Skip to content

Commit

Permalink
Get filtered express checkout payment methods
Browse files Browse the repository at this point in the history
AD4CR22I-9
  • Loading branch information
Tamara committed Jan 9, 2025
1 parent 01eafec commit fd05fe6
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,19 @@ export default class ExpressCheckoutPlugin extends Plugin {
return;
}

let availableTypes = [];
let paymentMethods = data.paymentMethodsResponse.paymentMethods || [];
for (let i = 0; i < paymentMethods.length; i++) {
availableTypes[i] = paymentMethods[i].type;
}

for (let i = 0; i < checkoutElements.length; i++) {
let type = checkoutElements[i].getElementsByClassName('adyen-type')[0].value;
this.initializeCheckoutComponent(data).then(function (checkoutInstance) {
this.mountElement(type, checkoutInstance, checkoutElements[i]);
}.bind(this));
if (availableTypes.includes(type)){
this.initializeCheckoutComponent(data).then(function (checkoutInstance) {
this.mountElement(type, checkoutInstance, checkoutElements[i]);
}.bind(this));
}
}
}

Expand Down

0 comments on commit fd05fe6

Please sign in to comment.