From 75417c4a34efc311020622ca98db225b25829294 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Fri, 12 Dec 2025 14:12:20 -0500 Subject: [PATCH] Attempts to resolve PayPal --- src/layouts/payment-adyen/payment-adyen.vue | 56 +++++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/src/layouts/payment-adyen/payment-adyen.vue b/src/layouts/payment-adyen/payment-adyen.vue index 86c8a67d2..f7e85b019 100644 --- a/src/layouts/payment-adyen/payment-adyen.vue +++ b/src/layouts/payment-adyen/payment-adyen.vue @@ -79,6 +79,10 @@ export default { methods: { async backButtonAction() { // Stub, for navigating back via nav-bar. + this.$router.navigateWithoutSaving( + this.navigationScenarios.CLICKED_BACK, + this.pageName + ); }, async forwardButtonAction() { @@ -130,14 +134,15 @@ export default { value: this.adyenPriceTotal, currency: "USD", }, - locale: "en-US", + locale: "en_US", countryCode: "US", showPayButton: true, translations: { - "en-US": { + "en_US": { "creditCard.securityCode.label": "CVV/CVC", }, }, + onPaymentCompleted: (result, component) => { console.log(`Payment completed from Adyen.`); this.handleCompletedPayment(result); @@ -160,23 +165,27 @@ export default { window.checkout = checkOut; // eslint-disable-next-line const dropin = new AdyenWeb.Dropin(checkOut, { - // paymentMethodsConfiguration: { - // card: { - // showBrandIcon: true, // when false not showing the brand logo - // hasHolderName: true, // show holder name - // holderNameRequired: true, // make holder name mandatory - // billingAddressRequired: true, - // billingAddressAllowedCountries: ["US"], - // // configure placeholders - // placeholders: { - // cardNumber: "1234 5678 9012 3456", - // expiryDate: "MM/YY", - // securityCodeThreeDigits: "123", - // securityCodeFourDigits: "1234", - // holderName: "J. Smith", - // }, - // }, - // }, + paymentMethodsConfiguration: { + ideal: { + showImage: true, + }, + paypal: { + amount: { + value: this.adyenPriceTotal, + currency: "USD", + }, + environment: "test", // Change this to "live" when you're ready to accept live PayPal payments + countryCode: "US", // Only needed for test. This will be automatically retrieved when you are in production. + blockPayPalVenmoButton: false, + //blockPayPalPayLaterButton: true + }, + card: { + hasHolderName: true, + holderNameRequired: true, + billingAddressRequired: true, + name: "Credit or debit card", + }, + }, }).mount("#adyen-container"); }, @@ -235,7 +244,10 @@ export default { await this.saveAndSubmitWorkOrder(); }, - handleFailedPayment(result) {}, + async handleFailedPayment(result) { + console.log(`Result =`); + console.log(result); + }, handleError(error) {}, async saveAndSubmitWorkOrder() { @@ -273,12 +285,12 @@ export default { street: this.splitStreetAddress.street, zipCode: this.locationInfo.zipCode, stateOrProvince: this.locationInfo.state, - returnUrl: "localhost:8080/fmg/confirmation", + returnUrl: "http://localhost:8080/fmg/confirmation", email: this.$store.getters.order.customer.emailAddress, IP: "127.0.0.1", // TODO firstName: this.$store.getters.order.customer.firstName, lastName: this.$store.getters.order.customer.lastName, - idempotencyKey: `${this.$store.getters.order.referralCorrelationId}-${this.sourceSystem}`, + idempotencyKey: crypto.randomUUID(), // `${this.$store.getters.order.referralCorrelationId}-${this.sourceSystem}`, }; },