Default to specific payment type if indicated

This commit is contained in:
Chloe Herd 2026-01-14 12:18:22 -05:00
parent 9fcff5dc2f
commit 061d5036b0
2 changed files with 32 additions and 3 deletions

View file

@ -84,6 +84,21 @@ export function mapAdyenToFmgPaymentMethod(adyenMethod) {
return match ?? paymentMethods.CREDIT_CARD; return match ?? paymentMethods.CREDIT_CARD;
} }
export function mapFmgToAdyenPaymentMethod(fmgMethod) {
const paymentMethodMap = {
[paymentMethods.CREDIT_CARD]: "scheme",
[paymentMethods.AFTERPAY]: "afterpaytouch",
[paymentMethods.PAYPAL]: "paypal",
[paymentMethods.APPLE_PAY]: "applepay",
[paymentMethods.PAY_NOW]: null,
[paymentMethods.PAY_LATER]: null,
};
const match = paymentMethodMap[fmgMethod];
return match;
}
export function generateCcToken(adyenSessionInfo) { export function generateCcToken(adyenSessionInfo) {
const order = store.getters.order; const order = store.getters.order;
const locationInfo = getLocationInfo(order); const locationInfo = getLocationInfo(order);

View file

@ -72,7 +72,7 @@ import { applicationConfig } from "@/constants/application-config";
import { paymentMethods } from "@/constants/payment-method-constants"; import { paymentMethods } from "@/constants/payment-method-constants";
import "@adyen/adyen-web/styles/adyen.css"; import "@adyen/adyen-web/styles/adyen.css";
import { mapAdyenToFmgPaymentMethod } from "../../helpers/adyen-helper"; import { mapAdyenToFmgPaymentMethod, mapFmgToAdyenPaymentMethod } from "../../helpers/adyen-helper";
import { showFmgLoadingModal } from "../../helpers/loading-modal-helper"; import { showFmgLoadingModal } from "../../helpers/loading-modal-helper";
import cart from "@/fmg-components/cart/cart"; import cart from "@/fmg-components/cart/cart";
import { coverageStatus } from "@/constants/insurance"; import { coverageStatus } from "@/constants/insurance";
@ -289,7 +289,7 @@ export default {
console.log(checkout); console.log(checkout);
const dropin = new Dropin(checkout, { const configuration = {
paymentMethodsConfiguration: { paymentMethodsConfiguration: {
ideal: { ideal: {
showImage: true, showImage: true,
@ -311,7 +311,17 @@ export default {
name: "Credit or debit card", name: "Credit or debit card",
}, },
}, },
}); };
const adyenPaymentType = mapFmgToAdyenPaymentMethod(this.piaType);
if (adyenPaymentType) {
configuration.openPaymentMethod = {
type: adyenPaymentType
};
}
const dropin = new Dropin(checkout, configuration);
this.dropinComponent = dropin; this.dropinComponent = dropin;
@ -493,6 +503,10 @@ export default {
}, },
computed: { computed: {
piaType() {
return this.$store.getters.order.payment.piaType;
},
adyenInitRequestInfo() { adyenInitRequestInfo() {
return { return {
sourceSystem: this.sourceSystem, sourceSystem: this.sourceSystem,