@@ -87,26 +87,17 @@ protected function handle_capture_status(
8787 // It is checked in the capture endpoint already, but there are other ways to capture,
8888 // such as when paid via saved card.
8989 case CaptureStatus::DECLINED :
90- $ fraud = $ capture ->fraud_processor_response ();
91- if ( $ fraud && $ fraud ->response_code () ) {
92- $ wc_order ->add_order_note (
93- sprintf (
94- /* translators: %s - processor response code and description */
95- __ ( 'PayPal payment declined. Processor response: %s ' , 'woocommerce-paypal-payments ' ),
96- $ fraud ->get_response_code_message ()
97- )
98- );
99- }
100- $ wc_order ->update_status (
101- 'failed ' ,
102- __ ( 'Could not capture the payment. ' , 'woocommerce-paypal-payments ' )
103- );
104- $ decline_message = ( $ fraud && $ fraud ->response_code () )
90+ $ fraud = $ capture ->fraud_processor_response ();
91+ $ status_note = ( $ fraud && $ fraud ->response_code () )
10592 ? sprintf (
10693 /* translators: %s - processor response code and description */
107- __ ( 'Payment declined by card processor: %s. Please use a different payment method or contact your bank. ' , 'woocommerce-paypal-payments ' ),
94+ __ ( 'Could not capture the payment. Processor response: %s ' , 'woocommerce-paypal-payments ' ),
10895 $ fraud ->get_response_code_message ()
10996 )
97+ : __ ( 'Could not capture the payment. ' , 'woocommerce-paypal-payments ' );
98+ $ wc_order ->update_status ( 'failed ' , $ status_note );
99+ $ decline_message = $ fraud
100+ ? $ fraud ->get_customer_decline_message ()
110101 : __ ( 'Payment provider declined the payment, please use a different payment method. ' , 'woocommerce-paypal-payments ' );
111102 throw new RuntimeException ( $ decline_message );
112103 case CaptureStatus::PENDING :
0 commit comments