Skip to content

Commit

Permalink
Merge pull request #653 from recurly/support_setup_intents_on_3ds2
Browse files Browse the repository at this point in the history
Support setup intents on 3ds2
  • Loading branch information
chrissrogers committed Nov 18, 2020
2 parents a704be1 + f88d220 commit 2964da2
Show file tree
Hide file tree
Showing 6 changed files with 597 additions and 251 deletions.
9 changes: 6 additions & 3 deletions lib/recurly/risk/three-d-secure/strategy/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,21 @@ export default class StripeStrategy extends ThreeDSecureStrategy {
super.attach(element);

this.whenReady(() => {
this.stripe.handleCardAction(this.stripeClientSecret).then(result => {
const isPaymentIntent = this.stripeClientSecret.indexOf('pi') === 0;
const handleAction = isPaymentIntent ? this.stripe.handleCardAction : this.stripe.confirmCardSetup;

handleAction(this.stripeClientSecret).then(result => {
if (result.error) {
return this.threeDSecure.error('3ds-auth-error', { cause: result.error });
}
const { id } = result.paymentIntent;
const { id } = result.paymentIntent || result.setupIntent;
this.emit('done', { id });
});
});
}

/**
* Loads Adyen library dependency
* Loads Stripe library dependency
*/
loadStripeLibrary () {
return new Promise((resolve, reject) => {
Expand Down

0 comments on commit 2964da2

Please sign in to comment.