Merge pull request #2531 from Safelite/nation/CASH-715
CASH-715 policy vehicle change
This commit is contained in:
commit
352a3d4dc8
1 changed files with 13 additions and 5 deletions
|
|
@ -3621,25 +3621,25 @@ export function mapTaxedLineItemsToStoreFormat(availableLineItems, storeLineItem
|
||||||
export function getArrayOfAllLineItemsAndChildParts(lineItems) {
|
export function getArrayOfAllLineItemsAndChildParts(lineItems) {
|
||||||
let consolidatedLineItemsArray = [];
|
let consolidatedLineItemsArray = [];
|
||||||
|
|
||||||
if (lineItems.glassParts != null)
|
if (lineItems?.glassParts != null)
|
||||||
consolidatedLineItemsArray = [
|
consolidatedLineItemsArray = [
|
||||||
...consolidatedLineItemsArray,
|
...consolidatedLineItemsArray,
|
||||||
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.glassParts),
|
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.glassParts),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (lineItems.supportingItems != null)
|
if (lineItems?.supportingItems != null)
|
||||||
consolidatedLineItemsArray = [
|
consolidatedLineItemsArray = [
|
||||||
...consolidatedLineItemsArray,
|
...consolidatedLineItemsArray,
|
||||||
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.supportingItems),
|
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.supportingItems),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (lineItems.vaps != null)
|
if (lineItems?.vaps != null)
|
||||||
consolidatedLineItemsArray = [
|
consolidatedLineItemsArray = [
|
||||||
...consolidatedLineItemsArray,
|
...consolidatedLineItemsArray,
|
||||||
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.vaps),
|
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.vaps),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (lineItems.promos != null)
|
if (lineItems?.promos != null)
|
||||||
consolidatedLineItemsArray = [
|
consolidatedLineItemsArray = [
|
||||||
...consolidatedLineItemsArray,
|
...consolidatedLineItemsArray,
|
||||||
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.promos),
|
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.promos),
|
||||||
|
|
@ -3789,7 +3789,15 @@ function supportingItemsEqual(supportingItemsA, supportingItemsB) {
|
||||||
// if so, make sure it's not in the past. if in the past, clear schedule info in store.
|
// if so, make sure it's not in the past. if in the past, clear schedule info in store.
|
||||||
// if date not in past, then call schedule service to verify appointment is still available.
|
// if date not in past, then call schedule service to verify appointment is still available.
|
||||||
async function resetScheduleIfUnavailable(context, order, pageNameToLog) {
|
async function resetScheduleIfUnavailable(context, order, pageNameToLog) {
|
||||||
if (!order.schedule?.date) {
|
// lineItems empty can happen when a customer goes all the way through scheduling as cash but then
|
||||||
|
// switches to insurance AND also switches vehicles during policy lookup. If you call shop-time-slots
|
||||||
|
// without parts, you get 500 errors so skip the call.
|
||||||
|
const lineItems = getArrayOfAllLineItemsAndChildParts(order.lineItems);
|
||||||
|
|
||||||
|
if (!order.schedule?.date || lineItems.length === 0) {
|
||||||
|
console.log(new Date() + " no schedule date or lineItems. skip resetSchedule logic.");
|
||||||
|
console.log(new Date() + " schedule.schedule.date" + JSON.stringify(order.schedule));
|
||||||
|
console.log(new Date() + " lineItems" + JSON.stringify(order.lineItems));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue