CSR-747 Add load-session parameters
This commit is contained in:
parent
aa875c84d7
commit
5a8c5365f5
3 changed files with 26 additions and 7 deletions
|
|
@ -78,7 +78,7 @@ const tintMap = {
|
|||
// Returns undefined if no items are found.
|
||||
export function getTintImage(glassLocation, colorString) {
|
||||
// Windshield glass has special images, all other glass uses the same though.
|
||||
if (glassLocation.toLowerCase() !== "windshield") {
|
||||
if (glassLocation?.toLowerCase() !== "windshield") {
|
||||
glassLocation = "other";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,14 @@ export async function loadSessionIfPresent() {
|
|||
}
|
||||
|
||||
// Loads session including referral if there is a cookie, and it doesn't indicate it needs a state reset.
|
||||
return (await loadSession(funnelCookie.SavedSessionId)).data;
|
||||
return (
|
||||
await loadSession(
|
||||
funnelCookie.SavedSessionId,
|
||||
funnelCookie.ReferralNumber,
|
||||
funnelCookie.ReferralParentAccountNumber,
|
||||
funnelCookie.ReferralCorrelationId
|
||||
)
|
||||
).data;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -61,13 +68,16 @@ export async function saveSession() {
|
|||
Calls API to load session given the referral number, referralDate, and referralCorrelationId
|
||||
and returns the response.
|
||||
*/
|
||||
async function loadSession(savedSessionId) {
|
||||
async function loadSession(savedSessionId, referralNumber, accountNumber, referralCorrelationId) {
|
||||
// await the saveSessionPromise in the store to make sure we're loading up to date information
|
||||
await store.getters.applicationUser.saveSessionPromise;
|
||||
const response = await baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.LOAD_SESSION,
|
||||
{
|
||||
savedSessionId: savedSessionId?.toString(),
|
||||
referralNumber,
|
||||
accountNumber,
|
||||
referralCorrelationId,
|
||||
},
|
||||
false
|
||||
);
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ export const mutations = {
|
|||
sessionInformation?.order.payment.insuranceCoverage.isVerified;
|
||||
// TODO KO CSR-747 double check this
|
||||
state.order.payment.insuranceCoverage.coverageStatus =
|
||||
sessionInformation?.insuranceInfo.coverageStatus;
|
||||
sessionInformation?.insuranceInfo?.coverageStatus;
|
||||
|
||||
state.order.customer.emailAddress = sessionInformation.order.customer.emailAddress;
|
||||
state.order.existingPromoCode = sessionInformation.order.existingPromoCode;
|
||||
|
|
@ -1036,12 +1036,21 @@ export const actions = {
|
|||
},
|
||||
});
|
||||
},
|
||||
loadSession(context, { savedSessionId }) {
|
||||
loadSession(context, { savedSessionId, referralNumber, referralCorrelationId, accountNumber }) {
|
||||
const order = context.state.order;
|
||||
|
||||
return globalMethods
|
||||
.callHttpClient({
|
||||
method: endpoints.LoadSession.method,
|
||||
endpoint:
|
||||
endpoints.LoadSession.url + "?savedSessionId=" + savedSessionId?.toString(),
|
||||
endpoint: `${
|
||||
endpoints.LoadSession.url
|
||||
}?savedSessionId=${savedSessionId?.toString()}&referralNumber=${
|
||||
referralNumber && referralNumber !== "" ? referralNumber : order.referralNumber
|
||||
}&accountNumber=${accountNumber}&referralCorrelationId=${
|
||||
referralCorrelationId !== ""
|
||||
? referralCorrelationId
|
||||
: order.referralCorrelationId
|
||||
}`,
|
||||
})
|
||||
.then((response) => {
|
||||
// Flatten location and name properties
|
||||
|
|
|
|||
Loading…
Reference in a new issue