Skip to content

Commit

Permalink
Consolidates Stripe intent next action handler selection
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissrogers committed Dec 11, 2024
1 parent 3642335 commit cc28ebf
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/recurly/risk/three-d-secure/strategy/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,12 @@ export default class StripeStrategy extends ThreeDSecureStrategy {
};
const handleError = err => this.threeDSecure.error('3ds-auth-error', { cause: err });

(() => (
isPaymentIntent
? this.stripe.handleNextAction({ clientSecret: this.stripeClientSecret })
: this.stripe.confirmCardSetup(this.stripeClientSecret)
))()
this.stripe.handleNextAction({ clientSecret: this.stripeClientSecret })
.then(handleResult)
.catch(err => {
// Handle a Payment Intent which has already had its action handled and succeeded
if (err.name === 'IntegrationError') {
return this.stripe.retrievePaymentIntent(this.stripeClientSecret)
return this.stripe[isPaymentIntent ? 'retrievePaymentIntent' : 'retrieveSetupIntent'](this.stripeClientSecret)
.then(result => {
if (result.error) {
throw result.error;
Expand Down

0 comments on commit cc28ebf

Please sign in to comment.