Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequential Preflight Calls #749

Merged
merged 4 commits into from
Sep 15, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix return value from promise for empty preflights
  • Loading branch information
isaacvance1027 committed Sep 15, 2022
commit 11d414725e84826475bfdae73c4da7863587aa47
10 changes: 4 additions & 6 deletions lib/recurly/risk/three-d-secure/three-d-secure.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,17 @@ export class ThreeDSecure extends RiskConcern {
* @return {Promise}
*/
static preflight ({ recurly, number, month, year, preflights }) {
const finished_preflights = [];
return preflights.reduce((preflight, result) => {
return preflight.then(() => {
return preflight.then((finishedPreflights) => {
const { type } = result.gateway;
const { gateway_code } = result.params;
const strategy = ThreeDSecure.getStrategyForGatewayType(type);
return strategy.preflight({ recurly, number, month, year, ...result.params })
.then(results =>{
finished_preflights.push({ processor: type, gateway_code, results });
return finished_preflights;
.then(results => {
return finishedPreflights.concat([{ processor: type, gateway_code, results }]);
});
});
}, Promise.resolve());
}, Promise.resolve([]));
}

constructor ({ risk, actionTokenId }) {
Expand Down