mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Create order and redirect when no order
This commit is contained in:
parent
5c699c24a5
commit
a61e9303e9
10 changed files with 214 additions and 131 deletions
|
@ -3,6 +3,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\Gateway;
|
||||
|
||||
use Exception;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
|
||||
|
@ -207,13 +208,10 @@ class WcGatewayTest extends TestCase
|
|||
public function testProcessPaymentFails() {
|
||||
$orderId = 1;
|
||||
$wcOrder = Mockery::mock(\WC_Order::class);
|
||||
$lastError = 'some-error';
|
||||
$error = 'some-error';
|
||||
$this->orderProcessor
|
||||
->expects('process')
|
||||
->andReturnFalse();
|
||||
$this->orderProcessor
|
||||
->expects('last_error')
|
||||
->andReturn($lastError);
|
||||
->andThrow(new Exception($error));
|
||||
$this->subscriptionHelper->shouldReceive('has_subscription')->with($orderId)->andReturn(true);
|
||||
$this->subscriptionHelper->shouldReceive('is_subscription_change_payment')->andReturn(true);
|
||||
$wcOrder->shouldReceive('update_status')->andReturn(true);
|
||||
|
@ -226,7 +224,7 @@ class WcGatewayTest extends TestCase
|
|||
$this->sessionHandler
|
||||
->shouldReceive('destroy_session_data');
|
||||
expect('wc_add_notice')
|
||||
->with($lastError, 'error');
|
||||
->with($error, 'error');
|
||||
|
||||
$redirectUrl = 'http://example.com/checkout';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue