mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Merge branch 'trunk' into PCP-1393-update-to-vault-v-3
# Conflicts: # modules/ppcp-api-client/services.php # modules/ppcp-wc-gateway/src/Processor/OrderProcessor.php # tests/PHPUnit/WcGateway/Processor/OrderProcessorTest.php
This commit is contained in:
commit
fb1ceeba76
27 changed files with 658 additions and 231 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;
|
||||
|
@ -106,7 +107,11 @@ class WcGatewayTest extends TestCase
|
|||
$this->paymentTokenRepository,
|
||||
$this->logger,
|
||||
$this->apiShopCountry,
|
||||
$this->orderEndpoint
|
||||
$this->orderEndpoint,
|
||||
function ($id) {
|
||||
return 'checkoutnow=' . $id;
|
||||
},
|
||||
'Pay via PayPal'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -204,13 +209,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);
|
||||
|
@ -223,7 +225,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