Skip to content

Commit da6289c

Browse files
committed
Merge branch '2.3-develop' of github.com:magento/magento2ce into graphql-develop-prs
2 parents 702e6d8 + a07f70f commit da6289c

File tree

142 files changed

+3170
-1091
lines changed

Some content is hidden

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

142 files changed

+3170
-1091
lines changed

app/code/Magento/Authorizenet/etc/adminhtml/system.xml

+2
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@
8585
</field>
8686
<field id="min_order_total" translate="label" type="text" sortOrder="190" showInDefault="1" showInWebsite="1" showInStore="0">
8787
<label>Minimum Order Total</label>
88+
<validate>validate-number validate-zero-or-greater</validate>
8889
</field>
8990
<field id="max_order_total" translate="label" type="text" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="0">
9091
<label>Maximum Order Total</label>
92+
<validate>validate-number validate-zero-or-greater</validate>
9193
</field>
9294
<field id="sort_order" translate="label" type="text" sortOrder="210" showInDefault="1" showInWebsite="1" showInStore="0">
9395
<label>Sort Order</label>

app/code/Magento/AuthorizenetAcceptjs/Test/Mftf/ActionGroup/ConfigureAuthorizenetAcceptjsActionGroup.xml

+28-25
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,43 @@
77
-->
88
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10-
<actionGroup name="ConfigureAuthorizenetAcceptjs">
10+
<actionGroup name="ConfigureAuthorizenetAcceptjs" extends="EnableAuthorizenetAcceptjs">
1111
<arguments>
1212
<argument name="paymentAction" type="string"/>
1313
</arguments>
14-
<!-- Navigate to configuration -->
15-
<waitForPageLoad stepKey="waitForStores"/>
16-
<click stepKey="clickOnStores" selector="{{AdminMenuSection.stores}}"/>
17-
<waitForPageLoad stepKey="waitForConfiguration"/>
18-
<click stepKey="clickOnConfiguration" selector="{{StoresSubmenuSection.configuration}}"/>
19-
<waitForPageLoad stepKey="waitForSales"/>
20-
<waitForElementVisible stepKey="waitForVisibleHack" selector="{{AdminMenuSection.currencySetup}}"/>
21-
<scrollTo stepKey="scrollToSales" selector="{{StoresConfigurationListSection.sales}}"/>
22-
<click stepKey="clickOnSales" selector="{{StoresConfigurationListSection.sales}}" />
23-
<waitForPageLoad stepKey="waitForPaymentMethods"/>
24-
<click stepKey="clickOnPaymentMethods" selector="{{StoresConfigurationListSection.salesPaymentMethods}}" />
25-
<waitForPageLoad stepKey="waitForOpenConfiguration"/>
26-
<scrollTo stepKey="scrollToOpenConfig" selector="{{AuthorizenetAcceptjsConfigurationSection.openSectionToggle}}"/>
27-
<conditionalClick stepKey="openConfiguration" selector="{{AuthorizenetAcceptjsConfigurationSection.openSectionToggle}}" dependentSelector="{{AuthorizenetAcceptjsConfigurationSection.alreadyOpenSectionToggle}}" visible="false"/>
28-
2914
<!-- Fill Auth.net fields and save -->
30-
<waitForPageLoad stepKey="waitToFillApiLogin"/>
15+
<waitForElementVisible selector="{{AuthorizenetAcceptjsConfigurationSection.paymentActionCheckbox}}" stepKey="waitForFormVisible"/>
3116
<conditionalClick selector="{{AuthorizenetAcceptjsConfigurationSection.paymentActionCheckbox}}" stepKey="uncheckPaymentActionDefault" dependentSelector="{{AuthorizenetAcceptjsConfigurationSection.paymentActionSelectDisabled}}" visible="true"/>
3217
<selectOption selector="{{AuthorizenetAcceptjsConfigurationSection.paymentActionSelect}}" stepKey="selectPaymentAction" userInput="{{paymentAction}}"/>
33-
<scrollTo stepKey="scrollToApiLoginId" selector="{{AuthorizenetAcceptjsConfigurationSection.apiLoginIdField}}"/>
34-
<fillField stepKey="fillApiLoginId" selector="{{AuthorizenetAcceptjsConfigurationSection.apiLoginIdField}}" userInput="{{_CREDS.authorizenet_acceptjs_api_login_id}}"/>
35-
<fillField stepKey="fillTransactionKey" selector="{{AuthorizenetAcceptjsConfigurationSection.transactionKeyField}}" userInput="{{_CREDS.authorizenet_acceptjs_transaction_key}}"/>
36-
<fillField stepKey="fillPublicClientKey" selector="{{AuthorizenetAcceptjsConfigurationSection.publicClientKeyField}}" userInput="{{_CREDS.authorizenet_acceptjs_public_client_key}}"/>
37-
<fillField stepKey="fillSignatureKey" selector="{{AuthorizenetAcceptjsConfigurationSection.signatureKeyField}}" userInput="{{_CREDS.authorizenet_acceptjs_signature_key}}"/>
38-
<uncheckOption stepKey="uncheckCheckbox" selector="{{AuthorizenetAcceptjsConfigurationSection.enabledDefaultCheckbox}}"/>
39-
<selectOption stepKey="fillExpYear" selector="{{AuthorizenetAcceptjsConfigurationSection.enabledDefaultSelect}}" userInput="Yes"/>
40-
<click stepKey="clickOnSave" selector="{{ConfigurationMainActionsSection.save}}" />
18+
<scrollTo selector="{{AuthorizenetAcceptjsConfigurationSection.apiLoginIdField}}" stepKey="scrollToApiLoginId"/>
19+
<fillField selector="{{AuthorizenetAcceptjsConfigurationSection.apiLoginIdField}}" userInput="{{_CREDS.authorizenet_acceptjs_api_login_id}}" stepKey="fillApiLoginId"/>
20+
<fillField selector="{{AuthorizenetAcceptjsConfigurationSection.transactionKeyField}}" userInput="{{_CREDS.authorizenet_acceptjs_transaction_key}}" stepKey="fillTransactionKey"/>
21+
<fillField selector="{{AuthorizenetAcceptjsConfigurationSection.publicClientKeyField}}" userInput="{{_CREDS.authorizenet_acceptjs_public_client_key}}" stepKey="fillPublicClientKey"/>
22+
<fillField selector="{{AuthorizenetAcceptjsConfigurationSection.signatureKeyField}}" userInput="{{_CREDS.authorizenet_acceptjs_signature_key}}" stepKey="fillSignatureKey"/>
4123
</actionGroup>
4224

