mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Put declined payment message as the exception message
This commit is contained in:
parent
adc00a7351
commit
947fda2473
2 changed files with 2 additions and 11 deletions
|
@ -334,13 +334,7 @@ class OrderEndpoint {
|
|||
|
||||
$purchase_units_payments_captures_status = $order->purchase_units()[0]->payments()->captures()[0]->status() ?? '';
|
||||
if ( $purchase_units_payments_captures_status && 'DECLINED' === $purchase_units_payments_captures_status ) {
|
||||
throw new RuntimeException(
|
||||
sprintf(
|
||||
// translators: %s is the purchase units payments captures status value.
|
||||
__( 'Purchase units payments captures status %s', 'woocommerce-paypal-payments' ),
|
||||
$purchase_units_payments_captures_status
|
||||
)
|
||||
);
|
||||
throw new RuntimeException( __( 'Payment provider declined the payment, please use a different payment method.', 'woocommerce-paypal-payments' ) );
|
||||
}
|
||||
|
||||
return $order;
|
||||
|
|
|
@ -74,10 +74,7 @@ trait ProcessPaymentTrait {
|
|||
$this->session_handler->destroy_session_data();
|
||||
} catch ( RuntimeException $error ) {
|
||||
$this->session_handler->destroy_session_data();
|
||||
wc_add_notice(
|
||||
__( 'Payment provider declined the payment, please use a different payment method.', 'woocommerce-paypal-payments' ),
|
||||
'error'
|
||||
);
|
||||
wc_add_notice( $error->getMessage(), 'error' );
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue