mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add process order error messages
This commit is contained in:
parent
fc5589612c
commit
74490c40c9
2 changed files with 5 additions and 3 deletions
|
@ -277,7 +277,7 @@ trait ProcessPaymentTrait {
|
|||
if ( $error->has_detail( 'INSTRUMENT_DECLINED' ) ) {
|
||||
$wc_order->update_status(
|
||||
'failed',
|
||||
__( 'Instrument declined.', 'woocommerce-paypal-payments' )
|
||||
__( 'Instrument declined. ' . $error->details()[0]->description ?? '', 'woocommerce-paypal-payments' )
|
||||
);
|
||||
|
||||
$this->session_handler->increment_insufficient_funding_tries();
|
||||
|
@ -308,9 +308,10 @@ trait ProcessPaymentTrait {
|
|||
$this->order_processor->last_error(),
|
||||
'error'
|
||||
);
|
||||
|
||||
$wc_order->update_status(
|
||||
'failed',
|
||||
__( 'Could not process order.', 'woocommerce-paypal-payments' )
|
||||
__( 'Could not process order. ' . $this->order_processor->last_error() , 'woocommerce-paypal-payments' )
|
||||
);
|
||||
|
||||
return $failure_data;
|
||||
|
@ -355,7 +356,7 @@ trait ProcessPaymentTrait {
|
|||
|
||||
$wc_order->update_status(
|
||||
'failed',
|
||||
__( 'Could not process order.', 'woocommerce-paypal-payments' )
|
||||
__( 'Could not process order. ' . $error->getMessage(), 'woocommerce-paypal-payments' )
|
||||
);
|
||||
|
||||
$this->session_handler->destroy_session_data();
|
||||
|
|
|
@ -141,6 +141,7 @@ class OrderProcessor {
|
|||
public function process( \WC_Order $wc_order ): bool {
|
||||
$order = $this->session_handler->order();
|
||||
if ( ! $order ) {
|
||||
$this->last_error = __('No PayPal order found in the current WooCommerce session.', 'woocommerce-paypal-payments');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue