Merge pull request #3012 from Safelite/feature/CASH-2108

Default to specific payment type if indicated
This commit is contained in:
chloeherdsafelite 2026-01-14 13:42:11 -05:00 committed by GitHub
commit 2d5fd43930
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 3 deletions

View file

@ -84,6 +84,21 @@ export function mapAdyenToFmgPaymentMethod(adyenMethod) {
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.LATER]: null,
};
const match = paymentMethodMap[fmgMethod];
return match;
}
export function generateCcToken(adyenSessionInfo) {
const order = store.getters.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 "@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 cart from "@/fmg-components/cart/cart";
import { coverageStatus } from "@/constants/insurance";
@ -289,7 +289,7 @@ export default {
console.log(checkout);
const dropin = new Dropin(checkout, {
const configuration = {
paymentMethodsConfiguration: {
ideal: {
showImage: true,
@ -311,7 +311,17 @@ export default {
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;
@ -493,6 +503,10 @@ export default {
},
computed: {
piaType() {
return this.$store.getters.order.payment.piaType;
},
adyenInitRequestInfo() {
return {
sourceSystem: this.sourceSystem,