From e85f6cf5eb656c25b8a03f2827f7746ba8ee8245 Mon Sep 17 00:00:00 2001 From: Timur Karimov Date: Thu, 13 Oct 2022 13:58:21 +0200 Subject: [PATCH] Fix the action of updating a payment intent with AJAX request --- client/checkout/api/index.js | 6 ++++-- client/checkout/blocks/confirm-upe-payment.js | 1 - includes/class-wc-payment-gateway-wcpay.php | 1 - includes/payment-methods/class-upe-payment-gateway.php | 2 +- includes/wc-payment-api/class-wc-payments-api-client.php | 1 - 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/client/checkout/api/index.js b/client/checkout/api/index.js index e149ee2dcf3..bda8cde9a81 100644 --- a/client/checkout/api/index.js +++ b/client/checkout/api/index.js @@ -392,7 +392,6 @@ export default class WCPayAPI { * @return {Promise} The final promise for the request to the server. */ createIntent( paymentMethodType, orderId ) { - console.log( paymentMethodType ); return this.request( buildAjaxURL( getConfig( 'wcAjaxUrl' ), @@ -438,7 +437,10 @@ export default class WCPayAPI { paymentCountry ) { return this.request( - buildAjaxURL( getConfig( 'wcAjaxUrl' ), 'update_payment_intent' ), + buildAjaxURL( + getConfig( 'wcAjaxUrl' ), + `update_payment_intent_${ selectedUPEPaymentType }` + ), { wcpay_order_id: orderId, wc_payment_intent_id: paymentIntentId, diff --git a/client/checkout/blocks/confirm-upe-payment.js b/client/checkout/blocks/confirm-upe-payment.js index fa155346e8e..aeaff54750c 100644 --- a/client/checkout/blocks/confirm-upe-payment.js +++ b/client/checkout/blocks/confirm-upe-payment.js @@ -17,7 +17,6 @@ export default async function confirmUPEPayment( billingData, emitResponse ) { - console.log( 'we are confirming the UPE payment right now' ); const name = `${ billingData.first_name } ${ billingData.last_name }`.trim() || '-'; diff --git a/includes/class-wc-payment-gateway-wcpay.php b/includes/class-wc-payment-gateway-wcpay.php index f2f72cad41a..b12caef8f9a 100644 --- a/includes/class-wc-payment-gateway-wcpay.php +++ b/includes/class-wc-payment-gateway-wcpay.php @@ -1299,7 +1299,6 @@ public function process_payment_for_order( $cart, $payment_information, $additio $intent = $this->payments_api_client->get_intent( $platform_checkout_intent_id ); $intent_meta_order_id_raw = $intent->get_metadata()['order_id'] ?? ''; $intent_meta_order_id = is_numeric( $intent_meta_order_id_raw ) ? intval( $intent_meta_order_id_raw ) : 0; - Logger::info( 'harris debug: ' . $intent_meta_order_id . "---" . $order_id); if ( $intent_meta_order_id !== $order_id ) { throw new Intent_Authentication_Exception( __( "We're not able to process this payment. Please try again later.", 'woocommerce-payments' ), diff --git a/includes/payment-methods/class-upe-payment-gateway.php b/includes/payment-methods/class-upe-payment-gateway.php index 17f4ee55ebc..cb4142d3e15 100644 --- a/includes/payment-methods/class-upe-payment-gateway.php +++ b/includes/payment-methods/class-upe-payment-gateway.php @@ -98,7 +98,7 @@ public function __construct( $this->title = $payment_method->get_title(); add_action( "wc_ajax_wcpay_create_payment_intent_$this->stripe_id", [ $this, 'create_payment_intent_ajax' ] ); - add_action( "wc_ajax_wcpay_update_payment_inten_ $this->stripe_id", [ $this, 'update_payment_intent_ajax' ] ); + add_action( "wc_ajax_wcpay_update_payment_intent_$this->stripe_id", [ $this, 'update_payment_intent_ajax' ] ); add_action( "wc_ajax_wcpay_init_setup_intent_$this->stripe_id", [ $this, 'init_setup_intent_ajax' ] ); if ( 'card' !== $this->stripe_id ) { diff --git a/includes/wc-payment-api/class-wc-payments-api-client.php b/includes/wc-payment-api/class-wc-payments-api-client.php index 17a01e3be50..de3e672b8a6 100644 --- a/includes/wc-payment-api/class-wc-payments-api-client.php +++ b/includes/wc-payment-api/class-wc-payments-api-client.php @@ -2108,7 +2108,6 @@ protected function request( $params, $api, $method, $is_site_specific = true, $u */ private function request_with_level3_data( $params, $api, $method, $is_site_specific = true ) { // If level3 data is not present for some reason, simply proceed normally. - Logger::error('harris debug' . json_encode($params)); if ( empty( $params['level3'] ) || ! is_array( $params['level3'] ) ) { return $this->request( $params, $api, $method, $is_site_specific ); }