Skip to content

Commit 163b012

Browse files
merge magento/2.2-develop into magento-tsg/2.2-develop-pr107
2 parents 851b780 + 8abdc8e commit 163b012

File tree

15 files changed

+227
-13
lines changed

15 files changed

+227
-13
lines changed

app/code/Magento/Braintree/Gateway/Validator/ErrorCodeValidator.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ public function __invoke($response)
2727
return [true, [__('Transaction is successful.')]];
2828
}
2929

30-
return [false, $this->getErrorCodes($response->errors)];
30+
$errorCodes = $this->getErrorCodes($response->errors);
31+
if (isset($response->transaction->status) && $response->transaction->status === 'gateway_rejected') {
32+
$errorCodes[] = $response->transaction->gatewayRejectionReason;
33+
}
34+
if (isset($response->transaction->status) && $response->transaction->status === 'processor_declined') {
35+
$errorCodes[] = $response->transaction->processorResponseCode;
36+
}
37+
38+
return [false, $errorCodes];
3139
}
3240

3341
/**

app/code/Magento/Braintree/etc/braintree_error_mapping.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<message code="81716" translate="true">Credit card number must be 12-19 digits.</message>
2121
<message code="81723" translate="true">Cardholder name is too long.</message>
2222
<message code="81736" translate="true">CVV verification failed.</message>
23+
<message code="cvv" translate="true">CVV verification failed.</message>
2324
<message code="81737" translate="true">Postal code verification failed.</message>
2425
<message code="81750" translate="true">Credit card number is prohibited.</message>
2526
<message code="81801" translate="true">Addresses must have at least one field filled in.</message>

app/code/Magento/Checkout/Model/DefaultConfigProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,10 @@ public function getConfig()
330330
)
331331
)
332332
];
333+
$output['useQty'] = $this->scopeConfig->isSetFlag(
334+
'checkout/cart_link/use_qty',
335+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
336+
);
333337
$output['activeCarriers'] = $this->getActiveCarriers();
334338
$output['originCountryCode'] = $this->getOriginCountryCode();
335339
$output['paymentMethods'] = $this->getPaymentMethods();
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontAssertMiniCartItemCountActionGroup">
11+
<arguments>
12+
<argument name="productCount" type="string"/>
13+
<argument name="productCountText" type="string"/>
14+
</arguments>
15+
<see selector="{{StorefrontMinicartSection.productCount}}" userInput="{{productCount}}" stepKey="seeProductCountInCart"/>
16+
<see selector="{{StorefrontMinicartSection.visibleItemsCountText}}" userInput="{{productCountText}}" stepKey="seeNumberOfItemDisplayInMiniCart"/>
17+
</actionGroup>
18+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontCheckoutAndAssertOrderSummaryDisplayActionGroup">
11+
<arguments>
12+
<argument name="itemsText" type="string"/>
13+
</arguments>
14+
<click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="clickOnCheckOutButtonInMiniCart"/>
15+
<waitForPageLoad stepKey="waitForPageToLoad"/>
16+
<see selector="{{CheckoutShippingGuestInfoSection.itemInCart}}" userInput="{{itemsText}}" stepKey="seeOrderSummaryText"/>
17+
<seeElement selector="{{CheckoutOrderSummarySection.miniCartTab}}" stepKey="clickOnOrderSummaryTab"/>
18+
<waitForPageLoad stepKey="waitForPageToLoad1"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontOpenMiniCartActionGroup">
11+
<waitForElementVisible selector="{{StorefrontMinicartSection.showCart}}" stepKey="waitForElementToBeVisible"/>
12+
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickOnMiniCart"/>
13+
<waitForPageLoad stepKey="waitForPageToLoad"/>
14+
</actionGroup>
15+
</actionGroups>

app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,16 @@
8181
<data key="label">No</data>
8282
<data key="value">0</data>
8383
</entity>
84+
85+
<!-- Checkout Config: Display Cart Summary -->
86+
<entity name="DisplayItemsQuantities">
87+
<data key="path">checkout/cart_link/use_qty</data>
88+
<data key="label">Display items quantities</data>
89+
<data key="value">1</data>
90+
</entity>
91+
<entity name="DisplayUniqueItems">
92+
<data key="path">checkout/cart_link/use_qty</data>
93+
<data key="label">Display number of items in cart</data>
94+
<data key="value">0</data>
95+
</entity>
8496
</entities>

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingGuestInfoSection.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,9 @@
2121
<element name="telephone" type="input" selector="input[name=telephone]"/>
2222
<element name="country" type="select" selector="select[name=country_id]"/>
2323
<element name="company" type="input" selector="input[name=company]"/>
24+
25+
<!--Order Summary-->
26+
<element name="itemInCart" type="button" selector="//div[@class='title']"/>
27+
<element name="productName" type="text" selector="//strong[@class='product-item-name']"/>
2428
</section>
2529
</sections>

app/code/Magento/Checkout/Test/Mftf/Section/StorefrontMinicartSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@
2626
<element name="itemQuantityUpdate" type="button" selector="//a[text()='{{productName}}']/../..//span[text()='Update']" parameterized="true"/>
2727
<element name="emptyCart" type="text" selector=".counter.qty.empty"/>
2828
<element name="minicartContent" type="block" selector="#minicart-content-wrapper"/>
29+
<element name="visibleItemsCountText" type="text" selector="//div[@class='items-total']"/>
2930
</section>
3031
</sections>
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="StorefrontCartItemsCountDisplayItemsQuantities">
11+
<annotations>
12+
<stories value="Checkout order summary has wrong item count"/>
13+
<title value="Checkout order summary has wrong item count - display items quantities"/>
14+
<description value="Items count in shopping cart and on checkout page should be consistent with settings 'checkout/cart_link/use_qty'"/>
15+
<testCaseId value="MC-18286"/>
16+
<severity value="CRITICAL"/>
17+
<group value="checkout"/>
18+
</annotations>
19+
20+
<before>
21+
<!--Set Display Cart Summary to display items quantities-->
22+
<magentoCLI command="config:set {{DisplayItemsQuantities.path}} {{DisplayItemsQuantities.value}}" stepKey="setDisplayCartSummary"/>
23+
<!--Create category-->
24+
<createData entity="_defaultCategory" stepKey="category1"/>
25+
<!--Create product1-->
26+
<createData entity="_defaultProduct" stepKey="simpleProduct1">
27+
<requiredEntity createDataKey="category1"/>
28+
</createData>
29+
<!--Create product2-->
30+
<createData entity="_defaultProduct" stepKey="simpleProduct2">
31+
<requiredEntity createDataKey="category1"/>
32+
</createData>
33+
</before>
34+
<after>
35+
<deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/>
36+
<deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/>
37+
<deleteData createDataKey="category1" stepKey="deleteCategory1"/>
38+
<magentoCLI command="config:set {{DisplayItemsQuantities.path}} {{DisplayItemsQuantities.value}}" stepKey="resetDisplayCartSummary"/>
39+
</after>
40+
41+
<!-- Add simpleProduct1 to cart -->
42+
<amOnPage url="{{StorefrontProductPage.url($$simpleProduct1.custom_attributes[url_key]$)}}" stepKey="amOnProduct1Page"/>
43+
<actionGroup ref="StorefrontAddProductToCartQuantityActionGroup" stepKey="addProduct1ToCart">
44+
<argument name="productName" value="$$simpleProduct1.name$$"/>
45+
<argument name="quantity" value="2"/>
46+
</actionGroup>
47+
<!-- Add simpleProduct2 to cart -->
48+
<amOnPage url="{{StorefrontProductPage.url($$simpleProduct2.custom_attributes[url_key]$)}}" stepKey="amOnProduct2Page"/>
49+
<actionGroup ref="StorefrontAddProductToCartQuantityActionGroup" stepKey="addProduct2ToCart">
50+
<argument name="productName" value="$$simpleProduct2.name$$"/>
51+
<argument name="quantity" value="1"/>
52+
</actionGroup>
53+
54+
<!-- Open Mini Cart -->
55+
<actionGroup ref="StorefrontOpenMiniCartActionGroup" stepKey="openMiniCart"/>
56+
57+
<!-- Assert Products Count in Mini Cart -->
58+
<actionGroup ref="StorefrontAssertMiniCartItemCountActionGroup" stepKey="assertProductCountAndTextInMiniCart">
59+
<argument name="productCount" value="3"/>
60+
<argument name="productCountText" value="3 Items in Cart"/>
61+
</actionGroup>
62+
<!-- Assert Products Count on checkout page -->
63+
<actionGroup ref="StorefrontCheckoutAndAssertOrderSummaryDisplayActionGroup" stepKey="assertProductCountOnCheckoutPage">
64+
<argument name="itemsText" value="3 Items in Cart"/>
65+
</actionGroup>
66+
</test>
67+
<test name="StorefrontCartItemsCountDisplayUniqueItems" extends="StorefrontCartItemsCountDisplayItemsQuantities">
68+
<annotations>
69+
<stories value="Checkout order summary has wrong item count"/>
70+
<title value="Checkout order summary has wrong item count - display unique items"/>
71+
<description value="Items count in shopping cart and on checkout page should be consistent with settings 'checkout/cart_link/use_qty'"/>
72+
<testCaseId value="MC-18286"/>
73+
<severity value="CRITICAL"/>
74+
<group value="checkout"/>
75+
</annotations>
76+
77+
<!-- Assert Products Count in Mini Cart -->
78+
<actionGroup ref="StorefrontAssertMiniCartItemCountActionGroup" stepKey="assertProductCountAndTextInMiniCart">
79+
<argument name="productCount" value="2"/>
80+
<argument name="productCountText" value="2 Items in Cart"/>
81+
</actionGroup>
82+
<!-- Assert Products Count on checkout page -->
83+
<actionGroup ref="StorefrontCheckoutAndAssertOrderSummaryDisplayActionGroup" stepKey="assertProductCountOnCheckoutPage">
84+
<argument name="itemsText" value="2 Items in Cart"/>
85+
</actionGroup>
86+
87+
<before>
88+
<!--Set Display Cart Summary to display items quantities-->
89+
<magentoCLI command="config:set {{DisplayUniqueItems.path}} {{DisplayUniqueItems.value}}" stepKey="setDisplayCartSummary"/>
90+
</before>
91+
</test>
92+
</tests>

0 commit comments

Comments
 (0)