Coupons
@panSarin maybe you would like to challenge yourself with this feature? 😎
Sure, I would love to - but can you gimme some more details? ;]
we want to mimic this
https://support.getdpd.com/hc/en-us/articles/201282573-Creating-Coupons-in-DPD
as the first story, only create and percentage discount is fine
:thinking: Is this still a thing? I saw a lot of code connected to discounts, isin't that the same thing?
what we have right now is discounts directly assigned by sales people (at the moment only they can create orders).
what we need in this ticket is to have "codes" which enable discounts. it's still a bit artificial as they would be entered by sales people but later it can be used by clients directly (when we finish the ticket where clients can create their orders).
we need a way of creating a coupon where "arkency20" would enable a discount of some value, probably 20%.
so a form with discount name, value and percentage - in UI terms
Alright, I'd like to take this issue then
I prepared something: https://github.com/RailsEventStore/ecommerce/pull/127 would appreciate any feedback
Shall this be closed?
Yea, the basic functionality requested is done, I'll add PR that fixes the issues from comments from that PR this week
I'm reopening this issue.
Currently we can create coupons, but it seems they can't be used in any way. As such this feature is not bringing any business value.
We should extend the ordering process with the possibility of providing the coupon. As a result the order will have the associated discount.
Now that a cart is ready on the client side, we can add buttons to use the coupon from the client perspective
Assumptions:
- using such coupon makes sense from the client perspective
- It makes less sense from the admin/sales perspective to have this in their UI (they already have the option to set discount)
- we can rely on the existing logic for setting discount on orders (ensuring there is only discount at a time is handled there)
- Introduce a new command
UseCoupon, withorder_idandcoupon_idwhich results in a new eventCouponUsedwith the same attributes - React to
CouponUsedin theClientOrdersread model and display on the view - React to
CouponUsedin theOrdersread model and display on the view - Create a simple process, when
CouponUsedhappens - trigger theSetPercentageDiscountcommand - Extend
orders/editview (or a new view) to display a field for entering coupon code