mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-03 08:37:53 +08:00
Merge branch 'trunk' into PCP-412-when-there-is-a-payment-saved-th
This commit is contained in:
commit
ba7bea6fa6
23 changed files with 349 additions and 225 deletions
|
@ -136,7 +136,7 @@ class CheckoutOrderApproved implements RequestHandler {
|
|||
}
|
||||
|
||||
if ( $order->intent() === 'CAPTURE' ) {
|
||||
$this->order_endpoint->capture( $order );
|
||||
$order = $this->order_endpoint->capture( $order );
|
||||
}
|
||||
} catch ( RuntimeException $error ) {
|
||||
$message = sprintf(
|
||||
|
@ -187,23 +187,18 @@ class CheckoutOrderApproved implements RequestHandler {
|
|||
return rest_ensure_response( $response );
|
||||
}
|
||||
|
||||
$new_status = $order->intent() === 'CAPTURE' ? 'processing' : 'on-hold';
|
||||
$status_message = $order->intent() === 'CAPTURE' ?
|
||||
__( 'Payment received.', 'woocommerce-paypal-payments' )
|
||||
: __( 'Payment can be captured.', 'woocommerce-paypal-payments' );
|
||||
foreach ( $wc_orders as $wc_order ) {
|
||||
if ( ! in_array( $wc_order->get_status(), array( 'pending', 'on-hold' ), true ) ) {
|
||||
continue;
|
||||
}
|
||||
/**
|
||||
* The WooCommerce order.
|
||||
*
|
||||
* @var \WC_Order $wc_order
|
||||
*/
|
||||
$wc_order->update_status(
|
||||
$new_status,
|
||||
$status_message
|
||||
);
|
||||
if ( $order->intent() === 'CAPTURE' ) {
|
||||
$wc_order->payment_complete();
|
||||
} else {
|
||||
$wc_order->update_status(
|
||||
'on-hold',
|
||||
__( 'Payment can be captured.', 'woocommerce-paypal-payments' )
|
||||
);
|
||||
}
|
||||
$this->logger->log(
|
||||
'info',
|
||||
sprintf(
|
||||
|
|
|
@ -134,15 +134,7 @@ class CheckoutOrderCompleted implements RequestHandler {
|
|||
if ( ! in_array( $wc_order->get_status(), array( 'pending', 'on-hold' ), true ) ) {
|
||||
continue;
|
||||
}
|
||||
/**
|
||||
* The WooCommerce order.
|
||||
*
|
||||
* @var \WC_Order $wc_order
|
||||
*/
|
||||
$wc_order->update_status(
|
||||
'processing',
|
||||
__( 'Payment received.', 'woocommerce-paypal-payments' )
|
||||
);
|
||||
$wc_order->payment_complete();
|
||||
$this->logger->log(
|
||||
'info',
|
||||
sprintf(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue