CSR-1977: ensures promo codes are in ALL CAPS even if they are returned from API call that way

This commit is contained in:
Adam Caouette 2024-03-18 11:16:45 -04:00
parent a4a505ba43
commit 99152df219

View file

@ -199,9 +199,14 @@ export default {
false
);
// ensure that all promo codes that return are in all caps format
promoValidationResponse?.orderPromos?.forEach((orderPromo) => {
orderPromo.promoCode = orderPromo.promoCode.toUpperCase();
});
return {
isValid: !("errorCode" in promoValidationResponse),
promoCode: promoValidationResponse?.orderPromos,
promoCode: promoValidationResponse?.orderPromos, // should be an array of promos
errorCode: promoValidationResponse?.errorCode,
additionalInfo: promoValidationResponse?.additionalInfo,
};
@ -264,7 +269,7 @@ export default {
if (promoCodeData.isValid) {
if (this.taxPromos) {
const pricedLineItemsToTax = [];
pricedLineItemsToTax.push(...promoCodeData.promoCode);
pricedLineItemsToTax.push(...promoCodeData.promoCode); // promoCodeData.promoCode should be an array
const taxedLineItems =
await baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.TAX_ORDER_ITEMS_AND_SAVE_SERVER_DATA,