A voucher pool is a collection of (voucher) codes that can be used by customers (recipients) to get discounts in a web shop. Each code may only be used once and we would like to know when it was used by the recipient. Since there can be many recipients in a voucher pool, we need a call that auto-generates voucher codes for each recipient.
- Kotlin Java
- Spring Boot 2.3
- MongoDB
- mongo db running at localhost:27017
- java 11
- start mongodb
- git clone https://github.com/xizzat/voucherpool.git
- cd voucherpool/
- ./gradlew clean bootRun
- ./gradlew test
http://localhost:8080/swagger-ui/
- The api can be used directly from swagger ui
- Create recipient by POST
/api/recipient
- Create specialOffer by POST
/api/special-offer
- if applyAll is enable, all existing recipient will be assigned a voucher for this offer
- if applyAll is disable, specialOffer is created but not assigned to recipient
- Call
/api/recipient/{email}/voucher
to get list of valid voucher for specific recipient - Call
/api/voucher/{code}/recipient/{email}
to redeemed voucher
- if expiry and unused is valid, the percentage will return as a response
- same voucher only can be redeemed once
- Voucher duration can be configured inside
application.properties
#VoucherPool Config
boost.voucher.duration=60