4325
<actionGroup name="DisableAuthorizenetAcceptjs">
4426
<magentoCLI stepKey="disableAuthorizenetAcceptjs" command="config:set payment/authorizenet_acceptjs/active 0"/>
4527
</actionGroup>
28+
29+
<actionGroup name="EnableAuthorizenetAcceptjs">
30+
<scrollTo selector="{{AuthorizenetAcceptjsConfigurationSection.openSectionToggle}}" stepKey="scrollToAuthorizeNetConfigSection"/>
31+
<conditionalClick selector="{{AuthorizenetAcceptjsConfigurationSection.openSectionToggle}}" dependentSelector="{{AuthorizenetAcceptjsConfigurationSection.enabledDefaultSelect}}" visible="false" stepKey="openConfigSection"/>
32+
<waitForElementVisible selector="{{AuthorizenetAcceptjsConfigurationSection.enabledDefaultSelect}}" stepKey="waitForEnableFieldVisible"/>
33+
<uncheckOption selector="{{AuthorizenetAcceptjsConfigurationSection.enabledDefaultCheckbox}}" stepKey="uncheckCheckbox"/>
34+
<selectOption selector="{{AuthorizenetAcceptjsConfigurationSection.enabledDefaultSelect}}" userInput="Yes" stepKey="enablePayment"/>
35+
</actionGroup>
36+
37+
<actionGroup name="AssertAuthorizenetAcceptjsRequiredFieldsValidationIsPresentOnSave">
38+
<scrollToTopOfPage stepKey="scrollToTop"/>
39+
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSave"/>
40+
<scrollTo selector="{{AuthorizenetAcceptjsConfigurationSection.apiLoginIdField}}" stepKey="scrollToApiLoginIdField"/>
41+
<see selector="{{AuthorizenetAcceptjsConfigurationSection.apiLoginIdField}} + {{AdminConfigSection.fieldError}}" userInput="This is a required field." stepKey="seeApiLoginIdRequiredMessage"/>
42+
<scrollTo selector="{{AuthorizenetAcceptjsConfigurationSection.publicClientKeyField}}" stepKey="scrollToPublicClientKeyField"/>
43+
<see selector="{{AuthorizenetAcceptjsConfigurationSection.publicClientKeyField}} + {{AdminConfigSection.fieldError}}" userInput="This is a required field." stepKey="seePublicClientKeyRequiredErrorMessage"/>
44+
<scrollTo selector="{{AuthorizenetAcceptjsConfigurationSection.transactionKeyField}}" stepKey="scrollTransactionKeyField"/>
45+
<see selector="{{AuthorizenetAcceptjsConfigurationSection.transactionKeyField}} + {{AdminConfigSection.fieldError}}" userInput="This is a required field." stepKey="seeTransactionKeyRequiredErrorMessage"/>
46+
<scrollTo selector="{{AuthorizenetAcceptjsConfigurationSection.signatureKeyField}}" stepKey="scrollToSignatureKeyField"/>
47+
<see selector="{{AuthorizenetAcceptjsConfigurationSection.signatureKeyField}} + {{AdminConfigSection.fieldError}}" userInput="This is a required field." stepKey="seeSignatureKeyRequiredErrorMessage"/>
48+
</actionGroup>
4649
</actionGroups>
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="ConfigureAuthorizenetAcceptjsWithoutRequiredOptionsTest">
12+
<annotations>
13+
<stories value="Authorize.net Accept.js"/>
14+
<title value="Unable to configure Authorize.net Accept.js without required options"/>
15+
<description value="Unable to configure Authorize.net Accept.js without required options"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="MC-17805"/>
18+
<useCaseId value="MC-17753"/>
19+
<group value="AuthorizenetAcceptjs"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
23+
</before>
24+
<after>
25+
<actionGroup ref="logout" stepKey="logout"/>
26+
</after>
27+
<amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/>
28+
<actionGroup ref="EnableAuthorizenetAcceptjs" stepKey="enableAuthorizenetAcceptjs"/>
29+
<actionGroup ref="AssertAuthorizenetAcceptjsRequiredFieldsValidationIsPresentOnSave" stepKey="assertErrorMessages"/>
30+
</test>
31+
</tests>

app/code/Magento/AuthorizenetAcceptjs/Test/Mftf/Test/FullCaptureAuthorizenetAcceptjsTest.xml

+2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@
3131
</createData>
3232

3333
<!--Configure Auth.net-->
34+
<amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/>
3435
<actionGroup ref="ConfigureAuthorizenetAcceptjs" stepKey="configureAuthorizenetAcceptjs">
3536
<argument name="paymentAction" value="Authorize Only"/>
3637
</actionGroup>
38+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfig"/>
3739

3840
</before>
3941
<after>

app/code/Magento/AuthorizenetAcceptjs/Test/Mftf/Test/GuestCheckoutVirtualProductAuthorizenetAcceptjsTest.xml

+2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@
3636
<actionGroup ref="saveProductForm" stepKey="saveProductForm"/>
3737

3838
<!--Configure Auth.net-->
39+
<amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/>
3940
<actionGroup ref="ConfigureAuthorizenetAcceptjs" stepKey="configureAuthorizenetAcceptjs">
4041
<argument name="paymentAction" value="Authorize and Capture"/>
4142
</actionGroup>
43+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfig"/>
4244

4345
</before>
4446
<after>

app/code/Magento/AuthorizenetAcceptjs/etc/adminhtml/system.xml

+22-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<group id="authorizenet_acceptjs_required"/>
1818
</requires>
1919
</field>
20-
<group id="required" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="5">
20+
<group id="required" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="15">
2121
<label>Basic Authorize.Net Settings</label>
2222
<attribute type="expanded">1</attribute>
2323
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
@@ -39,25 +39,44 @@
3939
<label>API Login ID</label>
4040
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
4141
<config_path>payment/authorizenet_acceptjs/login</config_path>
42+
<validate>required-entry</validate>
43+
<depends>
44+
<field id="*/authorizenet_acceptjs/active">1</field>
45+
</depends>
4246
</field>
4347
<field id="trans_key" translate="label" type="obscure" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
4448
<label>Transaction Key</label>
4549
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
4650
<config_path>payment/authorizenet_acceptjs/trans_key</config_path>
51+
<validate>required-entry</validate>
52+
<depends>
53+
<field id="*/authorizenet_acceptjs/active">1</field>
54+
</depends>
4755
</field>
4856
<field id="public_client_key" translate="label" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
4957
<label>Public Client Key</label>
5058
<config_path>payment/authorizenet_acceptjs/public_client_key</config_path>
59+
<validate>required-entry</validate>
60+
<depends>
61+
<field id="*/authorizenet_acceptjs/active">1</field>
62+
</depends>
5163
</field>
5264
<field id="trans_signature_key" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0">
5365
<label>Signature Key</label>
5466
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
5567
<config_path>payment/authorizenet_acceptjs/trans_signature_key</config_path>
68+
<validate>required-entry</validate>
69+
<depends>
70+
<field id="*/authorizenet_acceptjs/active">1</field>
71+
</depends>
5672
</field>
5773
<field id="trans_md5" translate="label" type="obscure" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0">
5874
<label>Merchant MD5 (deprecated)</label>
5975
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
6076
<config_path>payment/authorizenet_acceptjs/trans_md5</config_path>
77+
<depends>
78+
<field id="*/authorizenet_acceptjs/active">1</field>
79+
</depends>
6180
</field>
6281
</group>
6382
<group id="advanced" translate="label" showInDefault="1" showInWebsite="1" showInStore="0" sortOrder="20">
@@ -101,10 +120,12 @@
101120
<field id="min_order_total" translate="label" type="text" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0">
102121
<label>Minimum Order Total</label>
103122
<config_path>payment/authorizenet_acceptjs/min_order_total</config_path>
123+
<validate>validate-number validate-zero-or-greater</validate>
104124
</field>
105125
<field id="max_order_total" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0">
106126
<label>Maximum Order Total</label>
107127
<config_path>payment/authorizenet_acceptjs/max_order_total</config_path>
128+
<validate>validate-number validate-zero-or-greater</validate>
108129
</field>
109130
<field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0">
110131
<label>Sort Order</label>

