In progress
This commit is contained in:
parent
a212894a26
commit
3b1b000a13
2 changed files with 61 additions and 20 deletions
|
|
@ -217,11 +217,11 @@ const endpoints = {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
},
|
},
|
||||||
InitializeAdyenPayment: {
|
InitializeAdyenPayment: {
|
||||||
url: "/order/api/v1/order/payment/session/initialize-session",
|
url: "/payment/api/v1/payment/payment/session/initialize-session",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
},
|
},
|
||||||
GetAdyenSessionResult: {
|
GetAdyenSessionResult: {
|
||||||
url: "/order/api/v1/order/payment/session/session-result",
|
url: "/payment/api/v1/payment/payment/session/session-result",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,10 @@ import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import globalMethods from "@/global-methods";
|
import globalMethods from "@/global-methods";
|
||||||
import { endpoints } from "../../constants/endpoints";
|
import { endpoints } from "../../constants/endpoints";
|
||||||
import { AppointmentTypeStrings } from "../../constants/schedule-constants";
|
import { AppointmentTypeStrings } from "../../constants/schedule-constants";
|
||||||
|
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";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "payment-adyen",
|
name: "payment-adyen",
|
||||||
|
|
@ -90,6 +94,9 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
async initializeAdyen() {
|
async initializeAdyen() {
|
||||||
|
console.log(`Price = ${this.amountDue}`);
|
||||||
|
console.log(`Adyen Price = ${this.adyenPriceTotal}`);
|
||||||
|
|
||||||
const requestBody = this.adyenInitRequestInfo;
|
const requestBody = this.adyenInitRequestInfo;
|
||||||
|
|
||||||
console.log(`Calling with:`);
|
console.log(`Calling with:`);
|
||||||
|
|
@ -153,23 +160,23 @@ export default {
|
||||||
window.checkout = checkOut;
|
window.checkout = checkOut;
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
const dropin = new AdyenWeb.Dropin(checkOut, {
|
const dropin = new AdyenWeb.Dropin(checkOut, {
|
||||||
paymentMethodsConfiguration: {
|
// paymentMethodsConfiguration: {
|
||||||
card: {
|
// card: {
|
||||||
showBrandIcon: true, // when false not showing the brand logo
|
// showBrandIcon: true, // when false not showing the brand logo
|
||||||
hasHolderName: true, // show holder name
|
// hasHolderName: true, // show holder name
|
||||||
holderNameRequired: true, // make holder name mandatory
|
// holderNameRequired: true, // make holder name mandatory
|
||||||
billingAddressRequired: true,
|
// billingAddressRequired: true,
|
||||||
billingAddressAllowedCountries: ["US"],
|
// billingAddressAllowedCountries: ["US"],
|
||||||
// configure placeholders
|
// // configure placeholders
|
||||||
placeholders: {
|
// placeholders: {
|
||||||
cardNumber: "1234 5678 9012 3456",
|
// cardNumber: "1234 5678 9012 3456",
|
||||||
expiryDate: "MM/YY",
|
// expiryDate: "MM/YY",
|
||||||
securityCodeThreeDigits: "123",
|
// securityCodeThreeDigits: "123",
|
||||||
securityCodeFourDigits: "1234",
|
// securityCodeFourDigits: "1234",
|
||||||
holderName: "J. Smith",
|
// holderName: "J. Smith",
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
}).mount("#adyen-container");
|
}).mount("#adyen-container");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -218,9 +225,39 @@ export default {
|
||||||
|
|
||||||
console.log(`CC Token generated =`);
|
console.log(`CC Token generated =`);
|
||||||
console.log(ccToken);
|
console.log(ccToken);
|
||||||
|
|
||||||
|
await baseMixin.methods.dispatchStoreAction(storeActions.SAVE_CCTOKEN, ccToken, false);
|
||||||
|
await baseMixin.methods.dispatchStoreAction(
|
||||||
|
storeActions.SAVE_NEXTGEN_SETTLED_AMOUNT,
|
||||||
|
this.amountDue,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
await this.saveAndSubmitWorkOrder();
|
||||||
},
|
},
|
||||||
handleFailedPayment(result) {},
|
handleFailedPayment(result) {},
|
||||||
handleError(error) {},
|
handleError(error) {},
|
||||||
|
|
||||||
|
async saveAndSubmitWorkOrder() {
|
||||||
|
// Work order submission after successful payment.
|
||||||
|
await this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
|
||||||
|
try {
|
||||||
|
await submitWorkOrder({
|
||||||
|
pageNameToLog: "payment-adyen",
|
||||||
|
submitAfterSave: true,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`error: response from submit work order: ${error.message}`);
|
||||||
|
|
||||||
|
// navigate to error page
|
||||||
|
|
||||||
|
//this.$refs.loadingModal.isModalVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//this.$refs.loadingModal.isModalVisible = false;
|
||||||
|
// clear order
|
||||||
|
// navigate forward
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -304,8 +341,12 @@ export default {
|
||||||
return "FMG-2.0";
|
return "FMG-2.0";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
amountDue() {
|
||||||
|
return getAmountDue(this.$store.getters.order.lineItems);
|
||||||
|
},
|
||||||
|
|
||||||
adyenPriceTotal() {
|
adyenPriceTotal() {
|
||||||
return 10000;
|
return this.amountDue * 100;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue