Please design a Coupon Service ( Low Level and High Level ) for online food delivery system like Zomato. Following are the properties of the coupon service :
A coupon can be specific to some restaurants, payment gateways or coupon can be generic.
A coupon can be flat / percentage / cashback coupon. A coupon will have min. Cart value and max. discount.
Coupon can be single time use or multiple time use.
A coupon can be specific to one customer.
A coupon can have time limit meaning it can only be applied once in t minutes.
If a coupon is one time usable coupon and the order gets cancelled, coupon should be active again
Low LD - DB Schema, Api
High LD - Components or Services, Caching Algorithm
Any ideas on how to implement such a system.
Thanks