From b46427bac1b0fe936d3d1662fcc857c99ddfb529 Mon Sep 17 00:00:00 2001 From: Christopher Rogers Date: Thu, 21 Nov 2024 13:39:21 -0800 Subject: [PATCH] Uses stripe.handleNextAction for payment intents --- .../risk/three-d-secure/strategy/stripe.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/recurly/risk/three-d-secure/strategy/stripe.js b/lib/recurly/risk/three-d-secure/strategy/stripe.js index 9cfe639c5..06692f87e 100644 --- a/lib/recurly/risk/three-d-secure/strategy/stripe.js +++ b/lib/recurly/risk/three-d-secure/strategy/stripe.js @@ -40,15 +40,20 @@ export default class StripeStrategy extends ThreeDSecureStrategy { this.whenReady(() => { const isPaymentIntent = this.stripeClientSecret.indexOf('pi') === 0; - const handleAction = isPaymentIntent ? this.stripe.handleCardAction : this.stripe.confirmCardSetup; - handleAction(this.stripeClientSecret).then(result => { - if (result.error) { - throw result.error; - } - const { id } = result.paymentIntent || result.setupIntent; - this.emit('done', { id }); - }).catch(err => this.threeDSecure.error('3ds-auth-error', { cause: err })); + (() => ( + isPaymentIntent + ? this.stripe.handleNextAction({ clientSecret: this.stripeClientSecret }) + : this.stripe.confirmCardSetup(this.stripeClientSecret) + ))() + .then(result => { + if (result.error) { + throw result.error; + } + const { id } = result.paymentIntent || result.setupIntent; + this.emit('done', { id }); + }) + .catch(err => this.threeDSecure.error('3ds-auth-error', { cause: err })); }); }