CSR-2323 save vaps to store when promo added
CSR-2323 save vaps to store when promo added. This should allow an update to the package name in the review dropdown
This commit is contained in:
parent
383ebbbc23
commit
bb221a1958
3 changed files with 27 additions and 14 deletions
|
|
@ -134,7 +134,8 @@
|
|||
v-model="lineItems"
|
||||
:addableVaps="availableVaps"
|
||||
:pageName="pageName"
|
||||
modalWidgetName="PromoModalWidget" />
|
||||
modalWidgetName="PromoModalWidget"
|
||||
@promoAdded="saveVaps" />
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
|
|
@ -286,7 +287,12 @@ export default {
|
|||
this.lineItems[category] = this.lineItems[category].filter(
|
||||
(lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType
|
||||
);
|
||||
|
||||
|
||||
await this.dispatchStoreAction(storeActions.SAVE_VAPS, this.lineItems.vaps, false);
|
||||
},
|
||||
|
||||
async saveVaps(vaps) {
|
||||
this.lineItems.vaps = [...vaps];
|
||||
await this.dispatchStoreAction(storeActions.SAVE_VAPS, this.lineItems.vaps, false);
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ export default {
|
|||
additionalInfo: promoValidationResponse?.additionalInfo,
|
||||
};
|
||||
},
|
||||
removeItem(promo) {
|
||||
async removeItem(promo) {
|
||||
this.lineItems[cartItemCategories.PROMOS] = this.lineItems[
|
||||
cartItemCategories.PROMOS
|
||||
].filter(
|
||||
|
|
@ -320,6 +320,9 @@ export default {
|
|||
this.lineItems.vaps?.push(...getVaps);
|
||||
}
|
||||
this.lineItems?.promos.push(...promoCodeData.promoCode);
|
||||
|
||||
this.$emit('promoAdded', this.lineItems.vaps);
|
||||
|
||||
this.closeModal();
|
||||
} else {
|
||||
this.getErrorMessage(promoCodeData.errorCode, promoCodeData.additionalInfo);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ beforeEach(() => {
|
|||
},
|
||||
policy: {
|
||||
isNoComp: false,
|
||||
}
|
||||
},
|
||||
},
|
||||
damage: {},
|
||||
payment: {
|
||||
|
|
@ -616,9 +616,11 @@ describe("computed properties...", () => {
|
|||
//Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
const lineItems = {
|
||||
glassParts: [{
|
||||
partType: "RECALIBRATION",
|
||||
}]
|
||||
glassParts: [
|
||||
{
|
||||
partType: "RECALIBRATION",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
wrapper.vm.submittedOrder = {
|
||||
|
|
@ -639,7 +641,7 @@ describe("computed properties...", () => {
|
|||
lineItems: {
|
||||
glassParts: {
|
||||
partType: "Recalibration",
|
||||
}
|
||||
},
|
||||
},
|
||||
serviceLocation: store.getters.order.serviceLocation,
|
||||
};
|
||||
|
|
@ -653,13 +655,15 @@ describe("computed properties...", () => {
|
|||
// Assert
|
||||
expect(testValue).toEqual(true);
|
||||
});
|
||||
test ("Itac/NoComp with Recal should return false for shouldHideRecalibration", async () => {
|
||||
test("Itac/NoComp with Recal should return false for shouldHideRecalibration", async () => {
|
||||
//Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
const lineItems = {
|
||||
glassParts: [{
|
||||
partType: "RECALIBRATION",
|
||||
}]
|
||||
glassParts: [
|
||||
{
|
||||
partType: "RECALIBRATION",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
wrapper.vm.submittedOrder = {
|
||||
|
|
@ -688,7 +692,7 @@ describe("computed properties...", () => {
|
|||
|
||||
// Assert
|
||||
expect(testValue).toEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function setupMocks({ customMountOptions }) {
|
||||
|
|
@ -706,7 +710,7 @@ function setupMocks({ customMountOptions }) {
|
|||
if (settingName === experimentSettings.RECAL_PRICE_REMOVE) {
|
||||
return "true";
|
||||
}
|
||||
|
||||
|
||||
return "false";
|
||||
}),
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue