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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CatalogPromotion][API][UI] Fixed discount action #13325

Merged
merged 11 commits into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/book/products/catalog_promotions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ Catalog Promotion Actions configuration reference
+-------------------------------+--------------------------------------------------------------------+
| Action type | Action Configuration Array |
+===============================+====================================================================+
| ``fixed_discount`` | ``[$channelCode => ['amount' => $amountInteger]]`` |
+-------------------------------+--------------------------------------------------------------------+
| ``percentage_discount`` | ``['amount' => $amountFloat]`` |
+-------------------------------+--------------------------------------------------------------------+

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@applying_catalog_promotions
Feature: Applying all available types of catalog promotions
In order to see products in best prices
As a Customer
I want to see discounted products in the catalog

Background:
Given the store operates on a channel named "Web-US"
And the store classifies its products as "Clothes"
And the store has a "T-Shirt" configurable product
And this product belongs to "Clothes"
And this product has "PHP T-Shirt" variant priced at "$100.00" in "Web-US" channel
And there is a catalog promotion "PHP sale" that reduces price by "10%" and applies on "PHP T-Shirt" variant
And there is a catalog promotion "T-Shirt sale" that reduces price by "10%" and applies on "T-Shirt" product
And there is a catalog promotion "Clothes sale" that reduces price by "10%" and applies on "Clothes" taxon
And there is a catalog promotion "Fixed PHP sale" that reduces price by fixed "$5.00" in the "Web-US" channel and applies on "PHP T-Shirt" variant
And there is a catalog promotion "Fixed T-Shirt sale" that reduces price by fixed "$5.00" in the "Web-US" channel and applies on "T-Shirt" product
And there is a catalog promotion "Fixed Clothes sale" that reduces price by fixed "$5.00" in the "Web-US" channel and applies on "Clothes" taxon

@api @ui
Scenario: Applying multiple catalog promotions
When I view "PHP T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$100.00" to "$57.90" with 6 promotions
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ Feature: Applying catalog promotion with proper priorities

Background:
Given the store operates on a single channel in "United States"
And the store classifies its products as "Clothes"
And the store has a "T-Shirt" configurable product
And this product belongs to "Clothes"
And this product has "PHP T-Shirt" variant priced at "$100.00"
And there is a catalog promotion "Clothes sale" with priority 10 that reduces price by "30%" and applies on "PHP T-Shirt" variant
And there is a catalog promotion "Winter sale" with priority 100 that reduces price by "50%" and applies on "PHP T-Shirt" variant
And there is a catalog promotion "Autumn sale" with priority 10 that reduces price by "25%" and applies on "PHP T-Shirt" variant
And there is a catalog promotion "Winter sale" with priority 40 that reduces price by fixed "$10.00" in the "United States" channel and applies on "T-Shirt" product
And there is a catalog promotion "Spring sale" with priority 20 that reduces price by fixed "$5.00" in the "United States" channel and applies on "Clothes" taxon
And there is a catalog promotion "Summer sale" with priority 30 that reduces price by "50%" and applies on "PHP T-Shirt" variant

@api @ui
Scenario: Applying catalog promotion with descending order by their priority
When I view "PHP T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$100.00" to "$35.00" with "Winter sale" and "Clothes sale" promotions
Then I should see this variant is discounted from "$100.00" to "$30.00" with "Winter sale", "Summer sale", "Spring sale" and "Autumn sale" promotions
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@applying_catalog_promotions
Feature: Applying catalog promotions with fixed discount action
In order to be attracted to specific products
As a Visitor
I want to see discounted products in the catalog

Background:
Given the store operates on a single channel in "United States"
And the store has a "T-Shirt" configurable product
And this product has "PHP T-Shirt" variant priced at "$20.00"
And this product has "Java T-Shirt" variant priced at "$30.00"
And there is a catalog promotion "Winter sale" that reduces price by fixed "$10.00" in the "United States" channel and applies on "T-Shirt" product

@api @ui
Scenario: Applying simple catalog promotion
When I view "PHP T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$20.00" to "$10.00" with "Winter sale" promotion

@api @ui @javascript
Scenario: Applying simple catalog promotion on another variant
When I view "Java T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$30.00" to "$20.00" with "Winter sale" promotion

@api @ui
Scenario: Applying multiple catalog promotions
Given there is a catalog promotion "Christmas sale" that reduces price by fixed "$5.00" in the "United States" channel and applies on "PHP T-Shirt" variant
When I view "PHP T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$20.00" to "$5.00" with "Winter sale" and "Christmas sale" promotions

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@applying_catalog_promotions
Feature: Applying catalog promotions with taking minimum price into account
In order to avoid too much discount applied on product
As a Visitor
I want to see discounted products in the catalog up to minimum price

