Skip to content

Commit

Permalink
feature #15539 [API][Admin] Promotion coupons management(CRUD) (NoRes…
Browse files Browse the repository at this point in the history
…ponseMate, Wojdylak)

This PR was merged into the 1.13 branch.

Discussion
----------

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

Commits
-------

4715396 [API][Admin] Browsing coupons
41efb5f [API][Admin] Sorting coupons
cb3770b [API][Admin] Deleting coupons
9b88446 [API][Admin] Creating coupons
54b87d0 [API][Admin] Updating coupons
ae13ab3 [API][Admin] Validating coupons
854393e Add coupons to payload in PromotionCouponsTest
6d33557 Add api test for coupon_unique_code_validation.feature
440a75a Resolve phpstan issues
e6f4b2b Add PromotionCouponCannotBeRemoved to code mapping
c0ac149 [ApiBundle] Add promotion coupon endpoint as a subresource
41ed0f3 [ApiBundle] Add PromotionCouponPromotionFilter class
08251e4 [ApiBundle] Resolve phpstan issues
e82780e [ApiBundle] Add to test information abut PromotionCouponPromotionFilter
  • Loading branch information
GSadee committed Dec 1, 2023
2 parents ba0e65d + e82780e commit 079766a
Show file tree
Hide file tree
Showing 44 changed files with 1,588 additions and 53 deletions.
4 changes: 2 additions & 2 deletions features/promotion/managing_coupons/adding_coupon.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: Adding a new coupon
And it is coupon based promotion
And I am logged in as an administrator

@ui
@ui @api
Scenario: Adding a new coupon
When I want to create a new coupon for this promotion
And I specify its code as "SANTA2016"
Expand All @@ -19,4 +19,4 @@ Feature: Adding a new coupon
And I make it valid until "21.04.2017"
And I add it
Then I should be notified that it has been successfully created
And there should be coupon with code "SANTA2016"
And there should be a "Christmas sale" promotion with a coupon code "SANTA2016"
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Feature: Browsing promotion coupons
And the store has promotion "Christmas sale" with coupon "SANTA2016"
And I am logged in as an administrator

@ui
Scenario: Browsing coupons in store
@ui @api
Scenario: Browsing coupons of a promotion
When I want to view all coupons of this promotion
And there should be 1 coupon related to this promotion
And there should be coupon with code "SANTA2016"
And there should be a "Christmas sale" promotion with a coupon code "SANTA2016"
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Coupon unique code validation
And the store has promotion "Christmas sale" with coupon "SANTA2016"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Trying to add coupon with taken code
When I want to create a new coupon for this promotion
And I specify its code as "SANTA2016"
Expand Down
35 changes: 29 additions & 6 deletions features/promotion/managing_coupons/coupon_validation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: Coupon validation
And it is coupon based promotion
And I am logged in as an administrator

@ui
@ui @api
Scenario: Trying to add a new coupon without specifying its code
When I want to create a new coupon for this promotion
And I do not specify its code
Expand All @@ -19,9 +19,9 @@ Feature: Coupon validation
And I make it valid until "26.03.2017"
And I try to add it
Then I should be notified that code is required
And there should be 0 coupon related to this promotion
And there should be 0 coupons related to this promotion

@ui
@ui @api
Scenario: Trying to add a new coupon with usage limit below one
When I want to create a new coupon for this promotion
And I specify its code as "SANTA2016"
Expand All @@ -30,9 +30,9 @@ Feature: Coupon validation
And I make it valid until "26.03.2017"
And I try to add it
Then I should be notified that coupon usage limit must be at least one
And there should be 0 coupon related to this promotion
And there should be 0 coupons related to this promotion

@ui
@ui @api
Scenario: Trying to add a new coupon with per customer usage limit below one
When I want to create a new coupon for this promotion
And I specify its code as "SANTA2016"
Expand All @@ -41,4 +41,27 @@ Feature: Coupon validation
And I make it valid until "26.03.2017"
And I try to add it
Then I should be notified that coupon usage limit per customer must be at least one
And there should be 0 coupon related to this promotion
And there should be 0 coupons related to this promotion

@api @no-ui
Scenario: Trying to add a new coupon with no promotion
When I want to create a new coupon
And I specify its code as "RANDOM"
And I limit its usage to 30 times
And I limit its per customer usage to 3 times
And I make it valid until "26.03.2017"
And I try to add it
Then I should be notified that promotion is required
And there should be no coupon with code "RANDOM"

@api @no-ui
Scenario: Trying to add a new coupon for a non-coupon based promotion
Given there is a promotion "Flash sale"
When I want to create a new coupon for this promotion
And I specify its code as "FAST-50"
And I limit its usage to 50 times
And I limit its per customer usage to 1 time
And I make it valid until "26.03.2017"
And I try to add it
Then I should be notified that only coupon based promotions can have coupons
And there should be 0 coupons related to this promotion
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Deleting a coupon
And the store has promotion "Christmas sale" with coupon "SANTA2016"
And I am logged in as an administrator

