CSR-747 WIP
This commit is contained in:
parent
bd53177d53
commit
a299e558c1
5 changed files with 122 additions and 9 deletions
|
|
@ -122,6 +122,10 @@ const endpoints = {
|
|||
url: "/experiments/api/v1/experiments/run",
|
||||
method: "POST",
|
||||
},
|
||||
GetPriceForLineItems: {
|
||||
url: "/price/api/v1/price/order-items",
|
||||
method: "GET"
|
||||
}
|
||||
};
|
||||
|
||||
export { endpoints };
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ const storeActions = {
|
|||
RUN_EXPERIMENTS_FOR_TRIGGER: "runExperimentsForTrigger",
|
||||
CLEAR_VIN: "clearVin",
|
||||
RESET_SAVE_SESSION_PROMISE: "resetSaveSessionPromise",
|
||||
GET_PRICES_FOR_LINE_ITEMS: "getPricesForLineItems",
|
||||
|
||||
// DEPENDENCY MUTATIONS
|
||||
RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies",
|
||||
|
|
|
|||
|
|
@ -10,9 +10,13 @@ export default {
|
|||
callHttpClient({ method, endpoint, payload, logApiCall = true }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO;
|
||||
|
||||
if (endpoint.includes("/order/")) {
|
||||
cfDistroUrl = "https://localhost:44346";
|
||||
}
|
||||
else if (endpoint.includes("/price/")) {
|
||||
cfDistroUrl = "https://localhost:44372";
|
||||
}
|
||||
|
||||
const payloadAndAnalyticsData = Object.assign({}, payload, { AppName: "FixMyGlass" });
|
||||
const headers = {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
:displayGenericVehicleImage="false" />
|
||||
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
|
||||
<div class="fade-on-route-transition sub-container make-tall">
|
||||
<button @click="pricingTest">Price Test</button>
|
||||
<textBlock
|
||||
cmsWidgetName="paymentServiceOptionsCopy"
|
||||
justifyText="center"
|
||||
|
|
@ -179,6 +180,10 @@ export default {
|
|||
};
|
||||
},
|
||||
methods: {
|
||||
pricingTest() {
|
||||
const test = this.dispatchStoreAction(storeActions.GET_PRICES_FOR_LINE_ITEMS);
|
||||
console.log({test})
|
||||
},
|
||||
arePagePrerequisitesValid() {
|
||||
return true;
|
||||
//return store.getters.order.damage.isRepair || (store.getters.order.lineItems?.glassParts != null && store.getters.order.lineItems.glassParts.length > 0);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { applicationConfig } from "@/constants/application-config";
|
|||
import { experimentTriggers } from "@/constants/experiments";
|
||||
import { damageLocationsSelected } from "@/constants/damage-locations-selected";
|
||||
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
||||
import router from "@/router"
|
||||
import router from "@/router";
|
||||
|
||||
// Export State
|
||||
const getDefaultState = () => {
|
||||
|
|
@ -63,7 +63,7 @@ const getDefaultState = () => {
|
|||
isInsurance: null,
|
||||
insuranceCoverage: {
|
||||
isVerified: null,
|
||||
coverageStatus: null
|
||||
coverageStatus: null,
|
||||
},
|
||||
},
|
||||
referralNumber: null,
|
||||
|
|
@ -83,12 +83,6 @@ const getDefaultState = () => {
|
|||
experiments: [],
|
||||
triggeredSiteEntry: false,
|
||||
},
|
||||
// gaClickInformation: {
|
||||
// currentlySelectedValues: {},
|
||||
// firedGaClickEventValues: {},
|
||||
// lastFocusedInputGroup: "",
|
||||
// wasLastFocusedInputMultiselect: undefined,
|
||||
// },
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -920,7 +914,7 @@ export const actions = {
|
|||
const carId = context.getters.vehicle.carId;
|
||||
const isRepair = context.getters.damage.isRepair;
|
||||
const numberOfChips = context.getters.damage.numberOfChips;
|
||||
const parentAccountNumber = context.getters.order.accountNumber.toString();
|
||||
const parentAccountNumber = "167132"//context.getters.order.accountNumber.toString();
|
||||
return globalMethods.callHttpClient({
|
||||
method: endpoints.GetSupportingItems.method,
|
||||
endpoint: endpoints.GetSupportingItems.url,
|
||||
|
|
@ -1067,6 +1061,111 @@ export const actions = {
|
|||
});
|
||||
},
|
||||
|
||||
// START Pricing service call actions
|
||||
getPricesForLineItems(context) {
|
||||
const vehicle = context.getters.vehicle;
|
||||
const lineItems = {
|
||||
glassParts: [
|
||||
{
|
||||
partNumber: "FW04186GTYN",
|
||||
description: "solar, soundproofing, lane keep assist",
|
||||
color: "Green Tint",
|
||||
requiresRecalibration: true,
|
||||
requiresCapabilityQuestions: false,
|
||||
recalibrationType: "DUAL",
|
||||
childParts: [
|
||||
{
|
||||
partNumber: "GGG 3563 KIT",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
partNumber: "FD25457GTYN",
|
||||
description: "solar, driver side, rear",
|
||||
color: "Green Tint",
|
||||
requiresRecalibration: false,
|
||||
requiresCapabilityQuestions: false,
|
||||
recalibrationType: "",
|
||||
childParts: null,
|
||||
},
|
||||
{
|
||||
partNumber: "FD27090GTYN",
|
||||
description: "solar, driver side, front",
|
||||
color: "Green Tint",
|
||||
requiresRecalibration: false,
|
||||
requiresCapabilityQuestions: false,
|
||||
recalibrationType: "",
|
||||
childParts: null,
|
||||
},
|
||||
{
|
||||
partNumber: "FB25460GTYN",
|
||||
description: "heated glass, solar",
|
||||
color: "Green Tint",
|
||||
requiresRecalibration: false,
|
||||
requiresCapabilityQuestions: false,
|
||||
recalibrationType: "",
|
||||
childParts: null,
|
||||
},
|
||||
],
|
||||
supportingItems: [
|
||||
{
|
||||
partNumber: "PART1",
|
||||
description: "solar, soundproofing, lane keep assist",
|
||||
color: "Green Tint",
|
||||
requiresRecalibration: true,
|
||||
requiresCapabilityQuestions: false,
|
||||
recalibrationType: "DUAL",
|
||||
childParts: [
|
||||
{
|
||||
partNumber: "GGG 3563 KIT",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
partNumber: "PART2",
|
||||
description: "solar, driver side, rear",
|
||||
color: "Green Tint",
|
||||
requiresRecalibration: false,
|
||||
requiresCapabilityQuestions: false,
|
||||
recalibrationType: "",
|
||||
childParts: null,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const commaSeparatedPartNumbers = Object.values(context.getters.order.lineItems)
|
||||
.map((lineItemGroup) => lineItemGroup.map((lineItem) => lineItem.partNumber))
|
||||
.flat()
|
||||
.join(",");
|
||||
|
||||
console.log({
|
||||
lineItems: Object.values(lineItems)
|
||||
.map((lineItemGroup) => lineItemGroup.map((lineItem) => lineItem.partNumber))
|
||||
.flat()
|
||||
.join(","),
|
||||
commaSeparatedPartNumbers,
|
||||
});
|
||||
|
||||
// context.getters.order.lineItems.map(lineItemGroup => )
|
||||
|
||||
return globalMethods
|
||||
.callHttpClient({
|
||||
method: endpoints.GetPriceForLineItems.method,
|
||||
endpoint: `${endpoints.GetPriceForLineItems.url}?CTU=01833&carId=${vehicle.carId}&make=${vehicle.make}&model=${vehicle.model}&year=${vehicle.year}&EON=S169140586&zipCode=34785&lineItems=${commaSeparatedPartNumbers}&parentAccountNumber=167132`,
|
||||
})
|
||||
.then((response) => {
|
||||
// Flatten location and name properties
|
||||
|
||||
// clear the state if the existing EON does not equal what is returned from loadSession
|
||||
// if (context.state.order.eon && context.state.order.eon != response.data.eon) {
|
||||
// context.commit(storeMutations.RESET_STATE);
|
||||
// }
|
||||
// context.commit(storeMutations.UPDATE_STATE_WITH_ORDER_INFORMATION, response.data);
|
||||
return response;
|
||||
});
|
||||
},
|
||||
// END Pricing service call actions
|
||||
|
||||
// Business domain actions
|
||||
|
||||
// Vehicle
|
||||
|
|
|
|||
Loading…
Reference in a new issue