Skip to content

Commit a233dac

Browse files
committed
Merge branch '2.3-develop' into MC-13951-Declarative-upgrade-leads-to-the-re-creation-of-indexes
2 parents 52161a4 + d9d4b82 commit a233dac

File tree

72 files changed

+1727
-303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1727
-303
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Braintree\Gateway\Request;
7+
8+
use Magento\Payment\Gateway\Request\BuilderInterface;
9+
use Magento\Braintree\Gateway\SubjectReader;
10+
11+
/**
12+
* Class BillingAddressDataBuilder
13+
*/
14+
class BillingAddressDataBuilder implements BuilderInterface
15+
{
16+
/**
17+
* @var SubjectReader
18+
*/
19+
private $subjectReader;
20+
21+
/**
22+
* BillingAddress block name
23+
*/
24+
private const BILLING_ADDRESS = 'billing';
25+
26+
/**
27+
* The customer’s company. 255 character maximum.
28+
*/
29+
private const COMPANY = 'company';
30+
31+
/**
32+
* The first name value must be less than or equal to 255 characters.
33+
*/
34+
private const FIRST_NAME = 'firstName';
35+
36+
/**
37+
* The last name value must be less than or equal to 255 characters.
38+
*/
39+
private const LAST_NAME = 'lastName';
40+
41+
/**
42+
* The street address. Maximum 255 characters, and must contain at least 1 digit.
43+
* Required when AVS rules are configured to require street address.
44+
*/
45+
private const STREET_ADDRESS = 'streetAddress';
46+
47+
/**
48+
* The postal code. Postal code must be a string of 5 or 9 alphanumeric digits,
49+
* optionally separated by a dash or a space. Spaces, hyphens,
50+
* and all other special characters are ignored.
51+
*/
52+
private const POSTAL_CODE = 'postalCode';
53+
54+
/**
55+
* The ISO 3166-1 alpha-2 country code specified in an address.
56+
* The gateway only accepts specific alpha-2 values.
57+
*
58+
* @link https://developers.braintreepayments.com/reference/general/countries/php#list-of-countries
59+
*/
60+
private const COUNTRY_CODE = 'countryCodeAlpha2';
61+
62+
/**
63+
* The extended address information—such as apartment or suite number. 255 character maximum.
64+
*/
65+
private const EXTENDED_ADDRESS = 'extendedAddress';
66+
67+
/**
68+
* The locality/city. 255 character maximum.
69+
*/
70+
private const LOCALITY = 'locality';
71+
72+
/**
73+
* The state or province. For PayPal addresses, the region must be a 2-letter abbreviation;
74+
*/
75+
private const REGION = 'region';
76+
77+
/**
78+
* @param SubjectReader $subjectReader
79+
*/
80+
public function __construct(SubjectReader $subjectReader)
81+
{
82+
$this->subjectReader = $subjectReader;
83+
}
84+
85+
/**
86+
* @inheritdoc
87+
*/
88+
public function build(array $buildSubject)
89+
{
90+
$paymentDO = $this->subjectReader->readPayment($buildSubject);
91+
92+
$result = [];
93+
$order = $paymentDO->getOrder();
94+
95+
$billingAddress = $order->getBillingAddress();
96+
if ($billingAddress) {
97+
$result[self::BILLING_ADDRESS] = [
98+
self::REGION => $billingAddress->getRegionCode(),
99+
self::POSTAL_CODE => $billingAddress->getPostcode(),
100+
self::COUNTRY_CODE => $billingAddress->getCountryId(),
101+
self::FIRST_NAME => $billingAddress->getFirstname(),
102+
self::STREET_ADDRESS => $billingAddress->getStreetLine1(),
103+
self::LAST_NAME => $billingAddress->getLastname(),
104+
self::COMPANY => $billingAddress->getCompany(),
105+
self::EXTENDED_ADDRESS => $billingAddress->getStreetLine2(),
106+
self::LOCALITY => $billingAddress->getCity()
107+
];
108+
}
109+
110+
return $result;
111+
}
112+
}

app/code/Magento/Braintree/Test/Unit/Gateway/Validator/ErrorCodeProviderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ public function getErrorCodeDataProvider(): array
7474
'errors' => [],
7575
'transaction' => [
7676
'status' => 'processor_declined',
77-
'processorResponseCode' => '1000'
77+
'processorResponseCode' => '2059'
7878
],
79-
'expectedResult' => ['1000']
79+
'expectedResult' => ['2059']
8080
],
8181
[
8282
'errors' => [

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<message code="81723" translate="true">Cardholder name is too long.</message>
2222
<message code="81736" translate="true">CVV verification failed.</message>
2323
<message code="cvv" translate="true">CVV verification failed.</message>
24+
<message code="2059" translate="true">Address Verification Failed.</message>
2425
<message code="81737" translate="true">Postal code verification failed.</message>
2526
<message code="81750" translate="true">Credit card number is prohibited.</message>
2627
<message code="81801" translate="true">Addresses must have at least one field filled in.</message>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@
381381
<item name="customer" xsi:type="string">Magento\Braintree\Gateway\Request\CustomerDataBuilder</item>
382382
<item name="payment" xsi:type="string">Magento\Braintree\Gateway\Request\PaymentDataBuilder</item>
383383
<item name="channel" xsi:type="string">Magento\Braintree\Gateway\Request\ChannelDataBuilder</item>
384-
<item name="address" xsi:type="string">Magento\Braintree\Gateway\Request\AddressDataBuilder</item>
384+
<item name="address" xsi:type="string">Magento\Braintree\Gateway\Request\BillingAddressDataBuilder</item>
385385
<item name="dynamic_descriptor" xsi:type="string">Magento\Braintree\Gateway\Request\DescriptorDataBuilder</item>
386386
<item name="store" xsi:type="string">Magento\Braintree\Gateway\Request\StoreConfigBuilder</item>
387387
<item name="merchant_account" xsi:type="string">Magento\Braintree\Gateway\Request\MerchantAccountDataBuilder</item>

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ define([
1717
'Magento_Vault/js/view/payment/vault-enabler',
1818
'Magento_Checkout/js/action/create-billing-address',
1919
'Magento_Braintree/js/view/payment/kount',
20-
'mage/translate'
20+
'mage/translate',
21+
'Magento_Ui/js/model/messageList'
2122
], function (
2223
$,
2324
_,
@@ -31,7 +32,8 @@ define([
3132
VaultEnabler,
3233
createBillingAddress,
3334
kount,
34-
$t
35+
$t,
36+
globalMessageList
3537
) {
3638
'use strict';
3739

@@ -415,6 +417,18 @@ define([
415417
*/
416418
onVaultPaymentTokenEnablerChange: function () {
417419
this.reInitPayPal();
420+
},
421+
422+
/**
423+
* Show error message
424+
*
425+
* @param {String} errorMessage
426+
* @private
427+
*/
428+
showError: function (errorMessage) {
429+
globalMessageList.addErrorMessage({
430+
message: errorMessage
431+
});
418432
}
419433
});
420434
});
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
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+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontSortBundleProductsByPriceTest">
12+
<annotations>
13+
<features value="Bundle"/>
14+
<stories value="Bundle products list on Storefront"/>
15+
<title value="Customer should be able to sort bundle products by price when viewing products list"/>
16+
<description value="Customer should be able to sort bundle products by price when viewing products list"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-228"/>
19+
<group value="bundle"/>
20+
</annotations>
21+
<before>
22+
<!-- Create category -->
23+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
24+
25+
<!-- Create simple products for first bundle product -->
26+
<createData entity="SimpleProduct2" stepKey="createFirstSimpleProduct">
27+
<field key="price">100.00</field>
28+
</createData>
29+
<createData entity="SimpleProduct2" stepKey="createSecondSimpleProduct"/>
30+
31+
<!-- Create first bundle product -->
32+
<createData entity="ApiBundleProductPriceViewRange" stepKey="createFirstBundleProduct">
33+
<requiredEntity createDataKey="createCategory"/>
34+
</createData>
35+
<createData entity="DropDownBundleOption" stepKey="firstProductBundleOption">
36+
<requiredEntity createDataKey="createFirstBundleProduct"/>
37+
</createData>
38+
<createData entity="ApiBundleLink" stepKey="createFirstBundleLink">
39+
<requiredEntity createDataKey="createFirstBundleProduct"/>
40+
<requiredEntity createDataKey="firstProductBundleOption"/>
41+
<requiredEntity createDataKey="createFirstSimpleProduct"/>
42+
</createData>
43+
<createData entity="ApiBundleLink" stepKey="createSecondBundleLink">
44+
<requiredEntity createDataKey="createFirstBundleProduct"/>
45+
<requiredEntity createDataKey="firstProductBundleOption"/>
46+
<requiredEntity createDataKey="createSecondSimpleProduct"/>
47+
</createData>
48+
49+
<!-- Create simple products for second bundle product -->
50+
<createData entity="SimpleProduct2" stepKey="createFirstProduct">
51+
<field key="price">10.00</field>
52+
</createData>
53+
<createData entity="SimpleProduct2" stepKey="createSecondProduct"/>
54+
55+
<!-- Create second bundle product -->
56+
<createData entity="ApiBundleProductPriceViewRange" stepKey="createSecondBundleProduct">
57+
<requiredEntity createDataKey="createCategory"/>
58+
</createData>
59+
<createData entity="DropDownBundleOption" stepKey="secondProductBundleOption">
60+
<requiredEntity createDataKey="createSecondBundleProduct"/>
61+
</createData>
62+
<createData entity="ApiBundleLink" stepKey="createBundleLinkFirst">
63+
<requiredEntity createDataKey="createSecondBundleProduct"/>
64+
<requiredEntity createDataKey="secondProductBundleOption"/>
65+
<requiredEntity createDataKey="createFirstProduct"/>
66+
</createData>
67+
<createData entity="ApiBundleLink" stepKey="createBundleLinkSecond">
68+
<requiredEntity createDataKey="createSecondBundleProduct"/>
69+
<requiredEntity createDataKey="secondProductBundleOption"/>
70+
<requiredEntity createDataKey="createSecondProduct"/>
71+
</createData>
72+
73+
<!-- Create simple products for third bundle product -->
74+
<createData entity="SimpleProduct2" stepKey="createFirstProductForBundle"/>
75+
<createData entity="SimpleProduct2" stepKey="createSecondProductForBundle">
76+
<field key="price">500.00</field>
77+
</createData>
78+
79+
<!-- Create third bundle product -->
80+
<createData entity="ApiBundleProductPriceViewRange" stepKey="createThirdBundleProduct">
81+
<requiredEntity createDataKey="createCategory"/>
82+
</createData>
83+
<createData entity="DropDownBundleOption" stepKey="createThirdProductBundleOption">
84+
<requiredEntity createDataKey="createThirdBundleProduct"/>
85+
</createData>
86+
<createData entity="ApiBundleLink" stepKey="createBundleFirstLink">
87+
<requiredEntity createDataKey="createThirdBundleProduct"/>
88+
<requiredEntity createDataKey="createThirdProductBundleOption"/>
89+
<requiredEntity createDataKey="createFirstProductForBundle"/>
90+
</createData>
91+
<createData entity="ApiBundleLink" stepKey="createBundleSecondLink">
92+
<requiredEntity createDataKey="createThirdBundleProduct"/>
93+
<requiredEntity createDataKey="createThirdProductBundleOption"/>
94+
<requiredEntity createDataKey="createSecondProductForBundle"/>
95+
</createData>
96+
97+
<!-- Perform CLI reindex -->
98+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
99+
</before>
100+
<after>
101+
<!-- Delete all created data -->
102+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
103+
<deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
104+
<deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
105+
<deleteData createDataKey="createFirstBundleProduct" stepKey="deleteFirstBundleProduct"/>
106+
<deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/>
107+
<deleteData createDataKey="createSecondProduct" stepKey="deleteSecondProduct"/>
108+
<deleteData createDataKey="createSecondBundleProduct" stepKey="deleteSecondBundleProduct"/>
109+
<deleteData createDataKey="createFirstProductForBundle" stepKey="deleteFirstProductForBundle"/>
110+
<deleteData createDataKey="createSecondProductForBundle" stepKey="deleteSecondProductForBundle"/>
111+
<deleteData createDataKey="createThirdBundleProduct" stepKey="deleteThirdBundleProduct"/>
112+
</after>
113+
114+
<!-- Open created category on Storefront -->
115+
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openCategoryPage">
116+
<argument name="categoryName" value="$$createCategory.name$$"/>
117+
</actionGroup>
118+
119+
<!-- Assert first bundle products in category product grid -->
120+
<actionGroup ref="AssertProductOnCategoryPageActionGroup" stepKey="assertFirstBundleProduct">
121+
<argument name="product" value="$$createFirstBundleProduct$$"/>
122+
</actionGroup>
123+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeFromForFirstBundleProduct">
124+
<argument name="selector" value="{{StorefrontCategoryProductSection.priceFromByProductId($$createFirstBundleProduct.id$$)}}"/>
125+
<argument name="userInput" value="From $100.00"/>
126+
</actionGroup>
127+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeToForFirstBundleProduct">
128+
<argument name="selector" value="{{StorefrontCategoryProductSection.priceToByProductId($$createFirstBundleProduct.id$$)}}"/>
129+
<argument name="userInput" value="To $123.00"/>
130+
</actionGroup>
131+
132+
<!-- Assert second bundle products in category product grid -->
133+
<actionGroup ref="AssertProductOnCategoryPageActionGroup" stepKey="assertSecondBundleProduct">
134+
<argument name="product" value="$$createSecondBundleProduct$$"/>
135+
</actionGroup>
136+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeFromForSecondBundleProduct">
137+
<argument name="selector" value="{{StorefrontCategoryProductSection.priceFromByProductId($$createSecondBundleProduct.id$$)}}"/>
138+
<argument name="userInput" value="From $10.00"/>
139+
</actionGroup>
140+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeToForSecondBundleProduct">
141+
<argument name="selector" value="{{StorefrontCategoryProductSection.priceToByProductId($$createSecondBundleProduct.id$$)}}"/>
142+
<argument name="userInput" value="To $123.00"/>
143+
</actionGroup>
144+
145+
<!-- Assert third bundle products in category product grid -->
146+
<actionGroup ref="AssertProductOnCategoryPageActionGroup" stepKey="assertThirdBundleProduct">
147+
<argument name="product" value="$$createThirdBundleProduct$$"/>
148+
</actionGroup>
149+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeFromForThirdBundleProduct">
150+
<argument name="selector" value="{{StorefrontCategoryProductSection.priceFromByProductId($$createThirdBundleProduct.id$$)}}"/>
151+
<argument name="userInput" value="From $123.00"/>
152+
</actionGroup>
153+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeToForThirdBundleProduct">
154+
<argument name="selector" value="{{StorefrontCategoryProductSection.priceToByProductId($$createThirdBundleProduct.id$$)}}"/>
155+
<argument name="userInput" value="To $500.00"/>
156+
</actionGroup>
157+
158+
<!-- Switch category view to List mode -->
159+
<actionGroup ref="StorefrontSwitchCategoryViewToListMode" stepKey="switchCategoryViewToListMode"/>
160+
161+
<!-- Sort products By Price -->
162+
<actionGroup ref="StorefrontCategoryPageSortProductActionGroup" stepKey="sortProductByPrice"/>
163+
<!-- Set Ascending Direction -->
164+
<actionGroup ref="StorefrontCategoryPageSortAscendingActionGroup" stepKey="setAscendingDirection"/>
165+
166+
<!-- Assert new products positions -->
167+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductFirstPosition">
168+
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('1')}}"/>
169+
<argument name="userInput" value="$$createThirdBundleProduct.name$$"/>
170+
</actionGroup>
171+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductSecondPosition">
172+
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('2')}}"/>
173+
<argument name="userInput" value="$$createFirstBundleProduct.name$$"/>
174+
</actionGroup>
175+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductThirdPosition">
176+
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('3')}}"/>
177+
<argument name="userInput" value="$$createSecondBundleProduct.name$$"/>
178+
</actionGroup>
179+
180+
<!-- Set Descending Direction -->
181+
<actionGroup ref="StorefrontCategoryPageSortDescendingActionGroup" stepKey="setDescendingDirection"/>
182+
183+
<!-- Assert new products positions -->
184+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductNewFirstPosition">
185+
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('1')}}"/>
186+
<argument name="userInput" value="$$createSecondBundleProduct.name$$"/>
187+
</actionGroup>
188+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductNewSecondPosition">
189+
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('2')}}"/>
190+
<argument name="userInput" value="$$createFirstBundleProduct.name$$"/>
191+
</actionGroup>
192+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductNewThirdPosition">
193+
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('3')}}"/>
194+
<argument name="userInput" value="$$createThirdBundleProduct.name$$"/>
195+
</actionGroup>
196+
</test>
197+
</tests>

0 commit comments

Comments
 (0)