This commit is contained in:
Chloe Herd 2025-12-15 10:17:57 -05:00
parent 75417c4a34
commit a8453c76ae

View file

@ -46,6 +46,7 @@ import baseMixin from "@/mixins/base-mixin.js";
import { storeActions } from "@/constants/store-actions";
import { getAmountDue } from "@/helpers/pricing-helper.js";
import { submitWorkOrder } from "@/helpers/heritage-integration/order-helper.js";
import { paymentMethods } from "@/constants/payment-method-constants";
export default {
name: "payment-adyen",
@ -138,7 +139,7 @@ export default {
countryCode: "US",
showPayButton: true,
translations: {
"en_US": {
en_US: {
"creditCard.securityCode.label": "CVV/CVC",
},
},
@ -235,6 +236,11 @@ export default {
console.log(`CC Token generated =`);
console.log(ccToken);
// Save payment type.
// For now, CC.
// Need to determine payment type from Adyen response
await this.dispatchStoreAction(storeActions.SAVE_PAYMENT_METHOD_CHOICE, paymentMethods.CREDIT_CARD, false);
await baseMixin.methods.dispatchStoreAction(storeActions.SAVE_CCTOKEN, ccToken, false);
await baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_NEXTGEN_SETTLED_AMOUNT,
@ -247,6 +253,33 @@ export default {
async handleFailedPayment(result) {
console.log(`Result =`);
console.log(result);
// Fetch session info
const paymentSessionRequest = {
zipCodeCtu: this.locationInfo.zipCodeCtu,
workOrderNumber: this.workOrderNumberLastSixDigits,
sourceSystem: this.sourceSystem,
sessionId: this.sessionId,
sessionResult: result?.sessionResult,
};
console.log(`Get session payload =`);
console.log(paymentSessionRequest);
try {
const response = await globalMethods.callHttpClient({
method: endpoints.GetAdyenSessionResult.method,
endpoint: endpoints.GetAdyenSessionResult.url,
payload: paymentSessionRequest,
logApiCall: true,
pageNameToLog: "payment-adyen",
});
console.log(response);
} catch (error) {
console.log(`Error getting session info after failure.`);
}
},
handleError(error) {},