Skip to content

Instantly share code, notes, and snippets.

@alexfilatov
Created April 11, 2019 11:18
Show Gist options
  • Save alexfilatov/6f06e636d6fc34a9e4d6dc4f403829b9 to your computer and use it in GitHub Desktop.
Save alexfilatov/6f06e636d6fc34a9e4d6dc4f403829b9 to your computer and use it in GitHub Desktop.
Our marketing team have added another promotions as an incentive for our customers to purchase these items.
If you buy 3 Kids T-shirt then the third one is free.
Test data
---------
Basket: 003, 003
Total price expected: £39.90
Basket: 003, 003, 003
Total price expected: £39.90
Basket: 003, 003, 003, 002
Total price expected: £76.41
Bonus task
----------
Add another scanable product item: Discount coupon
The list of available items should be:
Product code | Name | Price
----------------------------------------------------------
001 | Lavender heart | £9.25
002 | Personalised cufflinks | £45.00
003 | Kids T-shirt | £19.95
004 | Discount coupon | -£5.00
Discount coupons can not be combined with other promotions
Test data
---------
Basket: 003, 003, 003, 002, 004
Total price expected: £71.41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment