mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Merge remote-tracking branch 'origin/trunk' into PCP-915-create-pay-later-tab
# Conflicts: # modules/ppcp-button/services.php
This commit is contained in:
commit
e189325766
46 changed files with 1029 additions and 207 deletions
|
@ -166,6 +166,7 @@ class CreateOrderEndpointTest extends TestCase
|
|||
$early_order_handler,
|
||||
false,
|
||||
CardBillingMode::MINIMAL_INPUT,
|
||||
false,
|
||||
new NullLogger()
|
||||
);
|
||||
return array($payer_factory, $testee);
|
||||
|
|
|
@ -52,7 +52,7 @@ class PaymentTokenRepositoryTest extends TestCase
|
|||
{
|
||||
$id = 1;
|
||||
$source = new \stdClass();
|
||||
$paymentToken = new PaymentToken('foo', 'PAYMENT_METHOD_TOKEN', $source);
|
||||
$paymentToken = new PaymentToken('foo', $source, 'PAYMENT_METHOD_TOKEN');
|
||||
|
||||
when('get_user_meta')->justReturn([]);
|
||||
$this->endpoint->shouldReceive('for_user')
|
||||
|
|
|
@ -70,12 +70,15 @@ class VaultedCreditCardHandlerTest extends TestCase
|
|||
|
||||
public function testHandlePaymentChangingPayment()
|
||||
{
|
||||
when('filter_input')->justReturn(1);
|
||||
$_POST['woocommerce_change_payment'] = 1;
|
||||
$wcOrder = Mockery::mock(\WC_Order::class);
|
||||
$wcOrder->shouldReceive('get_id')->andReturn(1);
|
||||
$wcOrder->shouldReceive('update_meta_data')
|
||||
->with('payment_token_id', 'abc123')
|
||||
->andReturn(1);
|
||||
$wcOrder->shouldReceive('save')->andReturn(1);
|
||||
$this->subscriptionHelper->shouldReceive('has_subscription')->andReturn(true);
|
||||
$this->subscriptionHelper->shouldReceive('is_subscription_change_payment')->andReturn(true);
|
||||
expect('update_post_meta')->with(1, 'payment_token_id', 'abc123');
|
||||
|
||||
$customer = Mockery::mock(WC_Customer::class);
|
||||
|
||||
|
@ -85,6 +88,8 @@ class VaultedCreditCardHandlerTest extends TestCase
|
|||
|
||||
public function testHandlePayment()
|
||||
{
|
||||
$_POST['woocommerce_change_payment'] = null;
|
||||
|
||||
$wcOrder = Mockery::mock(\WC_Order::class);
|
||||
$wcOrder->shouldReceive('get_id')->andReturn(1);
|
||||
$wcOrder->shouldReceive('get_customer_id')->andReturn(1);
|
||||
|
|
|
@ -55,6 +55,8 @@ class CreditCardGatewayTest extends TestCase
|
|||
$this->config->shouldReceive('has')->andReturn(true);
|
||||
$this->config->shouldReceive('get')->andReturn('');
|
||||
|
||||
when('wc_clean')->returnArg();
|
||||
|
||||
$this->testee = new CreditCardGateway(
|
||||
$this->settingsRenderer,
|
||||
$this->orderProcessor,
|
||||
|
@ -94,7 +96,7 @@ class CreditCardGatewayTest extends TestCase
|
|||
when('wc_get_order')->justReturn($wc_order);
|
||||
|
||||
$savedCreditCard = 'abc123';
|
||||
when('filter_input')->justReturn($savedCreditCard);
|
||||
$_POST['saved_credit_card'] = $savedCreditCard;
|
||||
|
||||
$this->vaultedCreditCardHandler
|
||||
->shouldReceive('handle_payment')
|
||||
|
|
|
@ -11,10 +11,12 @@ use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Environment;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\TestCase;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CheckoutHelper;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\PayUponInvoiceHelper;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
|
||||
use function Brain\Monkey\Functions\when;
|
||||
|
||||
class PayUponInvoiceGatewayTest extends TestCase
|
||||
|
@ -28,6 +30,8 @@ class PayUponInvoiceGatewayTest extends TestCase
|
|||
private $testee;
|
||||
private $pui_helper;
|
||||
private $checkout_helper;
|
||||
private $state;
|
||||
private $refund_processor;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
|
@ -42,7 +46,13 @@ class PayUponInvoiceGatewayTest extends TestCase
|
|||
$this->pui_helper = Mockery::mock(PayUponInvoiceHelper::class);
|
||||
$this->checkout_helper = Mockery::mock(CheckoutHelper::class);
|
||||
|
||||
$this->state = Mockery::mock(State::class);
|
||||
$this->state->shouldReceive('current_state')->andReturn(State::STATE_ONBOARDED);
|
||||
|
||||
$this->refund_processor = Mockery::mock(RefundProcessor::class);
|
||||
|
||||
$this->setInitStubs();
|
||||
when('wc_clean')->returnArg();
|
||||
|
||||
$this->testee = new PayUponInvoiceGateway(
|
||||
$this->order_endpoint,
|
||||
|
@ -52,7 +62,9 @@ class PayUponInvoiceGatewayTest extends TestCase
|
|||
$this->transaction_url_provider,
|
||||
$this->logger,
|
||||
$this->pui_helper,
|
||||
$this->checkout_helper
|
||||
$this->checkout_helper,
|
||||
$this->state,
|
||||
$this->refund_processor
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ class WcGatewayTest extends TestCase
|
|||
expect('is_admin')->andReturnUsing(function () {
|
||||
return $this->isAdmin;
|
||||
});
|
||||
when('wc_clean')->returnArg();
|
||||
|
||||
$this->settingsRenderer = Mockery::mock(SettingsRenderer::class);
|
||||
$this->orderProcessor = Mockery::mock(OrderProcessor::class);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue