diff --git a/packages/common/src/controllers/CheckoutController.ts b/packages/common/src/controllers/CheckoutController.ts index ffe195d50..917699af9 100644 --- a/packages/common/src/controllers/CheckoutController.ts +++ b/packages/common/src/controllers/CheckoutController.ts @@ -103,6 +103,8 @@ export default class CheckoutController { useCheckoutStore.getState().setOrder(null); } else if (error.message === 'Invalid coupon code') { throw new FormValidationError({ couponCode: [i18next.t('account:checkout.coupon_not_valid')] }); + } else if (error.message === 'Invalid coupon code for this offer') { + throw new FormValidationError({ couponCode: [i18next.t('account:checkout.coupon_not_valid_for_offer')] }); } } diff --git a/packages/common/src/services/integrations/cleeng/CleengCheckoutService.ts b/packages/common/src/services/integrations/cleeng/CleengCheckoutService.ts index 1dc3bce05..6aa89be0e 100644 --- a/packages/common/src/services/integrations/cleeng/CleengCheckoutService.ts +++ b/packages/common/src/services/integrations/cleeng/CleengCheckoutService.ts @@ -97,6 +97,10 @@ export default class CleengCheckoutService extends CheckoutService { if (response.errors[0].includes(`Coupon ${payload.couponCode} not found`)) { throw new Error('Invalid coupon code'); } + + if (response.errors[0].includes(`Coupon ${payload.couponCode} cannot be applied on this offer`)) { + throw new Error('Invalid coupon code for this offer'); + } } return response; diff --git a/platforms/web/public/locales/en/account.json b/platforms/web/public/locales/en/account.json index e01a545ed..d5dddbee5 100644 --- a/platforms/web/public/locales/en/account.json +++ b/platforms/web/public/locales/en/account.json @@ -15,6 +15,7 @@ "coupon_applied": "Your coupon code has been applied", "coupon_discount": "Coupon discount", "coupon_not_valid": "Coupon code is not valid", + "coupon_not_valid_for_offer": "Coupon code is not valid for this offer", "credit_card": "Credit card", "credit_card_name": "Credit card name", "days_trial_one": "You will be charged tomorrow.", diff --git a/platforms/web/public/locales/es/account.json b/platforms/web/public/locales/es/account.json index 7f685fb42..fbf29626e 100644 --- a/platforms/web/public/locales/es/account.json +++ b/platforms/web/public/locales/es/account.json @@ -15,6 +15,7 @@ "coupon_applied": "Se ha aplicado tu código de cupón", "coupon_discount": "Descuento de cupón", "coupon_not_valid": "El código de cupón no es válido", + "coupon_not_valid_for_offer": "El código de cupón no es válido para esta oferta", "credit_card": "Tarjeta de crédito", "credit_card_name": "Nombre de la tarjeta de crédito", "days_trial_one": "Se te cobrará mañana.",