diff --git a/src/constants/error-messages.js b/src/constants/error-messages.js index ef5459395..71c782856 100644 --- a/src/constants/error-messages.js +++ b/src/constants/error-messages.js @@ -33,6 +33,7 @@ const errorMessages = { MAKE_REQUIRED: "Please select your vehicle make", MODEL_REQUIRED: "Please select your vehicle model", STYLE_REQUIRED: "Please select your vehicle style", + PROMO_REQUIRED: "Please enter a promo code", }; export { errorMessages }; diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index a5ab80faa..be22a118c 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -239,15 +239,15 @@ export default { let cartItem = null; cartItem = { - name: "Some Kind of Promo", // get from CMS? + name: promoLineItem?.[0]?.promoCode, // get from CMS? category: cartItemCategories.PROMOS, - cartItemType: promoLineItem.partType, + cartItemType: promoLineItem?.[0]?.partType, isDisplayed: true, subTotal: - (promoLineItem.kitPrice ?? 0) + - (promoLineItem.laborAmount ?? 0) + - (promoLineItem.sellingPrice ?? 0), - salesTax: promoLineItem.salesTax, + (promoLineItem?.[0]?.kitPrice ?? 0) + + (promoLineItem?.[0]?.laborAmount ?? 0) + + (promoLineItem?.[0]?.sellingPrice ?? 0), + salesTax: promoLineItem?.[0]?.salesTax, }; cartItems.push(cartItem); diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 867dbb3fd..83ecde871 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -30,7 +30,13 @@ @cart-remove="cartRemove" recyclingModalCmsWidgetName="RecycleModal" /> -
+
+
diff --git a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue new file mode 100644 index 000000000..43674b0c2 --- /dev/null +++ b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue @@ -0,0 +1,167 @@ + + diff --git a/src/layouts/payment-method/promo-modal-question/promo-question/promo-question.vue b/src/layouts/payment-method/promo-modal-question/promo-question/promo-question.vue new file mode 100644 index 000000000..6060e75fc --- /dev/null +++ b/src/layouts/payment-method/promo-modal-question/promo-question/promo-question.vue @@ -0,0 +1,47 @@ + + + diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index 8c85cf815..32e1e2750 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -80,6 +80,21 @@ export default { zipCodeCtu: serviceZipValidationResponse.data.zipCodeCtu, }; }, + async getPromoCodeData(promoCode, pageNameToLog = null) { + const pageName = pageNameToLog ?? this.$options?.name; + + const promoValidationResponse = await this.dispatchStoreActionWithLogging( + storeActions.VALIDATE_ORDER_PROMO_AND_SAVE_SERVER_DATA, + { promoCode: promoCode }, + pageName + ); + + return { + isValid: !("errorCode" in promoValidationResponse), + promoCode: promoValidationResponse?.orderPromos, + errorCode: promoValidationResponse?.errorCode, + }; + }, getTierOnePackagePrice(lineItems) { let lineItemsToPrice = lineItems.filter((lineItem) => { return ( diff --git a/src/store/index.js b/src/store/index.js index e2915a1af..8a0bd8176 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2105,6 +2105,7 @@ export const actions = { context.commit(storeMutations.UPDATE_VAPS, vaps); }, savePromos(context, promos) { + addGuidToLineItemsIfNotAlreadyThere(promos); context.commit(storeMutations.UPDATE_PROMOS, promos); }, saveInactivePromos(context, inactivePromos) { @@ -2751,7 +2752,7 @@ function renameGlassToReplaceAttributes(glassToReplace) { } function addGuidToLineItemsIfNotAlreadyThere(lineItems) { - lineItems.forEach((lineItem) => { + lineItems?.forEach((lineItem) => { if (!lineItem.id) { lineItem.id = crypto.randomUUID(); }