author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
21,270
25.02.2021 16:26:39
28,800
7d4b98391c845414ab4e1f1a1615e0da1c783123
test for MAgento 2.3
[ { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Section/AmazonPageSection.xml", "new_path": "Test/Mftf-23/Section/AmazonPageSection.xml", "diff": "<element name=\"signInButton\" type=\"button\" selector=\"#signInSubmit\"/>\n<element name=\"checkoutButton\" type=\"button\" selector=\"#default-button-content input[type=submit]\"/>\n<element name=\"cancelButton\" type=\"button\" selector=\"#return_back_to_merchant_link\"/>\n+ <element name=\"loginCancelButton\" type=\"button\" selector=\"#consent-wrapper-content [data-action='cancel-consent'] a\"/>\n<element name=\"addressId\" type=\"text\" selector=\"#default .default_address .address_id\"/>\n<element name=\"addressDetails\" type=\"text\" selector=\"#change-buyer-details li[data-address_id='{{address_id}}']\" parameterized=\"true\"/>\n<element name=\"changeAddressButton\" type=\"button\" selector=\"#change-address-button\"/>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-23/Test/AmazonCancelReturnUrl.xml", "diff": "+../../Mftf-24/Test/AmazonCancelReturnUrl.xml\n\\ No newline at end of file\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-600 test for MAgento 2.3
21,241
03.03.2021 14:50:00
21,600
d51baae44de9a849b673dffe601640e44af4b231
trigger invalidating customerData when clicking the Amazon Pay button
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "* Adds tests for refund, multi auth refund, and multi auth with capture initiated\n* Updates Alexa feature name\n* Adds Japanese translations and updates translations for other languages\n+* Fixed customer data not getting cleared when getting signed in via Amazon Pay checkout\n## 5.0.1\n* Remove reliance on legacy config value being set.\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/js/amazon-button.js", "new_path": "view/frontend/web/js/amazon-button.js", "diff": "@@ -102,6 +102,7 @@ define([\nthis._loadButtonConfig(function (buttonConfig) {\namazon.Pay.renderButton('#' + $buttonRoot.empty().removeUniqueId().uniqueId().attr('id'), buttonConfig);\n$('.amazon-button-container .field-tooltip').fadeIn();\n+ $('.amazon-checkout-button').click(function() { customerData.invalidate('*'); });\n});\n}, this);\n},\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-649 - trigger invalidating customerData when clicking the Amazon Pay button
21,270
03.03.2021 16:45:30
28,800
2188d703c4106a5364c7c9cf3d3129df4bb4af94
first attempt with dual file and text field private key
[ { "change_type": "MODIFY", "old_path": "Model/Config/File/PemFile.php", "new_path": "Model/Config/File/PemFile.php", "diff": "@@ -27,7 +27,7 @@ class PemFile extends \\Magento\\Config\\Block\\System\\Config\\Form\\Field\\File\nprotected function _getDeleteCheckbox()\n{\nif ($this->getValue()) {\n- return '<div>.pem key already saved</div>';\n+ return '<div id=\"amazon_pay_private_key_pem_file_saved_msg\">.PEM key already saved</div>';\n}\nreturn '';\n" }, { "change_type": "MODIFY", "old_path": "Plugin/ConfigCredentialsValidator.php", "new_path": "Plugin/ConfigCredentialsValidator.php", "diff": "@@ -26,6 +26,8 @@ class ConfigCredentialsValidator\nconst XML_PATH_ACTIVE = 'groups/amazon_pay/groups/credentials/fields/active_v2/value';\nconst XML_PATH_ACTIVE_INHERIT = 'groups/amazon_pay/groups/credentials/fields/active_v2/inherit';\nconst XML_PATH_PRIVATE_KEY = 'groups/amazon_pay/groups/credentials/fields/private_key/value';\n+ const XML_PATH_PRIVATE_KEY_PEM = 'groups/amazon_pay/groups/credentials/fields/private_key_pem/value';\n+ const XML_PATH_PRIVATE_KEY_TEXT = 'groups/amazon_pay/groups/credentials/fields/private_key_text/value';\nconst XML_PATH_PUBLIC_KEY_ID = 'groups/amazon_pay/groups/credentials/fields/public_key_id/value';\nconst XML_PATH_STORE_ID = 'groups/amazon_pay/groups/credentials/fields/store_id/value';\nconst XML_PATH_PAYMENT_REGION = 'groups/amazon_pay/groups/credentials/fields/payment_region/value';\n@@ -115,6 +117,11 @@ class ConfigCredentialsValidator\n$scope = $subject->getScope() ?: ScopeInterface::SCOPE_STORE;\n$scopeCode = $subject->getScopeCode();\n+ $privateKey = '*';\n+ if ($subject->getData(self::XML_PATH_PRIVATE_KEY_TEXT)) {\n+ $privateKey = $subject->getData(self::XML_PATH_PRIVATE_KEY_TEXT);\n+ }\n+ else if ($subject->getData(self::XML_PATH_PRIVATE_KEY_PEM)) {\n$privateKeyArray = $subject->getData(self::XML_PATH_PRIVATE_KEY);\nif (empty($privateKeyArray['name'])) {\n$privateKey = '*';\n@@ -128,6 +135,8 @@ class ConfigCredentialsValidator\nthrow new \\Magento\\Framework\\Exception\\LocalizedException(__('Invalid key'));\n}\n}\n+ }\n+\nif ($privateKey && (\npreg_match('/^\\*+$/', $privateKey) ||\n$privateKey === $this->amazonConfig->getPrivateKey($scope, $scopeCode))\n" }, { "change_type": "MODIFY", "old_path": "etc/adminhtml/system.xml", "new_path": "etc/adminhtml/system.xml", "diff": "<source_model>Magento\\Config\\Model\\Config\\Source\\Yesno</source_model>\n<config_path>payment/amazon_payment_v2/active</config_path>\n</field>\n- <field id=\"private_key\" translate=\"label comment\" type=\"Amazon\\Pay\\Model\\Config\\File\\PemFile\" sortOrder=\"5\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n- <label>Private Key (.pem)</label>\n+ <field id=\"private_key_pem\" translate=\"label comment\" type=\"Amazon\\Pay\\Model\\Config\\File\\PemFile\" sortOrder=\"5\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n+ <label>Private Key</label>\n<config_path>payment/amazon_payment_v2/private_key</config_path>\n<backend_model>Amazon\\Pay\\Model\\Config\\File\\PrivateKeyPem</backend_model>\n<upload_dir config=\"system\" scope_info=\"1\">amazon</upload_dir>\n- <depends><field id=\"active_v2\">1</field></depends>\n+ <comment><![CDATA[<a href=\"#\" class=\"amazon-private-key-change-key-type\">Change private key type]]></comment>\n+ </field>\n+ <field id=\"private_key_text\" translate=\"label comment\" type=\"textarea\" sortOrder=\"5\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n+ <label>Private Key</label>\n+ <config_path>payment/amazon_payment_v2/private_key</config_path>\n+ <frontend_model>Amazon\\Pay\\Model\\Config\\Form\\Privatekey</frontend_model>\n+ <backend_model>Magento\\Config\\Model\\Config\\Backend\\Encrypted</backend_model>\n+ <validate>validate-private-key</validate>\n+ <comment><![CDATA[<a href=\"#\" class=\"amazon-private-key-change-key-type\">Change private key type]]></comment>\n+ </field>\n+ <field id=\"private_key_selected\" translate=\"label comment\" type=\"text\" sortOrder=\"5\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n+ <label>Private Key Selected</label>\n+ <config_path>payment/amazon_payment_v2/private_key_selected</config_path>\n+ </field>\n+ <field id=\"private_key_selector\" translate=\"label comment\" sortOrder=\"5\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n+ <label>Private Key</label>\n+ <frontend_model>Amazon\\Pay\\Block\\Adminhtml\\System\\Config\\Form\\PrivateKeySelector</frontend_model>\n</field>\n<field id=\"public_key_id\" translate=\"label comment\" type=\"text\" sortOrder=\"6\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>Public Key ID</label>\n" }, { "change_type": "MODIFY", "old_path": "view/adminhtml/web/css/source/_module.less", "new_path": "view/adminhtml/web/css/source/_module.less", "diff": "}\n}\n}\n+\n+#row_payment_us_amazon_pay_credentials_private_key_pem,\n+#row_payment_us_amazon_pay_credentials_private_key_text,\n+#row_payment_us_amazon_pay_credentials_private_key_selected,\n+#row_payment_us_amazon_pay_credentials_private_key_selector {\n+ display: none;\n+}\n+#row_payment_us_amazon_pay_credentials_private_key_selector {\n+ .value {\n+ display: flex;\n+ width: 96%;\n+ align-items: center;\n+ justify-content: space-between;\n+ }\n+ .use-default {\n+ display: none;\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "view/adminhtml/web/js/credentials.js", "new_path": "view/adminhtml/web/js/credentials.js", "diff": "@@ -27,4 +27,74 @@ require(['jquery', 'domReady!'], function ($) {\nfunction() {\n$(this).val($(this).val().toLowerCase());\n});\n+\n+ // Private Key\n+ $('#private_key_pem_button').click(function (e) {\n+ e.preventDefault();\n+\n+ // set selected type\n+ $('#payment_us_amazon_pay_credentials_private_key_selected').val('pem');\n+ // hide selector row\n+ $('#row_payment_us_amazon_pay_credentials_private_key_selector').hide();\n+ // remove saved file feedback text\n+ $('#amazon_pay_private_key_pem_file_saved_msg').html('');\n+ // show pem row\n+ $('#row_payment_us_amazon_pay_credentials_private_key_pem').show();\n+ // click pem choose file button\n+ $('#payment_us_amazon_pay_credentials_private_key_pem').click();\n+ });\n+\n+ $('#private_key_text_button').click(function (e) {\n+ e.preventDefault();\n+\n+ // set selected type\n+ $('#payment_us_amazon_pay_credentials_private_key_selected').val('text');\n+ // hide selector row\n+ $('#row_payment_us_amazon_pay_credentials_private_key_selector').hide();\n+ // show text area row\n+ $('#row_payment_us_amazon_pay_credentials_private_key_text').show();\n+ // focus on field\n+ $('#payment_us_amazon_pay_credentials_private_key_text').val('').focus();\n+ });\n+\n+ $('.amazon-private-key-change-key-type').click(function (e) {\n+ e.preventDefault();\n+\n+ // reset selected type\n+ $('#payment_us_amazon_pay_credentials_private_key_selected').val('');\n+ // hide pem row\n+ $('#row_payment_us_amazon_pay_credentials_private_key_pem').hide();\n+ // hide text row\n+ $('#row_payment_us_amazon_pay_credentials_private_key_text').hide();\n+ // show selector row\n+ $('#row_payment_us_amazon_pay_credentials_private_key_selector').show();\n+ });\n+\n+ $('#payment_us_amazon_pay_credentials-head').click(function () {\n+ showPrivateKey($(this), $('#payment_us_amazon_pay_credentials_active_v2').val() == 1);\n+ });\n+\n+ $('#payment_us_amazon_pay_credentials_active_v2').change(function () {\n+ showPrivateKey($(this), $(this).val() == 1);\n+ });\n+\n+ function showPrivateKey(field, enabled) {\n+ if (enabled) {\n+ let value = $('#payment_us_amazon_pay_credentials_private_key_selected').val();\n+ if (value === 'pem') {\n+ $('#row_payment_us_amazon_pay_credentials_private_key_selector').hide();\n+ $('#row_payment_us_amazon_pay_credentials_private_key_pem').show();\n+ } else if (value === 'text') {\n+ $('#row_payment_us_amazon_pay_credentials_private_key_selector').hide();\n+ $('#row_payment_us_amazon_pay_credentials_private_key_text').show();\n+ } else {\n+ $('#row_payment_us_amazon_pay_credentials_private_key_selector').show();\n+ }\n+ }\n+ else {\n+ $('#row_payment_us_amazon_pay_credentials_private_key_selector').hide();\n+ $('#row_payment_us_amazon_pay_credentials_private_key_pem').hide();\n+ $('#row_payment_us_amazon_pay_credentials_private_key_text').hide();\n+ }\n+ }\n});\n" }, { "change_type": "MODIFY", "old_path": "view/adminhtml/web/js/validation-mixin.js", "new_path": "view/adminhtml/web/js/validation-mixin.js", "diff": "@@ -29,6 +29,18 @@ define(['jquery'], function ($) {\n},\n$.mage.__('Please enter a valid URL. Secure protocol is required (https://).')\n),\n+ $.validator.addMethod(\n+ 'validate-private-key',\n+ function (v) {\n+ if (v == '******') {\n+ return true;\n+ }\n+ return (/^-----BEGIN (RSA )?PRIVATE KEY-----.*-----END (RSA )?PRIVATE KEY-----$/s).test(v);\n+ },\n+ $.mage.__('Private Key field is invalid. It must include header ' +\n+ 'and footer of the private key. Please check and try again')\n+ ),\n+\n$.validator.addMethod(\n'validate-amzn-merchant-id',\nfunction (v) {\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-647 first attempt with dual file and text field private key
21,270
04.03.2021 09:29:51
28,800
27be9a05913e72764a488ddc47bc5c92c0e9408a
replaces a php function that was only for php8
[ { "change_type": "MODIFY", "old_path": "Plugin/PaymentTransactionIdUpdate.php", "new_path": "Plugin/PaymentTransactionIdUpdate.php", "diff": "@@ -36,7 +36,7 @@ class PaymentTransactionIdUpdate\n$transactionBasedOn = false\n) {\n$paymentMethodTitle = $payment->getAdditionalInformation('method_title') ?? '';\n- if (str_contains($paymentMethodTitle, 'Amazon Pay') && $type == Transaction::TYPE_VOID) {\n+ if (strpos($paymentMethodTitle, 'Amazon Pay') !== false && $type == Transaction::TYPE_VOID) {\n$chargePermissionId = $payment->getAdditionalInformation('charge_permission_id');\nif (empty($chargePermissionId)) {\n$transactionId = explode('-', $payment->getParentTransactionId());\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-642 replaces a php function that was only for php8
21,270
04.03.2021 17:02:16
28,800
291b96a5d71f50119cada5bd9909f014fb240c13
updates functionality and validation of private key fields
[ { "change_type": "MODIFY", "old_path": "Model/Config/File/PemFile.php", "new_path": "Model/Config/File/PemFile.php", "diff": "@@ -27,7 +27,7 @@ class PemFile extends \\Magento\\Config\\Block\\System\\Config\\Form\\Field\\File\nprotected function _getDeleteCheckbox()\n{\nif ($this->getValue()) {\n- return '<div id=\"amazon_pay_private_key_pem_file_saved_msg\">.PEM key already saved</div>';\n+ return '<div id=\"amazon_pay_private_key_pem_file_saved_msg\"><strong>.pem key already saved</strong></div><br>';\n}\nreturn '';\n" }, { "change_type": "MODIFY", "old_path": "Plugin/ConfigCredentialsValidator.php", "new_path": "Plugin/ConfigCredentialsValidator.php", "diff": "@@ -25,9 +25,9 @@ class ConfigCredentialsValidator\nconst XML_PATH_API_VERSION = 'groups/amazon_pay/fields/api_version/value';\nconst XML_PATH_ACTIVE = 'groups/amazon_pay/groups/credentials/fields/active_v2/value';\nconst XML_PATH_ACTIVE_INHERIT = 'groups/amazon_pay/groups/credentials/fields/active_v2/inherit';\n- const XML_PATH_PRIVATE_KEY = 'groups/amazon_pay/groups/credentials/fields/private_key/value';\nconst XML_PATH_PRIVATE_KEY_PEM = 'groups/amazon_pay/groups/credentials/fields/private_key_pem/value';\nconst XML_PATH_PRIVATE_KEY_TEXT = 'groups/amazon_pay/groups/credentials/fields/private_key_text/value';\n+ const XML_PATH_PRIVATE_KEY_SELECTED = 'groups/amazon_pay/groups/credentials/fields/private_key_selected/value';\nconst XML_PATH_PUBLIC_KEY_ID = 'groups/amazon_pay/groups/credentials/fields/public_key_id/value';\nconst XML_PATH_STORE_ID = 'groups/amazon_pay/groups/credentials/fields/store_id/value';\nconst XML_PATH_PAYMENT_REGION = 'groups/amazon_pay/groups/credentials/fields/payment_region/value';\n@@ -117,16 +117,14 @@ class ConfigCredentialsValidator\n$scope = $subject->getScope() ?: ScopeInterface::SCOPE_STORE;\n$scopeCode = $subject->getScopeCode();\n- $privateKey = '*';\n- if ($subject->getData(self::XML_PATH_PRIVATE_KEY_TEXT)) {\n- $privateKey = $subject->getData(self::XML_PATH_PRIVATE_KEY_TEXT);\n- }\n- else if ($subject->getData(self::XML_PATH_PRIVATE_KEY_PEM)) {\n- $privateKeyArray = $subject->getData(self::XML_PATH_PRIVATE_KEY);\n- if (empty($privateKeyArray['name'])) {\n- $privateKey = '*';\n+ $privateKey = '';\n+ $privateKeyArray['name'] = '';\n+ // check for pem file presence first\n+ if ($subject->getData(self::XML_PATH_PRIVATE_KEY_PEM)) {\n+ $privateKeyArray = $subject->getData(self::XML_PATH_PRIVATE_KEY_PEM);\n}\n- else {\n+ // if pem file present\n+ if (!empty($privateKeyArray['name'])) {\n$privateKey = file_get_contents($privateKeyArray['tmp_name']);\nif (!preg_match(\n'/^-----BEGIN (RSA )?PRIVATE KEY-----.*-----END (RSA )?PRIVATE KEY-----$/s',\n@@ -135,6 +133,13 @@ class ConfigCredentialsValidator\nthrow new \\Magento\\Framework\\Exception\\LocalizedException(__('Invalid key'));\n}\n}\n+ // no file present, check for text field\n+ else {\n+ if ($subject->getData(self::XML_PATH_PRIVATE_KEY_TEXT) &&\n+ $subject->getData(self::XML_PATH_PRIVATE_KEY_TEXT) !== '------'\n+ ) {\n+ $privateKey = $subject->getData(self::XML_PATH_PRIVATE_KEY_TEXT);\n+ }\n}\nif ($privateKey && (\n@@ -143,6 +148,9 @@ class ConfigCredentialsValidator\n) {\n$privateKey = null;\n}\n+ else if ($privateKey == '') {\n+ throw new ValidatorException(new Phrase('Please provide a Private Key'));\n+ }\n$publicKeyId = $subject->getData(self::XML_PATH_PUBLIC_KEY_ID);\nif ($publicKeyId && $publicKeyId === $this->amazonConfig->getPublicKeyId($scope, $scopeCode)) {\n$publicKeyId = null;\n@@ -194,6 +202,11 @@ class ConfigCredentialsValidator\nif (!in_array($response['status'], [200, 201])) {\n$data = json_decode($response['response'], true);\n+ if ($data['reasonCode'] == 'InvalidRequestSignature') {\n+ throw new ValidatorException(\n+ new Phrase('Unable to sign request, is your RSA private key valid?')\n+ );\n+ }\nthrow new ValidatorException(new Phrase($data['message']));\n}\nreturn $this;\n@@ -239,6 +252,9 @@ class ConfigCredentialsValidator\n} catch (\\Exception $e) {\n$this->setDataByPath($subject, self::XML_PATH_ACTIVE_INHERIT, false);\n$this->setDataByPath($subject, self::XML_PATH_ACTIVE, false);\n+ $this->setDataByPath($subject, self::XML_PATH_PRIVATE_KEY_PEM, false);\n+ $this->setDataByPath($subject, self::XML_PATH_PRIVATE_KEY_TEXT, false);\n+ $this->setDataByPath($subject, self::XML_PATH_PRIVATE_KEY_SELECTED, false);\n$this->messageManager->addErrorMessage(__('Failed to enable Amazon Pay: %1', $e->getMessage()));\n}\nreturn null;\n" }, { "change_type": "MODIFY", "old_path": "etc/adminhtml/system.xml", "new_path": "etc/adminhtml/system.xml", "diff": "<config_path>payment/amazon_payment_v2/private_key</config_path>\n<backend_model>Amazon\\Pay\\Model\\Config\\File\\PrivateKeyPem</backend_model>\n<upload_dir config=\"system\" scope_info=\"1\">amazon</upload_dir>\n- <comment><![CDATA[<a href=\"#\" class=\"amazon-private-key-change-key-type\">Change private key type]]></comment>\n+ <comment><![CDATA[<a href=\"#\" class=\"amazon-private-key-change-key-type\">Change Private Key input method]]></comment>\n</field>\n<field id=\"private_key_text\" translate=\"label comment\" type=\"textarea\" sortOrder=\"5\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>Private Key</label>\n<frontend_model>Amazon\\Pay\\Model\\Config\\Form\\Privatekey</frontend_model>\n<backend_model>Magento\\Config\\Model\\Config\\Backend\\Encrypted</backend_model>\n<validate>validate-private-key</validate>\n- <comment><![CDATA[<a href=\"#\" class=\"amazon-private-key-change-key-type\">Change private key type]]></comment>\n+ <comment><![CDATA[<a href=\"#\" class=\"amazon-private-key-change-key-type\">Change Private Key input method]]></comment>\n</field>\n<field id=\"private_key_selected\" translate=\"label comment\" type=\"text\" sortOrder=\"5\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>Private Key Selected</label>\n" }, { "change_type": "MODIFY", "old_path": "view/adminhtml/templates/system/config/private-key.phtml", "new_path": "view/adminhtml/templates/system/config/private-key.phtml", "diff": "/* @var \\Amazon\\Pay\\Block\\Adminhtml\\System\\Config\\Form\\PrivateKeySelector $block */\n?>\n-<button id=\"private_key_pem_button\"><?= __('Upload .PEM') ?></button>\n-<div><?= __('OR') ?></div>\n-<button id=\"private_key_text_button\"><?= __('Copy & Paste your<br>file contents') ?></button>\n+<button id=\"private_key_pem_button\"><?= __('Upload .pem file') ?></button>\n+<div><?= __('or') ?></div>\n+<button id=\"private_key_text_button\"><?= __('Copy & paste') ?></button>\n" }, { "change_type": "MODIFY", "old_path": "view/adminhtml/web/js/credentials.js", "new_path": "view/adminhtml/web/js/credentials.js", "diff": "require(['jquery', 'domReady!'], function ($) {\n$('[data-ui-id=\"text-groups-amazon-pay-groups-credentials-fields-public-key-id-value\"]').blur(\nfunction() {\n- $(this).val($(this).val().toUpperCase());\n+ $(this).val($(this).val().toUpperCase().trim());\n});\n$('[data-ui-id=\"text-groups-amazon-pay-groups-credentials-fields-merchant-id-v2-value\"]').blur(\nfunction() {\n- $(this).val($(this).val().toUpperCase());\n+ $(this).val($(this).val().toUpperCase().trim());\n});\n$('[data-ui-id=\"text-groups-amazon-pay-groups-credentials-fields-store-id-value\"]').blur(\nfunction() {\n- $(this).val($(this).val().toLowerCase());\n+ $(this).val($(this).val().toLowerCase().trim());\n});\n- // Private Key\n+ // private key select pem file\n$('#private_key_pem_button').click(function (e) {\ne.preventDefault();\n// set selected type\n$('#payment_us_amazon_pay_credentials_private_key_selected').val('pem');\n+ // hide text row\n+ $('#row_payment_us_amazon_pay_credentials_private_key_text').hide();\n+ $('#payment_us_amazon_pay_credentials_private_key_text').val('------');\n// hide selector row\n$('#row_payment_us_amazon_pay_credentials_private_key_selector').hide();\n// remove saved file feedback text\n@@ -44,11 +47,14 @@ require(['jquery', 'domReady!'], function ($) {\n$('#payment_us_amazon_pay_credentials_private_key_pem').click();\n});\n+ // private key select text\n$('#private_key_text_button').click(function (e) {\ne.preventDefault();\n// set selected type\n$('#payment_us_amazon_pay_credentials_private_key_selected').val('text');\n+ // hide file row\n+ $('#row_payment_us_amazon_pay_credentials_private_key_pem').hide();\n// hide selector row\n$('#row_payment_us_amazon_pay_credentials_private_key_selector').hide();\n// show text area row\n@@ -57,11 +63,14 @@ require(['jquery', 'domReady!'], function ($) {\n$('#payment_us_amazon_pay_credentials_private_key_text').val('').focus();\n});\n+ // change key type\n$('.amazon-private-key-change-key-type').click(function (e) {\ne.preventDefault();\n// reset selected type\n$('#payment_us_amazon_pay_credentials_private_key_selected').val('');\n+ // set text field\n+ $('#payment_us_amazon_pay_credentials_private_key_text').val('------');\n// hide pem row\n$('#row_payment_us_amazon_pay_credentials_private_key_pem').hide();\n// hide text row\n@@ -89,6 +98,7 @@ require(['jquery', 'domReady!'], function ($) {\n$('#row_payment_us_amazon_pay_credentials_private_key_text').show();\n} else {\n$('#row_payment_us_amazon_pay_credentials_private_key_selector').show();\n+ $('#payment_us_amazon_pay_credentials_private_key_text').val('------');\n}\n}\nelse {\n" }, { "change_type": "MODIFY", "old_path": "view/adminhtml/web/js/validation-mixin.js", "new_path": "view/adminhtml/web/js/validation-mixin.js", "diff": "@@ -32,7 +32,7 @@ define(['jquery'], function ($) {\n$.validator.addMethod(\n'validate-private-key',\nfunction (v) {\n- if (v == '******') {\n+ if (v == '******' || v === '------') {\nreturn true;\n}\nreturn (/^-----BEGIN (RSA )?PRIVATE KEY-----.*-----END (RSA )?PRIVATE KEY-----$/s).test(v);\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-647 updates functionality and validation of private key fields
21,241
05.03.2021 10:42:46
21,600
09641d87dce00f707175fe3870738cd96061fe28
Version bump, and rearrange changelog
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "# Change Log\n-## <new release>\n+## 5.0.2\n* Added tests for refund, multi auth refund, and multi auth with capture initiated\n-* Updated Alexa feature name\n* Added Japanese translations and updates translations for other languages\n-* Updated the platform_id for the new module version\n* Fixed bug with updating configuration without changing the private key.\n* Fixed customer data not getting cleared when getting signed in via Amazon Pay checkout\n* Replaced PHP8 only function being used for a more compatible one.\n+* Updated Alexa feature name\n+* Updated the platform_id for the new module version\n## 5.0.1\n* Removed reliance on legacy config value being set.\n## 5.0.0\n* Beta release, replacing all versions that were included as part of the \"Vendor Bundled Extension\" (VBE) program in previous Magento releases.\n-* Fixed creating a credit memo against a split capture invoice.\n* Added input validation and test upon saving for credentials.\n* Changed calling `closeChargePermission` instead of `cancelCharge` when voiding an order.\n-* Fixed loading correct config when switching store view before a cart is initiated.\n* Changed the button to create the session directly instead of through Magento.\n-* Removed redirect to cart on login if the customer has products in cart.\n+* Fixed creating a credit memo against a split capture invoice.\n+* Fixed loading correct config when switching store view before a cart is initiated.\n* Fixed product page button hover and tooltip button placement.\n+* Removed redirect to cart on login if the customer has products in cart.\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -50,7 +50,7 @@ The following table provides an overview on which Git branch is compatible to wh\nMagento Version | Github Branch | Latest release\n---|---|---\n2.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)\n-2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.0.1\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.0.2\n## Release Notes\nSee [CHANGELOG.md](/CHANGELOG.md)\n" }, { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"name\": \"amzn/amazon-pay-magento-2-module\",\n\"description\": \"Official Magento2 Plugin to integrate with Amazon Pay\",\n\"type\": \"magento2-module\",\n- \"version\": \"5.0.1\",\n+ \"version\": \"5.0.2\",\n\"license\": [\n\"Apache-2.0\"\n],\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Version bump, and rearrange changelog
21,241
05.03.2021 10:56:28
21,600
f4d8c6b001f644c1cb1438e668cc35c635c3fb28
Version correction for next release
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "# Change Log\n-## 5.0.2\n+## 5.1.0\n* Added tests for refund, multi auth refund, and multi auth with capture initiated\n* Added Japanese translations and updates translations for other languages\n* Fixed bug with updating configuration without changing the private key.\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -50,7 +50,7 @@ The following table provides an overview on which Git branch is compatible to wh\nMagento Version | Github Branch | Latest release\n---|---|---\n2.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)\n-2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.0.2\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.1.0\n## Release Notes\nSee [CHANGELOG.md](/CHANGELOG.md)\n" }, { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"name\": \"amzn/amazon-pay-magento-2-module\",\n\"description\": \"Official Magento2 Plugin to integrate with Amazon Pay\",\n\"type\": \"magento2-module\",\n- \"version\": \"5.0.2\",\n+ \"version\": \"5.1.0\",\n\"license\": [\n\"Apache-2.0\"\n],\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Version correction for next release
21,270
05.03.2021 11:24:00
28,800
fb4f48bbfbf4ffd3b91a197f2655b02df6b649f0
updates copy and styling of private key buttons
[ { "change_type": "MODIFY", "old_path": "Model/Config/File/PemFile.php", "new_path": "Model/Config/File/PemFile.php", "diff": "@@ -27,7 +27,7 @@ class PemFile extends \\Magento\\Config\\Block\\System\\Config\\Form\\Field\\File\nprotected function _getDeleteCheckbox()\n{\nif ($this->getValue()) {\n- return '<div id=\"amazon_pay_private_key_pem_file_saved_msg\"><strong>.pem key already saved</strong></div><br>';\n+ return '<div id=\"amazon_pay_private_key_pem_file_saved_msg\"><strong>.pem key file already saved</strong></div><br>';\n}\nreturn '';\n" }, { "change_type": "MODIFY", "old_path": "view/adminhtml/templates/system/config/private-key.phtml", "new_path": "view/adminhtml/templates/system/config/private-key.phtml", "diff": "/* @var \\Amazon\\Pay\\Block\\Adminhtml\\System\\Config\\Form\\PrivateKeySelector $block */\n?>\n+<div class=\"private-key-buttons\">\n<button id=\"private_key_pem_button\"><?= __('Upload .pem file') ?></button>\n<div><?= __('or') ?></div>\n-<button id=\"private_key_text_button\"><?= __('Copy & paste') ?></button>\n+ <button id=\"private_key_text_button\"><?= __('Copy & Paste') ?></button>\n+</div>\n" }, { "change_type": "MODIFY", "old_path": "view/adminhtml/web/css/source/_module.less", "new_path": "view/adminhtml/web/css/source/_module.less", "diff": "display: none;\n}\n#row_payment_us_amazon_pay_credentials_private_key_selector {\n- .value {\n+ .value .private-key-buttons {\ndisplay: flex;\n- width: 96%;\nalign-items: center;\njustify-content: space-between;\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-647 updates copy and styling of private key buttons
21,270
05.03.2021 15:29:05
28,800
05ded84bf537414d6c58ddc10d09f5951b6c6605
handles already saved private key without a saved type
[ { "change_type": "MODIFY", "old_path": "etc/adminhtml/system.xml", "new_path": "etc/adminhtml/system.xml", "diff": "<field id=\"private_key_selected\" translate=\"label comment\" type=\"text\" sortOrder=\"5\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>Private Key Selected</label>\n<config_path>payment/amazon_payment_v2/private_key_selected</config_path>\n+ <frontend_model>Amazon\\Pay\\Model\\Config\\Form\\PrivateKeySelected</frontend_model>\n</field>\n<field id=\"private_key_selector\" translate=\"label comment\" sortOrder=\"5\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>Private Key</label>\n" }, { "change_type": "MODIFY", "old_path": "view/adminhtml/web/js/credentials.js", "new_path": "view/adminhtml/web/js/credentials.js", "diff": "@@ -34,6 +34,8 @@ require(['jquery', 'domReady!'], function ($) {\n// set selected type\n$('#payment_us_amazon_pay_credentials_private_key_selected').val('pem');\n+ // uncheck inherit\n+ $('#payment_us_amazon_pay_credentials_private_key_selected_inherit').prop('checked', true).click();\n// hide text row\n$('#row_payment_us_amazon_pay_credentials_private_key_text').hide();\n$('#payment_us_amazon_pay_credentials_private_key_text').val('------');\n@@ -53,6 +55,8 @@ require(['jquery', 'domReady!'], function ($) {\n// set selected type\n$('#payment_us_amazon_pay_credentials_private_key_selected').val('text');\n+ // uncheck inherit\n+ $('#payment_us_amazon_pay_credentials_private_key_selected_inherit').prop('checked', true).click();\n// hide file row\n$('#row_payment_us_amazon_pay_credentials_private_key_pem').hide();\n// hide selector row\n@@ -69,6 +73,8 @@ require(['jquery', 'domReady!'], function ($) {\n// reset selected type\n$('#payment_us_amazon_pay_credentials_private_key_selected').val('');\n+ // check inherit\n+ $('#payment_us_amazon_pay_credentials_private_key_selected_inherit').prop('checked', false).click();\n// set text field\n$('#payment_us_amazon_pay_credentials_private_key_text').val('------');\n// hide pem row\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-647 handles already saved private key without a saved type
21,270
05.03.2021 16:59:49
28,800
c5c0becac1c8cdc2e84114580fb51b2a4dd2bce2
checkout pages now redirect to cart when session cancelled
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -445,7 +445,7 @@ class AmazonPayAdapter\n{\n$payload = [\n'signInReturnUrl' => $this->url->getRouteUrl('amazon_pay/login/authorize/'),\n- 'signInCancelUrl' => $this->redirect->getRefererUrl(),\n+ 'signInCancelUrl' => $this->getCancelUrl(),\n'storeId' => $this->amazonConfig->getClientId(),\n'signInScopes' => ['name', 'email'],\n];\n@@ -463,7 +463,7 @@ class AmazonPayAdapter\n$payload = [\n'webCheckoutDetails' => [\n'checkoutReviewReturnUrl' => $this->amazonConfig->getCheckoutReviewUrl(),\n- 'checkoutCancelUrl' => $this->redirect->getRefererUrl(),\n+ 'checkoutCancelUrl' => $this->getCancelUrl(),\n],\n'storeId' => $this->amazonConfig->getClientId(),\n];\n@@ -479,4 +479,14 @@ class AmazonPayAdapter\n{\nreturn $this->clientFactory->create($storeId)->generateButtonSignature($payload);\n}\n+\n+ protected function getCancelUrl()\n+ {\n+ $referer = $this->redirect->getRefererUrl();\n+ if ($referer == $this->url->getUrl('checkout')) {\n+ return $this->url->getUrl('checkout/cart');\n+ }\n+\n+ return $referer;\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/js/action/checkout-session-config-load.js", "new_path": "view/frontend/web/js/action/checkout-session-config-load.js", "diff": "@@ -33,7 +33,9 @@ define([\nreturn function (callback) {\nvar cartId = customerData.get('cart')()['data_id'] || window.checkout.storeId;\nvar config = getLocalStorage().get('config') || false;\n- if (typeof config.checkout_payload === 'undefined' || !config.checkout_payload.includes(document.URL)) {\n+ if (cartId !== getLocalStorage().get('cart_id')\n+ || typeof config.checkout_payload === 'undefined'\n+ || !config.checkout_payload.includes(document.URL)) {\ncallbacks.push(callback);\nif (callbacks.length == 1) {\nremoteStorage.get(url.build('amazon_pay/checkout/config')).done(function (config) {\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-600 checkout pages now redirect to cart when session cancelled
21,241
08.03.2021 11:27:11
21,600
ead4ffd20ada089d3114e461b26ebc11512accfb
also clear amazon checkout session data if on the cart page to ensure fresh session when starting Amazon Pay checkout
[ { "change_type": "MODIFY", "old_path": "view/frontend/templates/config.phtml", "new_path": "view/frontend/templates/config.phtml", "diff": "?>\n<?php /* @var $block \\Amazon\\Pay\\Block\\Config */ ?>\n<?php if ($block->isEnabled()): ?>\n+<?php\n+ $frontName = $block->getRequest()->getFrontName();\n+ $pathInfo = $block->getRequest()->getPathInfo();\n+?>\n<script>\nrequire (['uiRegistry'], function(registry) {\nregistry.set('amazonPay', <?= /* @noEscape */ \\Zend_Json::encode($block->getConfig()); ?>);\n});\n- <?php if ($block->getRequest()->getFrontName() != 'checkout'): ?>\n+ <?php if ( $frontName != 'checkout' || (str_contains($pathInfo, 'checkout/cart') === true)): ?>\nrequire (['Amazon_Pay/js/model/storage'], function(amazonStorage) {\namazonStorage.clearAmazonCheckout();\n});\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-600 - also clear amazon checkout session data if on the cart page to ensure fresh session when starting Amazon Pay checkout
21,241
11.03.2021 11:55:41
21,600
31f5a378bde27060e6a13e0019c529031eded9fc
Address phpcs complaints
[ { "change_type": "MODIFY", "old_path": "Block/Adminhtml/System/Config/Form/PrivateKeySelector.php", "new_path": "Block/Adminhtml/System/Config/Form/PrivateKeySelector.php", "diff": "@@ -17,10 +17,6 @@ namespace Amazon\\Pay\\Block\\Adminhtml\\System\\Config\\Form;\nuse Magento\\Framework\\Data\\Form\\Element\\AbstractElement;\n-/**\n- * Class PrivateKeySelector\n- * @package Amazon\\Pay\\Block\\Adminhtml\\System\\Config\\Form\n- */\nclass PrivateKeySelector extends \\Magento\\Config\\Block\\System\\Config\\Form\\Field\n{\n/**\n" }, { "change_type": "MODIFY", "old_path": "Model/Config/File/PemFile.php", "new_path": "Model/Config/File/PemFile.php", "diff": "*/\nnamespace Amazon\\Pay\\Model\\Config\\File;\n-/**\n- * Class PemFile\n- * @package Amazon\\Pay\\Model\\Config\\File\n- */\nclass PemFile extends \\Magento\\Config\\Block\\System\\Config\\Form\\Field\\File\n{\n/**\n@@ -27,6 +23,7 @@ class PemFile extends \\Magento\\Config\\Block\\System\\Config\\Form\\Field\\File\nprotected function _getDeleteCheckbox()\n{\nif ($this->getValue()) {\n+ // phpcs:ignore Generic.Files.LineLength\nreturn '<div id=\"amazon_pay_private_key_pem_file_saved_msg\"><strong>.pem key file already saved</strong></div><br>';\n}\n" }, { "change_type": "MODIFY", "old_path": "Model/Config/File/PrivateKeyPem.php", "new_path": "Model/Config/File/PrivateKeyPem.php", "diff": "*/\nnamespace Amazon\\Pay\\Model\\Config\\File;\n-/**\n- * Class PrivateKeyPem\n- * @package Amazon\\Pay\\Model\\Config\\File\n- */\nclass PrivateKeyPem extends \\Magento\\Config\\Model\\Config\\Backend\\File\n{\n/**\n@@ -52,9 +48,19 @@ class PrivateKeyPem extends \\Magento\\Config\\Model\\Config\\Backend\\File\n\\Magento\\Framework\\Model\\ResourceModel\\AbstractResource $resource = null,\n\\Magento\\Framework\\Data\\Collection\\AbstractDb $resourceCollection = null,\narray $data = []\n- )\n- {\n- parent::__construct($context, $registry, $config, $cacheTypeList, $uploaderFactory, $requestData, $filesystem, $resource, $resourceCollection, $data);\n+ ) {\n+ parent::__construct(\n+ $context,\n+ $registry,\n+ $config,\n+ $cacheTypeList,\n+ $uploaderFactory,\n+ $requestData,\n+ $filesystem,\n+ $resource,\n+ $resourceCollection,\n+ $data\n+ );\n$this->encryptor = $encryptor;\n}\n@@ -73,14 +79,14 @@ class PrivateKeyPem extends \\Magento\\Config\\Model\\Config\\Backend\\File\n$uploader->setAllowRenameFiles(true);\n$uploader->addValidateCallback('size', $this, 'validateMaxSize');\nif ($uploader->validateFile()) {\n+ // phpcs:ignore Magento2.Functions.DiscouragedFunction\n$privateKey = file_get_contents($value['tmp_name']);\n$this->setValue($this->encryptor->encrypt($privateKey));\n}\n} catch (\\Exception $e) {\nthrow new \\Magento\\Framework\\Exception\\LocalizedException(__('%1', $e->getMessage()));\n}\n- }\n- else {\n+ } else {\n$this->unsValue();\n}\n" }, { "change_type": "MODIFY", "old_path": "Plugin/ConfigCredentialsValidator.php", "new_path": "Plugin/ConfigCredentialsValidator.php", "diff": "@@ -125,16 +125,14 @@ class ConfigCredentialsValidator\n}\n// if pem file present\nif (!empty($privateKeyArray['name'])) {\n+ // phpcs:ignore Magento2.Functions.DiscouragedFunction\n$privateKey = file_get_contents($privateKeyArray['tmp_name']);\n- if (!preg_match(\n- '/^-----BEGIN (RSA )?PRIVATE KEY-----.*-----END (RSA )?PRIVATE KEY-----$/s',\n- $privateKey)\n- ) {\n+ $pattern = '/^-----BEGIN (RSA )?PRIVATE KEY-----.*-----END (RSA )?PRIVATE KEY-----$/s';\n+ if (!preg_match($pattern, $privateKey)) {\nthrow new \\Magento\\Framework\\Exception\\LocalizedException(__('Invalid key'));\n}\n- }\n+ } else {\n// no file present, check for text field\n- else {\nif ($subject->getData(self::XML_PATH_PRIVATE_KEY_TEXT) &&\n$subject->getData(self::XML_PATH_PRIVATE_KEY_TEXT) !== '------'\n) {\n@@ -147,8 +145,7 @@ class ConfigCredentialsValidator\n$privateKey === $this->amazonConfig->getPrivateKey($scope, $scopeCode))\n) {\n$privateKey = null;\n- }\n- else if ($privateKey == '') {\n+ } elseif ($privateKey == '') {\nthrow new ValidatorException(new Phrase('Please provide a Private Key'));\n}\n$publicKeyId = $subject->getData(self::XML_PATH_PUBLIC_KEY_ID);\n" }, { "change_type": "MODIFY", "old_path": "view/adminhtml/templates/system/config/private-key.phtml", "new_path": "view/adminhtml/templates/system/config/private-key.phtml", "diff": "?>\n<div class=\"private-key-buttons\">\n- <button id=\"private_key_pem_button\"><?= __('Upload .pem file') ?></button>\n- <div><?= __('or') ?></div>\n- <button id=\"private_key_text_button\"><?= __('Copy & Paste') ?></button>\n+ <button id=\"private_key_pem_button\"><?= /* @noEscape */ __('Upload .pem file') ?></button>\n+ <div><?= /* @noEscape */ __('or') ?></div>\n+ <button id=\"private_key_text_button\"><?= /* @noEscape */ __('Copy & Paste') ?></button>\n</div>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Address phpcs complaints
21,241
16.03.2021 11:08:07
18,000
8d79b8791cf9d8e6a7e627d861df7718f723d66c
remove test that is no longer valid with the Amazon popup change
[ { "change_type": "DELETE", "old_path": "Test/Mftf-24/Test/AmazonCheckoutCancelledThenSuccessTest.xml", "new_path": null, "diff": "-<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n-<tests xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/testSchema.xsd\">\n- <test name=\"AmazonCheckoutCancelledThenSuccess\" extends=\"AmazonCheckoutButton\">\n- <annotations>\n- <stories value=\"Amazon Checkout Cancelled then Successful\"/>\n- <title value=\"Amazon Checkout Cancelled then Successful\"/>\n- <description value=\"User should be able to checkout with Amazon Pay after cancelling their checkout session.\"/>\n- <severity value=\"CRITICAL\"/>\n- <group value=\"amazon_pay_disabled\"/>\n- <group value=\"amazon_pay_checkout\"/>\n- </annotations>\n-\n- <!--Go to Amazon Pay from the checkout and login-->\n- <click selector=\"{{AmazonButtonSection.checkout}}\" stepKey=\"clickAmazonButton\"/>\n- <actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"AmazonLoginActionGroup\"/>\n-\n- <click selector=\"{{AmazonPageSection.cancelButton}}\" stepKey=\"cancelCheckout\"/>\n- <waitForPageLoad stepKey=\"waitForCheckoutPageLoad\"/>\n-\n- <!--Go back to Amazon Pay from the checkout and login-->\n- <click selector=\"{{AmazonButtonSection.checkout}}\" stepKey=\"clickAmazonButton2\"/>\n- <actionGroup ref=\"AmazonAlreadyLoggedInActionGroup\" stepKey=\"AmazonLoginActionGroup2\"/>\n- <!--Come back to checkout with default address-->\n- <actionGroup ref=\"AmazonCheckoutActionGroup\" stepKey=\"DefaultAmazonCheckoutActionGroup2\"/>\n-\n- <!-- Get the current checkout session ID -->\n- <executeJS function=\"return localStorage.getItem('amzn-checkout-session')\" stepKey=\"getCheckoutSession2\"/>\n-\n- <!-- Ensure we have an active checkout session by clicking Edit address -->\n- <click selector=\"{{AmazonCheckoutSection.editShippingButton}}\" stepKey=\"clickAmazonEditShippingButton\"/>\n- <waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"waitForCancelCheckout2\"/>\n- <click selector=\"{{AmazonPageSection.cancelButton}}\" stepKey=\"cancelCheckout2\"/>\n- <waitForPageLoad stepKey=\"waitForCheckoutPageLoad2\"/>\n-\n- <!--Go back to Amazon Pay from the checkout and login-->\n- <click selector=\"{{AmazonButtonSection.checkout}}\" stepKey=\"clickAmazonButton3\"/>\n- <actionGroup ref=\"AmazonAlreadyLoggedInActionGroup\" stepKey=\"AmazonLoginActionGroup3\"/>\n- <!--Come back to checkout with default address-->\n- <actionGroup ref=\"AmazonCheckoutActionGroup\" stepKey=\"DefaultAmazonCheckoutActionGroup3\"/>\n- <waitForPageLoad stepKey=\"waitForCheckoutPageLoad3\"/>\n-\n- <!-- Get the current checkout session ID and make sure it changed -->\n- <executeJS function=\"return localStorage.getItem('amzn-checkout-session')\" stepKey=\"getCheckoutSession3\"/>\n- <assertNotEquals stepKey=\"verifyChangedSession2\">\n- <actualResult type=\"const\">$getCheckoutSession3</actualResult>\n- <expectedResult type=\"const\">$getCheckoutSession2</expectedResult>\n- </assertNotEquals>\n-\n- <!--Go to payment method-->\n- <click selector=\"{{CheckoutShippingSection.next}}\" stepKey=\"clickCheckoutShippingNext\"/>\n- <waitForPageLoad stepKey=\"waitForCheckoutPaymentPageLoad\"/>\n-\n- <click selector=\"{{AmazonCheckoutSection.editPaymentButton}}\" stepKey=\"clickEditPaymentButton\"/>\n- <waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"waitForContinueButton\"/>\n- <click selector=\"{{AmazonPageSection.cancelButton}}\" stepKey=\"cancelCheckout3\"/>\n- <waitForPageLoad stepKey=\"waitForCheckoutPageLoad4\"/>\n-\n- <!--Go back to Amazon Pay from the checkout and login-->\n- <click selector=\"{{AmazonButtonSection.checkout}}\" stepKey=\"clickAmazonButton4\"/>\n- <actionGroup ref=\"AmazonAlreadyLoggedInActionGroup\" stepKey=\"AmazonLoginActionGroup4\"/>\n- <!--Come back to checkout with default address-->\n- <actionGroup ref=\"AmazonCheckoutActionGroup\" stepKey=\"DefaultAmazonCheckoutActionGroup4\"/>\n- <waitForPageLoad stepKey=\"waitForCheckoutPageLoad5\"/>\n-\n- <!-- Get the current checkout session ID and make sure it changed -->\n- <executeJS function=\"return localStorage.getItem('amzn-checkout-session')\" stepKey=\"getCheckoutSession4\"/>\n- <assertNotEquals stepKey=\"verifyChangedSession3\">\n- <actualResult type=\"const\">$getCheckoutSession4</actualResult>\n- <expectedResult type=\"const\">$getCheckoutSession3</expectedResult>\n- </assertNotEquals>\n-\n- <!--Go to payment method, edit payment, then proceed-->\n- <click selector=\"{{CheckoutShippingSection.next}}\" stepKey=\"clickCheckoutShippingNext2\"/>\n- <waitForPageLoad stepKey=\"waitForCheckoutPaymentPageLoad2\"/>\n- <click selector=\"{{AmazonCheckoutSection.editPaymentButton}}\" stepKey=\"clickEditPaymentButton2\"/>\n- <waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"waitForContinueButton2\"/>\n- <click selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"clickAmazonCheckoutButton2\"/>\n- <waitForElement selector=\"{{CheckoutPaymentSection.availablePaymentSolutions}}\" stepKey=\"waitForCheckoutPaymentPageLoad3\"/>\n-\n- <!--Verify only Amazon Pay method is visible-->\n- <seeNumberOfElements selector=\"{{CheckoutPaymentSection.availablePaymentSolutions}}\" userInput=\"1\" stepKey=\"seeSingleAvailablePaymentSolution\"/>\n- <seeElement selector=\"{{AmazonCheckoutSection.method}}\" stepKey=\"seeAmazonPaymentMethod\"/>\n- <!--Place order-->\n- <actionGroup ref=\"CheckoutPlaceOrderActionGroup\" stepKey=\"guestPlaceorder\">\n- <argument name=\"orderNumberMessage\" value=\"CONST.successGuestCheckoutOrderNumberMessage\" />\n- <argument name=\"emailYouMessage\" value=\"CONST.successCheckoutEmailYouMessage\" />\n- </actionGroup>\n- </test>\n-</tests>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-600 - remove test that is no longer valid with the Amazon popup change
21,241
17.03.2021 13:48:33
18,000
9f58c619c3d70a463dc5535a3e717ce377ff1f3a
add Sign in with Amazon button to the authentication modal that is triggered when guest checkout is disabled and a guest clicks proceed to checkout
[ { "change_type": "MODIFY", "old_path": "view/frontend/layout/default.xml", "new_path": "view/frontend/layout/default.xml", "diff": "<referenceContainer name=\"content\">\n<block class=\"Amazon\\Pay\\Block\\Config\" name=\"amazon_pay_config\" template=\"Amazon_Pay::config.phtml\" />\n</referenceContainer>\n+\n+ <referenceBlock name=\"authentication-popup\">\n+ <arguments>\n+ <argument name=\"jsLayout\" xsi:type=\"array\">\n+ <item name=\"components\" xsi:type=\"array\">\n+ <item name=\"authenticationPopup\" xsi:type=\"array\">\n+ <item name=\"children\" xsi:type=\"array\">\n+ <item name=\"amazon-button\" xsi:type=\"array\">\n+ <item name=\"component\" xsi:type=\"string\">Amazon_Pay/js/view/login-button-wrapper</item>\n+ <item name=\"sortOrder\" xsi:type=\"string\">0</item>\n+ <item name=\"displayArea\" xsi:type=\"string\">additional-login-form-fields</item>\n+ <item name=\"config\" xsi:type=\"array\">\n+ <item name=\"tooltip\" xsi:type=\"string\" translate=\"true\">Securely login into our website using your existing Amazon details.</item>\n+<!-- <item name=\"componentDisabled\" xsi:type=\"helper\"-->\n+<!-- helper=\"Amazon\\Pay\\Model\\AmazonConfig::isLwaEnabled\"/>-->\n+ </item>\n+ </item>\n+ </item>\n+ </item>\n+ </item>\n+ </argument>\n+ </arguments>\n+ </referenceBlock>\n</body>\n</page>\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/css/source/_module.less", "new_path": "view/frontend/web/css/source/_module.less", "diff": "top: 50%;\n}\n}\n+ .block-customer-login {\n+ .amazon-sign-in-button-container {\n+ .field-tooltip {\n+ .field-tooltip-content {\n+ top: 38px;\n+ left: -245px;\n+\n+ &:before {\n+ border: none;\n+ border-left: 10px solid transparent;\n+ border-right: 10px solid transparent;\n+ border-bottom: 10px solid #666666;\n+ top: -10px;\n+ left: 244px;\n+ }\n+ &:after {\n+ border: none;\n+ border-left: 10px solid transparent;\n+ border-right: 10px solid transparent;\n+ border-bottom: 10px solid #f4f4f4;\n+ top: -8px;\n+ left: 244px;\n+ }\n+ }\n+ }\n+ }\n+ }\n.cart-summary {\n.amazon-button-container {\n" }, { "change_type": "ADD", "old_path": null, "new_path": "view/frontend/web/js/view/login-button-wrapper.js", "diff": "+/**\n+ * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\").\n+ * You may not use this file except in compliance with the License.\n+ * A copy of the License is located at\n+ *\n+ * http://aws.amazon.com/apache2.0\n+ *\n+ * or in the \"license\" file accompanying this file. This file is distributed\n+ * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n+ * express or implied. See the License for the specific language governing\n+ * permissions and limitations under the License.\n+ */\n+\n+define(\n+ [\n+ 'jquery',\n+ 'uiRegistry',\n+ 'Amazon_Pay/js/model/storage',\n+ 'amazonPayLoginButton',\n+ 'uiComponent'\n+ ], function(\n+ $,\n+ registry,\n+ amazonStorage,\n+ loginButton,\n+ component\n+ ) {\n+ 'use strict';\n+\n+ if (amazonStorage.isLwaEnabled) {\n+ return component.extend({\n+ defaults: {\n+ template: 'Amazon_Pay/login-button-wrapper'\n+ },\n+\n+ initializeLoginButton: function() {\n+ $('#AmazonPayButton').AmazonLoginButton();\n+ }\n+\n+ });\n+ }\n+\n+ return component;\n+});\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-661 - add Sign in with Amazon button to the authentication modal that is triggered when guest checkout is disabled and a guest clicks proceed to checkout
21,241
17.03.2021 13:53:16
18,000
83e232dbb6a72cf095fabfce8bfc2b0d4d538ce6
remove commented lines from xml
[ { "change_type": "MODIFY", "old_path": "view/frontend/layout/default.xml", "new_path": "view/frontend/layout/default.xml", "diff": "<item name=\"displayArea\" xsi:type=\"string\">additional-login-form-fields</item>\n<item name=\"config\" xsi:type=\"array\">\n<item name=\"tooltip\" xsi:type=\"string\" translate=\"true\">Securely login into our website using your existing Amazon details.</item>\n-<!-- <item name=\"componentDisabled\" xsi:type=\"helper\"-->\n-<!-- helper=\"Amazon\\Pay\\Model\\AmazonConfig::isLwaEnabled\"/>-->\n</item>\n</item>\n</item>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-661 - remove commented lines from xml
21,266
19.03.2021 14:29:06
14,400
43964ffc77b154d723f82b06ba8057db7afcf9bc
Add MFTF for
[ { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-24/Test/AmazonSignInButtonVisibleNoGuestCheckout.xml", "diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<tests xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/testSchema.xsd\">\n+ <test name=\"AmazonSignInButtonNoGuestCheckout\">\n+ <annotations>\n+ <stories value=\"Amazon Sign In Button No Guest Checkout\"/>\n+ <title value=\"Amazon Sign In Button No Guest Checkout\"/>\n+ <description value=\"Amazon Sign In button should be visible when proceeding to checkout with guest checkout disabled\"/>\n+ <severity value=\"CRITICAL\"/>\n+ <group value=\"amazon_pay\"/>\n+ <group value=\"amazon_pay_signin\"/>\n+ </annotations>\n+\n+ <before>\n+ <createData entity=\"SimpleTwo\" stepKey=\"createSimpleProduct\"/>\n+ <createData entity=\"SampleAmazonPaymentConfigLwa\" stepKey=\"SampleAmazonPaymentConfigLwa\"/>\n+ <magentoCLI command=\"config:set checkout/options/guest_checkout 0\" stepKey=\"disableGuestCheckout\"/>\n+ <magentoCLI command=\"cache:flush\" stepKey=\"flushCache\"/>\n+ </before>\n+\n+ <after>\n+ <createData entity=\"SampleAmazonPaymentConfig\" stepKey=\"SampleAmazonPaymentConfig\"/>\n+ <magentoCLI command=\"config:set checkout/options/guest_checkout 1\" stepKey=\"enableGuestCheckout\"/>\n+ <magentoCLI command=\"cache:flush\" stepKey=\"flushCache\"/>\n+ </after>\n+\n+ <!--Go to product page-->\n+ <actionGroup ref=\"StorefrontOpenProductPageActionGroup\" stepKey=\"openProductStoreFront\">\n+ <argument name=\"productUrl\" value=\"$$createSimpleProduct.custom_attributes[url_key]$$\"/>\n+ </actionGroup>\n+ <!--Click on Add To Cart button-->\n+ <actionGroup ref=\"StorefrontAddToTheCartActionGroup\" stepKey=\"clickOnAddToCartButton\"/>\n+ <!--Go to checkout-->\n+ <actionGroup ref=\"GoToCheckoutFromMinicartActionGroup\" stepKey=\"goToCheckoutFromMiniCart\"/>\n+ <!-- Verify Sign in with Amazon button is displayed -->\n+ <seeElement selector=\"{{AmazonLoginSection.login}}\" stepKey=\"seeSignInWithAmazonButtonLogin\"/>\n+ </test>\n+</tests>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Add MFTF for ASD-661
21,241
19.03.2021 16:58:25
18,000
491e6563e441e9b09d81c15e94eb9b72febb3964
add required argument for a test, and make filename / test name match
[ { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonShippingAddressTest.xml", "new_path": "Test/Mftf-24/Test/AmazonShippingAddressTest.xml", "diff": "<waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"waitForAmazonChangedShippingPageLoad\"/>\n<wait time=\"1\" stepKey=\"allowButtonToActivate2\"/>\n<!--Come back to checkout with changed address-->\n- <actionGroup ref=\"AmazonCheckoutActionGroup\" stepKey=\"ChangedAmazonCheckoutActionGroup\"/>\n+ <actionGroup ref=\"AmazonCheckoutActionGroup\" stepKey=\"ChangedAmazonCheckoutActionGroup\">\n+ <argument name=\"openerName\" value=\"{$openerName}\"/>\n+ </actionGroup>\n</test>\n</tests>\n" }, { "change_type": "RENAME", "old_path": "Test/Mftf-24/Test/AmazonSignInButtonVisibleNoGuestCheckout.xml", "new_path": "Test/Mftf-24/Test/AmazonSignInButtonNoGuestCheckoutPopupTest.xml", "diff": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tests xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/testSchema.xsd\">\n- <test name=\"AmazonSignInButtonNoGuestCheckout\">\n+ <test name=\"AmazonSignInButtonNoGuestCheckoutPopup\">\n<annotations>\n<stories value=\"Amazon Sign In Button No Guest Checkout\"/>\n<title value=\"Amazon Sign In Button No Guest Checkout\"/>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-661 - add required argument for a test, and make filename / test name match
21,241
23.03.2021 15:37:36
18,000
13a8a9ca1d95f6f4aea6facc54d1dc0cf479d456
restructure the button widget creation to add an observer, so that if the customer data loads after the button js runs and adds customer data then it will trigger rendering the Amazon Pay button
[ { "change_type": "MODIFY", "old_path": "view/frontend/web/js/amazon-button.js", "new_path": "view/frontend/web/js/amazon-button.js", "diff": "@@ -22,16 +22,6 @@ define([\n], function ($, checkoutSessionConfigLoad, amazonStorage, url, amazonCheckout, customerData) {\n'use strict';\n- var cart = customerData.get('cart'),\n- customer = customerData.get('customer'),\n- canCheckoutWithAmazon = false;\n-\n- // to use Amazon Pay: customer needs to be logged in, or guest checkout allowed, or Amazon Sign-in enabled\n- if (customer().firstname || amazonStorage.isGuestCheckoutEnabled || amazonStorage.isLwaEnabled) {\n- canCheckoutWithAmazon = true;\n- }\n-\n- if (amazonStorage.isEnabled && canCheckoutWithAmazon) {\n$.widget('amazon.AmazonButton', {\noptions: {\npayOnly: null,\n@@ -129,6 +119,25 @@ define([\n}\n});\n+\n+ var cart = customerData.get('cart'),\n+ customer = customerData.get('customer'),\n+ canCheckoutWithAmazon = false;\n+\n+ // to use Amazon Pay: customer needs to be logged in, or guest checkout allowed, or Amazon Sign-in enabled\n+ if (customer().firstname || amazonStorage.isGuestCheckoutEnabled || amazonStorage.isLwaEnabled) {\n+ canCheckoutWithAmazon = true;\n+ }\n+\n+ if (amazonStorage.isEnabled && canCheckoutWithAmazon) {\nreturn $.amazon.AmazonButton;\n+ } else {\n+ return function(config, element) {\n+ customer.subscribe(function() {\n+ if (customer().firstname || amazonStorage.isGuestCheckoutEnabled || amazonStorage.isLwaEnabled) {\n+ $(element).AmazonButton();\n+ }\n+ });\n+ };\n}\n});\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-660 - restructure the button widget creation to add an observer, so that if the customer data loads after the button js runs and adds customer data then it will trigger rendering the Amazon Pay button
21,241
24.03.2021 10:18:32
18,000
780966fb41fba3474399ddf86c62d90cb9ae5e48
better handle hitting controller when checkoutSessionId is empty
[ { "change_type": "MODIFY", "old_path": "Controller/Login/Checkout.php", "new_path": "Controller/Login/Checkout.php", "diff": "@@ -28,6 +28,9 @@ class Checkout extends \\Amazon\\Pay\\Controller\\Login\npublic function execute()\n{\n$checkoutSessionId = $this->getRequest()->getParam('amazonCheckoutSessionId');\n+ if ($checkoutSessionId == '') {\n+ return $this->_redirect('checkout/cart');\n+ }\ntry {\n$checkoutSession = $this->amazonAdapter->getCheckoutSession(\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-601 - better handle hitting controller when checkoutSessionId is empty
21,241
29.03.2021 10:45:26
18,000
cec04909a4851d15fcb6be7e9a9669ae32ca234c
convert another str_contains to strpos
[ { "change_type": "MODIFY", "old_path": "view/frontend/templates/config.phtml", "new_path": "view/frontend/templates/config.phtml", "diff": "registry.set('amazonPay', <?= /* @noEscape */ \\Zend_Json::encode($block->getConfig()); ?>);\n});\n- <?php if ($frontName != 'checkout' || (str_contains($pathInfo, 'checkout/cart') === true)): ?>\n+ <?php if ($frontName != 'checkout' || (strpos($pathInfo, 'checkout/cart') !== false)): ?>\nrequire (['Amazon_Pay/js/model/storage'], function(amazonStorage) {\namazonStorage.clearAmazonCheckout();\n});\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-668 - convert another str_contains to strpos
21,241
30.03.2021 14:13:06
18,000
ced22bd11bb263fa0e32153dfabfaf9ba0efc27f
add dependencies that are used but not listed in composer.json
[ { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"magento/module-quote\": \"^101.0\",\n\"magento/module-customer\": \"^102.0||^103.0\",\n\"magento/module-store\": \"^101.0\",\n+ \"magento/module-catalog\": \"^103.0||^104.0\",\n+ \"magento/module-configurable-product\": \"^100.0\",\n+ \"magento/module-directory\": \"^100.0\",\n+ \"magento/module-media-storage\": \"^100.0\",\n+ \"magento/module-paypal\": \"^100.0||^101.0\",\n\"amzn/amazon-pay-api-sdk-php\": \"^2.2\",\n\"aws/aws-php-sns-message-validator\": \"^1.5\"\n},\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-603 - add dependencies that are used but not listed in composer.json
21,241
31.03.2021 14:40:28
18,000
b6555d9f701a74398b1154128b36d46bba951451
alter the redirect behavior to be configurable, to support checkout paths other than /checkout and success pages other than /checkout/onepage/success
[ { "change_type": "MODIFY", "old_path": "Controller/Checkout/CompleteSession.php", "new_path": "Controller/Checkout/CompleteSession.php", "diff": "@@ -27,6 +27,11 @@ class CompleteSession extends \\Magento\\Framework\\App\\Action\\Action\n*/\nprivate $amazonCheckoutSession;\n+ /**\n+ * @var \\Amazon\\Pay\\Model\\AmazonConfig\n+ */\n+ private $amazonConfig;\n+\n/**\n* @var \\Magento\\Store\\Model\\StoreManagerInterface\n*/\n@@ -51,6 +56,7 @@ class CompleteSession extends \\Magento\\Framework\\App\\Action\\Action\n* CompleteCheckout constructor.\n* @param \\Magento\\Framework\\App\\Action\\Context $context\n* @param \\Amazon\\Pay\\CustomerData\\CheckoutSession $amazonCheckoutSession\n+ * @param \\Amazon\\Pay\\Model\\AmazonConfig $amazonConfig\n* @param \\Magento\\Framework\\Stdlib\\CookieManagerInterface $cookieManager\n* @param \\Magento\\Framework\\Stdlib\\Cookie\\CookieMetadataFactory $cookieMetadataFactory\n* @param \\Magento\\Store\\Model\\StoreManagerInterface $storeManager\n@@ -59,6 +65,7 @@ class CompleteSession extends \\Magento\\Framework\\App\\Action\\Action\npublic function __construct(\n\\Magento\\Framework\\App\\Action\\Context $context,\n\\Amazon\\Pay\\CustomerData\\CheckoutSession $amazonCheckoutSession,\n+ \\Amazon\\Pay\\Model\\AmazonConfig $amazonConfig,\n\\Magento\\Framework\\Stdlib\\CookieManagerInterface $cookieManager,\n\\Magento\\Framework\\Stdlib\\Cookie\\CookieMetadataFactory $cookieMetadataFactory,\n\\Magento\\Store\\Model\\StoreManagerInterface $storeManager,\n@@ -66,6 +73,7 @@ class CompleteSession extends \\Magento\\Framework\\App\\Action\\Action\n) {\nparent::__construct($context);\n$this->amazonCheckoutSession = $amazonCheckoutSession;\n+ $this->amazonConfig = $amazonConfig;\n$this->exceptionLogger = $exceptionLogger ?: ObjectManager::getInstance()->get(ExceptionLogger::class);\n$this->cookieManager = $cookieManager;\n$this->cookieMetadataFactory = $cookieMetadataFactory;\n@@ -91,7 +99,8 @@ class CompleteSession extends \\Magento\\Framework\\App\\Action\\Action\nthrow new \\Magento\\Framework\\Exception\\NotFoundException(__('Something went wrong. Please try again.'));\n}\n$this->updateVersionCookie();\n- return $this->_redirect('checkout/onepage/success', [\n+ $successUrl = $this->amazonConfig->getCheckoutResultUrlPath();\n+ return $this->_redirect($successUrl, [\n'_scope' => $scope,\n]);\n} catch (\\Exception $e) {\n" }, { "change_type": "MODIFY", "old_path": "Controller/Login/Checkout.php", "new_path": "Controller/Login/Checkout.php", "diff": "@@ -81,7 +81,8 @@ class Checkout extends \\Amazon\\Pay\\Controller\\Login\n$this->_eventManager->dispatch('amazon_login_authorize_error', ['exception' => $e]);\n}\n- return $this->_redirect('checkout', ['_query' => ['amazonCheckoutSessionId' => $checkoutSessionId]]);\n+ $checkoutUrl = $this->amazonConfig->getCheckoutReviewUrlPath();\n+ return $this->_redirect($checkoutUrl, ['_query' => ['amazonCheckoutSessionId' => $checkoutSessionId]]);\n}\nprotected function processAmazonCustomer(AmazonCustomerInterface $amazonCustomer)\n" }, { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -159,7 +159,7 @@ class AmazonPayAdapter\n$payload = [\n'webCheckoutDetails' => [\n- 'checkoutResultReturnUrl' => $this->amazonConfig->getCheckoutResultUrl()\n+ 'checkoutResultReturnUrl' => $this->url->getRouteUrl('amazon_pay/checkout/completeSession')\n],\n'paymentDetails' => [\n'paymentIntent' => $paymentIntent,\n@@ -462,7 +462,7 @@ class AmazonPayAdapter\n{\n$payload = [\n'webCheckoutDetails' => [\n- 'checkoutReviewReturnUrl' => $this->amazonConfig->getCheckoutReviewUrl(),\n+ 'checkoutReviewReturnUrl' => $this->amazonConfig->getCheckoutReviewReturnUrl(),\n'checkoutCancelUrl' => $this->getCancelUrl(),\n],\n'storeId' => $this->amazonConfig->getClientId(),\n" }, { "change_type": "MODIFY", "old_path": "Model/AmazonConfig.php", "new_path": "Model/AmazonConfig.php", "diff": "@@ -507,7 +507,18 @@ class AmazonConfig\n/**\n* @return string\n*/\n- public function getCheckoutReviewUrl($scope = ScopeInterface::SCOPE_STORE, $scopeCode = null)\n+ public function getCheckoutReviewReturnUrl($scope = ScopeInterface::SCOPE_STORE, $scopeCode = null)\n+ {\n+ return $this->storeManager->getStore()->getUrl(\n+ 'amazon_pay/login/checkout',\n+ ['_forced_secure' => true]\n+ );\n+ }\n+\n+ /**\n+ * @return string\n+ */\n+ public function getCheckoutReviewUrlPath($scope = ScopeInterface::SCOPE_STORE, $scopeCode = null)\n{\n$result = $this->scopeConfig->getValue(\n'payment/amazon_payment_v2/checkout_review_url',\n@@ -515,10 +526,7 @@ class AmazonConfig\n$scopeCode\n);\nif (empty($result)) {\n- $result = $this->storeManager->getStore()->getUrl(\n- 'amazon_pay/login/checkout',\n- ['_forced_secure' => true]\n- );\n+ $result = 'checkout';\n}\nreturn $result;\n}\n@@ -526,7 +534,7 @@ class AmazonConfig\n/**\n* @return string\n*/\n- public function getCheckoutResultUrl($scope = ScopeInterface::SCOPE_STORE, $scopeCode = null)\n+ public function getCheckoutResultUrlPath($scope = ScopeInterface::SCOPE_STORE, $scopeCode = null)\n{\n$result = $this->scopeConfig->getValue(\n'payment/amazon_payment_v2/checkout_result_url',\n@@ -534,10 +542,7 @@ class AmazonConfig\n$scopeCode\n);\nif (empty($result)) {\n- $result = $this->storeManager->getStore()->getUrl(\n- 'amazon_pay/checkout/completeSession',\n- ['_forced_secure' => true]\n- );\n+ $result = 'checkout/onepage/success';\n}\nreturn $result;\n}\n" }, { "change_type": "MODIFY", "old_path": "Plugin/ConfigCredentialsValidator.php", "new_path": "Plugin/ConfigCredentialsValidator.php", "diff": "@@ -189,7 +189,7 @@ class ConfigCredentialsValidator\n$client = $this->clientFactory->create($scopeCode, $scope, $config);\n$response = $client->createCheckoutSession([\n'webCheckoutDetails' => [\n- 'checkoutReviewReturnUrl' => $this->amazonConfig->getCheckoutReviewUrl(),\n+ 'checkoutReviewReturnUrl' => $this->amazonConfig->getCheckoutReviewReturnUrl(),\n],\n'storeId' => $storeId,\n'platformId' => $this->amazonConfig->getPlatformId(),\n" }, { "change_type": "MODIFY", "old_path": "etc/adminhtml/system.xml", "new_path": "etc/adminhtml/system.xml", "diff": "<config_path>payment/amazon_payment/logging</config_path>\n</field>\n<field id=\"checkout_review_url\" translate=\"label comment\" type=\"text\" sortOrder=\"20\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n- <label>Checkout review URL</label>\n- <comment><![CDATA[Amazon Pay will redirect to this URL after the buyer selects their preferred payment instrument and shipping address.]]></comment>\n+ <label>Checkout review URL Path</label>\n+ <comment><![CDATA[<strong>Amazon Pay Checkout could potentially break if this value is modified. Do it only if it is needed by your website.</strong><br />Amazon Pay will redirect to this URL after the buyer selects their preferred payment instrument and shipping address. Do not use a leading slash.]]></comment>\n<config_path>payment/amazon_payment_v2/checkout_review_url</config_path>\n- <validate>validate-secure-url</validate>\n</field>\n<field id=\"checkout_result_url\" translate=\"label comment\" type=\"text\" sortOrder=\"20\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n- <label>Checkout result URL</label>\n- <comment><![CDATA[Amazon Pay will redirect to this URL after completing the transaction.]]></comment>\n+ <label>Checkout result URL Path</label>\n+ <comment><![CDATA[<strong>Amazon Pay Checkout could potentially break if this value is modified. Do it only if it is needed by your website.</strong><br />Amazon Pay will redirect to this URL after completing the transaction. Do not use a leading slash.]]></comment>\n<config_path>payment/amazon_payment_v2/checkout_result_url</config_path>\n- <validate>validate-secure-url</validate>\n</field>\n<field id=\"loglist_v2\" translate=\"label\" type=\"text\" sortOrder=\"30\" showInDefault=\"1\" showInWebsite=\"0\" showInStore=\"0\">\n<label>Developer Logs</label>\n" }, { "change_type": "MODIFY", "old_path": "etc/config.xml", "new_path": "etc/config.xml", "diff": "<private_key backend_model=\"Magento\\Config\\Model\\Config\\Backend\\Encrypted\" />\n<alexa_active>0</alexa_active>\n<platform_id>A2ZAYEJU54T1BM</platform_id>\n+ <checkout_review_url>checkout</checkout_review_url>\n+ <checkout_result_url>checkout/onepage/success</checkout_result_url>\n</amazon_payment_v2>\n</payment>\n</default>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-629 - alter the redirect behavior to be configurable, to support checkout paths other than /checkout and success pages other than /checkout/onepage/success
21,241
01.04.2021 10:57:59
18,000
e10a664ce2403f53b2bed5881319b8cab5dea1d9
add type="button" to private key config so that enter on an unrelated text field doesn't trigger the buttons
[ { "change_type": "MODIFY", "old_path": "view/adminhtml/templates/system/config/private-key.phtml", "new_path": "view/adminhtml/templates/system/config/private-key.phtml", "diff": "?>\n<div class=\"private-key-buttons\">\n- <button id=\"private_key_pem_button\"><?= /* @noEscape */ __('Upload .pem file') ?></button>\n+ <button id=\"private_key_pem_button\" type=\"button\"><?= /* @noEscape */ __('Upload .pem file') ?></button>\n<div><?= /* @noEscape */ __('or') ?></div>\n- <button id=\"private_key_text_button\"><?= /* @noEscape */ __('Copy & Paste') ?></button>\n+ <button id=\"private_key_text_button\" type=\"button\"><?= /* @noEscape */ __('Copy & Paste') ?></button>\n</div>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-670 - add type="button" to private key config so that enter on an unrelated text field doesn't trigger the buttons
21,241
06.04.2021 18:28:47
18,000
74bea0e108b12c83874c7fadae3ccfcc772358cc
set the Amazon Checkout Session ID based on the correct url param, it would set it to any url param in some cases before
[ { "change_type": "MODIFY", "old_path": "view/frontend/web/js/model/storage.js", "new_path": "view/frontend/web/js/model/storage.js", "diff": "@@ -60,14 +60,15 @@ define([\n*/\ngetCheckoutSessionId: function () {\nvar sessionId = getStorage().get('id');\n- var param = '?amazonCheckoutSessionId=';\n- if (typeof sessionId === 'undefined' && window.location.search.indexOf(param) != -1) {\n- sessionId = window.location.search.replace(param, '');\n+ var param = 'amazonCheckoutSessionId';\n+\n+ var myParams = new URLSearchParams(window.location.search);\n+ if (myParams.has(param)) {\n+ var paramSessionId = myParams.get(param);\n+ if (typeof sessionId === 'undefined' || paramSessionId != sessionId) {\n+ sessionId = paramSessionId;\ngetStorage().set('id', sessionId);\n}\n- else if(sessionId != window.location.search.replace(param, '') && window.location.search.replace(param, '') != '') {\n- sessionId = window.location.search.replace(param, '');\n- getStorage().set('id', sessionId);\n}\nreturn sessionId;\n},\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-671 - set the Amazon Checkout Session ID based on the correct url param, it would set it to any url param in some cases before
21,255
08.04.2021 17:53:07
14,400
b5f17405d21734a2fdd243d1ed8b2f9537ca063a
Alexa Model - use Phrases to construct Exceptions
[ { "change_type": "MODIFY", "old_path": "Model/Alexa.php", "new_path": "Model/Alexa.php", "diff": "@@ -18,6 +18,7 @@ namespace Amazon\\Pay\\Model;\nuse Amazon\\Pay\\Client\\ClientFactoryInterface;\nuse Magento\\Framework\\Module\\Dir;\n+use Magento\\Framework\\Phrase;\nuse Magento\\Sales\\Model\\Order\\Payment;\nuse Magento\\Store\\Model\\ScopeInterface;\n@@ -94,7 +95,7 @@ class Alexa\n$errorMessage = __('API error:') . ' (' . $status . ') ';\n$errorMessage .= !empty($response['reasonCode']) ? $response['reasonCode'] . ': ' : '';\n$errorMessage .= !empty($response['message']) ? $response['message'] : '';\n- throw new \\Magento\\Framework\\Exception\\StateException($errorMessage);\n+ throw new \\Magento\\Framework\\Exception\\StateException(new Phrase($errorMessage));\n}\nreturn $response;\n}\n@@ -115,7 +116,9 @@ class Alexa\n}\n$transaction = $this->transactionRepository->getByTransactionType($transationType, $payment->getId());\nif (!$transaction) {\n- throw new \\Magento\\Framework\\Exception\\NotFoundException('Failed to lookup order transaction');\n+ throw new \\Magento\\Framework\\Exception\\NotFoundException(\n+ new Phrase('Failed to lookup order transaction')\n+ );\n}\n$response = $this->apiCall($order->getStoreId(), 'getCharge', [$transaction->getTxnId()]);\nreturn $response['chargePermissionId'];\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Alexa Model - use Phrases to construct Exceptions
21,241
16.04.2021 11:47:15
18,000
61ccf64d04078d949fee98b9bf3f3283d3ef4db5
add sort order config option
[ { "change_type": "MODIFY", "old_path": "etc/adminhtml/system.xml", "new_path": "etc/adminhtml/system.xml", "diff": "<source_model>Amazon\\Pay\\Model\\Config\\Source\\AuthorizationMode</source_model>\n<config_path>payment/amazon_payment/authorization_mode</config_path>\n</field>\n+ <field id=\"sort_order\" translate=\"label comment\" type=\"text\" sortOrder=\"90\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n+ <label>Sort Order</label>\n+ <frontend_class>validate-number</frontend_class>\n+ <config_path>payment/amazon_payment_v2/sort_order</config_path>\n+ </field>\n</group>\n<group id=\"alexa\" translate=\"label\" type=\"text\" sortOrder=\"25\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>Alexa Delivery Notifications</label>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-464 - add sort order config option
21,241
19.04.2021 10:56:00
18,000
169a8843f4183e90bad668ee24ab94817dda76f3
update location of sort order config option
[ { "change_type": "MODIFY", "old_path": "etc/adminhtml/system.xml", "new_path": "etc/adminhtml/system.xml", "diff": "<source_model>Amazon\\Pay\\Model\\Config\\Source\\AuthorizationMode</source_model>\n<config_path>payment/amazon_payment/authorization_mode</config_path>\n</field>\n- <field id=\"sort_order\" translate=\"label comment\" type=\"text\" sortOrder=\"90\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n- <label>Sort Order</label>\n- <frontend_class>validate-number</frontend_class>\n- <config_path>payment/amazon_payment_v2/sort_order</config_path>\n- </field>\n</group>\n<group id=\"alexa\" translate=\"label\" type=\"text\" sortOrder=\"25\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>Alexa Delivery Notifications</label>\n<source_model>Magento\\Config\\Model\\Config\\Source\\Yesno</source_model>\n<config_path>payment/amazonlogin/active</config_path>\n</field>\n+ <field id=\"sort_order\" translate=\"label comment\" type=\"text\" sortOrder=\"90\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n+ <label>Sort Order</label>\n+ <frontend_class>validate-number</frontend_class>\n+ <config_path>payment/amazon_payment_v2/sort_order</config_path>\n+ </field>\n</group>\n<group id=\"sales_options\" translate=\"label\" type=\"text\" sortOrder=\"20\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>Sales Options</label>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-464 - update location of sort order config option
21,241
19.04.2021 11:43:32
18,000
9c09f4c8564f87b41b3fdc3e5d19c2fe17b00b1b
re-add the dependency on "Show Amazon Pay in payment methods" field for the sort order config to show up
[ { "change_type": "MODIFY", "old_path": "etc/adminhtml/system.xml", "new_path": "etc/adminhtml/system.xml", "diff": "<label>Sort Order</label>\n<frontend_class>validate-number</frontend_class>\n<config_path>payment/amazon_payment_v2/sort_order</config_path>\n+ <depends>\n+ <field id=\"amazonloggin\">1</field>\n+ </depends>\n</field>\n</group>\n<group id=\"sales_options\" translate=\"label\" type=\"text\" sortOrder=\"20\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-464 - re-add the dependency on "Show Amazon Pay in payment methods" field for the sort order config to show up
21,241
26.04.2021 20:39:57
18,000
731060bd5c73cc09f9385b1557fad4ecb3bc534a
change how core javascript is extended/overridden
[ { "change_type": "MODIFY", "old_path": "etc/frontend/di.xml", "new_path": "etc/frontend/di.xml", "diff": "</argument>\n</arguments>\n</type>\n- <type name=\"Magento\\Checkout\\Block\\Checkout\\LayoutProcessor\">\n- <plugin name=\"amazon_pay_checkout_processor\" type=\"Amazon\\Pay\\Plugin\\CheckoutProcessor\" />\n- </type>\n</config>\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/requirejs-config.js", "new_path": "view/frontend/requirejs-config.js", "diff": "@@ -21,6 +21,21 @@ var config = {\n'Magento_Tax/js/view/checkout/summary/grand-total': {\n'Amazon_Pay/js/view/checkout/summary/grand-total-mixin': true,\n'Amazon_Payment/js/view/checkout/summary/grand-total-mixin': false\n+ },\n+ 'Magento_Checkout/js/view/form/element/email': {\n+ 'Amazon_Pay/js/view/form/element/email': true\n+ },\n+ 'Magento_Checkout/js/view/shipping-address/list': {\n+ 'Amazon_Pay/js/view/shipping-address/list': true\n+ },\n+ 'Magento_Checkout/js/view/shipping-address/address-renderer/default': {\n+ 'Amazon_Pay/js/view/shipping-address/address-renderer/default': true\n+ },\n+ 'Magento_Checkout/js/view/billing-address': {\n+ 'Amazon_Pay/js/view/billing-address': true\n+ },\n+ 'Magento_Checkout/js/view/shipping': {\n+ 'Amazon_Pay/js/view/shipping': true\n}\n}\n},\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/js/view/billing-address.js", "new_path": "view/frontend/web/js/view/billing-address.js", "diff": "define([\n'jquery',\n- 'Magento_Checkout/js/view/billing-address',\n'Amazon_Pay/js/action/toggle-form-fields',\n'Amazon_Pay/js/model/storage',\n'Amazon_Pay/js/model/billing-address/form-address-state'\n-], function ($, Component, toggleFormFields, amazonStorage, billingFormAddressState) {\n+], function ($, toggleFormFields, amazonStorage, billingFormAddressState) {\n'use strict';\n+ return function(Component) {\nif (!amazonStorage.isAmazonCheckout()) {\n// DO NOT EXTEND SHARED BILLING ADDRESS FORM IF AMAZON CHECKOUT IS NOT INITIATED\nreturn Component;\n@@ -76,4 +76,5 @@ define([\nreturn this.isAddressEditable ? this._super() : false;\n}\n});\n+ }\n});\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/js/view/form/element/email.js", "new_path": "view/frontend/web/js/view/form/element/email.js", "diff": "define([\n'jquery',\n- 'Magento_Checkout/js/view/form/element/email',\n'Magento_Customer/js/customer-data',\n'Magento_Checkout/js/model/quote',\n'Magento_Checkout/js/checkout-data',\n+ 'Amazon_Pay/js/model/storage',\n'mage/validation'\n-], function ($, Component, customerData, quote, checkoutData) {\n+], function ($, customerData, quote, checkoutData, amazonStorage) {\n'use strict';\n+ return function(Component) {\n+ if (!amazonStorage.isEnabled) {\n+ return Component;\n+ }\n+\nreturn Component.extend({\ndefaults: {\nemail: checkoutData.getInputFieldEmailValue(),\n@@ -32,4 +37,5 @@ define([\nreturn this;\n}\n});\n+ }\n});\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/js/view/shipping-address/address-renderer/default.js", "new_path": "view/frontend/web/js/view/shipping-address/address-renderer/default.js", "diff": "define([\n'jquery',\n- 'Magento_Checkout/js/view/shipping-address/address-renderer/default',\n'uiRegistry',\n'Amazon_Pay/js/action/toggle-form-fields',\n'Amazon_Pay/js/model/storage',\n'Amazon_Pay/js/amazon-checkout'\n-], function ($, Component, registry, toggleFormFields, amazonStorage, amazonCheckout) {\n+], function ($, registry, toggleFormFields, amazonStorage, amazonCheckout) {\n'use strict';\n- var self;\n- var editSelector = '.edit-address-link';\n-\n+ return function(Component) {\nif (!amazonStorage.isAmazonCheckout()) {\nreturn Component;\n}\n+ var self;\n+ var editSelector = '.edit-address-link';\n+\nreturn Component.extend({\ndefaults: {\ntemplate: {\n@@ -56,6 +56,8 @@ define([\n/**\n* Edit address (using amazon.Pay.bindChangeAction).\n*/\n- editAddress: function () { }\n+ editAddress: function () {\n+ }\n});\n+ }\n});\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/js/view/shipping-address/list.js", "new_path": "view/frontend/web/js/view/shipping-address/list.js", "diff": "define([\n- 'Magento_Checkout/js/view/shipping-address/list',\n'Magento_Customer/js/model/address-list',\n- 'Amazon_Pay/js/model/storage',\n- 'ko'\n-], function (Component, addressList, amazonStorage, ko) {\n+ 'Amazon_Pay/js/model/storage'\n+], function (addressList, amazonStorage) {\n'use strict';\n- if (!amazonStorage.isAmazonCheckout()) {\n+ return function(Component) {\n+ if (!amazonStorage.isEnabled || !amazonStorage.isAmazonCheckout()) {\nreturn Component;\n}\n@@ -20,15 +19,12 @@ define([\nreturn this;\n},\n- /**\n- * @param {Object} address\n- * @param {*} index\n- */\ncreateRendererComponent: function (address, index) {\nif (address.getType() === 'new-customer-address') {\n// Only display one address from Amazon\n- this._super();\n+ return this._super();\n}\n}\n});\n+ }\n});\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/js/view/shipping.js", "new_path": "view/frontend/web/js/view/shipping.js", "diff": "define(\n[\n'jquery',\n- 'Magento_Checkout/js/view/shipping',\n'Amazon_Pay/js/model/storage'\n],\nfunction (\n$,\n- Component,\namazonStorage\n) {\n'use strict';\n+ return function(Component) {\n+ if (!amazonStorage.isAmazonCheckout()) {\n+ return Component;\n+ }\n+\nreturn Component.extend({\n/**\n@@ -19,9 +22,7 @@ define(\n*/\ninitialize: function () {\nthis._super();\n- if (amazonStorage.isAmazonCheckout()) {\nthis.isNewAddressAdded(true);\n- }\nreturn this;\n},\n@@ -37,4 +38,5 @@ define(\n}\n});\n}\n+ }\n);\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/template/form/element/email.html", "new_path": "view/frontend/web/template/form/element/email.html", "diff": "* permissions and limitations under the License.\n*/\n-->\n+\n<!-- ko foreach: getRegion('amazon-button-region') -->\n<!-- ko template: getTemplate() --><!-- /ko -->\n<!-- /ko -->\nmethod=\"post\">\n<fieldset id=\"customer-email-fieldset\" class=\"fieldset\" data-bind=\"blockLoader: isLoading\">\n<div class=\"field required\">\n- <label class=\"label\" for=\"customer-email\">\n- <span data-bind=\"i18n: 'Email Address'\"></span>\n- </label>\n+ <label class=\"label\" for=\"customer-email\"><span data-bind=\"i18n: 'Email Address'\"></span></label>\n<div class=\"control _with-tooltip\">\n<input class=\"input-text\"\ntype=\"email\"\ndata-bind=\"\ntextInput: email,\n- hasFocus: emailFocused\"\n+ hasFocus: emailFocused,\n+ afterRender: emailHasChanged,\n+ mageInit: {'mage/trim-input':{}}\"\nname=\"username\"\ndata-validate=\"{required:true, 'validate-email':true}\"\nid=\"customer-email\" />\n<!--Hidden fields -->\n<fieldset class=\"fieldset hidden-fields\" data-bind=\"fadeVisible: isPasswordVisible\">\n<div class=\"field\">\n- <label class=\"label\" for=\"customer-password\">\n- <span data-bind=\"i18n: 'Password'\"></span>\n- </label>\n+ <label class=\"label\" for=\"customer-password\"><span data-bind=\"i18n: 'Password'\"></span></label>\n<div class=\"control\">\n<input class=\"input-text\"\n- placeholder=\"Password\"\n+ data-bind=\"\n+ attr: {\n+ placeholder: $t('Password'),\n+ }\"\ntype=\"password\"\nname=\"password\"\nid=\"customer-password\"\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-672 - change how core javascript is extended/overridden
21,250
28.04.2021 11:20:23
10,800
dd9c3bd74ccd70c0810927919580f4438cc4e796
replace CartId with Session Id for shipping-address, billing-address and payment-descriptor
[ { "change_type": "MODIFY", "old_path": "Api/CheckoutSessionManagementInterface.php", "new_path": "Api/CheckoutSessionManagementInterface.php", "diff": "@@ -34,22 +34,22 @@ interface CheckoutSessionManagementInterface\npublic function storeCheckoutSession($cartId, $checkoutSessionId);\n/**\n- * @param mixed $cartId\n+ * @param mixed $amazonSessionId\n* @return mixed\n*/\n- public function getShippingAddress($cartId);\n+ public function getShippingAddress($amazonSessionId);\n/**\n- * @param mixed $cartId\n+ * @param mixed $amazonSessionId\n* @return mixed\n*/\n- public function getBillingAddress($cartId);\n+ public function getBillingAddress($amazonSessionId);\n/**\n- * @param mixed $cartId\n+ * @param mixed $amazonSessionId\n* @return string\n*/\n- public function getPaymentDescriptor($cartId);\n+ public function getPaymentDescriptor($amazonSessionId);\n/**\n* @param mixed $cartId\n" }, { "change_type": "MODIFY", "old_path": "Model/CheckoutSessionManagement.php", "new_path": "Model/CheckoutSessionManagement.php", "diff": "@@ -251,12 +251,11 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n}\n/**\n- * @param mixed $cartId\n+ * @param mixed $amazonCheckoutSessionId\n* @return mixed\n*/\n- protected function getAmazonSession($cartId)\n+ protected function getAmazonSession($amazonSessionId)\n{\n- $amazonSessionId = $this->getCheckoutSession($cartId);\nif (!isset($this->amazonSessions[$amazonSessionId])) {\n$this->amazonSessions[$amazonSessionId] = $this->amazonAdapter->getCheckoutSession(\n$this->storeManager->getStore()->getId(),\n@@ -281,16 +280,16 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n}\n/**\n- * @param mixed $cartId\n+ * @param mixed $amazonCheckoutSessionId\n* @param bool $isShippingAddress\n* @param mixed $addressDataExtractor\n* @return mixed\n*/\n- protected function fetchAddress($cartId, $isShippingAddress, $addressDataExtractor)\n+ protected function fetchAddress($amazonSessionId, $isShippingAddress, $addressDataExtractor)\n{\n$result = false;\n- if ($this->isAvailable($cartId)) {\n- $session = $this->getAmazonSession($cartId);\n+\n+ $session = $this->getAmazonSession($amazonSessionId);\n// phpcs:ignore Magento2.Functions.DiscouragedFunction\n$addressData = call_user_func($addressDataExtractor, $session);\n@@ -306,7 +305,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$result = $this->convertToMagentoAddress($address, $isShippingAddress);\n$result[0]['email'] = $session['buyer']['email'];\n}\n- }\n+\nreturn $result;\n}\n@@ -386,29 +385,43 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n/**\n* {@inheritdoc}\n*/\n- public function getShippingAddress($cartId)\n+ public function getShippingAddress($amazonSessionId)\n{\n- return $this->fetchAddress($cartId, true, function ($session) {\n+ $cartId = $this->magentoCheckoutSession->getQuote()->getId();\n+ $result = false;\n+\n+ if ($this->isAvailable($cartId)) {\n+ $result = $this->fetchAddress($amazonSessionId, true, function ($session) {\nreturn $session['shippingAddress'] ?? [];\n});\n}\n+ return $result;\n+ }\n+\n/**\n* {@inheritdoc}\n*/\n- public function getBillingAddress($cartId)\n+ public function getBillingAddress($amazonSessionId)\n{\n- return $this->fetchAddress($cartId, false, function ($session) {\n+ $cartId = $this->magentoCheckoutSession->getQuote()->getId();\n+ $result = false;\n+\n+ if ($this->isAvailable($cartId)) {\n+ $result = $this->fetchAddress($amazonSessionId, false, function ($session) {\nreturn $session['billingAddress'] ?? [];\n});\n}\n+ return $result;\n+ }\n+\n/**\n* {@inheritdoc}\n*/\n- public function getPaymentDescriptor($cartId)\n+ public function getPaymentDescriptor($amazonSessionId)\n{\n- $session = $this->getAmazonSession($cartId);\n+ $session = $this->getAmazonSession($amazonSessionId);\nreturn $session['paymentPreferences'][0]['paymentDescriptor'] ?? '';\n}\n" }, { "change_type": "MODIFY", "old_path": "etc/webapi.xml", "new_path": "etc/webapi.xml", "diff": "<resource ref=\"anonymous\" />\n</resources>\n</route>\n- <route url=\"/V1/amazon-checkout-session/:cartId/payment-descriptor\" method=\"GET\">\n+ <route url=\"/V1/amazon-checkout-session/:amazonSessionId/payment-descriptor\" method=\"GET\">\n<service class=\"Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\" method=\"getPaymentDescriptor\"/>\n<resources>\n<resource ref=\"anonymous\" />\n</resources>\n</route>\n- <route url=\"/V1/amazon-checkout-session/:cartId/billing-address\" method=\"GET\">\n+ <route url=\"/V1/amazon-checkout-session/:amazonSessionId/billing-address\" method=\"GET\">\n<service class=\"Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\" method=\"getBillingAddress\"/>\n<resources>\n<resource ref=\"anonymous\" />\n</resources>\n</route>\n- <route url=\"/V1/amazon-checkout-session/:cartId/shipping-address\" method=\"GET\">\n+ <route url=\"/V1/amazon-checkout-session/:amazonSessionId/shipping-address\" method=\"GET\">\n<service class=\"Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\" method=\"getShippingAddress\"/>\n<resources>\n<resource ref=\"anonymous\" />\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/js/action/checkout-session-address-load.js", "new_path": "view/frontend/web/js/action/checkout-session-address-load.js", "diff": "@@ -24,8 +24,8 @@ define([\n'use strict';\nreturn function (addressType, callback) {\n- var serviceUrl = urlBuilder.createUrl('/amazon-checkout-session/:cartId/' + addressType + '-address', {\n- cartId: quote.getQuoteId()\n+ var serviceUrl = urlBuilder.createUrl('/amazon-checkout-session/:amazonSessionId/' + addressType + '-address', {\n+ amazonSessionId: amazonStorage.getCheckoutSessionId()\n});\nfullScreenLoader.startLoader();\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/js/action/checkout-session-payment-descriptor-load.js", "new_path": "view/frontend/web/js/action/checkout-session-payment-descriptor-load.js", "diff": "@@ -18,13 +18,14 @@ define([\n'mage/storage',\n'Magento_Checkout/js/model/url-builder',\n'Magento_Checkout/js/model/full-screen-loader',\n- 'Magento_Checkout/js/model/error-processor'\n-], function (quote, storage, urlBuilder, fullScreenLoader, errorProcessor) {\n+ 'Magento_Checkout/js/model/error-processor',\n+ 'Amazon_Pay/js/model/storage'\n+], function (quote, storage, urlBuilder, fullScreenLoader, errorProcessor, amazonStorage) {\n'use strict';\nreturn function (callback) {\n- var serviceUrl = urlBuilder.createUrl('/amazon-checkout-session/:cartId/payment-descriptor', {\n- cartId: quote.getQuoteId()\n+ var serviceUrl = urlBuilder.createUrl('/amazon-checkout-session/:amazonSessionId/payment-descriptor', {\n+ amazonSessionId: amazonStorage.getCheckoutSessionId()\n});\nfullScreenLoader.startLoader();\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-687: replace CartId with Session Id for shipping-address, billing-address and payment-descriptor
21,241
30.04.2021 10:55:57
18,000
9b507330dbf218c415d87ade776bf857c482a0b2
inject serializer instead of using statically
[ { "change_type": "MODIFY", "old_path": "Model/Alexa.php", "new_path": "Model/Alexa.php", "diff": "@@ -19,6 +19,7 @@ namespace Amazon\\Pay\\Model;\nuse Amazon\\Pay\\Client\\ClientFactoryInterface;\nuse Magento\\Framework\\Module\\Dir;\nuse Magento\\Framework\\Phrase;\n+use Magento\\Framework\\Serialize\\SerializerInterface;\nuse Magento\\Sales\\Model\\Order\\Payment;\nuse Magento\\Store\\Model\\ScopeInterface;\n@@ -54,6 +55,11 @@ class Alexa\n*/\nprivate $cache;\n+ /**\n+ * @var SerializerInterface\n+ */\n+ private $serializer;\n+\n/**\n* @param AmazonConfig $amazonConfig\n* @param ClientFactoryInterface $clientFactory\n@@ -67,7 +73,8 @@ class Alexa\nPayment\\Transaction\\Repository $transactionRepository,\nDir $moduleDir,\n\\Magento\\Framework\\File\\Csv $csv,\n- \\Magento\\Framework\\Config\\CacheInterface $cache\n+ \\Magento\\Framework\\Config\\CacheInterface $cache,\n+ SerializerInterface $serializer\n) {\n$this->amazonConfig = $amazonConfig;\n$this->clientFactory = $clientFactory;\n@@ -75,6 +82,7 @@ class Alexa\n$this->moduleDir = $moduleDir;\n$this->csv = $csv;\n$this->cache = $cache;\n+ $this->serializer = $serializer;\n}\n/**\n@@ -151,13 +159,13 @@ class Alexa\n$result = $this->cache->load($cacheKey);\nif ($result) {\n// phpcs:ignore Magento2.Functions.DiscouragedFunction\n- $result = \\Magento\\Framework\\Serialize\\SerializerInterface::unserialize(gzuncompress($result));\n+ $result = $this->serializer->unserialize(gzuncompress($result));\n}\nif (!$result) {\n$result = $this->fetchDeliveryCarriers();\n$this->cache->save(\n// phpcs:ignore Magento2.Functions.DiscouragedFunction\n- gzcompress(\\Magento\\Framework\\Serialize\\SerializerInterface::serialize($result)),\n+ gzcompress($this->serializer->serialize($result)),\n$cacheKey\n);\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-695 - inject serializer instead of using statically
21,241
03.05.2021 12:37:37
18,000
4cccb5303f1811ab5d8059badf88f5791f367b90
Bump version, add changelog notes
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "# Change Log\n+## 5.3.0\n+* Added sort order to payment method config\n+* Changed the REST requests to pass in the Amazon Checkout Session ID instead of the cart ID\n+* Fixed bug where multiple url parameters would cause reloading in checkout\n+* Fixed bug with the way serializer was called in Alexa notification processing\n+* Fixed incorrect exception messaging in Alexa notification\n+* Removed quote to Amazon Session mapping table\n+* Updated how javascript customizations are implemented\n+\n## 5.2.0\n* Added Sign in with Amazon to the authentication modal\n* Fixed bug where pressing enter on a text input config field would open the file selector for Amazon Private Key\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -48,7 +48,7 @@ The following table provides an overview on which Git branch is compatible to wh\nMagento Version | Github Branch | Latest release\n---|---|---\n2.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)\n-2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.2.0\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.3.0\n## Release Notes\nSee [CHANGELOG.md](/CHANGELOG.md)\n" }, { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"name\": \"amzn/amazon-pay-magento-2-module\",\n\"description\": \"Official Magento2 Plugin to integrate with Amazon Pay\",\n\"type\": \"magento2-module\",\n- \"version\": \"5.2.0\",\n+ \"version\": \"5.3.0\",\n\"license\": [\n\"Apache-2.0\"\n],\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Bump version, add changelog notes
21,241
04.05.2021 00:21:04
18,000
c4c6e12e1d5c901dc3400c893c95358b55e8f943
remove "-capture" from the transaction ID prior to using in Alexa update
[ { "change_type": "MODIFY", "old_path": "Model/Alexa.php", "new_path": "Model/Alexa.php", "diff": "@@ -128,7 +128,8 @@ class Alexa\nnew Phrase('Failed to lookup order transaction')\n);\n}\n- $response = $this->apiCall($order->getStoreId(), 'getCharge', [$transaction->getTxnId()]);\n+ $txnId = str_replace('-capture', '', $transaction->getTxnId());\n+ $response = $this->apiCall($order->getStoreId(), 'getCharge', [$txnId]);\nreturn $response['chargePermissionId'];\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-676 - remove "-capture" from the transaction ID prior to using in Alexa update
21,241
12.05.2021 10:58:16
18,000
4d2871f3dfbcfe4fb0ccff13d15f58c0316948ba
don't try to create Alexa notifications for unknown carriers
[ { "change_type": "MODIFY", "old_path": "Model/Alexa.php", "new_path": "Model/Alexa.php", "diff": "@@ -222,6 +222,13 @@ class Alexa\nif ($this->canAddDeliveryNotification($track)) {\n$chargePermissionId = $this->getChargePermissionId($track->getShipment()->getOrder());\n$carrierCode = $this->getCarrierCode($track);\n+\n+ if ($carrierCode == \"CUSTOM\") {\n+ throw new \\Magento\\Framework\\Exception\\NotFoundException(\n+ new Phrase('No matched Alexa Notification carrier for: ' . $track->getTitle())\n+ );\n+ }\n+\n$response = $this->apiCall($track->getStoreId(), 'deliveryTrackers', [json_encode([\n'amazonOrderReferenceId' => $chargePermissionId,\n'deliveryDetails' => [[\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-676 - don't try to create Alexa notifications for unknown carriers
21,250
12.05.2021 16:02:07
10,800
812e26193f96161d170ef95ea862c4303439615d
Change buyerId empty validation
[ { "change_type": "MODIFY", "old_path": "Controller/Login.php", "new_path": "Controller/Login.php", "diff": "@@ -178,7 +178,7 @@ abstract class Login extends Action\n$userInfo = $this->amazonAdapter\n->getBuyer($token);\n- if (is_array($userInfo) && isset($userInfo['buyerId'])) {\n+ if (is_array($userInfo) && !empty($userInfo['buyerId'])) {\n$data = [\n'id' => $userInfo['buyerId'],\n'email' => $userInfo['email'],\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-701: Change buyerId empty validation
21,250
13.05.2021 11:06:55
10,800
f8ad33391f78c5679c9373a4e40a1d4f6a4ef2e5
Log error when buyerid is empty
[ { "change_type": "MODIFY", "old_path": "Controller/Login.php", "new_path": "Controller/Login.php", "diff": "@@ -188,7 +188,11 @@ abstract class Login extends Action\n$amazonCustomer = $this->amazonCustomerFactory->create($data);\nreturn $amazonCustomer;\n+\n+ }else{\n+ $this->logger->error('Amazon buyerId is empty. Token: ' . $token);\n}\n+\n} catch (\\Exception $e) {\n$this->logger->error($e);\n$this->messageManager->addErrorMessage(__('Error processing Amazon Login'));\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-701: Log error when buyerid is empty
21,241
14.05.2021 10:18:41
18,000
1748d3f4f87ff796ef97ba2d94aecb303d863dce
update credentials validation to properly observe the inherit flag and validate using parent scope's value. Inspiration for parent scope tree from ericthehacker/magento2-configscopehints
[ { "change_type": "MODIFY", "old_path": "Model/AmazonConfig.php", "new_path": "Model/AmazonConfig.php", "diff": "@@ -393,7 +393,6 @@ class AmazonConfig\n*\n* @param string $scope\n* @param null $scopeCode\n- * @param null $store\n*\n* @return string\n*/\n@@ -406,12 +405,28 @@ class AmazonConfig\n);\n}\n+ /**\n+ * Return Private Key Selected method (text or pem)\n+ *\n+ * @param string $scope\n+ * @param null $scopeCode\n+ *\n+ * @return string\n+ */\n+ public function getPrivateKeySelected($scope = ScopeInterface::SCOPE_STORE, $scopeCode = null)\n+ {\n+ return $this->scopeConfig->getValue(\n+ 'payment/amazon_payment_v2/private_key_selected',\n+ $scope,\n+ $scopeCode\n+ );\n+ }\n+\n/**\n* Return Public Key\n*\n* @param string $scope\n* @param null $scopeCode\n- * @param null $store\n*\n* @return string\n*/\n@@ -429,7 +444,6 @@ class AmazonConfig\n*\n* @param string $scope\n* @param null $scopeCode\n- * @param null $store\n*\n* @return string\n*/\n" }, { "change_type": "MODIFY", "old_path": "Plugin/ConfigCredentialsValidator.php", "new_path": "Plugin/ConfigCredentialsValidator.php", "diff": "namespace Amazon\\Pay\\Plugin;\nuse Magento\\Config\\Model\\Config;\n+use Magento\\Framework\\App\\Config\\ScopeConfigInterface;\nuse Magento\\Framework\\Exception\\ValidatorException;\nuse Magento\\Framework\\Phrase;\nuse Magento\\Store\\Model\\ScopeInterface;\nclass ConfigCredentialsValidator\n{\n- const XML_PATH_API_VERSION = 'groups/amazon_pay/fields/api_version/value';\nconst XML_PATH_ACTIVE = 'groups/amazon_pay/groups/credentials/fields/active_v2/value';\nconst XML_PATH_ACTIVE_INHERIT = 'groups/amazon_pay/groups/credentials/fields/active_v2/inherit';\nconst XML_PATH_PRIVATE_KEY_PEM = 'groups/amazon_pay/groups/credentials/fields/private_key_pem/value';\nconst XML_PATH_PRIVATE_KEY_TEXT = 'groups/amazon_pay/groups/credentials/fields/private_key_text/value';\nconst XML_PATH_PRIVATE_KEY_SELECTED = 'groups/amazon_pay/groups/credentials/fields/private_key_selected/value';\n+ const XML_PATH_PRIVATE_KEY_SELECTOR = 'groups/amazon_pay/groups/credentials/fields/private_key_selector/value';\nconst XML_PATH_PUBLIC_KEY_ID = 'groups/amazon_pay/groups/credentials/fields/public_key_id/value';\nconst XML_PATH_STORE_ID = 'groups/amazon_pay/groups/credentials/fields/store_id/value';\nconst XML_PATH_PAYMENT_REGION = 'groups/amazon_pay/groups/credentials/fields/payment_region/value';\nconst XML_PATH_SANDBOX = 'groups/amazon_pay/groups/credentials/fields/sandbox/value';\n+ const STORE_VIEW_SCOPE_CODE = 'stores';\n+ const WEBSITE_SCOPE_CODE = 'websites';\n+ const DEFAULT_SCOPE_CODE = 'default';\n+\n/**\n* @var \\Amazon\\Pay\\Model\\AmazonConfig\n*/\n@@ -48,14 +53,25 @@ class ConfigCredentialsValidator\n*/\nprotected $messageManager;\n+ /** @var \\Magento\\Store\\Model\\StoreManagerInterface */\n+ protected $storeManager;\n+\n+ protected $scopeTree;\n+ protected $parentScope;\n+ protected $parentScopeCode;\n+\npublic function __construct(\n\\Amazon\\Pay\\Model\\AmazonConfig $amazonConfig,\n\\Amazon\\Pay\\Client\\ClientFactoryInterface $clientFactory,\n- \\Magento\\Framework\\Message\\ManagerInterface $messageManager\n+ \\Magento\\Framework\\Message\\ManagerInterface $messageManager,\n+ \\Magento\\Store\\Model\\StoreManagerInterface $storeManager\n) {\n$this->amazonConfig = $amazonConfig;\n$this->clientFactory = $clientFactory;\n+ $this->storeManager = $storeManager;\n$this->messageManager = $messageManager;\n+\n+ $this->scopeTree = $this->getScopeTree();\n}\n/**\n@@ -108,6 +124,75 @@ class ConfigCredentialsValidator\nreturn $newValue !== $oldValue;\n}\n+ /**\n+ * Gets store tree so we can traverse the hierarchy\n+ *\n+ * @return array\n+ */\n+ protected function getScopeTree()\n+ {\n+ $tree = [self::WEBSITE_SCOPE_CODE => []];\n+\n+ $websites = $this->storeManager->getWebsites();\n+\n+ /* @var $website \\Magento\\Store\\Model\\Website */\n+ foreach ($websites as $website) {\n+ $tree[self::WEBSITE_SCOPE_CODE][$website->getId()] = [self::STORE_VIEW_SCOPE_CODE => []];\n+\n+ /* @var $store \\Magento\\Store\\Model\\Store */\n+ foreach ($website->getStores() as $store) {\n+ $tree[self::WEBSITE_SCOPE_CODE][$website->getId()][self::STORE_VIEW_SCOPE_CODE][] = $store->getId();\n+ }\n+ }\n+\n+ return $tree;\n+ }\n+\n+ /**\n+ * @param $storeId\n+ * @return int|string\n+ */\n+ protected function findParentScopeCode($storeId)\n+ {\n+ foreach ($this->scopeTree[self::WEBSITE_SCOPE_CODE] as $websiteId => $website) {\n+ foreach ($website[self::STORE_VIEW_SCOPE_CODE] as $store) {\n+ if ($store == $storeId) {\n+ return $websiteId;\n+ }\n+ }\n+ }\n+ }\n+\n+ /**\n+ * @param $scope\n+ * @return string\n+ */\n+ private function getParentScope($scope)\n+ {\n+ if (!isset($this->parentScope)) {\n+ if ($scope == self::STORE_VIEW_SCOPE_CODE) {\n+ $this->parentScope = self::WEBSITE_SCOPE_CODE;\n+ } else {\n+ $this->parentScope = self::DEFAULT_SCOPE_CODE;\n+ }\n+ }\n+\n+ return $this->parentScope;\n+ }\n+\n+ /**\n+ * @param $storeId int Numeric store id\n+ * @return int|string\n+ */\n+ private function getParentScopeCode($storeId)\n+ {\n+ if (!isset($this->parentScopeCode)) {\n+ $this->parentScopeCode = $this->findParentScopeCode($storeId);\n+ }\n+\n+ return $this->parentScopeCode;\n+ }\n+\n/**\n* @param Config $subject\n* @return array\n@@ -116,9 +201,83 @@ class ConfigCredentialsValidator\n{\n$scope = $subject->getScope() ?: ScopeInterface::SCOPE_STORE;\n$scopeCode = $subject->getScopeCode();\n+ $parentScope = $this->getParentScope($scope);\n+ $parentScopeCode = $this->getParentScopeCode($subject->getStore());\n+\n+ $privateKey = $this->readPrivateKey($subject);\n+\n+ $publicKeyId = $subject->getData(self::XML_PATH_PUBLIC_KEY_ID);\n+ if ($publicKeyId && $publicKeyId === $this->amazonConfig->getPublicKeyId($scope, $scopeCode)) {\n+ $publicKeyId = null;\n+ } elseif ($subject->getData(str_replace('value', 'inherit', self::XML_PATH_PUBLIC_KEY_ID))) {\n+ $publicKeyId = $this->amazonConfig->getPublicKeyId($parentScope, $parentScopeCode);\n+ }\n+\n+ $paymentRegion = $subject->getData(self::XML_PATH_PAYMENT_REGION);\n+ if ($paymentRegion && $paymentRegion === $this->amazonConfig->getPaymentRegion($scope, $scopeCode)) {\n+ $paymentRegion = null;\n+ } elseif ($subject->getData(str_replace('value', 'inherit', self::XML_PATH_PAYMENT_REGION))) {\n+ $paymentRegion = $this->amazonConfig->getPaymentRegion($parentScope, $parentScopeCode);\n+ }\n+\n+ $sandbox = $subject->getData(self::XML_PATH_SANDBOX);\n+ if ($sandbox !== null) {\n+ $sandbox = boolval($sandbox) !== $this->amazonConfig->isSandboxEnabled($scope, $scopeCode) ?\n+ boolval($sandbox) : null;\n+ } elseif ($subject->getData(str_replace('value', 'inherit', self::XML_PATH_SANDBOX))) {\n+ $sandbox = $this->amazonConfig->isSandboxEnabled($parentScope, $parentScopeCode);\n+ }\n+\n+ return array_filter([\n+ 'private_key' => $privateKey,\n+ 'public_key_id' => $publicKeyId,\n+ 'region' => $paymentRegion,\n+ 'sandbox' => $sandbox,\n+ ]);\n+ }\n+\n+ /**\n+ * @param Config $subject\n+ * @param string $path\n+ */\n+ private function isInherited($subject, $path)\n+ {\n+ return $subject->getData(str_replace('value', 'inherit', $path));\n+ }\n+\n+ /**\n+ * @param Config $subject\n+ */\n+ private function readPrivateKey($subject)\n+ {\n+ $scope = $subject->getScope() ?: ScopeInterface::SCOPE_STORES;\n+ $scopeCode = $subject->getScopeCode();\n$privateKey = '';\n$privateKeyArray['name'] = '';\n+\n+ // check for inherited value\n+ $keyMethod = $subject->getData(self::XML_PATH_PRIVATE_KEY_SELECTED);\n+ if ($this->isInherited($subject, self::XML_PATH_PRIVATE_KEY_SELECTED)) {\n+ $keyMethod = $this->amazonConfig->getPrivateKeySelected(\n+ $this->getParentScope($scope),\n+ $this->getParentScopeCode($subject->getStore())\n+ );\n+ }\n+\n+ if (!in_array($keyMethod, ['text', 'pem'])) {\n+ $keyMethod = 'text';\n+ }\n+\n+ if (($keyMethod == 'pem' && $this->isInherited($subject, self::XML_PATH_PRIVATE_KEY_PEM)) ||\n+ ($keyMethod == 'text' && $this->isInherited($subject, self::XML_PATH_PRIVATE_KEY_TEXT))\n+ ) {\n+ return $this->amazonConfig->getPrivateKey(\n+ $this->getParentScope($scope),\n+ $this->getParentScopeCode($subject->getStore())\n+ );\n+ }\n+\n// check for pem file presence first\nif ($subject->getData(self::XML_PATH_PRIVATE_KEY_PEM)) {\n$privateKeyArray = $subject->getData(self::XML_PATH_PRIVATE_KEY_PEM);\n@@ -139,7 +298,6 @@ class ConfigCredentialsValidator\n$privateKey = $subject->getData(self::XML_PATH_PRIVATE_KEY_TEXT);\n}\n}\n-\nif ($privateKey && (\npreg_match('/^\\*+$/', $privateKey) ||\n$privateKey === $this->amazonConfig->getPrivateKey($scope, $scopeCode))\n@@ -148,26 +306,8 @@ class ConfigCredentialsValidator\n} elseif ($privateKey == '') {\nthrow new ValidatorException(new Phrase('Please provide a Private Key'));\n}\n- $publicKeyId = $subject->getData(self::XML_PATH_PUBLIC_KEY_ID);\n- if ($publicKeyId && $publicKeyId === $this->amazonConfig->getPublicKeyId($scope, $scopeCode)) {\n- $publicKeyId = null;\n- }\n- $paymentRegion = $subject->getData(self::XML_PATH_PAYMENT_REGION);\n- if ($paymentRegion && $paymentRegion === $this->amazonConfig->getPaymentRegion($scope, $scopeCode)) {\n- $paymentRegion = null;\n- }\n- $sandbox = $subject->getData(self::XML_PATH_SANDBOX);\n- if ($sandbox !== null) {\n- $sandbox = boolval($sandbox) !== $this->amazonConfig->isSandboxEnabled($scope, $scopeCode) ?\n- boolval($sandbox) : null;\n- }\n- return array_filter([\n- 'private_key' => $privateKey,\n- 'public_key_id' => $publicKeyId,\n- 'region' => $paymentRegion,\n- 'sandbox' => $sandbox,\n- ]);\n+ return $privateKey;\n}\n/**\n@@ -180,11 +320,19 @@ class ConfigCredentialsValidator\n{\n$scope = $subject->getScope() ?: ScopeInterface::SCOPE_STORE;\n$scopeCode = $subject->getScopeCode();\n+ $storeId = $subject->getStore();\n+ if ($subject->getData(str_replace('value', 'inherit', self::XML_PATH_STORE_ID))) {\n+ $storeId = $this->amazonConfig->getClientId(\n+ $this->getParentScope($scope),\n+ $this->getParentScopeCode($storeId)\n+ );\n+ } else {\n$storeId = $subject->getData(self::XML_PATH_STORE_ID);\nif ($storeId === null) {\n$storeId = $this->amazonConfig->getClientId($scope, $scopeCode);\n}\n+ }\n$client = $this->clientFactory->create($scopeCode, $scope, $config);\n$response = $client->createCheckoutSession([\n@@ -230,7 +378,6 @@ class ConfigCredentialsValidator\n$target = $value;\n}\n$subject->setData($data);\n- return $this;\n}\n/**\n@@ -250,9 +397,6 @@ class ConfigCredentialsValidator\n} catch (\\Exception $e) {\n$this->setDataByPath($subject, self::XML_PATH_ACTIVE_INHERIT, false);\n$this->setDataByPath($subject, self::XML_PATH_ACTIVE, false);\n- $this->setDataByPath($subject, self::XML_PATH_PRIVATE_KEY_PEM, false);\n- $this->setDataByPath($subject, self::XML_PATH_PRIVATE_KEY_TEXT, false);\n- $this->setDataByPath($subject, self::XML_PATH_PRIVATE_KEY_SELECTED, false);\n$this->messageManager->addErrorMessage(__('Failed to enable Amazon Pay: %1', $e->getMessage()));\n}\nreturn null;\n" }, { "change_type": "MODIFY", "old_path": "view/adminhtml/web/js/credentials.js", "new_path": "view/adminhtml/web/js/credentials.js", "diff": "@@ -39,8 +39,9 @@ require(['jquery', 'domReady!'], function ($) {\n// hide text row\n$('#row_payment_us_amazon_pay_credentials_private_key_text').hide();\n$('#payment_us_amazon_pay_credentials_private_key_text').val('------');\n- // hide selector row\n+ // hide selector row & make non-inherited\n$('#row_payment_us_amazon_pay_credentials_private_key_selector').hide();\n+ $('#row_payment_us_amazon_pay_credentials_private_key_selector_inherit').prop('checked', true).click()\n// remove saved file feedback text\n$('#amazon_pay_private_key_pem_file_saved_msg').html('');\n// show pem row\n@@ -59,8 +60,9 @@ require(['jquery', 'domReady!'], function ($) {\n$('#payment_us_amazon_pay_credentials_private_key_selected_inherit').prop('checked', true).click();\n// hide file row\n$('#row_payment_us_amazon_pay_credentials_private_key_pem').hide();\n- // hide selector row\n+ // hide selector row & make non-inherited\n$('#row_payment_us_amazon_pay_credentials_private_key_selector').hide();\n+ $('#row_payment_us_amazon_pay_credentials_private_key_selector_inherit').prop('checked', true).click()\n// show text area row\n$('#row_payment_us_amazon_pay_credentials_private_key_text').show();\n// focus on field\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-699 - update credentials validation to properly observe the inherit flag and validate using parent scope's value. Inspiration for parent scope tree from ericthehacker/magento2-configscopehints
21,241
18.05.2021 11:46:45
18,000
ea5fb505674ee67b3a851641fc7d051a4143fd3c
Version bump to 5.4.0, add release notes to changelog
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "# Change Log\n+## 5.4.0\n+* Fixed credential validation when inheriting from parent scope\n+* Fixed issue to properly handle when Amazon Pay returns empty buyer ID\n+* Fixed issue with using Alexa notifications and custom carriers\n+\n## 5.3.0\n* Added sort order to payment method config\n* Changed the REST requests to pass in the Amazon Checkout Session ID instead of the cart ID\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -48,7 +48,7 @@ The following table provides an overview on which Git branch is compatible to wh\nMagento Version | Github Branch | Latest release\n---|---|---\n2.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)\n-2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.3.0\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.4.0\n## Release Notes\nSee [CHANGELOG.md](/CHANGELOG.md)\n" }, { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"name\": \"amzn/amazon-pay-magento-2-module\",\n\"description\": \"Official Magento2 Plugin to integrate with Amazon Pay\",\n\"type\": \"magento2-module\",\n- \"version\": \"5.3.0\",\n+ \"version\": \"5.4.0\",\n\"license\": [\n\"Apache-2.0\"\n],\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Version bump to 5.4.0, add release notes to changelog
21,250
19.05.2021 11:52:33
10,800
b0bc4df8b0f6efa1eb99ca392512c26f8d297089
check if quote has already has an order
[ { "change_type": "MODIFY", "old_path": "Model/CheckoutSessionManagement.php", "new_path": "Model/CheckoutSessionManagement.php", "diff": "@@ -131,6 +131,11 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n*/\nprivate $carts = [];\n+ /**\n+ * @var \\Magento\\Sales\\Model\\ResourceModel\\Order\\CollectionFactory\n+ */\n+ private $orderCollectionFactory;\n+\n/**\n* CheckoutSessionManagement constructor.\n* @param \\Magento\\Store\\Model\\StoreManagerInterface $storeManager\n@@ -151,6 +156,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n* @param \\Amazon\\Pay\\Model\\AsyncManagement\\Charge $asyncCharge\n* @param \\Magento\\Sales\\Api\\TransactionRepositoryInterface $transactionRepository\n* @param \\Magento\\Framework\\Api\\SearchCriteriaBuilder $searchCriteriaBuilder\n+ * @param \\Magento\\Sales\\Model\\ResourceModel\\Order\\CollectionFactory $orderCollectionFactory\n*/\npublic function __construct(\n\\Magento\\Store\\Model\\StoreManagerInterface $storeManager,\n@@ -170,7 +176,8 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n\\Amazon\\Pay\\Model\\AsyncManagement $asyncManagement,\n\\Amazon\\Pay\\Model\\AsyncManagement\\Charge $asyncCharge,\n\\Magento\\Sales\\Api\\TransactionRepositoryInterface $transactionRepository,\n- \\Magento\\Framework\\Api\\SearchCriteriaBuilder $searchCriteriaBuilder\n+ \\Magento\\Framework\\Api\\SearchCriteriaBuilder $searchCriteriaBuilder,\n+ \\Magento\\Sales\\Model\\ResourceModel\\Order\\CollectionFactory $orderCollectionFactory\n) {\n$this->storeManager = $storeManager;\n$this->quoteIdMaskFactory = $quoteIdMaskFactory;\n@@ -190,6 +197,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$this->asyncCharge = $asyncCharge;\n$this->transactionRepository = $transactionRepository;\n$this->searchCriteriaBuilder = $searchCriteriaBuilder;\n+ $this->orderCollectionFactory = $orderCollectionFactory;\n}\n/**\n@@ -216,6 +224,23 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n!$this->amazonHelper->hasRestrictedProducts($this->magentoCheckoutSession->getQuote());\n}\n+ /**\n+ * In some particular cases an error occurs in Magento where an order with the same quoteId\n+ * is duplicated in a very short time difference.\n+ * This method checks if there is already an order created for that particular Quote.\n+ * https://github.com/magento/magento2/issues/13952\n+ * @param Quote $quote\n+ * @return bool\n+ */\n+ protected function canSubmitQuote($quote)\n+ {\n+ $orderCollection = $this->orderCollectionFactory->create()\n+ ->addFieldToSelect('increment_id')\n+ ->addFieldToFilter('quote_id', ['eq' => $quote->getId()]);\n+\n+ return ($orderCollection->count() == 0);\n+ }\n+\n/**\n* @param mixed $amazonCheckoutSessionId\n* @param bool $isShippingAddress\n@@ -501,7 +526,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n{\n$cart = $this->magentoCheckoutSession->getQuote();\n- if (empty($amazonSessionId) || !$this->canCheckoutWithAmazon()) {\n+ if (empty($amazonSessionId) || !$this->canCheckoutWithAmazon() || !$this->canSubmitQuote($cart)) {\nreturn [\n'success' => false,\n'message' => __(\"Unable to complete Amazon Pay checkout\"),\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-702: check if quote has already has an order
21,250
27.05.2021 10:47:32
10,800
938d8cf079a7f601fe9feb5d714f4dc15d2ccf54
Bug fix on the admin stylesheet. Styles were not being applied when Merchant Country != US
[ { "change_type": "MODIFY", "old_path": "view/adminhtml/web/css/source/_module.less", "new_path": "view/adminhtml/web/css/source/_module.less", "diff": "-#row_payment_us_amazon_payment_advanced_sales_options_restrict_categories {\n+tr[id$='_amazon_pay_advanced_sales_options_restrict_categories'] {\n.action-select-wrap {\n.action-select:after {\ntransform: none;\n}\n}\n-#row_payment_us_amazon_pay_credentials_private_key_pem,\n-#row_payment_us_amazon_pay_credentials_private_key_text,\n-#row_payment_us_amazon_pay_credentials_private_key_selected,\n-#row_payment_us_amazon_pay_credentials_private_key_selector {\n+tr[id$='_amazon_pay_credentials_private_key_pem'],\n+tr[id$='_amazon_pay_credentials_private_key_text'],\n+tr[id$='_amazon_pay_credentials_private_key_selected'],\n+tr[id$='_amazon_pay_credentials_private_key_selector'] {\ndisplay: none;\n}\n-#row_payment_us_amazon_pay_credentials_private_key_selector {\n+\n+tr[id$='_amazon_pay_credentials_private_key_selector'] {\n.value .private-key-buttons {\ndisplay: flex;\nalign-items: center;\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Bug fix on the admin stylesheet. Styles were not being applied when Merchant Country != US
21,250
01.06.2021 16:24:00
10,800
a4cded3d96afc706977032787eab9d50b417c93b
small fix to avoid race condition when drawing and redrawing button on product page
[ { "change_type": "MODIFY", "old_path": "view/frontend/web/js/amazon-button.js", "new_path": "view/frontend/web/js/amazon-button.js", "diff": "@@ -29,6 +29,8 @@ define([\nhideIfUnavailable: ''\n},\n+ drawing: false,\n+\n_loadButtonConfig: function (callback) {\ncheckoutSessionConfigLoad(function (checkoutSessionConfig) {\nif (!$.isEmptyObject(checkoutSessionConfig)) {\n@@ -84,17 +86,25 @@ define([\n* Draw button\n**/\n_draw: function () {\n+ var self = this;\n+\n+ if (!this.drawing) {\n+ this.drawing = true;\nvar $buttonContainer = this.element;\namazonCheckout.withAmazonCheckout(function (amazon, args) {\nvar $buttonRoot = $('<div></div>');\n$buttonRoot.html('<img src=\"' + require.toUrl('images/loader-1.gif') + '\" alt=\"\" width=\"24\" />');\n$buttonContainer.empty().append($buttonRoot);\n+\nthis._loadButtonConfig(function (buttonConfig) {\namazon.Pay.renderButton('#' + $buttonRoot.empty().removeUniqueId().uniqueId().attr('id'), buttonConfig);\n$('.amazon-button-container .field-tooltip').fadeIn();\n$('.amazon-checkout-button').click(function() { customerData.invalidate('*'); });\n+\n+ self.drawing = false;\n});\n}, this);\n+ }\n},\n/**\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-707: small fix to avoid race condition when drawing and redrawing button on product page
21,250
02.06.2021 15:06:57
10,800
35200c02a08e32d6b27db7609d19f8363cd29e00
Added more logs Alexa
[ { "change_type": "MODIFY", "old_path": "Model/Alexa.php", "new_path": "Model/Alexa.php", "diff": "namespace Amazon\\Pay\\Model;\nuse Amazon\\Pay\\Client\\ClientFactoryInterface;\n+use Amazon\\Pay\\Logger\\AlexaLogger;\nuse Magento\\Framework\\Module\\Dir;\nuse Magento\\Framework\\Phrase;\nuse Magento\\Framework\\Serialize\\SerializerInterface;\n@@ -60,6 +61,11 @@ class Alexa\n*/\nprivate $serializer;\n+ /**\n+ * @var \\Amazon\\Pay\\Logger\\AlexaLogger\n+ */\n+ private $alexaLogger;\n+\n/**\n* @param AmazonConfig $amazonConfig\n* @param ClientFactoryInterface $clientFactory\n@@ -74,7 +80,8 @@ class Alexa\nDir $moduleDir,\n\\Magento\\Framework\\File\\Csv $csv,\n\\Magento\\Framework\\Config\\CacheInterface $cache,\n- SerializerInterface $serializer\n+ SerializerInterface $serializer,\n+ AlexaLogger $alexaLogger\n) {\n$this->amazonConfig = $amazonConfig;\n$this->clientFactory = $clientFactory;\n@@ -83,6 +90,7 @@ class Alexa\n$this->csv = $csv;\n$this->cache = $cache;\n$this->serializer = $serializer;\n+ $this->alexaLogger = $alexaLogger;\n}\n/**\n@@ -96,9 +104,12 @@ class Alexa\n{\n$client = $this->clientFactory->create($storeId, ScopeInterface::SCOPE_STORE);\n// phpcs:ignore Magento2.Functions.DiscouragedFunction\n- $data = call_user_func_array([$client, $method], $arguments);\n- $status = $data['status'];\n- $response = json_decode($data['response'], true);\n+ $clientResponse = call_user_func_array([$client, $method], $arguments);\n+\n+ $response = $this->processResponse($clientResponse, $method);\n+\n+ $status = isset($response['status']) ? $response['status'] : '';\n+\nif ($status != '200') {\n$errorMessage = __('API error:') . ' (' . $status . ') ';\n$errorMessage .= !empty($response['reasonCode']) ? $response['reasonCode'] . ': ' : '';\n@@ -108,6 +119,43 @@ class Alexa\nreturn $response;\n}\n+ /**\n+ * Process SDK client response\n+ *\n+ * @param $clientResponse\n+ * @param $functionName\n+ * @return array\n+ */\n+ protected function processResponse($clientResponse, $functionName)\n+ {\n+ $response = [];\n+\n+ if (!isset($clientResponse['response'])) {\n+ $this->alexaLogger->debug(__('Unable to ' . $functionName));\n+ } else {\n+ $response = json_decode($clientResponse['response'], true);\n+ }\n+\n+ // Add HTTP response status code\n+ if (isset($clientResponse['status'])) {\n+ $response['status'] = $clientResponse['status'];\n+ }\n+\n+ // Log\n+ $isError = (!isset($response['status']) || !in_array($response['status'], [200, 201]));\n+ if ($isError || $this->amazonConfig->isLoggingEnabled()) {\n+ $debugBackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);\n+ $this->alexaLogger->debug($functionName . ' <- ', $debugBackTrace[1]['args']);\n+ if ($isError) {\n+ $this->alexaLogger->error($functionName . ' -> ', $response);\n+ } else {\n+ $this->alexaLogger->debug($functionName . ' -> ', $response);\n+ }\n+ }\n+\n+ return $response;\n+ }\n+\n/**\n* @param \\Magento\\Sales\\Model\\Order $order\n* @return string\n@@ -224,6 +272,11 @@ class Alexa\n$carrierCode = $this->getCarrierCode($track);\nif ($carrierCode == \"CUSTOM\") {\n+ $this->alexaLogger->debug('addDeliveryNotification: -> No matched Alexa Notification carrier for: ' .\n+ $track->getTitle() .\n+ ' - merchantReferenceId: ' .\n+ $track->getShipment()->getOrder()->getIncrementId());\n+\nthrow new \\Magento\\Framework\\Exception\\NotFoundException(\nnew Phrase('No matched Alexa Notification carrier for: ' . $track->getTitle())\n);\n" }, { "change_type": "MODIFY", "old_path": "Observer/SalesOrderShipmentTrackAfter.php", "new_path": "Observer/SalesOrderShipmentTrackAfter.php", "diff": "@@ -23,11 +23,6 @@ class SalesOrderShipmentTrackAfter implements \\Magento\\Framework\\Event\\ObserverI\n*/\nprivate $alexaModel;\n- /**\n- * @var \\Amazon\\Pay\\Logger\\AlexaLogger\n- */\n- private $alexaLogger;\n-\n/**\n* @var \\Magento\\Framework\\Message\\ManagerInterface\n*/\n@@ -35,11 +30,9 @@ class SalesOrderShipmentTrackAfter implements \\Magento\\Framework\\Event\\ObserverI\npublic function __construct(\n\\Amazon\\Pay\\Model\\Alexa $alexaModel,\n- \\Amazon\\Pay\\Logger\\AlexaLogger $alexaLogger,\n\\Magento\\Framework\\Message\\ManagerInterface $messageManager\n) {\n$this->alexaModel = $alexaModel;\n- $this->alexaLogger = $alexaLogger;\n$this->messageManager = $messageManager;\n}\n@@ -63,11 +56,6 @@ class SalesOrderShipmentTrackAfter implements \\Magento\\Framework\\Event\\ObserverI\n$this->messageManager->addSuccessMessage($message);\n}\n} catch (\\Exception $e) {\n- $this->alexaLogger->debug(implode('; ', [\n- 'ORDER: ' . $track->getOrderId(),\n- 'SHIPMENT: ' . $shipment->getId(),\n- 'ERROR: ' . $e->getMessage(),\n- ]));\n$this->messageManager->addWarningMessage(__(\n'Alexa Notification: %1',\n$e->getMessage()\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-696: Added more logs Alexa
21,250
07.06.2021 15:29:14
10,800
17882d4d2cb2d923222c91ca24690c60439636ae
Added logs for Capture
[ { "change_type": "MODIFY", "old_path": "Model/AsyncManagement/Charge.php", "new_path": "Model/AsyncManagement/Charge.php", "diff": "@@ -278,6 +278,7 @@ class Charge extends AbstractOperation\n$invoice = $this->invoiceService->prepareInvoice($order);\n$invoice->register();\n}\n+\nif ($invoice && ($invoice->canCapture() || $invoice->getOrder()->getStatus() == Order::STATE_PAYMENT_REVIEW)) {\n$order = $invoice->getOrder();\n$payment = $order->getPayment();\n@@ -303,6 +304,19 @@ class Charge extends AbstractOperation\n$this->setProcessing($order);\n$order->save();\n$this->asyncLogger->info('Captured Order #' . $order->getIncrementId());\n+ } else {\n+ if (!$invoice) {\n+ $errorMessage = 'Cannot create invoice for Order #' . $order->getIncrementId();\n+ } else {\n+ $errorMessage = 'Invoice cannot be captured -'\n+ . ' Order #' . $order->getIncrementId()\n+ . ' Order Status: ' . $invoice->getOrder()->getStatus();\n+ }\n+\n+ $this->asyncLogger->error($errorMessage);\n+ $order->addStatusHistoryComment($errorMessage);\n+ $order->save();\n+\n}\n}\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-690: Added logs for Capture
21,266
08.06.2021 10:15:38
14,400
2d8b2ed7c7d708e2f8096bac277b7d0458ea3a19
Add 'waitForPopup' helper method
[ { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-24/Helper/WaitForPopup.php", "diff": "+<?php\n+\n+namespace Amazon\\Pay\\Test\\Mftf\\Helper;\n+\n+use Magento\\FunctionalTestingFramework\\Helper\\Helper;\n+\n+class WaitForPopup extends Helper {\n+\n+ public function waitForPopup() {\n+ /** @var \\Magento\\FunctionalTestingFramework\\Module\\MagentoWebDriver $webDriver */\n+ $webDriver = $this->getModule('\\Magento\\FunctionalTestingFramework\\Module\\MagentoWebDriver');\n+ $allMods = $this->getModules();\n+\n+ try {\n+ $webDriver->executeInSelenium(function(\\Facebook\\WebDriver\\Remote\\RemoteWebDriver $webdriver) {\n+ // Allow popup to appear before switching tabs\n+ $handles = $webdriver->getWindowHandles();\n+ while(count($handles) < 2) {\n+ $handles = $webdriver->getWindowHandles();\n+ }\n+ });\n+ } catch(\\Exception $e) {\n+ print($e);\n+ }\n+\n+ }\n+\n+}\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonCancelReturnUrl.xml", "new_path": "Test/Mftf-24/Test/AmazonCancelReturnUrl.xml", "diff": "<!--Save opener window name since popup auto-closes-->\n<executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n<click selector=\"{{AmazonLoginSection.login}}\" stepKey=\"signInWithAmazon\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen\"/>\n+ <helper class=\"\\Amazon\\Pay\\Test\\Mftf\\Helper\\WaitForPopup\" method=\"waitForPopup\" stepKey=\"allowPopupToOpen\" />\n<switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n<!-- Login to Amazon -->\n<!-- Click Amazon Pay button on product page and login -->\n<click selector=\"{{AmazonButtonSection.product}}\" stepKey=\"clickAmazonButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen2\"/>\n+ <helper class=\"\\Amazon\\Pay\\Test\\Mftf\\Helper\\WaitForPopup\" method=\"waitForPopup\" stepKey=\"allowPopupToOpen2\" />\n<switchToNextTab stepKey=\"switchToWindowLoginPopup2\"/>\n<waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seeAmazonCheckoutButton\"/>\n<!-- Click edit button on address -->\n<click selector=\"{{AmazonCheckoutSection.editShippingButton}}\" stepKey=\"clickAmazonEditShippingButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen3\"/>\n+ <helper class=\"\\Amazon\\Pay\\Test\\Mftf\\Helper\\WaitForPopup\" method=\"waitForPopup\" stepKey=\"allowPopupToOpen3\" />\n<switchToNextTab stepKey=\"switchToAddressEditPopup\"/>\n<waitForElement selector=\"{{AmazonPageSection.cancelButton}}\" stepKey=\"waitForCancelCheckout\"/>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Add 'waitForPopup' helper method
21,266
08.06.2021 10:18:16
14,400
c9a9fbb9c0ebb12dc11c738cdcf234b8e8eff5ba
Remove unnecessary call for modules
[ { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Helper/WaitForPopup.php", "new_path": "Test/Mftf-24/Helper/WaitForPopup.php", "diff": "@@ -9,7 +9,6 @@ class WaitForPopup extends Helper {\npublic function waitForPopup() {\n/** @var \\Magento\\FunctionalTestingFramework\\Module\\MagentoWebDriver $webDriver */\n$webDriver = $this->getModule('\\Magento\\FunctionalTestingFramework\\Module\\MagentoWebDriver');\n- $allMods = $this->getModules();\ntry {\n$webDriver->executeInSelenium(function(\\Facebook\\WebDriver\\Remote\\RemoteWebDriver $webdriver) {\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Remove unnecessary call for modules
21,250
08.06.2021 11:23:23
10,800
90768c2038a09251fdcae66fefef00f00ba93d85
Added extra validation when buyerId is empty
[ { "change_type": "MODIFY", "old_path": "Controller/Login.php", "new_path": "Controller/Login.php", "diff": "@@ -178,7 +178,7 @@ abstract class Login extends Action\n$userInfo = $this->amazonAdapter\n->getBuyer($token);\n- if (is_array($userInfo) && !empty($userInfo['buyerId'])) {\n+ if (is_array($userInfo) && array_key_exists('buyerId', $userInfo) && !empty($userInfo['buyerId'])) {\n$data = [\n'id' => $userInfo['buyerId'],\n'email' => $userInfo['email'],\n" }, { "change_type": "MODIFY", "old_path": "Controller/Login/Checkout.php", "new_path": "Controller/Login/Checkout.php", "diff": "@@ -121,8 +121,7 @@ class Checkout extends \\Amazon\\Pay\\Controller\\Login\nprotected function getAmazonCustomerFromSession($checkoutSession)\n{\n$userInfo = $checkoutSession['buyer'];\n-\n- if (is_array($userInfo) && array_key_exists('buyerId', $userInfo)) {\n+ if (is_array($userInfo) && array_key_exists('buyerId', $userInfo) && !empty($userInfo['buyerId'])) {\n$data = [\n'id' => $userInfo['buyerId'],\n'email' => $userInfo['email'],\n@@ -131,6 +130,8 @@ class Checkout extends \\Amazon\\Pay\\Controller\\Login\n];\nreturn $data;\n+ } else {\n+ $this->logger->error('Amazon buyerId is empty');\n}\nreturn false;\n@@ -143,7 +144,10 @@ class Checkout extends \\Amazon\\Pay\\Controller\\Login\nprotected function createAmazonCustomerFromSession($checkoutSession)\n{\n$data = $this->getAmazonCustomerFromSession($checkoutSession);\n-\n+ if ($data) {\nreturn $this->amazonCustomerFactory->create($data);\n+ } else {\n+ return false;\n+ }\n}\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-701: Added extra validation when buyerId is empty
21,266
09.06.2021 08:57:22
14,400
0deeb6f5d68ed7a442bf08648514987f6d52bcfc
Update to use ActionGroup with timeout
[ { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-23/ActionGroup/AmazonSwitchToPopupActionGroup.xml", "diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<actionGroups xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/actionGroupSchema.xsd\">\n+ <actionGroup name=\"AmazonSwitchToPopupActionGroup\">\n+ <executeInSelenium function=\"function(\\Facebook\\WebDriver\\Remote\\RemoteWebDriver $webdriver) {$webdriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::numberOfWindowsToBe(2));}\" stepKey=\"allowPopupToOpen\" />\n+ </actionGroup>\n+</actionGroups>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Test/AmazonCancelReturnUrl.xml", "new_path": "Test/Mftf-23/Test/AmazonCancelReturnUrl.xml", "diff": "<!--Save opener window name since popup auto-closes-->\n<executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n<click selector=\"{{AmazonLoginSection.login}}\" stepKey=\"signInWithAmazon\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n<!-- Login to Amazon -->\n<!-- Click Amazon Pay button on product page and login -->\n<click selector=\"{{AmazonButtonSection.product}}\" stepKey=\"clickAmazonButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen2\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen2\" />\n<switchToNextTab stepKey=\"switchToWindowLoginPopup2\"/>\n<waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seeAmazonCheckoutButton\"/>\n<!-- Click edit button on address -->\n<click selector=\"{{AmazonCheckoutSection.editShippingButton}}\" stepKey=\"clickAmazonEditShippingButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen3\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen3\" />\n<switchToNextTab stepKey=\"switchToAddressEditPopup\"/>\n<waitForElement selector=\"{{AmazonPageSection.cancelButton}}\" stepKey=\"waitForCancelCheckout\"/>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-24/ActionGroup/AmazonSwitchToPopupActionGroup.xml", "diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<actionGroups xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/actionGroupSchema.xsd\">\n+ <actionGroup name=\"AmazonSwitchToPopupActionGroup\">\n+ <helper class=\"\\Amazon\\Pay\\Test\\Mftf\\Helper\\WaitForPopup\" method=\"waitForPopup\" stepKey=\"allowPopupToOpen\" />\n+ </actionGroup>\n+</actionGroups>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Helper/WaitForPopup.php", "new_path": "Test/Mftf-24/Helper/WaitForPopup.php", "diff": "@@ -12,11 +12,8 @@ class WaitForPopup extends Helper {\ntry {\n$webDriver->executeInSelenium(function(\\Facebook\\WebDriver\\Remote\\RemoteWebDriver $webdriver) {\n- // Allow popup to appear before switching tabs\n- $handles = $webdriver->getWindowHandles();\n- while(count($handles) < 2) {\n- $handles = $webdriver->getWindowHandles();\n- }\n+ // Wait for up to 30 seconds, poll every 100ms\n+ $webdriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::numberOfWindowsToBe(2));\n});\n} catch(\\Exception $e) {\nprint($e);\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonCancelReturnUrl.xml", "new_path": "Test/Mftf-24/Test/AmazonCancelReturnUrl.xml", "diff": "<!--Save opener window name since popup auto-closes-->\n<executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n<click selector=\"{{AmazonLoginSection.login}}\" stepKey=\"signInWithAmazon\"/>\n- <helper class=\"\\Amazon\\Pay\\Test\\Mftf\\Helper\\WaitForPopup\" method=\"waitForPopup\" stepKey=\"allowPopupToOpen\" />\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n<!-- Login to Amazon -->\n<!-- Click Amazon Pay button on product page and login -->\n<click selector=\"{{AmazonButtonSection.product}}\" stepKey=\"clickAmazonButton\"/>\n- <helper class=\"\\Amazon\\Pay\\Test\\Mftf\\Helper\\WaitForPopup\" method=\"waitForPopup\" stepKey=\"allowPopupToOpen2\" />\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen2\" />\n<switchToNextTab stepKey=\"switchToWindowLoginPopup2\"/>\n<waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seeAmazonCheckoutButton\"/>\n<!-- Click edit button on address -->\n<click selector=\"{{AmazonCheckoutSection.editShippingButton}}\" stepKey=\"clickAmazonEditShippingButton\"/>\n- <helper class=\"\\Amazon\\Pay\\Test\\Mftf\\Helper\\WaitForPopup\" method=\"waitForPopup\" stepKey=\"allowPopupToOpen3\" />\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen3\" />\n<switchToNextTab stepKey=\"switchToAddressEditPopup\"/>\n<waitForElement selector=\"{{AmazonPageSection.cancelButton}}\" stepKey=\"waitForCancelCheckout\"/>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Update to use ActionGroup with timeout
21,241
09.06.2021 13:29:36
18,000
ad4b7f410f93568563ec95bada0e047ff9d4fa05
payment method button changed to be APB flow
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "namespace Amazon\\Pay\\Model\\Adapter;\n+use Amazon\\Pay\\Model\\Config\\Source\\PaymentAction;\n+use Magento\\Quote\\Model\\Quote;\n+\nclass AmazonPayAdapter\n{\nconst PAYMENT_INTENT_CONFIRM = 'Confirm';\n@@ -475,6 +478,51 @@ class AmazonPayAdapter\nreturn json_encode($payload, JSON_UNESCAPED_SLASHES);\n}\n+ public function generatePayNowButtonPayload(Quote $quote, $paymentIntent = PaymentAction::AUTHORIZE)\n+ {\n+ // Always use Authorize for now, so that async transactions are handled properly\n+ $paymentIntent = self::PAYMENT_INTENT_AUTHORIZE;\n+\n+ $payload = [\n+ 'webCheckoutDetails' => [\n+ 'checkoutMode' => 'ProcessOrder',\n+ 'checkoutResultReturnUrl' => $this->amazonConfig->getPayNowResultUrl(),\n+ ],\n+ 'storeId' => $this->amazonConfig->getClientId(),\n+\n+ 'paymentDetails' => [\n+ 'paymentIntent' => $paymentIntent,\n+ 'canHandlePendingAuthorization' => $this->amazonConfig->canHandlePendingAuthorization(),\n+ 'chargeAmount' => $this->createPrice($quote->getGrandTotal(), $quote->getQuoteCurrencyCode()),\n+ ],\n+ 'merchantMetadata' => [\n+ 'merchantReferenceId' => $quote->getReservedOrderId(),\n+ 'merchantStoreName' => $this->amazonConfig->getStoreName(),\n+ 'customInformation' => $this->getMerchantCustomInformation(),\n+ ],\n+ ];\n+\n+ $address = $quote->getShippingAddress();\n+ if (!empty($address->getPostcode())) {\n+ $addressData = [\n+ 'name' => $address->getName(),\n+ 'city' => $address->getCity(),\n+ 'stateOrRegion' => $address->getRegionCode(),\n+ 'postalCode' => $address->getPostcode(),\n+ 'countryCode' => $address->getCountry(),\n+ 'phoneNumber' => $address->getTelephone(),\n+ ];\n+ foreach ($address->getStreet() as $index => $streetLine) {\n+ $addressKey = 'addressLine' . ($index + 1);\n+ $addressData[$addressKey] = $streetLine;\n+ }\n+\n+ $payload['addressDetails'] = $addressData;\n+ }\n+\n+ return json_encode($payload, JSON_UNESCAPED_SLASHES);\n+ }\n+\npublic function signButton($payload, $storeId = null)\n{\nreturn $this->clientFactory->create($storeId)->generateButtonSignature($payload);\n" }, { "change_type": "MODIFY", "old_path": "Model/AmazonConfig.php", "new_path": "Model/AmazonConfig.php", "diff": "@@ -561,6 +561,17 @@ class AmazonConfig\nreturn $result;\n}\n+ /**\n+ * @return string\n+ */\n+ public function getPayNowResultUrl($scope = ScopeInterface::SCOPE_STORE, $scopeCode = null)\n+ {\n+ return $this->storeManager->getStore()->getUrl(\n+ 'amazon_pay/checkout/completeSession',\n+ ['_forced_secure' => true]\n+ );\n+ }\n+\n/**\n* @param string $scope\n* @param mixed $scopeCode\n" }, { "change_type": "MODIFY", "old_path": "Model/CheckoutSessionManagement.php", "new_path": "Model/CheckoutSessionManagement.php", "diff": "@@ -309,20 +309,27 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n{\n$result = [];\nif ($this->canCheckoutWithAmazon()) {\n+ $magentoQuote = $this->magentoCheckoutSession->getQuote();\n$loginButtonPayload = $this->amazonAdapter->generateLoginButtonPayload();\n$checkoutButtonPayload = $this->amazonAdapter->generateCheckoutButtonPayload();\n+ $payNowButtonPayload = $this->amazonAdapter->generatePayNowButtonPayload(\n+ $magentoQuote,\n+ $this->amazonConfig->getPaymentAction()\n+ );\n$result = [\n'merchant_id' => $this->amazonConfig->getMerchantId(),\n'currency' => $this->amazonConfig->getCurrencyCode(),\n'button_color' => $this->amazonConfig->getButtonColor(),\n'language' => $this->amazonConfig->getLanguage(),\n- 'pay_only' => $this->amazonHelper->isPayOnly($this->magentoCheckoutSession->getQuote()),\n+ 'pay_only' => $this->amazonHelper->isPayOnly($magentoQuote),\n'sandbox' => $this->amazonConfig->isSandboxEnabled(),\n'login_payload' => $loginButtonPayload,\n'login_signature' => $this->amazonAdapter->signButton($loginButtonPayload),\n'checkout_payload' => $checkoutButtonPayload,\n'checkout_signature' => $this->amazonAdapter->signButton($checkoutButtonPayload),\n+ 'paynow_payload' => $payNowButtonPayload,\n+ 'paynow_signature' => $this->amazonAdapter->signButton($payNowButtonPayload),\n'public_key_id' => $this->amazonConfig->getPublicKeyId(),\n];\n}\n@@ -553,6 +560,25 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n];\n}\n+ if ($amazonSession['productType'] == 'PayOnly') {\n+ $addressData = $amazonSession['billingAddress'];\n+\n+ $addressData['state'] = $addressData['stateOrRegion'];\n+ $addressData['phone'] = $addressData['phoneNumber'];\n+\n+ $address = array_combine(\n+ array_map('ucfirst', array_keys($addressData)),\n+ array_values($addressData)\n+ );\n+ $amazonAddress = $this->amazonAddressFactory->create(['address' => $address]);\n+\n+ $customerAddress = $this->addressHelper->convertToMagentoEntity($amazonAddress);\n+ $cart->getBillingAddress()->importCustomerAddressData($customerAddress);\n+ if (empty($cart->getCustomerEmail())) {\n+ $cart->setCustomerEmail($amazonSession['buyer']['email']);\n+ }\n+ }\n+\n// get payment to load it in the session, so that a salesrule that relies on payment method conditions\n// can work as expected\n$payment = $this->magentoCheckoutSession->getQuote()->getPayment();\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/js/amazon-button.js", "new_path": "view/frontend/web/js/amazon-button.js", "diff": "@@ -34,6 +34,14 @@ define([\n_loadButtonConfig: function (callback) {\ncheckoutSessionConfigLoad(function (checkoutSessionConfig) {\nif (!$.isEmptyObject(checkoutSessionConfig)) {\n+ var payload = (this.options.placement === 'PayNow') ?\n+ checkoutSessionConfig['paynow_payload'] : checkoutSessionConfig['checkout_payload'];\n+ var signature = (this.options.placement === 'PayNow') ?\n+ checkoutSessionConfig['paynow_signature'] : checkoutSessionConfig['checkout_signature'];\n+ if (this.options.placement === 'PayNow') {\n+ this.options.placement = 'Checkout';\n+ }\n+\ncallback({\nmerchantId: checkoutSessionConfig['merchant_id'],\nledgerCurrency: checkoutSessionConfig['currency'],\n@@ -43,13 +51,13 @@ define([\nplacement: this.options.placement,\nbuttonColor: checkoutSessionConfig['button_color'],\ncreateCheckoutSessionConfig: {\n- payloadJSON: checkoutSessionConfig['checkout_payload'],\n- signature: checkoutSessionConfig['checkout_signature'],\n+ payloadJSON: payload,\n+ signature: signature,\npublicKeyId: checkoutSessionConfig['public_key_id'],\n}\n});\n- if (this.options.placement !== \"Checkout\") {\n+ if (this.options.placement !== \"Checkout\" && this.options.placement !== \"PayNow\") {\n$(this.options.hideIfUnavailable).show();\n}\n} else {\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/template/payment/amazon-payment-method.html", "new_path": "view/frontend/web/template/payment/amazon-payment-method.html", "diff": "<div class=\"amazon-button-column\">\n<div id=\"PayWithAmazonButton\"\nclass=\"amazon-checkout-button\"\n- data-bind=\"mageInit: {'Amazon_Pay/js/amazon-button':{'placement': 'Checkout'}}\"></div>\n+ data-bind=\"mageInit: {'Amazon_Pay/js/amazon-button':{'placement': 'PayNow'}}\"></div>\n</div>\n<div class=\"amazon-button-column amazon-button-column-tooltip\">\n<div class=\"field-tooltip toggle\">\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
APF-311 - payment method button changed to be APB flow
21,266
09.06.2021 14:45:18
14,400
425df49ce1c4ea30ac388af050bb8ccb3082189e
Move switchToNextTab into SwitchToPopup ActionGroup
[ { "change_type": "MODIFY", "old_path": "Test/Mftf-23/ActionGroup/AmazonSwitchToPopupActionGroup.xml", "new_path": "Test/Mftf-23/ActionGroup/AmazonSwitchToPopupActionGroup.xml", "diff": "<actionGroups xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/actionGroupSchema.xsd\">\n<actionGroup name=\"AmazonSwitchToPopupActionGroup\">\n<executeInSelenium function=\"function(\\Facebook\\WebDriver\\Remote\\RemoteWebDriver $webdriver) {$webdriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::numberOfWindowsToBe(2));}\" stepKey=\"allowPopupToOpen\" />\n+ <switchToNextTab stepKey=\"switchToPopup\"/>\n</actionGroup>\n</actionGroups>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Test/AmazonCancelReturnUrl.xml", "new_path": "Test/Mftf-23/Test/AmazonCancelReturnUrl.xml", "diff": "<executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n<click selector=\"{{AmazonLoginSection.login}}\" stepKey=\"signInWithAmazon\"/>\n<actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n- <switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n<!-- Login to Amazon -->\n<actionGroup ref=\"AmazonBeginLoginOnlyActionGroup\" stepKey=\"amazonBeginLoginOnlyActionGroup\"/>\n<click selector=\"{{AmazonButtonSection.product}}\" stepKey=\"clickAmazonButton\"/>\n<actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen2\" />\n- <switchToNextTab stepKey=\"switchToWindowLoginPopup2\"/>\n<waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seeAmazonCheckoutButton\"/>\n<!--Come back to checkout with default address-->\n<!-- Click edit button on address -->\n<click selector=\"{{AmazonCheckoutSection.editShippingButton}}\" stepKey=\"clickAmazonEditShippingButton\"/>\n<actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen3\" />\n- <switchToNextTab stepKey=\"switchToAddressEditPopup\"/>\n<waitForElement selector=\"{{AmazonPageSection.cancelButton}}\" stepKey=\"waitForCancelCheckout\"/>\n<!-- Click cancel button on Amazon hosted page -->\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/ActionGroup/AmazonSwitchToPopupActionGroup.xml", "new_path": "Test/Mftf-24/ActionGroup/AmazonSwitchToPopupActionGroup.xml", "diff": "<actionGroups xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/actionGroupSchema.xsd\">\n<actionGroup name=\"AmazonSwitchToPopupActionGroup\">\n<helper class=\"\\Amazon\\Pay\\Test\\Mftf\\Helper\\WaitForPopup\" method=\"waitForPopup\" stepKey=\"allowPopupToOpen\" />\n+ <switchToNextTab stepKey=\"switchToPopup\"/>\n</actionGroup>\n</actionGroups>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonCancelReturnUrl.xml", "new_path": "Test/Mftf-24/Test/AmazonCancelReturnUrl.xml", "diff": "<executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n<click selector=\"{{AmazonLoginSection.login}}\" stepKey=\"signInWithAmazon\"/>\n<actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n- <switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n<!-- Login to Amazon -->\n<actionGroup ref=\"AmazonBeginLoginOnlyActionGroup\" stepKey=\"amazonBeginLoginOnlyActionGroup\"/>\n<click selector=\"{{AmazonButtonSection.product}}\" stepKey=\"clickAmazonButton\"/>\n<actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen2\" />\n- <switchToNextTab stepKey=\"switchToWindowLoginPopup2\"/>\n<waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seeAmazonCheckoutButton\"/>\n<!--Come back to checkout with default address-->\n<!-- Click edit button on address -->\n<click selector=\"{{AmazonCheckoutSection.editShippingButton}}\" stepKey=\"clickAmazonEditShippingButton\"/>\n<actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen3\" />\n- <switchToNextTab stepKey=\"switchToAddressEditPopup\"/>\n<waitForElement selector=\"{{AmazonPageSection.cancelButton}}\" stepKey=\"waitForCancelCheckout\"/>\n<!-- Click cancel button on Amazon hosted page -->\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Move switchToNextTab into SwitchToPopup ActionGroup
21,241
09.06.2021 15:57:55
18,000
27fd94ce49c08f9a5c26aea4a7f86fc7e5201807
set presentmentCurrency for multi-currency checkout
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -482,6 +482,7 @@ class AmazonPayAdapter\n{\n// Always use Authorize for now, so that async transactions are handled properly\n$paymentIntent = self::PAYMENT_INTENT_AUTHORIZE;\n+ $currencyCode = $quote->getQuoteCurrencyCode();\n$payload = [\n'webCheckoutDetails' => [\n@@ -493,7 +494,8 @@ class AmazonPayAdapter\n'paymentDetails' => [\n'paymentIntent' => $paymentIntent,\n'canHandlePendingAuthorization' => $this->amazonConfig->canHandlePendingAuthorization(),\n- 'chargeAmount' => $this->createPrice($quote->getGrandTotal(), $quote->getQuoteCurrencyCode()),\n+ 'chargeAmount' => $this->createPrice($quote->getGrandTotal(), $currencyCode),\n+ 'presentmentCurrency' => $currencyCode,\n],\n'merchantMetadata' => [\n'merchantReferenceId' => $quote->getReservedOrderId(),\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
APF-311 - set presentmentCurrency for multi-currency checkout
21,266
10.06.2021 09:08:58
14,400
4514e336fd36585eed68be263d00e7ab786f2fcd
Add MFTFs for Pay Now
[ { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-23/Test/AmazonCheckoutPayNowDeclinedTest.xml", "diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<tests xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/testSchema.xsd\">\n+ <test name=\"AmazonCheckoutPayNowDeclinedTest\" extends=\"AmazonCheckoutButton\">\n+ <annotations>\n+ <stories value=\"Amazon Checkout\"/>\n+ <title value=\"Amazon Checkout Pay Now Declined\"/>\n+ <description value=\"User should be able to checkout with Amazon Pay.\"/>\n+ <severity value=\"CRITICAL\"/>\n+ <group value=\"amazon_pay\"/>\n+ <group value=\"amazon_pay_checkout\"/>\n+ </annotations>\n+\n+ <!-- shipping-->\n+ <actionGroup ref=\"ShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n+\n+ <!-- amazon pay option -->\n+ <click selector=\"{{AmazonCheckoutSection.method}}\" stepKey=\"chooseAmazonMethod\" />\n+ <waitForPageLoad stepKey=\"waitForPayButton\" />\n+\n+ <!-- amazon pay button -->\n+ <waitForElement selector=\"{{AmazonButtonSection.payment}}\" stepKey=\"seeAmazonPay\" />\n+ <executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n+ <click selector=\"{{AmazonButtonSection.payment}}\" stepKey=\"clickAmazonPay\" />\n+\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"switchToPopup\" />\n+ <actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"amazonLogin\" />\n+\n+ <!-- choose card -->\n+ <click selector=\"{{AmazonPageSection.changePaymentButton}}\" stepKey=\"clickChangeAddress\"/>\n+ <executeJS function=\"document.querySelectorAll('#maxo_payment_methods .a-radio-label').forEach(function(v,i,o) { if (v.querySelector('.trail_number').innerText.includes('3434')) { v.click() } });\" stepKey=\"executeJsCc\"/>\n+ <click selector=\"{{AmazonPageSection.usePaymentButton}}\" stepKey=\"clickUsePaymentMethod\"/>\n+\n+ <waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seePayNow\" />\n+ <wait time=\"2\" stepKey=\"allowPayNowButtonToBeClickable\" />\n+ <click selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"payNow\" />\n+ <switchToWindow userInput=\"{$openerName}\" stepKey=\"switchToWindowOpener\" />\n+\n+ <!--Wait for redirect to cart-->\n+ <waitForPageLoad stepKey=\"waitRedirect\"/>\n+ <seeInCurrentUrl url=\"{{CheckoutCartPage.url}}\" stepKey=\"assertUrl\"/>\n+ <waitForText userInput=\"transaction has been declined\" selector=\"{{AdminMessagesSection.errorMessage}}\" stepKey=\"waitForText\"/>\n+ </test>\n+</tests>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-23/Test/AmazonCheckoutPayNowSuccessTest.xml", "diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<tests xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/testSchema.xsd\">\n+ <test name=\"AmazonCheckoutPayNowSuccessTest\" extends=\"AmazonCheckoutButton\">\n+ <annotations>\n+ <stories value=\"Amazon Checkout\"/>\n+ <title value=\"Amazon Checkout Pay Now Success\"/>\n+ <description value=\"User should get declined message when Amazon Rejects the payment.\"/>\n+ <severity value=\"CRITICAL\"/>\n+ <group value=\"amazon_pay\"/>\n+ <group value=\"amazon_pay_checkout\"/>\n+ </annotations>\n+\n+ <!-- shipping-->\n+ <actionGroup ref=\"ShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n+\n+ <!-- amazon pay option -->\n+ <click selector=\"{{AmazonCheckoutSection.method}}\" stepKey=\"chooseAmazonMethod\" />\n+ <waitForPageLoad stepKey=\"waitForPayButton\" />\n+\n+ <!-- amazon pay button -->\n+ <waitForElement selector=\"{{AmazonButtonSection.payment}}\" stepKey=\"seeAmazonPay\" />\n+ <executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n+ <click selector=\"{{AmazonButtonSection.payment}}\" stepKey=\"clickAmazonPay\" />\n+\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"switchToPopup\" />\n+ <actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"amazonLogin\" />\n+\n+ <waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seePayNow\" />\n+ <click selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"payNow\" />\n+ <switchToWindow userInput=\"{$openerName}\" stepKey=\"switchToWindowOpener\" />\n+\n+ <waitForPageLoad stepKey=\"checkoutSuccessLoad\" />\n+ <waitForElementVisible selector=\"{{CheckoutSuccessMainSection.successTitle}}\" stepKey=\"waitForProcess\" />\n+\n+ <seeInCurrentUrl url=\"/checkout/onepage/success\" stepKey=\"verifySuccess\" />\n+ <see selector=\"{{CheckoutSuccessMainSection.success}}\" userInput=\"{{CONST.successGuestCheckoutOrderNumberMessage}}\" stepKey=\"seeOrderNumber\"/>\n+ <see selector=\"{{CheckoutSuccessMainSection.success}}\" userInput=\"{{CONST.successCheckoutEmailYouMessage}}\" stepKey=\"seeEmailYou\"/>\n+ </test>\n+</tests>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-24/Test/AmazonCheckoutPayNowDeclinedTest.xml", "diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<tests xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/testSchema.xsd\">\n+ <test name=\"AmazonCheckoutPayNowDeclinedTest\" extends=\"AmazonCheckoutButton\">\n+ <annotations>\n+ <stories value=\"Amazon Checkout\"/>\n+ <title value=\"Amazon Checkout Pay Now Declined\"/>\n+ <description value=\"User should be able to checkout with Amazon Pay.\"/>\n+ <severity value=\"CRITICAL\"/>\n+ <group value=\"amazon_pay\"/>\n+ <group value=\"amazon_pay_checkout\"/>\n+ </annotations>\n+\n+ <!-- shipping-->\n+ <actionGroup ref=\"ShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n+\n+ <!-- amazon pay option -->\n+ <click selector=\"{{AmazonCheckoutSection.method}}\" stepKey=\"chooseAmazonMethod\" />\n+ <waitForPageLoad stepKey=\"waitForPayButton\" />\n+\n+ <!-- amazon pay button -->\n+ <waitForElement selector=\"{{AmazonButtonSection.payment}}\" stepKey=\"seeAmazonPay\" />\n+ <executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n+ <click selector=\"{{AmazonButtonSection.payment}}\" stepKey=\"clickAmazonPay\" />\n+\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"switchToPopup\" />\n+ <actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"amazonLogin\" />\n+\n+ <!-- choose card -->\n+ <click selector=\"{{AmazonPageSection.changePaymentButton}}\" stepKey=\"clickChangeAddress\"/>\n+ <executeJS function=\"document.querySelectorAll('#maxo_payment_methods .a-radio-label').forEach(function(v,i,o) { if (v.querySelector('.trail_number').innerText.includes('3434')) { v.click() } });\" stepKey=\"executeJsCc\"/>\n+ <click selector=\"{{AmazonPageSection.usePaymentButton}}\" stepKey=\"clickUsePaymentMethod\"/>\n+\n+ <waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seePayNow\" />\n+ <wait time=\"2\" stepKey=\"allowPayNowButtonToBeClickable\" />\n+ <click selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"payNow\" />\n+ <switchToWindow userInput=\"{$openerName}\" stepKey=\"switchToWindowOpener\" />\n+\n+ <!--Wait for redirect to cart-->\n+ <waitForPageLoad stepKey=\"waitRedirect\"/>\n+ <seeInCurrentUrl url=\"{{CheckoutCartPage.url}}\" stepKey=\"assertUrl\"/>\n+ <waitForText userInput=\"transaction has been declined\" selector=\"{{AdminMessagesSection.errorMessage}}\" stepKey=\"waitForText\"/>\n+ </test>\n+</tests>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-24/Test/AmazonCheckoutPayNowSuccessTest.xml", "diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<tests xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/testSchema.xsd\">\n+ <test name=\"AmazonCheckoutPayNowSuccessTest\" extends=\"AmazonCheckoutButton\">\n+ <annotations>\n+ <stories value=\"Amazon Checkout\"/>\n+ <title value=\"Amazon Checkout Pay Now Success\"/>\n+ <description value=\"User should get declined message when Amazon Rejects the payment.\"/>\n+ <severity value=\"CRITICAL\"/>\n+ <group value=\"amazon_pay\"/>\n+ <group value=\"amazon_pay_checkout\"/>\n+ </annotations>\n+\n+ <!-- shipping-->\n+ <actionGroup ref=\"ShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n+\n+ <!-- amazon pay option -->\n+ <click selector=\"{{AmazonCheckoutSection.method}}\" stepKey=\"chooseAmazonMethod\" />\n+ <waitForPageLoad stepKey=\"waitForPayButton\" />\n+\n+ <!-- amazon pay button -->\n+ <waitForElement selector=\"{{AmazonButtonSection.payment}}\" stepKey=\"seeAmazonPay\" />\n+ <executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n+ <click selector=\"{{AmazonButtonSection.payment}}\" stepKey=\"clickAmazonPay\" />\n+\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"switchToPopup\" />\n+ <actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"amazonLogin\" />\n+\n+ <waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seePayNow\" />\n+ <click selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"payNow\" />\n+ <switchToWindow userInput=\"{$openerName}\" stepKey=\"switchToWindowOpener\" />\n+\n+ <waitForPageLoad stepKey=\"checkoutSuccessLoad\" />\n+ <waitForElementVisible selector=\"{{CheckoutSuccessMainSection.successTitle}}\" stepKey=\"waitForProcess\" />\n+\n+ <seeInCurrentUrl url=\"/checkout/onepage/success\" stepKey=\"verifySuccess\" />\n+ <see selector=\"{{CheckoutSuccessMainSection.success}}\" userInput=\"{{CONST.successGuestCheckoutOrderNumberMessage}}\" stepKey=\"seeOrderNumber\"/>\n+ <see selector=\"{{CheckoutSuccessMainSection.success}}\" userInput=\"{{CONST.successCheckoutEmailYouMessage}}\" stepKey=\"seeEmailYou\"/>\n+ </test>\n+</tests>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Add MFTFs for Pay Now
21,241
10.06.2021 10:41:01
18,000
50501a7cf00574e4f45834849388ad21ed38e107
add checkoutCancelUrl to the PayNow payload
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -488,6 +488,7 @@ class AmazonPayAdapter\n'webCheckoutDetails' => [\n'checkoutMode' => 'ProcessOrder',\n'checkoutResultReturnUrl' => $this->amazonConfig->getPayNowResultUrl(),\n+ 'checkoutCancelUrl' => $this->getCancelUrl(),\n],\n'storeId' => $this->amazonConfig->getClientId(),\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
APF-311 - add checkoutCancelUrl to the PayNow payload
21,241
10.06.2021 14:50:23
18,000
5f931c3032ebb467bb90616d831d89ec5f8217ec
Version bumps and notes for 5.5.0 release
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "# Change Log\n+## 5.5.0\n+* Added Auto Key Exchange for configuring the credentials\n+* Added PayNow functionality for the button on the final step of checkout\n+* Added more logging to the Alexa feature\n+* Added more logging to capturing flow\n+* Added validation that Amazon API always returns a buyerId\n+* Fixed admin stylesheets for non-US locale\n+* Fixed race condition that could happen when re-drawing the button\n+\n## 5.4.0\n* Fixed credential validation when inheriting from parent scope\n* Fixed issue to properly handle when Amazon Pay returns empty buyer ID\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -48,7 +48,7 @@ The following table provides an overview on which Git branch is compatible to wh\nMagento Version | Github Branch | Latest release\n---|---|---\n2.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)\n-2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.4.0\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.5.0\n## Release Notes\nSee [CHANGELOG.md](/CHANGELOG.md)\n" }, { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"name\": \"amzn/amazon-pay-magento-2-module\",\n\"description\": \"Official Magento2 Plugin to integrate with Amazon Pay\",\n\"type\": \"magento2-module\",\n- \"version\": \"5.4.0\",\n+ \"version\": \"5.5.0\",\n\"license\": [\n\"Apache-2.0\"\n],\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Version bumps and notes for 5.5.0 release
21,241
11.06.2021 09:28:18
18,000
40c644f9fbd22875ee773328409a4f70515a6864
Adjustments for php7.3
[ { "change_type": "MODIFY", "old_path": "Model/Config/AutoKeyExchange.php", "new_path": "Model/Config/AutoKeyExchange.php", "diff": "@@ -76,19 +76,71 @@ class AutoKeyExchange\n* @var AmazonConfig\n*/\nprivate $amazonConfig;\n- private \\Magento\\Framework\\App\\Config\\ConfigResource\\ConfigInterface $config;\n- private \\Magento\\Framework\\App\\Config\\ScopeConfigInterface $scopeConfig;\n- private \\Magento\\Framework\\App\\ProductMetadataInterface $productMeta;\n- private \\Magento\\Framework\\Encryption\\EncryptorInterface $encryptor;\n- private UrlInterface $backendUrl;\n- private \\Magento\\Framework\\App\\Cache\\Manager $cacheManager;\n- private \\Magento\\Framework\\App\\ResourceConnection $connection;\n- private State $state;\n- private \\Magento\\Framework\\App\\Request\\Http $request;\n- private \\Magento\\Store\\Model\\StoreManagerInterface $storeManager;\n- private \\Psr\\Log\\LoggerInterface $logger;\n- private \\Magento\\Framework\\Message\\ManagerInterface $messageManager;\n- private \\Magento\\Framework\\Math\\Random $mathRandom;\n+\n+ /**\n+ * @var \\Magento\\Framework\\App\\Config\\ConfigResource\\ConfigInterface\n+ */\n+ private $config;\n+\n+ /**\n+ * @var \\Magento\\Framework\\App\\Config\\ScopeConfigInterface\n+ */\n+ private $scopeConfig;\n+\n+ /**\n+ * @var \\Magento\\Framework\\App\\ProductMetadataInterface\n+ */\n+ private $productMeta;\n+\n+ /**\n+ * @var \\Magento\\Framework\\Encryption\\EncryptorInterface\n+ */\n+ private $encryptor;\n+\n+ /**\n+ * @var UrlInterface\n+ */\n+ private $backendUrl;\n+\n+ /**\n+ * @var \\Magento\\Framework\\App\\Cache\\Manager\n+ */\n+ private $cacheManager;\n+\n+ /**\n+ * @var \\Magento\\Framework\\App\\ResourceConnection\n+ */\n+ private $connection;\n+\n+ /**\n+ * @var State\n+ */\n+ private $state;\n+\n+ /**\n+ * @var \\Magento\\Framework\\App\\Request\\Http\n+ */\n+ private $request;\n+\n+ /**\n+ * @var \\Magento\\Store\\Model\\StoreManagerInterface\n+ */\n+ private $storeManager;\n+\n+ /**\n+ * @var \\Psr\\Log\\LoggerInterface\n+ */\n+ private $logger;\n+\n+ /**\n+ * @var \\Magento\\Framework\\Message\\ManagerInterface\n+ */\n+ private $messageManager;\n+\n+ /**\n+ * @var \\Magento\\Framework\\Math\\Random\n+ */\n+ private $mathRandom;\n/**\n* @param AmazonHelper $coreHelper\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Adjustments for php7.3
21,250
11.06.2021 12:56:47
10,800
142ead9084a0b1e141def108534ae01475248699
Fix admin JS for non US locale
[ { "change_type": "MODIFY", "old_path": "view/adminhtml/web/js/credentials.js", "new_path": "view/adminhtml/web/js/credentials.js", "diff": "@@ -33,21 +33,21 @@ require(['jquery', 'domReady!'], function ($) {\ne.preventDefault();\n// set selected type\n- $('#payment_us_amazon_pay_credentials_private_key_selected').val('pem');\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_selected\"]').val('pem');\n// uncheck inherit\n- $('#payment_us_amazon_pay_credentials_private_key_selected_inherit').prop('checked', true).click();\n+ $('input[id$=\"_amazon_pay_credentials_private_key_selected_inherit\"]').prop('checked', true).click();\n// hide text row\n- $('#row_payment_us_amazon_pay_credentials_private_key_text').hide();\n- $('#payment_us_amazon_pay_credentials_private_key_text').val('------');\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_text\"]').hide();\n+ $('textarea[id$=\"_amazon_pay_credentials_private_key_text\"]').val('------');\n// hide selector row & make non-inherited\n- $('#row_payment_us_amazon_pay_credentials_private_key_selector').hide();\n- $('#row_payment_us_amazon_pay_credentials_private_key_selector_inherit').prop('checked', true).click()\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_selector\"]').hide();\n+ $('input[id$=\"_amazon_pay_credentials_private_key_selector_inherit\"]').prop('checked', true).click()\n// remove saved file feedback text\n$('#amazon_pay_private_key_pem_file_saved_msg').html('');\n// show pem row\n- $('#row_payment_us_amazon_pay_credentials_private_key_pem').show();\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_pem\"]').show();\n// click pem choose file button\n- $('#payment_us_amazon_pay_credentials_private_key_pem').click();\n+ $('textarea[id$=\"_amazon_pay_credentials_private_key_pem\"]').click();\n});\n// private key select text\n@@ -55,18 +55,18 @@ require(['jquery', 'domReady!'], function ($) {\ne.preventDefault();\n// set selected type\n- $('#payment_us_amazon_pay_credentials_private_key_selected').val('text');\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_selected\"]').val('text');\n// uncheck inherit\n- $('#payment_us_amazon_pay_credentials_private_key_selected_inherit').prop('checked', true).click();\n+ $('input[id$=\"_amazon_pay_credentials_private_key_selected_inherit\"]').prop('checked', true).click();\n// hide file row\n- $('#row_payment_us_amazon_pay_credentials_private_key_pem').hide();\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_pem\"]').hide();\n// hide selector row & make non-inherited\n- $('#row_payment_us_amazon_pay_credentials_private_key_selector').hide();\n- $('#row_payment_us_amazon_pay_credentials_private_key_selector_inherit').prop('checked', true).click()\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_selector\"]').hide();\n+ $('input[id$=\"_amazon_pay_credentials_private_key_selector_inherit\"]').prop('checked', true).click()\n// show text area row\n- $('#row_payment_us_amazon_pay_credentials_private_key_text').show();\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_text\"]').show();\n// focus on field\n- $('#payment_us_amazon_pay_credentials_private_key_text').val('').focus();\n+ $('textarea[id$=\"_amazon_pay_credentials_private_key_text\"]').val('').focus();\n});\n// change key type\n@@ -74,45 +74,45 @@ require(['jquery', 'domReady!'], function ($) {\ne.preventDefault();\n// reset selected type\n- $('#payment_us_amazon_pay_credentials_private_key_selected').val('');\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_selected\"]').val('');\n// check inherit\n- $('#payment_us_amazon_pay_credentials_private_key_selected_inherit').prop('checked', false).click();\n+ $('input[id$=\"_amazon_pay_credentials_private_key_selected_inherit\"]').prop('checked', false).click();\n// set text field\n- $('#payment_us_amazon_pay_credentials_private_key_text').val('------');\n+ $('textarea[id$=\"_amazon_pay_credentials_private_key_text\"]').val('------');\n// hide pem row\n- $('#row_payment_us_amazon_pay_credentials_private_key_pem').hide();\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_pem\"]').hide();\n// hide text row\n- $('#row_payment_us_amazon_pay_credentials_private_key_text').hide();\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_text\"]').hide();\n// show selector row\n- $('#row_payment_us_amazon_pay_credentials_private_key_selector').show();\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_selector\"]').show();\n});\n- $('#payment_us_amazon_pay_credentials-head').click(function () {\n- showPrivateKey($(this), $('#payment_us_amazon_pay_credentials_active_v2').val() == 1);\n+ $('a[id$=\"_amazon_pay_credentials-head\"]').click(function () {\n+ showPrivateKey($(this), $('select[id$=\"_amazon_pay_credentials_active_v2\"]').val() == 1);\n});\n- $('#payment_us_amazon_pay_credentials_active_v2').change(function () {\n+ $('select[id$=\"_amazon_pay_credentials_active_v2\"]').change(function () {\nshowPrivateKey($(this), $(this).val() == 1);\n});\nfunction showPrivateKey(field, enabled) {\nif (enabled) {\n- let value = $('#payment_us_amazon_pay_credentials_private_key_selected').val();\n+ let value = $('input[id$=\"_amazon_pay_credentials_private_key_selected\"]').val();\nif (value === 'pem') {\n- $('#row_payment_us_amazon_pay_credentials_private_key_selector').hide();\n- $('#row_payment_us_amazon_pay_credentials_private_key_pem').show();\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_selector\"]').hide();\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_pem\"]').show();\n} else if (value === 'text') {\n- $('#row_payment_us_amazon_pay_credentials_private_key_selector').hide();\n- $('#row_payment_us_amazon_pay_credentials_private_key_text').show();\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_selector\"]').hide();\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_text\"]').show();\n} else {\n- $('#row_payment_us_amazon_pay_credentials_private_key_selector').show();\n- $('#payment_us_amazon_pay_credentials_private_key_text').val('------');\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_selector\"]').show();\n+ $('textarea[id$=\"_amazon_pay_credentials_private_key_text\"]').val('------');\n}\n}\nelse {\n- $('#row_payment_us_amazon_pay_credentials_private_key_selector').hide();\n- $('#row_payment_us_amazon_pay_credentials_private_key_pem').hide();\n- $('#row_payment_us_amazon_pay_credentials_private_key_text').hide();\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_selector\"]').hide();\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_pem\"]').hide();\n+ $('tr[id$=\"_amazon_pay_credentials_private_key_text\"]').hide();\n}\n}\n});\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Fix admin JS for non US locale
21,241
11.06.2021 10:52:45
18,000
8f9a8a81299d61a2e49362ae4f5e9435991891c2
update styling of buttons, and use scope for setting sandbox mode when using auto key exchange
[ { "change_type": "MODIFY", "old_path": "Model/Config/AutoKeyExchange.php", "new_path": "Model/Config/AutoKeyExchange.php", "diff": "@@ -439,7 +439,9 @@ class AutoKeyExchange\n}\n$this->config->saveConfig(\n'payment/amazon_payment/sandbox',\n- '0'\n+ '0',\n+ $this->_scope,\n+ $this->_scopeId\n);\nif ($autoEnable) {\n" }, { "change_type": "MODIFY", "old_path": "etc/adminhtml/system.xml", "new_path": "etc/adminhtml/system.xml", "diff": "<config_path>payment/amazon_payment/payment_region</config_path>\n<depends><field id=\"active_v2\">1</field></depends>\n</field>\n- <field id=\"sandbox\" translate=\"label\" type=\"select\" sortOrder=\"70\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"0\">\n+ <field id=\"sandbox\" translate=\"label\" type=\"select\" sortOrder=\"70\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>Sandbox</label>\n<source_model>Magento\\Config\\Model\\Config\\Source\\Yesno</source_model>\n<config_path>payment/amazon_payment/sandbox</config_path>\n" }, { "change_type": "MODIFY", "old_path": "view/adminhtml/web/css/source/_module.less", "new_path": "view/adminhtml/web/css/source/_module.less", "diff": "@@ -31,3 +31,9 @@ tr[id$='_amazon_pay_credentials_private_key_selector'] {\ndisplay: none;\ncolor: red;\n}\n+\n+#autokeyexchange_form {\n+ button {\n+ width: 320px;\n+ }\n+}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
APF-310 - update styling of buttons, and use scope for setting sandbox mode when using auto key exchange
21,239
09.06.2021 16:19:29
-7,200
b6eeeef91b8c5b5ead6a42c82b4b4ab67958e8a2
Fixing issue of matching another website customer with the same email
[ { "change_type": "MODIFY", "old_path": "Model/Customer/IdMatcher.php", "new_path": "Model/Customer/IdMatcher.php", "diff": "@@ -19,6 +19,7 @@ use Amazon\\Pay\\Api\\Data\\AmazonCustomerInterface;\nuse Amazon\\Pay\\Model\\Customer\\MatcherInterface;\nuse Magento\\Customer\\Api\\CustomerRepositoryInterface;\nuse Magento\\Framework\\Api\\SearchCriteriaBuilder;\n+use Magento\\Store\\Model\\StoreManagerInterface;\nclass IdMatcher implements MatcherInterface\n{\n@@ -32,18 +33,24 @@ class IdMatcher implements MatcherInterface\n*/\nprivate $searchCriteriaBuilder;\n+ /** @var StoreManagerInterface */\n+ private $storeManager;\n+\n/**\n* IdMatcher constructor.\n*\n* @param CustomerRepositoryInterface $customerRepository\n* @param SearchCriteriaBuilder $searchCriteriaBuilder\n+ * @param StoreManagerInterface $storeManager\n*/\npublic function __construct(\nCustomerRepositoryInterface $customerRepository,\n- SearchCriteriaBuilder $searchCriteriaBuilder\n+ SearchCriteriaBuilder $searchCriteriaBuilder,\n+ StoreManagerInterface $storeManager\n) {\n$this->customerRepository = $customerRepository;\n$this->searchCriteriaBuilder = $searchCriteriaBuilder;\n+ $this->storeManager = $storeManager;\n}\n/**\n@@ -54,6 +61,9 @@ class IdMatcher implements MatcherInterface\n$this->searchCriteriaBuilder->addFilter(\n'amazon_id',\n$amazonCustomer->getId()\n+ )->addFilter(\n+ 'website_id',\n+ $this->storeManager->getWebsite()->getId()\n);\n$searchCriteria = $this->searchCriteriaBuilder\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Fixing issue of matching another website customer with the same email
21,241
14.06.2021 09:43:41
18,000
96a08e0031d2e3a84518104216edc91a16e72e1f
Fix php7.3 issue with variable type hinting
[ { "change_type": "MODIFY", "old_path": "Controller/Adminhtml/Pay/ResetAutoKey.php", "new_path": "Controller/Adminhtml/Pay/ResetAutoKey.php", "diff": "@@ -29,9 +29,20 @@ use Magento\\Framework\\App\\Config\\ConfigResource\\ConfigInterface;\n*/\nclass ResetAutoKey extends System\n{\n- private ConfigInterface $config;\n- private Manager $cacheManager;\n- private JsonFactory $jsonResultFactory;\n+ /**\n+ * @var ConfigInterface\n+ */\n+ private $config;\n+\n+ /**\n+ * @var Manager\n+ */\n+ private $cacheManager;\n+\n+ /**\n+ * @var JsonFactory\n+ */\n+ private $jsonResultFactory;\n/**\n* @param Context $context\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Fix php7.3 issue with variable type hinting
21,241
15.06.2021 12:40:23
18,000
d2746c4d79b97cfd95740af66b48391bdf115477
Remove dependency on laminas module due to incompatibility with older Magneto 2.3.0
[ { "change_type": "MODIFY", "old_path": "Controller/AutoKeyExchange/Listener.php", "new_path": "Controller/AutoKeyExchange/Listener.php", "diff": "@@ -41,11 +41,6 @@ class Listener extends \\Magento\\Framework\\App\\Action\\Action implements CsrfAware\n*/\nprivate $exceptionLogger;\n- /**\n- * @var \\Laminas\\Uri\\Http\n- */\n- private $uri;\n-\n/**\n* Listener constructor.\n* @param \\Magento\\Framework\\App\\Action\\Context $context\n@@ -57,12 +52,10 @@ class Listener extends \\Magento\\Framework\\App\\Action\\Action implements CsrfAware\n\\Magento\\Framework\\App\\Action\\Context $context,\n\\Magento\\Framework\\Controller\\Result\\JsonFactory $jsonResultFactory,\n\\Amazon\\Pay\\Model\\Config\\AutoKeyExchange $autokeyexchange,\n- \\Laminas\\Uri\\Http $uri,\nExceptionLogger $exceptionLogger = null\n) {\n$this->autokeyexchange = $autokeyexchange;\n$this->jsonResultFactory = $jsonResultFactory;\n- $this->uri = $uri;\n$this->exceptionLogger = $exceptionLogger ?: ObjectManager::getInstance()->get(ExceptionLogger::class);\nparent::__construct($context);\n}\n@@ -74,7 +67,7 @@ class Listener extends \\Magento\\Framework\\App\\Action\\Action implements CsrfAware\n{\ntry {\n$originHeader = $this->getRequest()->getHeader('Origin');\n- if (!empty($originHeader) && $host = $this->uri->parse($originHeader)->getHost()) {\n+ if (!empty($originHeader) && $host = parse_url($originHeader, PHP_URL_HOST)) {\nif (in_array($host, $this->autokeyexchange->getListenerOrigins())) {\n$this->getResponse()->setHeader('Access-Control-Allow-Origin', 'https://' . $host);\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Remove dependency on laminas module due to incompatibility with older Magneto 2.3.0
21,241
16.06.2021 16:25:55
18,000
dcb25483ef224f5af095ba0d7f5b88d6808f64d3
add to csp whitelist
[ { "change_type": "MODIFY", "old_path": "etc/csp_whitelist.xml", "new_path": "etc/csp_whitelist.xml", "diff": "<value id=\"media_amazon_fr\" type=\"host\">*.media-amazon.fr</value>\n<value id=\"media_amazon_es\" type=\"host\">*.media-amazon.es</value>\n<value id=\"media_amazon_de\" type=\"host\">*.media-amazon.de</value>\n+ <value id=\"static-eu_payments-amazon_com\" type=\"host\">static-eu.payments-amazon.com</value>\n</values>\n</policy>\n<policy id=\"form-action\">\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-723 - add to csp whitelist
21,241
17.06.2021 11:30:04
18,000
fd4a88c61fd69cd0a5454969a92a3e072caeae03
don't send stateOrRegion for a few specific countries due to amazon failing address validation if included
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -510,11 +510,15 @@ class AmazonPayAdapter\n$addressData = [\n'name' => $address->getName(),\n'city' => $address->getCity(),\n- 'stateOrRegion' => $address->getRegionCode(),\n'postalCode' => $address->getPostcode(),\n'countryCode' => $address->getCountry(),\n'phoneNumber' => $address->getTelephone(),\n];\n+ // do not submit stateOrRegion for these EU countries as it will fail validation, see EU tab on\n+ // https://developer.amazon.com/docs/amazon-pay-checkout/address-formatting-and-validation.html\n+ if (!in_array($address->getCountry(), ['UK', 'GB', 'SG', 'AE', 'MX'])) {\n+ $addressData['stateOrRegion'] = $address->getRegionCode();\n+ }\nforeach ($address->getStreet() as $index => $streetLine) {\n$addressKey = 'addressLine' . ($index + 1);\n$addressData[$addressKey] = $streetLine;\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-719 - don't send stateOrRegion for a few specific countries due to amazon failing address validation if included
21,241
17.06.2021 11:30:34
18,000
978ed8a6bdfb191b3abd5647619df91a38830436
Remove unused function and clean up phpcs output
[ { "change_type": "MODIFY", "old_path": "Controller/AutoKeyExchange/Listener.php", "new_path": "Controller/AutoKeyExchange/Listener.php", "diff": "@@ -67,6 +67,7 @@ class Listener extends \\Magento\\Framework\\App\\Action\\Action implements CsrfAware\n{\ntry {\n$originHeader = $this->getRequest()->getHeader('Origin');\n+ // phpcs:ignore Magento2.Functions.DiscouragedFunction\nif (!empty($originHeader) && $host = parse_url($originHeader, PHP_URL_HOST)) {\nif (in_array($host, $this->autokeyexchange->getListenerOrigins())) {\n$this->getResponse()->setHeader('Access-Control-Allow-Origin', 'https://' . $host);\n@@ -101,41 +102,6 @@ class Listener extends \\Magento\\Framework\\App\\Action\\Action implements CsrfAware\n}\n}\n- /**\n- * Overridden to allow POST without form key\n- *\n- * @return bool\n- */\n- public function _processUrlKeys()\n- {\n- $_isValidFormKey = true;\n- $_isValidSecretKey = true;\n- $_keyErrorMsg = '';\n- if ($this->_auth->isLoggedIn()) {\n- if ($this->_backendUrl->useSecretKey()) {\n- $_isValidSecretKey = $this->_validateSecretKey();\n- $_keyErrorMsg = __('You entered an invalid Secret Key. Please refresh the page.');\n- }\n- }\n- if (!$_isValidFormKey || !$_isValidSecretKey) {\n- $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);\n- $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true);\n- if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) {\n- $this->getResponse()->representJson(\n- $this->_objectManager->get(\n- \\Magento\\Framework\\Json\\Helper\\Data::class\n- )->jsonEncode(\n- ['error' => true, 'message' => $_keyErrorMsg]\n- )\n- );\n- } else {\n- $this->_redirect($this->_backendUrl->getStartupPageUrl());\n- }\n- return false;\n- }\n- return true;\n- }\n-\n/**\n* @inheritDoc\n*/\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Remove unused function and clean up phpcs output
21,241
17.06.2021 12:36:53
18,000
57b30ea0e955684745be30e976bb2558c753773a
Version bump to 5.5.1 and update changelog
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "# Change Log\n+## 5.5.1\n+* Add url to csp_whitelist.xml\n+* Fix issue with the payment method button and UK addresses\n+\n## 5.5.0\n* Added Auto Key Exchange for configuring the credentials\n* Added PayNow functionality for the button on the final step of checkout\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -48,7 +48,7 @@ The following table provides an overview on which Git branch is compatible to wh\nMagento Version | Github Branch | Latest release\n---|---|---\n2.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)\n-2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.5.0\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.5.1\n## Release Notes\nSee [CHANGELOG.md](/CHANGELOG.md)\n" }, { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"name\": \"amzn/amazon-pay-magento-2-module\",\n\"description\": \"Official Magento2 Plugin to integrate with Amazon Pay\",\n\"type\": \"magento2-module\",\n- \"version\": \"5.5.0\",\n+ \"version\": \"5.5.1\",\n\"license\": [\n\"Apache-2.0\"\n],\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Version bump to 5.5.1 and update changelog
21,241
17.06.2021 13:28:08
18,000
39779a4645d0aafd97b06f1b0338c3186f403f15
Remove any null values from addressData in PayNow payload generation
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -524,6 +524,8 @@ class AmazonPayAdapter\n$addressData[$addressKey] = $streetLine;\n}\n+ $addressData = array_filter($addressData);\n+\n$payload['addressDetails'] = $addressData;\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Remove any null values from addressData in PayNow payload generation
21,241
22.06.2021 12:42:37
18,000
07debe85bccfe3a5ab76ac62ec594ccbc8c79ec3
ensure we have a payment method set, particularly necessary for 3rd party checkout or the Pay Now button if set-payment-information ajax call doesn't happen for some reason
[ { "change_type": "MODIFY", "old_path": "Model/CheckoutSessionManagement.php", "new_path": "Model/CheckoutSessionManagement.php", "diff": "namespace Amazon\\Pay\\Model;\nuse Amazon\\Pay\\Api\\Data\\CheckoutSessionInterface;\n+use Amazon\\Pay\\Gateway\\Config\\Config;\nuse Amazon\\Pay\\Model\\Config\\Source\\AuthorizationMode;\nuse Amazon\\Pay\\Model\\Config\\Source\\PaymentAction;\nuse Amazon\\Pay\\Model\\AsyncManagement;\n@@ -583,6 +584,11 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n// can work as expected\n$payment = $this->magentoCheckoutSession->getQuote()->getPayment();\n+ // Some checkout flows (especially 3rd party) could get to this point without setting payment method\n+ if (empty($payment->getMethod())) {\n+ $payment->setMethod(Config::CODE);\n+ }\n+\n// set amazon session id on payment object to be used in authorize\n$payment->setAdditionalInformation('amazon_session_id', $amazonSessionId);\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-719 - ensure we have a payment method set, particularly necessary for 3rd party checkout or the Pay Now button if set-payment-information ajax call doesn't happen for some reason
21,266
22.06.2021 16:37:55
14,400
7f8c65692f2c1e19636601c735149de849813254
Update MFTFs for
[ { "change_type": "ADD", "old_path": null, "new_path": "Command/Sales/AmazonChargePermissionCommand.php", "diff": "+<?php\n+\n+namespace Amazon\\Pay\\Command\\Sales;\n+\n+use Symfony\\Component\\Console\\Command\\Command;\n+use Symfony\\Component\\Console\\Input\\InputInterface;\n+use Symfony\\Component\\Console\\Input\\InputOption;\n+use Symfony\\Component\\Console\\Output\\OutputInterface;\n+use Magento\\Sales\\Api\\Data\\OrderInterface;\n+\n+class AmazonChargePermissionCommand extends Command {\n+\n+ const ORDER_ID = 'orderId';\n+\n+ /**\n+ * @var \\Magento\\Framework\\App\\State $state\n+ */\n+ private $state;\n+\n+ /**\n+ * @var \\Magento\\Sales\\Model\\OrderRepository $orderRepository\n+ */\n+ private $orderRepository;\n+\n+ /**\n+ * @var \\Amazon\\Pay\\Model\\Adapter\\AmazonPayAdapter $amazonAdapter\n+ */\n+ private $amazonAdapter;\n+\n+ /**\n+ * @var \\Magento\\Framework\\Api\\SearchCriteriaBuilder $searchCriteriaBuilder\n+ */\n+ private $searchCriteriaBuilder;\n+\n+ public function __construct(\n+ \\Magento\\Framework\\App\\State $state,\n+ \\Magento\\Sales\\Model\\OrderRepository $orderRepository,\n+ \\Amazon\\Pay\\Model\\Adapter\\AmazonPayAdapter $amazonAdapter,\n+ \\Magento\\Framework\\Api\\SearchCriteriaBuilder $searchCriteriaBuilder\n+ ) {\n+ $this->state = $state;\n+ $this->orderRepository = $orderRepository;\n+ $this->amazonAdapter = $amazonAdapter;\n+ $this->searchCriteriaBuilder = $searchCriteriaBuilder;\n+\n+ parent::__construct();\n+ }\n+\n+ protected function configure()\n+ {\n+ $this->setName('amazon:payment:sales:cp-verify');\n+ $this->addOption(\n+ self::ORDER_ID,\n+ null,\n+ InputOption::VALUE_REQUIRED,\n+ 'OrderId'\n+ );\n+\n+ parent::configure();\n+ }\n+\n+ protected function execute(InputInterface $input, OutputInterface $output)\n+ {\n+ $this->state->setAreaCode(\\Magento\\Framework\\App\\Area::AREA_ADMINHTML);\n+\n+ if ($orderId = $input->getOption(self::ORDER_ID)) {\n+ $searchCriteria = $this->searchCriteriaBuilder\n+ ->addFilter(OrderInterface::INCREMENT_ID, $orderId)->create();\n+\n+ $orderResults = $this->orderRepository->getList($searchCriteria)->getItems();\n+ $order = reset($orderResults);\n+ $storeId = $order->getStoreId();\n+ $chargePermissionId = $order->getPayment()->getAdditionalInformation('charge_permission_id');\n+\n+ try {\n+ $resp = $this->amazonAdapter->getChargePermission($storeId, $chargePermissionId);\n+ } catch (\\Exception $ex) { }\n+\n+ $referenceID = $resp['merchantMetadata']['merchantReferenceId'];\n+ $output->write('<info>' . $referenceID . '</info>');\n+ }\n+ }\n+\n+}\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Test/AmazonCheckoutSuccessTest.xml", "new_path": "Test/Mftf-23/Test/AmazonCheckoutSuccessTest.xml", "diff": "<argument name=\"orderNumberMessage\" value=\"CONST.successGuestCheckoutOrderNumberMessage\" />\n<argument name=\"emailYouMessage\" value=\"CONST.successCheckoutEmailYouMessage\" />\n</actionGroup>\n+\n+ <grabTextFrom selector=\"{{CheckoutSuccessMainSection.orderNumber}}\" stepKey=\"orderNumber\" />\n+ <magentoCLI command=\"amazon:payment:sales:cp-verify\" arguments=\"--orderId {$orderNumber}\" stepKey=\"command\" />\n+ <assertEquals stepKey=\"refIdAssert\">\n+ <actualResult type=\"string\">\"${command}\"</actualResult>\n+ <expectedResult type=\"string\">\"${orderNumber}\"</expectedResult>\n+ </assertEquals>\n</test>\n</tests>\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml", "new_path": "Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml", "diff": "<argument name=\"orderNumberMessage\" value=\"CONST.successGuestCheckoutOrderNumberMessage\" />\n<argument name=\"emailYouMessage\" value=\"CONST.successCheckoutEmailYouMessage\" />\n</actionGroup>\n+\n+ <grabTextFrom selector=\"{{CheckoutSuccessMainSection.orderNumber}}\" stepKey=\"orderNumber\" />\n+ <magentoCLI command=\"amazon:payment:sales:cp-verify\" arguments=\"--orderId {$orderNumber}\" stepKey=\"command\" />\n+ <assertEquals stepKey=\"refIdAssert\">\n+ <actualResult type=\"string\">\"${command}\"</actualResult>\n+ <expectedResult type=\"string\">\"${orderNumber}\"</expectedResult>\n+ </assertEquals>\n</test>\n</tests>\n" }, { "change_type": "MODIFY", "old_path": "etc/di.xml", "new_path": "etc/di.xml", "diff": "</arguments>\n</type>\n+ <type name=\"Magento\\Framework\\Console\\CommandList\">\n+ <arguments>\n+ <argument name=\"commands\" xsi:type=\"array\">\n+ <item name=\"AmazonChargePermissionCommand\" xsi:type=\"object\">Amazon\\Pay\\Command\\Sales\\AmazonChargePermissionCommand</item>\n+ </argument>\n+ </arguments>\n+ </type>\n+\n<!-- Loggers -->\n<type name=\"Amazon\\Pay\\Logger\\AlexaLogger\">\n<arguments>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Update MFTFs for ASD-720
21,266
22.06.2021 16:49:35
14,400
24890d543077241db5f256e4db944d0a5c410f1e
Update tests to use switchToPopup action group
[ { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Test/AmazonCheckoutLoginTest.xml", "new_path": "Test/Mftf-23/Test/AmazonCheckoutLoginTest.xml", "diff": "<!--Go to Amazon Pay from the checkout and login-->\n<click selector=\"{{AmazonButtonSection.checkout}}\" stepKey=\"clickAmazonButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen\"/>\n- <switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"AmazonLoginActionGroup\"/>\n</test>\n</tests>\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Test/AmazonMiniCartLoginTest.xml", "new_path": "Test/Mftf-23/Test/AmazonMiniCartLoginTest.xml", "diff": "<!--Go to Amazon Pay from the mini cart and login-->\n<click selector=\"{{AmazonButtonSection.miniCart}}\" stepKey=\"clickAmazonButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen\"/>\n- <switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"amazonLoginActionGroup\"/>\n</test>\n</tests>\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Test/AmazonPaymentLoginTest.xml", "new_path": "Test/Mftf-23/Test/AmazonPaymentLoginTest.xml", "diff": "<!--Go to Amazon Pay from the payment method and login-->\n<wait time=\"1\" stepKey=\"allowButtonToActivate\"/>\n<click selector=\"{{AmazonButtonSection.payment}}\" stepKey=\"clickAmazonButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen\"/>\n- <switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"AmazonLoginActionGroup\"/>\n</test>\n</tests>\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Test/AmazonProductLoginTest.xml", "new_path": "Test/Mftf-23/Test/AmazonProductLoginTest.xml", "diff": "<!--Add to cart via Amazon Pay button on product page and login-->\n<click selector=\"{{AmazonButtonSection.product}}\" stepKey=\"clickAmazonButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen\"/>\n- <switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"amazonLoginActionGroup\"/>\n</test>\n</tests>\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Test/AmazonShippingAddressTest.xml", "new_path": "Test/Mftf-23/Test/AmazonShippingAddressTest.xml", "diff": "<executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n<!--Change shipping address-->\n<click selector=\"{{AmazonCheckoutSection.editShippingButton}}\" stepKey=\"clickAmazonEditShippingButton\"/>\n- <wait time=\"1\" stepKey=\"allowButtonToActivate\"/>\n- <switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<waitForElement selector=\"{{AmazonPageSection.changeAddressButton}}\" stepKey=\"waitForAmazonEditShippingPageLoad\"/>\n<click selector=\"{{AmazonPageSection.changeAddressButton}}\" stepKey=\"clickChangeAmazonAddressButton\"/>\n<click selector=\"{{AmazonPageSection.notSelectedAddress}}\" stepKey=\"clickNotSelectedAmazonAddress\"/>\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Test/AmazonSignInToExistingTest.xml", "new_path": "Test/Mftf-23/Test/AmazonSignInToExistingTest.xml", "diff": "<!--Verify Sign in with Amazon Button is present again-->\n<click selector=\"{{AmazonLoginSection.login}}\" stepKey=\"clickSignInWithAmazonButton2\"/>\n- <wait time=\"1\" stepKey=\"allowButtonToActivate\"/>\n- <switchToNextTab stepKey=\"switchToLoginWindow\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<!-- make sure we are logged out from Amazon by clearing ubid-main cookie -->\n<resetCookie userInput=\"ubid-main\" parameterArray=\"['domainName' => '.amazon.com']\" stepKey=\"resetCookieForAmazon\"/>\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonCheckoutLoginTest.xml", "new_path": "Test/Mftf-24/Test/AmazonCheckoutLoginTest.xml", "diff": "<!--Go to Amazon Pay from the checkout and login-->\n<click selector=\"{{AmazonButtonSection.checkout}}\" stepKey=\"clickAmazonButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen\"/>\n- <switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"AmazonLoginActionGroup\"/>\n</test>\n</tests>\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonMiniCartLoginTest.xml", "new_path": "Test/Mftf-24/Test/AmazonMiniCartLoginTest.xml", "diff": "<!--Go to Amazon Pay from the mini cart and login-->\n<click selector=\"{{AmazonButtonSection.miniCart}}\" stepKey=\"clickAmazonButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen\"/>\n- <switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"amazonLoginActionGroup\"/>\n</test>\n</tests>\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonPaymentLoginTest.xml", "new_path": "Test/Mftf-24/Test/AmazonPaymentLoginTest.xml", "diff": "<!--Go to Amazon Pay from the payment method and login-->\n<wait time=\"1\" stepKey=\"allowButtonToActivate\"/>\n<click selector=\"{{AmazonButtonSection.payment}}\" stepKey=\"clickAmazonButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen\"/>\n- <switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"AmazonLoginActionGroup\"/>\n</test>\n</tests>\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonProductLoginTest.xml", "new_path": "Test/Mftf-24/Test/AmazonProductLoginTest.xml", "diff": "<!--Add to cart via Amazon Pay button on product page and login-->\n<click selector=\"{{AmazonButtonSection.product}}\" stepKey=\"clickAmazonButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen\"/>\n- <switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"amazonLoginActionGroup\"/>\n</test>\n</tests>\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonShippingAddressTest.xml", "new_path": "Test/Mftf-24/Test/AmazonShippingAddressTest.xml", "diff": "<executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n<!--Change shipping address-->\n<click selector=\"{{AmazonCheckoutSection.editShippingButton}}\" stepKey=\"clickAmazonEditShippingButton\"/>\n- <wait time=\"1\" stepKey=\"allowButtonToActivate\"/>\n- <switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<waitForElement selector=\"{{AmazonPageSection.changeAddressButton}}\" stepKey=\"waitForAmazonEditShippingPageLoad\"/>\n<click selector=\"{{AmazonPageSection.changeAddressButton}}\" stepKey=\"clickChangeAmazonAddressButton\"/>\n<click selector=\"{{AmazonPageSection.notSelectedAddress}}\" stepKey=\"clickNotSelectedAmazonAddress\"/>\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonSignInToExistingTest.xml", "new_path": "Test/Mftf-24/Test/AmazonSignInToExistingTest.xml", "diff": "<!--Verify Sign in with Amazon Button is present again-->\n<click selector=\"{{AmazonLoginSection.login}}\" stepKey=\"clickSignInWithAmazonButton2\"/>\n- <wait time=\"1\" stepKey=\"allowButtonToActivate\"/>\n- <switchToNextTab stepKey=\"switchToLoginWindow\"/>\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<!-- make sure we are logged out from Amazon by clearing ubid-main cookie -->\n<resetCookie userInput=\"ubid-main\" parameterArray=\"['domainName' => '.amazon.com']\" stepKey=\"resetCookieForAmazon\"/>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Update tests to use switchToPopup action group
21,266
23.06.2021 08:30:03
14,400
f9e99bcd8576965457e894356495b84f45daa3f9
Remove hard waits for popups from action groups
[ { "change_type": "MODIFY", "old_path": "Test/Mftf-23/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml", "new_path": "Test/Mftf-23/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml", "diff": "<wait time=\"1\" stepKey=\"allowButtonToActivate\"/>\n<click selector=\"{{buttonSelector}}\" stepKey=\"clickAmazonButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen\"/>\n+ <executeInSelenium function=\"function(\\Facebook\\WebDriver\\Remote\\RemoteWebDriver $webdriver) {$webdriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::numberOfWindowsToBe(2));}\" stepKey=\"allowPopupToOpen\" />\n<switchToNextTab stepKey=\"switchToLoginPopupWindow\"/>\n<!-- Fill in login form -->\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-23/ActionGroup/AmazonLoginOnlyActionGroup.xml", "new_path": "Test/Mftf-23/ActionGroup/AmazonLoginOnlyActionGroup.xml", "diff": "<!--Verify Sign in with Amazon Button is present-->\n<click selector=\"{{buttonSelector}}\" stepKey=\"clickSignInWithAmazonButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen\"/>\n+ <executeInSelenium function=\"function(\\Facebook\\WebDriver\\Remote\\RemoteWebDriver $webdriver) {$webdriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::numberOfWindowsToBe(2));}\" stepKey=\"allowPopupToOpen\" />\n<switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n<waitForElement selector=\"{{AmazonPageSection.emailField}}\" stepKey=\"waitForEmailField\"/>\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml", "new_path": "Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml", "diff": "<wait time=\"1\" stepKey=\"allowButtonToActivate\"/>\n<click selector=\"{{buttonSelector}}\" stepKey=\"clickAmazonButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen\"/>\n+ <helper class=\"\\Amazon\\Pay\\Test\\Mftf\\Helper\\WaitForPopup\" method=\"waitForPopup\" stepKey=\"allowPopupToOpen\" />\n<switchToNextTab stepKey=\"switchToLoginPopupWindow\"/>\n<!-- Fill in login form -->\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/ActionGroup/AmazonLoginOnlyActionGroup.xml", "new_path": "Test/Mftf-24/ActionGroup/AmazonLoginOnlyActionGroup.xml", "diff": "<!--Verify Sign in with Amazon Button is present-->\n<click selector=\"{{buttonSelector}}\" stepKey=\"clickSignInWithAmazonButton\"/>\n- <wait time=\"1\" stepKey=\"allowPopupToOpen\"/>\n+ <helper class=\"\\Amazon\\Pay\\Test\\Mftf\\Helper\\WaitForPopup\" method=\"waitForPopup\" stepKey=\"allowPopupToOpen\" />\n<switchToNextTab stepKey=\"switchToWindowLoginPopup\"/>\n<waitForElement selector=\"{{AmazonPageSection.emailField}}\" stepKey=\"waitForEmailField\"/>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Remove hard waits for popups from action groups
21,266
25.06.2021 09:36:32
14,400
6810cb2f5bf6924b1f4b7401006a8904545009ad
Clean up smells and add error checks
[ { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Test/AmazonCheckoutSuccessTest.xml", "new_path": "Test/Mftf-23/Test/AmazonCheckoutSuccessTest.xml", "diff": "</actionGroup>\n<grabTextFrom selector=\"{{CheckoutSuccessMainSection.orderNumber}}\" stepKey=\"orderNumber\" />\n- <magentoCLI command=\"amazon:payment:sales:cp-verify\" arguments=\"--orderId {$orderNumber}\" stepKey=\"command\" />\n+ <magentoCLI command=\"amazon:payment:sales:verify-charge-permission\" arguments=\"--orderId {$orderNumber}\" stepKey=\"command\" />\n<assertEquals stepKey=\"refIdAssert\">\n- <actualResult type=\"string\">\"${command}\"</actualResult>\n- <expectedResult type=\"string\">\"${orderNumber}\"</expectedResult>\n+ <actualResult type=\"string\">${command}</actualResult>\n+ <expectedResult type=\"string\">true\\n</expectedResult>\n</assertEquals>\n</test>\n</tests>\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml", "new_path": "Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml", "diff": "<argument name=\"emailYouMessage\" value=\"CONST.successCheckoutEmailYouMessage\" />\n</actionGroup>\n+\n<grabTextFrom selector=\"{{CheckoutSuccessMainSection.orderNumber}}\" stepKey=\"orderNumber\" />\n- <magentoCLI command=\"amazon:payment:sales:cp-verify\" arguments=\"--orderId {$orderNumber}\" stepKey=\"command\" />\n+ <magentoCLI command=\"amazon:payment:sales:verify-charge-permission\" arguments=\"--orderId {$orderNumber}\" stepKey=\"command\" />\n<assertEquals stepKey=\"refIdAssert\">\n- <actualResult type=\"string\">\"${command}\"</actualResult>\n- <expectedResult type=\"string\">\"${orderNumber}\"</expectedResult>\n+ <actualResult type=\"string\">${command}</actualResult>\n+ <expectedResult type=\"string\">true\\n</expectedResult>\n</assertEquals>\n</test>\n</tests>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-720 - Clean up smells and add error checks
21,241
29.06.2021 12:18:24
18,000
0ec11806241cd1c0ee3fc02ad6c1315fa90b28dc
handle empty lines in address data
[ { "change_type": "MODIFY", "old_path": "Domain/AmazonAddress.php", "new_path": "Domain/AmazonAddress.php", "diff": "@@ -61,11 +61,12 @@ class AmazonAddress extends \\Magento\\Framework\\DataObject implements AmazonAddre\n{\nwhile ($times > 0) {\n$lines = $this->getData(AmazonAddressInterface::LINES);\n+ $newlines = [];\n$numberOfLines = count($lines);\nfor ($i = 1; $i <= $numberOfLines; $i++) {\n- $lines[$i] = isset($lines[$i + 1]) ? $lines[$i + 1] : '';\n+ $newlines[$i] = isset($lines[$i + 1]) ? $lines[$i + 1] : '';\n}\n- $this->setData(AmazonAddressInterface::LINES, $lines);\n+ $this->setData(AmazonAddressInterface::LINES, $newlines);\n$times--;\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-731 - handle empty lines in address data
21,241
01.07.2021 10:48:43
18,000
1852d4fb652f96e589e6228ddbb9cf97080c6307
when payment info is edited, send the customer back through to re-select shipping because that could have changed
[ { "change_type": "MODIFY", "old_path": "view/frontend/web/js/model/storage.js", "new_path": "view/frontend/web/js/model/storage.js", "diff": "@@ -78,22 +78,6 @@ define([\n*/\ngetRegion: function() {\nreturn amazonPayConfig.getValue('region');\n- },\n-\n- /**\n- * @param value\n- * @returns {exports}\n- */\n- setIsEditPaymentFlag: function (value) {\n- getStorage().set('is_edit_billing_clicked', value);\n- return this;\n- },\n-\n- /**\n- * @returns {boolean}\n- */\n- getIsEditPaymentFlag: function () {\n- return getStorage().get('is_edit_billing_clicked');\n}\n};\n});\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/js/view/checkout-address.js", "new_path": "view/frontend/web/js/view/checkout-address.js", "diff": "@@ -55,10 +55,6 @@ define(\nthis._super();\nif (!this.isPayOnly && this.isAmazonCheckout) {\nthis.getShippingAddressFromAmazon();\n- if (amazonStorage.getIsEditPaymentFlag()) {\n- amazonStorage.setIsEditPaymentFlag(false);\n- stepNavigator.setHash('payment');\n- }\n}\n},\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/js/view/payment/method-renderer/amazon-payment-method.js", "new_path": "view/frontend/web/js/view/payment/method-renderer/amazon-payment-method.js", "diff": "@@ -68,11 +68,6 @@ define(\namazonCheckoutSessionId: amazonStorage.getCheckoutSessionId(),\nchangeAction: 'changePayment'\n});\n- if (!amazonConfig.getValue('is_pay_only')) {\n- $elem.click(function () {\n- amazonStorage.setIsEditPaymentFlag(true);\n- });\n- }\n},\ngetLogoUrl: function() {\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-733 - when payment info is edited, send the customer back through to re-select shipping because that could have changed
21,266
15.07.2021 13:41:42
14,400
9ea85a25cdd277e1f9cf9325175113ed8ee49082
Add data/section/action group to fix missing action group error
[ { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-23/ActionGroup/AmazonShipmentFormActionGroup.xml", "diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<actionGroups xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n+ xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/actionGroupSchema.xsd\">\n+\n+ <actionGroup name=\"AmazonShipmentFormActionGroup\">\n+ <fillField selector=\"{{StorefrontCheckoutCheckoutCustomerLoginSection.email}}\" userInput=\"{{AmazonShippingFormData.email}}\" stepKey=\"setCustomerEmail\"/>\n+ <fillField selector=\"{{AmazonFillShipmentFormSection.firstname}}\" userInput=\"{{AmazonShippingFormData.fname}}\" stepKey=\"SetCustomerFirstName\"/>\n+ <fillField selector=\"{{AmazonFillShipmentFormSection.lastname}}\" userInput=\"{{AmazonShippingFormData.lname}}\" stepKey=\"SetCustomerLastName\"/>\n+ <fillField selector=\"{{AmazonFillShipmentFormSection.street}}\" userInput=\"{{AmazonShippingFormData.street}}\" stepKey=\"SetCustomerStreetAddress\"/>\n+ <fillField selector=\"{{AmazonFillShipmentFormSection.city}}\" userInput=\"{{AmazonShippingFormData.city}}\" stepKey=\"SetCustomerCity\"/>\n+ <fillField selector=\"{{AmazonFillShipmentFormSection.postcode}}\" userInput=\"{{AmazonShippingFormData.postcode}}\" stepKey=\"SetCustomerZipCode\"/>\n+ <fillField selector=\"{{AmazonFillShipmentFormSection.telephone}}\" userInput=\"{{AmazonShippingFormData.telephone}}\" stepKey=\"SetCustomerPhoneNumber\"/>\n+ <click selector=\"{{AmazonFillShipmentFormSection.region}}\" stepKey=\"clickToSetState\"/>\n+ <click selector=\"{{AmazonFillShipmentFormSection.state}}\" stepKey=\"clickToChooseState\"/>\n+ <click selector=\"{{AmazonFillShipmentFormSection.next}}\" stepKey=\"clickToSaveShippingInfo\"/>\n+ <waitForPageLoad time=\"5\" stepKey=\"waitForReviewAndPaymentsPageIsLoaded\"/>\n+ <seeInCurrentUrl url=\"payment\" stepKey=\"reviewAndPaymentIsShown\"/>\n+ </actionGroup>\n+\n+</actionGroups>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-23/Data/AmazonShippingData.xml", "diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<entities xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n+ xsi:noNamespaceSchemaLocation=\"../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd\">\n+\n+ <entity name=\"AmazonShippingFormData\" type=\"shipping\">\n+ <data key=\"email\" unique=\"prefix\">mail@gmail.com</data>\n+ <data key=\"fname\">firstname</data>\n+ <data key=\"lname\">lastname</data>\n+ <data key=\"street\">BirminghamStreet</data>\n+ <data key=\"city\">Birmingham</data>\n+ <data key=\"postcode\">35005</data>\n+ <data key=\"telephone\">222222222</data>\n+ </entity>\n+\n+</entities>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-23/Section/AmazonShippingSection.xml", "diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<sections xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n+ xsi:noNamespaceSchemaLocation=\"../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd\">\n+\n+ <!--Fill all required fields in shipping form-->\n+ <section name=\"AmazonFillShipmentFormSection\">\n+ <element name=\"email\" type=\"input\" selector=\"#customer-email\" />\n+ <element name=\"firstname\" type=\"input\" selector=\"//input[@name='firstname']\"/>\n+ <element name=\"lastname\" type=\"input\" selector=\"//input[@name='lastname']\"/>\n+ <element name=\"street\" type=\"input\" selector=\"//input[contains(@name, 'street')]\"/>\n+ <element name=\"city\" type=\"input\" selector=\"//input[@name='city']\"/>\n+ <element name=\"postcode\" type=\"input\" selector=\"//input[@name='postcode']\"/>\n+ <element name=\"telephone\" type=\"input\" selector=\"//input[@name='telephone']\"/>\n+ <element name=\"region\" type=\"button\" selector=\"//*[@name='region_id']\"/>\n+ <element name=\"state\" type=\"button\" selector=\"//*[text()='Alabama']\"/>\n+ <element name=\"next\" type=\"button\" selector=\"//span[text()='Next']\"/>\n+ </section>\n+</sections>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Test/AmazonCheckoutPayNowDeclinedTest.xml", "new_path": "Test/Mftf-23/Test/AmazonCheckoutPayNowDeclinedTest.xml", "diff": "<group value=\"amazon_pay_paynow\"/>\n</annotations>\n+ <before>\n+ <magentoCLI command=\"config:set {{AmazonButtonPaymentConfig.path}} 1\" stepKey=\"displayAmazonButtonPayment\"/>\n+ </before>\n+\n<!-- shipping-->\n- <actionGroup ref=\"ShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n+ <actionGroup ref=\"AmazonShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n<!-- amazon pay option -->\n<click selector=\"{{AmazonCheckoutSection.method}}\" stepKey=\"chooseAmazonMethod\" />\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Test/AmazonCheckoutPayNowMulticurrencySuccessTest.xml", "new_path": "Test/Mftf-23/Test/AmazonCheckoutPayNowMulticurrencySuccessTest.xml", "diff": "<before>\n<createData entity=\"EUAmazonPaymentConfig\" stepKey=\"SampleAmazonPaymentConfigData\" before=\"flushCache\"/>\n<createData entity=\"EUAmazonCurrencyConfig\" stepKey=\"SampleAmazonCurrencyConfig\" before=\"flushCache\"/>\n+ <!-- enable ap button at checkout -->\n+ <magentoCLI command=\"config:set {{AmazonButtonPaymentConfig.path}} 1\" stepKey=\"displayAmazonButtonPayment\"/>\n<!-- set default currency to one supported for multicurrency -->\n<magentoCLI command=\"config:set currency/options/default USD\" stepKey=\"setDefaultCurrency\" before=\"flushCache\"/>\n<!-- disable multicurrency -->\n</after>\n<!-- shipping-->\n- <actionGroup ref=\"ShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n+ <actionGroup ref=\"AmazonShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n<!-- amazon pay option -->\n<click selector=\"{{AmazonCheckoutSection.method}}\" stepKey=\"chooseAmazonMethod\" />\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Test/AmazonCheckoutPayNowSuccessTest.xml", "new_path": "Test/Mftf-23/Test/AmazonCheckoutPayNowSuccessTest.xml", "diff": "<annotations>\n<stories value=\"Amazon Checkout\"/>\n<title value=\"Amazon Checkout Pay Now Success\"/>\n- <description value=\"User should get declined message when Amazon Rejects the payment.\"/>\n+ <description value=\"User should successfully check out with Pay Now.\"/>\n<severity value=\"CRITICAL\"/>\n<group value=\"amazon_pay\"/>\n<group value=\"amazon_pay_checkout\"/>\n<group value=\"amazon_pay_paynow\"/>\n</annotations>\n+ <before>\n+ <magentoCLI command=\"config:set {{AmazonButtonPaymentConfig.path}} 1\" stepKey=\"displayAmazonButtonPayment\"/>\n+ </before>\n+\n<!-- shipping-->\n- <actionGroup ref=\"ShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n+ <actionGroup ref=\"AmazonShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n<!-- amazon pay option -->\n<click selector=\"{{AmazonCheckoutSection.method}}\" stepKey=\"chooseAmazonMethod\" />\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-23/Test/AmazonShippingAddressTest.xml", "new_path": "Test/Mftf-23/Test/AmazonShippingAddressTest.xml", "diff": "<executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n<!--Change shipping address-->\n<click selector=\"{{AmazonCheckoutSection.editShippingButton}}\" stepKey=\"clickAmazonEditShippingButton\"/>\n+ <wait time=\"1\" stepKey=\"amazonSignInWorkaround\" />\n<actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<waitForElement selector=\"{{AmazonPageSection.changeAddressButton}}\" stepKey=\"waitForAmazonEditShippingPageLoad\"/>\n<click selector=\"{{AmazonPageSection.changeAddressButton}}\" stepKey=\"clickChangeAmazonAddressButton\"/>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-24/ActionGroup/AmazonShipmentFormActionGroup.xml", "diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<actionGroups xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n+ xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/actionGroupSchema.xsd\">\n+\n+ <actionGroup name=\"AmazonShipmentFormActionGroup\">\n+ <fillField selector=\"{{StorefrontCheckoutCheckoutCustomerLoginSection.email}}\" userInput=\"{{AmazonShippingFormData.email}}\" stepKey=\"setCustomerEmail\"/>\n+ <fillField selector=\"{{AmazonFillShipmentFormSection.firstname}}\" userInput=\"{{AmazonShippingFormData.fname}}\" stepKey=\"SetCustomerFirstName\"/>\n+ <fillField selector=\"{{AmazonFillShipmentFormSection.lastname}}\" userInput=\"{{AmazonShippingFormData.lname}}\" stepKey=\"SetCustomerLastName\"/>\n+ <fillField selector=\"{{AmazonFillShipmentFormSection.street}}\" userInput=\"{{AmazonShippingFormData.street}}\" stepKey=\"SetCustomerStreetAddress\"/>\n+ <fillField selector=\"{{AmazonFillShipmentFormSection.city}}\" userInput=\"{{AmazonShippingFormData.city}}\" stepKey=\"SetCustomerCity\"/>\n+ <fillField selector=\"{{AmazonFillShipmentFormSection.postcode}}\" userInput=\"{{AmazonShippingFormData.postcode}}\" stepKey=\"SetCustomerZipCode\"/>\n+ <fillField selector=\"{{AmazonFillShipmentFormSection.telephone}}\" userInput=\"{{AmazonShippingFormData.telephone}}\" stepKey=\"SetCustomerPhoneNumber\"/>\n+ <click selector=\"{{AmazonFillShipmentFormSection.region}}\" stepKey=\"clickToSetState\"/>\n+ <click selector=\"{{AmazonFillShipmentFormSection.state}}\" stepKey=\"clickToChooseState\"/>\n+ <click selector=\"{{AmazonFillShipmentFormSection.next}}\" stepKey=\"clickToSaveShippingInfo\"/>\n+ <waitForPageLoad time=\"5\" stepKey=\"waitForReviewAndPaymentsPageIsLoaded\"/>\n+ <seeInCurrentUrl url=\"payment\" stepKey=\"reviewAndPaymentIsShown\"/>\n+ </actionGroup>\n+\n+</actionGroups>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-24/Data/AmazonShippingData.xml", "diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<entities xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n+ xsi:noNamespaceSchemaLocation=\"../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd\">\n+\n+ <entity name=\"AmazonShippingFormData\" type=\"shipping\">\n+ <data key=\"email\" unique=\"prefix\">mail@gmail.com</data>\n+ <data key=\"fname\">firstname</data>\n+ <data key=\"lname\">lastname</data>\n+ <data key=\"street\">BirminghamStreet</data>\n+ <data key=\"city\">Birmingham</data>\n+ <data key=\"postcode\">35005</data>\n+ <data key=\"telephone\">222222222</data>\n+ </entity>\n+\n+</entities>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/Mftf-24/Section/AmazonShippingSection.xml", "diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<sections xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n+ xsi:noNamespaceSchemaLocation=\"../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd\">\n+\n+ <!--Fill all required fields in shipping form-->\n+ <section name=\"AmazonFillShipmentFormSection\">\n+ <element name=\"email\" type=\"input\" selector=\"#customer-email\" />\n+ <element name=\"firstname\" type=\"input\" selector=\"//input[@name='firstname']\"/>\n+ <element name=\"lastname\" type=\"input\" selector=\"//input[@name='lastname']\"/>\n+ <element name=\"street\" type=\"input\" selector=\"//input[contains(@name, 'street')]\"/>\n+ <element name=\"city\" type=\"input\" selector=\"//input[@name='city']\"/>\n+ <element name=\"postcode\" type=\"input\" selector=\"//input[@name='postcode']\"/>\n+ <element name=\"telephone\" type=\"input\" selector=\"//input[@name='telephone']\"/>\n+ <element name=\"region\" type=\"button\" selector=\"//*[@name='region_id']\"/>\n+ <element name=\"state\" type=\"button\" selector=\"//*[text()='Alabama']\"/>\n+ <element name=\"next\" type=\"button\" selector=\"//span[text()='Next']\"/>\n+ </section>\n+</sections>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonCheckoutPayNowDeclinedTest.xml", "new_path": "Test/Mftf-24/Test/AmazonCheckoutPayNowDeclinedTest.xml", "diff": "<group value=\"amazon_pay_paynow\"/>\n</annotations>\n+ <before>\n+ <magentoCLI command=\"config:set {{AmazonButtonPaymentConfig.path}} 1\" stepKey=\"displayAmazonButtonPayment\"/>\n+ </before>\n+\n<!-- shipping-->\n- <actionGroup ref=\"ShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n+ <actionGroup ref=\"AmazonShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n<!-- amazon pay option -->\n<click selector=\"{{AmazonCheckoutSection.method}}\" stepKey=\"chooseAmazonMethod\" />\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonCheckoutPayNowMulticurrencySuccessTest.xml", "new_path": "Test/Mftf-24/Test/AmazonCheckoutPayNowMulticurrencySuccessTest.xml", "diff": "<before>\n<createData entity=\"EUAmazonPaymentConfig\" stepKey=\"SampleAmazonPaymentConfigData\" before=\"flushCache\"/>\n<createData entity=\"EUAmazonCurrencyConfig\" stepKey=\"SampleAmazonCurrencyConfig\" before=\"flushCache\"/>\n+ <!-- enable ap button at checkout -->\n+ <magentoCLI command=\"config:set {{AmazonButtonPaymentConfig.path}} 1\" stepKey=\"displayAmazonButtonPayment\"/>\n<!-- set default currency to one supported for multicurrency -->\n<magentoCLI command=\"config:set currency/options/default USD\" stepKey=\"setDefaultCurrency\" before=\"flushCache\"/>\n<!-- disable multicurrency -->\n</after>\n<!-- shipping-->\n- <actionGroup ref=\"ShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n+ <actionGroup ref=\"AmazonShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n<!-- amazon pay option -->\n<click selector=\"{{AmazonCheckoutSection.method}}\" stepKey=\"chooseAmazonMethod\" />\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonCheckoutPayNowSuccessTest.xml", "new_path": "Test/Mftf-24/Test/AmazonCheckoutPayNowSuccessTest.xml", "diff": "<annotations>\n<stories value=\"Amazon Checkout\"/>\n<title value=\"Amazon Checkout Pay Now Success\"/>\n- <description value=\"User should get declined message when Amazon Rejects the payment.\"/>\n+ <description value=\"User should successfully check out with Pay Now.\"/>\n<severity value=\"CRITICAL\"/>\n<group value=\"amazon_pay\"/>\n<group value=\"amazon_pay_checkout\"/>\n<group value=\"amazon_pay_paynow\"/>\n</annotations>\n+ <before>\n+ <magentoCLI command=\"config:set {{AmazonButtonPaymentConfig.path}} 1\" stepKey=\"displayAmazonButtonPayment\"/>\n+ </before>\n+\n<!-- shipping-->\n- <actionGroup ref=\"ShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n+ <actionGroup ref=\"AmazonShipmentFormActionGroup\" stepKey=\"fillShipping\" />\n<!-- amazon pay option -->\n<click selector=\"{{AmazonCheckoutSection.method}}\" stepKey=\"chooseAmazonMethod\" />\n" }, { "change_type": "MODIFY", "old_path": "Test/Mftf-24/Test/AmazonShippingAddressTest.xml", "new_path": "Test/Mftf-24/Test/AmazonShippingAddressTest.xml", "diff": "<executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n<!--Change shipping address-->\n<click selector=\"{{AmazonCheckoutSection.editShippingButton}}\" stepKey=\"clickAmazonEditShippingButton\"/>\n+ <wait time=\"1\" stepKey=\"amazonSignInWorkaround\" />\n<actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen\" />\n<waitForElement selector=\"{{AmazonPageSection.changeAddressButton}}\" stepKey=\"waitForAmazonEditShippingPageLoad\"/>\n<click selector=\"{{AmazonPageSection.changeAddressButton}}\" stepKey=\"clickChangeAmazonAddressButton\"/>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Add data/section/action group to fix missing action group error
21,241
16.07.2021 10:04:59
18,000
8e6f5c99b90b8c8a169d5a9ba81e23ef7ea691c9
when processing a second/third/etc invoice for an order, if we have a charge permission ID we should be creating a charge rather than checking an auth
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -367,14 +367,13 @@ class AmazonPayAdapter\npublic function authorize($data)\n{\n$quote = $this->quoteRepository->get($data['quote_id']);\n- if (!empty($data['amazon_checkout_session_id'])) {\n- $response = $this->getCheckoutSession($quote->getStoreId(), $data['amazon_checkout_session_id']);\n- } elseif (!empty($data['charge_permission_id'])) {\n+ if (!empty($data['charge_permission_id'])) {\n$getChargePermissionResponse = $this->getChargePermission(\n$quote->getStoreId(),\n$data['charge_permission_id']\n);\n- if ($getChargePermissionResponse['statusDetails']['state'] == \"Chargeable\") {\n+ if ($getChargePermissionResponse['statusDetails']['state'] == \"Chargeable\" &&\n+ $getChargePermissionResponse['limits']['amountBalance']['amount'] >= $data['amount']) {\n$response = $this->createCharge(\n$quote->getStoreId(),\n$data['charge_permission_id'],\n@@ -383,6 +382,8 @@ class AmazonPayAdapter\ntrue\n);\n}\n+ } elseif (!empty($data['amazon_checkout_session_id'])) {\n+ $response = $this->getCheckoutSession($quote->getStoreId(), $data['amazon_checkout_session_id']);\n}\nreturn $response;\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-750 - when processing a second/third/etc invoice for an order, if we have a charge permission ID we should be creating a charge rather than checking an auth
21,241
16.07.2021 10:46:21
18,000
bd0e4e3bbf8f3d6c85fccd361724030afef5b5a5
don't process an async state change (particularly capture) unless invoice is open or doesn't exist, otherwise it will add a confusing message to the order
[ { "change_type": "MODIFY", "old_path": "Model/AsyncManagement/Charge.php", "new_path": "Model/AsyncManagement/Charge.php", "diff": "@@ -127,6 +127,13 @@ class Charge extends AbstractOperation\n$order = $this->loadOrder($chargeId);\nif ($order) {\n+ $invoice = $this->loadInvoice($chargeId, $order);\n+ if ($invoice && $invoice->getState() != Order\\Invoice::STATE_OPEN) {\n+ // Could happen with duplicate IPN messages, don't want to try to capture unless not invoiced\n+ $this->asyncLogger->info('Duplicate IPN received after capture for Order #' . $order->getIncrementId());\n+ return true;\n+ }\n+\n$charge = $this->amazonAdapter->getCharge($order->getStoreId(), $chargeId);\n// Compare Charge State with Order State\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-743 - don't process an async state change (particularly capture) unless invoice is open or doesn't exist, otherwise it will add a confusing message to the order
21,241
19.07.2021 14:17:03
18,000
c4b8aa037d8ae5f6eae5eec83777e639c6c9ade6
removed charge balance check, sometimes would fail due to floating point comparison and it gives useful error messaging if you try to capture more than limit anyhow. Also added error log if the charge permission isn't in a state that can be charged.
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -372,8 +372,7 @@ class AmazonPayAdapter\n$quote->getStoreId(),\n$data['charge_permission_id']\n);\n- if ($getChargePermissionResponse['statusDetails']['state'] == \"Chargeable\" &&\n- $getChargePermissionResponse['limits']['amountBalance']['amount'] >= $data['amount']) {\n+ if ($getChargePermissionResponse['statusDetails']['state'] == \"Chargeable\") {\n$response = $this->createCharge(\n$quote->getStoreId(),\n$data['charge_permission_id'],\n@@ -381,6 +380,8 @@ class AmazonPayAdapter\n$quote->getQuoteCurrencyCode(),\ntrue\n);\n+ } else {\n+ $this->logger->debug(__('Charge permission not in Chargeable state: ') . $data['charge_permission_id']);\n}\n} elseif (!empty($data['amazon_checkout_session_id'])) {\n$response = $this->getCheckoutSession($quote->getStoreId(), $data['amazon_checkout_session_id']);\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-750 - removed charge balance check, sometimes would fail due to floating point comparison and it gives useful error messaging if you try to capture more than limit anyhow. Also added error log if the charge permission isn't in a state that can be charged.
21,241
19.07.2021 14:38:42
18,000
5820f745395252eb41afd044d2222be715fcaf21
remove js that hides config for multicurrency, rely on the helptext to guide usage
[ { "change_type": "MODIFY", "old_path": "view/adminhtml/web/js/autokeyexchange.js", "new_path": "view/adminhtml/web/js/autokeyexchange.js", "diff": "@@ -57,15 +57,6 @@ define(\nself.$amazonAutoKeyExchangeBack = $(self.apAutoKeyExchangeBackSelector);\nself.$container = $(self.apAutoKeyExchangeSelector);\n- if (this.isMultiCurrencyRegion) {\n- $('#row_payment_' + self.getCountry() + '_amazon_pay_options_multicurrency').show();\n- $('#row_payment_other_amazon_pay_options_multicurrency').show();\n- }\n- else {\n- $('#row_payment_' + self.getCountry() + '_amazon_pay_options_multicurrency').hide();\n- $('#row_payment_other_amazon_pay_options_multicurrency').hide();\n- }\n-\nif (self.$amazonMerchantId.val()) {\nthis.$amazonAutoKeyExchange.hide();\nthis.$amazonAutoKeyExchangeBack.show();\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-749 - remove js that hides config for multicurrency, rely on the helptext to guide usage
21,241
20.07.2021 16:41:06
18,000
ea07faf4f4ebf2548537337c5ba2d7837c9b9bf7
Version bump for 5.6.0 and update changelog
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -48,7 +48,7 @@ The following table provides an overview on which Git branch is compatible to wh\nMagento Version | Github Branch | Latest release\n---|---|---\n2.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)\n-2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.5.1\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.6.0\n## Release Notes\nSee [CHANGELOG.md](/CHANGELOG.md)\n" }, { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"name\": \"amzn/amazon-pay-magento-2-module\",\n\"description\": \"Official Magento2 Plugin to integrate with Amazon Pay\",\n\"type\": \"magento2-module\",\n- \"version\": \"5.5.1\",\n+ \"version\": \"5.6.0\",\n\"license\": [\n\"Apache-2.0\"\n],\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Version bump for 5.6.0 and update changelog
21,241
22.07.2021 13:43:48
18,000
f9ced88f57f7a0f0a27e094fa29ef0262f31efcf
add full Magento version to the customInformation field
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -50,6 +50,11 @@ class AmazonPayAdapter\n*/\nprivate $amazonHelper;\n+ /**\n+ * @var \\Magento\\Framework\\App\\ProductMetadataInterface\n+ */\n+ private $productMetadata;\n+\n/**\n* @var \\Amazon\\Pay\\Logger\\Logger\n*/\n@@ -72,6 +77,7 @@ class AmazonPayAdapter\n* @param \\Magento\\Store\\Model\\StoreManagerInterface $storeManager\n* @param \\Magento\\Quote\\Api\\CartRepositoryInterface $quoteRepository\n* @param \\Amazon\\Pay\\Helper\\Data $amazonHelper\n+ * @param \\Magento\\Framework\\App\\ProductMetadataInterface $productMetadata\n* @param \\Amazon\\Pay\\Logger\\Logger $logger\n* @param \\Magento\\Framework\\UrlInterface $url\n* @param \\Magento\\Framework\\App\\Response\\RedirectInterface $redirect\n@@ -82,6 +88,7 @@ class AmazonPayAdapter\n\\Magento\\Store\\Model\\StoreManagerInterface $storeManager,\n\\Magento\\Quote\\Api\\CartRepositoryInterface $quoteRepository,\n\\Amazon\\Pay\\Helper\\Data $amazonHelper,\n+ \\Magento\\Framework\\App\\ProductMetadataInterface $productMetadata,\n\\Amazon\\Pay\\Logger\\Logger $logger,\n\\Magento\\Framework\\UrlInterface $url,\n\\Magento\\Framework\\App\\Response\\RedirectInterface $redirect\n@@ -91,6 +98,7 @@ class AmazonPayAdapter\n$this->storeManager = $storeManager;\n$this->quoteRepository = $quoteRepository;\n$this->amazonHelper = $amazonHelper;\n+ $this->productMetadata = $productMetadata;\n$this->logger = $logger;\n$this->url = $url;\n$this->redirect = $redirect;\n@@ -101,7 +109,11 @@ class AmazonPayAdapter\n*/\nprotected function getMerchantCustomInformation()\n{\n- return sprintf('Magento Version: 2, Plugin Version: %s', $this->amazonHelper->getModuleVersion('Amazon_Pay'));\n+ return sprintf(\n+ 'Magento Version: %s, Plugin Version: %s (v2)',\n+ $this->productMetadata->getVersion(),\n+ $this->amazonHelper->getModuleVersion('Amazon_Pay')\n+ );\n}\n/**\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-751 - add full Magento version to the customInformation field
21,241
22.07.2021 14:04:01
18,000
99024c2340834fa29eaa9296b6c980c191e43c6f
remove V2 from version string
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -110,7 +110,7 @@ class AmazonPayAdapter\nprotected function getMerchantCustomInformation()\n{\nreturn sprintf(\n- 'Magento Version: %s, Plugin Version: %s (v2)',\n+ 'Magento Version: %s, Plugin Version: %s',\n$this->productMetadata->getVersion(),\n$this->amazonHelper->getModuleVersion('Amazon_Pay')\n);\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-751 - remove V2 from version string
21,241
23.07.2021 11:23:29
18,000
e90cd93143810c4265b6e2266cfc7ffa6020e789
Proxy console commands to correct marketplace submission failure
[ { "change_type": "MODIFY", "old_path": "Command/Async/ProcessCommand.php", "new_path": "Command/Async/ProcessCommand.php", "diff": "@@ -20,6 +20,14 @@ class ProcessCommand extends Command\n*/\nprivate $asyncUpdater;\n+ /**\n+ * ProcessCommand constructor.\n+ *\n+ * These dependencies are proxied, update di.xml if changed\n+ * @param \\Amazon\\Pay\\Model\\ResourceModel\\Async\\CollectionFactory $asyncCollectionFactory\n+ * @param \\Amazon\\Pay\\Model\\AsyncUpdater $asyncUpdater\n+ * @param string|null $name\n+ */\npublic function __construct(\n\\Amazon\\Pay\\Model\\ResourceModel\\Async\\CollectionFactory $asyncCollectionFactory,\n\\Amazon\\Pay\\Model\\AsyncUpdater $asyncUpdater,\n" }, { "change_type": "MODIFY", "old_path": "Command/Sales/AmazonChargePermissionCommand.php", "new_path": "Command/Sales/AmazonChargePermissionCommand.php", "diff": "@@ -47,6 +47,15 @@ class AmazonChargePermissionCommand extends Command\n*/\nprivate $searchCriteriaBuilder;\n+ /**\n+ * AmazonChargePermissionCommand constructor.\n+ *\n+ * These dependencies are proxied, update di.xml if changed\n+ * @param \\Magento\\Framework\\App\\State $state\n+ * @param \\Magento\\Sales\\Model\\OrderRepository $orderRepository\n+ * @param \\Amazon\\Pay\\Model\\Adapter\\AmazonPayAdapter $amazonAdapter\n+ * @param \\Magento\\Framework\\Api\\SearchCriteriaBuilder $searchCriteriaBuilder\n+ */\npublic function __construct(\n\\Magento\\Framework\\App\\State $state,\n\\Magento\\Sales\\Model\\OrderRepository $orderRepository,\n" }, { "change_type": "MODIFY", "old_path": "etc/di.xml", "new_path": "etc/di.xml", "diff": "</arguments>\n</type>\n+ <type name=\"Amazon\\Pay\\Command\\Async\\ProcessCommand\">\n+ <arguments>\n+ <argument name=\"asyncCollectionFactory\" xsi:type=\"object\">Amazon\\Pay\\Model\\ResourceModel\\Async\\CollectionFactory\\Proxy</argument>\n+ <argument name=\"asyncUpdater\" xsi:type=\"object\">Amazon\\Pay\\Model\\AsyncUpdater\\Proxy</argument>\n+ </arguments>\n+ </type>\n+\n<type name=\"Magento\\Framework\\Console\\CommandList\">\n<arguments>\n<argument name=\"commands\" xsi:type=\"array\">\n</arguments>\n</type>\n+ <type name=\"Amazon\\Pay\\Command\\Sales\\AmazonChargePermissionCommand\">\n+ <arguments>\n+ <argument name=\"state\" xsi:type=\"object\">Magento\\Framework\\App\\State\\Proxy</argument>\n+ <argument name=\"orderRepository\" xsi:type=\"object\">Magento\\Sales\\Model\\OrderRepository\\Proxy</argument>\n+ <argument name=\"amazonAdapter\" xsi:type=\"object\">Amazon\\Pay\\Model\\Adapter\\AmazonPayAdapter\\Proxy</argument>\n+ <argument name=\"searchCriteriaBuilder\" xsi:type=\"object\">Magento\\Framework\\Api\\SearchCriteriaBuilder\\Proxy</argument>\n+ </arguments>\n+ </type>\n+\n<type name=\"Magento\\Framework\\Console\\CommandList\">\n<arguments>\n<argument name=\"commands\" xsi:type=\"array\">\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Proxy console commands to correct marketplace submission failure
21,250
30.07.2021 16:54:45
10,800
745860b1ce43d5d5e744ca2d4ba32fa41f0bfb4b
Display State/Province select when region is missing
[ { "change_type": "MODIFY", "old_path": "view/frontend/web/js/view/shipping.js", "new_path": "view/frontend/web/js/view/shipping.js", "diff": "define(\n[\n'jquery',\n- 'Amazon_Pay/js/model/storage'\n+ 'Amazon_Pay/js/model/storage',\n+ 'uiRegistry',\n+ 'Magento_Checkout/js/model/checkout-data-resolver'\n],\nfunction (\n$,\n- amazonStorage\n+ amazonStorage,\n+ registry,\n+ checkoutDataResolver\n) {\n'use strict';\n@@ -21,8 +25,10 @@ define(\n* Initialize shipping\n*/\ninitialize: function () {\n+ this.showFormPopUp();\nthis._super();\nthis.isNewAddressAdded(true);\n+ this.refreshShippingRegion();\nreturn this;\n},\n@@ -35,6 +41,14 @@ define(\n$(loginFormSelector).validation();\nreturn $(loginFormSelector + ' input[type=email]').valid();\n+ },\n+\n+ refreshShippingRegion: function() {\n+ var checkoutProvider = registry.get('checkoutProvider');\n+\n+ checkoutProvider.on('shippingAddress.region_id', function (regionId) {\n+ checkoutDataResolver.resolveEstimationAddress();\n+ });\n}\n});\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-738: Display State/Province select when region is missing
21,266
02.08.2021 08:34:48
14,400
72dedda7fd07d3a540ed641be8d8b1ba8ffa6aa2
Add specific gateway validators to check object states
[ { "change_type": "MODIFY", "old_path": "Gateway/Validator/GeneralResponseValidator.php", "new_path": "Gateway/Validator/GeneralResponseValidator.php", "diff": "@@ -26,6 +26,13 @@ use Magento\\Payment\\Gateway\\Validator\\ResultInterface;\nclass GeneralResponseValidator extends AbstractValidator\n{\n+ /**\n+ * Acceptable object states\n+ *\n+ * @var Array $validStates\n+ */\n+ protected $validStates = [];\n+\n/**\n* Performs validation of result code\n*\n@@ -40,28 +47,26 @@ class GeneralResponseValidator extends AbstractValidator\n$response = $validationSubject['response'];\n+ if (!in_array($response['status'], [200, 201])) {\n+ $isValid = false;\n+ $errorCodes[] = 'HTTP status code ' . $response['status'];\n+ }\n+\nif (isset($response['statusDetails'])) {\n- if ($response['statusDetails']['state'] != 'Canceled') {\n- if (!empty($response['statusDetails']['reasonCode'])) {\n+ if (!in_array($response['statusDetails']['state'], $this->validStates)) {\n$isValid = false;\n+ $errorMessages[] = 'Invalid State: receieved ' . $response['statusDetails']['state']\n+ . ', expected ' . implode(' | ', $this->validStates);\n+\n+ if (!empty($response['statusDetails']['reasonCode'])) {\n$errorCodes[] = $response['statusDetails']['reasonCode'];\n}\nif (!empty($response['statusDetails']['reasonDescription'])) {\n- $isValid = false;\n$errorMessages[] = $response['statusDetails']['reasonDescription'];\n}\n}\n}\n- if (!empty($response['reasonCode'])) {\n- $isValid = false;\n- $errorCodes[] = $response['reasonCode'];\n- }\n- if (!empty($response['reasonDescription'])) {\n- $isValid = false;\n- $errorMessages[] = $response['reasonDescription'];\n- }\n-\nreturn $this->createResult($isValid, $errorMessages, $errorCodes);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "etc/di.xml", "new_path": "etc/di.xml", "diff": "<argument name=\"client\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\Client\\AuthorizeClient</argument>\n<argument name=\"handler\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Response\\AuthorizationSaleHandler</argument>\n<argument name=\"transferFactory\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\TransferFactory</argument>\n- <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\GeneralResponseValidator</argument>\n+ <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\AuthorizeResponseValidator</argument>\n<argument name=\"errorMessageMapper\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\ErrorMapper\\VirtualErrorMessageMapper</argument>\n</arguments>\n</virtualType>\n<argument name=\"client\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\Client\\SaleClient</argument>\n<argument name=\"handler\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Response\\AuthorizationSaleHandler</argument>\n<argument name=\"transferFactory\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\TransferFactory</argument>\n- <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\GeneralResponseValidator</argument>\n+ <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\SaleResponseValidator</argument>\n<argument name=\"errorMessageMapper\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\ErrorMapper\\VirtualErrorMessageMapper</argument>\n</arguments>\n</virtualType>\n<argument name=\"client\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\Client\\SettlementClient</argument>\n<argument name=\"handler\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Response\\SettlementHandler</argument>\n<argument name=\"transferFactory\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\TransferFactory</argument>\n- <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\GeneralResponseValidator</argument>\n+ <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\SettlementResponseValidator</argument>\n<argument name=\"errorMessageMapper\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\ErrorMapper\\VirtualErrorMessageMapper</argument>\n</arguments>\n</virtualType>\n<argument name=\"handler\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Response\\RefundHandler</argument>\n<argument name=\"transferFactory\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\TransferFactory</argument>\n<argument name=\"client\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\Client\\RefundClient</argument>\n- <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\GeneralResponseValidator</argument>\n+ <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\RefundResponseValidator</argument>\n<argument name=\"errorMessageMapper\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\ErrorMapper\\VirtualErrorMessageMapper</argument>\n</arguments>\n</virtualType>\n<argument name=\"handler\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Response\\VoidHandler</argument>\n<argument name=\"client\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\Client\\VoidClient</argument>\n<argument name=\"transferFactory\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\TransferFactory</argument>\n- <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\GeneralResponseValidator</argument>\n+ <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\VoidResponseValidator</argument>\n<argument name=\"errorMessageMapper\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\ErrorMapper\\VirtualErrorMessageMapper</argument>\n</arguments>\n</virtualType>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-496 - Add specific gateway validators to check object states
21,275
04.08.2021 09:24:13
-7,200
40dbafdffcfadc4a5b0dba24db40255d508bccf7
Add additional check if password hash is empty in auth process. Related to magento issue
[ { "change_type": "MODIFY", "old_path": "Controller/Login/ValidatePost.php", "new_path": "Controller/Login/ValidatePost.php", "diff": "@@ -84,7 +84,8 @@ class ValidatePost extends Action\nif (null !== $credentials && $credentials instanceof ValidationCredentials) {\n$password = $this->getRequest()->getParam('password');\n- $hash = $this->customerRegistry->retrieveSecureData($credentials->getCustomerId())->getPasswordHash();\n+ $customerSecure = $this->customerRegistry->retrieveSecureData($credentials->getCustomerId());\n+ $hash = $customerSecure->getPasswordHash() ?? '';\nif ($this->encryptor->validateHash($password, $hash)) {\n$this->customerLinkManagement->updateLink($credentials->getCustomerId(), $credentials->getAmazonId());\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Add additional check if password hash is empty in auth process. Related to magento issue #19060.
21,241
05.08.2021 09:28:41
18,000
afa9b10f169a2a71055d48393cff67c3e273c804
add translation wrapper
[ { "change_type": "MODIFY", "old_path": "Controller/Login/ValidatePost.php", "new_path": "Controller/Login/ValidatePost.php", "diff": "@@ -91,7 +91,7 @@ class ValidatePost extends Action\n$this->customerLinkManagement->updateLink($credentials->getCustomerId(), $credentials->getAmazonId());\n$this->session->loginById($credentials->getCustomerId());\n} else {\n- $this->messageManager->addErrorMessage('The password supplied was incorrect');\n+ $this->messageManager->addErrorMessage(__('The password supplied was incorrect'));\nreturn $this->_redirect($this->_url->getRouteUrl('*/*/validate'));\n}\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-757 - add translation wrapper
21,241
09.08.2021 17:40:19
18,000
b79484ca6cf3209219da5772db1ffeb05fc0c280
add option to load quote from masked cart ID for REST requests
[ { "change_type": "MODIFY", "old_path": "Api/CheckoutSessionManagementInterface.php", "new_path": "Api/CheckoutSessionManagementInterface.php", "diff": "@@ -21,9 +21,10 @@ namespace Amazon\\Pay\\Api;\ninterface CheckoutSessionManagementInterface\n{\n/**\n+ * @param mixed|null $cartId\n* @return mixed\n*/\n- public function getConfig();\n+ public function getConfig($cartId = null);\n/**\n* @param mixed $amazonSessionId\n@@ -45,13 +46,15 @@ interface CheckoutSessionManagementInterface\n/**\n* @param mixed $amazonSessionId\n+ * @param mixed|null $cartId\n* @return string\n*/\n- public function updateCheckoutSession($amazonSessionId);\n+ public function updateCheckoutSession($amazonSessionId, $cartId = null);\n/**\n* @param mixed $amazonSessionId\n+ * @param mixed|null $cartId\n* @return int\n*/\n- public function completeCheckoutSession($amazonSessionId);\n+ public function completeCheckoutSession($amazonSessionId, $cartId = null);\n}\n" }, { "change_type": "MODIFY", "old_path": "CustomerData/CheckoutSession.php", "new_path": "CustomerData/CheckoutSession.php", "diff": "@@ -48,6 +48,6 @@ class CheckoutSession\n*/\npublic function getConfig()\n{\n- return $this->checkoutSessionManagement->getConfig($this->session->getQuote());\n+ return $this->checkoutSessionManagement->getConfig();\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "Model/CheckoutSessionManagement.php", "new_path": "Model/CheckoutSessionManagement.php", "diff": "@@ -22,12 +22,15 @@ use Amazon\\Pay\\Model\\Config\\Source\\AuthorizationMode;\nuse Amazon\\Pay\\Model\\Config\\Source\\PaymentAction;\nuse Amazon\\Pay\\Model\\AsyncManagement;\nuse http\\Exception\\UnexpectedValueException;\n+use Magento\\Framework\\Exception\\NoSuchEntityException;\n+use Magento\\Framework\\Exception\\NotFoundException;\nuse Magento\\Quote\\Api\\Data\\CartInterface;\nuse Magento\\Framework\\Validator\\Exception as ValidatorException;\nuse Magento\\Framework\\Webapi\\Exception as WebapiException;\nuse Magento\\Sales\\Api\\OrderRepositoryInterface;\nuse Magento\\Sales\\Model\\Order\\Invoice;\nuse Magento\\Sales\\Model\\Order\\Payment;\n+use Magento\\Quote\\Model\\MaskedQuoteIdToQuoteIdInterface;\nuse Magento\\Sales\\Api\\Data\\TransactionInterface as Transaction;\nclass CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\n@@ -137,6 +140,11 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n*/\nprivate $orderCollectionFactory;\n+ /**\n+ * @var MaskedQuoteIdToQuoteIdInterface\n+ */\n+ private $maskedQuoteIdConverter;\n+\n/**\n* CheckoutSessionManagement constructor.\n* @param \\Magento\\Store\\Model\\StoreManagerInterface $storeManager\n@@ -158,6 +166,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n* @param \\Magento\\Sales\\Api\\TransactionRepositoryInterface $transactionRepository\n* @param \\Magento\\Framework\\Api\\SearchCriteriaBuilder $searchCriteriaBuilder\n* @param \\Magento\\Sales\\Model\\ResourceModel\\Order\\CollectionFactory $orderCollectionFactory\n+ * @param MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdConverter\n*/\npublic function __construct(\n\\Magento\\Store\\Model\\StoreManagerInterface $storeManager,\n@@ -178,7 +187,8 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n\\Amazon\\Pay\\Model\\AsyncManagement\\Charge $asyncCharge,\n\\Magento\\Sales\\Api\\TransactionRepositoryInterface $transactionRepository,\n\\Magento\\Framework\\Api\\SearchCriteriaBuilder $searchCriteriaBuilder,\n- \\Magento\\Sales\\Model\\ResourceModel\\Order\\CollectionFactory $orderCollectionFactory\n+ \\Magento\\Sales\\Model\\ResourceModel\\Order\\CollectionFactory $orderCollectionFactory,\n+ MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdConverter\n) {\n$this->storeManager = $storeManager;\n$this->quoteIdMaskFactory = $quoteIdMaskFactory;\n@@ -199,6 +209,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$this->transactionRepository = $transactionRepository;\n$this->searchCriteriaBuilder = $searchCriteriaBuilder;\n$this->orderCollectionFactory = $orderCollectionFactory;\n+ $this->maskedQuoteIdConverter = $maskedQuoteIdConverter;\n}\n/**\n@@ -219,10 +230,10 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n/**\n* @return bool\n*/\n- protected function canCheckoutWithAmazon()\n+ protected function canCheckoutWithAmazon($quote)\n{\nreturn $this->amazonConfig->isEnabled() &&\n- !$this->amazonHelper->hasRestrictedProducts($this->magentoCheckoutSession->getQuote());\n+ !$this->amazonHelper->hasRestrictedProducts($quote);\n}\n/**\n@@ -303,18 +314,43 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\nreturn [$this->addressHelper->convertToArray($magentoAddress)];\n}\n+ /**\n+ * Load quote from provided masked quote ID or falls back to loading from the session\n+ * @param $cartId null|string\n+ * @return false|CartInterface|\\Magento\\Quote\\Model\\Quote\n+ * @throws \\Magento\\Framework\\Exception\\LocalizedException\n+ */\n+ private function getQuoteFromIdOrSession($cartId = null)\n+ {\n+ try {\n+ if (empty($cartId)) {\n+ $quote = $this->magentoCheckoutSession->getQuote();\n+ } else {\n+ $quoteId = $this->maskedQuoteIdConverter->execute($cartId);\n+ $quote = $this->cartRepository->get($quoteId);\n+ }\n+ } catch (NoSuchEntityException $e) {\n+ return false;\n+ }\n+\n+ return $quote;\n+ }\n+\n/**\n* {@inheritdoc}\n*/\n- public function getConfig()\n+ public function getConfig($cartId = null)\n{\n+ if (!$quote = $this->getQuoteFromIdOrSession($cartId)) {\n+ return [];\n+ }\n+\n$result = [];\n- if ($this->canCheckoutWithAmazon()) {\n- $magentoQuote = $this->magentoCheckoutSession->getQuote();\n+ if ($this->canCheckoutWithAmazon($quote)) {\n$loginButtonPayload = $this->amazonAdapter->generateLoginButtonPayload();\n$checkoutButtonPayload = $this->amazonAdapter->generateCheckoutButtonPayload();\n$payNowButtonPayload = $this->amazonAdapter->generatePayNowButtonPayload(\n- $magentoQuote,\n+ $quote,\n$this->amazonConfig->getPaymentAction()\n);\n@@ -323,7 +359,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n'currency' => $this->amazonConfig->getCurrencyCode(),\n'button_color' => $this->amazonConfig->getButtonColor(),\n'language' => $this->amazonConfig->getLanguage(),\n- 'pay_only' => $this->amazonHelper->isPayOnly($magentoQuote),\n+ 'pay_only' => $this->amazonHelper->isPayOnly($quote),\n'sandbox' => $this->amazonConfig->isSandboxEnabled(),\n'login_payload' => $loginButtonPayload,\n'login_signature' => $this->amazonAdapter->signButton($loginButtonPayload),\n@@ -342,13 +378,9 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n*/\npublic function getShippingAddress($amazonSessionId)\n{\n- $result = false;\n-\n- if ($this->canCheckoutWithAmazon()) {\n$result = $this->fetchAddress($amazonSessionId, true, function ($session) {\nreturn $session['shippingAddress'] ?? [];\n});\n- }\nreturn $result;\n}\n@@ -358,13 +390,9 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n*/\npublic function getBillingAddress($amazonSessionId)\n{\n- $result = false;\n-\n- if ($this->canCheckoutWithAmazon()) {\n$result = $this->fetchAddress($amazonSessionId, false, function ($session) {\nreturn $session['billingAddress'] ?? [];\n});\n- }\nreturn $result;\n}\n@@ -381,13 +409,16 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n/**\n* {@inheritdoc}\n*/\n- public function updateCheckoutSession($amazonCheckoutSessionId)\n+ public function updateCheckoutSession($amazonCheckoutSessionId, $cartId = null)\n{\n- $quote = $this->magentoCheckoutSession->getQuote();\n+ if (!$quote = $this->getQuoteFromIdOrSession($cartId)) {\n+ return [];\n+ }\n+\n$result = null;\n$paymentIntent = Adapter\\AmazonPayAdapter::PAYMENT_INTENT_AUTHORIZE;\n- if ($this->canCheckoutWithAmazon()) {\n+ if ($this->canCheckoutWithAmazon($quote)) {\n$response = $this->amazonAdapter->updateCheckoutSession(\n$quote,\n$amazonCheckoutSessionId,\n@@ -395,6 +426,8 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n);\nif (!empty($response['webCheckoutDetails']['amazonPayRedirectUrl'])) {\n$result = $response['webCheckoutDetails']['amazonPayRedirectUrl'];\n+ } elseif (!empty($response) && $response['status'] == 404) {\n+ $result = ['status' => $response['reasonCode']];\n}\n}\nreturn $result;\n@@ -483,13 +516,13 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n* Add capture comment to order\n*\n* @param Payment $payment\n- * @param $cart\n+ * @param $quote\n* @param $chargeId\n*/\n- protected function addCaptureComment($payment, $cart, $chargeId)\n+ protected function addCaptureComment($payment, $quote, $chargeId)\n{\n$order = $payment->getOrder();\n- $formattedAmount = $order->getBaseCurrency()->formatTxt($cart->getBaseGrandTotal());\n+ $formattedAmount = $order->getBaseCurrency()->formatTxt($quote->getBaseGrandTotal());\nif ($order->getBaseCurrencyCode() != $order->getOrderCurrencyCode()) {\n$formattedAmount = $formattedAmount . ' [' . $order->formatPriceTxt($payment->getAmountOrdered()) . ']';\n}\n@@ -534,24 +567,26 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n/**\n* {@inheritdoc}\n*/\n- public function completeCheckoutSession($amazonSessionId)\n+ public function completeCheckoutSession($amazonSessionId, $cartId = null)\n{\n- $cart = $this->magentoCheckoutSession->getQuote();\n+ if (!$quote = $this->getQuoteFromIdOrSession($cartId)) {\n+ return ['success' => false];\n+ }\n- if (empty($amazonSessionId) || !$this->canCheckoutWithAmazon() || !$this->canSubmitQuote($cart)) {\n+ if (empty($amazonSessionId) || !$this->canCheckoutWithAmazon($quote) || !$this->canSubmitQuote($quote)) {\nreturn [\n'success' => false,\n'message' => __(\"Unable to complete Amazon Pay checkout\"),\n];\n}\ntry {\n- if (!$cart->getCustomer()->getId()) {\n- $cart->setCheckoutMethod(\\Magento\\Quote\\Api\\CartManagementInterface::METHOD_GUEST);\n+ if (!$quote->getCustomer()->getId()) {\n+ $quote->setCheckoutMethod(\\Magento\\Quote\\Api\\CartManagementInterface::METHOD_GUEST);\n}\n// check the Amazon session one last time before placing the order\n$amazonSession = $this->amazonAdapter->getCheckoutSession(\n- $cart->getStoreId(),\n+ $quote->getStoreId(),\n$amazonSessionId\n);\nif ($amazonSession['statusDetails']['state'] == 'Canceled') {\n@@ -574,15 +609,15 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$amazonAddress = $this->amazonAddressFactory->create(['address' => $address]);\n$customerAddress = $this->addressHelper->convertToMagentoEntity($amazonAddress);\n- $cart->getBillingAddress()->importCustomerAddressData($customerAddress);\n- if (empty($cart->getCustomerEmail())) {\n- $cart->setCustomerEmail($amazonSession['buyer']['email']);\n+ $quote->getBillingAddress()->importCustomerAddressData($customerAddress);\n+ if (empty($quote->getCustomerEmail())) {\n+ $quote->setCustomerEmail($amazonSession['buyer']['email']);\n}\n}\n// get payment to load it in the session, so that a salesrule that relies on payment method conditions\n// can work as expected\n- $payment = $this->magentoCheckoutSession->getQuote()->getPayment();\n+ $payment = $quote->getPayment();\n// Some checkout flows (especially 3rd party) could get to this point without setting payment method\nif (empty($payment->getMethod())) {\n@@ -594,9 +629,9 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n// collect quote totals before placing order (needed for 2.3.0 and lower)\n// https://github.com/amzn/amazon-payments-magento-2-plugin/issues/992\n- $this->magentoCheckoutSession->getQuote()->collectTotals();\n+ $quote->collectTotals();\n- $orderId = $this->cartManagement->placeOrder($cart->getId());\n+ $orderId = $this->cartManagement->placeOrder($quote->getId());\n$order = $this->orderRepository->get($orderId);\n$result = [\n'success' => true,\n@@ -604,10 +639,10 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n];\n$amazonCompleteCheckoutResult = $this->amazonAdapter->completeCheckoutSession(\n- $cart->getStoreId(),\n+ $quote->getStoreId(),\n$amazonSessionId,\n- $cart->getGrandTotal(),\n- $cart->getQuoteCurrencyCode()\n+ $quote->getGrandTotal(),\n+ $quote->getQuoteCurrencyCode()\n);\n$completeCheckoutStatus = $amazonCompleteCheckoutResult['status'] ?? '404';\nif (!preg_match('/^2\\d\\d$/', $completeCheckoutStatus)) {\n@@ -615,12 +650,12 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$this->cancelOrder($order);\n$session = $this->amazonAdapter->getCheckoutSession(\n- $cart->getStoreId(),\n+ $quote->getStoreId(),\n$amazonSessionId\n);\nif (isset($session['chargePermissionId'])) {\n$this->amazonAdapter->closeChargePermission(\n- $cart->getStoreId(),\n+ $quote->getStoreId(),\n$session['chargePermissionId'],\n'Canceled due to checkout session failed to complete',\ntrue\n@@ -643,15 +678,15 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$this->amazonConfig->getPaymentAction() == PaymentAction::AUTHORIZE_AND_CAPTURE) {\n// capture on Amazon Pay\n$this->amazonAdapter->captureCharge(\n- $cart->getStoreId(),\n+ $quote->getStoreId(),\n$chargeId,\n- $cart->getGrandTotal(),\n- $cart->getQuoteCurrencyCode()\n+ $quote->getGrandTotal(),\n+ $quote->getQuoteCurrencyCode()\n);\n// capture and invoice on the Magento side\n- $this->asyncCharge->capture($order, $chargeId, $cart->getGrandTotal());\n+ $this->asyncCharge->capture($order, $chargeId, $quote->getGrandTotal());\n}\n- $amazonCharge = $this->amazonAdapter->getCharge($cart->getStoreId(), $chargeId);\n+ $amazonCharge = $this->amazonAdapter->getCharge($quote->getStoreId(), $chargeId);\n//Send merchantReferenceId to Amazon\n$this->amazonAdapter->updateChargePermission(\n@@ -672,7 +707,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\ncase 'Authorized':\nif ($this->amazonConfig->getAuthorizationMode() == AuthorizationMode::SYNC_THEN_ASYNC) {\n$this->setProcessing($payment);\n- $this->addCaptureComment($payment, $cart, $amazonCharge['chargePermissionId']);\n+ $this->addCaptureComment($payment, $quote, $amazonCharge['chargePermissionId']);\n}\nbreak;\ncase 'Captured':\n@@ -681,7 +716,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\nif ($this->amazonConfig->getAuthorizationMode() == AuthorizationMode::SYNC_THEN_ASYNC) {\n$this->setProcessing($payment);\n- $this->addCaptureComment($payment, $cart, $chargeId);\n+ $this->addCaptureComment($payment, $quote, $chargeId);\n}\nbreak;\n}\n@@ -695,13 +730,13 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n} catch (\\Exception $e) {\n$session = $this->amazonAdapter->getCheckoutSession(\n- $cart->getStoreId(),\n+ $quote->getStoreId(),\n$amazonSessionId\n);\nif (isset($session['chargePermissionId'])) {\n$this->amazonAdapter->closeChargePermission(\n- $cart->getStoreId(),\n+ $quote->getStoreId(),\n$session['chargePermissionId'],\n'Canceled due to technical issue: ' . $e->getMessage(),\ntrue\n" }, { "change_type": "MODIFY", "old_path": "etc/webapi.xml", "new_path": "etc/webapi.xml", "diff": "<resource ref=\"anonymous\" />\n</resources>\n</route>\n+ <route url=\"/V1/amazon-checkout-session/config/:cartId\" method=\"GET\">\n+ <service class=\"Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\" method=\"getConfig\"/>\n+ <resources>\n+ <resource ref=\"anonymous\" />\n+ </resources>\n+ </route>\n<route url=\"/V1/amazon-checkout-session/:amazonSessionId/payment-descriptor\" method=\"GET\">\n<service class=\"Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\" method=\"getPaymentDescriptor\"/>\n<resources>\n<resource ref=\"anonymous\" />\n</resources>\n</route>\n+ <route url=\"/V1/amazon-checkout-session/:amazonSessionId/update/:cartId\" method=\"POST\">\n+ <service class=\"Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\" method=\"updateCheckoutSession\"/>\n+ <resources>\n+ <resource ref=\"anonymous\" />\n+ </resources>\n+ </route>\n<route url=\"/V1/amazon-checkout-session/:amazonSessionId/complete\" method=\"POST\">\n<service class=\"Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\" method=\"completeCheckoutSession\"/>\n<resources>\n<resource ref=\"anonymous\" />\n</resources>\n</route>\n+ <route url=\"/V1/amazon-checkout-session/:amazonSessionId/complete/:cartId\" method=\"POST\">\n+ <service class=\"Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\" method=\"completeCheckoutSession\"/>\n+ <resources>\n+ <resource ref=\"anonymous\" />\n+ </resources>\n+ </route>\n</routes>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-756 - add option to load quote from masked cart ID for REST requests
21,266
13.08.2021 15:17:54
14,400
5d7498a281375d66a5ac5d459863f75be5768c43
Return order increment ID from complete endpoint instead of database entity ID
[ { "change_type": "MODIFY", "old_path": "Model/CheckoutSessionManagement.php", "new_path": "Model/CheckoutSessionManagement.php", "diff": "@@ -600,7 +600,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$order = $this->orderRepository->get($orderId);\n$result = [\n'success' => true,\n- 'order_id' => $orderId,\n+ 'order_id' => $order->getIncrementId(),\n];\n$amazonCompleteCheckoutResult = $this->amazonAdapter->completeCheckoutSession(\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-766 - Return order increment ID from complete endpoint instead of database entity ID
21,247
10.08.2021 16:40:02
-7,200
3cbd383f8ec39f31445d29ff42220afbf2b3da7e
fixed amount formatting
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -128,7 +128,7 @@ class AmazonPayAdapter\n$amount = round($amount);\nbreak;\ndefault:\n- $amount = (float) $amount;\n+ $amount = (float)number_format((float)$amount, 2);\nbreak;\n}\nreturn [\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-761 - #1070 - fixed amount formatting
21,247
11.08.2021 11:11:08
-7,200
cd0fb9abbc68c229d2df82dd5367b759e1c04a14
Update Model/Adapter/AmazonPayAdapter.php
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -128,7 +128,7 @@ class AmazonPayAdapter\n$amount = round($amount);\nbreak;\ndefault:\n- $amount = (float)number_format((float)$amount, 2);\n+ $amount = (float)number_format($amount, 2, '.', '');\nbreak;\n}\nreturn [\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-761 - Update Model/Adapter/AmazonPayAdapter.php Co-authored-by: Jay Becker <jay@beckr.com>
21,266
17.08.2021 11:02:50
14,400
ab8d501475e293ce476224461c8fa762ec8b4467
Update gateway validators to use virtual types
[ { "change_type": "MODIFY", "old_path": "Gateway/Validator/GeneralResponseValidator.php", "new_path": "Gateway/Validator/GeneralResponseValidator.php", "diff": "@@ -33,6 +33,14 @@ class GeneralResponseValidator extends AbstractValidator\n*/\nprotected $validStates = [];\n+ public function __construct(\n+ \\Magento\\Payment\\Gateway\\Validator\\ResultInterfaceFactory $resultFactory,\n+ array $validStates = []\n+ ) {\n+ $this->validStates = $validStates;\n+ parent::__construct($resultFactory);\n+ }\n+\n/**\n* Performs validation of result code\n*\n" }, { "change_type": "MODIFY", "old_path": "etc/di.xml", "new_path": "etc/di.xml", "diff": "</arguments>\n</type>\n+ <!-- Gateway Response Validators -->\n+ <virtualType name=\"AuthorizeResponseValidator\" type=\"Amazon\\Pay\\Gateway\\Validator\\GeneralResponseValidator\">\n+ <arguments>\n+ <argument name=\"validStates\" xsi:type=\"array\">\n+ <item name=\"state_open\" xsi:type=\"string\">Open</item>\n+ </argument>\n+ </arguments>\n+ </virtualType>\n+\n+ <virtualType name=\"SaleResponseValidator\" type=\"Amazon\\Pay\\Gateway\\Validator\\GeneralResponseValidator\">\n+ <arguments>\n+ <argument name=\"validStates\" xsi:type=\"array\">\n+ <item name=\"state_capture_initiated\" xsi:type=\"string\">Capture Initiated</item>\n+ <item name=\"state_captured\" xsi:type=\"string\">Captured</item>\n+ <item name=\"state_open\" xsi:type=\"string\">Open</item>\n+ </argument>\n+ </arguments>\n+ </virtualType>\n+\n+ <virtualType name=\"SettlementResponseValidator\" type=\"Amazon\\Pay\\Gateway\\Validator\\GeneralResponseValidator\">\n+ <arguments>\n+ <argument name=\"validStates\" xsi:type=\"array\">\n+ <item name=\"state_capture_initiated\" xsi:type=\"string\">Capture Initiated</item>\n+ <item name=\"state_captured\" xsi:type=\"string\">Captured</item>\n+ </argument>\n+ </arguments>\n+ </virtualType>\n+\n+ <virtualType name=\"RefundResponseValidator\" type=\"Amazon\\Pay\\Gateway\\Validator\\GeneralResponseValidator\">\n+ <arguments>\n+ <argument name=\"validStates\" xsi:type=\"array\">\n+ <item name=\"state_refund_initiated\" xsi:type=\"string\">Refund Initiated</item>\n+ <item name=\"state_refunded\" xsi:type=\"string\">Refunded</item>\n+ </argument>\n+ </arguments>\n+ </virtualType>\n+\n+ <virtualType name=\"VoidResponseValidator\" type=\"Amazon\\Pay\\Gateway\\Validator\\GeneralResponseValidator\">\n+ <arguments>\n+ <argument name=\"validStates\" xsi:type=\"array\">\n+ <item name=\"state_closed\" xsi:type=\"string\">Closed</item>\n+ </argument>\n+ </arguments>\n+ </virtualType>\n+\n<!-- Authorize command -->\n<virtualType name=\"AmazonPayAuthorizeCommand\" type=\"Magento\\Payment\\Gateway\\Command\\GatewayCommand\">\n<arguments>\n<argument name=\"client\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\Client\\AuthorizeClient</argument>\n<argument name=\"handler\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Response\\AuthorizationSaleHandler</argument>\n<argument name=\"transferFactory\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\TransferFactory</argument>\n- <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\AuthorizeResponseValidator</argument>\n+ <argument name=\"validator\" xsi:type=\"object\">AuthorizeResponseValidator</argument>\n<argument name=\"errorMessageMapper\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\ErrorMapper\\VirtualErrorMessageMapper</argument>\n</arguments>\n</virtualType>\n<argument name=\"client\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\Client\\SaleClient</argument>\n<argument name=\"handler\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Response\\AuthorizationSaleHandler</argument>\n<argument name=\"transferFactory\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\TransferFactory</argument>\n- <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\SaleResponseValidator</argument>\n+ <argument name=\"validator\" xsi:type=\"object\">SaleResponseValidator</argument>\n<argument name=\"errorMessageMapper\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\ErrorMapper\\VirtualErrorMessageMapper</argument>\n</arguments>\n</virtualType>\n<argument name=\"client\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\Client\\SettlementClient</argument>\n<argument name=\"handler\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Response\\SettlementHandler</argument>\n<argument name=\"transferFactory\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\TransferFactory</argument>\n- <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\SettlementResponseValidator</argument>\n+ <argument name=\"validator\" xsi:type=\"object\">SettlementResponseValidator</argument>\n<argument name=\"errorMessageMapper\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\ErrorMapper\\VirtualErrorMessageMapper</argument>\n</arguments>\n</virtualType>\n<argument name=\"handler\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Response\\RefundHandler</argument>\n<argument name=\"transferFactory\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\TransferFactory</argument>\n<argument name=\"client\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\Client\\RefundClient</argument>\n- <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\RefundResponseValidator</argument>\n+ <argument name=\"validator\" xsi:type=\"object\">RefundResponseValidator</argument>\n<argument name=\"errorMessageMapper\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\ErrorMapper\\VirtualErrorMessageMapper</argument>\n</arguments>\n</virtualType>\n<argument name=\"handler\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Response\\VoidHandler</argument>\n<argument name=\"client\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\Client\\VoidClient</argument>\n<argument name=\"transferFactory\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Http\\TransferFactory</argument>\n- <argument name=\"validator\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\Validator\\VoidResponseValidator</argument>\n+ <argument name=\"validator\" xsi:type=\"object\">VoidResponseValidator</argument>\n<argument name=\"errorMessageMapper\" xsi:type=\"object\">Amazon\\Pay\\Gateway\\ErrorMapper\\VirtualErrorMessageMapper</argument>\n</arguments>\n</virtualType>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Update gateway validators to use virtual types
21,266
17.08.2021 13:48:47
14,400
adbe52226cc2e04cd1dfb26fbf3bce4dbb89368a
Include both order entity ID and increment ID (merchantReferenceId) on success of completeCheckoutSession
[ { "change_type": "MODIFY", "old_path": "Model/CheckoutSessionManagement.php", "new_path": "Model/CheckoutSessionManagement.php", "diff": "@@ -600,7 +600,8 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$order = $this->orderRepository->get($orderId);\n$result = [\n'success' => true,\n- 'order_id' => $order->getIncrementId(),\n+ 'order_id' => $orderId,\n+ 'increment_id' => $order->getIncrementId()\n];\n$amazonCompleteCheckoutResult = $this->amazonAdapter->completeCheckoutSession(\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-766 - Include both order entity ID and increment ID (merchantReferenceId) on success of completeCheckoutSession
21,241
18.08.2021 15:56:07
18,000
06e6d33aa07349af3a6bd047a42d2820208aac01
WIP - initial changes to support decoupled AP button render/click
[ { "change_type": "MODIFY", "old_path": "Model/CheckoutSessionManagement.php", "new_path": "Model/CheckoutSessionManagement.php", "diff": "@@ -308,6 +308,10 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n*/\npublic function getConfig()\n{\n+ // Ensure the totals are up to date, in case the checkout does something to update qty or shipping without\n+ // collecting totals\n+ $this->magentoCheckoutSession->getQuote()->collectTotals();\n+\n$result = [];\nif ($this->canCheckoutWithAmazon()) {\n$magentoQuote = $this->magentoCheckoutSession->getQuote();\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/js/amazon-button.js", "new_path": "view/frontend/web/js/amazon-button.js", "diff": "@@ -18,15 +18,17 @@ define([\n'Amazon_Pay/js/model/storage',\n'mage/url',\n'Amazon_Pay/js/amazon-checkout',\n- 'Magento_Customer/js/customer-data'\n-], function ($, checkoutSessionConfigLoad, amazonStorage, url, amazonCheckout, customerData) {\n+ 'Magento_Customer/js/customer-data',\n+ 'Magento_Checkout/js/model/payment/additional-validators'\n+], function ($, checkoutSessionConfigLoad, amazonStorage, url, amazonCheckout, customerData, additionalValidators) {\n'use strict';\n$.widget('amazon.AmazonButton', {\noptions: {\npayOnly: null,\nplacement: 'Cart',\n- hideIfUnavailable: ''\n+ hideIfUnavailable: '',\n+ buttonType: 'Normal'\n},\ndrawing: false,\n@@ -34,16 +36,17 @@ define([\n_loadButtonConfig: function (callback) {\ncheckoutSessionConfigLoad(function (checkoutSessionConfig) {\nif (!$.isEmptyObject(checkoutSessionConfig)) {\n- var payload = (this.options.placement === 'PayNow') ?\n- checkoutSessionConfig['paynow_payload'] : checkoutSessionConfig['checkout_payload'];\n- var signature = (this.options.placement === 'PayNow') ?\n- checkoutSessionConfig['paynow_signature'] : checkoutSessionConfig['checkout_signature'];\n- if (this.options.placement === 'PayNow') {\n- this.options.placement = 'Checkout';\n+ var payload = checkoutSessionConfig['checkout_payload'];\n+ var signature = checkoutSessionConfig['checkout_signature'];\n+\n+ if (this.buttonType === 'PayNow') {\n+ payload = checkoutSessionConfig['paynow_payload'];\n+ signature = checkoutSessionConfig['paynow_signature'];\n}\ncallback({\nmerchantId: checkoutSessionConfig['merchant_id'],\n+ publicKeyId: checkoutSessionConfig['public_key_id'],\nledgerCurrency: checkoutSessionConfig['currency'],\nsandbox: checkoutSessionConfig['sandbox'],\ncheckoutLanguage: checkoutSessionConfig['language'],\n@@ -57,7 +60,7 @@ define([\n}\n});\n- if (this.options.placement !== \"Checkout\" && this.options.placement !== \"PayNow\") {\n+ if (this.options.placement !== \"Checkout\") {\n$(this.options.hideIfUnavailable).show();\n}\n} else {\n@@ -83,9 +86,16 @@ define([\n* Create button\n*/\n_create: function () {\n+ var self = this;\n+ if (this.options.placement === 'PayNow') {\n+ // PayNow is not a valid placement for Amazon Pay API, only used for changing payload\n+ this.options.placement = 'Checkout';\n+ this.buttonType = 'PayNow';\n+ }\n+\nthis._draw();\n- if (this.options.placement == 'Product') {\n+ if (this.options.placement === 'Product') {\nthis._redraw();\n}\n},\n@@ -105,9 +115,21 @@ define([\n$buttonContainer.empty().append($buttonRoot);\nthis._loadButtonConfig(function (buttonConfig) {\n- amazon.Pay.renderButton('#' + $buttonRoot.empty().removeUniqueId().uniqueId().attr('id'), buttonConfig);\n+ // do not use session config for decoupled button\n+ delete buttonConfig.createCheckoutSessionConfig;\n+ var amazonPayButton = amazon.Pay.renderButton('#' + $buttonRoot.empty().removeUniqueId().uniqueId().attr('id'), buttonConfig);\n+ amazonPayButton.onClick(function() {\n+ if (self.buttonType === 'PayNow' && !additionalValidators.validate()) {\n+ return false;\n+ }\n+\n+ self._loadButtonConfig(function (buttonConfig) {\n+ var initConfig = {createCheckoutSessionConfig: buttonConfig.createCheckoutSessionConfig};\n+ amazonPayButton.initCheckout(initConfig);\n+ });\n+ customerData.invalidate('*');\n+ });\n$('.amazon-button-container .field-tooltip').fadeIn();\n- $('.amazon-checkout-button').click(function() { customerData.invalidate('*'); });\nself.drawing = false;\n});\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-726 - WIP - initial changes to support decoupled AP button render/click
21,241
23.08.2021 15:12:37
18,000
a879e42f13ed6c491d000ac3d679b9a74d86f844
remove use of isPlaceOrderActionAllowed
[ { "change_type": "MODIFY", "old_path": "view/frontend/web/js/view/payment/method-renderer/amazon-payment-method.js", "new_path": "view/frontend/web/js/view/payment/method-renderer/amazon-payment-method.js", "diff": "@@ -45,7 +45,6 @@ define(\ndefaults: {\nisAmazonCheckout: ko.observable(amazonStorage.isAmazonCheckout()),\nisBillingAddressVisible: ko.observable(false),\n- isPlaceOrderActionAllowed: billingFormAddressState.isValid,\npaymentDescriptor: ko.observable(''),\nlogo: 'Amazon_Pay/images/logo/Black-L.png',\ntemplate: 'Amazon_Pay/payment/amazon-payment-method'\n@@ -84,7 +83,6 @@ define(\nvar checkoutProvider = registry.get('checkoutProvider');\ncheckoutSessionAddressLoad('billing', function (amazonAddress) {\nif ($.isEmptyObject(amazonAddress)) {\n- self.isPlaceOrderActionAllowed(true);\nreturn;\n}\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/template/payment/amazon-payment-method.html", "new_path": "view/frontend/web/template/payment/amazon-payment-method.html", "diff": "data-bind=\"\nclick: placeOrder,\nattr: {title: $t('Place Order')},\n- css: {disabled: !isPlaceOrderActionAllowed()},\nenable: (getCode() == isChecked())\n\"\ndisabled>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-681 - remove use of isPlaceOrderActionAllowed
21,241
24.08.2021 16:09:20
18,000
505b6aaa6016a5848b84993e18c9af96d17fccd9
Version bump to 5.7.0 and add to changelog
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -48,7 +48,7 @@ The following table provides an overview on which Git branch is compatible to wh\nMagento Version | Github Branch | Latest release\n---|---|---\n2.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)\n-2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.6.0\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.7.0\n## Release Notes\nSee [CHANGELOG.md](/CHANGELOG.md)\n" }, { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"name\": \"amzn/amazon-pay-magento-2-module\",\n\"description\": \"Official Magento2 Plugin to integrate with Amazon Pay\",\n\"type\": \"magento2-module\",\n- \"version\": \"5.6.0\",\n+ \"version\": \"5.7.0\",\n\"license\": [\n\"Apache-2.0\"\n],\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Version bump to 5.7.0 and add to changelog
21,266
26.08.2021 14:47:09
14,400
38f50bb6e191f597b57d79b643b7f19fd49b7785
Remove PID and buyerToken from logs
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -459,8 +459,29 @@ class AmazonPayAdapter\n// Log\n$isError = !in_array($response['status'], [200, 201]);\nif ($isError || $this->amazonConfig->isLoggingEnabled()) {\n- $debugBackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);\n- $this->logger->debug($functionName . ' <- ', $debugBackTrace[1]['args']);\n+ $this->logSanitized($functionName, $response, $isError);\n+ }\n+\n+ return $response;\n+ }\n+\n+ protected function logSanitized($functionName, $response, $isError)\n+ {\n+ $debugBackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 3);\n+ $buyerKeys = ['buyerId' => '', 'primeMembershipTypes' => '', 'status' => ''];\n+\n+ if ($functionName == 'getBuyer') {\n+ $response = array_intersect_key($response, $buyerKeys);\n+ $debugBackTrace[2]['args'] = [];\n+ }\n+\n+ if (isset($response['buyer'])) {\n+ $response['buyer'] = array_intersect_key($response['buyer'], $buyerKeys);\n+ }\n+\n+ unset($response['shippingAddress'], $response['billingAddress']);\n+\n+ $this->logger->debug($functionName . ' <- ', $debugBackTrace[2]['args']);\nif ($isError) {\n$this->logger->error($functionName . ' -> ', $response);\n} else {\n@@ -468,9 +489,6 @@ class AmazonPayAdapter\n}\n}\n- return $response;\n- }\n-\n/**\n* Generate idempotency header\n*\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-769 - Remove PID and buyerToken from logs
21,241
31.08.2021 09:33:38
18,000
09db423b07bd4972ec0dd5d7852784c485b5b26c
if no phone number is provided, use "0" to satisfy Amazon API
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -570,6 +570,10 @@ class AmazonPayAdapter\n$addressData = array_filter($addressData);\n+ if (!array_key_exists('phoneNumber', $addressData)) {\n+ $addressData['phoneNumber'] = \"0\";\n+ }\n+\n$payload['addressDetails'] = $addressData;\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-755 - if no phone number is provided, use "0" to satisfy Amazon API
21,241
31.08.2021 14:45:33
18,000
d12017faf2b954baf7269cbdeae8e289f350dbc3
also remove fields from address if they are a single dash "-"
[ { "change_type": "MODIFY", "old_path": "Model/Adapter/AmazonPayAdapter.php", "new_path": "Model/Adapter/AmazonPayAdapter.php", "diff": "@@ -568,8 +568,12 @@ class AmazonPayAdapter\n$addressData[$addressKey] = $streetLine;\n}\n- $addressData = array_filter($addressData);\n+ // Remove empty fields, or ones that contain only \"-\"\n+ $addressData = array_filter($addressData, function ($val) {\n+ return !empty($val) && $val != \"-\";\n+ });\n+ // Make sure phone number is set for PayNow button\nif (!array_key_exists('phoneNumber', $addressData)) {\n$addressData['phoneNumber'] = \"0\";\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-755 - also remove fields from address if they are a single dash "-"
21,241
31.08.2021 16:32:13
18,000
5673ce274bd8a10f5ee2f25a1fe73e646d31f583
Version bump to 5.7.1 and add to changelog
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "# Change Log\n+## 5.7.1\n+* Fixed issue when phone number not required and entered in Magento\n+* Updated API calls to take in a masked cart ID so they can be used without relying on Magento sessions\n+* Updated logging to sanitize some data\n+\n## 5.7.0\n* Changed the response of completeCheckoutSession API call to include both increment ID and order ID\n* Fixed issue with logging in when a customer has an empty password hash (thanks @rafczow!)\n* Fixed issue where using Amazon Pay in the Payment Methods section did not work on one step checkouts\n* Fixed issue where using Amazon Pay in the Payment Methods section could bypass agreeing to Terms and Conditions\n* Removed usage of isPlaceOrderActionAllowed in js components\n-* Updated API calls to take in a masked cart ID so they can be used without relying on Magento sessions\n* Updated response validators to look for specific response code and states\n## 5.6.0\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -48,7 +48,7 @@ The following table provides an overview on which Git branch is compatible to wh\nMagento Version | Github Branch | Latest release\n---|---|---\n2.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)\n-2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.7.0\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.7.1\n## Release Notes\nSee [CHANGELOG.md](/CHANGELOG.md)\n" }, { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"name\": \"amzn/amazon-pay-magento-2-module\",\n\"description\": \"Official Magento2 Plugin to integrate with Amazon Pay\",\n\"type\": \"magento2-module\",\n- \"version\": \"5.7.0\",\n+ \"version\": \"5.7.1\",\n\"license\": [\n\"Apache-2.0\"\n],\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Version bump to 5.7.1 and add to changelog
21,266
01.09.2021 15:25:01
14,400
6b5cf376988368e276495d3623a072c490758386
Allow custom order status to be displayed for certain payment/authorization flows
[ { "change_type": "MODIFY", "old_path": "Model/AsyncManagement/Charge.php", "new_path": "Model/AsyncManagement/Charge.php", "diff": "@@ -288,6 +288,7 @@ class Charge extends AbstractOperation\nif ($invoice && ($invoice->canCapture() || $invoice->getOrder()->getStatus() == Order::STATE_PAYMENT_REVIEW)) {\n$order = $invoice->getOrder();\n+ $this->setProcessing($order);\n$payment = $order->getPayment();\n$invoice->setTransactionId($chargeId);\n@@ -308,7 +309,6 @@ class Charge extends AbstractOperation\n$payment->setDataUsingMethod('base_amount_paid_online', $chargeAmount);\n$payment->addTransactionCommentsToOrder($transaction, $message);\n$transaction->setIsClosed(true);\n- $this->setProcessing($order);\n$order->save();\n$this->asyncLogger->info('Captured Order #' . $order->getIncrementId());\n} else {\n" }, { "change_type": "MODIFY", "old_path": "Model/CheckoutSessionManagement.php", "new_path": "Model/CheckoutSessionManagement.php", "diff": "@@ -477,9 +477,9 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\nif (!empty($invoiceCollection->getItems())) {\n$invoiceCollection->getFirstItem()->pay();\n}\n- $order->setState(\\Magento\\Sales\\Model\\Order::STATE_PROCESSING)->setStatus(\n- \\Magento\\Sales\\Model\\Order::STATE_PROCESSING\n- );\n+ $state = \\Magento\\Sales\\Model\\Order::STATE_PROCESSING;\n+ $status = $order->getConfig()->getStateDefaultStatus($state);\n+ $order->setState($state)->setStatus($status);\n$this->orderRepository->save($order);\n}\n" }, { "change_type": "MODIFY", "old_path": "etc/config.xml", "new_path": "etc/config.xml", "diff": "<title>Amazon Pay</title>\n<sort_order>1</sort_order>\n<model>AmazonPayFacade</model>\n- <order_status>processing</order_status>\n<payment_action>authorize</payment_action>\n<can_authorize>1</can_authorize>\n<can_capture>1</can_capture>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-722 - Allow custom order status to be displayed for certain payment/authorization flows
21,266
02.09.2021 13:08:23
14,400
0a8c793805a10d00de5bc5cb6e7c041dbf1d85d5
Handle cancelling orders with no saved chargePermissionId (created in CV1)
[ { "change_type": "MODIFY", "old_path": "Gateway/Request/VoidRequestBuilder.php", "new_path": "Gateway/Request/VoidRequestBuilder.php", "diff": "@@ -50,7 +50,7 @@ class VoidRequestBuilder implements BuilderInterface\n// If we do not have a charge permission on the payment, try the first 3 sections of transaction ID\nif (empty($chargePermissionId)) {\n- $transactionId = explode('-', $paymentDO->getPayment()->getParentTransactionId());\n+ $transactionId = explode('-', $paymentDO->getPayment()->getAuthorizationTransaction()->getTxnId());\n$chargePermissionId = implode('-', array_slice($transactionId, 0, 3));\n}\n" }, { "change_type": "MODIFY", "old_path": "Plugin/PaymentTransactionIdUpdate.php", "new_path": "Plugin/PaymentTransactionIdUpdate.php", "diff": "@@ -39,7 +39,7 @@ class PaymentTransactionIdUpdate\nif (strpos($paymentMethodTitle, 'Amazon Pay') !== false && $type == Transaction::TYPE_VOID) {\n$chargePermissionId = $payment->getAdditionalInformation('charge_permission_id');\nif (empty($chargePermissionId)) {\n- $transactionId = explode('-', $payment->getParentTransactionId());\n+ $transactionId = explode('-', $payment->getAuthorizationTransaction()->getTxnId());\n$chargePermissionId = implode('-', array_slice($transactionId, 0, 3));\n}\n$payment->setTransactionId($chargePermissionId . '-void');\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-776 - Handle cancelling orders with no saved chargePermissionId (created in CV1)
21,266
07.09.2021 13:48:17
14,400
4d9f48baba174ea7dc2af489fbcf08b542ec70b0
Trigger click on Pay Now button from standard Place Order button when using Iosc module
[ { "change_type": "MODIFY", "old_path": "view/frontend/web/js/view/payment/method-renderer/amazon-payment-method.js", "new_path": "view/frontend/web/js/view/payment/method-renderer/amazon-payment-method.js", "diff": "@@ -45,6 +45,7 @@ define(\ndefaults: {\nisAmazonCheckout: ko.observable(amazonStorage.isAmazonCheckout()),\nisBillingAddressVisible: ko.observable(false),\n+ isIosc: ko.observable($('button.iosc-place-order-button').length > 0),\npaymentDescriptor: ko.observable(''),\nlogo: 'Amazon_Pay/images/logo/Black-L.png',\ntemplate: 'Amazon_Pay/payment/amazon-payment-method'\n@@ -138,6 +139,15 @@ define(\nreturn false;\n},\n+ /**\n+ * Redirect Place Order clicks to Amazon button in Pay Now flow for OSC\n+ */\n+ payNow: function () {\n+ $('#PayWithAmazonButton')\n+ .find('div')\n+ .trigger('click');\n+ },\n+\n/**\n* Set email address\n* @param email\n" }, { "change_type": "MODIFY", "old_path": "view/frontend/web/template/payment/amazon-payment-method.html", "new_path": "view/frontend/web/template/payment/amazon-payment-method.html", "diff": "<!-- ko template: getTemplate() --><!-- /ko -->\n<!--/ko-->\n</div>\n- <!-- ko if: isAmazonCheckout -->\n+ <!-- ko if: isAmazonCheckout() || isIosc() -->\n<div class=\"actions-toolbar\">\n<div class=\"primary\">\n<button class=\"action primary checkout\"\ntype=\"submit\"\ndata-bind=\"\n- click: placeOrder,\n+ click: isAmazonCheckout() ? placeOrder : payNow,\nattr: {title: $t('Place Order')},\nenable: (getCode() == isChecked())\n\"\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
ASD-771 - Trigger click on Pay Now button from standard Place Order button when using Iosc module