Background:
Given the store operates on a single channel in "United States"
And the store has a "T-Shirt" configurable product
And this product has "PHP T-Shirt" variant priced at "$20.00"
And the "PHP T-Shirt" variant has minimum price of "$15.00" in the "United States" channel

@api @ui
Scenario: Applying percentage discount up to minimum price
Given there is a catalog promotion "Winter sale" that reduces price by "80%" and applies on "PHP T-Shirt" variant
When I view "PHP T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$20.00" to "$15.00" with "Winter sale" promotion

@api @ui
Scenario: Applying fixed discount up to minimum price
Given there is a catalog promotion "Winter sale" that reduces price by fixed "$10.00" in the "United States" channel and applies on "PHP T-Shirt" variant
When I view "PHP T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$20.00" to "$15.00" with "Winter sale" promotion

@api @ui
Scenario: Not applying promotion if product is priced on same price as its minimum price
Given there is a catalog promotion "Winter sale" that reduces price by "80%" and applies on "PHP T-Shirt" variant
And there is a catalog promotion "T-shirt Sale" that reduces price by "40%" and applies on "PHP T-Shirt" variant
When I view "PHP T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$20.00" to "$15.00" with only "Winter sale" promotion
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ Feature: Creating a catalog promotion
And it should have "winter_sale" code and "Winter sale" name
And the catalog promotion "Winter sale" should be available in channel "United States"

@api @ui @javascript
Scenario: Creating a catalog promotion with fixed discount action
When I want to create a new catalog promotion
And I specify its code as "winter_sale"
And I name it "Winter sale"
And I add scope that applies on "Clothes" taxon
And I add action that gives "$10.00" of fixed discount in the "United States" channel
And I add it
Then there should be 1 new catalog promotion on the list
And it should have "winter_sale" code and "Winter sale" name
And the "Winter sale" catalog promotion should have "$10.00" of fixed discount in the "United States" channel

@api @ui @javascript
Scenario: Creating a catalog promotion for taxon
When I want to create a new catalog promotion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ Feature: Editing catalog promotion
Then I should be notified that it has been successfully edited
And this catalog promotion should have "40%" percentage discount

@api @ui @javascript
Scenario: Editing catalog promotion action to be a fixed discount
When I edit "Christmas sale" catalog promotion to have "$10.00" of fixed discount in the "United States" channel
Then I should be notified that it has been successfully edited
And this catalog promotion should have "$10.00" of fixed discount in the "United States" channel

@api @ui
Scenario: Being unable to edit catalog promotion if it is currently being processed
Given the catalog promotion "Christmas sale" is currently being processed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,48 @@ Feature: Validating a catalog promotion creation
Then I should be notified that a discount amount should be a number and cannot be empty
And there should be an empty list of catalog promotions

@api @ui @javascript
Scenario: Trying to create a catalog promotion with not configured fixed discount action
When I want to create a new catalog promotion
And I specify its code as "winter_sale"
And I name it "Winter sale"
And I make it available in channel "United States"
And I specify its label as "Winter -50%" in "English (United States)"
And I describe it as "This promotion gives a $10.00 discount on every product" in "English (United States)"
And I add scope that applies on variants "PHP T-Shirt" variant and "Kotlin T-Shirt" variant
And I add fixed discount action without amount configured
And I try to add it
Then I should be notified that a discount amount should be configured for at least one channel
And there should be an empty list of catalog promotions

@api @ui @javascript
Scenario: Trying to create a catalog promotion with wrong value of fixed discount action
When I want to create a new catalog promotion
And I specify its code as "winter_sale"
And I name it "Winter sale"
And I make it available in channel "United States"
And I specify its label as "Winter -50%" in "English (United States)"
And I describe it as "This promotion gives a $10.00 discount on every product" in "English (United States)"
And I add scope that applies on variants "PHP T-Shirt" variant and "Kotlin T-Shirt" variant
And I add invalid fixed discount action with non number in amount for the "United States" channel
And I try to add it
Then I should be notified that a discount amount should be configured for at least one channel
And there should be an empty list of catalog promotions

@api
Scenario: Trying to create a catalog promotion with fixed discount action with invalid channel
When I want to create a new catalog promotion
And I specify its code as "winter_sale"
And I name it "Winter sale"
And I make it available in channel "United States"
And I specify its label as "Winter -50%" in "English (United States)"
And I describe it as "This promotion gives a $10.00 discount on every product" in "English (United States)"
And I add scope that applies on variants "PHP T-Shirt" variant and "Kotlin T-Shirt" variant
And I add invalid fixed discount action configured for nonexistent channel
And I try to add it
Then I should be notified that at least one of the provided channel codes does not exist
And there should be an empty list of catalog promotions

@api @ui @javascript
Scenario: Trying to create a catalog promotion with taxon type without taxons
When I want to create a new catalog promotion
Expand Down
Loading