Skip to content

Commit

Permalink
Merge pull request #1039 from BearGroup/release/5.2.0
Browse files Browse the repository at this point in the history
Release/5.2.0
  • Loading branch information
Christian Zichichi authored Apr 1, 2021
2 parents 0af5e31 + dda9be0 commit c2e98a4
Show file tree
Hide file tree
Showing 84 changed files with 870 additions and 472 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Change Log

## 5.2.0
* Added Sign in with Amazon to the authentication modal
* Fixed bug where pressing enter on a text input config field would open the file selector for Amazon Private Key
* Fixed usage of a php8 str_contains so that installations that don't have the Symfony polyfill will still work correctly
* Fixed issue that crawlers could trigger by hitting the login/checkout path without an Amazon checkout session
* Modified Amazon Pay button rendering so that it will be triggered by customer data loading after the Amazon javascript runs
* Updated MFTF tests to handle authentication popup that happens in desktop view now
* Updated composer.json requires to specify a few additional dependencies that are used

## 5.1.0
* General availability release
* Added tests for refund, multi auth refund, and multi auth with capture initiated
Expand Down
3 changes: 3 additions & 0 deletions Controller/Login/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class Checkout extends \Amazon\Pay\Controller\Login
public function execute()
{
$checkoutSessionId = $this->getRequest()->getParam('amazonCheckoutSessionId');
if ($checkoutSessionId == '') {
return $this->_redirect('checkout/cart');
}

try {
$checkoutSession = $this->amazonAdapter->getCheckoutSession(
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The following table provides an overview on which Git branch is compatible to wh
Magento Version | Github Branch | Latest release
---|---|---
2.2.6 - 2.2.11 (EOL) | [V2checkout-1.2.x](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/V2checkout-1.2.x) | 1.20.0 (EOL)
2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.1.0
2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.2.0

## Release Notes
See [CHANGELOG.md](/CHANGELOG.md)
13 changes: 13 additions & 0 deletions Test/Mftf-23/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AmazonBeginLoginOnlyActionGroup">
<waitForElement selector="{{AmazonPageSection.emailField}}" stepKey="waitForEmailField"/>
<wait time="1" stepKey="allowButtonToActivate1"/>
<fillField selector="{{AmazonPageSection.emailField}}" userInput="{{AmazonAccount.email}}" stepKey="fillAmazonPageEmailField"/>
<fillField selector="{{AmazonPageSection.passwordField}}" userInput="{{AmazonAccount.password}}" stepKey="fillAmazonPagePasswordField"/>
<click selector="{{AmazonPageSection.signInButton}}" stepKey="clickAmazonPageSignInButton"/>
<!--Verify successful login by the presence of the continue button-->
<wait time="1" stepKey="allowButtonToActivate2"/>
<waitForElement selector="{{AmazonLoginSection.consentButton}}" stepKey="seeAmazonConsentButton"/>
</actionGroup>
</actionGroups>
5 changes: 5 additions & 0 deletions Test/Mftf-23/ActionGroup/AmazonCheckoutActionGroup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<actionGroup name="AmazonCheckoutActionGroup">
<arguments>
<argument name="cc" defaultValue="1111" type="string"/>
<argument name="openerName" type="string"/>
</arguments>

<!--Get shipping address information-->
Expand All @@ -25,6 +26,10 @@
<waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="waitForAmazonCheckoutButton"/>
<wait time="1" stepKey="allowContinueButtonToActivate"/>
<click selector="{{AmazonPageSection.checkoutButton}}" stepKey="clickAmazonCheckoutButton"/>

<!-- Switch back to main window -->
<switchToWindow userInput="{{openerName}}" stepKey="switchToWindowOpener" />

<waitForPageLoad stepKey="waitForCheckoutPageLoad"/>
<!--Filter out address data-->
<executeJS function="return '{$amazonAddressLine1Raw}' !== 'null' ? '{$amazonAddressLine1Raw}' : ''" stepKey="amazonAddressLine1"/>
Expand Down
73 changes: 73 additions & 0 deletions Test/Mftf-23/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<!--Open login popup and complete form-->
<actionGroup name="AmazonLoginAndCheckoutActionGroup">
<arguments>
<argument name="buttonSelector" defaultValue="{{AmazonButtonSection.checkout}}" type="string"/>
<argument name="cc" defaultValue="1111" type="string"/>
</arguments>

<!--Save opener window name since popup auto-closes-->
<executeJS function="return window.name;" stepKey="openerName"/>

<!--Go to Amazon Pay from the checkout and login-->
<waitForElement selector="{{buttonSelector}}" time="30" stepKey="apWaitForButton"/>
<wait time="1" stepKey="allowButtonToActivate"/>
<click selector="{{buttonSelector}}" stepKey="clickAmazonButton"/>

<wait time="1" stepKey="allowPopupToOpen"/>
<switchToNextTab stepKey="switchToLoginPopupWindow"/>

<!-- Fill in login form -->
<waitForElement selector="{{AmazonPageSection.emailField}}" time="30" stepKey="apWaitForLogin"/>
<fillField selector="{{AmazonPageSection.emailField}}" userInput="{{AmazonAccount.email}}" stepKey="apEnterEmail"/>
<fillField selector="{{AmazonPageSection.passwordField}}" userInput="{{AmazonAccount.password}}" stepKey="apEnterPassword"/>
<click selector="{{AmazonPageSection.signInButton}}" stepKey="clickSigninButton"/>

<!--Verify successful login by the presence of the checkout button-->
<wait time="1" stepKey="allowButtonToActivate2"/>
<waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="seeAmazonCheckoutButton"/>


<!--Get shipping address information-->
<grabAttributeFrom selector="{{AmazonPageSection.addressId}}" userInput="data-address_id" stepKey="amazonAddressId"/>
<grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-name_on_address" stepKey="amazonAddressName"/>
<grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-address_line1" stepKey="amazonAddressLine1Raw"/>
<grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-address_line2" stepKey="amazonAddressLine2Raw"/>
<grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-address_line3" stepKey="amazonAddressLine3Raw"/>
<grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-city" stepKey="amazonAddressCity"/>
<grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-zip_code" stepKey="amazonAddressZipCode"/>
<grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-country" stepKey="amazonAddressCountryCode"/>
<grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-phone_number" stepKey="amazonAddressPhoneNumber"/>

<!-- choose card -->
<click selector="{{AmazonPageSection.changePaymentButton}}" stepKey="clickChangeAddress"/>
<executeJS function="document.querySelectorAll('#maxo_payment_methods .a-radio-label').forEach(function(v,i,o) { if (v.querySelector('.trail_number').innerText.includes('{{cc}}')) { v.click() } });" stepKey="executeJsCc"/>
<click selector="{{AmazonPageSection.usePaymentButton}}" stepKey="clickUsePaymentMethod"/>

<!--Go back to checkout-->
<waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="waitForAmazonCheckoutButton"/>
<wait time="1" stepKey="allowContinueButtonToActivate"/>
<click selector="{{AmazonPageSection.checkoutButton}}" stepKey="clickAmazonCheckoutButton"/>

<!-- Switch back to main window -->
<switchToWindow userInput="{$openerName}" stepKey="switchToWindowOpener" />

<waitForPageLoad stepKey="waitForCheckoutPageLoad"/>
<wait time="1" stepKey="allowAddressToPopulate"/>
<!--Filter out address data-->
<executeJS function="return '{$amazonAddressLine1Raw}' !== 'null' ? '{$amazonAddressLine1Raw}' : ''" stepKey="amazonAddressLine1"/>
<executeJS function="return '{$amazonAddressLine2Raw}' !== 'null' ? '{$amazonAddressLine2Raw}' : ''" stepKey="amazonAddressLine2"/>
<executeJS function="return '{$amazonAddressLine3Raw}' !== 'null' ? '{$amazonAddressLine3Raw}' : ''" stepKey="amazonAddressLine3"/>
<grabAttributeFrom selector="{{AmazonCheckoutSection.countryNameByCode({$amazonAddressCountryCode})}}" userInput="data-title" stepKey="amazonAddressCountryName"/>
<!--Verify correct shipping address is displayed-->
<see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressName" stepKey="seeAmazonAddressName"/>
<see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressLine1" stepKey="seeAmazonAddressLine1"/>
<see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressLine2" stepKey="seeAmazonAddressLine2"/>
<see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressLine3" stepKey="seeAmazonAddressLine3"/>
<see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressCity" stepKey="seeAmazonAddressCity"/>
<see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressZipCode" stepKey="seeAmazonAddressZipCode"/>
<see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressCountryName" stepKey="seeAmazonAddressCountryName"/>
<see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressPhoneNumber" stepKey="seeAmazonAddressPhoneNumber"/>
</actionGroup>
</actionGroups>
15 changes: 15 additions & 0 deletions Test/Mftf-23/ActionGroup/AmazonLoginOnlyActionGroup.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AmazonLoginOnlyActionGroup">
<arguments>
<argument name="buttonSelector" defaultValue="{{AmazonLoginSection.login}}" type="string"/>
</arguments>
<!--Save opener window name since popup auto-closes-->
<executeJS function="return window.name;" stepKey="openerName"/>

<!--Verify Sign in with Amazon Button is present-->
<click selector="{{buttonSelector}}" stepKey="clickSignInWithAmazonButton"/>
<wait time="1" stepKey="allowPopupToOpen"/>
<switchToNextTab stepKey="switchToWindowLoginPopup"/>

<waitForElement selector="{{AmazonPageSection.emailField}}" stepKey="waitForEmailField"/>
<wait time="1" stepKey="allowButtonToActivate1"/>
<fillField selector="{{AmazonPageSection.emailField}}" userInput="{{AmazonAccount.email}}" stepKey="fillAmazonPageEmailField"/>
Expand All @@ -9,5 +20,9 @@
<!--Verify successful login by the presence of the continue button-->
<wait time="1" stepKey="allowButtonToActivate2"/>
<waitForElement selector="{{AmazonLoginSection.consentButton}}" stepKey="seeAmazonConsentButton"/>
<click selector="{{AmazonLoginSection.consentButton}}" stepKey="clickAmazonConsentButton"/>

<!-- Switch back to main window -->
<switchToWindow userInput="{$openerName}" stepKey="switchToWindowOpener" />
</actionGroup>
</actionGroups>
13 changes: 13 additions & 0 deletions Test/Mftf-23/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AmazonLoginOnlyRedirectActionGroup">
<waitForElement selector="{{AmazonPageSection.emailField}}" stepKey="waitForEmailField"/>
<wait time="1" stepKey="allowButtonToActivate1"/>
<fillField selector="{{AmazonPageSection.emailField}}" userInput="{{AmazonAccount.email}}" stepKey="fillAmazonPageEmailField"/>
<fillField selector="{{AmazonPageSection.passwordField}}" userInput="{{AmazonAccount.password}}" stepKey="fillAmazonPagePasswordField"/>
<click selector="{{AmazonPageSection.signInButton}}" stepKey="clickAmazonPageSignInButton"/>
<!--Verify successful login by the presence of the continue button-->
<wait time="1" stepKey="allowButtonToActivate2"/>
<waitForElement selector="{{AmazonLoginSection.consentButton}}" stepKey="seeAmazonConsentButton"/>
</actionGroup>
</actionGroups>
13 changes: 13 additions & 0 deletions Test/Mftf-23/ActionGroup/AmazonLoginRedirectActionGroup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AmazonLoginRedirectActionGroup">
<waitForElement selector="{{AmazonPageSection.emailField}}" stepKey="waitForEmailField"/>
<wait time="1" stepKey="allowButtonToActivate1"/>
<fillField selector="{{AmazonPageSection.emailField}}" userInput="{{AmazonAccount.email}}" stepKey="fillAmazonPageEmailField"/>
<fillField selector="{{AmazonPageSection.passwordField}}" userInput="{{AmazonAccount.password}}" stepKey="fillAmazonPagePasswordField"/>
<click selector="{{AmazonPageSection.signInButton}}" stepKey="clickAmazonPageSignInButton"/>
<!--Verify successful login by the presence of the checkout button-->
<wait time="1" stepKey="allowButtonToActivate"/>
<waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="seeAmazonCheckoutButton"/>
</actionGroup>
</actionGroups>
16 changes: 11 additions & 5 deletions Test/Mftf-23/Data/AmazonPaymentConfigData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
<entity name="SampleAmazonPaymentConfig" type="amazon_payment_config">
<requiredEntity type="api_version">SampleAmazonPaymentApiVersion</requiredEntity>
<requiredEntity type="active">SampleAmazonPaymentActive</requiredEntity>
<requiredEntity type="private_key">SampleAmazonPaymentPrivateKey</requiredEntity>
<requiredEntity type="private_key_text">SampleAmazonPaymentPrivateKey</requiredEntity>
<requiredEntity type="private_key_selected">SampleAmazonPaymentPrivateKeySelectedText</requiredEntity>
<requiredEntity type="public_key_id">SampleAmazonPaymentPublicKeyId</requiredEntity>
<requiredEntity type="merchant_id">SampleAmazonPaymentMerchantId</requiredEntity>
<requiredEntity type="store_id">SampleAmazonPaymentStoreId</requiredEntity>
Expand All @@ -56,9 +57,12 @@
<entity name="SampleAmazonPaymentActive" type="active">
<data key="value">1</data>
</entity>
<entity name="SampleAmazonPaymentPrivateKey" type="private_key">
<entity name="SampleAmazonPaymentPrivateKey" type="private_key_text">
<data key="value">{{_CREDS.amazon/private_key}}</data>
</entity>
<entity name="SampleAmazonPaymentPrivateKeySelectedText" type="private_key_selected">
<data key="value">text</data>
</entity>
<entity name="SampleAmazonPaymentPublicKeyId" type="public_key_id">
<data key="value">{{_CREDS.amazon/public_key_id}}</data>
</entity>
Expand Down Expand Up @@ -92,15 +96,16 @@
<entity name="EUAmazonPaymentConfig" type="amazon_payment_config">
<requiredEntity type="api_version">SampleAmazonPaymentApiVersion</requiredEntity>
<requiredEntity type="active">SampleAmazonPaymentActive</requiredEntity>
<requiredEntity type="private_key">EUAmazonPaymentPrivateKey</requiredEntity>
<requiredEntity type="private_key_text">EUAmazonPaymentPrivateKey</requiredEntity>
<requiredEntity type="private_key_selected">SampleAmazonPaymentPrivateKeySelectedText</requiredEntity>
<requiredEntity type="public_key_id">EUAmazonPaymentPublicKeyId</requiredEntity>
<requiredEntity type="merchant_id">EUAmazonPaymentMerchantId</requiredEntity>
<requiredEntity type="store_id">EUAmazonPaymentStoreId</requiredEntity>
<requiredEntity type="payment_region">EUAmazonPaymentPaymentRegion</requiredEntity>
<requiredEntity type="sandbox">SampleAmazonPaymentSandbox</requiredEntity>
<requiredEntity type="lwa_enabled">SampleAmazonPaymentLwaDisabled</requiredEntity>
</entity>
<entity name="EUAmazonPaymentPrivateKey" type="private_key">
<entity name="EUAmazonPaymentPrivateKey" type="private_key_text">
<data key="value">{{_CREDS.amazon/eu_private_key}}</data>
</entity>
<entity name="EUAmazonPaymentPublicKeyId" type="public_key_id">
Expand All @@ -122,7 +127,8 @@
<entity name="SampleAmazonPaymentConfigLwa" type="amazon_payment_config">
<requiredEntity type="api_version">SampleAmazonPaymentApiVersion</requiredEntity>
<requiredEntity type="active">SampleAmazonPaymentActive</requiredEntity>
<requiredEntity type="private_key">SampleAmazonPaymentPrivateKey</requiredEntity>
<requiredEntity type="private_key_text">SampleAmazonPaymentPrivateKey</requiredEntity>
<requiredEntity type="private_key_selected">SampleAmazonPaymentPrivateKeySelectedText</requiredEntity>
<requiredEntity type="public_key_id">SampleAmazonPaymentPublicKeyId</requiredEntity>
<requiredEntity type="merchant_id">SampleAmazonPaymentMerchantId</requiredEntity>
<requiredEntity type="store_id">SampleAmazonPaymentStoreId</requiredEntity>
Expand Down
8 changes: 7 additions & 1 deletion Test/Mftf-23/Metadata/amazon_payment_v2_config-meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
<object key="active_v2" dataType="active">
<field key="value">string</field>
</object>
<object key="private_key" dataType="private_key">
<object key="private_key_text" dataType="private_key_text">
<field key="value">string</field>
</object>
<object key="private_key_pem" dataType="private_key_pem">
<field key="value">string</field>
</object>
<object key="private_key_selected" dataType="private_key_selected">
<field key="value">string</field>
</object>
<object key="public_key_id" dataType="public_key_id">
Expand Down
1 change: 0 additions & 1 deletion Test/Mftf-23/Test/AmazonCancelReturnUrl.xml

This file was deleted.

Loading

0 comments on commit c2e98a4

Please sign in to comment.