Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
gilv93 committed Sep 17, 2024
1 parent d2ff39d commit 2173459
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions lib/recurly/alternative-payment-methods/gateways/adyen.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isBindingElement } from 'typescript';
import Base from './base';

class AdyenGateway extends Base {
Expand Down
10 changes: 9 additions & 1 deletion lib/recurly/risk/risk.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class Risk {
* @return {Promise}
*/
static preflight ({ recurly, number, month, year, cvv }) {
return recurly.request.get({ route: '/risk/preflights' })
return recurly.request.get({ route: Risk.resolveRoute(recurly) })
.then(({ preflights }) => {
debug('received preflight instructions', preflights);
return ThreeDSecure.preflight({ recurly, number, month, year, cvv, preflights });
Expand All @@ -70,6 +70,14 @@ export class Risk {
}));
}

static resolveRoute (recurly) {
let route = '/risk/preflights'
if (recurly.config.risk.threeDSecure.proactive.enabled) {
route += `?proactive=true&gatewayCode=${recurly.config.risk.threeDSecure.proactive.gateway_code}`
}
return route;
}

constructor ({ recurly }) {
this.recurly = recurly;
this.concerns = [];
Expand Down
5 changes: 3 additions & 2 deletions lib/recurly/risk/three-d-secure/strategy/braintree.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ export default class BraintreeStrategy extends ThreeDSecureStrategy {
.then(({ paymentMethodNonce, clientToken, bin }) => ({
payment_method_nonce: paymentMethodNonce,
client_token: clientToken,
bin
bin,
proactive: true
}));
}
}


constructor (...args) {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/recurly.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ describe('Recurly', function () {
});
});

describe.only('when proactive3ds', function () {
describe('when proactive3ds', function () {
describe('is set to true', function() {
it('returns true', function () {
const recurly = initRecurly({
Expand Down
4 changes: 2 additions & 2 deletions test/unit/token.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Recurly } from '../../lib/recurly';
import { applyFixtures } from './support/fixtures';
import { initRecurly, testBed } from './support/helpers';

describe(`Recurly.token`, function () {
describe.only(`Recurly.token`, function () {
// Some of these tests can take a while to stand up fields and receive reponses
this.timeout(15000);

Expand Down Expand Up @@ -317,7 +317,7 @@ describe(`Recurly.token`, function () {
});
});

describe('when given an invalid json response', function () {
describe.only('when given an invalid json response', function () {
prepareExample(Object.assign({}, valid, {
number: '5454545454545454'
}), builder);
Expand Down

0 comments on commit 2173459

Please sign in to comment.