app/code/Magento/AuthorizenetAcceptjs/view/frontend/web/js/view/payment/method-renderer/authorizenet-accept.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,10 @@ define([
9191
return;
9292
}
9393

94-
authData.clientKey = window.checkoutConfig.payment[this.getCode()].clientKey;
95-
authData.apiLoginID = window.checkoutConfig.payment[this.getCode()].apiLoginID;
94+
authData.clientKey = window.checkoutConfig.payment[this.getCode()].clientKey !== null ?
95+
window.checkoutConfig.payment[this.getCode()].clientKey : '';
96+
authData.apiLoginID = window.checkoutConfig.payment[this.getCode()].apiLoginID !== null ?
97+
window.checkoutConfig.payment[this.getCode()].apiLoginID : '';
9698

9799
cardData.cardNumber = this.creditCardNumber();
98100
cardData.month = this.creditCardExpMonth();

app/code/Magento/AuthorizenetGraphQl/Model/AuthorizenetDataProvider.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Framework\Stdlib\ArrayManager;
1212

1313
/**
14-
* DataProvider Model for Authorizenet
14+
* SetPaymentMethod additional data provider model for Authorizenet payment method
1515
*/
1616
class AuthorizenetDataProvider implements AdditionalDataProviderInterface
1717
{
@@ -23,7 +23,6 @@ class AuthorizenetDataProvider implements AdditionalDataProviderInterface
2323
private $arrayManager;
2424

2525
/**
26-
* AuthorizenetDataProvider constructor.
2726
* @param ArrayManager $arrayManager
2827
*/
2928
public function __construct(
@@ -42,19 +41,19 @@ public function getData(array $data): array
4241
{
4342
$additionalData = $this->arrayManager->get(static::PATH_ADDITIONAL_DATA, $data) ?? [];
4443
foreach ($additionalData as $key => $value) {
45-
$additionalData[$this->snakeCaseToCamelCase($key)] = $value;
44+
$additionalData[$this->convertSnakeCaseToCamelCase($key)] = $value;
4645
unset($additionalData[$key]);
4746
}
4847
return $additionalData;
4948
}
5049

5150
/**
52-
* Converts an input string from snake_case to camelCase.
51+
* Convert an input string from snake_case to camelCase.
5352
*
5453
* @param string $input
5554
* @return string
5655
*/
57-
private function snakeCaseToCamelCase($input)
56+
private function convertSnakeCaseToCamelCase($input): string
5857
{
5958
return lcfirst(str_replace('_', '', ucwords($input, '_')));
6059
}
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+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<!--Click save button and see message-->
12+
<actionGroup name="ClickSaveButtonActionGroup">
13+
<arguments>
14+
<argument name="message" type="string"/>
15+
</arguments>
16+
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSave"/>
17+
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitMessage" />
18+
<see userInput="{{message}}" selector="{{AdminMessagesSection.success}}" stepKey="verifyMessage" />
19+
</actionGroup>
20+
</actionGroups>

0 commit comments

Comments
 (0)