This api services is answer of problem when 12.12 event, which is
- Customers were able to put items in their cart, check out, and then pay. After several days, many of our customers received calls from
- our Customer Service department stating that their orders have been canceled due to stock unavailability. These bad reviews generally come within a week after our 12.12 event, in which we held a large flash sale and set up other major discounts to promote our store.
After checking in with our Customer Service and Order Processing departments, we received the following additional facts:
- Our inventory quantities are often misreported, and some items even go as far as having a negative inventory quantity. The misreported items are those that performed very well on our 12.12 event.
- Because of these misreported inventory quantities, the Order Processing department was unable to fulfill a lot of orders, and thus requested help from our Customer Service department to call our customers and notify them that we have had to cancel their orders.
And here I am trying to find the root of the problem why this is happening and this is the posibility.
- the possibility that occurs is when the system processes purchases, the system does not validate the stock first. so that it can cause an imbalance between stock and demand
So I wil give solution start from add to chart until process order.
- For add to chart process This is the flow that I recommend.
- For update to chart process This is the flow that I recommend.
- For order process This is the flow that I recommend.
- GO
- Postgres
- Consul for store configuration (Optional)
- Postman for API Documentation
-
makesure .env file is exist and the configuration is like this.
- GOCONF_ENV_PREFIX=evermos
- #GOCONF_CONSUL=localhost:8500 (please remark using # if you don't have consul so it will read )
- GOCONF_TYPE=json
- GOCONF_FILENAME=evermos.config
- #PROPERTY_NEWRELIC_KEY=
After you full fill the requeirment above this is rule for run application locally.
- for run api please run this command
- go run main.go api
- for Api documentation please import )
- for run test please run this command
- go test -v .\test\evermos_test.go
Feel free for ask
- WA 087777000056
- email slamet.supriyadi88@gmail.com
Regard