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",
|
||||
},
|
||||
InitializeAdyenPayment: {
|
||||
url: "/order/api/v1/order/payment/session/initialize-session",
|
||||
url: "/payment/api/v1/payment/payment/session/initialize-session",
|
||||
method: "POST",
|
||||
},
|
||||
GetAdyenSessionResult: {
|
||||
url: "/order/api/v1/order/payment/session/session-result",
|
||||
url: "/payment/api/v1/payment/payment/session/session-result",
|
||||
method: "POST",
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@ import { settleAllPromises } from "@/helpers/layout-helper";
|
|||
import globalMethods from "@/global-methods";
|
||||
import { endpoints } from "../../constants/endpoints";
|
||||
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 {
|
||||
name: "payment-adyen",
|
||||
|
|
@ -90,6 +94,9 @@ export default {
|
|||
},
|
||||
|
||||
async initializeAdyen() {
|
||||
console.log(`Price = ${this.amountDue}`);
|
||||
console.log(`Adyen Price = ${this.adyenPriceTotal}`);
|
||||
|
||||
const requestBody = this.adyenInitRequestInfo;
|
||||
|
||||
console.log(`Calling with:`);
|
||||
|
|
@ -153,23 +160,23 @@ 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: {
|
||||
// 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",
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
}).mount("#adyen-container");
|
||||
},
|
||||
|
||||
|
|
@ -218,9 +225,39 @@ export default {
|
|||
|
||||
console.log(`CC Token generated =`);
|
||||
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) {},
|
||||
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: {
|
||||
|
|
@ -304,8 +341,12 @@ export default {
|
|||
return "FMG-2.0";
|
||||
},
|
||||
|
||||
amountDue() {
|
||||
return getAmountDue(this.$store.getters.order.lineItems);
|
||||
},
|
||||
|
||||
adyenPriceTotal() {
|
||||
return 10000;
|
||||
return this.amountDue * 100;
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue