mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
Merge pull request #145 from woocommerce/fix/PCP-109-wrong-order-status-virtual-downloadable
Wrong order status for orders with contain only products which are both virtual and downloadable
This commit is contained in:
commit
13d681f1cc
5 changed files with 10 additions and 16 deletions
|
@ -216,10 +216,9 @@ class PayPalGateway extends \WC_Payment_Gateway {
|
||||||
$wc_order->add_order_note(
|
$wc_order->add_order_note(
|
||||||
__( 'Payment successfully captured.', 'woocommerce-paypal-payments' )
|
__( 'Payment successfully captured.', 'woocommerce-paypal-payments' )
|
||||||
);
|
);
|
||||||
|
|
||||||
$wc_order->set_status( 'processing' );
|
|
||||||
$wc_order->update_meta_data( self::CAPTURED_META_KEY, 'true' );
|
$wc_order->update_meta_data( self::CAPTURED_META_KEY, 'true' );
|
||||||
$wc_order->save();
|
$wc_order->save();
|
||||||
|
$wc_order->payment_complete();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,11 +227,11 @@ class PayPalGateway extends \WC_Payment_Gateway {
|
||||||
$wc_order->add_order_note(
|
$wc_order->add_order_note(
|
||||||
__( 'Payment successfully captured.', 'woocommerce-paypal-payments' )
|
__( 'Payment successfully captured.', 'woocommerce-paypal-payments' )
|
||||||
);
|
);
|
||||||
$wc_order->set_status( 'processing' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$wc_order->update_meta_data( self::CAPTURED_META_KEY, 'true' );
|
$wc_order->update_meta_data( self::CAPTURED_META_KEY, 'true' );
|
||||||
$wc_order->save();
|
$wc_order->save();
|
||||||
|
$wc_order->payment_complete();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -176,10 +176,8 @@ class OrderProcessor {
|
||||||
__( 'Awaiting payment.', 'woocommerce-paypal-payments' )
|
__( 'Awaiting payment.', 'woocommerce-paypal-payments' )
|
||||||
);
|
);
|
||||||
if ( $order->status()->is( OrderStatus::COMPLETED ) && $order->intent() === 'CAPTURE' ) {
|
if ( $order->status()->is( OrderStatus::COMPLETED ) && $order->intent() === 'CAPTURE' ) {
|
||||||
$wc_order->update_status(
|
|
||||||
'processing',
|
$wc_order->payment_complete();
|
||||||
__( 'Payment received.', 'woocommerce-paypal-payments' )
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $this->capture_authorized_downloads( $order ) && $this->authorized_payments_processor->process( $wc_order ) ) {
|
if ( $this->capture_authorized_downloads( $order ) && $this->authorized_payments_processor->process( $wc_order ) ) {
|
||||||
|
|
|
@ -117,7 +117,7 @@ class PaymentCaptureCompleted implements RequestHandler {
|
||||||
__( 'Payment successfully captured.', 'woocommerce-paypal-payments' )
|
__( 'Payment successfully captured.', 'woocommerce-paypal-payments' )
|
||||||
);
|
);
|
||||||
|
|
||||||
$wc_order->set_status( 'processing' );
|
$wc_order->payment_complete();
|
||||||
$wc_order->update_meta_data( PayPalGateway::CAPTURED_META_KEY, 'true' );
|
$wc_order->update_meta_data( PayPalGateway::CAPTURED_META_KEY, 'true' );
|
||||||
$wc_order->save();
|
$wc_order->save();
|
||||||
$this->logger->log(
|
$this->logger->log(
|
||||||
|
|
|
@ -191,12 +191,11 @@ class WcGatewayTest extends TestCase
|
||||||
$wcOrder = Mockery::mock(\WC_Order::class);
|
$wcOrder = Mockery::mock(\WC_Order::class);
|
||||||
$wcOrder
|
$wcOrder
|
||||||
->expects('add_order_note');
|
->expects('add_order_note');
|
||||||
$wcOrder
|
|
||||||
->expects('set_status')
|
|
||||||
->with('processing');
|
|
||||||
$wcOrder
|
$wcOrder
|
||||||
->expects('update_meta_data')
|
->expects('update_meta_data')
|
||||||
->with(PayPalGateway::CAPTURED_META_KEY, 'true');
|
->with(PayPalGateway::CAPTURED_META_KEY, 'true');
|
||||||
|
$wcOrder
|
||||||
|
->expects('payment_complete');
|
||||||
$wcOrder
|
$wcOrder
|
||||||
->expects('save');
|
->expects('save');
|
||||||
$settingsRenderer = Mockery::mock(SettingsRenderer::class);
|
$settingsRenderer = Mockery::mock(SettingsRenderer::class);
|
||||||
|
@ -247,12 +246,11 @@ class WcGatewayTest extends TestCase
|
||||||
->andReturn('on-hold');
|
->andReturn('on-hold');
|
||||||
$wcOrder
|
$wcOrder
|
||||||
->expects('add_order_note');
|
->expects('add_order_note');
|
||||||
$wcOrder
|
|
||||||
->expects('set_status')
|
|
||||||
->with('processing');
|
|
||||||
$wcOrder
|
$wcOrder
|
||||||
->expects('update_meta_data')
|
->expects('update_meta_data')
|
||||||
->with(PayPalGateway::CAPTURED_META_KEY, 'true');
|
->with(PayPalGateway::CAPTURED_META_KEY, 'true');
|
||||||
|
$wcOrder
|
||||||
|
->expects('payment_complete');
|
||||||
$wcOrder
|
$wcOrder
|
||||||
->expects('save');
|
->expects('save');
|
||||||
$settingsRenderer = Mockery::mock(SettingsRenderer::class);
|
$settingsRenderer = Mockery::mock(SettingsRenderer::class);
|
||||||
|
|
|
@ -272,8 +272,7 @@ class OrderProcessorTest extends TestCase
|
||||||
$wcOrder->expects('set_transaction_id')
|
$wcOrder->expects('set_transaction_id')
|
||||||
->with($transactionId);
|
->with($transactionId);
|
||||||
$wcOrder
|
$wcOrder
|
||||||
->expects('update_status')
|
->expects('payment_complete');
|
||||||
->with('processing', 'Payment received.');
|
|
||||||
$this->assertTrue($testee->process($wcOrder));
|
$this->assertTrue($testee->process($wcOrder));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue