-
-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure coupon code times_used decrements on cancel #1031
Ensure coupon code times_used decrements on cancel #1031
Conversation
- Update rule name in config. Separate save calls. - Fix typo in bind params - Ensure coupon usage table update. Allow decrementing coupon usage. - Fix observer definition - Fix coupon codes on order cancellation - Decrement `times_used` on coupon codes when an order payment is cancelled.
LGTM ... but can you please add some steps to reproduce? |
Sure thing!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for the PR!
@tomekjordan @seansan may be interested in reviewing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tzzz .... uppercase FALSE .... :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually prefer uppercase bools but unfortunately one of those PSR things doesn't agree with me.. 🤣
Hi, this logic is not obvious. Please reanalyse if used coupon should be reused. |
Can you please explain your concerns? If I use a voucher but cancel the order, the voucher should still be available to me. In what cases should the voucher no longer be valid? |
are you sure? I'm not against it. Just please analyze. |
Yeah, but maybe I'm missing something... For example: A customer orders an article not in stock with a one-time-voucher. Since it takes too long, he cancels the order. Should the voucher expire? |
IMO yes. he should get another one if seller permit. |
Well ... IMO it should not :) Just did a quick search ...
I think its easy cover both needs ... add a config section and a check to observer. Time for a PR? |
ok, approve. :) I wanted to be careful |
* Remove $timesUsed > 0 check to prevent duplicate entry * Prevent $timesUsed from going less than 0 refs: OpenMage#1031
To implement this cleanly in the observer (without instantiating new connection objects, fetching records, etc.) I added a parameter
$decrement
toupdateCustomerCouponTimesUsed
which should be a non-breaking change.fixes #167