Right now the logic to check promo codes is in packages/commerce/util/promo-codes.ts as a util. This logic should be part of the commerce service.
Add optional argument promos (array) to service impl, getSingleton and ContextProvider. For convenience, this can be passed in from @luxdefi/common/promos or something like that.
When we have the API to check promos we can make async getPromoFromCode and call the API from this function, for now it should just use the JSON object with promos to check if code belongs to a valid promo.
Right now the logic to check promo codes is in
packages/commerce/util/promo-codes.tsas a util. This logic should be part of the commerce service.Add optional argument
promos(array) to service impl, getSingleton and ContextProvider. For convenience, this can be passed in from @luxdefi/common/promos or something like that.When we have the API to check promos we can make async
getPromoFromCodeand call the API from this function, for now it should just use the JSON object with promos to check if code belongs to a valid promo.