diff --git a/modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php b/modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php index 7e974664c..adb0cd6f5 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php +++ b/modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php @@ -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(); diff --git a/modules/ppcp-wc-gateway/src/Processor/OrderProcessor.php b/modules/ppcp-wc-gateway/src/Processor/OrderProcessor.php index 22b06ae1a..af83f195c 100644 --- a/modules/ppcp-wc-gateway/src/Processor/OrderProcessor.php +++ b/modules/ppcp-wc-gateway/src/Processor/OrderProcessor.php @@ -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; }