Skip to content

Commit

Permalink
Fix the action of updating a payment intent with AJAX request
Browse files Browse the repository at this point in the history
  • Loading branch information
Timur Karimov committed Oct 13, 2022
1 parent 90a3829 commit e85f6cf
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
6 changes: 4 additions & 2 deletions client/checkout/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' ),
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion client/checkout/blocks/confirm-upe-payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() || '-';

Expand Down
1 change: 0 additions & 1 deletion includes/class-wc-payment-gateway-wcpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ),
Expand Down
2 changes: 1 addition & 1 deletion includes/payment-methods/class-upe-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
1 change: 0 additions & 1 deletion includes/wc-payment-api/class-wc-payments-api-client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down

0 comments on commit e85f6cf

Please sign in to comment.