call payment_complete() instead of update status

This commit is contained in:
Kirill Braslavsky 2021-04-14 16:34:14 +03:00
parent d257b270df
commit 4ee48de635
3 changed files with 5 additions and 8 deletions

View file

@ -215,10 +215,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;
} }
@ -227,11 +226,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;

View file

@ -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 ) ) {

View file

@ -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(