Skip to content

Commit cd8132c

Browse files
committed
Improve logging for checkout action
1 parent f43eeee commit cd8132c

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

includes/class-wc-gateway-amazon-payments-advanced.php

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -691,20 +691,24 @@ public function process_payment( $order_id ) {
691691
$can_do_async = true;
692692
}
693693

694+
$payload = array(
695+
'paymentDetails' => array(
696+
'paymentIntent' => $payment_intent, // TODO: Check Authorize, and Confirm flows.
697+
'canHandlePendingAuthorization' => $can_do_async,
698+
// "softDescriptor" => "Descriptor", // TODO: Implement setting, if empty, don't set this. ONLY FOR AuthorizeWithCapture
699+
'chargeAmount' => array(
700+
'amount' => $order_total,
701+
'currencyCode' => $currency,
702+
),
703+
),
704+
'merchantMetadata' => WC_Amazon_Payments_Advanced_API::get_merchant_metadata( $order_id ),
705+
);
706+
707+
wc_apa()->log( __METHOD__, "Updating checkout session data for #{$order_id}. Checkout Session ID: {$checkout_session_id}.\n" . wp_json_encode( $payload, JSON_PRETTY_PRINT ) );
708+
694709
$response = WC_Amazon_Payments_Advanced_API::update_checkout_session_data(
695710
$checkout_session_id,
696-
array(
697-
'paymentDetails' => array(
698-
'paymentIntent' => $payment_intent, // TODO: Check Authorize, and Confirm flows.
699-
'canHandlePendingAuthorization' => $can_do_async,
700-
// "softDescriptor" => "Descriptor", // TODO: Implement setting, if empty, don't set this. ONLY FOR AuthorizeWithCapture
701-
'chargeAmount' => array(
702-
'amount' => $order_total,
703-
'currencyCode' => $currency,
704-
),
705-
),
706-
'merchantMetadata' => WC_Amazon_Payments_Advanced_API::get_merchant_metadata( $order_id ),
707-
)
711+
$payload
708712
);
709713

710714
if ( is_wp_error( $response ) ) {

0 commit comments

Comments
 (0)