mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Add PayPal transaction id to order note
This commit is contained in:
parent
f454c60292
commit
d2f257a812
4 changed files with 20 additions and 6 deletions
|
@ -111,6 +111,11 @@ class PayPalApiException extends RuntimeException {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns response issues.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function issues(): array {
|
||||
return $this->response->issues ?? array();
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ trait ProcessPaymentTrait {
|
|||
if ( $error->has_detail( 'INSTRUMENT_DECLINED' ) ) {
|
||||
$wc_order->update_status(
|
||||
'failed',
|
||||
__( 'Instrument declined. ' . $error->details()[0]->description ?? '', 'woocommerce-paypal-payments' )
|
||||
__( 'Instrument declined. ', 'woocommerce-paypal-payments' ) . $error->details()[0]->description ?? ''
|
||||
);
|
||||
|
||||
$this->session_handler->increment_insufficient_funding_tries();
|
||||
|
@ -317,7 +317,7 @@ trait ProcessPaymentTrait {
|
|||
|
||||
$wc_order->update_status(
|
||||
'failed',
|
||||
__( 'Could not process order. ' . $this->order_processor->last_error() , 'woocommerce-paypal-payments' )
|
||||
__( 'Could not process order. ', 'woocommerce-paypal-payments' ) . $this->order_processor->last_error()
|
||||
);
|
||||
|
||||
return $failure_data;
|
||||
|
@ -362,7 +362,7 @@ trait ProcessPaymentTrait {
|
|||
|
||||
$wc_order->update_status(
|
||||
'failed',
|
||||
__( 'Could not process order. ' . $error->getMessage(), 'woocommerce-paypal-payments' )
|
||||
__( 'Could not process order. ', 'woocommerce-paypal-payments' ) . $error->getMessage()
|
||||
);
|
||||
|
||||
$this->session_handler->destroy_session_data();
|
||||
|
|
|
@ -36,6 +36,15 @@ trait TransactionIdHandlingTrait {
|
|||
try {
|
||||
$wc_order->set_transaction_id( $transaction_id );
|
||||
$wc_order->save();
|
||||
|
||||
$wc_order->add_order_note(
|
||||
sprintf(
|
||||
/* translators: %s is the PayPal transaction ID */
|
||||
__( 'PayPal transaction ID: %s', 'woocommerce-paypal-payments' ),
|
||||
$transaction_id
|
||||
)
|
||||
);
|
||||
|
||||
return true;
|
||||
} catch ( Exception $exception ) {
|
||||
if ( $logger ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue