Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] Denying usage of coupon for invalid promotion #12704

Merged
merged 9 commits into from Jun 9, 2021

Conversation

Zales0123
Copy link
Member

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets
License MIT

I've also unified the validation message to always show that coupon code is invalid (from the perspective of a Customer, much more natural information than Promotion is invalid 馃拑)

@Zales0123 Zales0123 added Feature New feature proposals. Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). API APIs related issues and PRs. labels Jun 9, 2021
@Zales0123 Zales0123 requested a review from a team as a code owner June 9, 2021 09:09
@Zales0123 Zales0123 changed the title [API] Import proper context to fix coupon invalidity checking [API] Denying usage of coupon for invalid promotion Jun 9, 2021
@Zales0123 Zales0123 force-pushed the api-invalid-promotion-coupon-usage branch from eb7f5d4 to 81bf5da Compare June 9, 2021 09:33
/** @var PromotionInterface $promotion */
$promotion = $promotionCoupon->getPromotion();

if (!$promotion->getChannels()->contains($cart->getChannel())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!$promotion->getChannels()->contains($cart->getChannel())) {
if (!$promotion->hasChannel($cart->getChannel())) {

@GSadee GSadee merged commit f272bdd into Sylius:master Jun 9, 2021
@GSadee
Copy link
Member

GSadee commented Jun 9, 2021

Thank you, Mateusz! 馃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API APIs related issues and PRs. Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). Feature New feature proposals.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants