ecommerce icon indicating copy to clipboard operation
ecommerce copied to clipboard

Coupons

Open andrzejkrzywda opened this issue 4 years ago • 12 comments

andrzejkrzywda avatar Apr 29 '21 13:04 andrzejkrzywda

@panSarin maybe you would like to challenge yourself with this feature? 😎

andrzejkrzywda avatar Mar 15 '22 12:03 andrzejkrzywda

Sure, I would love to - but can you gimme some more details? ;]

panSarin avatar Mar 17 '22 11:03 panSarin

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

andrzejkrzywda avatar Mar 17 '22 13:03 andrzejkrzywda

:thinking: Is this still a thing? I saw a lot of code connected to discounts, isin't that the same thing?

krzykamil avatar May 18 '22 15:05 krzykamil

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

andrzejkrzywda avatar May 18 '22 21:05 andrzejkrzywda

Alright, I'd like to take this issue then

krzykamil avatar May 19 '22 10:05 krzykamil

I prepared something: https://github.com/RailsEventStore/ecommerce/pull/127 would appreciate any feedback

krzykamil avatar May 19 '22 21:05 krzykamil

Shall this be closed?

bryszard avatar May 23 '22 21:05 bryszard

Yea, the basic functionality requested is done, I'll add PR that fixes the issues from comments from that PR this week

krzykamil avatar May 24 '22 08:05 krzykamil

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.

andrzejkrzywda avatar Jul 13 '22 11:07 andrzejkrzywda

Now that a cart is ready on the client side, we can add buttons to use the coupon from the client perspective

andrzejkrzywda avatar Sep 28 '22 08:09 andrzejkrzywda

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)
  1. Introduce a new command UseCoupon, with order_id and coupon_id which results in a new event CouponUsed with the same attributes
  2. React to CouponUsed in the ClientOrders read model and display on the view
  3. React to CouponUsed in the Orders read model and display on the view
  4. Create a simple process, when CouponUsed happens - trigger the SetPercentageDiscount command
  5. Extend orders/edit view (or a new view) to display a field for entering coupon code

andrzejkrzywda avatar Oct 10 '23 08:10 andrzejkrzywda