E-commerce Cashback Loyalty Program
Overview
We currently have a basic e-commerce system that supports the following:
- Account Registration / Sign in
- Placing Orders
- Multiple Merchant partners
The business wants to build a loyalty program that customers can enroll in. In the first iteration of this program, the plan is to support cashback maintenance operations and cashback on "fulfilled" orders.
Business Requirements
- User enrollment into the loyalty program
- Business team can perform operations on the cashback program - Cashback amount base rate is set per merchant partner: * ie: Merchant A base rate is 5%
- Users in the loyalty program will get cashback on "fulfilled" orders - Cashback payouts must be auditable
Stretch Requirements
- Additional cashback is added based on user tier * tier 1 (+1%) - in the loyalty program < 1 year * tier 2 (+2%) - in the loyalty program >= 1 year
- Enabling promotional cashback rates
Development
Getting started
make start
to start the app (app runs onhttp://localhost:3000
)make migrate-initial
to run the initial db migrationsmake seed
to seed the db with the default datamake down
to tear down app and local db datamake clean
to tear down app and local db data AND remove images
Solution:
./server/solutionRouter.js
- API endpoints./migrations/20210205143735_solution.js
- DB schema updates
Using the db
make list-migrations
to list migrations statusesmake migrate
to roll the db to the latest migrationmake rollback
to rollback the db from the last migration
Helpful tips
- Use
cURL
to test the endpoints - Use
jq
orpython -m json.tool
(if you don't havejq
) to pretty print json data