Merge pull request #2188 from Safelite/feature/CASH-79-BE
CASH-79 Front end save quote api call
This commit is contained in:
commit
b045d6e135
5 changed files with 67 additions and 2 deletions
|
|
@ -124,6 +124,10 @@ const endpoints = {
|
||||||
url: "/order/api/v1/order/load-session",
|
url: "/order/api/v1/order/load-session",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
},
|
},
|
||||||
|
SaveQuote: {
|
||||||
|
url: "/order/api/v1/order/initiate-saved-progress-email",
|
||||||
|
method: "POST",
|
||||||
|
},
|
||||||
GetSignature: {
|
GetSignature: {
|
||||||
url: "/order/api/v1/order/sign",
|
url: "/order/api/v1/order/sign",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ const storeActions = {
|
||||||
GET_MOBILE_PREMIUM_FEE: "getMobilePremiumFee",
|
GET_MOBILE_PREMIUM_FEE: "getMobilePremiumFee",
|
||||||
SAVE_SESSION: "saveSession",
|
SAVE_SESSION: "saveSession",
|
||||||
LOAD_SESSION: "loadSession",
|
LOAD_SESSION: "loadSession",
|
||||||
|
SAVE_QUOTE: "saveQuote",
|
||||||
UPDATE_STORE_WITH_SAVE_SESSION_RESPONSE: "updateStoreWithSaveSessionResponse",
|
UPDATE_STORE_WITH_SAVE_SESSION_RESPONSE: "updateStoreWithSaveSessionResponse",
|
||||||
VALIDATE_ZIP: "validateZip",
|
VALIDATE_ZIP: "validateZip",
|
||||||
PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA: "priceOrderItemsAndSaveServerData",
|
PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA: "priceOrderItemsAndSaveServerData",
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,15 @@ export async function submitWorkOrder({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function saveQuote({ pageNameToLog }) {
|
||||||
|
return await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
|
storeActions.SAVE_QUOTE,
|
||||||
|
{},
|
||||||
|
pageNameToLog,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// PRIVATE FUNCTIONS //
|
// PRIVATE FUNCTIONS //
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,11 @@
|
||||||
class="mb-5 quote-disclaimer" />
|
class="mb-5 quote-disclaimer" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-6 col-xl-4">
|
||||||
|
<button @click="handleClick">Click me!</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -134,6 +139,7 @@ import { packageNames } from "@/constants/package-names";
|
||||||
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||||
import { containsRecalParts } from "@/helpers/recal-helper";
|
import { containsRecalParts } from "@/helpers/recal-helper";
|
||||||
import { externalParameterStatus } from "@/constants/external-parameters";
|
import { externalParameterStatus } from "@/constants/external-parameters";
|
||||||
|
import { saveQuote } from "@/helpers/heritage-integration/order-helper.js";
|
||||||
|
|
||||||
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
||||||
|
|
||||||
|
|
@ -455,6 +461,9 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
async handleClick() {
|
||||||
|
await saveQuote({ pageNameToLog: "quote" });
|
||||||
|
},
|
||||||
openModalAction(modalName) {
|
openModalAction(modalName) {
|
||||||
this.$refs[modalName].openModal();
|
this.$refs[modalName].openModal();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1931,6 +1931,49 @@ export const actions = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Session API Actions
|
// Session API Actions
|
||||||
|
saveQuote(context, { pageNameToLog, payload }) {
|
||||||
|
const vehicle = context.getters.vehicle;
|
||||||
|
const damage = context.getters.damage;
|
||||||
|
const order = context.state.order;
|
||||||
|
const applicationUser = context.getters.applicationUser;
|
||||||
|
const lineItems = context.state.order.lineItems;
|
||||||
|
const excludeRecalInquote = context.getters.shouldHideRecalibration;
|
||||||
|
|
||||||
|
return globalMethods.callHttpClient({
|
||||||
|
method: endpoints.SaveQuote.method,
|
||||||
|
endpoint: endpoints.SaveQuote.url,
|
||||||
|
payload: {
|
||||||
|
referralCorrelationId: order.referralCorrelationId,
|
||||||
|
referralNumber: order.referralNumber?.toString(),
|
||||||
|
referralSequenceNumber: order.referralSequenceNumber,
|
||||||
|
emailAddress: "cn@gm.com", //order.customer.emailAddress,
|
||||||
|
lastPage: pageNameToLog,
|
||||||
|
isRepair: damage.isRepair,
|
||||||
|
firstName: order.customer.firstName,
|
||||||
|
lastName: order.customer.lastName,
|
||||||
|
savedSessionId: applicationUser.savedSessionId,
|
||||||
|
serviceState: order.serviceLocation.state,
|
||||||
|
serviceZipCode: order.serviceLocation.zipCode,
|
||||||
|
parentAccountNumber: order.payment.parentAccountNumber,
|
||||||
|
excludeRecalInquote: excludeRecalInquote,
|
||||||
|
year: vehicle.year,
|
||||||
|
make: vehicle.make,
|
||||||
|
model: vehicle.model,
|
||||||
|
isInsurance: order.payment.isInsurance ?? false,
|
||||||
|
isVerified: order.payment.insuranceCoverage.isVerified ?? false,
|
||||||
|
lineItems: {
|
||||||
|
glassParts: lineItems.glassParts,
|
||||||
|
supportingItems: lineItems.supportingItems,
|
||||||
|
vaps: lineItems.vaps,
|
||||||
|
serverData: lineItems.serverData,
|
||||||
|
promos: lineItems.promos,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
logApiCall: true,
|
||||||
|
pageNameToLog: pageNameToLog,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
saveSession(context, { pageNameToLog, payload }) {
|
saveSession(context, { pageNameToLog, payload }) {
|
||||||
const vehicle = context.getters.vehicle;
|
const vehicle = context.getters.vehicle;
|
||||||
const damage = context.getters.damage;
|
const damage = context.getters.damage;
|
||||||
|
|
@ -2008,8 +2051,7 @@ export const actions = {
|
||||||
order.payment.insuranceCoverage.coverageStatus?.toString(),
|
order.payment.insuranceCoverage.coverageStatus?.toString(),
|
||||||
coverageVerificationType:
|
coverageVerificationType:
|
||||||
order.payment.insuranceCoverage.coverageVerificationType,
|
order.payment.insuranceCoverage.coverageVerificationType,
|
||||||
coverageSubStatus:
|
coverageSubStatus: order.payment.insuranceCoverage.coverageSubStatus,
|
||||||
order.payment.insuranceCoverage.coverageSubStatus,
|
|
||||||
},
|
},
|
||||||
isInsurance: order.payment.isInsurance,
|
isInsurance: order.payment.isInsurance,
|
||||||
parentAccountNumber: order.payment.parentAccountNumber,
|
parentAccountNumber: order.payment.parentAccountNumber,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue