Skip to content

Commit a11d30b

Browse files
committed
Merge remote-tracking branch 'origin/AC-8920-v1' into spartans_pr_04122023
2 parents ed33a4e + 945cfe1 commit a11d30b

13 files changed

+269
-6
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="CheckoutSelectCreditCardPaymentActionGroup">
12+
<annotations>
13+
<description>Selects the 'Credit card' Payment Method on the Storefront Checkout page.</description>
14+
</annotations>
15+
16+
<waitForPageLoad stepKey="waitForLoadingMask"/>
17+
<waitForPageLoad stepKey="waitForPageLoad"/>
18+
<click selector="{{StorefrontCheckoutPaymentMethodSection.checkCreditCard}}" stepKey="selectCreditCardPaymentMethod"/>
19+
<waitForPageLoad stepKey="waitForLoadingMaskAfterPaymentMethodSelection"/>
20+
</actionGroup>
21+
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<section name="StorefrontCheckoutPaymentMethodSection">
1212
<element name="billingAddress" type="text" selector=".checkout-billing-address"/>
1313
<element name="checkPaymentMethodByName" type="radio" selector="//div[@id='checkout-payment-method-load']//div[@class='payment-method']//label//span[contains(., '{{methodName}}')]/../..//input" parameterized="true"/>
14+
<element name="checkCreditCard" type="radio" selector="//div[@id='checkout-payment-method-load']//div[@class='payment-method payment-method-braintree']//label//span[contains(., 'Credit Card')]/../..//input"/>
1415
<element name="billingAddressSameAsShipping" type="checkbox" selector=".payment-method._active [name='billing-address-same-as-shipping']"/>
1516
<element name="billingAddressSameAsShippingShared" type="checkbox" selector="#billing-address-same-as-shipping-shared"/>
1617
<element name="paymentOnAccount" type="radio" selector="#companycredit" deprecated="Use StorefrontCheckoutPaymentSection.paymentOnAccount B2B repository"/>

app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,4 +511,20 @@
511511
<data key="postcode">5555</data>
512512
<data key="telephone">555-55-555-55</data>
513513
</entity>
514+
<entity name="US_Address_CA_CC" type="address">
515+
<data key="firstname">CCREJECT-BANK_ERROR</data>
516+
<data key="lastname">Doe</data>
517+
<array key="street">
518+
<item>119 Belmont St</item>
519+
</array>
520+
<data key="city">Ontario</data>
521+
<data key="state">California</data>
522+
<data key="country_id">US</data>
523+
<data key="country">United States</data>
524+
<data key="postcode">91761</data>
525+
<data key="telephone">7865438767</data>
526+
<data key="default_billing">Yes</data>
527+
<data key="default_shipping">Yes</data>
528+
<requiredEntity type="region">RegionCA</requiredEntity>
529+
</entity>
514530
</entities>

app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,4 +489,18 @@
489489
<data key="group">General</data>
490490
<requiredEntity type="address">Canada_Address</requiredEntity>
491491
</entity>
492+
<entity name="Custom_US_Customer" type="customer">
493+
<data key="group_id">1</data>
494+
<data key="default_billing">true</data>
495+
<data key="default_shipping">true</data>
496+
<data key="email" unique="prefix">John.Doe@example.com</data>
497+
<data key="firstname">John</data>
498+
<data key="lastname">Doe</data>
499+
<data key="fullname">John Doe</data>
500+
<data key="password">pwdTest123!</data>
501+
<data key="store_id">0</data>
502+
<data key="website_id">0</data>
503+
<data key="group">General</data>
504+
<requiredEntity type="address">US_Address_CA_CC</requiredEntity>
505+
</entity>
492506
</entities>

app/code/Magento/Quote/Model/QuoteValidator.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Quote\Model\Quote as QuoteEntity;
1515
use Magento\Quote\Model\Quote\Validator\MinimumOrderAmount\ValidationMessage as OrderAmountValidationMessage;
1616
use Magento\Quote\Model\ValidationRules\QuoteValidationRuleInterface;
17+
use Magento\Framework\Webapi\Rest\Response as RestResponse;
1718

1819
/**
1920
* Class to validate the quote
@@ -43,24 +44,32 @@ class QuoteValidator
4344
*/
4445
private $quoteValidationRule;
4546

47+
/**
48+
* @var RestResponse
49+
*/
50+
private $_response;
51+
4652
/**
4753
* QuoteValidator constructor.
4854
*
4955
* @param AllowedCountries|null $allowedCountryReader
5056
* @param OrderAmountValidationMessage|null $minimumAmountMessage
5157
* @param QuoteValidationRuleInterface|null $quoteValidationRule
58+
* @param RestResponse|null $response
5259
*/
5360
public function __construct(
5461
AllowedCountries $allowedCountryReader = null,
5562
OrderAmountValidationMessage $minimumAmountMessage = null,
56-
QuoteValidationRuleInterface $quoteValidationRule = null
63+
QuoteValidationRuleInterface $quoteValidationRule = null,
64+
RestResponse $response = null
5765
) {
5866
$this->allowedCountryReader = $allowedCountryReader ?: ObjectManager::getInstance()
5967
->get(AllowedCountries::class);
6068
$this->minimumAmountMessage = $minimumAmountMessage ?: ObjectManager::getInstance()
6169
->get(OrderAmountValidationMessage::class);
6270
$this->quoteValidationRule = $quoteValidationRule ?: ObjectManager::getInstance()
6371
->get(QuoteValidationRuleInterface::class);
72+
$this->_response = $response ?: ObjectManager::getInstance()->get(RestResponse::class);
6473
}
6574

6675
/**
@@ -106,6 +115,7 @@ public function validateBeforeSubmit(QuoteEntity $quote)
106115
$defaultMessage .= ' %1';
107116
}
108117
if ($defaultMessage) {
118+
$this->_response->setHeader('errorRedirectAction', '#shipping');
109119
throw new ValidatorException(__($defaultMessage, implode(' ', $messages)));
110120
}
111121
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminBraintreeEnableActionGroup">
12+
<annotations>
13+
<description>Goes to the 'Configuration' page for 'Payment Methods'. Fills in the provided Sample Braintree credentials and other details. Clicks on Save.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="credentials" defaultValue="SampleBraintreeConfig"/>
17+
<argument name="countryCode" type="string" defaultValue="us"/>
18+
</arguments>
19+
<amOnPage url="{{AdminConfigBraintreePage.url}}" stepKey="navigateToPaymentConfigurationPage"/>
20+
<waitForPageLoad stepKey="waitForPageLoad1"/>
21+
<click selector="{{BraintreeConfigSection.configureBtn(countryCode)}}" stepKey="clickBraintreeConfigureBtn"/>
22+
<selectOption selector ="{{BraintreeConfigSection.environment(countryCode)}}" userInput="Sandbox" stepKey="inputTypeOfEnvironment"/>
23+
<selectOption selector ="{{BraintreeConfigSection.paymentAction(countryCode)}}" userInput="Authorize" stepKey="inputPaymentAction"/>
24+
<fillField selector ="{{BraintreeConfigSection.merchantID(countryCode)}}" userInput="{{credentials.braintree_merchant_id}}" stepKey="inputMerchantId"/>
25+
<fillField selector ="{{BraintreeConfigSection.publicKey(countryCode)}}" userInput="{{credentials.braintree_public_key}}" stepKey="inputPublicKey"/>
26+
<fillField selector ="{{BraintreeConfigSection.privateKey(countryCode)}}" userInput="{{credentials.braintree_private_key}}" stepKey="inputPrivateKey"/>
27+
<selectOption selector ="{{BraintreeConfigSection.enableCard(countryCode)}}" userInput="Yes" stepKey="enableCardPayment"/>
28+
<click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/>
29+
<waitForPageLoad stepKey="waitForPageLoad2"/>
30+
</actionGroup>
31+
</actionGroups>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="FillBraintreeCreditCardActionGroup">
12+
<annotations>
13+
<description>Fills in the provided Braintree Credit Card details.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="creditCardDetails" defaultValue="InvalidCreditCard"/>
17+
</arguments>
18+
<switchToIFrame selector="{{BraintreeCreditCardSection.ccNumberIframe}}" stepKey="switchToCcNumberIframe"/>
19+
<fillField selector ="{{BraintreeCreditCardSection.creditCardNumber}}" userInput="{{creditCardDetails.cardNumber}}" stepKey="inputCreditcardNumber"/>
20+
<switchToIFrame stepKey="switchBack1"/>
21+
<switchToIFrame selector="{{BraintreeCreditCardSection.ccExpiryIframe}}" stepKey="switchToExpiryIframe"/>
22+
<fillField selector ="{{BraintreeCreditCardSection.expirationDate}}" userInput="{{creditCardDetails.expiry}}" stepKey="inputExpiryDate"/>
23+
<switchToIFrame stepKey="switchBack2"/>
24+
<switchToIFrame selector="{{BraintreeCreditCardSection.ccCvvIframe}}" stepKey="switchToCvvIframe"/>
25+
<fillField selector ="{{BraintreeCreditCardSection.cvv}}" userInput="{{creditCardDetails.cvv}}" stepKey="inputCvv"/>
26+
<switchToIFrame stepKey="switchBack3"/>
27+
</actionGroup>
28+
</actionGroups>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
10+
<entity name="SampleBraintreeConfig" type="braintree_config">
11+
<data key="braintree_username">MagentoPB</data>
12+
<data key="braintree_password">123123q</data>
13+
<data key="braintree_merchant_id">d4pdjhxgjfrsmzbf</data>
14+
<data key="braintree_public_key">m7q4wmh43xrgyrst</data>
15+
<data key="braintree_private_key">67de364080b1b4e2492d7a3de413a572</data>
16+
</entity>
17+
<entity name="InvalidCreditCard" type="data">
18+
<data key="cardNumber">4032031062519193</data>
19+
<data key="expiry">12/25</data>
20+
<data key="cvv">123</data>
21+
</entity>
22+
</entities>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
9+
<page name="AdminConfigBraintreePage" url="admin/system_config/edit/section/payment/" area="admin" module="Magento_Config">
10+
<section name="OtherPaymentsConfigSection"/>
11+
</page>
12+
</pages>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
10+
<section name="BraintreeConfigSection">
11+
<element name="configureBtn" type="button" selector="#payment_{{countryCode}}_braintree_section_braintree-head" parameterized="true"/>
12+
<element name="environment" type="input" selector="#payment_{{countryCode}}_braintree_section_braintree_braintree_required_environment" parameterized="true"/>
13+
<element name="paymentAction" type="input" selector="#payment_{{countryCode}}_braintree_section_braintree_braintree_required_payment_action" parameterized="true"/>
14+
<element name="merchantID" type="input" selector="#payment_{{countryCode}}_braintree_section_braintree_braintree_required_sandbox_merchant_id" parameterized="true"/>
15+
<element name="publicKey" type="input" selector="#payment_{{countryCode}}_braintree_section_braintree_braintree_required_sandbox_public_key" parameterized="true"/>
16+
<element name="privateKey" type="input" selector="#payment_{{countryCode}}_braintree_section_braintree_braintree_required_sandbox_private_key" parameterized="true"/>
17+
<element name="enableCard" type="input" selector="#payment_{{countryCode}}_braintree_section_braintree_active" parameterized="true"/>
18+
</section>
19+
</sections>

0 commit comments

Comments
 (0)