[API]adding promotions with expire date#12013
Merged
Merged
Conversation
Contributor
arti0090
commented
Nov 6, 2020
| Q | A |
|---|---|
| Branch? | master |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| License | MIT |
AdamKasp
reviewed
Nov 6, 2020
59b7c4e to
0958db2
Compare
GSadee
reviewed
Nov 6, 2020
GSadee
approved these changes
Nov 6, 2020
Member
|
Thank you, @arti0090! 🎉 |
lchrusciel
reviewed
Nov 6, 2020
| { | ||
| $response = $this->cartsClient->getLastResponse(); | ||
|
|
||
| Assert::same($response->getStatusCode(), 500); |
Contributor
There was a problem hiding this comment.
500 is a wrong indicator of wrong coupon code usage. We should add validation to this feature.
Comment on lines
+62
to
+80
| if (null !== $couponUsageLimit) { | ||
| Assert::greaterThan($couponUsageLimit, 0, 'Promotion coupon usage has expired'); | ||
| } | ||
|
|
||
| $couponExpireDate = $promotionCoupon->getExpiresAt(); | ||
|
|
||
| if (null !== $couponExpireDate) { | ||
| Assert::greaterThan($couponExpireDate, new DateTime(), 'Promotion coupon has expired'); | ||
| } | ||
|
|
||
| $promotion = $promotionCoupon->getPromotion(); | ||
|
|
||
| Assert::notNull($promotion, 'Could not find promotion linked with this coupon'); | ||
|
|
||
| $promotionEndDate = $promotion->getEndsAt(); | ||
|
|
||
| if (null !== $promotionEndDate) { | ||
| Assert::greaterThan($promotionEndDate, new DateTime(), 'Promotion has expired'); | ||
| } |
Contributor
There was a problem hiding this comment.
Do we have to check all these things to perform this action? Most of it seems to be related to validation and processing logic.
GSadee
added a commit
that referenced
this pull request
Nov 11, 2020
This PR was merged into the 1.9-dev branch. Discussion ---------- | Q | A | --------------- | ----- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Related tickets | #12013 like this but better | License | MIT Commits ------- 071b43e changed way how it is validated 1d5617e fixed issues and changed validator logic e5e252f Fixed minor issues
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.