@domain @ui
@domain @ui @api
Scenario: Deleted coupon should disappear from the registry
When I delete "SANTA2016" coupon related to this promotion
Then I should be notified that it has been successfully deleted
Expand Down
22 changes: 15 additions & 7 deletions features/promotion/managing_coupons/editing_coupon.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,39 @@ Feature: Editing promotion coupon
And the store has promotion "Christmas sale" with coupon "SANTA2016"
And I am logged in as an administrator

@ui
@ui @api
Scenario: Changing coupon expires date
When I want to modify the "SANTA2016" coupon for this promotion
And I change expires date to "21.05.2019"
And I change its expiration date to "21.05.2019"
And I save my changes
Then I should be notified that it has been successfully edited
And this coupon should be valid until "21.05.2019"

@ui
@ui @api
Scenario: Changing coupons usage limit
When I want to modify the "SANTA2016" coupon for this promotion
And I change its usage limit to 50
And I save my changes
Then I should be notified that it has been successfully edited
And this coupon should have 50 usage limit

@ui
@ui @api
Scenario: Changing coupons per customer usage limit
When I want to modify the "SANTA2016" coupon for this promotion
And I change its per customer usage limit to 20
And I save my changes
Then I should be notified that it has been successfully edited
And this coupon should have 20 per customer usage limit

@ui
Scenario: Seeing a disabled code field when editing a coupon
@ui @api
Scenario: Changing whether it can be reused from cancelled orders
When I want to modify the "SANTA2016" coupon for this promotion
Then the code field should be disabled
And I make it not reusable from cancelled orders
And I save my changes
Then I should be notified that it has been successfully edited
And this coupon should not be reusable from cancelled orders

@ui @api
Scenario: Being unable to change code of promotion coupon
When I want to modify the "SANTA2016" coupon for this promotion
Then I should not be able to edit its code
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: Not being able to delete a coupon which is in use
And the customer chose "Free" shipping method to "United States" with "Cash on Delivery" payment
And I am logged in as an administrator

@domain @ui
@domain @ui @api
Scenario: Being unable to delete a used coupon
When I try to delete "SANTA2016" coupon related to this promotion
Then I should be notified that it is in use and cannot be deleted
Expand Down
20 changes: 10 additions & 10 deletions features/promotion/managing_coupons/sorting_coupons.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,69 +19,69 @@ Feature: Sorting listed coupons
And this coupon expires on "20-02-2023"
And I am logged in as an administrator

@ui
@ui @api
Scenario: Coupons are sorted by descending number of uses by default
When I want to view all coupons of this promotion
Then I should see 3 coupons on the list
And the first coupon should have code "Y"

@ui
@ui @api
Scenario: Changing the number of uses sorting order to ascending
Given I am browsing coupons of this promotion
When I sort coupons by ascending number of uses
Then I should see 3 coupons on the list
And the first coupon should have code "X"

@ui
@ui @api
Scenario: Sorting coupons by code in descending order
Given I am browsing coupons of this promotion
When I sort coupons by descending code
Then I should see 3 coupons on the list
And the first coupon should have code "Z"

@ui
@ui @api
Scenario: Sorting coupons by code in ascending order
Given I am browsing coupons of this promotion
When I sort coupons by ascending code
Then I should see 3 coupons on the list
And the first coupon should have code "X"

@ui @no-postgres
@ui @no-postgres @api
Scenario: Sorting coupons by usage limit in descending order
Given I am browsing coupons of this promotion
When I sort coupons by descending usage limit
Then I should see 3 coupons on the list
And the first coupon should have code "X"

@ui @no-postgres
@ui @no-postgres @api
Scenario: Sorting coupons by usage limit in ascending order
Given I am browsing coupons of this promotion
When I sort coupons by ascending usage limit
Then I should see 3 coupons on the list
And the first coupon should have code "Z"

@ui @no-postgres
@ui @no-postgres @api
Scenario: Sorting coupons by usage limit per customer in descending order
Given I am browsing coupons of this promotion
When I sort coupons by descending usage limit per customer
Then I should see 3 coupons on the list
And the first coupon should have code "X"

@ui @no-postgres
@ui @no-postgres @api
Scenario: Sorting coupons by usage limit per customer in ascending order
Given I am browsing coupons of this promotion
When I sort coupons by ascending usage limit per customer
Then I should see 3 coupons on the list
And the first coupon should have code "Y"

@ui @no-postgres
@ui @no-postgres @api
Scenario: Sorting coupons by expiration date in descending order
Given I am browsing coupons of this promotion
When I sort coupons by descending expiration date
Then I should see 3 coupons on the list
And the first coupon should have code "Z"

@ui @no-postgres
@ui @no-postgres @api
Scenario: Sorting coupons by expiration date in ascending order
Given I am browsing coupons of this promotion
When I sort coupons by ascending expiration date
Expand Down

0 comments on commit 079766a

Please sign in to comment.