mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 06:52:50 +08:00
Add update status note for capture denied
This commit is contained in:
parent
51001c388e
commit
e1cd7d5ad1
3 changed files with 16 additions and 9 deletions
|
@ -5,8 +5,8 @@ document.addEventListener(
|
|||
if(data.payer_action && data.payer_action !== '') {
|
||||
const width = screen.width / 2;
|
||||
const height = screen.height / 2;
|
||||
const left = (screen.width / 2) - (width / 2);
|
||||
const top = (screen.height / 2) - (height / 2);
|
||||
const left = width - (width / 2);
|
||||
const top = height - (height / 2);
|
||||
window.open(
|
||||
data.payer_action,
|
||||
'_blank',
|
||||
|
|
|
@ -113,14 +113,16 @@ class OXXO {
|
|||
);
|
||||
|
||||
add_filter(
|
||||
'woocommerce_available_payment_gateways',
|
||||
function( $available_gateways ) {
|
||||
if ( array_key_exists( OXXOGateway::ID, $available_gateways ) ) {
|
||||
$available_gateways[ OXXOGateway::ID ]->order_button_text = __( 'Pay with OXXO', 'woocommerce-paypal-payments' );
|
||||
'ppcp_payment_capture_reversed_webhook_update_status_note',
|
||||
function( $note, $wc_order, $event_type ) {
|
||||
if ( $wc_order->get_payment_method() === OXXOGateway::ID && $event_type === 'PAYMENT.CAPTURE.DENIED' ) {
|
||||
$note = __( 'OXXO voucher has expired or the buyer didn\'t complete the payment successfully.', 'woocommerce-paypal-payments' );
|
||||
}
|
||||
|
||||
return $available_gateways;
|
||||
}
|
||||
return $note;
|
||||
},
|
||||
10,
|
||||
2
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -112,12 +112,17 @@ class PaymentCaptureReversed implements RequestHandler {
|
|||
return rest_ensure_response( $response );
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows adding an update status note.
|
||||
*/
|
||||
$note = apply_filters( 'ppcp_payment_capture_reversed_webhook_update_status_note', '', $wc_order, $request['event_type'] );
|
||||
|
||||
/**
|
||||
* The WooCommerce order.
|
||||
*
|
||||
* @var \WC_Order $wc_order
|
||||
*/
|
||||
$response['success'] = (bool) $wc_order->update_status( 'cancelled' );
|
||||
$response['success'] = (bool) $wc_order->update_status( 'cancelled', $note );
|
||||
|
||||
$message = $response['success'] ? sprintf(
|
||||
// translators: %1$s is the order id.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue