Put declined payment message as the exception message

This commit is contained in:
dinamiko 2020-11-23 16:25:43 +01:00
parent adc00a7351
commit 947fda2473
2 changed files with 2 additions and 11 deletions

View file

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

View file

@ -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;
}