0

I am trying to implement offer engine for e-commerece website. I envision offer engine having CRUD APIs. It should be a rule based system wherein the offer post api (or create api) will create a rule. Like for example: consumers who have shopped more than 3 times and have London as delivery city will get discount of 10%.

The Offer GET API will get context and return the applicable offers.

Now, offer can have usage constraints:

-> applicable for each customer only once -> applicable for first 1000 users

I understand I need to make a table which tracks the usage of the offers. My question is it should be the system which uses the offers, which in my case would be payment. I would make this assertion on the belief that client of offers should know the usage. And the task of offer engine is limited to providing/creating rule given the context.

Or should it be offer engine itself which tracks the usage of the offers?

H-V
  • 131
  • 1
  • 4
  • 1
    Well, one issue that I can see straight away with in your design is that you will probably have a circular dependency on your system. Your payment API needs to call your offer API to get the offers which in turn will will have to call the payment API to check if the user has made the x payments. – fnmps Sep 25 '18 at 20:51
  • @fnmps, So, would you suggest to have payments as the owner of the offer usage? – H-V Sep 26 '18 at 05:57
  • 1
    It's difficult to say. Usually when you have a circular dependency you'll want to add an extra module. On this case probably a paymentManager that is responsible for creating a payment with the offer or reject the payment. So, you would end up with the paymentmanagement calling the offer to get eligible discounts, and apply the discount when creating the payment with the payment api. This way you have paymentManagement depending on the offer and payment API, and the offer API depending on the payment API. If that makes sense on your system then I would put an offer db behind the offer API. – fnmps Sep 28 '18 at 22:10
  • What is Offer Engine exactly? is it a general term? – Euijun Jeong Aug 02 '22 at 23:11

0 Answers0