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,250 | 09.09.2021 12:39:48 | 10,800 | 9d2b65b09118695c02d3eb253171f44d8cae2ef5 | config API endpoint doesn't return correct response | [
{
"change_type": "MODIFY",
"old_path": "CustomerData/CheckoutSession.php",
"new_path": "CustomerData/CheckoutSession.php",
"diff": "@@ -48,6 +48,10 @@ class CheckoutSession\n*/\npublic function getConfig()\n{\n- return $this->checkoutSessionManagement->getConfig();\n+ $data = $this->checkoutSessionManagement->getConfig();\n+ if (count($data) > 0) {\n+ $data = $data[0];\n+ }\n+ return $data;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -358,7 +358,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$this->amazonConfig->getPaymentAction()\n);\n- $result = [\n+ $result[] = [\n'merchant_id' => $this->amazonConfig->getMerchantId(),\n'currency' => $this->amazonConfig->getCurrencyCode(),\n'button_color' => $this->amazonConfig->getButtonColor(),\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-783: config API endpoint doesn't return correct response |
21,250 | 13.09.2021 12:24:02 | 10,800 | f2b473c697eb647421f34e48713a22326ef7c9d4 | Magento Swagger crashes due to parameter notation in API interface | [
{
"change_type": "MODIFY",
"old_path": "Api/CheckoutSessionManagementInterface.php",
"new_path": "Api/CheckoutSessionManagementInterface.php",
"diff": "@@ -21,7 +21,7 @@ namespace Amazon\\Pay\\Api;\ninterface CheckoutSessionManagementInterface\n{\n/**\n- * @param mixed|null $cartId\n+ * @param string|null $cartId\n* @return mixed\n*/\npublic function getConfig($cartId = null);\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-788: Magento Swagger crashes due to parameter notation in API interface |
21,250 | 13.09.2021 15:45:15 | 10,800 | ac350f7816aae090a65cf7259c0c035b358b5092 | added some log to completeCheckoutSession | [
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -145,6 +145,11 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n*/\nprivate $maskedQuoteIdConverter;\n+ /**\n+ * @var \\Amazon\\Pay\\Logger\\Logger\n+ */\n+ private $logger;\n+\n/**\n* CheckoutSessionManagement constructor.\n* @param \\Magento\\Store\\Model\\StoreManagerInterface $storeManager\n@@ -167,6 +172,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n* @param \\Magento\\Framework\\Api\\SearchCriteriaBuilder $searchCriteriaBuilder\n* @param \\Magento\\Sales\\Model\\ResourceModel\\Order\\CollectionFactory $orderCollectionFactory\n* @param MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdConverter\n+ * @param \\Amazon\\Pay\\Logger\\Logger $logger\n*/\npublic function __construct(\n\\Magento\\Store\\Model\\StoreManagerInterface $storeManager,\n@@ -188,7 +194,8 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n\\Magento\\Sales\\Api\\TransactionRepositoryInterface $transactionRepository,\n\\Magento\\Framework\\Api\\SearchCriteriaBuilder $searchCriteriaBuilder,\n\\Magento\\Sales\\Model\\ResourceModel\\Order\\CollectionFactory $orderCollectionFactory,\n- MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdConverter\n+ MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdConverter,\n+ \\Amazon\\Pay\\Logger\\Logger $logger\n) {\n$this->storeManager = $storeManager;\n$this->quoteIdMaskFactory = $quoteIdMaskFactory;\n@@ -210,6 +217,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$this->searchCriteriaBuilder = $searchCriteriaBuilder;\n$this->orderCollectionFactory = $orderCollectionFactory;\n$this->maskedQuoteIdConverter = $maskedQuoteIdConverter;\n+ $this->logger = $logger;\n}\n/**\n@@ -578,6 +586,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n}\nif (empty($amazonSessionId) || !$this->canCheckoutWithAmazon($quote) || !$this->canSubmitQuote($quote)) {\n+ $this->logger->debug(\"Unable to complete Amazon Pay checkout. Can't submit quote id: \" . $quote->getId());\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-773: added some log to completeCheckoutSession |
21,250 | 15.09.2021 15:00:48 | 10,800 | 710b85beabf09386f703c9a9ed701d592805c301 | Street multilne count fix for EE | [
{
"change_type": "MODIFY",
"old_path": "Helper/Address.php",
"new_path": "Helper/Address.php",
"diff": "@@ -23,6 +23,8 @@ use Magento\\Customer\\Api\\Data\\AddressInterfaceFactory;\nuse Magento\\Customer\\Api\\Data\\RegionInterfaceFactory;\nuse Magento\\Directory\\Model\\RegionFactory;\nuse Magento\\Framework\\App\\Config\\ScopeConfigInterface;\n+use Magento\\Framework\\App\\ProductMetadataInterface;\n+use Magento\\Eav\\Model\\Config as EavConfig;\nclass Address\n{\n@@ -46,16 +48,30 @@ class Address\n*/\nprivate $scopeConfig;\n+ /**\n+ * @var eavConfig\n+ */\n+ private $eavConfig;\n+\n+ /**\n+ * @var productMetadata\n+ */\n+ private $productMetadata;\n+\npublic function __construct(\nAddressInterfaceFactory $addressFactory,\nRegionFactory $regionFactory,\nRegionInterfaceFactory $regionDataFactory,\n- ScopeConfigInterface $config\n+ ScopeConfigInterface $config,\n+ EavConfig $eavConfig,\n+ ProductMetadataInterface $productMetadata\n) {\n$this->addressFactory = $addressFactory;\n$this->regionFactory = $regionFactory;\n$this->regionDataFactory = $regionDataFactory;\n$this->scopeConfig = $config;\n+ $this->productMetadata = $productMetadata;\n+ $this->eavConfig = $eavConfig;\n}\n/**\n@@ -67,10 +83,17 @@ class Address\n*/\npublic function convertToMagentoEntity(AmazonAddressInterface $amazonAddress)\n{\n+ if ($this->productMetadata->getEdition() == 'Enterprise') {\n+ $addressLinesAllowed = (int) $this->eavConfig->getAttribute(\n+ 'customer_address',\n+ 'street'\n+ )->getMultilineCount();\n+ } else {\n$addressLinesAllowed = (int) $this->scopeConfig->getValue(\n'customer/address/street_lines',\n\\Magento\\Store\\Model\\ScopeInterface::SCOPE_STORE\n);\n+ }\n$address = $this->addressFactory->create();\n$address->setFirstname($amazonAddress->getFirstName());\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-785: Street multilne count fix for EE |
21,241 | 20.09.2021 15:10:02 | 18,000 | bb12f844158ea2bdcf32a6498f649a7982b93921 | Version bump to 5.8.0 and add to changelog | [
{
"change_type": "MODIFY",
"old_path": "CHANGELOG.md",
"new_path": "CHANGELOG.md",
"diff": "# Change Log\n+## 5.8.0\n+* Added log message if we are unable to complete checkout session due to an existing order with same quoteId\n+* Added email when asynchronous order processing is declined\n+* Fixed issue with Magento Open Source when configured to only allow a single address line\n+* Fixed API output for config endpoint to return key/value pairs\n+* Fixed issue generating Swagger docs (thanks @ebaschiera!)\n+* Fixed issue with canceling transactions started prior to upgrading to CV2/Marketplace module\n+* Fixed issue where the Amazon Pay payment method button on Onestepcheckout_Iosc would not trigger when clicking Place Order\n+\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"
},
{
"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.1\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.8.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.7.1\",\n+ \"version\": \"5.8.0\",\n\"license\": [\n\"Apache-2.0\"\n],\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Version bump to 5.8.0 and add to changelog |
21,241 | 22.09.2021 21:55:49 | 18,000 | c9705bb7978300926a179d2f4cf449fb1a57a9a3 | add config options for checkoutReviewReturnUrl and checkoutResultReturnUrl | [
{
"change_type": "MODIFY",
"old_path": "Model/Adapter/AmazonPayAdapter.php",
"new_path": "Model/Adapter/AmazonPayAdapter.php",
"diff": "@@ -174,7 +174,7 @@ class AmazonPayAdapter\n$payload = [\n'webCheckoutDetails' => [\n- 'checkoutResultReturnUrl' => $this->url->getRouteUrl('amazon_pay/checkout/completeSession')\n+ 'checkoutResultReturnUrl' => $this->amazonConfig->getCheckoutResultReturnUrl()\n],\n'paymentDetails' => [\n'paymentIntent' => $paymentIntent,\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/AmazonConfig.php",
"new_path": "Model/AmazonConfig.php",
"diff": "@@ -523,8 +523,13 @@ class AmazonConfig\n*/\npublic function getCheckoutReviewReturnUrl($scope = ScopeInterface::SCOPE_STORE, $scopeCode = null)\n{\n+ $route = $this->scopeConfig->getValue(\n+ 'payment/amazon_payment_v2/checkout_review_return_url',\n+ $scope,\n+ $scopeCode\n+ );\nreturn $this->storeManager->getStore()->getUrl(\n- 'amazon_pay/login/checkout',\n+ $route,\n['_forced_secure' => true]\n);\n}\n@@ -545,6 +550,22 @@ class AmazonConfig\nreturn $result;\n}\n+ /**\n+ *\n+ */\n+ public function getCheckoutResultReturnUrl($scope = ScopeInterface::SCOPE_STORE, $scopeCode = null)\n+ {\n+ $route = $this->scopeConfig->getValue(\n+ 'payment/amazon_payment_v2/checkout_result_return_url',\n+ $scope,\n+ $scopeCode\n+ );\n+ return $this->storeManager->getStore()->getUrl(\n+ $route,\n+ ['_forced_secure' => true]\n+ );\n+ }\n+\n/**\n* @return string\n*/\n@@ -566,10 +587,7 @@ class AmazonConfig\n*/\npublic 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+ return $this->getCheckoutResultReturnUrl($scope, $scopeCode);\n}\n/**\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/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+ <field id=\"checkout_review_return_url\" translate=\"label comment\" type=\"text\" sortOrder=\"18\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n+ <label>Amazon checkout review return URL</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 />Magento redirect to this URL after processing the Amazon session initiation.]]></comment>\n+ <config_path>payment/amazon_payment_v2/checkout_review_return_url</config_path>\n+ </field>\n+ <field id=\"checkout_review_url\" translate=\"label comment\" type=\"text\" sortOrder=\"19\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\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</field>\n- <field id=\"checkout_result_url\" translate=\"label comment\" type=\"text\" sortOrder=\"20\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n+ <field id=\"checkout_result_return_url\" translate=\"label comment\" type=\"text\" sortOrder=\"20\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n+ <label>Amazon checkout result return URL</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 initiating the transaction. Do not use a leading slash.]]></comment>\n+ <config_path>payment/amazon_payment_v2/checkout_result_return_url</config_path>\n+ </field>\n+ <field id=\"checkout_result_url\" translate=\"label comment\" type=\"text\" sortOrder=\"21\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\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+ <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 />Magento will redirect to this URL after completing the checkout session. Do not use a leading slash.]]></comment>\n<config_path>payment/amazon_payment_v2/checkout_result_url</config_path>\n</field>\n<field id=\"loglist_v2\" translate=\"label\" type=\"text\" sortOrder=\"30\" showInDefault=\"1\" showInWebsite=\"0\" showInStore=\"0\">\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_return_url>amazon_pay/login/checkout</checkout_review_return_url>\n<checkout_review_url>checkout</checkout_review_url>\n+ <checkout_result_return_url>amazon_pay/checkout/completeSession</checkout_result_return_url>\n<checkout_result_url>checkout/onepage/success</checkout_result_url>\n<can_use_internal>0</can_use_internal>\n</amazon_payment_v2>\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-782 - add config options for checkoutReviewReturnUrl and checkoutResultReturnUrl |
21,241 | 23.09.2021 09:44:35 | 18,000 | 301b073cd07d977fc259fb7d406f70ae98e9e257 | add optional masked cart ID to /amazon_pay/login/checkout path | [
{
"change_type": "MODIFY",
"old_path": "Controller/Login/Checkout.php",
"new_path": "Controller/Login/Checkout.php",
"diff": "@@ -17,7 +17,9 @@ namespace Amazon\\Pay\\Controller\\Login;\nuse Amazon\\Pay\\Api\\Data\\AmazonCustomerInterface;\nuse Amazon\\Pay\\Domain\\ValidationCredentials;\n+use Magento\\Framework\\Exception\\NoSuchEntityException;\nuse Magento\\Framework\\Exception\\ValidatorException;\n+use Magento\\Quote\\Api\\Data\\CartInterface;\nuse Zend_Validate;\nclass Checkout extends \\Amazon\\Pay\\Controller\\Login\n@@ -28,6 +30,7 @@ class Checkout extends \\Amazon\\Pay\\Controller\\Login\npublic function execute()\n{\n$checkoutSessionId = $this->getRequest()->getParam('amazonCheckoutSessionId');\n+ $maskedQuoteId = $this->getRequest()->getParam('magentoCartId');\nif ($checkoutSessionId == '') {\nreturn $this->_redirect('checkout/cart');\n}\n@@ -42,7 +45,7 @@ class Checkout extends \\Amazon\\Pay\\Controller\\Login\n$userInfo = $checkoutSession['buyer'];\nif ($userInfo && isset($userInfo['email'])) {\n$userEmail = $userInfo['email'];\n- $quote = $this->session->getQuote();\n+ $quote = $this->session->getQuoteFromIdOrSession($maskedQuoteId);\nif ($quote) {\n$quote->setCustomerEmail($userEmail);\n"
},
{
"change_type": "MODIFY",
"old_path": "Helper/Session.php",
"new_path": "Helper/Session.php",
"diff": "@@ -21,6 +21,9 @@ use Magento\\Customer\\Api\\Data\\CustomerInterface;\nuse Magento\\Customer\\Model\\Session as CustomerSession;\nuse Magento\\Checkout\\Model\\Session as CheckoutSession;\nuse Magento\\Framework\\Event\\ManagerInterface as EventManagerInterface;\n+use Magento\\Framework\\Exception\\NoSuchEntityException;\n+use Magento\\Quote\\Api\\CartRepositoryInterface;\n+use Magento\\Quote\\Model\\MaskedQuoteIdToQuoteIdInterface;\nclass Session\n{\n@@ -39,6 +42,16 @@ class Session\n*/\nprivate $eventManager;\n+ /**\n+ * @var CartRepositoryInterface\n+ */\n+ private $cartRepository;\n+\n+ /**\n+ * @var MaskedQuoteIdToQuoteIdInterface\n+ */\n+ private $maskedQuoteIdConverter;\n+\n/**\n* Session constructor.\n* @param CustomerSession $session\n@@ -48,11 +61,15 @@ class Session\npublic function __construct(\nCustomerSession $session,\nEventManagerInterface $eventManager,\n- CheckoutSession $checkoutSession\n+ CheckoutSession $checkoutSession,\n+ CartRepositoryInterface $cartRepository,\n+ MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdConverter\n) {\n$this->session = $session;\n$this->checkoutSession = $checkoutSession;\n$this->eventManager = $eventManager;\n+ $this->cartRepository = $cartRepository;\n+ $this->maskedQuoteIdConverter = $maskedQuoteIdConverter;\n}\n/**\n@@ -187,4 +204,27 @@ class Session\n{\nreturn $this->checkoutSession->getQuote();\n}\n+\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+ public function getQuoteFromIdOrSession($cartId = null)\n+ {\n+ try {\n+ if (empty($cartId)) {\n+ $quote = $this->session->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"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-782 - add optional masked cart ID to /amazon_pay/login/checkout path |
21,250 | 23.09.2021 13:22:27 | 10,800 | 9a241539f2f0008b7da39907ccf3e9c15410c61c | Alexa Notification > carrier mapping | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "Helper/Alexa.php",
"diff": "+<?php\n+/**\n+ * Copyright 2020 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+namespace Amazon\\Pay\\Helper;\n+\n+use Magento\\Framework\\Module\\Dir;\n+use Magento\\Framework\\Serialize\\SerializerInterface;\n+\n+class Alexa\n+{\n+ /**\n+ * @var \\Magento\\Framework\\Module\\Dir\n+ */\n+ private $moduleDir;\n+\n+ /**\n+ * @var \\Magento\\Framework\\File\\Csv\n+ */\n+ private $csv;\n+\n+ /**\n+ * @var \\Magento\\Framework\\Config\\CacheInterface\n+ */\n+ private $cache;\n+\n+ /**\n+ * @var SerializerInterface\n+ */\n+ private $serializer;\n+\n+ /**\n+ * @param Dir $moduleDir\n+ * @param \\Magento\\Framework\\File\\Csv $csv\n+ * @param \\Magento\\Framework\\Config\\CacheInterface $cache\n+ * @param SerializerInterface $serializer\n+ */\n+ public function __construct(\n+ Dir $moduleDir,\n+ \\Magento\\Framework\\File\\Csv $csv,\n+ \\Magento\\Framework\\Config\\CacheInterface $cache,\n+ SerializerInterface $serializer\n+ ) {\n+ $this->moduleDir = $moduleDir;\n+ $this->csv = $csv;\n+ $this->cache = $cache;\n+ $this->serializer = $serializer;\n+ }\n+\n+ /**\n+ * @return array\n+ */\n+ public function getDeliveryCarriers()\n+ {\n+ $cacheKey = hash('sha256', __METHOD__);\n+ $result = $this->cache->load($cacheKey);\n+ if ($result) {\n+ // phpcs:ignore Magento2.Functions.DiscouragedFunction\n+ $result = $this->serializer->unserialize(gzuncompress($result));\n+ }\n+ if (!$result) {\n+ $result = $this->fetchDeliveryCarriers();\n+ $this->cache->save(\n+ // phpcs:ignore Magento2.Functions.DiscouragedFunction\n+ gzcompress($this->serializer->serialize($result)),\n+ $cacheKey\n+ );\n+ }\n+ return $result;\n+ }\n+\n+ /**\n+ * @return array\n+ */\n+ protected function fetchDeliveryCarriers()\n+ {\n+ $result = [];\n+ $fileName = implode(DIRECTORY_SEPARATOR, [\n+ $this->moduleDir->getDir('Amazon_Pay', Dir::MODULE_ETC_DIR),\n+ 'files',\n+ 'amazon-pay-delivery-tracker-supported-carriers.csv'\n+ ]);\n+ foreach ($this->csv->getData($fileName) as $row) {\n+ list($carrierTitle, $carrierCode) = $row;\n+ $result[] = ['code' => $carrierCode, 'title' => $carrierTitle];\n+ }\n+ return $result;\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/Alexa.php",
"new_path": "Model/Alexa.php",
"diff": "@@ -18,9 +18,8 @@ namespace Amazon\\Pay\\Model;\nuse Amazon\\Pay\\Client\\ClientFactoryInterface;\nuse Amazon\\Pay\\Logger\\AlexaLogger;\n-use Magento\\Framework\\Module\\Dir;\n+use Amazon\\Pay\\Helper\\Alexa as AlexaHelper;\nuse Magento\\Framework\\Phrase;\n-use Magento\\Framework\\Serialize\\SerializerInterface;\nuse Magento\\Sales\\Model\\Order\\Payment;\nuse Magento\\Store\\Model\\ScopeInterface;\n@@ -42,54 +41,33 @@ class Alexa\nprivate $transactionRepository;\n/**\n- * @var Dir\n- */\n- private $moduleDir;\n-\n- /**\n- * @var \\Magento\\Framework\\File\\Csv\n- */\n- private $csv;\n-\n- /**\n- * @var \\Magento\\Framework\\Config\\CacheInterface\n- */\n- private $cache;\n-\n- /**\n- * @var SerializerInterface\n+ * @var \\Amazon\\Pay\\Logger\\AlexaLogger\n*/\n- private $serializer;\n+ private $alexaLogger;\n/**\n- * @var \\Amazon\\Pay\\Logger\\AlexaLogger\n+ * @var AlexaHelper\n*/\n- private $alexaLogger;\n+ private $alexaHelper;\n/**\n* @param AmazonConfig $amazonConfig\n* @param ClientFactoryInterface $clientFactory\n* @param Payment\\Transaction\\Repository $transactionRepository\n- * @param Dir $moduleDir\n- * @param \\Magento\\Framework\\File\\Csv $csv\n+ * @param AlexaHelper $alexaHelper\n+ * @param AlexaLogger $alexaLogger\n*/\npublic function __construct(\nAmazonConfig $amazonConfig,\nClientFactoryInterface $clientFactory,\nPayment\\Transaction\\Repository $transactionRepository,\n- Dir $moduleDir,\n- \\Magento\\Framework\\File\\Csv $csv,\n- \\Magento\\Framework\\Config\\CacheInterface $cache,\n- SerializerInterface $serializer,\n+ AlexaHelper $alexaHelper,\nAlexaLogger $alexaLogger\n) {\n$this->amazonConfig = $amazonConfig;\n$this->clientFactory = $clientFactory;\n$this->transactionRepository = $transactionRepository;\n- $this->moduleDir = $moduleDir;\n- $this->csv = $csv;\n- $this->cache = $cache;\n- $this->serializer = $serializer;\n+ $this->alexaHelper = $alexaHelper;\n$this->alexaLogger = $alexaLogger;\n}\n@@ -181,42 +159,15 @@ class Alexa\nreturn $response['chargePermissionId'];\n}\n- /**\n- * @return array\n- */\n- protected function fetchDeliveryCarriers()\n- {\n- $result = [];\n- $fileName = implode(DIRECTORY_SEPARATOR, [\n- $this->moduleDir->getDir('Amazon_Pay', Dir::MODULE_ETC_DIR),\n- 'files',\n- 'amazon-pay-delivery-tracker-supported-carriers.csv'\n- ]);\n- foreach ($this->csv->getData($fileName) as $row) {\n- list($carrierTitle, $carrierCode) = $row;\n- $result[$carrierTitle] = $carrierCode;\n- }\n- return $result;\n- }\n-\n/**\n* @return array\n*/\nprotected function getDeliveryCarriers()\n{\n- $cacheKey = hash('sha256', __METHOD__);\n- $result = $this->cache->load($cacheKey);\n- if ($result) {\n- // phpcs:ignore Magento2.Functions.DiscouragedFunction\n- $result = $this->serializer->unserialize(gzuncompress($result));\n- }\n- if (!$result) {\n- $result = $this->fetchDeliveryCarriers();\n- $this->cache->save(\n- // phpcs:ignore Magento2.Functions.DiscouragedFunction\n- gzcompress($this->serializer->serialize($result)),\n- $cacheKey\n- );\n+ $result = [];\n+ $carriers = $this->alexaHelper->getDeliveryCarriers();\n+ foreach ($carriers as $carrier) {\n+ $result[$carrier['title']] = $carrier['code'];\n}\nreturn $result;\n}\n@@ -228,16 +179,14 @@ class Alexa\nprotected function getCarrierCode($track)\n{\n$result = '';\n- $deliveryCarriers = $this->getDeliveryCarriers();\n- if (isset($deliveryCarriers[$track->getTitle()])) {\n- $result = $deliveryCarriers[$track->getTitle()];\n+ $carriersMapping = $this->amazonConfig->getCarriersMapping(ScopeInterface::SCOPE_STORE, $track->getStoreId());\n+ if (array_key_exists($track->getCarrierCode(), $carriersMapping)) {\n+ $result = $carriersMapping[$track->getCarrierCode()];\n}\nif (empty($result)) {\n- foreach (['usps', 'ups', 'fedex'] as $carrierCode) {\n- if (stripos($track->getCarrierCode(), $carrierCode) !== false) {\n- $result = strtoupper($carrierCode);\n- break;\n- }\n+ $deliveryCarriers = $this->getDeliveryCarriers();\n+ if (array_key_exists($track->getTitle(), $deliveryCarriers)) {\n+ $result = $deliveryCarriers[$track->getTitle()];\n}\n}\nif (empty($result)) {\n@@ -270,15 +219,16 @@ class Alexa\nif ($this->canAddDeliveryNotification($track)) {\n$chargePermissionId = $this->getChargePermissionId($track->getShipment()->getOrder());\n$carrierCode = $this->getCarrierCode($track);\n-\n- if ($carrierCode == \"CUSTOM\") {\n- $this->alexaLogger->debug('addDeliveryNotification: -> No matched Alexa Notification carrier for: ' .\n- $track->getTitle() .\n+ if ($carrierCode == 'CUSTOM') {\n+ $this->alexaLogger->debug('addDeliveryNotification: -> No matched Alexa Notification carrier for ' .\n+ 'Carrier title: ' . $track->getTitle() .\n+ 'Carrier code: ' . $track->getCarrierCode() .\n' - merchantReferenceId: ' .\n$track->getShipment()->getOrder()->getIncrementId());\nthrow new \\Magento\\Framework\\Exception\\NotFoundException(\n- new Phrase('No matched Alexa Notification carrier for: ' . $track->getTitle())\n+ new Phrase('No matched Alexa Notification carrier for: ' .\n+ $track->getCarrierCode() . ' - ' . $track->getTitle())\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/AmazonConfig.php",
"new_path": "Model/AmazonConfig.php",
"diff": "@@ -69,6 +69,11 @@ class AmazonConfig\n*/\nprivate $remoteAddress;\n+ /**\n+ * @var \\Magento\\Framework\\Serialize\\SerializerInterface\n+ */\n+ private $serializer;\n+\n/**\n* AmazonConfig constructor.\n* @param \\Magento\\Store\\Model\\StoreManagerInterface $storeManager\n@@ -77,6 +82,7 @@ class AmazonConfig\n* @param \\Magento\\Directory\\Model\\Config\\Source\\Country $countryConfig\n* @param \\Magento\\Framework\\Locale\\Resolver $localeResolver\n* @param \\Magento\\Framework\\HTTP\\PhpEnvironment\\RemoteAddress $remoteAddress\n+ * @param \\Magento\\Framework\\Serialize\\SerializerInterface $serializer\n*/\npublic function __construct(\n\\Magento\\Store\\Model\\StoreManagerInterface $storeManager,\n@@ -84,7 +90,8 @@ class AmazonConfig\n\\Magento\\Directory\\Model\\AllowedCountries $countriesAllowed,\n\\Magento\\Directory\\Model\\Config\\Source\\Country $countryConfig,\n\\Magento\\Framework\\Locale\\Resolver $localeResolver,\n- \\Magento\\Framework\\HTTP\\PhpEnvironment\\RemoteAddress $remoteAddress\n+ \\Magento\\Framework\\HTTP\\PhpEnvironment\\RemoteAddress $remoteAddress,\n+ \\Magento\\Framework\\Serialize\\SerializerInterface $serializer\n) {\n$this->storeManager = $storeManager;\n$this->scopeConfig = $scopeConfig;\n@@ -92,6 +99,7 @@ class AmazonConfig\n$this->countryConfig = $countryConfig;\n$this->localeResolver = $localeResolver;\n$this->remoteAddress = $remoteAddress;\n+ $this->serializer = $serializer;\n}\n/**\n@@ -679,6 +687,32 @@ class AmazonConfig\n);\n}\n+ /**\n+ * @param string $scope\n+ * @param null $scopeCode\n+ * @return array\n+ */\n+ public function getCarriersMapping($scope = ScopeInterface::SCOPE_STORE, $scopeCode = null)\n+ {\n+ $mapping = [];\n+ $configValues = $this->scopeConfig->getValue(\n+ 'payment/amazon_payment_v2/alexa_carrier_codes',\n+ $scope,\n+ $scopeCode\n+ );\n+\n+ if ($configValues) {\n+ $configValues = $this->serializer->unserialize($configValues);\n+ if (count($configValues) > 0) {\n+ foreach (array_values($configValues) as $row) {\n+ $mapping[$row['carrier']] = $row['amazon_carrier'];\n+ }\n+ }\n+ }\n+\n+ return $mapping;\n+ }\n+\n/**\n* @param string $scope\n* @param string $scopeCode\n"
},
{
"change_type": "MODIFY",
"old_path": "Observer/SalesOrderShipmentTrackAfter.php",
"new_path": "Observer/SalesOrderShipmentTrackAfter.php",
"diff": "@@ -48,7 +48,7 @@ class SalesOrderShipmentTrackAfter implements \\Magento\\Framework\\Event\\ObserverI\n$details = $this->alexaModel->addDeliveryNotification($track);\nif ($details) {\n$message = __(\n- 'Amazon Pay has received shipping tracking information for carrier %1 and tracking number %2.',\n+ 'Amazon Pay has received shipping tracking information for carrier code %1 and tracking number %2',\n$details['carrierCode'],\n$details['trackingNumber']\n);\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/alexa_active</config_path>\n</field>\n+ <field id=\"carrier_codes\" translate=\"label comment\" sortOrder=\"10\" showInDefault=\"1\" showInStore=\"1\" showInWebsite=\"1\">\n+ <label>Carrier Codes</label>\n+ <comment><![CDATA[This option allows to map carriers from your shop to the Amazon Pay predefined carriers. Please use the Carrier codes form by selecting your available carriers and assign them to the matching one in the Amazon Pay carrier list.]]></comment>\n+ <frontend_model>Amazon\\Pay\\Block\\Adminhtml\\System\\Config\\Form\\CarrierCodes</frontend_model>\n+ <backend_model>Magento\\Config\\Model\\Config\\Backend\\Serialized\\ArraySerialized</backend_model>\n+ <config_path>payment/amazon_payment_v2/alexa_carrier_codes</config_path>\n+ <depends>\n+ <field id=\"active\">1</field>\n+ </depends>\n+ </field>\n</group>\n<group id=\"advanced\" translate=\"label\" type=\"text\" sortOrder=\"30\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>Advanced</label>\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Alexa Notification > carrier mapping |
21,241 | 28.09.2021 12:08:34 | 18,000 | 5cca2af505f6655799a6434cd015acc43f78477e | force reload when getting config for APB | [
{
"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": "@@ -30,10 +30,11 @@ define([\n}\nreturn localStorage;\n};\n- return function (callback) {\n+ return function (callback, forceReload = false) {\nvar cartId = customerData.get('cart')()['data_id'] || window.checkout.storeId;\nvar config = getLocalStorage().get('config') || false;\n- if (cartId !== getLocalStorage().get('cart_id')\n+ if (forceReload\n+ || cartId !== getLocalStorage().get('cart_id')\n|| typeof config.checkout_payload === 'undefined'\n|| !config.checkout_payload.includes(document.URL)) {\ncallbacks.push(callback);\n"
},
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/js/amazon-button.js",
"new_path": "view/frontend/web/js/amazon-button.js",
"diff": "@@ -33,7 +33,7 @@ define([\ndrawing: false,\n- _loadButtonConfig: function (callback) {\n+ _loadButtonConfig: function (callback, forceReload = false) {\ncheckoutSessionConfigLoad(function (checkoutSessionConfig) {\nif (!$.isEmptyObject(checkoutSessionConfig)) {\nvar payload = checkoutSessionConfig['checkout_payload'];\n@@ -66,7 +66,7 @@ define([\n} else {\n$(this.options.hideIfUnavailable).hide();\n}\n- }.bind(this));\n+ }.bind(this), forceReload);\n},\n/**\n@@ -126,7 +126,7 @@ define([\nself._loadButtonConfig(function (buttonConfig) {\nvar initConfig = {createCheckoutSessionConfig: buttonConfig.createCheckoutSessionConfig};\namazonPayButton.initCheckout(initConfig);\n- });\n+ }, true);\ncustomerData.invalidate('*');\n});\n$('.amazon-button-container .field-tooltip').fadeIn();\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-799 - force reload when getting config for APB |
21,250 | 28.09.2021 15:13:09 | 10,800 | db304f307c4a00ad76c22b10210d0816dce982c7 | change backend message | [
{
"change_type": "MODIFY",
"old_path": "Model/Alexa.php",
"new_path": "Model/Alexa.php",
"diff": "@@ -240,6 +240,7 @@ class Alexa\n]]\n])]);\n$result = $response['deliveryDetails'][0];\n+ $result['carrierTitle'] = $track->getTitle();\n}\nreturn $result;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Observer/SalesOrderShipmentTrackAfter.php",
"new_path": "Observer/SalesOrderShipmentTrackAfter.php",
"diff": "@@ -48,7 +48,8 @@ class SalesOrderShipmentTrackAfter implements \\Magento\\Framework\\Event\\ObserverI\n$details = $this->alexaModel->addDeliveryNotification($track);\nif ($details) {\n$message = __(\n- 'Amazon Pay has received shipping tracking information for carrier code %1 and tracking number %2',\n+ 'Amazon Pay has received shipping tracking information for carrier %1 (%2) and tracking number %3',\n+ $details['carrierTitle'],\n$details['carrierCode'],\n$details['trackingNumber']\n);\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-725: change backend message |
21,250 | 04.10.2021 15:26:36 | 10,800 | c66792cf178c8d3f3f869a5ffe127ef2e12a09ec | Some OSC address updates are not reflected in PayNow button payload | [
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/js/amazon-button.js",
"new_path": "view/frontend/web/js/amazon-button.js",
"diff": "* permissions and limitations under the License.\n*/\ndefine([\n+ 'ko',\n'jquery',\n'Amazon_Pay/js/action/checkout-session-config-load',\n'Amazon_Pay/js/model/storage',\n'mage/url',\n'Amazon_Pay/js/amazon-checkout',\n'Magento_Customer/js/customer-data',\n- 'Magento_Checkout/js/model/payment/additional-validators'\n-], function ($, checkoutSessionConfigLoad, amazonStorage, url, amazonCheckout, customerData, additionalValidators) {\n+ 'Magento_Checkout/js/model/payment/additional-validators',\n+ 'mage/storage',\n+ 'Magento_Checkout/js/model/error-processor'\n+], function (\n+ ko,\n+ $,\n+ checkoutSessionConfigLoad,\n+ amazonStorage,\n+ url,\n+ amazonCheckout,\n+ customerData,\n+ additionalValidators,\n+ storage,\n+ errorProcessor\n+ ) {\n'use strict';\n$.widget('amazon.AmazonButton', {\n@@ -28,7 +42,8 @@ define([\npayOnly: null,\nplacement: 'Cart',\nhideIfUnavailable: '',\n- buttonType: 'Normal'\n+ buttonType: 'Normal',\n+ isIosc: ko.observable($('button.iosc-place-order-button').length > 0)\n},\ndrawing: false,\n@@ -122,21 +137,45 @@ define([\nif (self.buttonType === 'PayNow' && !additionalValidators.validate()) {\nreturn false;\n}\n-\n- self._loadButtonConfig(function (buttonConfig) {\n- var initConfig = {createCheckoutSessionConfig: buttonConfig.createCheckoutSessionConfig};\n- amazonPayButton.initCheckout(initConfig);\n- });\n- customerData.invalidate('*');\n+ //This is for compatibility with Iosc. We need to update the customer's Magento session before getting the final config and payload\n+ if (self.buttonType === 'PayNow' && self.options.isIosc()) {\n+ storage.post(\n+ 'checkout/onepage/update',\n+ \"{}\",\n+ false\n+ ).done(\n+ function (response) {\n+ if (!response.error) {\n+ self._initCheckout(amazonPayButton);\n+ } else {\n+ errorProcessor.process(response);\n+ }\n+ }\n+ ).fail(\n+ function (response) {\n+ errorProcessor.process(response);\n+ }\n+ );\n+ }else{\n+ self._initCheckout(amazonPayButton);\n+ }\n});\n- $('.amazon-button-container .field-tooltip').fadeIn();\n+ $('.amazon-button-container .field-tooltip').fadeIn();\nself.drawing = false;\n});\n}, this);\n}\n},\n+ _initCheckout: function (amazonPayButton) {\n+ this._loadButtonConfig(function (buttonConfig) {\n+ var initConfig = {createCheckoutSessionConfig: buttonConfig.createCheckoutSessionConfig};\n+ amazonPayButton.initCheckout(initConfig);\n+ });\n+ customerData.invalidate('*');\n+ },\n+\n/**\n* Redraw button if needed\n**/\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-794: Some OSC address updates are not reflected in PayNow button payload |
21,250 | 14.10.2021 15:05:02 | 10,800 | 2f66e872bc70be4f9bbbd00645482213e805506a | Undefined index: status | [
{
"change_type": "MODIFY",
"old_path": "Gateway/Validator/GeneralResponseValidator.php",
"new_path": "Gateway/Validator/GeneralResponseValidator.php",
"diff": "@@ -55,7 +55,12 @@ class GeneralResponseValidator extends AbstractValidator\n$response = $validationSubject['response'];\n- if (!in_array($response['status'], [200, 201])) {\n+ if (!isset($response['status'])) {\n+ $isValid = false;\n+ $errorCodes[] = 'No HTTP status code';\n+ }\n+\n+ if (isset($response['status']) && !in_array($response['status'], [200, 201])) {\n$isValid = false;\n$errorCodes[] = 'HTTP status code ' . $response['status'];\n}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-812: Undefined index: status |
21,241 | 19.10.2021 15:40:54 | 18,000 | 86d522db2ab16d1faf984813045cd70a39f599d2 | Version bump to 5.9.0, update changelog, and fix phpcs issue | [
{
"change_type": "MODIFY",
"old_path": "CHANGELOG.md",
"new_path": "CHANGELOG.md",
"diff": "# Change Log\n+## 5.9.0\n+* Added custom Carrier Code mapping\n+* Added config options to allow headless integrations to change return urls\n+* Changed validation on private key to allow empty values\n+* Fixed issue with processing an invalid Amazon response\n+* Fixed issue with One Step Checkouts having stale data in the Payment Methods button\n+\n## 5.8.0\n* Added log message if we are unable to complete checkout session due to an existing order with same quoteId\n* Added email when asynchronous order processing is declined\n"
},
{
"change_type": "MODIFY",
"old_path": "Helper/Session.php",
"new_path": "Helper/Session.php",
"diff": "@@ -205,7 +205,6 @@ class Session\nreturn $this->checkoutSession->getQuote();\n}\n-\n/**\n* Load quote from provided masked quote ID or falls back to loading from the session\n* @param $cartId null|string\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.8.0\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.9.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.8.0\",\n+ \"version\": \"5.9.0\",\n\"license\": [\n\"Apache-2.0\"\n],\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Version bump to 5.9.0, update changelog, and fix phpcs issue |
21,266 | 21.10.2021 15:12:17 | 14,400 | e53050095cc12a57f0b71f278cfae3b179c17d8a | Prevent escaping special characters in Pay Now button payloads | [
{
"change_type": "MODIFY",
"old_path": "Model/Adapter/AmazonPayAdapter.php",
"new_path": "Model/Adapter/AmazonPayAdapter.php",
"diff": "@@ -599,7 +599,7 @@ class AmazonPayAdapter\n$payload['addressDetails'] = $addressData;\n}\n- return json_encode($payload, JSON_UNESCAPED_SLASHES);\n+ return json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);\n}\npublic function signButton($payload, $storeId = null)\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-817 - Prevent escaping special characters in Pay Now button payloads |
21,266 | 27.10.2021 12:12:16 | 14,400 | adabccfaa6bc4d07d60ce79357b2c669c727845b | Clarify naming for (Magento) redirect URLs | [
{
"change_type": "MODIFY",
"old_path": "etc/adminhtml/system.xml",
"new_path": "etc/adminhtml/system.xml",
"diff": "<config_path>payment/amazon_payment_v2/checkout_review_return_url</config_path>\n</field>\n<field id=\"checkout_review_url\" translate=\"label comment\" type=\"text\" sortOrder=\"19\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n- <label>Checkout URL Path</label>\n+ <label>Magento Checkout 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 />Magento redirect to this URL after processing the Amazon session initiation, where checkout happens. Do not use a leading slash.]]></comment>\n<config_path>payment/amazon_payment_v2/checkout_review_url</config_path>\n</field>\n<config_path>payment/amazon_payment_v2/checkout_result_return_url</config_path>\n</field>\n<field id=\"checkout_result_url\" translate=\"label comment\" type=\"text\" sortOrder=\"21\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n- <label>Checkout result URL Path</label>\n+ <label>Magento 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 />Magento will redirect to this URL after completing the checkout session. Do not use a leading slash.]]></comment>\n<config_path>payment/amazon_payment_v2/checkout_result_url</config_path>\n</field>\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-782 - Clarify naming for (Magento) redirect URLs |
21,241 | 01.11.2021 10:42:50 | 18,000 | 7d6a4c8ee2b34eff8655aea86a752b0d86134a4a | Version bump to 5.9.1 and update changelog | [
{
"change_type": "MODIFY",
"old_path": "CHANGELOG.md",
"new_path": "CHANGELOG.md",
"diff": "# Change Log\n+## 5.9.1\n+* Fixed issue with umlauts in PayNow button flow\n+* Updated config labels for Magento Checkout redirect paths\n+\n## 5.9.0\n* Added custom Carrier Code mapping\n* Added config options to allow headless integrations to change return urls\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.9.0\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.9.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.9.0\",\n+ \"version\": \"5.9.1\",\n\"license\": [\n\"Apache-2.0\"\n],\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Version bump to 5.9.1 and update changelog |
21,266 | 02.11.2021 16:39:01 | 14,400 | 176e6b371333bec07e2c039f3fc8c2d93aae3bc7 | Remove regional restrictions on split/partial captures | [
{
"change_type": "MODIFY",
"old_path": "Gateway/Config/Config.php",
"new_path": "Gateway/Config/Config.php",
"diff": "*/\nnamespace Amazon\\Pay\\Gateway\\Config;\n-use Amazon\\Pay\\Model\\AmazonConfig;\nuse Magento\\Framework\\App\\Config\\ScopeConfigInterface;\n-use Magento\\Store\\Model\\ScopeInterface;\nclass Config extends \\Magento\\Payment\\Gateway\\Config\\Config\n{\n@@ -16,66 +14,14 @@ class Config extends \\Magento\\Payment\\Gateway\\Config\\Config\nconst KEY_ACTIVE = 'active';\n/**\n- * @var AmazonConfig\n- */\n- protected $amazonConfig;\n-\n- /**\n- * @var \\Magento\\Framework\\App\\RequestInterface\n- */\n- protected $request;\n-\n- /**\n- * @var \\Magento\\Sales\\Api\\OrderRepositoryInterface\n- */\n- protected $orderRepository;\n-\n- /**\n- * @param AmazonConfig $amazonConfig\n* @param ScopeConfigInterface $scopeConfig\n- * @param \\Magento\\Framework\\App\\RequestInterface $request\n- * @param \\Magento\\Sales\\Api\\OrderRepositoryInterface $orderRepository\n*/\npublic function __construct(\n- AmazonConfig $amazonConfig,\n- ScopeConfigInterface $scopeConfig,\n- \\Magento\\Framework\\App\\RequestInterface $request,\n- \\Magento\\Sales\\Api\\OrderRepositoryInterface $orderRepository\n+ ScopeConfigInterface $scopeConfig\n) {\n- $this->amazonConfig = $amazonConfig;\n- $this->request = $request;\n- $this->orderRepository = $orderRepository;\nparent::__construct($scopeConfig, self::CODE);\n}\n- /**\n- * @param int|null $storeId\n- * @return boolean\n- */\n- protected function canCapturePartial($storeId = null)\n- {\n- // get the order store id if not provided\n- if (empty($storeId)) {\n- $orderId = $this->request->getParam('order_id');\n- if ($orderId) {\n- $order = $this->orderRepository->get($orderId);\n- $storeId = $order->getStoreId();\n- }\n- }\n-\n- $region = $this->amazonConfig->getPaymentRegion(ScopeInterface::SCOPE_STORE, $storeId);\n- switch ($region) {\n- case 'de':\n- case 'uk':\n- $result = false;\n- break;\n- default:\n- $result = parent::getValue('can_capture_partial', $storeId);\n- break;\n- }\n- return $result;\n- }\n-\n/**\n* Gets Payment configuration status.\n*\n@@ -86,22 +32,4 @@ class Config extends \\Magento\\Payment\\Gateway\\Config\\Config\n{\nreturn (bool) $this->getValue(self::KEY_ACTIVE, $storeId);\n}\n-\n- /**\n- * @param string $field\n- * @param int|null $storeId\n- * @return mixed\n- */\n- public function getValue($field, $storeId = null)\n- {\n- switch ($field) {\n- case 'can_capture_partial':\n- $result = $this->canCapturePartial($storeId);\n- break;\n- default:\n- $result = parent::getValue($field, $storeId);\n- break;\n- }\n- return $result;\n- }\n}\n"
},
{
"change_type": "DELETE",
"old_path": "Test/Mftf-23/Test/AmazonInvoiceOnlySingleCapture.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=\"AmazonInvoiceOnlySingleCapture\" extends=\"AmazonCheckoutButton\">\n- <annotations>\n- <stories value=\"Amazon Pay Only Single Capture\"/>\n- <title value=\"Admin user must not be able to capture multiple times when configuration doesn't allow\"/>\n- <description value=\"Admin user must not be able to capture multiple times when configuration doesn't allow\"/>\n- <severity value=\"CRITICAL\"/>\n- <group value=\"amazon_pay\"/>\n- <group value=\"amazon_pay_invoice\"/>\n- </annotations>\n-\n- <before>\n- <createData entity=\"SimpleTwo\" stepKey=\"createSimpleProduct2\" before=\"flushCache\"/>\n- <createData entity=\"EUAmazonPaymentConfig\" stepKey=\"SingleInvoiceAmazonPaymentConfig\"/>\n- <createData entity=\"EUAmazonCurrencyConfig\" stepKey=\"SingleInvoiceAmazonCurrencyConfig\"/>\n- <magentoCLI command=\"cache:flush\" stepKey=\"flushCache\"/>\n- </before>\n-\n- <after>\n- <createData entity=\"SampleAmazonPaymentConfig\" stepKey=\"DefaultAmazonPaymentConfig\"/>\n- <createData entity=\"DefaultAmazonCurrencyConfig\" stepKey=\"DefaultAmazonCurrencyConfig\"/>\n- <magentoCLI command=\"cache:flush\" stepKey=\"flushCache\"/>\n- </after>\n-\n- <!-- Product 1 is added to cart by AmazonCheckoutButton -->\n-\n- <!-- Go to product 2 page and add to cart -->\n- <actionGroup ref=\"StorefrontOpenProductPageActionGroup\" stepKey=\"openProduct2StoreFront\">\n- <argument name=\"productUrl\" value=\"$$createSimpleProduct2.custom_attributes[url_key]$$\"/>\n- </actionGroup>\n- <actionGroup ref=\"StorefrontAddToTheCartActionGroup\" stepKey=\"addProduct2ToCart\"/>\n-\n- <!--Go to checkout-->\n- <actionGroup ref=\"GoToCheckoutFromMinicartActionGroup\" stepKey=\"goToCheckoutFromMiniCart2\"/>\n-\n- <!--Go to Amazon Pay and login-->\n- <actionGroup ref=\"AmazonLoginAndCheckoutActionGroup\" stepKey=\"AmazonLoginAndCheckoutActionGroup\"/>\n- <!--Go to payment method-->\n- <click selector=\"{{CheckoutShippingSection.next}}\" stepKey=\"clickCheckoutShippingNext\"/>\n- <waitForPageLoad stepKey=\"waitForCheckoutPaymentPageLoad\"/>\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- <grabTextFrom selector=\"{{CheckoutSuccessMainSection.orderNumber}}\" stepKey=\"grabOrderNumber\"/>\n-\n- <!-- Login as admin -->\n- <actionGroup ref=\"LoginAsAdmin\" stepKey=\"loginAsAdmin\"/>\n-\n- <!-- Open created order in backend -->\n- <amOnPage url=\"{{AdminOrdersPage.url}}\" stepKey=\"goToOrders\"/>\n- <waitForPageLoad stepKey=\"waitForOrdersPageLoad\"/>\n- <actionGroup ref=\"OpenOrderByIdActionGroup\" stepKey=\"filterOrderGridById\">\n- <argument name=\"orderId\" value=\"$grabOrderNumber\"/>\n- </actionGroup>\n-\n- <!-- Create Invoice -->\n- <click selector=\"{{AdminOrderDetailsMainActionsSection.invoice}}\" stepKey=\"clickInvoice\"/>\n- <waitForPageLoad stepKey=\"waitForInvoicePage\"/>\n-\n- <!-- Verify invoice item qtys cannot be changed -->\n- <dontSeeElement stepKey=\"dontSeeItemQtyToInvoice1\" selector=\"{{AdminInvoiceItemsSection.itemQtyToInvoice('1')}}\"/>\n- <dontSeeElement stepKey=\"dontSeeItemQtyToInvoice2\" selector=\"{{AdminInvoiceItemsSection.itemQtyToInvoice('2')}}\"/>\n- <dontSeeElement stepKey=\"dontSeeUpdateQty\" selector=\"{{AdminInvoiceItemsSection.updateQty}}\"/>\n-\n- <!-- Submit and verify the invoice created -->\n- <click selector=\"{{AdminInvoiceMainActionsSection.submitInvoice}}\" stepKey=\"submitInvoice\"/>\n- <waitForPageLoad stepKey=\"waitForLoadPage\"/>\n- <see userInput=\"The invoice has been created.\" stepKey=\"seeMessage\"/>\n- </test>\n-</tests>\n"
},
{
"change_type": "DELETE",
"old_path": "Test/Mftf-24/Test/AmazonInvoiceOnlySingleCapture.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=\"AmazonInvoiceOnlySingleCapture\" extends=\"AmazonCheckoutButton\">\n- <annotations>\n- <stories value=\"Amazon Pay Only Single Capture\"/>\n- <title value=\"Admin user must not be able to capture multiple times when configuration doesn't allow\"/>\n- <description value=\"Admin user must not be able to capture multiple times when configuration doesn't allow\"/>\n- <severity value=\"CRITICAL\"/>\n- <group value=\"amazon_pay\"/>\n- <group value=\"amazon_pay_invoice\"/>\n- </annotations>\n-\n- <before>\n- <createData entity=\"SimpleTwo\" stepKey=\"createSimpleProduct2\" before=\"flushCache\"/>\n- <createData entity=\"EUAmazonPaymentConfig\" stepKey=\"SingleInvoiceAmazonPaymentConfig\"/>\n- <createData entity=\"EUAmazonCurrencyConfig\" stepKey=\"SingleInvoiceAmazonCurrencyConfig\"/>\n- <magentoCLI command=\"cache:flush\" stepKey=\"flushCache\"/>\n- </before>\n-\n- <after>\n- <createData entity=\"SampleAmazonPaymentConfig\" stepKey=\"DefaultAmazonPaymentConfig\"/>\n- <createData entity=\"DefaultAmazonCurrencyConfig\" stepKey=\"DefaultAmazonCurrencyConfig\"/>\n- <magentoCLI command=\"cache:flush\" stepKey=\"flushCache\"/>\n- </after>\n-\n- <!-- Product 1 is added to cart by AmazonCheckoutButton -->\n-\n- <!-- Go to product 2 page and add to cart -->\n- <actionGroup ref=\"StorefrontOpenProductPageActionGroup\" stepKey=\"openProduct2StoreFront\">\n- <argument name=\"productUrl\" value=\"$$createSimpleProduct2.custom_attributes[url_key]$$\"/>\n- </actionGroup>\n- <actionGroup ref=\"StorefrontAddToTheCartActionGroup\" stepKey=\"addProduct2ToCart\"/>\n-\n- <!--Go to checkout-->\n- <actionGroup ref=\"GoToCheckoutFromMinicartActionGroup\" stepKey=\"goToCheckoutFromMiniCart2\"/>\n-\n- <!--Go to Amazon Pay and login-->\n- <actionGroup ref=\"AmazonLoginAndCheckoutActionGroup\" stepKey=\"AmazonLoginAndCheckoutActionGroup\"/>\n- <!--Go to payment method-->\n- <click selector=\"{{CheckoutShippingSection.next}}\" stepKey=\"clickCheckoutShippingNext\"/>\n- <waitForPageLoad stepKey=\"waitForCheckoutPaymentPageLoad\"/>\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- <grabTextFrom selector=\"{{CheckoutSuccessMainSection.orderNumber}}\" stepKey=\"grabOrderNumber\"/>\n-\n- <!-- Login as admin -->\n- <actionGroup ref=\"AdminLoginActionGroup\" stepKey=\"loginAsAdmin\"/>\n-\n- <!-- Open created order in backend -->\n- <amOnPage url=\"{{AdminOrdersPage.url}}\" stepKey=\"goToOrders\"/>\n- <waitForPageLoad stepKey=\"waitForOrdersPageLoad\"/>\n- <actionGroup ref=\"OpenOrderByIdActionGroup\" stepKey=\"filterOrderGridById\">\n- <argument name=\"orderId\" value=\"$grabOrderNumber\"/>\n- </actionGroup>\n-\n- <!-- Create Invoice -->\n- <click selector=\"{{AdminOrderDetailsMainActionsSection.invoice}}\" stepKey=\"clickInvoice\"/>\n- <waitForPageLoad stepKey=\"waitForInvoicePage\"/>\n-\n- <!-- Verify invoice item qtys cannot be changed -->\n- <dontSeeElement stepKey=\"dontSeeItemQtyToInvoice1\" selector=\"{{AdminInvoiceItemsSection.itemQtyToInvoice('1')}}\"/>\n- <dontSeeElement stepKey=\"dontSeeItemQtyToInvoice2\" selector=\"{{AdminInvoiceItemsSection.itemQtyToInvoice('2')}}\"/>\n- <dontSeeElement stepKey=\"dontSeeUpdateQty\" selector=\"{{AdminInvoiceItemsSection.updateQty}}\"/>\n-\n- <!-- Submit and verify the invoice created -->\n- <click selector=\"{{AdminInvoiceMainActionsSection.submitInvoice}}\" stepKey=\"submitInvoice\"/>\n- <waitForPageLoad stepKey=\"waitForLoadPage\"/>\n- <see userInput=\"The invoice has been created.\" stepKey=\"seeMessage\"/>\n- </test>\n-</tests>\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-822 - Remove regional restrictions on split/partial captures |
21,266 | 09.11.2021 17:39:56 | 18,000 | 63d0ae6e9c410ed2e50f608e3d72b54f71bc3060 | Add helper/selenium conditionals to deal with intermediate 'securely signed in' popup | [
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/ActionGroup/AmazonLoginActionGroup.xml",
"new_path": "Test/Mftf-23/ActionGroup/AmazonLoginActionGroup.xml",
"diff": "<click selector=\"{{AmazonPageSection.signInButton}}\" stepKey=\"clickAmazonPageSignInButton\"/>\n<!--Verify successful login by the presence of the checkout button-->\n<wait time=\"1\" stepKey=\"allowButtonToActivate\"/>\n+\n+ <executeInSelenium function=\"function (\\Facebook\\WebDriver\\Remote\\RemoteWebDriver $remoteWebDriver) use ($I, $openerName) {\n+ $I->comment('Click Continue as... button and return to checkout');\n+ $continueAs[0]->click();\n+ $remoteWebDriver->switchTo()->window($openerName);\n+ $I->waitForPageLoad(30);\n+\n+ $I->comment('Wait for Edit button in address details');\n+ $editAddressSelector = \\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{AmazonCheckoutSection.editShippingButton}}');\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::elementToBeClickable($editAddressSelector));\n+ $I->comment('Click Edit button to return to normal flow');\n+ $remoteWebDriver->findElement($editAddressSelector)->click();\n+\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::numberOfWindowsToBe(2));\n+ $I->switchToNextTab();\n+ }\" stepKey=\"secureSignInWorkaround\" />\n+\n<waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seeAmazonCheckoutButton\"/>\n</actionGroup>\n</actionGroups>\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml",
"new_path": "Test/Mftf-23/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml",
"diff": "<!--Verify successful login by the presence of the checkout button-->\n<wait time=\"1\" stepKey=\"allowButtonToActivate2\"/>\n- <waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seeAmazonCheckoutButton\"/>\n+ <executeInSelenium function=\"function (\\Facebook\\WebDriver\\Remote\\RemoteWebDriver $remoteWebDriver) use ($I, $openerName) {\n+ $continueAs = $remoteWebDriver->findElements(\\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{AmazonPageSection.continueButton}}'));\n+\n+ if (!empty($continueAs)) {\n+ $I->comment('Click Continue as... button and return to checkout');\n+ $continueAs[0]->click();\n+ $remoteWebDriver->switchTo()->window($openerName);\n+ $I->waitForPageLoad(30);\n+\n+ $I->comment('Wait for Edit button in address details');\n+ $editAddressSelector = \\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{AmazonCheckoutSection.editShippingButton}}');\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::elementToBeClickable($editAddressSelector));\n+ $I->comment('Click Edit button to return to normal flow');\n+ $remoteWebDriver->findElement($editAddressSelector)->click();\n+\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::numberOfWindowsToBe(2));\n+ $I->switchToNextTab();\n+ }\n+ }\" stepKey=\"secureSignInWorkaround\" />\n<!--Get shipping address information-->\n<grabAttributeFrom selector=\"{{AmazonPageSection.addressId}}\" userInput=\"data-address_id\" stepKey=\"amazonAddressId\"/>\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/Section/AmazonPageSection.xml",
"new_path": "Test/Mftf-23/Section/AmazonPageSection.xml",
"diff": "<element name=\"passwordField\" type=\"input\" selector=\"#ap_password\"/>\n<element name=\"signInButton\" type=\"button\" selector=\"#signInSubmit\"/>\n<element name=\"checkoutButton\" type=\"button\" selector=\"#default-button-content input[type=submit]\"/>\n+ <element name=\"continueButton\" type=\"button\" selector=\"#maxo_buy_now 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"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/Test/AmazonCheckoutPayNowMulticurrencySuccessTest.xml",
"new_path": "Test/Mftf-23/Test/AmazonCheckoutPayNowMulticurrencySuccessTest.xml",
"diff": "<executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n<click selector=\"{{AmazonButtonSection.payment}}\" stepKey=\"clickAmazonPay\" />\n+ <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"switchToPopup\" />\n<actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"amazonLogin\" />\n<waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seePayNow\" />\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/ActionGroup/AmazonLoginActionGroup.xml",
"new_path": "Test/Mftf-24/ActionGroup/AmazonLoginActionGroup.xml",
"diff": "<!--Verify successful login by the presence of the checkout button-->\n<wait time=\"1\" stepKey=\"allowButtonToActivate\"/>\n+\n+ <helper class=\"\\Amazon\\Pay\\Test\\Mftf\\Helper\\SecureSignInWorkaround\" method=\"continueAsUser\" stepKey=\"secureWorkaround\">\n+ <argument name=\"openerName\">{$openerName}</argument>\n+ <argument name=\"editAddress\">{{AmazonCheckoutSection.editShippingButton}}</argument>\n+ </helper>\n+\n<waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seeAmazonCheckoutButton\"/>\n</actionGroup>\n</actionGroups>\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml",
"new_path": "Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml",
"diff": "<click selector=\"{{AmazonPageSection.signInButton}}\" stepKey=\"clickSigninButton\"/>\n<!--Verify successful login by the presence of the checkout button-->\n- <wait time=\"1\" stepKey=\"allowButtonToActivate2\"/>\n- <waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seeAmazonCheckoutButton\"/>\n+ <wait time=\"3\" stepKey=\"allowButtonToActivate2\"/>\n+ <helper class=\"\\Amazon\\Pay\\Test\\Mftf\\Helper\\SecureSignInWorkaround\" method=\"continueAsUser\" stepKey=\"secureWorkaround\">\n+ <argument name=\"openerName\">{$openerName}</argument>\n+ <argument name=\"editAddress\">{{AmazonCheckoutSection.editShippingButton}}</argument>\n+ </helper>\n+ <waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seeAmazonCheckoutButton\"/>\n<!--Get shipping address information-->\n<grabAttributeFrom selector=\"{{AmazonPageSection.addressId}}\" userInput=\"data-address_id\" stepKey=\"amazonAddressId\"/>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Test/Mftf-24/Helper/SecureSignInWorkaround.php",
"diff": "+<?php\n+\n+namespace Amazon\\Pay\\Test\\Mftf\\Helper;\n+\n+use Facebook\\WebDriver\\Remote\\RemoteWebDriver;\n+use Facebook\\WebDriver\\WebDriverBy;\n+use Facebook\\WebDriver\\WebDriverExpectedCondition;\n+use Magento\\FunctionalTestingFramework\\Helper\\Helper;\n+\n+class SecureSignInWorkaround extends Helper\n+{\n+ public function continueAsUser($openerName, $editAddress)\n+ {\n+ /** @var \\Magento\\FunctionalTestingFramework\\Module\\MagentoWebDriver $webDriver */\n+ $magentoWebDriver = $this->getModule('\\Magento\\FunctionalTestingFramework\\Module\\MagentoWebDriver');\n+\n+ try {\n+ $magentoWebDriver->executeInSelenium(function (RemoteWebDriver $remoteWebDriver) use ($openerName, $editAddress, $magentoWebDriver) {\n+ // Do nothing here unless the new 'Continue as...' button is present\n+ $continueAs = $remoteWebDriver->findElements(WebDriverBy::cssSelector('#maxo_buy_now input[type=submit]'));\n+\n+ if (!empty($continueAs)) {\n+ // Click Continue as... button and return to checkout\n+ $continueAs[0]->click();\n+ $remoteWebDriver->switchTo()->window($openerName);\n+ $magentoWebDriver->waitForPageLoad(30);\n+\n+ // Wait for Edit button in address details\n+ $editAddressSelector = WebDriverBy::cssSelector($editAddress);\n+ $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::elementToBeClickable($editAddressSelector));\n+ // Click Edit button to return to normal flow\n+ $remoteWebDriver->findElement($editAddressSelector)->click();\n+\n+ $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::numberOfWindowsToBe(2));\n+ $magentoWebDriver->switchToNextTab();\n+ }\n+ });\n+ } catch (\\Exception $e) {\n+ print($e->getMessage());\n+ }\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/Section/AmazonPageSection.xml",
"new_path": "Test/Mftf-24/Section/AmazonPageSection.xml",
"diff": "<element name=\"passwordField\" type=\"input\" selector=\"#ap_password\"/>\n<element name=\"signInButton\" type=\"button\" selector=\"#signInSubmit\"/>\n<element name=\"checkoutButton\" type=\"button\" selector=\"#default-button-content input[type=submit]\"/>\n+ <element name=\"continueButton\" type=\"button\" selector=\"#maxo_buy_now 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"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-824 - Add helper/selenium conditionals to deal with intermediate 'securely signed in' popup |
21,266 | 10.11.2021 11:16:45 | 18,000 | 92be344508c72549ed040ed4d777026e7aed622e | Add return in button _draw on render error/removed button container | [
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/js/amazon-button.js",
"new_path": "view/frontend/web/js/amazon-button.js",
"diff": "@@ -132,7 +132,12 @@ define([\nthis._loadButtonConfig(function (buttonConfig) {\n// do not use session config for decoupled button\ndelete buttonConfig.createCheckoutSessionConfig;\n+ try {\nvar amazonPayButton = amazon.Pay.renderButton('#' + $buttonRoot.empty().removeUniqueId().uniqueId().attr('id'), buttonConfig);\n+ } catch (e) {\n+ console.log('Amazon Pay button render error: ' + e);\n+ return;\n+ }\namazonPayButton.onClick(function() {\nif (self.buttonType === 'PayNow' && !additionalValidators.validate()) {\nreturn false;\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-821 - Add return in button _draw on render error/removed button container |
21,266 | 29.11.2021 15:10:56 | 18,000 | fac4a8433c76adeaecf0887da5d86d5e596232be | Include 'securely signed in' workaround in AmazonCancelReturnUrl | [
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/Test/AmazonCancelReturnUrl.xml",
"new_path": "Test/Mftf-23/Test/AmazonCancelReturnUrl.xml",
"diff": "<click selector=\"{{AmazonButtonSection.product}}\" stepKey=\"clickAmazonButton\"/>\n<actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen2\" />\n- <waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seeAmazonCheckoutButton\"/>\n+ <wait time=\"3\" stepKey=\"allowButtonToActivate\"/>\n+\n+ <executeInSelenium function=\"function (\\Facebook\\WebDriver\\Remote\\RemoteWebDriver $remoteWebDriver) use ($I, $openerName) {\n+ $continueAs = $remoteWebDriver->findElements(\\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{AmazonPageSection.continueButton}}'));\n+\n+ if (!empty($continueAs)) {\n+ $I->comment('Click Continue as... button and return to checkout');\n+ $continueAs[0]->click();\n+ $remoteWebDriver->switchTo()->window($openerName);\n+ $I->waitForPageLoad(30);\n+\n+ $I->comment('Wait for Edit button in address details');\n+ $editAddressSelector = \\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{AmazonCheckoutSection.editShippingButton}}');\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::elementToBeClickable($editAddressSelector));\n+ $I->comment('Click Edit button to return to normal flow');\n+ $remoteWebDriver->findElement($editAddressSelector)->click();\n+\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::numberOfWindowsToBe(2));\n+ $I->switchToNextTab();\n+ }\n+ }\" stepKey=\"secureSignInWorkaround\" />\n<!--Come back to checkout with default address-->\n<actionGroup ref=\"AmazonCheckoutActionGroup\" stepKey=\"DefaultAmazonCheckoutActionGroup\">\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/Test/AmazonCancelReturnUrl.xml",
"new_path": "Test/Mftf-24/Test/AmazonCancelReturnUrl.xml",
"diff": "<click selector=\"{{AmazonButtonSection.product}}\" stepKey=\"clickAmazonButton\"/>\n<actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"allowPopupToOpen2\" />\n- <waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seeAmazonCheckoutButton\"/>\n+ <wait time=\"3\" stepKey=\"allowButtonToActivate\"/>\n+ <helper class=\"\\Amazon\\Pay\\Test\\Mftf\\Helper\\SecureSignInWorkaround\" method=\"continueAsUser\" stepKey=\"secureWorkaround\">\n+ <argument name=\"openerName\">{$openerName}</argument>\n+ <argument name=\"editAddress\">{{AmazonCheckoutSection.editShippingButton}}</argument>\n+ </helper>\n<!--Come back to checkout with default address-->\n<actionGroup ref=\"AmazonCheckoutActionGroup\" stepKey=\"DefaultAmazonCheckoutActionGroup\">\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-824 - Include 'securely signed in' workaround in AmazonCancelReturnUrl |
21,241 | 29.11.2021 18:17:09 | 21,600 | 8283decacf10121b432911c9c5b6f3d8502a0db9 | Remove check for admin split invoicing from mftf test since it is allowed now | [
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/Test/AmazonCheckoutMulticurrencySuccessTest.xml",
"new_path": "Test/Mftf-23/Test/AmazonCheckoutMulticurrencySuccessTest.xml",
"diff": "<click selector=\"{{AdminOrderDetailsMainActionsSection.invoice}}\" stepKey=\"clickInvoice\"/>\n<waitForPageLoad stepKey=\"waitForInvoicePage\"/>\n- <!-- Verify invoice item qtys cannot be changed -->\n- <dontSeeElement stepKey=\"dontSeeItemQtyToInvoice1\" selector=\"{{AdminInvoiceItemsSection.itemQtyToInvoice('1')}}\"/>\n- <dontSeeElement stepKey=\"dontSeeItemQtyToInvoice2\" selector=\"{{AdminInvoiceItemsSection.itemQtyToInvoice('2')}}\"/>\n- <dontSeeElement stepKey=\"dontSeeUpdateQty\" selector=\"{{AdminInvoiceItemsSection.updateQty}}\"/>\n-\n<!-- Submit and verify the invoice created using the presentmentCurrency -->\n<click selector=\"{{AdminInvoiceMainActionsSection.submitInvoice}}\" stepKey=\"submitInvoice\"/>\n<waitForPageLoad stepKey=\"waitForLoadPage\"/>\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/Test/AmazonCheckoutMulticurrencySuccessTest.xml",
"new_path": "Test/Mftf-24/Test/AmazonCheckoutMulticurrencySuccessTest.xml",
"diff": "<click selector=\"{{AdminOrderDetailsMainActionsSection.invoice}}\" stepKey=\"clickInvoice\"/>\n<waitForPageLoad stepKey=\"waitForInvoicePage\"/>\n- <!-- Verify invoice item qtys cannot be changed -->\n- <dontSeeElement stepKey=\"dontSeeItemQtyToInvoice1\" selector=\"{{AdminInvoiceItemsSection.itemQtyToInvoice('1')}}\"/>\n- <dontSeeElement stepKey=\"dontSeeItemQtyToInvoice2\" selector=\"{{AdminInvoiceItemsSection.itemQtyToInvoice('2')}}\"/>\n- <dontSeeElement stepKey=\"dontSeeUpdateQty\" selector=\"{{AdminInvoiceItemsSection.updateQty}}\"/>\n-\n<!-- Submit and verify the invoice created using the presentmentCurrency -->\n<click selector=\"{{AdminInvoiceMainActionsSection.submitInvoice}}\" stepKey=\"submitInvoice\"/>\n<waitForPageLoad stepKey=\"waitForLoadPage\"/>\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-822 - Remove check for admin split invoicing from mftf test since it is allowed now |
21,266 | 07.12.2021 15:48:19 | 18,000 | 96196500beb3e8d96c0c78baff7168943b4f7ff8 | Fix undefined variable in login action group | [
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/ActionGroup/AmazonLoginActionGroup.xml",
"new_path": "Test/Mftf-23/ActionGroup/AmazonLoginActionGroup.xml",
"diff": "<wait time=\"1\" stepKey=\"allowButtonToActivate\"/>\n<executeInSelenium function=\"function (\\Facebook\\WebDriver\\Remote\\RemoteWebDriver $remoteWebDriver) use ($I, $openerName) {\n+ $continueAs = $remoteWebDriver->findElements(WebDriverBy::cssSelector('#maxo_buy_now input[type=submit]'));\n+\n+ if (!empty($continueAs)) {\n$I->comment('Click Continue as... button and return to checkout');\n$continueAs[0]->click();\n$remoteWebDriver->switchTo()->window($openerName);\n$remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::numberOfWindowsToBe(2));\n$I->switchToNextTab();\n+ }\n}\" stepKey=\"secureSignInWorkaround\" />\n<waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seeAmazonCheckoutButton\"/>\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-824 - Fix undefined variable in login action group |
21,266 | 07.12.2021 16:21:18 | 18,000 | 430622fd79598c4ae05fc148a49d2f5cfa6c6b50 | Clarify type of WebDriverBy in executeInSelenium function | [
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/ActionGroup/AmazonLoginActionGroup.xml",
"new_path": "Test/Mftf-23/ActionGroup/AmazonLoginActionGroup.xml",
"diff": "<wait time=\"1\" stepKey=\"allowButtonToActivate\"/>\n<executeInSelenium function=\"function (\\Facebook\\WebDriver\\Remote\\RemoteWebDriver $remoteWebDriver) use ($I, $openerName) {\n- $continueAs = $remoteWebDriver->findElements(WebDriverBy::cssSelector('#maxo_buy_now input[type=submit]'));\n+ $continueAs = $remoteWebDriver->findElements(\\Facebook\\WebDriver\\WebDriverBy::cssSelector('#maxo_buy_now input[type=submit]'));\nif (!empty($continueAs)) {\n$I->comment('Click Continue as... button and return to checkout');\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-824 - Clarify type of WebDriverBy in executeInSelenium function |
21,248 | 17.12.2021 14:36:39 | 28,800 | 3254a757adf812ef4b26a9e60731050fee8e4a06 | Added functionality to load the quote from the user context if an id is not provided. Added is numeric check to provided cart ids prior to calling the masked id conversion | [
{
"change_type": "MODIFY",
"old_path": "Helper/Session.php",
"new_path": "Helper/Session.php",
"diff": "@@ -17,16 +17,25 @@ namespace Amazon\\Pay\\Helper;\nuse Amazon\\Pay\\Api\\Data\\AmazonCustomerInterface;\nuse Amazon\\Pay\\Domain\\ValidationCredentials;\n+use Magento\\Authorization\\Model\\UserContextInterface;\nuse Magento\\Customer\\Api\\Data\\CustomerInterface;\nuse Magento\\Customer\\Model\\Session as CustomerSession;\nuse Magento\\Checkout\\Model\\Session as CheckoutSession;\nuse Magento\\Framework\\Event\\ManagerInterface as EventManagerInterface;\nuse Magento\\Framework\\Exception\\NoSuchEntityException;\n+use Magento\\Quote\\Api\\CartManagementInterface;\nuse Magento\\Quote\\Api\\CartRepositoryInterface;\n+use Magento\\Quote\\Api\\Data\\CartInterface;\nuse Magento\\Quote\\Model\\MaskedQuoteIdToQuoteIdInterface;\n+use function PHPUnit\\Framework\\returnArgument;\nclass Session\n{\n+ /**\n+ * @var CartManagementInterface\n+ */\n+ private $cartManagement;\n+\n/**\n* @var CustomerSession\n*/\n@@ -52,24 +61,37 @@ class Session\n*/\nprivate $maskedQuoteIdConverter;\n+ /**\n+ * @var UserContextInterface\n+ */\n+ private $userContext;\n+\n/**\n* Session constructor.\n+ * @param CartManagementInterface $cartManagement\n* @param CustomerSession $session\n* @param EventManagerInterface $eventManager\n* @param CheckoutSession $checkoutSession\n+ * @param CartRepositoryInterface $cartRepository\n+ * @param MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdConverter\n+ * @param UserContextInterface $userContext\n*/\npublic function __construct(\n+ CartManagementInterface $cartManagement,\nCustomerSession $session,\nEventManagerInterface $eventManager,\nCheckoutSession $checkoutSession,\nCartRepositoryInterface $cartRepository,\n- MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdConverter\n+ MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdConverter,\n+ UserContextInterface $userContext\n) {\n+ $this->cartManagement = $cartManagement;\n$this->session = $session;\n$this->checkoutSession = $checkoutSession;\n$this->eventManager = $eventManager;\n$this->cartRepository = $cartRepository;\n$this->maskedQuoteIdConverter = $maskedQuoteIdConverter;\n+ $this->userContext = $userContext;\n}\n/**\n@@ -196,7 +218,7 @@ class Session\n}\n/**\n- * @return \\Magento\\Quote\\Api\\Data\\CartInterface|\\Magento\\Quote\\Model\\Quote\n+ * @return CartInterface|\\Magento\\Quote\\Model\\Quote\n* @throws \\Magento\\Framework\\Exception\\LocalizedException\n* @throws \\Magento\\Framework\\Exception\\NoSuchEntityException\n*/\n@@ -206,24 +228,42 @@ class Session\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+ * @param $cartId\n+ * @return false|CartInterface\n*/\npublic function getQuoteFromIdOrSession($cartId = null)\n{\ntry {\nif (empty($cartId)) {\n- $quote = $this->session->getQuote();\n- } else {\n- $quoteId = $this->maskedQuoteIdConverter->execute($cartId);\n- $quote = $this->cartRepository->get($quoteId);\n+ $userContextCartId = $this->getCartIdViaUserContext();\n+ if ($userContextCartId !== null) {\n+ return $this->cartRepository->get($userContextCartId);\n+ }\n+ return $this->session->getQuote();\n}\n+ $quoteId = is_numeric($cartId) ? $cartId : $this->maskedQuoteIdConverter->execute($cartId);\n+ return $this->cartRepository->get($quoteId);\n} catch (NoSuchEntityException $e) {\nreturn false;\n}\n+ }\n- return $quote;\n+ /**\n+ * @return int|null\n+ */\n+ public function getCartIdViaUserContext()\n+ {\n+ try {\n+ $customerId = $this->userContext->getUserId();\n+\n+ /** @var CartInterface */\n+ $cart = $this->cartManagement->getCartForCustomer($customerId);\n+ if ($cart) {\n+ return $cart->getId();\n+ }\n+ return null;\n+ } catch (NoSuchEntityException $e) {\n+ return null;\n+ }\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -18,6 +18,7 @@ namespace Amazon\\Pay\\Model;\nuse Amazon\\Pay\\Api\\Data\\CheckoutSessionInterface;\nuse Amazon\\Pay\\Gateway\\Config\\Config;\n+use Amazon\\Pay\\Helper\\Session;\nuse Amazon\\Pay\\Model\\Config\\Source\\AuthorizationMode;\nuse Amazon\\Pay\\Model\\Config\\Source\\PaymentAction;\nuse Amazon\\Pay\\Model\\AsyncManagement;\n@@ -150,6 +151,11 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n*/\nprivate $logger;\n+ /**\n+ * @var Session\n+ */\n+ private $session;\n+\n/**\n* CheckoutSessionManagement constructor.\n* @param \\Magento\\Store\\Model\\StoreManagerInterface $storeManager\n@@ -173,6 +179,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n* @param \\Magento\\Sales\\Model\\ResourceModel\\Order\\CollectionFactory $orderCollectionFactory\n* @param MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdConverter\n* @param \\Amazon\\Pay\\Logger\\Logger $logger\n+ * @param Session $session\n*/\npublic function __construct(\n\\Magento\\Store\\Model\\StoreManagerInterface $storeManager,\n@@ -195,7 +202,8 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n\\Magento\\Framework\\Api\\SearchCriteriaBuilder $searchCriteriaBuilder,\n\\Magento\\Sales\\Model\\ResourceModel\\Order\\CollectionFactory $orderCollectionFactory,\nMaskedQuoteIdToQuoteIdInterface $maskedQuoteIdConverter,\n- \\Amazon\\Pay\\Logger\\Logger $logger\n+ \\Amazon\\Pay\\Logger\\Logger $logger,\n+ Session $session\n) {\n$this->storeManager = $storeManager;\n$this->quoteIdMaskFactory = $quoteIdMaskFactory;\n@@ -218,6 +226,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$this->orderCollectionFactory = $orderCollectionFactory;\n$this->maskedQuoteIdConverter = $maskedQuoteIdConverter;\n$this->logger = $logger;\n+ $this->session = $session;\n}\n/**\n@@ -322,34 +331,12 @@ 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*/\npublic function getConfig($cartId = null)\n{\n- if (!$quote = $this->getQuoteFromIdOrSession($cartId)) {\n+ if (!$quote = $this->session->getQuoteFromIdOrSession($cartId)) {\nreturn [];\n}\n@@ -423,7 +410,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n*/\npublic function updateCheckoutSession($amazonCheckoutSessionId, $cartId = null)\n{\n- if (!$quote = $this->getQuoteFromIdOrSession($cartId)) {\n+ if (!$quote = $this->session->getQuoteFromIdOrSession($cartId)) {\nreturn [];\n}\n@@ -581,7 +568,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n*/\npublic function completeCheckoutSession($amazonSessionId, $cartId = null)\n{\n- if (!$quote = $this->getQuoteFromIdOrSession($cartId)) {\n+ if (!$quote = $this->session->getQuoteFromIdOrSession($cartId)) {\nreturn ['success' => false];\n}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-841 - Added functionality to load the quote from the user context if an id is not provided. Added is numeric check to provided cart ids prior to calling the masked id conversion |
21,248 | 17.12.2021 14:52:15 | 28,800 | 5eaacc5ea2a37c639dbb15c1ed5da10eba2fa8d4 | Filtering out the numeric values passed to load solely via user context to prevent guessed ids from being passed and accessed | [
{
"change_type": "MODIFY",
"old_path": "Helper/Session.php",
"new_path": "Helper/Session.php",
"diff": "@@ -234,14 +234,14 @@ class Session\npublic function getQuoteFromIdOrSession($cartId = null)\n{\ntry {\n- if (empty($cartId)) {\n+ if (empty($cartId) || is_numeric($cartId)) {\n$userContextCartId = $this->getCartIdViaUserContext();\nif ($userContextCartId !== null) {\nreturn $this->cartRepository->get($userContextCartId);\n}\nreturn $this->session->getQuote();\n}\n- $quoteId = is_numeric($cartId) ? $cartId : $this->maskedQuoteIdConverter->execute($cartId);\n+ $quoteId = $this->maskedQuoteIdConverter->execute($cartId);\nreturn $this->cartRepository->get($quoteId);\n} catch (NoSuchEntityException $e) {\nreturn false;\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-841 - Filtering out the numeric values passed to load solely via user context to prevent guessed ids from being passed and accessed |
21,241 | 17.12.2021 18:29:09 | 21,600 | 25965e9fd2f97f65ff7bba4ecdb1c4aaca28915f | update to use phpseclib 3.x and allow php 8 | [
{
"change_type": "MODIFY",
"old_path": "Model/Config/AutoKeyExchange.php",
"new_path": "Model/Config/AutoKeyExchange.php",
"diff": "@@ -22,9 +22,7 @@ use Amazon\\Pay\\Model\\AmazonConfig;\nuse Magento\\Framework\\App\\State;\nuse Magento\\Framework\\App\\Cache\\Type\\Config as CacheTypeConfig;\nuse Magento\\Backend\\Model\\UrlInterface;\n-use Magento\\Payment\\Helper\\Formatter;\n-use \\phpseclib\\Crypt\\RSA;\n-use \\phpseclib\\Crypt\\AES;\n+use phpseclib3\\Crypt\\RSA;\nclass AutoKeyExchange\n{\n@@ -274,12 +272,11 @@ class AutoKeyExchange\n*/\npublic function generateKeys()\n{\n- $rsa = new RSA();\n- $keys = $rsa->createKey(2048);\n- $encrypt = $this->encryptor->encrypt($keys['privatekey']);\n+ $keys = RSA::createKey(2048);\n+ $encrypt = $this->encryptor->encrypt($keys->__toString());\n$this->config\n- ->saveConfig(self::CONFIG_XML_PATH_PUBLIC_KEY, $keys['publickey'], 'default', 0)\n+ ->saveConfig(self::CONFIG_XML_PATH_PUBLIC_KEY, $keys->getPublicKey()->__toString(), 'default', 0)\n->saveConfig(self::CONFIG_XML_PATH_PRIVATE_KEY, $encrypt, 'default', 0);\n$this->cacheManager->clean([CacheTypeConfig::TYPE_IDENTIFIER]);\n@@ -327,7 +324,7 @@ class AutoKeyExchange\n// Generate key pair\nif (!$publickey || $reset || strlen($publickey) < 300) {\n$keys = $this->generateKeys();\n- $publickey = $keys['publickey'];\n+ $publickey = $keys->getPublicKey()->__toString();\n}\nif (!$pemformat) {\n"
},
{
"change_type": "MODIFY",
"old_path": "composer.json",
"new_path": "composer.json",
"diff": "\"phpunit/phpunit\": \"4.1.0\"\n},\n\"require\": {\n- \"php\": \"~7.0.13||~7.1.0||~7.2.0||~7.3.0||~7.4.0\",\n+ \"php\": \"~7.0.13||~7.1.0||~7.2.0||~7.3.0||~7.4.0||~8.0.0||~8.1.0\",\n\"magento/framework\": \"^102.0||^103.0\",\n\"magento/module-sales\": \"^100.0||^101.0||^102.0||^103.0\",\n\"magento/module-checkout\": \"^100.0\",\n\"magento/module-directory\": \"^100.0\",\n\"magento/module-media-storage\": \"^100.0\",\n\"magento/module-paypal\": \"^100.0||^101.0\",\n+ \"phpseclib/phpseclib\": \"~3.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-840 - update to use phpseclib 3.x and allow php 8 |
21,248 | 22.12.2021 09:59:14 | 28,800 | ceeee96e5c0b99824375a652f3f9a6f4eef44319 | Cleaned up the functionality a bit and added in the pr change to session model | [
{
"change_type": "MODIFY",
"old_path": "Helper/Session.php",
"new_path": "Helper/Session.php",
"diff": "@@ -22,6 +22,7 @@ use Magento\\Customer\\Api\\Data\\CustomerInterface;\nuse Magento\\Customer\\Model\\Session as CustomerSession;\nuse Magento\\Checkout\\Model\\Session as CheckoutSession;\nuse Magento\\Framework\\Event\\ManagerInterface as EventManagerInterface;\n+use Magento\\Framework\\Exception\\LocalizedException;\nuse Magento\\Framework\\Exception\\NoSuchEntityException;\nuse Magento\\Quote\\Api\\CartManagementInterface;\nuse Magento\\Quote\\Api\\CartRepositoryInterface;\n@@ -234,16 +235,22 @@ class Session\npublic function getQuoteFromIdOrSession($cartId = null)\n{\ntry {\n+ // the intention of is_numeric is to filter out any potential unwanted requests trying to guess quote ids\n+ // we only really want to utilize masked ids here unless retrieved elsewhere\nif (empty($cartId) || is_numeric($cartId)) {\n+ $quote = $this->getQuote();\n+ if (!$quote) {\n+ // here we'll check the user context for any available cart data before moving on\n$userContextCartId = $this->getCartIdViaUserContext();\nif ($userContextCartId !== null) {\nreturn $this->cartRepository->get($userContextCartId);\n}\n- return $this->session->getQuote();\n+ }\n+ return $quote;\n}\n$quoteId = $this->maskedQuoteIdConverter->execute($cartId);\nreturn $this->cartRepository->get($quoteId);\n- } catch (NoSuchEntityException $e) {\n+ } catch (NoSuchEntityException | LocalizedException $e) {\nreturn false;\n}\n}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-841 - Cleaned up the functionality a bit and added in the pr change to session model |
21,266 | 06.01.2022 16:14:43 | 18,000 | 73c06cfbe36fb75eccf05ed2059ab3d797839245 | Add several guards to account for slow loading in popup, PDP, and checkout forms | [
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/ActionGroup/AmazonCheckoutActionGroup.xml",
"new_path": "Test/Mftf-23/ActionGroup/AmazonCheckoutActionGroup.xml",
"diff": "<grabAttributeFrom selector=\"{{AmazonPageSection.addressDetails({$amazonAddressId})}}\" userInput=\"data-country\" stepKey=\"amazonAddressCountryCode\"/>\n<grabAttributeFrom selector=\"{{AmazonPageSection.addressDetails({$amazonAddressId})}}\" userInput=\"data-phone_number\" stepKey=\"amazonAddressPhoneNumber\"/>\n+ <executeInSelenium function=\"function (\\Facebook\\WebDriver\\Remote\\RemoteWebDriver $remoteWebDriver) {\n+ $changePaymentSelector = \\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{AmazonPageSection.changePaymentButton}}');\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::elementToBeClickable($changePaymentSelector));\n+ $usePaymentSelector = \\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{AmazonPageSection.usePaymentButton}}');\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::presenceOfElementLocated($usePaymentSelector));\n+ }\" stepKey=\"allowPaymentMethodsToLoad\" />\n+\n<!-- choose card -->\n+ <waitForJS function=\"return document.querySelectorAll('#maxo_payment_methods .a-radio-label').length > 0;\" time=\"30\" stepKey=\"waitForPaymentMethodRadioButtons\"/>\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('{{cc}}')) { v.click() } });\" stepKey=\"executeJsCc\"/>\n<click selector=\"{{AmazonPageSection.usePaymentButton}}\" stepKey=\"clickUsePaymentMethod\"/>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Test/Mftf-23/ActionGroup/AmazonFillGuestShippingActionGroup.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+ <actionGroup name=\"GuestCheckoutFillingShippingSectionActionGroup\">\n+ <annotations>\n+ <description>Fills in the provided Customer/Address (Including Region) details on the Storefront Checkout page under the 'Shipping Address' section. Selects the provided Shipping Method. Clicks on Next. Validates that the URL is present and correct.</description>\n+ </annotations>\n+ <arguments>\n+ <argument name=\"customerVar\" defaultValue=\"CustomerEntityOne\"/>\n+ <argument name=\"customerAddressVar\" defaultValue=\"CustomerAddressSimple\"/>\n+ <!--First available shipping method will be selected if value is not passed for shippingMethod-->\n+ <argument name=\"shippingMethod\" defaultValue=\"\" type=\"string\"/>\n+ </arguments>\n+\n+ <fillField selector=\"{{CheckoutShippingSection.email}}\" userInput=\"{{customerVar.email}}\" stepKey=\"enterEmail\"/>\n+ <fillField selector=\"{{CheckoutShippingSection.firstName}}\" userInput=\"{{customerVar.firstname}}\" stepKey=\"enterFirstName\"/>\n+ <fillField selector=\"{{CheckoutShippingSection.lastName}}\" userInput=\"{{customerVar.lastname}}\" stepKey=\"enterLastName\"/>\n+ <fillField selector=\"{{CheckoutShippingSection.street}}\" userInput=\"{{customerAddressVar.street[0]}}\" stepKey=\"enterStreet\"/>\n+ <fillField selector=\"{{CheckoutShippingSection.city}}\" userInput=\"{{customerAddressVar.city}}\" stepKey=\"enterCity\"/>\n+ <selectOption selector=\"{{CheckoutShippingSection.region}}\" userInput=\"{{customerAddressVar.state}}\" stepKey=\"selectRegion\"/>\n+ <fillField selector=\"{{CheckoutShippingSection.postcode}}\" userInput=\"{{customerAddressVar.postcode}}\" stepKey=\"enterPostcode\"/>\n+ <fillField selector=\"{{CheckoutShippingSection.telephone}}\" userInput=\"{{customerAddressVar.telephone}}\" stepKey=\"enterTelephone\"/>\n+ <waitForLoadingMaskToDisappear stepKey=\"waitForLoadingMask\"/>\n+ <waitForElement selector=\"{{CheckoutShippingMethodsSection.checkShippingMethodByName('shippingMethod')}}\" stepKey=\"waitForShippingMethod\"/>\n+ <scrollTo selector=\"{{CheckoutShippingMethodsSection.checkShippingMethodByName('shippingMethod')}}\" stepKey=\"scrollToShhippingMethod\" before=\"selectShippingMethod\"/>\n+ <click selector=\"{{CheckoutShippingMethodsSection.checkShippingMethodByName('shippingMethod')}}\" stepKey=\"selectShippingMethod\"/>\n+ <waitForElement selector=\"{{CheckoutShippingSection.next}}\" time=\"30\" stepKey=\"waitForNextButton\"/>\n+ <click selector=\"{{CheckoutShippingSection.next}}\" stepKey=\"clickNext\"/>\n+ <waitForElement selector=\"{{CheckoutPaymentSection.paymentSectionTitle}}\" time=\"30\" stepKey=\"waitForPaymentSectionLoaded\"/>\n+ <seeInCurrentUrl url=\"{{CheckoutPage.url}}/#payment\" stepKey=\"assertCheckoutPaymentUrl\"/>\n+ </actionGroup>\n+</actionGroups>\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/ActionGroup/AmazonLoginActionGroup.xml",
"new_path": "Test/Mftf-23/ActionGroup/AmazonLoginActionGroup.xml",
"diff": "$remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::numberOfWindowsToBe(2));\n$I->switchToNextTab();\n+ $addressIdSelector = \\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{AmazonPageSection.addressId}}');\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::presenceOfElementLocated($addressIdSelector));\n+\n+ $changePaymentSelector = \\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{AmazonPageSection.changePaymentButton}}');\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::elementToBeClickable($changePaymentSelector));\n+ $usePaymentSelector = \\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{AmazonPageSection.usePaymentButton}}');\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::presenceOfElementLocated($usePaymentSelector));\n}\n}\" stepKey=\"secureSignInWorkaround\" />\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml",
"new_path": "Test/Mftf-23/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml",
"diff": "$remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::numberOfWindowsToBe(2));\n$I->switchToNextTab();\n+ $addressIdSelector = \\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{AmazonPageSection.addressId}}');\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::presenceOfElementLocated($addressIdSelector));\n+\n+ $changePaymentSelector = \\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{AmazonPageSection.changePaymentButton}}');\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::elementToBeClickable($changePaymentSelector));\n+ $usePaymentSelector = \\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{AmazonPageSection.usePaymentButton}}');\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::presenceOfElementLocated($usePaymentSelector));\n}\n}\" stepKey=\"secureSignInWorkaround\" />\n<grabAttributeFrom selector=\"{{AmazonPageSection.addressDetails({$amazonAddressId})}}\" userInput=\"data-phone_number\" stepKey=\"amazonAddressPhoneNumber\"/>\n<!-- choose card -->\n+ <waitForJS function=\"return document.querySelectorAll('#maxo_payment_methods .a-radio-label').length > 0;\" time=\"30\" stepKey=\"waitForPaymentMethodRadioButtons\"/>\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('{{cc}}')) { v.click() } });\" stepKey=\"executeJsCc\"/>\n<click selector=\"{{AmazonPageSection.usePaymentButton}}\" stepKey=\"clickUsePaymentMethod\"/>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Test/Mftf-23/ActionGroup/AmazonStorefrontAddToTheCartActionGroup.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+ <actionGroup name=\"StorefrontAddToTheCartActionGroup\">\n+ <annotations>\n+ <description>Scrolls to the Add To Cart button. Clicks on Add To Cart.</description>\n+ </annotations>\n+\n+ <waitForPageLoad stepKey=\"waitForPageLoad\"/>\n+ <scrollTo selector=\"{{StorefrontProductActionSection.addToCart}}\" stepKey=\"scrollToAddToCartButton\"/>\n+\n+ <executeInSelenium function=\"function (\\Facebook\\WebDriver\\Remote\\RemoteWebDriver $remoteWebDriver) {\n+ $addToCartSelector = \\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{StorefrontProductActionSection.addToCart}}');\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::elementToBeClickable($addToCartSelector));\n+ }\" stepKey=\"allowAddToCartButtonToLoad\" before=\"addToCart\"/>\n+ <click selector=\"{{StorefrontProductActionSection.addToCart}}\" stepKey=\"addToCart\"/>\n+ <waitForPageLoad stepKey=\"waitForPageToLoad\"/>\n+ <waitForElementVisible selector=\"{{StorefrontMessagesSection.success}}\" stepKey=\"waitForSuccessMessage\"/>\n+ </actionGroup>\n+</actionGroups>\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/Test/AmazonCancelReturnUrl.xml",
"new_path": "Test/Mftf-23/Test/AmazonCancelReturnUrl.xml",
"diff": "$remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::numberOfWindowsToBe(2));\n$I->switchToNextTab();\n+ $addressIdSelector = \\Facebook\\WebDriver\\WebDriverBy::cssSelector('{{AmazonPageSection.addressId}}');\n+ $remoteWebDriver->wait(30, 100)->until(\\Facebook\\WebDriver\\WebDriverExpectedCondition::presenceOfElementLocated($addressIdSelector));\n}\n}\" stepKey=\"secureSignInWorkaround\" />\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/Test/AmazonCheckoutPayNowDeclinedTest.xml",
"new_path": "Test/Mftf-23/Test/AmazonCheckoutPayNowDeclinedTest.xml",
"diff": "<actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"amazonLogin\" />\n<!-- choose card -->\n+ <waitForJS function=\"return document.querySelectorAll('#maxo_payment_methods .a-radio-label').length > 0;\" time=\"30\" stepKey=\"waitForPaymentMethodRadioButtons\"/>\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"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/Test/AmazonCheckoutPayNowMulticurrencySuccessTest.xml",
"new_path": "Test/Mftf-23/Test/AmazonCheckoutPayNowMulticurrencySuccessTest.xml",
"diff": "<executeJS function=\"return window.name;\" stepKey=\"openerName\"/>\n<click selector=\"{{AmazonButtonSection.payment}}\" stepKey=\"clickAmazonPay\" />\n- <actionGroup ref=\"AmazonSwitchToPopupActionGroup\" stepKey=\"switchToPopup\" />\n<actionGroup ref=\"AmazonLoginActionGroup\" stepKey=\"amazonLogin\" />\n<waitForElement selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"seePayNow\" />\n<click selector=\"{{AmazonPageSection.checkoutButton}}\" stepKey=\"payNow\" />\n- <switchToWindow userInput=\"{$openerName}\" stepKey=\"switchToWindowOpener\" />\n<waitForPageLoad stepKey=\"checkoutSuccessLoad\" />\n<waitForElementVisible selector=\"{{CheckoutSuccessMainSection.successTitle}}\" stepKey=\"waitForProcess\" />\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Add several guards to account for slow loading in popup, PDP, and checkout forms |
21,250 | 15.10.2021 16:59:00 | 10,800 | fa2bfc4ed327af620d78ad0d03f808a9d3aca9b5 | Added SigIn endpoint | [
{
"change_type": "MODIFY",
"old_path": "Api/CheckoutSessionManagementInterface.php",
"new_path": "Api/CheckoutSessionManagementInterface.php",
"diff": "@@ -57,4 +57,10 @@ interface CheckoutSessionManagementInterface\n* @return int\n*/\npublic function completeCheckoutSession($amazonSessionId, $cartId = null);\n+\n+ /**\n+ * @param mixed $buyerToken\n+ * @return mixed\n+ */\n+ public function signIn($buyerToken);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Controller/Login.php",
"new_path": "Controller/Login.php",
"diff": "@@ -23,6 +23,9 @@ use Amazon\\Pay\\Model\\AmazonConfig;\nuse Amazon\\Pay\\Model\\Validator\\AccessTokenRequestValidator;\nuse Magento\\Customer\\Model\\Account\\Redirect as AccountRedirect;\nuse Amazon\\Pay\\Helper\\Session;\n+use Amazon\\Pay\\Helper\\Customer as CustomerHelper;\n+use Amazon\\Pay\\Model\\Adapter\\AmazonPayAdapter;\n+use Amazon\\Pay\\Domain\\ValidationCredentials;\nuse Magento\\Customer\\Api\\AccountManagementInterface;\nuse Magento\\Customer\\Model\\Session as CustomerSession;\nuse Magento\\Customer\\Model\\Url;\n@@ -110,8 +113,16 @@ abstract class Login extends Action\n*/\nprotected $accountManagement;\n+ /**\n+ * @var CheckoutSessionManagement\n+ */\nprotected $checkoutSessionManagement;\n+ /**\n+ * @var CustomerHelper\n+ */\n+ protected $customerHelper;\n+\n/**\n* Login constructor.\n* @param Context $context\n@@ -129,12 +140,14 @@ abstract class Login extends Action\n* @param StoreManager $storeManager\n* @param UrlInterface $url\n* @param AccountManagementInterface $accountManagement\n+ * @param CheckoutSessionManagementInterface $checkoutSessionManagement\n+ * @param customerHelper $customerHelper\n* @SuppressWarnings(PHPMD.ExcessiveParameterList)\n*/\npublic function __construct(\nContext $context,\nAmazonCustomerFactory $amazonCustomerFactory,\n- \\Amazon\\Pay\\Model\\Adapter\\AmazonPayAdapter $amazonAdapter,\n+ AmazonPayAdapter $amazonAdapter,\nAmazonConfig $amazonConfig,\nUrl $customerUrl,\nAccessTokenRequestValidator $accessTokenRequestValidator,\n@@ -147,7 +160,8 @@ abstract class Login extends Action\nStoreManager $storeManager,\nUrlInterface $url,\nAccountManagementInterface $accountManagement,\n- CheckoutSessionManagementInterface $checkoutSessionManagement\n+ CheckoutSessionManagementInterface $checkoutSessionManagement,\n+ CustomerHelper $customerHelper\n) {\n$this->amazonCustomerFactory = $amazonCustomerFactory;\n$this->amazonAdapter = $amazonAdapter;\n@@ -164,43 +178,10 @@ abstract class Login extends Action\n$this->url = $url;\n$this->accountManagement = $accountManagement;\n$this->checkoutSessionManagement = $checkoutSessionManagement;\n+ $this->customerHelper = $customerHelper;\nparent::__construct($context);\n}\n- /**\n- * Load userinfo from access token\n- *\n- * @return AmazonCustomerInterface|false\n- */\n- protected function getAmazonCustomer($token)\n- {\n- try {\n- $userInfo = $this->amazonAdapter\n- ->getBuyer($token);\n-\n- if (is_array($userInfo) && array_key_exists('buyerId', $userInfo) && !empty($userInfo['buyerId'])) {\n- $data = [\n- 'id' => $userInfo['buyerId'],\n- 'email' => $userInfo['email'],\n- 'name' => $userInfo['name'],\n- 'country' => $this->amazonConfig->getRegion(),\n- ];\n- $amazonCustomer = $this->amazonCustomerFactory->create($data);\n-\n- return $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- }\n-\n- return false;\n- }\n-\n/**\n* @return bool\n*/\n@@ -224,4 +205,33 @@ abstract class Login extends Action\n{\nreturn $this->accountRedirect->getRedirect();\n}\n+\n+ protected function getAmazonCustomer($buyerInfo)\n+ {\n+ return $this->customerHelper->getAmazonCustomer($buyerInfo);\n+ }\n+\n+ protected function processAmazonCustomer(AmazonCustomerInterface $amazonCustomer)\n+ {\n+ $customerData = $this->matcher->match($amazonCustomer);\n+\n+ if (null === $customerData) {\n+ return $this->createCustomer($amazonCustomer);\n+ }\n+\n+ if ($amazonCustomer->getId() != $customerData->getExtensionAttributes()->getAmazonId()) {\n+ if (! $this->session->isLoggedIn()) {\n+ return new ValidationCredentials($customerData->getId(), $amazonCustomer->getId());\n+ }\n+\n+ $this->customerLinkManagement->updateLink($customerData->getId(), $amazonCustomer->getId());\n+ }\n+\n+ return $customerData;\n+ }\n+\n+ protected function createCustomer(AmazonCustomerInterface $amazonCustomer)\n+ {\n+ return $this->customerHelper->createCustomer($amazonCustomer);\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Controller/Login/Authorize.php",
"new_path": "Controller/Login/Authorize.php",
"diff": "*/\nnamespace Amazon\\Pay\\Controller\\Login;\n-use Amazon\\Pay\\Api\\Data\\AmazonCustomerInterface;\nuse Amazon\\Pay\\Domain\\ValidationCredentials;\nuse Magento\\Framework\\Exception\\ValidatorException;\nuse Magento\\Framework\\Exception\\NotFoundException;\n-use Zend_Validate;\nclass Authorize extends \\Amazon\\Pay\\Controller\\Login\n{\n@@ -39,7 +37,8 @@ class Authorize extends \\Amazon\\Pay\\Controller\\Login\n$token = $this->getRequest()->getParam('buyerToken');\ntry {\n- $amazonCustomer = $this->getAmazonCustomer($token);\n+ $buyerInfo = $this->amazonAdapter->getBuyer($token);\n+ $amazonCustomer = $this->getAmazonCustomer($buyerInfo);\nif ($amazonCustomer) {\n$processed = $this->processAmazonCustomer($amazonCustomer);\n@@ -50,6 +49,8 @@ class Authorize extends \\Amazon\\Pay\\Controller\\Login\n} else {\n$this->session->login($processed);\n}\n+ } else {\n+ $this->logger->error('Amazon buyerId is empty. Token: ' . $token);\n}\n} catch (ValidatorException $e) {\n$this->logger->error($e);\n@@ -64,35 +65,4 @@ class Authorize extends \\Amazon\\Pay\\Controller\\Login\nreturn $this->getRedirectAccount();\n}\n-\n- protected function processAmazonCustomer(AmazonCustomerInterface $amazonCustomer)\n- {\n- $customerData = $this->matcher->match($amazonCustomer);\n-\n- if (null === $customerData) {\n- return $this->createCustomer($amazonCustomer);\n- }\n-\n- if ($amazonCustomer->getId() != $customerData->getExtensionAttributes()->getAmazonId()) {\n- if (! $this->session->isLoggedIn()) {\n- return new ValidationCredentials($customerData->getId(), $amazonCustomer->getId());\n- }\n-\n- $this->customerLinkManagement->updateLink($customerData->getId(), $amazonCustomer->getId());\n- }\n-\n- return $customerData;\n- }\n-\n- protected function createCustomer(AmazonCustomerInterface $amazonCustomer)\n- {\n- if (! Zend_Validate::is($amazonCustomer->getEmail(), 'EmailAddress')) {\n- throw new ValidatorException(__('the email address for your Amazon account is invalid'));\n- }\n-\n- $customerData = $this->customerLinkManagement->create($amazonCustomer);\n- $this->customerLinkManagement->updateLink($customerData->getId(), $amazonCustomer->getId());\n-\n- return $customerData;\n- }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Controller/Login/Checkout.php",
"new_path": "Controller/Login/Checkout.php",
"diff": "*/\nnamespace Amazon\\Pay\\Controller\\Login;\n-use Amazon\\Pay\\Api\\Data\\AmazonCustomerInterface;\nuse Amazon\\Pay\\Domain\\ValidationCredentials;\nuse Magento\\Framework\\Exception\\NoSuchEntityException;\nuse Magento\\Framework\\Exception\\ValidatorException;\nuse Magento\\Quote\\Api\\Data\\CartInterface;\n-use Zend_Validate;\nclass Checkout extends \\Amazon\\Pay\\Controller\\Login\n{\n@@ -53,7 +51,8 @@ class Checkout extends \\Amazon\\Pay\\Controller\\Login\n}\n}\n} else {\n- $amazonCustomer = $this->createAmazonCustomerFromSession($checkoutSession);\n+ $buyerInfo = $checkoutSession['buyer'];\n+ $amazonCustomer = $this->getAmazonCustomer($buyerInfo);\nif ($amazonCustomer) {\n$processed = $this->processAmazonCustomer($amazonCustomer);\n@@ -69,6 +68,8 @@ class Checkout extends \\Amazon\\Pay\\Controller\\Login\n} elseif (!$this->customerSession->isLoggedIn()) {\n$this->session->login($processed);\n}\n+ } else {\n+ $this->logger->error('Amazon buyerId is empty');\n}\n}\n} catch (ValidatorException $e) {\n@@ -85,72 +86,4 @@ class Checkout extends \\Amazon\\Pay\\Controller\\Login\n$checkoutUrl = $this->amazonConfig->getCheckoutReviewUrlPath();\nreturn $this->_redirect($checkoutUrl, ['_query' => ['amazonCheckoutSessionId' => $checkoutSessionId]]);\n}\n-\n- protected function processAmazonCustomer(AmazonCustomerInterface $amazonCustomer)\n- {\n- $customerData = $this->matcher->match($amazonCustomer);\n-\n- if (null === $customerData) {\n- return $this->createCustomer($amazonCustomer);\n- }\n-\n- if ($amazonCustomer->getId() != $customerData->getExtensionAttributes()->getAmazonId()) {\n- if (! $this->session->isLoggedIn()) {\n- return new ValidationCredentials($customerData->getId(), $amazonCustomer->getId());\n- }\n-\n- $this->customerLinkManagement->updateLink($customerData->getId(), $amazonCustomer->getId());\n- }\n-\n- return $customerData;\n- }\n-\n- protected function createCustomer(AmazonCustomerInterface $amazonCustomer)\n- {\n- if (! Zend_Validate::is($amazonCustomer->getEmail(), 'EmailAddress')) {\n- throw new ValidatorException(__('the email address for your Amazon account is invalid'));\n- }\n-\n- $customerData = $this->customerLinkManagement->create($amazonCustomer);\n- $this->customerLinkManagement->updateLink($customerData->getId(), $amazonCustomer->getId());\n-\n- return $customerData;\n- }\n-\n- /**\n- * @param $checkoutSession\n- * @return array|false\n- */\n- protected function getAmazonCustomerFromSession($checkoutSession)\n- {\n- $userInfo = $checkoutSession['buyer'];\n- if (is_array($userInfo) && array_key_exists('buyerId', $userInfo) && !empty($userInfo['buyerId'])) {\n- $data = [\n- 'id' => $userInfo['buyerId'],\n- 'email' => $userInfo['email'],\n- 'name' => $userInfo['name'],\n- 'country' => $this->amazonConfig->getRegion(),\n- ];\n-\n- return $data;\n- } else {\n- $this->logger->error('Amazon buyerId is empty');\n- }\n-\n- return false;\n- }\n-\n- /**\n- * @param $checkoutSession\n- * @return \\Amazon\\Pay\\Domain\\AmazonCustomer\n- */\n- protected function createAmazonCustomerFromSession($checkoutSession)\n- {\n- $data = $this->getAmazonCustomerFromSession($checkoutSession);\n- if ($data) {\n- return $this->amazonCustomerFactory->create($data);\n- } else {\n- return false;\n- }\n- }\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Helper/Customer.php",
"diff": "+<?php\n+\n+/**\n+ * Copyright 2020 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+namespace Amazon\\Pay\\Helper;\n+use Amazon\\Pay\\Api\\Data\\AmazonCustomerInterface;\n+use Zend_Validate;\n+\n+class Customer\n+{\n+ /**\n+ * @var Adapter\\AmazonPayAdapter\n+ */\n+ private $amazonAdapter;\n+\n+ /**\n+ * @var AmazonCustomerFactory\n+ */\n+ private $amazonCustomerFactory;\n+\n+ /**\n+ * @var CustomerLinkManagementInterface\n+ */\n+ private $customerLinkManagement;\n+\n+ /**\n+ * @var AmazonConfig\n+ */\n+ private $amazonConfig;\n+\n+ /**\n+ * @param Adapter\\AmazonPayAdapter $amazonAdapter\n+ * @param Domain\\AmazonCustomerFactory $amazonCustomerFactory\n+ * @param CustomerLinkManagementInterface $customerLinkManagement\n+ * @param AmazonConfig $amazonConfig\n+ */\n+ public function __construct(\n+ \\Amazon\\Pay\\Model\\Adapter\\AmazonPayAdapter $amazonAdapter,\n+ \\Amazon\\Pay\\Domain\\AmazonCustomerFactory $amazonCustomerFactory,\n+ \\Amazon\\Pay\\Api\\CustomerLinkManagementInterface $customerLinkManagement,\n+ \\Amazon\\Pay\\Model\\AmazonConfig $amazonConfig\n+\n+ ) {\n+ $this->amazonAdapter = $amazonAdapter;\n+ $this->amazonCustomerFactory = $amazonCustomerFactory;\n+ $this->customerLinkManagement = $customerLinkManagement;\n+ $this->amazonConfig = $amazonConfig;\n+ }\n+\n+ public function getAmazonCustomer($buyerInfo)\n+ {\n+ if (is_array($buyerInfo) && array_key_exists('buyerId', $buyerInfo) && !empty($buyerInfo['buyerId'])) {\n+ $data = [\n+ 'id' => $buyerInfo['buyerId'],\n+ 'email' => $buyerInfo['email'],\n+ 'name' => $buyerInfo['name'],\n+ 'country' => $this->amazonConfig->getRegion(),\n+ ];\n+ $amazonCustomer = $this->amazonCustomerFactory->create($data);\n+\n+ return $amazonCustomer;\n+\n+ }\n+ return false;\n+ }\n+\n+ public function createCustomer(AmazonCustomerInterface $amazonCustomer)\n+ {\n+ if (! Zend_Validate::is($amazonCustomer->getEmail(), 'EmailAddress')) {\n+ throw new ValidatorException(__('the email address for your Amazon account is invalid'));\n+ }\n+\n+ $customerData = $this->customerLinkManagement->create($amazonCustomer);\n+ $this->updateCustomerLink($customerData->getId(), $amazonCustomer->getId());\n+\n+ return $customerData;\n+ }\n+\n+ public function updateCustomerLink($customerDataId, $amazonCustomerId)\n+ {\n+ return $this->customerLinkManagement->updateLink($customerDataId, $amazonCustomerId);\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/Adapter/AmazonPayAdapter.php",
"new_path": "Model/Adapter/AmazonPayAdapter.php",
"diff": "@@ -509,7 +509,7 @@ class AmazonPayAdapter\npublic function generateLoginButtonPayload()\n{\n$payload = [\n- 'signInReturnUrl' => $this->url->getRouteUrl('amazon_pay/login/authorize/'),\n+ 'signInReturnUrl' => $this->getSignInUrl(),\n'signInCancelUrl' => $this->getCancelUrl(),\n'storeId' => $this->amazonConfig->getClientId(),\n'signInScopes' => ['name', 'email'],\n@@ -616,4 +616,10 @@ class AmazonPayAdapter\nreturn $referer;\n}\n+\n+ protected function getSignInUrl()\n+ {\n+ $signInUrl = $this->amazonConfig->getSignInResultUrlPath();\n+ return $this->url->getUrl($signInUrl);\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/AmazonConfig.php",
"new_path": "Model/AmazonConfig.php",
"diff": "@@ -590,6 +590,22 @@ class AmazonConfig\nreturn $result;\n}\n+ /**\n+ * @return string\n+ */\n+ public function getSignInResultUrlPath($scope = ScopeInterface::SCOPE_STORE, $scopeCode = null)\n+ {\n+ $result = $this->scopeConfig->getValue(\n+ 'payment/amazon_payment_v2/sign_in_result_url',\n+ $scope,\n+ $scopeCode\n+ );\n+ if (empty($result)) {\n+ $result = 'amazon_pay/login/authorize/';\n+ }\n+ return $result;\n+ }\n+\n/**\n* @return string\n*/\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -21,6 +21,9 @@ 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+use Amazon\\Pay\\Helper\\Customer as CustomerHelper;\n+use Amazon\\Pay\\Model\\Customer\\CompositeMatcher as Matcher;\n+use Amazon\\Pay\\Api\\Data\\AmazonCustomerInterface;\nuse http\\Exception\\UnexpectedValueException;\nuse Magento\\Framework\\Exception\\NoSuchEntityException;\nuse Magento\\Framework\\Exception\\NotFoundException;\n@@ -32,6 +35,9 @@ use Magento\\Sales\\Model\\Order\\Invoice;\nuse Magento\\Sales\\Model\\Order\\Payment;\nuse Magento\\Quote\\Model\\MaskedQuoteIdToQuoteIdInterface;\nuse Magento\\Sales\\Api\\Data\\TransactionInterface as Transaction;\n+use Magento\\Integration\\Model\\Oauth\\TokenFactory as TokenModelFactory;\n+use Magento\\Authorization\\Model\\UserContextInterface as UserContext;\n+\nclass CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\n{\n@@ -145,6 +151,29 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n*/\nprivate $maskedQuoteIdConverter;\n+ /**\n+ * @var CustomerHelper\n+ */\n+ private $customerHelper;\n+\n+ /**\n+ * @var Matcher\n+ */\n+ private $matcher;\n+\n+ /**\n+ * Token Model\n+ *\n+ * @var TokenModelFactory\n+ */\n+ private $tokenModelFactory;\n+\n+ /**\n+ *\n+ * @var UserContext\n+ */\n+ private $userContext;\n+\n/**\n* @var \\Amazon\\Pay\\Logger\\Logger\n*/\n@@ -172,6 +201,10 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n* @param \\Magento\\Framework\\Api\\SearchCriteriaBuilder $searchCriteriaBuilder\n* @param \\Magento\\Sales\\Model\\ResourceModel\\Order\\CollectionFactory $orderCollectionFactory\n* @param MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdConverter\n+ * @param CustomerHelper $customerHelper\n+ * @param Matcher $matcher\n+ * @param TokenModelFactory $tokenModelFactory\n+ * @param UserContext $userContext\n* @param \\Amazon\\Pay\\Logger\\Logger $logger\n*/\npublic function __construct(\n@@ -195,6 +228,10 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n\\Magento\\Framework\\Api\\SearchCriteriaBuilder $searchCriteriaBuilder,\n\\Magento\\Sales\\Model\\ResourceModel\\Order\\CollectionFactory $orderCollectionFactory,\nMaskedQuoteIdToQuoteIdInterface $maskedQuoteIdConverter,\n+ CustomerHelper $customerHelper,\n+ Matcher $matcher,\n+ TokenModelFactory $tokenModelFactory,\n+ UserContext $userContext,\n\\Amazon\\Pay\\Logger\\Logger $logger\n) {\n$this->storeManager = $storeManager;\n@@ -217,6 +254,10 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$this->searchCriteriaBuilder = $searchCriteriaBuilder;\n$this->orderCollectionFactory = $orderCollectionFactory;\n$this->maskedQuoteIdConverter = $maskedQuoteIdConverter;\n+ $this->customerHelper = $customerHelper;\n+ $this->matcher = $matcher;\n+ $this->tokenModelFactory = $tokenModelFactory;\n+ $this->userContext = $userContext;\n$this->logger = $logger;\n}\n@@ -349,39 +390,42 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n*/\npublic function getConfig($cartId = null)\n{\n- if (!$quote = $this->getQuoteFromIdOrSession($cartId)) {\n- return [];\n- }\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- $quote->collectTotals();\n-\n$result = [];\n- if ($this->canCheckoutWithAmazon($quote)) {\n+ $config = [];\n$loginButtonPayload = $this->amazonAdapter->generateLoginButtonPayload();\n$checkoutButtonPayload = $this->amazonAdapter->generateCheckoutButtonPayload();\n- $payNowButtonPayload = $this->amazonAdapter->generatePayNowButtonPayload(\n- $quote,\n- $this->amazonConfig->getPaymentAction()\n- );\n-\n- $result[] = [\n+ $config = [\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($quote),\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+ $quote = $this->getQuoteFromIdOrSession($cartId);\n+\n+ if ($quote) {\n+ // Ensure the totals are up to date, in case the checkout does something to update qty or shipping without\n+ // collecting totals\n+ $quote->collectTotals();\n+\n+ if ($this->canCheckoutWithAmazon($quote)) {\n+ $payNowButtonPayload = $this->amazonAdapter->generatePayNowButtonPayload(\n+ $quote,\n+ $this->amazonConfig->getPaymentAction()\n+ );\n+\n+ $config['pay_only'] = $this->amazonHelper->isPayOnly($quote);\n+ $config['paynow_payload'] = $payNowButtonPayload;\n+ $config['paynow_signature'] = $this->amazonAdapter->signButton($payNowButtonPayload);\n}\n+ }\n+ $result[] = $config;\nreturn $result;\n}\n@@ -781,4 +825,89 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\nreturn $amazonSession['statusDetails']['reasonDescription'];\n}\n+\n+ /**\n+ * @param mixed $buyerToken\n+ * @return mixed\n+ */\n+ public function signIn($buyerToken)\n+ {\n+ $result = [];\n+\n+ if (!$this->amazonConfig->isLwaEnabled()) {\n+ $result = [\n+ 'success' => false,\n+ 'message' => __('Amazon Sign-in is disabled')\n+ ];\n+\n+ return [$result];\n+ }\n+\n+ try {\n+ $buyerInfo = $this->amazonAdapter->getBuyer($buyerToken);\n+ $amazonCustomer = $this->getAmazonCustomer($buyerInfo);\n+\n+ if ($amazonCustomer) {\n+ $customer = $this->processAmazonCustomer($amazonCustomer);\n+ if ($customer) {\n+ $customerToken = $this->tokenModelFactory->create()->createCustomerToken($customer->getId())->getToken();\n+ $result = [\n+ 'success' => true,\n+ 'customer_id' => $customer->getId(),\n+ 'customer_email' => $customer->getEmail(),\n+ 'customer_firstname' => $customer->getFirstName(),\n+ 'customer_last' => $customer->getLastName(),\n+ 'customer_bearer_token' => $customerToken\n+ ];\n+\n+ } else {\n+ //TODO: Customer is already in the database but with no Amazon Id.\n+ }\n+\n+ } else {\n+ $this->logger->error('Amazon buyerId is empty. Token: ' . $buyerToken);\n+ $result = [\n+ 'success' => false,\n+ 'message' => __('Amazon buyerId is empty')\n+ ];\n+ }\n+\n+ } catch (\\Exception $e) {\n+ $this->logger->error('Error processing Amazon Login: ' . $e->getMessage());\n+ $result = [\n+ 'success' => false,\n+ 'message' => __($e->getMessage())\n+ ];\n+ }\n+\n+ return [$result];\n+ }\n+\n+ protected function processAmazonCustomer(AmazonCustomerInterface $amazonCustomer)\n+ {\n+ $customerData = $this->matcher->match($amazonCustomer);\n+\n+ if (null === $customerData) {\n+ return $this->customerHelper->createCustomer($amazonCustomer);\n+ }\n+\n+ if ($amazonCustomer->getId() != $customerData->getExtensionAttributes()->getAmazonId()) {\n+\n+ //TODO: Not sure what to do here. This is the case when there is already a customer with the same registered email.\n+ // We can't redirect him to enter his password.\n+ /*if (! $this->session->isLoggedIn()) {\n+ return new ValidationCredentials($customerData->getId(), $amazonCustomer->getId());\n+ }\n+ $this->customerLinkManagement->updateLink($customerData->getId(), $amazonCustomer->getId());*/\n+\n+ return false;\n+ }\n+\n+ return $customerData;\n+ }\n+\n+ protected function getAmazonCustomer($buyerInfo)\n+ {\n+ return $this->customerHelper->getAmazonCustomer($buyerInfo);\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "etc/adminhtml/system.xml",
"new_path": "etc/adminhtml/system.xml",
"diff": "<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 initiating the transaction. Do not use a leading slash.]]></comment>\n<config_path>payment/amazon_payment_v2/checkout_result_return_url</config_path>\n</field>\n+ <field id=\"sign_in_result_url\" translate=\"label comment\" type=\"text\" sortOrder=\"20\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n+ <label>Sign In result URL Path</label>\n+ <comment><![CDATA[<strong>Amazon Pay Sign In 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 Sign In process.]]></comment>\n+ <config_path>payment/amazon_payment_v2/sign_in_result_url</config_path>\n+ </field>\n<field id=\"checkout_result_url\" translate=\"label comment\" type=\"text\" sortOrder=\"21\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>Magento 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 />Magento will redirect to this URL after completing the checkout session. Do not use a leading slash.]]></comment>\n"
},
{
"change_type": "MODIFY",
"old_path": "etc/config.xml",
"new_path": "etc/config.xml",
"diff": "<checkout_review_url>checkout</checkout_review_url>\n<checkout_result_return_url>amazon_pay/checkout/completeSession</checkout_result_return_url>\n<checkout_result_url>checkout/onepage/success</checkout_result_url>\n+ <sign_in_result_url>amazon_pay/login/authorize/</sign_in_result_url>\n<can_use_internal>0</can_use_internal>\n</amazon_payment_v2>\n</payment>\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/signin/:buyerToken\" method=\"GET\">\n+ <service class=\"Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\" method=\"signIn\"/>\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-801: Added SigIn endpoint |
21,266 | 29.10.2021 16:07:10 | 14,400 | 217ce4534420b1cc1468c1a1552ea75c3c3e138f | Add customer link endpoint for PWA merchants to handle Amazon sign-ins with existing store accounts | [
{
"change_type": "MODIFY",
"old_path": "Api/CheckoutSessionManagementInterface.php",
"new_path": "Api/CheckoutSessionManagementInterface.php",
"diff": "@@ -63,4 +63,11 @@ interface CheckoutSessionManagementInterface\n* @return mixed\n*/\npublic function signIn($buyerToken);\n+\n+ /**\n+ * @param mixed $buyerToken\n+ * @param string $password\n+ * @return mixed\n+ */\n+ public function setCustomerLink($buyerToken, $password);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Helper/Customer.php",
"new_path": "Helper/Customer.php",
"diff": "*/\nnamespace Amazon\\Pay\\Helper;\n+\nuse Amazon\\Pay\\Api\\Data\\AmazonCustomerInterface;\nuse Zend_Validate;\n@@ -52,7 +53,6 @@ class Customer\n\\Amazon\\Pay\\Domain\\AmazonCustomerFactory $amazonCustomerFactory,\n\\Amazon\\Pay\\Api\\CustomerLinkManagementInterface $customerLinkManagement,\n\\Amazon\\Pay\\Model\\AmazonConfig $amazonConfig\n-\n) {\n$this->amazonAdapter = $amazonAdapter;\n$this->amazonCustomerFactory = $amazonCustomerFactory;\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -31,6 +31,9 @@ use Magento\\Quote\\Api\\Data\\CartInterface;\nuse Magento\\Framework\\Validator\\Exception as ValidatorException;\nuse Magento\\Framework\\Webapi\\Exception as WebapiException;\nuse Magento\\Sales\\Api\\OrderRepositoryInterface;\n+use Magento\\Customer\\Api\\CustomerRepositoryInterface;\n+use Magento\\Customer\\Model\\CustomerRegistry;\n+use Magento\\Framework\\Encryption\\Encryptor;\nuse Magento\\Sales\\Model\\Order\\Invoice;\nuse Magento\\Sales\\Model\\Order\\Payment;\nuse Magento\\Quote\\Model\\MaskedQuoteIdToQuoteIdInterface;\n@@ -38,7 +41,6 @@ use Magento\\Sales\\Api\\Data\\TransactionInterface as Transaction;\nuse Magento\\Integration\\Model\\Oauth\\TokenFactory as TokenModelFactory;\nuse Magento\\Authorization\\Model\\UserContextInterface as UserContext;\n-\nclass CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\n{\n/**\n@@ -66,6 +68,21 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n*/\nprivate $orderRepository;\n+ /**\n+ * @var \\Magento\\Customer\\Api\\CustomerRepositoryInterface\n+ */\n+ private $customerRepository;\n+\n+ /**\n+ * @var CustomerRegistry\n+ */\n+ private $customerRegistry;\n+\n+ /**\n+ * @var Encryptor\n+ */\n+ private $encryptor;\n+\n/**\n* @var \\Magento\\Sales\\Api\\OrderPaymentRepositoryInterface\n*/\n@@ -186,6 +203,9 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n* @param \\Magento\\Quote\\Api\\CartManagementInterface $cartManagement\n* @param \\Magento\\Quote\\Api\\CartRepositoryInterface $cartRepository\n* @param \\Magento\\Sales\\Api\\OrderRepositoryInterface $orderRepository\n+ * @param \\Magento\\Customer\\Api\\CustomerRepositoryInterface $customerRepository\n+ * @param \\Magento\\Customer\\Model\\CustomerRegistry $customerRegistry\n+ * @param \\Magento\\Framework\\Encryption\\Encryptor $encryptor\n* @param \\Magento\\Sales\\Api\\OrderPaymentRepositoryInterface $paymentRepository\n* @param \\Magento\\Framework\\Validator\\Factory $validatorFactory ,\n* @param \\Magento\\Directory\\Model\\ResourceModel\\Country\\CollectionFactory $countryCollectionFactory ,\n@@ -213,6 +233,9 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n\\Magento\\Quote\\Api\\CartManagementInterface $cartManagement,\n\\Magento\\Quote\\Api\\CartRepositoryInterface $cartRepository,\n\\Magento\\Sales\\Api\\OrderRepositoryInterface $orderRepository,\n+ \\Magento\\Customer\\Api\\CustomerRepositoryInterface $customerRepository,\n+ \\Magento\\Customer\\Model\\CustomerRegistry $customerRegistry,\n+ \\Magento\\Framework\\Encryption\\Encryptor $encryptor,\n\\Magento\\Sales\\Api\\OrderPaymentRepositoryInterface $paymentRepository,\n\\Magento\\Framework\\Validator\\Factory $validatorFactory,\n\\Magento\\Directory\\Model\\ResourceModel\\Country\\CollectionFactory $countryCollectionFactory,\n@@ -239,6 +262,9 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$this->cartManagement = $cartManagement;\n$this->cartRepository = $cartRepository;\n$this->orderRepository = $orderRepository;\n+ $this->customerRepository = $customerRepository;\n+ $this->customerRegistry = $customerRegistry;\n+ $this->encryptor = $encryptor;\n$this->paymentRepository = $paymentRepository;\n$this->validatorFactory = $validatorFactory;\n$this->countryCollectionFactory = $countryCollectionFactory;\n@@ -849,8 +875,12 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\nif ($amazonCustomer) {\n$customer = $this->processAmazonCustomer($amazonCustomer);\n- if ($customer) {\n- $customerToken = $this->tokenModelFactory->create()->createCustomerToken($customer->getId())->getToken();\n+ if ($customer && $customer instanceof \\Magento\\Customer\\Model\\Data\\Customer) {\n+ $customerToken = $this\n+ ->tokenModelFactory\n+ ->create()\n+ ->createCustomerToken($customer->getId())\n+ ->getToken();\n$result = [\n'success' => true,\n'customer_id' => $customer->getId(),\n@@ -861,23 +891,21 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n];\n} else {\n- //TODO: Customer is already in the database but with no Amazon Id.\n- }\n-\n- } else {\n- $this->logger->error('Amazon buyerId is empty. Token: ' . $buyerToken);\n+ // Magento customer exists with same email used for Sign in with Amazon\n$result = [\n'success' => false,\n- 'message' => __('Amazon buyerId is empty')\n+ 'customer_email' => $customer->getEmail(),\n+ 'message' => __('A shop account for this email address already exists. Please enter your ' .\n+ 'shop accounts password to log in without leaving the shop.')\n];\n}\n+ } else {\n+ $result = $this->getBuyerIdError($buyerToken);\n+ }\n+\n} catch (\\Exception $e) {\n- $this->logger->error('Error processing Amazon Login: ' . $e->getMessage());\n- $result = [\n- 'success' => false,\n- 'message' => __($e->getMessage())\n- ];\n+ $result = $this->getLoginError($e);\n}\nreturn [$result];\n@@ -892,15 +920,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n}\nif ($amazonCustomer->getId() != $customerData->getExtensionAttributes()->getAmazonId()) {\n-\n- //TODO: Not sure what to do here. This is the case when there is already a customer with the same registered email.\n- // We can't redirect him to enter his password.\n- /*if (! $this->session->isLoggedIn()) {\n- return new ValidationCredentials($customerData->getId(), $amazonCustomer->getId());\n- }\n- $this->customerLinkManagement->updateLink($customerData->getId(), $amazonCustomer->getId());*/\n-\n- return false;\n+ return $amazonCustomer;\n}\nreturn $customerData;\n@@ -910,4 +930,59 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n{\nreturn $this->customerHelper->getAmazonCustomer($buyerInfo);\n}\n+\n+ protected function getBuyerIdError($buyerToken)\n+ {\n+ $this->logger->error('Amazon buyerId is empty. Token: ' . $buyerToken);\n+ return [\n+ 'success' => false,\n+ 'message' => __('Amazon buyerId is empty')\n+ ];\n+ }\n+\n+ protected function getLoginError($e)\n+ {\n+ $this->logger->error('Error processing Amazon Login: ' . $e->getMessage());\n+ return [\n+ 'success' => false,\n+ 'message' => __($e->getMessage())\n+ ];\n+ }\n+\n+ /**\n+ * @param mixed $buyerToken\n+ * @param string $password\n+ * @return mixed\n+ */\n+ public function setCustomerLink($buyerToken, $password)\n+ {\n+ try {\n+ $buyerInfo = $this->amazonAdapter->getBuyer($buyerToken);\n+ $amazonCustomer = $this->getAmazonCustomer($buyerInfo);\n+\n+ if ($amazonCustomer) {\n+ $magentoCustomer = $this->customerRepository->get($amazonCustomer->getEmail());\n+ $customerSecure = $this->customerRegistry->retrieveSecureData($magentoCustomer->getId());\n+ $hash = $customerSecure->getPasswordHash() ?? '';\n+\n+ if ($this->encryptor->validateHash($password, $hash)) {\n+ $this->customerHelper->updateCustomerLink($magentoCustomer->getId(), $amazonCustomer->getId());\n+ return $this->signIn($buyerToken);\n+ } else {\n+ return [\n+ [\n+ 'success' => false,\n+ 'message' => __('The password supplied was incorrect')\n+ ]\n+ ];\n+ }\n+ } else {\n+ $result = $this->getBuyerIdError($buyerToken);\n+ }\n+ } catch (\\Exception $e) {\n+ $result = $this->getLoginError($e);\n+ }\n+\n+ return [$result];\n+ }\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/setcustomerlink\" method=\"POST\">\n+ <service class=\"Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\" method=\"setCustomerLink\"/>\n+ <resources>\n+ <resource ref=\"anonymous\" />\n+ </resources>\n+ </route>\n</routes>\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Add customer link endpoint for PWA merchants to handle Amazon sign-ins with existing store accounts |
21,241 | 02.12.2021 17:56:33 | 21,600 | ee9d812de8ef70311d0731ce706fe188e75710a4 | remove variable initialization | [
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -417,7 +417,6 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\npublic function getConfig($cartId = null)\n{\n$result = [];\n- $config = [];\n$loginButtonPayload = $this->amazonAdapter->generateLoginButtonPayload();\n$checkoutButtonPayload = $this->amazonAdapter->generateCheckoutButtonPayload();\n$config = [\n@@ -858,8 +857,6 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n*/\npublic function signIn($buyerToken)\n{\n- $result = [];\n-\nif (!$this->amazonConfig->isLwaEnabled()) {\n$result = [\n'success' => false,\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-801 - remove variable initialization |
21,272 | 13.01.2022 10:57:37 | 10,800 | 4794d56738acc9c855c0359352eced6a447015e8 | Check if getDefaultStoreView() returned a Store before building IPN URL | [
{
"change_type": "MODIFY",
"old_path": "Block/Adminhtml/System/Config/Form/IpnUrl.php",
"new_path": "Block/Adminhtml/System/Config/Form/IpnUrl.php",
"diff": "@@ -32,11 +32,13 @@ class IpnUrl extends \\Magento\\Config\\Block\\System\\Config\\Form\\Field\n$store = $this->_storeManager->getDefaultStoreView();\n$valueReturn = '';\n+ if ($store) {\n$baseUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_WEB, true);\nif ($baseUrl) {\n$value = $baseUrl . 'amazon_pay/payment/ipn/';\n$valueReturn = \"<div>\".$this->escapeHtml($value).\"</div>\";\n}\n+ }\n$html = '<td class=\"value\">';\n$html .= $valueReturn;\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Check if getDefaultStoreView() returned a Store before building IPN URL |
21,266 | 18.01.2022 13:57:19 | 18,000 | 83f1b9d9c1a7bd613c8f02c70d1b3a1a06f1f746 | Add informational message to blocked IPN URL | [
{
"change_type": "MODIFY",
"old_path": "Block/Adminhtml/System/Config/Form/IpnUrl.php",
"new_path": "Block/Adminhtml/System/Config/Form/IpnUrl.php",
"diff": "@@ -38,11 +38,14 @@ class IpnUrl extends \\Magento\\Config\\Block\\System\\Config\\Form\\Field\n$value = $baseUrl . 'amazon_pay/payment/ipn/';\n$valueReturn = \"<div>\".$this->escapeHtml($value).\"</div>\";\n}\n+ } else {\n+ $valueReturn = 'You do not have permission to view this setting. The IPN URL is managed\n+ from the Default Store View.';\n}\n$html = '<td class=\"value\">';\n$html .= $valueReturn;\n- if ($element->getComment()) {\n+ if ($element->getComment() && $store) {\n$html .= '<p class=\"note\"><span>' . $element->getComment() . '</span></p>';\n}\n$html .= '</td>';\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-855 - Add informational message to blocked IPN URL |
21,241 | 19.01.2022 18:20:44 | 21,600 | 5ce23c08745a2b766f36f7b42b4de5e7d754ef2d | update method call that moved to session helper | [
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -419,7 +419,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n'public_key_id' => $this->amazonConfig->getPublicKeyId(),\n];\n- $quote = $this->getQuoteFromIdOrSession($cartId);\n+ $quote = $this->session->getQuoteFromIdOrSession($cartId);\nif ($quote) {\n// Ensure the totals are up to date, in case the checkout does something to update qty or shipping without\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-801 - update method call that moved to session helper |
21,241 | 19.01.2022 20:56:21 | 21,600 | 18628b00733cafdc32aeb9e4d0144a9bfbe13879 | Version bump to 5.10.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.9.1\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.10.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.9.1\",\n+ \"version\": \"5.10.0\",\n\"license\": [\n\"Apache-2.0\"\n],\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Version bump to 5.10.0 and update changelog |
21,266 | 20.01.2022 07:51:53 | 18,000 | cde12025cf5bbed7be66a3a3d6e11a1828dfb975 | Check current scope for private key to determine 'selected' value | [
{
"change_type": "MODIFY",
"old_path": "Model/Config/Form/PrivateKeySelected.php",
"new_path": "Model/Config/Form/PrivateKeySelected.php",
"diff": "@@ -32,8 +32,14 @@ class PrivateKeySelected extends \\Magento\\Config\\Block\\System\\Config\\Form\\Field\n*/\nprotected function _getElementHtml(\\Magento\\Framework\\Data\\Form\\Element\\AbstractElement $element)\n{\n+ $storeId = $this->getRequest()->getParam('store');\n+\nif (empty($element->getValue()) &&\n- $this->_scopeConfig->getValue('payment/amazon_payment_v2/private_key')\n+ $this->_scopeConfig->getValue(\n+ 'payment/amazon_payment_v2/private_key',\n+ \\Magento\\Store\\Model\\ScopeInterface::SCOPE_STORE,\n+ $storeId\n+ )\n) {\n$element->setValue(self::TEXT_VALUE);\n}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-857 - Check current scope for private key to determine 'selected' value |
21,241 | 20.01.2022 09:44:09 | 21,600 | 95591b32f7f230c88813c1d09ef96419332913ce | phpcs fixes in test helper | [
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/Helper/SecureSignInWorkaround.php",
"new_path": "Test/Mftf-24/Helper/SecureSignInWorkaround.php",
"diff": "@@ -15,9 +15,12 @@ class SecureSignInWorkaround extends Helper\n$magentoWebDriver = $this->getModule('\\Magento\\FunctionalTestingFramework\\Module\\MagentoWebDriver');\ntry {\n- $magentoWebDriver->executeInSelenium(function (RemoteWebDriver $remoteWebDriver) use ($openerName, $editAddress, $magentoWebDriver) {\n+ $magentoWebDriver->executeInSelenium(\n+ function (RemoteWebDriver $remoteWebDriver) use ($openerName, $editAddress, $magentoWebDriver) {\n// Do nothing here unless the new 'Continue as...' button is present\n- $continueAs = $remoteWebDriver->findElements(WebDriverBy::cssSelector('#maxo_buy_now input[type=submit]'));\n+ $continueAs = $remoteWebDriver->findElements(\n+ WebDriverBy::cssSelector('#maxo_buy_now input[type=submit]')\n+ );\nif (!empty($continueAs)) {\n// Click Continue as... button and return to checkout\n@@ -27,16 +30,21 @@ class SecureSignInWorkaround extends Helper\n// Wait for Edit button in address details\n$editAddressSelector = WebDriverBy::cssSelector($editAddress);\n- $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::elementToBeClickable($editAddressSelector));\n+ $remoteWebDriver\n+ ->wait(30, 100)\n+ ->until(WebDriverExpectedCondition::elementToBeClickable($editAddressSelector));\n// Click Edit button to return to normal flow\n$remoteWebDriver->findElement($editAddressSelector)->click();\n- $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::numberOfWindowsToBe(2));\n+ $remoteWebDriver\n+ ->wait(30, 100)\n+ ->until(WebDriverExpectedCondition::numberOfWindowsToBe(2));\n$magentoWebDriver->switchToNextTab();\n}\n- });\n+ }\n+ );\n} catch (\\Exception $e) {\n- print($e->getMessage());\n+ print_r($e->getMessage());\n}\n}\n}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | phpcs fixes in test helper |
21,266 | 01.02.2022 13:37:14 | 18,000 | 9e835f683e8c780c009d52d0c8d2f13acf0fddfc | Wait for email field to render before attempting to populate | [
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/js/view/checkout-address.js",
"new_path": "view/frontend/web/js/view/checkout-address.js",
"diff": "@@ -13,6 +13,7 @@ define(\n'Magento_Checkout/js/checkout-data',\n'Magento_Checkout/js/model/checkout-data-resolver',\n'Magento_Checkout/js/model/step-navigator',\n+ 'Magento_Checkout/js/view/form/element/email',\n'uiRegistry',\n'Amazon_Pay/js/action/checkout-session-address-load',\n'Amazon_Pay/js/model/shipping-address/form-address-state',\n@@ -30,6 +31,7 @@ define(\ncheckoutData,\ncheckoutDataResolver,\nstepNavigator,\n+ emailComponent,\nregistry,\ncheckoutSessionAddressLoad,\nshippingFormAddressState,\n@@ -100,7 +102,17 @@ define(\n* @param email\n*/\nsetEmail: function(email) {\n+ if (emailComponent.call().hasRendered()) {\n$('#customer-email').val(email).trigger('change');\n+ } else {\n+ emailComponent.call().hasRendered.subscribe(function (rendered) {\n+ if (rendered) {\n+ $('#customer-email').val(email).trigger('change');\n+ this.dispose();\n+ }\n+ });\n+ }\n+\ncheckoutData.setInputFieldEmailValue(email);\ncheckoutData.setValidatedEmailValue(email);\nquote.guestEmail = email;\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+ 'ko',\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 ($, customerData, quote, checkoutData, amazonStorage) {\n+], function ($, ko, customerData, quote, checkoutData, amazonStorage) {\n'use strict';\nreturn function(Component) {\n@@ -18,6 +19,7 @@ define([\nemail: checkoutData.getInputFieldEmailValue(),\ntemplate: 'Amazon_Pay/form/element/email'\n},\n+ hasRendered: ko.observable(false),\n/**\n* Init email validator\n@@ -35,6 +37,11 @@ define([\n}\nreturn this;\n+ },\n+\n+ emailHasChanged: function() {\n+ this._super();\n+ this.hasRendered(true);\n}\n});\n}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-829 - Wait for email field to render before attempting to populate |
21,241 | 07.02.2022 12:22:08 | 21,600 | b58a6b57c64d2df4a98d23940a6c0b1a52afffae | conditionally use phpseclib3 if it is available to generate keys | [
{
"change_type": "MODIFY",
"old_path": "Model/Config/AutoKeyExchange.php",
"new_path": "Model/Config/AutoKeyExchange.php",
"diff": "@@ -22,7 +22,6 @@ use Amazon\\Pay\\Model\\AmazonConfig;\nuse Magento\\Framework\\App\\State;\nuse Magento\\Framework\\App\\Cache\\Type\\Config as CacheTypeConfig;\nuse Magento\\Backend\\Model\\UrlInterface;\n-use phpseclib3\\Crypt\\RSA;\nclass AutoKeyExchange\n{\n@@ -272,11 +271,22 @@ class AutoKeyExchange\n*/\npublic function generateKeys()\n{\n- $keys = RSA::createKey(2048);\n- $encrypt = $this->encryptor->encrypt($keys->__toString());\n+ // Magento 2.4.4 switches to phpseclib3, use that if it exists\n+ if (class_exists(\\phpseclib3\\Crypt\\RSA::class, false)) {\n+ $keypair = \\phpseclib3\\Crypt\\RSA::createKey(2048);\n+ $keys = [\n+ \"publickey\" => $keypair->getPublicKey()->__toString(),\n+ \"privatekey\" => $keypair->__toString()\n+ ];\n+ } else {\n+ $rsa = new \\phpseclib\\Crypt\\RSA();\n+ $keys = $rsa->createKey(2048);\n+ }\n+\n+ $encrypt = $this->encryptor->encrypt($keys['privatekey']);\n$this->config\n- ->saveConfig(self::CONFIG_XML_PATH_PUBLIC_KEY, $keys->getPublicKey()->__toString(), 'default', 0)\n+ ->saveConfig(self::CONFIG_XML_PATH_PUBLIC_KEY, $keys['publickey'], 'default', 0)\n->saveConfig(self::CONFIG_XML_PATH_PRIVATE_KEY, $encrypt, 'default', 0);\n$this->cacheManager->clean([CacheTypeConfig::TYPE_IDENTIFIER]);\n@@ -324,7 +334,7 @@ class AutoKeyExchange\n// Generate key pair\nif (!$publickey || $reset || strlen($publickey) < 300) {\n$keys = $this->generateKeys();\n- $publickey = $keys->getPublicKey()->__toString();\n+ $publickey = $keys['publickey'];\n}\nif (!$pemformat) {\n"
},
{
"change_type": "MODIFY",
"old_path": "composer.json",
"new_path": "composer.json",
"diff": "\"magento/module-directory\": \"^100.0\",\n\"magento/module-media-storage\": \"^100.0\",\n\"magento/module-paypal\": \"^100.0||^101.0\",\n- \"phpseclib/phpseclib\": \"~3.0\",\n+ \"phpseclib/phpseclib\": \"~2.0||~3.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-840 - conditionally use phpseclib3 if it is available to generate keys |
21,266 | 16.02.2022 16:02:10 | 18,000 | 716577a91bc68887c59c536fd98f2fc59793f9b9 | Relax validation for environment-specific keys | [
{
"change_type": "MODIFY",
"old_path": "view/adminhtml/web/js/validation-mixin.js",
"new_path": "view/adminhtml/web/js/validation-mixin.js",
"diff": "@@ -51,9 +51,10 @@ define(['jquery'], function ($) {\n$.validator.addMethod(\n'validate-amzn-public-key-id',\nfunction (v) {\n- return (/^[0-9A-Z]{24}$/).test(v);\n+ return (/^((SANDBOX-)?|(LIVE-)?)[0-9A-Z]{24}$/).test(v);\n},\n- $.mage.__('Public Key ID field is invalid. It must contain 24 characters. Please check and try again')\n+ $.mage.__('Public Key ID field is invalid. It must contain 24 characters, possibly prefixed with ' +\n+ '\\'SANDBOX-\\' or \\'LIVE-\\'. Please check and try again')\n),\n$.validator.addMethod(\n'validate-amzn-store-id',\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Relax validation for environment-specific keys |
21,241 | 22.02.2022 17:24:51 | 21,600 | 5b5e63ea400a916a94b3c472709a3f2bb814f42b | handle difference in how 2.4.4 reference rendered child jquery widgets | [
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/js/amazon-product-add.js",
"new_path": "view/frontend/web/js/amazon-product-add.js",
"diff": "@@ -51,7 +51,12 @@ define([\n//only trigger the amazon button click if the user has chosen to add to cart via this method\nif (addedViaAmazon) {\naddedViaAmazon = false;\n- $('#PayWithAmazon-Product').data('amazonAmazonButton').click();\n+ var button = $('#PayWithAmazon-Product').data('amazon-AmazonButton');\n+ if (undefined === button) {\n+ // 2.4.3-p1 and lower have different data key for the button\n+ button = $('#PayWithAmazon-Product').data('amazonAmazonButton');\n+ }\n+ button.click();\n}\n}, this);\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-864 - handle difference in how 2.4.4 reference rendered child jquery widgets |
21,241 | 24.02.2022 09:45:52 | 21,600 | 0b44a6d0186f562fed59b6d1d7bbb02aa3962dd6 | Version bumps for 5.10.1 and update changelog | [
{
"change_type": "MODIFY",
"old_path": "CHANGELOG.md",
"new_path": "CHANGELOG.md",
"diff": "# Change Log\n+## 5.10.1\n+* Added compatibility with Adobe Commerce / Magento Open Source 2.4.4\n+* Fixed an issue with email population\n+* Updated validation on Private Key field to allow SANDBOX- or LIVE- prefixes (thanks @cmorrisonmvnt!)\n+\n## 5.10.0\n* Added signin REST endpoint\n* Fixed an issue that could occur when rendering the Amazon Pay button more than once\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.10.0\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.10.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.10.0\",\n+ \"version\": \"5.10.1\",\n\"license\": [\n\"Apache-2.0\"\n],\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Version bumps for 5.10.1 and update changelog |
21,241 | 03.03.2022 09:48:44 | 21,600 | 0469fd2414dfaac32b6d499c101cac05360df583 | invoke autoloader when detecting which phpseclib to use | [
{
"change_type": "MODIFY",
"old_path": "Model/Config/AutoKeyExchange.php",
"new_path": "Model/Config/AutoKeyExchange.php",
"diff": "@@ -272,7 +272,7 @@ class AutoKeyExchange\npublic function generateKeys()\n{\n// Magento 2.4.4 switches to phpseclib3, use that if it exists\n- if (class_exists(\\phpseclib3\\Crypt\\RSA::class, false)) {\n+ if (class_exists(\\phpseclib3\\Crypt\\RSA::class, true)) {\n$keypair = \\phpseclib3\\Crypt\\RSA::createKey(2048);\n$keys = [\n\"publickey\" => $keypair->getPublicKey()->__toString(),\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-840 - invoke autoloader when detecting which phpseclib to use |
21,241 | 03.03.2022 10:15:38 | 21,600 | de0ec07ebb341182c1770c7fea3568f6f1b3c7ce | Version bump to 5.11.1 | [
{
"change_type": "MODIFY",
"old_path": "CHANGELOG.md",
"new_path": "CHANGELOG.md",
"diff": "# Change Log\n+## 5.11.1\n+* Fixed an issue where autoloader is needed to detect version of phpseclib used\n+\n## 5.11.0\n* Added compatibility with Adobe Commerce / Magento Open Source 2.4.4\n* Fixed an issue with email population\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.11.0\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.11.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.11.0\",\n+ \"version\": \"5.11.1\",\n\"license\": [\n\"Apache-2.0\"\n],\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Version bump to 5.11.1 |
21,248 | 10.03.2022 01:03:21 | 0 | f2d91c9f611b0610d420058c526b9bb3738aea64 | Initial GraphQl additions, POST methods/mutations | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "Model/Resolver/CompleteCheckoutSession.php",
"diff": "+<?php\n+\n+namespace Amazon\\Pay\\Model\\Resolver;\n+\n+use Amazon\\Pay\\Model\\CheckoutSessionManagement;\n+use Magento\\Framework\\GraphQl\\Config\\Element\\Field;\n+use Magento\\Framework\\GraphQl\\Exception\\GraphQlInputException;\n+use Magento\\Framework\\GraphQl\\Query\\Resolver\\ContextInterface;\n+use Magento\\Framework\\GraphQl\\Query\\Resolver\\Value;\n+use Magento\\Framework\\GraphQl\\Query\\ResolverInterface;\n+use Magento\\Framework\\GraphQl\\Schema\\Type\\ResolveInfo;\n+\n+class CompleteCheckoutSession implements ResolverInterface\n+{\n+\n+ /**\n+ * @var CheckoutSessionManagement\n+ */\n+ private $checkoutSessionManagementModel;\n+\n+ /**\n+ * @param CheckoutSessionManagement $checkoutSessionManagementModel\n+ */\n+ public function __construct(\n+ CheckoutSessionManagement $checkoutSessionManagementModel\n+ ){\n+ $this->checkoutSessionManagementModel = $checkoutSessionManagementModel;\n+ }\n+\n+ /**\n+ * @param Field $field\n+ * @param $context\n+ * @param ResolveInfo $info\n+ * @param array|null $value\n+ * @param array|null $args\n+ * @return array|false[]|int|Value|mixed\n+ * @throws GraphQlInputException\n+ */\n+ public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)\n+ {\n+ $cartId = $args['cartId'] ?? false;\n+ $checkoutSessionId = $args['checkoutSessionId'] ?? false;\n+\n+ if (!$cartId) {\n+ throw new GraphQlInputException(__('Required parameter \"cartId\" is missing'));\n+ }\n+\n+ if (!$checkoutSessionId) {\n+ throw new GraphQlInputException(__('Required parameter \"checkoutSessionId\" is missing'));\n+ }\n+\n+ try {\n+ return $this->checkoutSessionManagementModel->completeCheckoutSession($checkoutSessionId, $cartId);\n+ } catch (\\Exception $e) {\n+ return [\n+ 'message' => $e->getMessage(),\n+ 'success' => false\n+ ];\n+ }\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Model/Resolver/SetCustomerLink.php",
"diff": "+<?php\n+\n+namespace Amazon\\Pay\\Model\\Resolver;\n+\n+use Amazon\\Pay\\Model\\CheckoutSessionManagement;\n+use Magento\\Framework\\GraphQl\\Config\\Element\\Field;\n+use Magento\\Framework\\GraphQl\\Exception\\GraphQlInputException;\n+use Magento\\Framework\\GraphQl\\Query\\Resolver\\Value;\n+use Magento\\Framework\\GraphQl\\Query\\ResolverInterface;\n+use Magento\\Framework\\GraphQl\\Schema\\Type\\ResolveInfo;\n+\n+class SetCustomerLink implements ResolverInterface\n+{\n+\n+ /**\n+ * @var CheckoutSessionManagement\n+ */\n+ private $checkoutSessionManagementModel;\n+\n+ /**\n+ * @param CheckoutSessionManagement $checkoutSessionManagementModel\n+ */\n+ public function __construct(\n+ CheckoutSessionManagement $checkoutSessionManagementModel\n+ ){\n+ $this->checkoutSessionManagementModel = $checkoutSessionManagementModel;\n+ }\n+\n+ /**\n+ * @param Field $field\n+ * @param $context\n+ * @param ResolveInfo $info\n+ * @param array|null $value\n+ * @param array|null $args\n+ * @return array[]|Value|mixed\n+ * @throws GraphQlInputException\n+ */\n+ public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)\n+ {\n+ $buyerToken = $args['buyerToken'] ?? false;\n+ $password = $args['password'] ?? false;\n+\n+ if (!$buyerToken) {\n+ throw new GraphQlInputException(__('Required parameter \"buyerToken\" is missing'));\n+ }\n+\n+ if (!$password) {\n+ throw new GraphQlInputException(__('Required parameter \"password\" is missing'));\n+ }\n+\n+ return array_merge(...$this->checkoutSessionManagementModel->setCustomerLink($buyerToken, $password));\n+\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Model/Resolver/UpdateCheckoutSession.php",
"diff": "+<?php\n+\n+namespace Amazon\\Pay\\Model\\Resolver;\n+\n+use Amazon\\Pay\\Model\\CheckoutSessionManagement;\n+use Magento\\Framework\\GraphQl\\Config\\Element\\Field;\n+use Magento\\Framework\\GraphQl\\Exception\\GraphQlInputException;\n+use Magento\\Framework\\GraphQl\\Query\\Resolver\\ContextInterface;\n+use Magento\\Framework\\GraphQl\\Query\\Resolver\\Value;\n+use Magento\\Framework\\GraphQl\\Query\\ResolverInterface;\n+use Magento\\Framework\\GraphQl\\Schema\\Type\\ResolveInfo;\n+\n+class UpdateCheckoutSession implements ResolverInterface\n+{\n+\n+ /**\n+ * @var CheckoutSessionManagement\n+ */\n+ private $checkoutSessionManagementModel;\n+\n+ /**\n+ * @param CheckoutSessionManagement $checkoutSessionManagementModel\n+ */\n+ public function __construct(\n+ CheckoutSessionManagement $checkoutSessionManagementModel\n+ ){\n+ $this->checkoutSessionManagementModel = $checkoutSessionManagementModel;\n+ }\n+\n+ /**\n+ * @param Field $field\n+ * @param $context\n+ * @param ResolveInfo $info\n+ * @param array|null $value\n+ * @param array|null $args\n+ * @return array|false[]|int\n+ * @throws GraphQlInputException\n+ */\n+ public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)\n+ {\n+ $cartId = $args['cartId'] ?? false;\n+ $checkoutSessionId = $args['checkoutSessionId'] ?? false;\n+\n+ if (!$cartId) {\n+ throw new GraphQlInputException(__('Required parameter \"cartId\" is missing'));\n+ }\n+\n+ if (!$checkoutSessionId) {\n+ throw new GraphQlInputException(__('Required parameter \"checkoutSessionId\" is missing'));\n+ }\n+\n+ $updateResponse = $this->checkoutSessionManagementModel->updateCheckoutSession($checkoutSessionId, $cartId);\n+\n+ $redirectUrl = $updateResponse['webCheckoutDetails']['amazonPayRedirectUrl'] ?? false;\n+ if ($redirectUrl) {\n+ return [\n+ 'redirectUrl' => $redirectUrl\n+ ];\n+ }\n+\n+ // N/A would likely only be coalesced to if config isn't set. After running through some test cases will\n+ // update fallback messaging to be a bit more specific\n+ return [\n+ 'redirectUrl' => $updateResponse['status'] ?? 'N/A'\n+ ];\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "etc/schema.graphqls",
"diff": "+type Query {\n+}\n+\n+type Mutation {\n+ setCustomerLink(buyerToken: String!, password: String!): SetCustomerLinkOutput\n+ @doc(description:\"Set Customer Link\")\n+ @resolver(class: \"Amazon\\\\Pay\\\\Model\\\\Resolver\\\\SetCustomerLink\")\n+\n+ completeCheckoutSession(cartId: String!, checkoutSessionId: String!): CompleteCheckoutSessionOutput\n+ @doc(description: \"Complete Checkout Session\")\n+ @resolver(class: \"Amazon\\\\Pay\\\\Model\\\\Resolver\\\\CompleteCheckoutSession\")\n+\n+ updateCheckoutSession(cartId: String!, checkoutSessionId: String!): UpdateCheckoutSessionOutput\n+ @doc(description: \"Update Checkout Session\")\n+ @resolver(class: \"Amazon\\\\Pay\\\\Model\\\\Resolver\\\\UpdateCheckoutSession\")\n+\n+}\n+\n+type SetCustomerLinkOutput {\n+ success: Boolean\n+ message: String\n+}\n+\n+type CompleteCheckoutSessionOutput {\n+ success: Boolean\n+ message: String\n+}\n+\n+type UpdateCheckoutSessionOutput {\n+ redirectUrl: String\n+}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | APF-320 - Initial GraphQl additions, POST methods/mutations |
21,248 | 10.03.2022 23:39:38 | 0 | fd548f0b26486d9c76644bd4d39bee41a8b53629 | Finished initial checkout session api endpoint additions for graphql | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "Model/Resolver/CheckoutSessionConfig.php",
"diff": "+<?php\n+\n+namespace Amazon\\Pay\\Model\\Resolver;\n+\n+use Amazon\\Pay\\Model\\CheckoutSessionManagement;\n+use Magento\\Framework\\GraphQl\\Config\\Element\\Field;\n+use Magento\\Framework\\GraphQl\\Query\\Resolver\\ContextInterface;\n+use Magento\\Framework\\GraphQl\\Query\\Resolver\\Value;\n+use Magento\\Framework\\GraphQl\\Query\\ResolverInterface;\n+use Magento\\Framework\\GraphQl\\Schema\\Type\\ResolveInfo;\n+\n+class CheckoutSessionConfig implements ResolverInterface\n+{\n+\n+ /**\n+ * @var CheckoutSessionManagement\n+ */\n+ private $checkoutSessionManagement;\n+\n+ public function __construct(\n+ CheckoutSessionManagement $checkoutSessionManagement\n+ ){\n+ $this->checkoutSessionManagement = $checkoutSessionManagement;\n+ }\n+\n+ /**\n+ * @param Field $field\n+ * @param $context\n+ * @param ResolveInfo $info\n+ * @param array|null $value\n+ * @param array|null $args\n+ * @return array|Value|mixed\n+ */\n+ public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)\n+ {\n+ $cartId = $args['cartId'] ?? null;\n+ return [\n+ 'config' => ($this->checkoutSessionManagement->getConfig($cartId)[0] ?? [])\n+ ];\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Model/Resolver/CheckoutSessionDetails.php",
"diff": "+<?php\n+\n+namespace Amazon\\Pay\\Model\\Resolver;\n+\n+use Amazon\\Pay\\Model\\CheckoutSessionManagement;\n+use Magento\\Framework\\GraphQl\\Config\\Element\\Field;\n+use Magento\\Framework\\GraphQl\\Exception\\GraphQlInputException;\n+use Magento\\Framework\\GraphQl\\Query\\Resolver\\ContextInterface;\n+use Magento\\Framework\\GraphQl\\Query\\Resolver\\Value;\n+use Magento\\Framework\\GraphQl\\Query\\ResolverInterface;\n+use Magento\\Framework\\GraphQl\\Schema\\Type\\ResolveInfo;\n+\n+class CheckoutSessionDetails implements ResolverInterface\n+{\n+\n+ const QUERY_TYPES = ['billing', 'payment', 'shipping'];\n+\n+ /**\n+ * @var CheckoutSessionManagement\n+ */\n+ private $checkoutSessionManagement;\n+\n+ /**\n+ * @param CheckoutSessionManagement $checkoutSessionManagement\n+ */\n+ public function __construct(\n+ CheckoutSessionManagement $checkoutSessionManagement\n+ ){\n+ $this->checkoutSessionManagement = $checkoutSessionManagement;\n+ }\n+\n+ /**\n+ * @param Field $field\n+ * @param $context\n+ * @param ResolveInfo $info\n+ * @param array|null $value\n+ * @param array|null $args\n+ * @return array\n+ * @throws GraphQlInputException\n+ */\n+ public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)\n+ {\n+ $amazonSessionId = $args['amazonSessionId'] ?? false;\n+ $queryTypes = $args['queryTypes'] ?? false;\n+\n+ if (!$amazonSessionId) {\n+ throw new GraphQlInputException(__('Required parameter \"amazonSessionId\" is missing'));\n+ }\n+\n+ if (!$queryTypes) {\n+ throw new GraphQlInputException(__('Required parameter \"queryTypes\" is missing'));\n+ }\n+\n+ $response = [];\n+ foreach ($queryTypes as $queryType) {\n+ $response[$queryType] = $this->getQueryTypesData($amazonSessionId, $queryType) ?: 'Query type: ' .\n+ $queryType . 'is not a supported type. ';\n+ }\n+\n+ return [\n+ 'response' => json_encode($response)\n+ ];\n+ }\n+\n+\n+ /**\n+ * @param $amazonSessionId\n+ * @param $queryType\n+ * @return void\n+ */\n+ private function getQueryTypesData($amazonSessionId, $queryType)\n+ {\n+ $result = false;\n+ if (in_array($queryType, self::QUERY_TYPES, true)) {\n+ switch ($queryType) {\n+ case 'billing':\n+ $result = $this->checkoutSessionManagement->getBillingAddress($amazonSessionId);\n+ break;\n+ case 'payment':\n+ $result = $this->checkoutSessionManagement->getPaymentDescriptor($amazonSessionId);\n+ break;\n+ case 'shipping':\n+ $result = $this->checkoutSessionManagement->getShippingAddress($amazonSessionId);\n+ }\n+ }\n+\n+ return $result;\n+ }\n+\n+\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Model/Resolver/CheckoutSessionSignIn.php",
"diff": "+<?php\n+\n+namespace Amazon\\Pay\\Model\\Resolver;\n+\n+use Amazon\\Pay\\Model\\CheckoutSessionManagement;\n+use Magento\\Framework\\GraphQl\\Config\\Element\\Field;\n+use Magento\\Framework\\GraphQl\\Exception\\GraphQlInputException;\n+use Magento\\Framework\\GraphQl\\Query\\Resolver\\ContextInterface;\n+use Magento\\Framework\\GraphQl\\Query\\Resolver\\Value;\n+use Magento\\Framework\\GraphQl\\Query\\ResolverInterface;\n+use Magento\\Framework\\GraphQl\\Schema\\Type\\ResolveInfo;\n+\n+class CheckoutSessionSignIn implements ResolverInterface\n+{\n+\n+ /**\n+ * @var CheckoutSessionManagement\n+ */\n+ private $checkoutSessionManagement;\n+\n+ /**\n+ * @param CheckoutSessionManagement $checkoutSessionManagement\n+ */\n+ public function __construct(\n+ CheckoutSessionManagement $checkoutSessionManagement\n+ ){\n+ $this->checkoutSessionManagement = $checkoutSessionManagement;\n+ }\n+\n+ /**\n+ * @param Field $field\n+ * @param $context\n+ * @param ResolveInfo $info\n+ * @param array|null $value\n+ * @param array|null $args\n+ * @return array[]\n+ * @throws GraphQlInputException\n+ */\n+ public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)\n+ {\n+ $buyerToken = $args['buyerToken'] ?? false;\n+\n+ if (!$buyerToken) {\n+ throw new GraphQlInputException(__('Required parameter \"buyerToken\" is missing'));\n+ }\n+\n+ return [\n+ 'response' => $this->checkoutSessionManagement->signIn($buyerToken)[0] ?? []\n+ ];\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "etc/schema.graphqls",
"new_path": "etc/schema.graphqls",
"diff": "type Query {\n+ checkoutSessionConfig(cartId: String!): CheckoutSessionConfigOutput\n+ @resolver(class:\"Amazon\\\\Pay\\\\Model\\\\Resolver\\\\CheckoutSessionConfig\")\n+\n+ checkoutSessionDetails(amazonSessionId: String!, queryTypes: [String!]): CheckoutSessionDetailsOutput\n+ @resolver(class:\"Amazon\\\\Pay\\\\Model\\\\Resolver\\\\CheckoutSessionDetails\")\n+\n+ checkoutSessionSignIn(buyerToken: String!): CheckoutSessionSignInOutput\n+ @resolver(class:\"Amazon\\\\Pay\\\\Model\\\\Resolver\\\\CheckoutSessionSignIn\")\n}\ntype Mutation {\n@@ -16,6 +24,18 @@ type Mutation {\n}\n+type CheckoutSessionDetailsOutput {\n+ response: String!\n+}\n+\n+type CheckoutSessionConfigOutput {\n+ config: [String!]\n+}\n+\n+type CheckoutSessionSignInOutput {\n+ response: [String!]\n+}\n+\ntype SetCustomerLinkOutput {\nsuccess: Boolean\nmessage: String\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | APF-320 - Finished initial checkout session api endpoint additions for graphql |
21,248 | 11.03.2022 00:16:31 | 0 | 97fdcd06049e3bfe45ce6bf762b47b3566388e98 | Changed config query to list each potential value returned so that they can be cherry picked instead of returning all by default | [
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/CheckoutSessionConfig.php",
"new_path": "Model/Resolver/CheckoutSessionConfig.php",
"diff": "@@ -34,8 +34,7 @@ class CheckoutSessionConfig implements ResolverInterface\npublic function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)\n{\n$cartId = $args['cartId'] ?? null;\n- return [\n- 'config' => ($this->checkoutSessionManagement->getConfig($cartId)[0] ?? [])\n- ];\n+\n+ return $this->checkoutSessionManagement->getConfig($cartId)[0] ?? [];\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "etc/schema.graphqls",
"new_path": "etc/schema.graphqls",
"diff": "@@ -29,7 +29,16 @@ type CheckoutSessionDetailsOutput {\n}\ntype CheckoutSessionConfigOutput {\n- config: [String!]\n+ merchant_id: String\n+ currency: String\n+ button_color: String\n+ language: String\n+ sandbox: Boolean\n+ login_payload: String\n+ login_signature: String\n+ checkout_payload: String\n+ checkout_signature: String\n+ public_key_id: String\n}\ntype CheckoutSessionSignInOutput {\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | APF-320 - Changed config query to list each potential value returned so that they can be cherry picked instead of returning all by default |
21,266 | 11.03.2022 15:51:51 | 18,000 | 07ec785baea1587aba9da8429ff49025884a17f1 | Fix display regression/hide APB for restricted products | [
{
"change_type": "MODIFY",
"old_path": "Block/Config.php",
"new_path": "Block/Config.php",
"diff": "@@ -62,6 +62,7 @@ class Config extends \\Magento\\Framework\\View\\Element\\Template\n'is_pay_only' => $this->amazonHelper->isPayOnly(),\n'is_lwa_enabled' => $this->isLwaEnabled(),\n'is_guest_checkout_enabled' => $this->amazonConfig->isGuestCheckoutEnabled(),\n+ 'has_restricted_products' => $this->amazonHelper->hasRestrictedProducts()\n];\nreturn $config;\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -404,6 +404,9 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\npublic function getConfig($cartId = null)\n{\n$result = [];\n+ $quote = $this->session->getQuoteFromIdOrSession($cartId);\n+\n+ if ($this->canCheckoutWithAmazon($quote)) {\n$loginButtonPayload = $this->amazonAdapter->generateLoginButtonPayload();\n$checkoutButtonPayload = $this->amazonAdapter->generateCheckoutButtonPayload();\n$config = [\n@@ -419,14 +422,11 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n'public_key_id' => $this->amazonConfig->getPublicKeyId(),\n];\n- $quote = $this->session->getQuoteFromIdOrSession($cartId);\n-\nif ($quote) {\n// Ensure the totals are up to date, in case the checkout does something to update qty or shipping without\n// collecting totals\n$quote->collectTotals();\n- if ($this->canCheckoutWithAmazon($quote)) {\n$payNowButtonPayload = $this->amazonAdapter->generatePayNowButtonPayload(\n$quote,\n$this->amazonConfig->getPaymentAction()\n@@ -436,8 +436,10 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$config['paynow_payload'] = $payNowButtonPayload;\n$config['paynow_signature'] = $this->amazonAdapter->signButton($payNowButtonPayload);\n}\n- }\n+\n$result[] = $config;\n+ }\n+\nreturn $result;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/js/view/payment/amazon-payment-method.js",
"new_path": "view/frontend/web/js/view/payment/amazon-payment-method.js",
"diff": "@@ -13,7 +13,8 @@ define(\n) {\n'use strict';\n- if (amazonStorage.isAmazonCheckout() || amazonConfig.getValue('is_method_available')) {\n+ if ((amazonStorage.isAmazonCheckout() || amazonConfig.getValue('is_method_available'))\n+ && !amazonConfig.getValue('has_restricted_products')) {\nrendererList.push(\n{\ntype: amazonConfig.getCode(),\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-884 - Fix display regression/hide APB for restricted products |
21,266 | 11.03.2022 16:01:01 | 18,000 | b4e57339dc82270c9a6abd501960d839eb19a214 | Remove error logging in MFTF helpers (out of memory issue) | [
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/Helper/AddToCart.php",
"new_path": "Test/Mftf-24/Helper/AddToCart.php",
"diff": "@@ -20,7 +20,8 @@ class AddToCart extends Helper\n$remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::elementToBeClickable($addToCart));\n});\n} catch (\\Exception $e) {\n- print_r($e);\n+ // Avoid out of memory error sometimes caused by print_r\n+ // print_r($e);\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/Helper/SecureSignInWorkaround.php",
"new_path": "Test/Mftf-24/Helper/SecureSignInWorkaround.php",
"diff": "@@ -66,7 +66,8 @@ class SecureSignInWorkaround extends Helper\n}\n});\n} catch (\\Exception $e) {\n- print_r($e->getMessage());\n+ // Avoid out of memory error sometimes caused by print_r\n+ // print_r($e->getMessage());\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/Helper/SignInWithAmazon.php",
"new_path": "Test/Mftf-24/Helper/SignInWithAmazon.php",
"diff": "@@ -25,7 +25,8 @@ class SignInWithAmazon extends Helper\n}\", $waitTime);\n$webDriver->click($siwaLocator);\n} catch (\\Exception $e) {\n- print_r($e);\n+ // Avoid out of memory error sometimes caused by print_r\n+ // print_r($e);\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/Helper/WaitForPopup.php",
"new_path": "Test/Mftf-24/Helper/WaitForPopup.php",
"diff": "@@ -19,7 +19,8 @@ class WaitForPopup extends Helper\n$webdriver->wait(30, 100)->until(WebDriverExpectedCondition::numberOfWindowsToBe(2));\n});\n} catch (\\Exception $e) {\n- print_r($e);\n+ // Avoid out of memory error sometimes caused by print_r\n+ // print_r($e);\n}\n}\n}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Remove error logging in MFTF helpers (out of memory issue) |
21,248 | 11.03.2022 23:17:36 | 0 | 7159f6fb11eb280e0ae3bc677a04a761c24a7f65 | Brought a couple responses back in line with the current endpoints responses | [
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/CheckoutSessionConfig.php",
"new_path": "Model/Resolver/CheckoutSessionConfig.php",
"diff": "@@ -17,6 +17,9 @@ class CheckoutSessionConfig implements ResolverInterface\n*/\nprivate $checkoutSessionManagement;\n+ /**\n+ * @param CheckoutSessionManagement $checkoutSessionManagement\n+ */\npublic function __construct(\nCheckoutSessionManagement $checkoutSessionManagement\n){\n@@ -35,6 +38,8 @@ class CheckoutSessionConfig implements ResolverInterface\n{\n$cartId = $args['cartId'] ?? null;\n- return $this->checkoutSessionManagement->getConfig($cartId)[0] ?? [];\n+ return [\n+ 'config' => ($this->checkoutSessionManagement->getConfig($cartId)[0] ?? [])\n+ ];\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/CheckoutSessionDetails.php",
"new_path": "Model/Resolver/CheckoutSessionDetails.php",
"diff": "@@ -53,8 +53,7 @@ class CheckoutSessionDetails implements ResolverInterface\n$response = [];\nforeach ($queryTypes as $queryType) {\n- $response[$queryType] = $this->getQueryTypesData($amazonSessionId, $queryType) ?: 'Query type: ' .\n- $queryType . 'is not a supported type. ';\n+ $response[$queryType] = $this->getQueryTypesData($amazonSessionId, $queryType) ?: [];\n}\nreturn [\n"
},
{
"change_type": "MODIFY",
"old_path": "etc/schema.graphqls",
"new_path": "etc/schema.graphqls",
"diff": "@@ -29,16 +29,7 @@ type CheckoutSessionDetailsOutput {\n}\ntype CheckoutSessionConfigOutput {\n- merchant_id: String\n- currency: String\n- button_color: String\n- language: String\n- sandbox: Boolean\n- login_payload: String\n- login_signature: String\n- checkout_payload: String\n- checkout_signature: String\n- public_key_id: String\n+ config: [String]\n}\ntype CheckoutSessionSignInOutput {\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | APF-320 - Brought a couple responses back in line with the current endpoints responses |
21,248 | 14.03.2022 22:59:52 | 0 | 17912c2ab7649bffc86363333e76d457ccbbe7ec | Updated to mutation and definition for updateCheckoutSession to more closely resemble rest api. Added fix for completeCheckoutSession response | [
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/CompleteCheckoutSession.php",
"new_path": "Model/Resolver/CompleteCheckoutSession.php",
"diff": "@@ -39,7 +39,7 @@ class CompleteCheckoutSession implements ResolverInterface\npublic function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)\n{\n$cartId = $args['cartId'] ?? false;\n- $checkoutSessionId = $args['checkoutSessionId'] ?? false;\n+ $checkoutSessionId = $args['amazonSessionId'] ?? false;\nif (!$cartId) {\nthrow new GraphQlInputException(__('Required parameter \"cartId\" is missing'));\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/UpdateCheckoutSession.php",
"new_path": "Model/Resolver/UpdateCheckoutSession.php",
"diff": "@@ -39,7 +39,7 @@ class UpdateCheckoutSession implements ResolverInterface\npublic function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)\n{\n$cartId = $args['cartId'] ?? false;\n- $checkoutSessionId = $args['checkoutSessionId'] ?? false;\n+ $checkoutSessionId = $args['amazonSessionId'] ?? false;\nif (!$cartId) {\nthrow new GraphQlInputException(__('Required parameter \"cartId\" is missing'));\n@@ -49,19 +49,10 @@ class UpdateCheckoutSession implements ResolverInterface\nthrow new GraphQlInputException(__('Required parameter \"checkoutSessionId\" is missing'));\n}\n- $updateResponse = $this->checkoutSessionManagementModel->updateCheckoutSession($checkoutSessionId, $cartId);\n-\n- $redirectUrl = $updateResponse['webCheckoutDetails']['amazonPayRedirectUrl'] ?? false;\n- if ($redirectUrl) {\nreturn [\n- 'redirectUrl' => $redirectUrl\n+ 'redirectUrl' => $this->checkoutSessionManagementModel->updateCheckoutSession($checkoutSessionId,\n+ $cartId) ?? 'N/A'\n];\n}\n- // N/A would likely only be coalesced to if config isn't set. After running through some test cases will\n- // update fallback messaging to be a bit more specific\n- return [\n- 'redirectUrl' => $updateResponse['status'] ?? 'N/A'\n- ];\n- }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "etc/schema.graphqls",
"new_path": "etc/schema.graphqls",
"diff": "@@ -14,11 +14,11 @@ type Mutation {\n@doc(description:\"Set Customer Link\")\n@resolver(class: \"Amazon\\\\Pay\\\\Model\\\\Resolver\\\\SetCustomerLink\")\n- completeCheckoutSession(cartId: String!, checkoutSessionId: String!): CompleteCheckoutSessionOutput\n+ completeCheckoutSession(cartId: String!, amazonSessionId: String!): CompleteCheckoutSessionOutput\n@doc(description: \"Complete Checkout Session\")\n@resolver(class: \"Amazon\\\\Pay\\\\Model\\\\Resolver\\\\CompleteCheckoutSession\")\n- updateCheckoutSession(cartId: String!, checkoutSessionId: String!): UpdateCheckoutSessionOutput\n+ updateCheckoutSession(cartId: String!, amazonSessionId: String!): UpdateCheckoutSessionOutput\n@doc(description: \"Update Checkout Session\")\n@resolver(class: \"Amazon\\\\Pay\\\\Model\\\\Resolver\\\\UpdateCheckoutSession\")\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | APF-320 - Updated to mutation and definition for updateCheckoutSession to more closely resemble rest api. Added fix for completeCheckoutSession response |
21,248 | 15.03.2022 19:38:12 | 0 | 495804c853eaee5bd912ef2a4c03b2ef73164c09 | Updated config response to match new kay value pair response of original endpoint | [
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/CheckoutSessionConfig.php",
"new_path": "Model/Resolver/CheckoutSessionConfig.php",
"diff": "@@ -39,7 +39,7 @@ class CheckoutSessionConfig implements ResolverInterface\n$cartId = $args['cartId'] ?? null;\nreturn [\n- 'config' => ($this->checkoutSessionManagement->getConfig($cartId)[0] ?? [])\n+ 'config' => json_encode(($this->checkoutSessionManagement->getConfig($cartId) ?? []))\n];\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "etc/schema.graphqls",
"new_path": "etc/schema.graphqls",
"diff": "type Query {\n- checkoutSessionConfig(cartId: String!): CheckoutSessionConfigOutput\n+ checkoutSessionConfig(cartId: String): CheckoutSessionConfigOutput\n@resolver(class:\"Amazon\\\\Pay\\\\Model\\\\Resolver\\\\CheckoutSessionConfig\")\ncheckoutSessionDetails(amazonSessionId: String!, queryTypes: [String!]): CheckoutSessionDetailsOutput\n@@ -29,7 +29,7 @@ type CheckoutSessionDetailsOutput {\n}\ntype CheckoutSessionConfigOutput {\n- config: [String]\n+ config: String\n}\ntype CheckoutSessionSignInOutput {\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | APF-320 - Updated config response to match new kay value pair response of original endpoint |
21,266 | 21.03.2022 15:20:38 | 14,400 | 1e3c623077c10ec99ff716d581e15de74e85343c | Add MFTF test for products in restricted categories | [
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -423,8 +423,8 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n];\nif ($quote) {\n- // Ensure the totals are up to date, in case the checkout does something to update qty or shipping without\n- // collecting totals\n+ // Ensure the totals are up to date, in case the checkout does something to update qty or shipping\n+ // without collecting totals\n$quote->collectTotals();\n$payNowButtonPayload = $this->amazonAdapter->generatePayNowButtonPayload(\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/Data/AmazonButtonConfigData.xml",
"new_path": "Test/Mftf-23/Data/AmazonButtonConfigData.xml",
"diff": "<entity name=\"AmazonButtonPaymentConfig\">\n<data key=\"path\">payment/amazonlogin/active</data>\n</entity>\n+ <entity name=\"AmazonRestrictedCategoriesConfig\">\n+ <data key=\"path\">payment/amazon_payment_v2/restrict_categories</data>\n+ </entity>\n</entities>\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/Section/AmazonButtonSection.xml",
"new_path": "Test/Mftf-23/Section/AmazonButtonSection.xml",
"diff": "<element name=\"v1Payment\" type=\"button\" selector=\"#PayWithAmazon .amazonpay-button-inner-image\"/>\n<element name=\"product\" type=\"button\" selector=\"#amazon-addtoCart-amazon-pay-button-product\"/>\n<element name=\"miniCart\" type=\"button\" selector=\"#PayWithAmazon-Cart div\"/>\n+ <element name=\"cart\" type=\"button\" selector=\"#PayWithAmazon-Cart div\"/>\n<element name=\"checkout\" type=\"button\" selector=\".amazon-button-container #PayWithAmazon_amazon-pay-button div\"/>\n<element name=\"payment\" type=\"button\" selector=\"#PayWithAmazonButton div\"/>\n</section>\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/Section/AmazonCheckoutSection.xml",
"new_path": "Test/Mftf-23/Section/AmazonCheckoutSection.xml",
"diff": "<element name=\"editShippingButton\" type=\"button\" selector=\"#checkout-step-shipping .shipping-address-item.selected-item .edit-address-link\"/>\n<element name=\"editPaymentButton\" type=\"button\" selector=\"#amazon-payment .action-edit-payment\"/>\n<element name=\"v1Method\" type=\"input\" selector=\"#amazonlogin\"/>\n- <element name=\"method\" type=\"input\" selector=\"#amazon_payment_v2\"/>\n+ <element name=\"method\" type=\"input\" selector=\"#amazon_payment\"/>\n<element name=\"returnToStandardCheckout\" type=\"text\" selector=\"#checkout-step-shipping .revert-checkout\"/>\n</section>\n</sections>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Test/Mftf-23/Test/AmazonRestrictedCategoryTest.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=\"AmazonRestricted\">\n+ <annotations>\n+ <stories value=\"Amazon Pay Restricted Categories\"/>\n+ <title value=\"Amazon Pay button shouldn't appear anywhere for carts containing restricted products\"/>\n+ <description value=\"Amazon Pay button shouldn't appear anywhere for carts containing restricted products\"/>\n+ <severity value=\"CRITICAL\"/>\n+ <group value=\"amazon_pay\"/>\n+ </annotations>\n+\n+ <before>\n+ <createData entity=\"_defaultCategory\" stepKey=\"createCategory\"/>\n+ <createData entity=\"SimpleProduct\" stepKey=\"createProduct\">\n+ <requiredEntity createDataKey=\"createCategory\"/>\n+ </createData>\n+ <magentoCLI command=\"config:set {{AmazonButtonProductConfig.path}} 1\" stepKey=\"displayAmazonButtonProduct\"/>\n+ <magentoCLI command=\"config:set {{AmazonButtonMiniCartConfig.path}} 1\" stepKey=\"displayAmazonButtonMiniCart\"/>\n+ <magentoCLI command=\"config:set {{AmazonButtonPaymentConfig.path}} 1\" stepKey=\"displayAmazonButtonPayment\"/>\n+ <magentoCLI command=\"config:set {{AmazonRestrictedCategoriesConfig.path}} $$createCategory.id$$\" stepKey=\"setRestrictedCategory\"/>\n+ <magentoCLI command=\"cache:flush\" stepKey=\"flushCache\"/>\n+ </before>\n+\n+ <after>\n+ <deleteData createDataKey=\"createProduct\" stepKey=\"deleteProduct\"/>\n+ <deleteData createDataKey=\"createCategory\" stepKey=\"deleteCategory\"/>\n+ <magentoCLI command=\"config:set {{AmazonRestrictedCategoriesConfig.path}} ''\" stepKey=\"setRestrictedCategory\"/>\n+ <magentoCLI command=\"cache:flush\" stepKey=\"flushCache\"/>\n+ </after>\n+\n+ <actionGroup ref=\"StorefrontOpenProductPageActionGroup\" stepKey=\"openProductStoreFront\">\n+ <argument name=\"productUrl\" value=\"$$createProduct.custom_attributes[url_key]$$\"/>\n+ </actionGroup>\n+\n+ <!-- don't see AP button on PDP -->\n+ <dontSeeElement selector=\"{{AmazonButtonSection.product}}\" stepKey=\"dontSeeHiddenPdpButton\"/>\n+\n+ <!-- don't see AP button in minicart -->\n+ <actionGroup ref=\"StorefrontAddToTheCartActionGroup\" stepKey=\"clickOnAddToCartButton\"/>\n+ <actionGroup ref=\"StorefrontClickOnMiniCartActionGroup\" stepKey=\"clickOnMiniCart\"/>\n+ <wait time=\"2\" stepKey=\"waitForButtonToActivate\"/>\n+ <dontSeeElement selector=\"{{AmazonButtonSection.miniCart}}\" stepKey=\"dontSeeHiddenMiniCartButton\"/>\n+\n+ <!-- don't see AP button in cart -->\n+ <actionGroup ref=\"StorefrontOpenCartPageActionGroup\" stepKey=\"openCartPage\"/>\n+ <dontSeeElement selector=\"{{AmazonButtonSection.cart}}\" stepKey=\"dontSeeHiddenCartButton\"/>\n+\n+ <!-- don't see express checkout -->\n+ <actionGroup ref=\"StorefrontOpenCheckoutPageActionGroup\" stepKey=\"openCheckoutPage\"/>\n+ <dontSeeElement selector=\"{{AmazonButtonSection.checkout}}\" stepKey=\"dontSeeHiddenExpressCheckoutButton\"/>\n+\n+ <!-- don't see payment method -->\n+ <actionGroup ref=\"AmazonShipmentFormActionGroup\" stepKey=\"guestCheckoutFillingShipping\"/>\n+ <dontSeeElement selector=\"{{AmazonCheckoutSection.method}}\" stepKey=\"dontSeeHiddenPaymentMethod\"/>\n+ </test>\n+</tests>\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/Data/AmazonButtonConfigData.xml",
"new_path": "Test/Mftf-24/Data/AmazonButtonConfigData.xml",
"diff": "<entity name=\"AmazonButtonPaymentConfig\">\n<data key=\"path\">payment/amazonlogin/active</data>\n</entity>\n+ <entity name=\"AmazonRestrictedCategoriesConfig\">\n+ <data key=\"path\">payment/amazon_payment_v2/restrict_categories</data>\n+ </entity>\n</entities>\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/Section/AmazonButtonSection.xml",
"new_path": "Test/Mftf-24/Section/AmazonButtonSection.xml",
"diff": "<element name=\"v1Payment\" type=\"button\" selector=\"#PayWithAmazon .amazonpay-button-inner-image\"/>\n<element name=\"product\" type=\"button\" selector=\"#amazon-addtoCart-amazon-pay-button-product\"/>\n<element name=\"miniCart\" type=\"button\" selector=\"#PayWithAmazon-Cart div\"/>\n+ <element name=\"cart\" type=\"button\" selector=\"#PayWithAmazon-Cart div\"/>\n<element name=\"checkout\" type=\"button\" selector=\".amazon-button-container #PayWithAmazon_amazon-pay-button div\"/>\n<element name=\"payment\" type=\"button\" selector=\"#PayWithAmazonButton div\"/>\n</section>\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/Section/AmazonCheckoutSection.xml",
"new_path": "Test/Mftf-24/Section/AmazonCheckoutSection.xml",
"diff": "<element name=\"editShippingButton\" type=\"button\" selector=\"#checkout-step-shipping .shipping-address-item.selected-item .edit-address-link\"/>\n<element name=\"editPaymentButton\" type=\"button\" selector=\"#amazon-payment .action-edit-payment\"/>\n<element name=\"v1Method\" type=\"input\" selector=\"#amazonlogin\"/>\n- <element name=\"method\" type=\"input\" selector=\"#amazon_payment_v2\"/>\n+ <element name=\"method\" type=\"input\" selector=\"#amazon_payment\"/>\n<element name=\"returnToStandardCheckout\" type=\"text\" selector=\"#checkout-step-shipping .revert-checkout\"/>\n</section>\n</sections>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Test/Mftf-24/Test/AmazonRestrictedCategoryTest.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=\"AmazonRestricted\">\n+ <annotations>\n+ <stories value=\"Amazon Pay Restricted Categories\"/>\n+ <title value=\"Amazon Pay button shouldn't appear anywhere for carts containing restricted products\"/>\n+ <description value=\"Amazon Pay button shouldn't appear anywhere for carts containing restricted products\"/>\n+ <severity value=\"CRITICAL\"/>\n+ <group value=\"amazon_pay\"/>\n+ </annotations>\n+\n+ <before>\n+ <createData entity=\"_defaultCategory\" stepKey=\"createCategory\"/>\n+ <createData entity=\"SimpleProduct\" stepKey=\"createProduct\">\n+ <requiredEntity createDataKey=\"createCategory\"/>\n+ </createData>\n+ <magentoCLI command=\"config:set {{AmazonButtonProductConfig.path}} 1\" stepKey=\"displayAmazonButtonProduct\"/>\n+ <magentoCLI command=\"config:set {{AmazonButtonMiniCartConfig.path}} 1\" stepKey=\"displayAmazonButtonMiniCart\"/>\n+ <magentoCLI command=\"config:set {{AmazonButtonPaymentConfig.path}} 1\" stepKey=\"displayAmazonButtonPayment\"/>\n+ <magentoCLI command=\"config:set {{AmazonRestrictedCategoriesConfig.path}} $$createCategory.id$$\" stepKey=\"setRestrictedCategory\"/>\n+ <magentoCLI command=\"cache:flush\" stepKey=\"flushCache\"/>\n+ </before>\n+\n+ <after>\n+ <deleteData createDataKey=\"createProduct\" stepKey=\"deleteProduct\"/>\n+ <deleteData createDataKey=\"createCategory\" stepKey=\"deleteCategory\"/>\n+ <magentoCLI command=\"config:set {{AmazonRestrictedCategoriesConfig.path}} ''\" stepKey=\"setRestrictedCategory\"/>\n+ <magentoCLI command=\"cache:flush\" stepKey=\"flushCache\"/>\n+ </after>\n+\n+ <actionGroup ref=\"StorefrontOpenProductPageActionGroup\" stepKey=\"openProductStoreFront\">\n+ <argument name=\"productUrl\" value=\"$$createProduct.custom_attributes[url_key]$$\"/>\n+ </actionGroup>\n+\n+ <!-- don't see AP button on PDP -->\n+ <dontSeeElement selector=\"{{AmazonButtonSection.product}}\" stepKey=\"dontSeeHiddenPdpButton\"/>\n+\n+ <!-- don't see AP button in minicart -->\n+ <actionGroup ref=\"StorefrontAddToTheCartActionGroup\" stepKey=\"clickOnAddToCartButton\"/>\n+ <actionGroup ref=\"StorefrontClickOnMiniCartActionGroup\" stepKey=\"clickOnMiniCart\"/>\n+ <wait time=\"2\" stepKey=\"waitForButtonToActivate\"/>\n+ <dontSeeElement selector=\"{{AmazonButtonSection.miniCart}}\" stepKey=\"dontSeeHiddenMiniCartButton\"/>\n+\n+ <!-- don't see AP button in cart -->\n+ <actionGroup ref=\"StorefrontCartPageOpenActionGroup\" stepKey=\"openCartPage\"/>\n+ <dontSeeElement selector=\"{{AmazonButtonSection.cart}}\" stepKey=\"dontSeeHiddenCartButton\"/>\n+\n+ <!-- don't see express checkout -->\n+ <actionGroup ref=\"StorefrontOpenCheckoutPageActionGroup\" stepKey=\"openCheckoutPage\"/>\n+ <dontSeeElement selector=\"{{AmazonButtonSection.checkout}}\" stepKey=\"dontSeeHiddenExpressCheckoutButton\"/>\n+\n+ <!-- don't see payment method -->\n+ <actionGroup ref=\"AmazonShipmentFormActionGroup\" stepKey=\"guestCheckoutFillingShipping\"/>\n+ <dontSeeElement selector=\"{{AmazonCheckoutSection.method}}\" stepKey=\"dontSeeHiddenPaymentMethod\"/>\n+ </test>\n+</tests>\n+\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-884 - Add MFTF test for products in restricted categories |
21,274 | 21.03.2022 14:39:12 | -3,600 | 5c6d0c30ba8b5a00d17638f5f82801785146cdfb | fix: Fix visibility of billing address form | [
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/template/billing-address.html",
"new_path": "view/frontend/web/template/billing-address.html",
"diff": "<div if=\"isAddressLoaded\" id=\"amazon-billing-address\" class=\"checkout-billing-address\">\n<render args=\"detailsTemplate\"/>\n- <fieldset class=\"fieldset\" data-bind=\"visible: isAddressFormVisible()\">\n+ <fieldset class=\"fieldset\" data-bind=\"visible: !isAddressDetailsVisible()\">\n+ <div data-bind=\"fadeVisible: isAddressFormVisible\">\n<render args=\"formTemplate\"/>\n+ </div>\n<render args=\"actionsTemplate\"/>\n</fieldset>\n</div>\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | fix: Fix visibility of billing address form |
21,266 | 30.03.2022 09:57:55 | 14,400 | c5748a57ec2507f7c076c82f0e12a9b3308fea26 | Add scopes to checkoutButtonPayloads, display billing address details
for all regions, associated MFTF test | [
{
"change_type": "MODIFY",
"old_path": "Model/Adapter/AmazonPayAdapter.php",
"new_path": "Model/Adapter/AmazonPayAdapter.php",
"diff": "@@ -531,6 +531,7 @@ class AmazonPayAdapter\n'checkoutCancelUrl' => $this->getCancelUrl(),\n],\n'storeId' => $this->amazonConfig->getClientId(),\n+ 'scopes' => ['name', 'email', 'phoneNumber', 'billingAddress'],\n];\nif ($deliverySpecs = $this->amazonConfig->getDeliverySpecifications()) {\n@@ -553,7 +554,7 @@ class AmazonPayAdapter\n'checkoutCancelUrl' => $this->getCancelUrl(),\n],\n'storeId' => $this->amazonConfig->getClientId(),\n-\n+ 'scopes' => ['name', 'email', 'phoneNumber', 'billingAddress'],\n'paymentDetails' => [\n'paymentIntent' => $paymentIntent,\n'canHandlePendingAuthorization' => $this->amazonConfig->canHandlePendingAuthorization(),\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-23/Section/AmazonCheckoutSection.xml",
"new_path": "Test/Mftf-23/Section/AmazonCheckoutSection.xml",
"diff": "<sections xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/sectionObjectSchema.xsd\">\n<section name=\"AmazonCheckoutSection\">\n<element name=\"shippingAddress\" type=\"text\" selector=\"#checkout-step-shipping .shipping-address-item.selected-item\"/>\n+ <element name=\"billingAddress\" type=\"text\" selector=\"#amazon-billing-address\"/>\n<element name=\"countryNameByCode\" type=\"text\" selector=\"select[name=country_id] option[value={{country_code}}]\" parameterized=\"true\"/>\n<element name=\"editShippingButton\" type=\"button\" selector=\"#checkout-step-shipping .shipping-address-item.selected-item .edit-address-link\"/>\n<element name=\"editPaymentButton\" type=\"button\" selector=\"#amazon-payment .action-edit-payment\"/>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Test/Mftf-23/Test/AmazonBillingFormVisibilityTest.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=\"AmazonBillingAddressVisibility\">\n+ <annotations>\n+ <stories value=\"Amazon Billing Address Visibility\"/>\n+ <title value=\"Amazon Billing Address Visibility\"/>\n+ <description value=\"User should be presented the billing address details/form in any region\"/>\n+ <severity value=\"CRITICAL\"/>\n+ <group value=\"amazon_pay\"/>\n+ </annotations>\n+\n+ <before>\n+ <createData entity=\"SimpleTwo\" stepKey=\"createSimpleProduct\"/>\n+ <createData entity=\"SampleAmazonPaymentConfig\" stepKey=\"SampleAmazonPaymentConfigData\"/>\n+ <magentoCLI command=\"cache:flush\" stepKey=\"flushCache\"/>\n+ </before>\n+\n+ <after>\n+ <deleteData createDataKey=\"createSimpleProduct\" stepKey=\"deleteSimpleProduct\"/>\n+ <magentoCLI command=\"cache:flush\" stepKey=\"flushCache\"/>\n+ </after>\n+\n+ <!-- Go to new product page and add it to cart -->\n+ <actionGroup ref=\"StorefrontOpenProductPageActionGroup\" stepKey=\"openProductStoreFront\">\n+ <argument name=\"productUrl\" value=\"$$createSimpleProduct.custom_attributes[url_key]$$\"/>\n+ </actionGroup>\n+ <actionGroup ref=\"StorefrontAddProductToCartActionGroup\" stepKey=\"addToCart\">\n+ <argument name=\"product\" value=\"$$createSimpleProduct$$\"/>\n+ <argument name=\"productCount\" value=\"1\"/>\n+ </actionGroup>\n+\n+ <!-- Open minicart and login with Amazon -->\n+ <actionGroup ref=\"StorefrontClickOnMiniCartActionGroup\" stepKey=\"clickOnMiniCart\"/>\n+ <seeElement selector=\"{{AmazonButtonSection.miniCart}}\" stepKey=\"seeEnabledAmazonButton\"/>\n+ <actionGroup ref=\"AmazonLoginAndCheckoutActionGroup\" stepKey=\"AmazonLoginAndCheckoutActionGroup\">\n+ <argument name=\"buttonSelector\" value=\"{{AmazonButtonSection.miniCart}}\"/>\n+ </actionGroup>\n+\n+ <!-- Move to payments page and verify visibility of billing address -->\n+ <click selector=\"{{CheckoutShippingSection.next}}\" stepKey=\"clickCheckoutShippingNext\"/>\n+ <seeElement selector=\"{{AmazonCheckoutSection.billingAddress}}\" stepKey=\"seeBillingAddress\"/>\n+ </test>\n+</tests>\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/Section/AmazonCheckoutSection.xml",
"new_path": "Test/Mftf-24/Section/AmazonCheckoutSection.xml",
"diff": "<sections xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:mftf:Test/etc/sectionObjectSchema.xsd\">\n<section name=\"AmazonCheckoutSection\">\n<element name=\"shippingAddress\" type=\"text\" selector=\"#checkout-step-shipping .shipping-address-item.selected-item\"/>\n+ <element name=\"billingAddress\" type=\"text\" selector=\"#amazon-billing-address\"/>\n<element name=\"countryNameByCode\" type=\"text\" selector=\"select[name=country_id] option[value={{country_code}}]\" parameterized=\"true\"/>\n<element name=\"editShippingButton\" type=\"button\" selector=\"#checkout-step-shipping .shipping-address-item.selected-item .edit-address-link\"/>\n<element name=\"editPaymentButton\" type=\"button\" selector=\"#amazon-payment .action-edit-payment\"/>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Test/Mftf-24/Test/AmazonBillingFormVisibilityTest.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=\"AmazonBillingAddressVisibility\">\n+ <annotations>\n+ <stories value=\"Amazon Billing Address Visibility\"/>\n+ <title value=\"Amazon Billing Address Visibility\"/>\n+ <description value=\"User should be presented the billing address details/form in any region\"/>\n+ <severity value=\"CRITICAL\"/>\n+ <group value=\"amazon_pay\"/>\n+ </annotations>\n+\n+ <before>\n+ <createData entity=\"SimpleTwo\" stepKey=\"createSimpleProduct\"/>\n+ <createData entity=\"SampleAmazonPaymentConfig\" stepKey=\"SampleAmazonPaymentConfigData\"/>\n+ <magentoCLI command=\"cache:flush\" stepKey=\"flushCache\"/>\n+ </before>\n+\n+ <after>\n+ <deleteData createDataKey=\"createSimpleProduct\" stepKey=\"deleteSimpleProduct\"/>\n+ <magentoCLI command=\"cache:flush\" stepKey=\"flushCache\"/>\n+ </after>\n+\n+ <!-- Go to new product page and add it to cart -->\n+ <actionGroup ref=\"StorefrontOpenProductPageActionGroup\" stepKey=\"openProductStoreFront\">\n+ <argument name=\"productUrl\" value=\"$$createSimpleProduct.custom_attributes[url_key]$$\"/>\n+ </actionGroup>\n+ <actionGroup ref=\"StorefrontAddProductToCartActionGroup\" stepKey=\"addToCart\">\n+ <argument name=\"product\" value=\"$$createSimpleProduct$$\"/>\n+ <argument name=\"productCount\" value=\"1\"/>\n+ </actionGroup>\n+\n+ <!-- Open minicart and login with Amazon -->\n+ <actionGroup ref=\"StorefrontClickOnMiniCartActionGroup\" stepKey=\"clickOnMiniCart\"/>\n+ <seeElement selector=\"{{AmazonButtonSection.miniCart}}\" stepKey=\"seeEnabledAmazonButton\"/>\n+ <actionGroup ref=\"AmazonLoginAndCheckoutActionGroup\" stepKey=\"AmazonLoginAndCheckoutActionGroup\">\n+ <argument name=\"buttonSelector\" value=\"{{AmazonButtonSection.miniCart}}\"/>\n+ </actionGroup>\n+\n+ <!-- Move to payments page and verify visibility of billing address -->\n+ <click selector=\"{{CheckoutShippingSection.next}}\" stepKey=\"clickCheckoutShippingNext\"/>\n+ <seeElement selector=\"{{AmazonCheckoutSection.billingAddress}}\" stepKey=\"seeBillingAddress\"/>\n+ </test>\n+</tests>\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Add scopes to checkoutButtonPayloads, display billing address details
for all regions, associated MFTF test |
21,248 | 30.03.2022 23:24:32 | 0 | 5ac050fc3f3f3eb7439df95094ef1063d9b6b783 | Removed composer.json reference to phpunit dependency and removed the single inclusion in the module which was also unused | [
{
"change_type": "MODIFY",
"old_path": "Helper/Session.php",
"new_path": "Helper/Session.php",
"diff": "@@ -28,7 +28,6 @@ use Magento\\Quote\\Api\\CartManagementInterface;\nuse Magento\\Quote\\Api\\CartRepositoryInterface;\nuse Magento\\Quote\\Api\\Data\\CartInterface;\nuse Magento\\Quote\\Model\\MaskedQuoteIdToQuoteIdInterface;\n-use function PHPUnit\\Framework\\returnArgument;\nclass Session\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "composer.json",
"new_path": "composer.json",
"diff": "\"amzn/amazon-payments-magento-2-plugin\": \"*\"\n},\n\"require-dev\": {\n- \"guzzlehttp/guzzle\": \"^6.2.0\",\n- \"phpunit/phpunit\": \"4.1.0\"\n+ \"guzzlehttp/guzzle\": \"^6.2.0\"\n},\n\"require\": {\n\"php\": \"~7.0.13||~7.1.0||~7.2.0||~7.3.0||~7.4.0||~8.0.0||~8.1.0\",\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-894 - Removed composer.json reference to phpunit dependency and removed the single inclusion in the module which was also unused |
21,248 | 31.03.2022 18:54:55 | 0 | 674439f76cb85db30ebcbb8cb0707a925b297fdb | Updated setCustomerLink output to properly encapsulate the potential data | [
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/SetCustomerLink.php",
"new_path": "Model/Resolver/SetCustomerLink.php",
"diff": "@@ -48,7 +48,9 @@ class SetCustomerLink implements ResolverInterface\nthrow new GraphQlInputException(__('Required parameter \"password\" is missing'));\n}\n- return array_merge(...$this->checkoutSessionManagementModel->setCustomerLink($buyerToken, $password));\n+ return [\n+ 'response' => array_merge(...$this->checkoutSessionManagementModel->setCustomerLink($buyerToken, $password))\n+ ];\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "etc/schema.graphqls",
"new_path": "etc/schema.graphqls",
"diff": "@@ -37,8 +37,7 @@ type CheckoutSessionSignInOutput {\n}\ntype SetCustomerLinkOutput {\n- success: Boolean\n- message: String\n+ response: [String!]\n}\ntype CompleteCheckoutSessionOutput {\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | APF-320 - Updated setCustomerLink output to properly encapsulate the potential data |
21,248 | 31.03.2022 19:15:04 | 0 | 5a19a2e01352f4fc214fd69ab4b4df31bfbf1a34 | Encoded string to preserve keys in the general response | [
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/SetCustomerLink.php",
"new_path": "Model/Resolver/SetCustomerLink.php",
"diff": "@@ -49,7 +49,7 @@ class SetCustomerLink implements ResolverInterface\n}\nreturn [\n- 'response' => array_merge(...$this->checkoutSessionManagementModel->setCustomerLink($buyerToken, $password))\n+ 'response' => json_encode(array_merge(...$this->checkoutSessionManagementModel->setCustomerLink($buyerToken, $password)))\n];\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "etc/schema.graphqls",
"new_path": "etc/schema.graphqls",
"diff": "@@ -37,7 +37,7 @@ type CheckoutSessionSignInOutput {\n}\ntype SetCustomerLinkOutput {\n- response: [String!]\n+ response: String\n}\ntype CompleteCheckoutSessionOutput {\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | APF-320 - Encoded string to preserve keys in the general response |
21,266 | 01.04.2022 11:51:58 | 14,400 | ed02cd2305f93fddcb08effab9e550c9f0a4c245 | Exclude orders with Canceled status when checking
canSubmitQuote in completeCheckoutSession | [
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -336,7 +336,8 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$orderCollection = $this->orderCollectionFactory->create()\n->addFieldToSelect('increment_id')\n- ->addFieldToFilter('quote_id', ['eq' => $quote->getId()]);\n+ ->addFieldToFilter('quote_id', ['eq' => $quote->getId()])\n+ ->addFieldToFilter('status', ['neq' => \\Magento\\Sales\\Model\\Order::STATE_CANCELED]);\nreturn ($orderCollection->count() == 0);\n}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-896 - Exclude orders with Canceled status when checking
canSubmitQuote in completeCheckoutSession |
21,248 | 01.04.2022 18:20:32 | 0 | ef4a88b78975ca013e77402defceabdb5e79aef8 | Updated output data to be more graphql intuitive | [
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/CheckoutSessionConfig.php",
"new_path": "Model/Resolver/CheckoutSessionConfig.php",
"diff": "@@ -38,8 +38,6 @@ class CheckoutSessionConfig implements ResolverInterface\n{\n$cartId = $args['cartId'] ?? null;\n- return [\n- 'config' => json_encode(($this->checkoutSessionManagement->getConfig($cartId) ?? []))\n- ];\n+ return array_merge(...$this->checkoutSessionManagement->getConfig($cartId));\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/CheckoutSessionSignIn.php",
"new_path": "Model/Resolver/CheckoutSessionSignIn.php",
"diff": "@@ -44,8 +44,6 @@ class CheckoutSessionSignIn implements ResolverInterface\nthrow new GraphQlInputException(__('Required parameter \"buyerToken\" is missing'));\n}\n- return [\n- 'response' => $this->checkoutSessionManagement->signIn($buyerToken)[0] ?? []\n- ];\n+ return array_merge(...$this->checkoutSessionManagement->signIn($buyerToken));\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/SetCustomerLink.php",
"new_path": "Model/Resolver/SetCustomerLink.php",
"diff": "@@ -48,9 +48,7 @@ class SetCustomerLink implements ResolverInterface\nthrow new GraphQlInputException(__('Required parameter \"password\" is missing'));\n}\n- return [\n- 'response' => json_encode(array_merge(...$this->checkoutSessionManagementModel->setCustomerLink($buyerToken, $password)))\n- ];\n+ return array_merge(...$this->checkoutSessionManagementModel->setCustomerLink($buyerToken, $password));\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "etc/schema.graphqls",
"new_path": "etc/schema.graphqls",
"diff": "@@ -29,21 +29,45 @@ type CheckoutSessionDetailsOutput {\n}\ntype CheckoutSessionConfigOutput {\n- config: String\n+ button_color: String\n+ checkout_payload: String\n+ checkout_signature: String\n+ currency: String\n+ sandbox: String\n+ language: String\n+ login_payload: String\n+ login_signature: String\n+ merchant_id: String\n+ pay_only: String\n+ paynow_payload: String\n+ paynow_signature: String\n+ public_key_id: String\n}\ntype CheckoutSessionSignInOutput {\n- response: [String!]\n+ customer_id: String\n+ customer_email: String\n+ customer_firstname: String\n+ customer_last: String\n+ customer_bearer_token: String\n+ message: String\n+ success: Boolean\n}\ntype SetCustomerLinkOutput {\n- response: String\n+ customer_id: String\n+ customer_email: String\n+ customer_firstname: String\n+ customer_last: String\n+ customer_bearer_token: String\n+ message: String\n+ success: Boolean\n}\ntype CompleteCheckoutSessionOutput {\n- success: Boolean\n- message: String\nincrement_id: String\n+ message: String\n+ success: Boolean\n}\ntype UpdateCheckoutSessionOutput {\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | APF-320 - Updated output data to be more graphql intuitive |
21,248 | 01.04.2022 18:44:01 | 0 | 3cb675a24b2341a578f29d9a3358b6c7bcf61902 | Updated return value types to accurately reflect the true data types | [
{
"change_type": "MODIFY",
"old_path": "etc/schema.graphqls",
"new_path": "etc/schema.graphqls",
"diff": "@@ -33,12 +33,12 @@ type CheckoutSessionConfigOutput {\ncheckout_payload: String\ncheckout_signature: String\ncurrency: String\n- sandbox: String\n+ sandbox: Boolean\nlanguage: String\nlogin_payload: String\nlogin_signature: String\nmerchant_id: String\n- pay_only: String\n+ pay_only: Boolean\npaynow_payload: String\npaynow_signature: String\npublic_key_id: String\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | APF-320 - Updated return value types to accurately reflect the true data types |
21,248 | 01.04.2022 21:16:49 | 0 | 5e038dcd95ed9eb4828e7316e2e1bc9d38a634ac | Few more corrections/updates to various admin strings and translations | [
{
"change_type": "MODIFY",
"old_path": "view/adminhtml/templates/system/config/autokeyexchange_admin.phtml",
"new_path": "view/adminhtml/templates/system/config/autokeyexchange_admin.phtml",
"diff": "<div id=\"autokeyexchange-hint\">\n<?= $block->escapeHtml(\n__(\n- \"You'll be connecting/registering a US account based on your display currency of your store scope. For more information, see Amazon Pay for Magento 2.\"\n+ \"You'll be connecting/registering a %1 account based on your display currency of your store scope. For more information, see Amazon Pay for Magento 2.\",\n+ $block->getRegion()\n)\n); ?>\n<span class=\"note\">\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-674 - Few more corrections/updates to various admin strings and translations |
21,266 | 05.04.2022 13:32:29 | 14,400 | 2d32f12551db7410b2bd795be2eb33fa06c2a46b | Remove self-closing tags in templates due to jQuery upgrade in 2.4.4 | [
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/template/billing-address.html",
"new_path": "view/frontend/web/template/billing-address.html",
"diff": "<div if=\"isAddressLoaded\" id=\"amazon-billing-address\" class=\"checkout-billing-address\">\n- <render args=\"detailsTemplate\"/>\n+ <render args=\"detailsTemplate\"></render>\n<fieldset class=\"fieldset\" data-bind=\"visible: isAddressFormVisible()\">\n- <render args=\"formTemplate\"/>\n- <render args=\"actionsTemplate\"/>\n+ <render args=\"formTemplate\"></render>\n+ <render args=\"actionsTemplate\"></render>\n</fieldset>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/template/billing-address/actions.html",
"new_path": "view/frontend/web/template/billing-address/actions.html",
"diff": "<button class=\"action action-update\"\ntype=\"button\"\nclick=\"updateAddress\">\n- <span translate=\"'Update'\"/>\n+ <span translate=\"'Update'\"></span>\n</button>\n<button class=\"action action-cancel\"\ntype=\"button\"\nclick=\"cancelAddressEdit\"\nvisible=\"canUseCancelBillingAddress()\">\n- <span translate=\"'Cancel'\"/>\n+ <span translate=\"'Cancel'\"></span>\n</button>\n</div>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/template/billing-address/details.html",
"new_path": "view/frontend/web/template/billing-address/details.html",
"diff": "<div if=\"isAddressDetailsVisible() && currentBillingAddress()\">\n<p data-bind=\"i18n: 'Billing address associated with this payment method:'\"></p>\n<p class=\"billing-address-details\">\n- <text args=\"currentBillingAddress().prefix\"/> <text args=\"currentBillingAddress().firstname\"/> <text args=\"currentBillingAddress().middlename\"/>\n- <text args=\"currentBillingAddress().lastname\"/> <text args=\"currentBillingAddress().suffix\"/><br/>\n- <text args=\"_.values(currentBillingAddress().street).join(', ')\"/><br/>\n- <text args=\"currentBillingAddress().city \"/>, <span text=\"currentBillingAddress().region\"></span> <text args=\"currentBillingAddress().postcode\"/><br/>\n- <text args=\"getCountryName(currentBillingAddress().countryId)\"/><br/>\n+ <text args=\"currentBillingAddress().prefix\"></text> <text args=\"currentBillingAddress().firstname\"></text> <text args=\"currentBillingAddress().middlename\"></text>\n+ <text args=\"currentBillingAddress().lastname\"></text> <text args=\"currentBillingAddress().suffix\"></text><br/>\n+ <text args=\"_.values(currentBillingAddress().street).join(', ')\"></text><br/>\n+ <text args=\"currentBillingAddress().city \"></text>, <span text=\"currentBillingAddress().region\"></span> <text args=\"currentBillingAddress().postcode\"></text><br/>\n+ <text args=\"getCountryName(currentBillingAddress().countryId)\"></text><br/>\n<!-- ko if: currentBillingAddress().telephone -->\n<a attr=\"'href': 'tel:' + currentBillingAddress().telephone\" text=\"currentBillingAddress().telephone\"></a><br/>\n<!-- /ko -->\n<each args=\"data: currentBillingAddress().customAttributes, as: 'element'\">\n- <text args=\"$parent.getCustomAttributeLabel(element)\"/>\n+ <text args=\"$parent.getCustomAttributeLabel(element)\"></text>\n<br/>\n</each>\n</p>\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": "mageInit: {'mage/trim-input':{}}\"\nname=\"username\"\ndata-validate=\"{required:true, 'validate-email':true}\"\n- id=\"customer-email\" />\n+ id=\"customer-email\"></input>\n<!-- ko template: 'ui/form/element/helper/tooltip' --><!-- /ko -->\n<span class=\"note\" data-bind=\"fadeVisible: isPasswordVisible() == false\"><!-- ko i18n: 'You can create an account after checkout.'--><!-- /ko --></span>\n</div>\ntype=\"password\"\nname=\"password\"\nid=\"customer-password\"\n- data-validate=\"{required:true}\" autocomplete=\"off\"/>\n+ data-validate=\"{required:true}\" autocomplete=\"off\"></input>\n<span class=\"note\" data-bind=\"i18n: 'You already have an account with us. Sign in or continue as guest.'\"></span>\n</div>\n<!-- ko template: getTemplate() --><!-- /ko -->\n<!-- /ko -->\n<div class=\"actions-toolbar\">\n- <input name=\"context\" type=\"hidden\" value=\"checkout\" />\n+ <input name=\"context\" type=\"hidden\" value=\"checkout\"></input>\n<div class=\"primary\">\n<button type=\"submit\" class=\"action login primary\" data-action=\"checkout-method-login\"><span data-bind=\"i18n: 'Login'\"></span></button>\n</div>\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": "<input type=\"radio\"\nname=\"payment[method]\"\nclass=\"radio\"\n- data-bind=\"attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()\"/>\n+ data-bind=\"attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()\"></input>\n<label data-bind=\"attr: {'for': getCode()}\" class=\"label\">\n<img alt=\"Amazon Pay\" data-bind=\"attr: { src: getLogoUrl() } \"/>\n</label>\n- <span data-bind=\"text: paymentDescriptor\"/>\n+ <span data-bind=\"text: paymentDescriptor\"></span>\n</div>\n<div class=\"payment-method-content\">\n<!-- ko foreach: getRegion('messages') -->\n<!--/ko-->\n</div>\n</div>\n-\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Remove self-closing tags in templates due to jQuery upgrade in 2.4.4 |
21,241 | 06.04.2022 17:23:39 | 18,000 | f7eb2a7e999e6047f09e7d93b69f640061eb1e30 | phpcs updates | [
{
"change_type": "MODIFY",
"old_path": "Controller/Checkout/CompleteSession.php",
"new_path": "Controller/Checkout/CompleteSession.php",
"diff": "@@ -104,7 +104,8 @@ class CompleteSession extends \\Magento\\Framework\\App\\Action\\Action\nreturn $this->_redirect('checkout/cart', ['_scope' => $scope]);\n} elseif (!$result['order_id']) {\n- throw new \\Magento\\Framework\\Exception\\NotFoundException(__('Something went wrong. Choose another payment method for checkout and try again.'));\n+ throw new \\Magento\\Framework\\Exception\\NotFoundException(__('Something went wrong. Choose another ' .\n+ 'payment method for checkout and try again.'));\n}\n$this->updateVersionCookie();\n$successUrl = $this->amazonConfig->getCheckoutResultUrlPath();\n"
},
{
"change_type": "MODIFY",
"old_path": "Controller/Login/Authorize.php",
"new_path": "Controller/Login/Authorize.php",
"diff": "@@ -59,7 +59,8 @@ class Authorize extends \\Amazon\\Pay\\Controller\\Login\n$this->_eventManager->dispatch('amazon_login_authorize_error', ['exception' => $e]);\n} catch (\\Exception $e) {\n$this->logger->error($e);\n- $this->messageManager->addErrorMessage(__('An error occurred while matching your Amazon account with your store account. '));\n+ $this->messageManager->addErrorMessage(__('An error occurred while matching your Amazon account with ' .\n+ 'your store account. '));\n$this->_eventManager->dispatch('amazon_login_authorize_error', ['exception' => $e]);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Controller/Login/Checkout.php",
"new_path": "Controller/Login/Checkout.php",
"diff": "@@ -79,7 +79,8 @@ class Checkout extends \\Amazon\\Pay\\Controller\\Login\n$this->_eventManager->dispatch('amazon_login_authorize_error', ['exception' => $e]);\n} catch (\\Exception $e) {\n$this->logger->error($e);\n- $this->messageManager->addErrorMessage(__('An error occurred while matching your Amazon account with your store account. '));\n+ $this->messageManager->addErrorMessage(__('An error occurred while matching your Amazon account with ' .\n+ 'your store account. '));\n$this->_eventManager->dispatch('amazon_login_authorize_error', ['exception' => $e]);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -391,7 +391,9 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n->getSize();\nif (1 != $collectionSize) {\n- throw new WebapiException(__('The store doesn\\'t support the country that was entered. To review allowed countries, go to General > General > Allow Countries list. Enter a supported country and try again. '));\n+ throw new WebapiException(__('The store doesn\\'t support the country that was entered. ' .\n+ 'To review allowed countries, go to General > General > Allow Countries list. Enter ' .\n+ 'a supported country and try again. '));\n}\n}\n@@ -928,7 +930,8 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\nprotected function getLoginError($e)\n{\n- $this->logger->error('An error occurred while matching your Amazon account with your store account. : ' . $e->getMessage());\n+ $this->logger->error('An error occurred while matching your Amazon account with ' .\n+ 'your store account. : ' . $e->getMessage());\nreturn [\n'success' => false,\n'message' => __($e->getMessage())\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/Config/Source/EnabledDisabled.php",
"new_path": "Model/Config/Source/EnabledDisabled.php",
"diff": "namespace Amazon\\Pay\\Model\\Config\\Source;\n-\nclass EnabledDisabled implements \\Magento\\Framework\\Option\\ArrayInterface\n{\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "view/adminhtml/templates/system/config/autokeyexchange_admin.phtml",
"new_path": "view/adminhtml/templates/system/config/autokeyexchange_admin.phtml",
"diff": "<div id=\"autokeyexchange-hint\">\n<?= $block->escapeHtml(\n__(\n- \"You'll be connecting/registering a %1 account based on your display currency of your store scope. For more information, see Amazon Pay for Magento 2.\",\n+ \"You'll be connecting/registering a %1 account based on your display currency of your store \" .\n+ \"scope. For more information, see Amazon Pay for Magento 2.\",\n$block->getRegion()\n)\n); ?>\n<span class=\"apake-or\">\n <?= $block->escapeHtml(__('or')); ?> \n<a href=\"#\" id=\"autokeyexchange-skip\">\n- <?= $block->escapeHtml(__(\"I've already set up Amazon Pay with Magento and I want to edit my configuration.\")); ?>\n+ <?= $block->escapeHtml(__(\"I've already set up Amazon Pay with Magento and I want to edit \" .\n+ \"my configuration.\")); ?>\n</a>\n</span>\n<p id=\"amazon_https_required\">\n</button>\n<br />\n<span id=\"reset-auto-key-exchange-message\">\n- <?= /* @noEscape */ __('Resetting the Amazon Pay configuration. After the page reloaded, click Start configuration/registration.'); ?>\n+ <?= /* @noEscape */ __('Resetting the Amazon Pay configuration. After the page reloaded, click Start ' .\n+ 'configuration/registration.'); ?>\n</span>\n</div>\n<?php endif; ?>\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-674 - phpcs updates |
21,241 | 07.04.2022 17:57:30 | 18,000 | 402364d4361c26596d5f714c0e4226b273727929 | Version bump to 5.12.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.11.1\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.12.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.11.1\",\n+ \"version\": \"5.12.0\",\n\"license\": [\n\"Apache-2.0\"\n],\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Version bump to 5.12.0 and update changelog |
21,266 | 13.04.2022 14:13:55 | 14,400 | 53aa518cfed6ed3588096a9b6916363305d6f80d | Separate checkout button rendering from checkout initiation; - Optionally split payloads/signatures from config response | [
{
"change_type": "MODIFY",
"old_path": "Api/CheckoutSessionManagementInterface.php",
"new_path": "Api/CheckoutSessionManagementInterface.php",
"diff": "@@ -22,9 +22,16 @@ interface CheckoutSessionManagementInterface\n{\n/**\n* @param string|null $cartId\n+ * @param boolean $omitPayloads\n* @return mixed\n*/\n- public function getConfig($cartId = null);\n+ public function getConfig($cartId = null, $omitPayloads = false);\n+\n+ /**\n+ * @param string $payloadType\n+ * @return mixed\n+ */\n+ public function getButtonPayload($payloadType = 'checkout');\n/**\n* @param mixed $amazonSessionId\n"
},
{
"change_type": "MODIFY",
"old_path": "Controller/Checkout/Config.php",
"new_path": "Controller/Checkout/Config.php",
"diff": "@@ -46,7 +46,8 @@ class Config extends \\Magento\\Framework\\App\\Action\\Action\n*/\npublic function execute()\n{\n- $data = $this->amazonCheckoutSession->getConfig();\n+ $omitPayloads = isset($this->getRequest()->getParams()['omit_payloads']);\n+ $data = $this->amazonCheckoutSession->getConfig($omitPayloads);\nreturn $this->resultJsonFactory->create()->setData($data);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "CustomerData/CheckoutSession.php",
"new_path": "CustomerData/CheckoutSession.php",
"diff": "@@ -46,9 +46,9 @@ class CheckoutSession\n/**\n* @return array\n*/\n- public function getConfig()\n+ public function getConfig($omitPayloads)\n{\n- $data = $this->checkoutSessionManagement->getConfig();\n+ $data = $this->checkoutSessionManagement->getConfig(null, $omitPayloads);\nif (count($data) > 0) {\n$data = $data[0];\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -404,40 +404,34 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n/**\n* {@inheritdoc}\n*/\n- public function getConfig($cartId = null)\n+ public function getConfig($cartId = null, $omitPayloads = false)\n{\n$result = [];\n$quote = $this->session->getQuoteFromIdOrSession($cartId);\nif ($this->canCheckoutWithAmazon($quote)) {\n- $loginButtonPayload = $this->amazonAdapter->generateLoginButtonPayload();\n- $checkoutButtonPayload = $this->amazonAdapter->generateCheckoutButtonPayload();\n$config = [\n'merchant_id' => $this->amazonConfig->getMerchantId(),\n'currency' => $this->amazonConfig->getCurrencyCode(),\n'button_color' => $this->amazonConfig->getButtonColor(),\n'language' => $this->amazonConfig->getLanguage(),\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'public_key_id' => $this->amazonConfig->getPublicKeyId(),\n];\n+ if (!$omitPayloads) {\n+ $config = array_merge($config, $this->getLoginButtonPayload(), $this->getCheckoutButtonPayload());\n+ }\n+\nif ($quote) {\n// Ensure the totals are up to date, in case the checkout does something to update qty or shipping\n// without collecting totals\n$quote->collectTotals();\n- $payNowButtonPayload = $this->amazonAdapter->generatePayNowButtonPayload(\n- $quote,\n- $this->amazonConfig->getPaymentAction()\n- );\n-\n$config['pay_only'] = $this->amazonHelper->isPayOnly($quote);\n- $config['paynow_payload'] = $payNowButtonPayload;\n- $config['paynow_signature'] = $this->amazonAdapter->signButton($payNowButtonPayload);\n+ if (!$omitPayloads) {\n+ $config = array_merge($config, $this->getPayNowButtonPayload($quote));\n+ }\n}\n$result[] = $config;\n@@ -446,6 +440,71 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\nreturn $result;\n}\n+ public function getButtonPayload($payloadType = 'checkout')\n+ {\n+ switch ($payloadType) {\n+ case 'paynow':\n+ $quote = $this->session->getQuoteFromIdOrSession();\n+ return $this->getPayNowButtonPayload($quote);\n+ case 'login':\n+ return $this->getLoginButtonPayload();\n+ default:\n+ return $this->getCheckoutButtonPayload();\n+ }\n+ }\n+\n+ /**\n+ * Generate login button payload/signature pair.\n+ *\n+ * @return mixed\n+ */\n+ private function getLoginButtonPayload()\n+ {\n+ $loginButtonPayload = $this->amazonAdapter->generateLoginButtonPayload();\n+ $result = [\n+ 'login_payload' => $loginButtonPayload,\n+ 'login_signature' => $this->amazonAdapter->signButton($loginButtonPayload)\n+ ];\n+\n+ return $result;\n+ }\n+\n+ /**\n+ * Generate checkout button payload/signature pair.\n+ *\n+ * @return mixed\n+ */\n+ private function getCheckoutButtonPayload()\n+ {\n+ $checkoutButtonPayload = $this->amazonAdapter->generateCheckoutButtonPayload();\n+ $result = [\n+ 'checkout_payload' => $checkoutButtonPayload,\n+ 'checkout_signature' => $this->amazonAdapter->signButton($checkoutButtonPayload)\n+ ];\n+\n+ return $result;\n+ }\n+\n+ /**\n+ * Generate paynow payload/signature pair.\n+ *\n+ * @param CartInterface $quote\n+ * @return mixed\n+ */\n+ private function getPayNowButtonPayload($quote)\n+ {\n+ $payNowButtonPayload = $this->amazonAdapter->generatePayNowButtonPayload(\n+ $quote,\n+ $this->amazonConfig->getPaymentAction()\n+ );\n+ $result = [\n+ 'paynow_payload' => $payNowButtonPayload,\n+ 'paynow_signature' => $this->amazonAdapter->signButton($payNowButtonPayload)\n+ ];\n+\n+ return $result;\n+ }\n+\n/**\n* {@inheritdoc}\n*/\n"
},
{
"change_type": "MODIFY",
"old_path": "etc/webapi.xml",
"new_path": "etc/webapi.xml",
"diff": "<resources>\n<resource ref=\"anonymous\" />\n</resources>\n+ <data>\n+ <parameter name=\"omitPayloads\">%omit_payloads%</parameter>\n+ </data>\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+ <data>\n+ <parameter name=\"omitPayloads\">%omit_payloads%</parameter>\n+ </data>\n+ </route>\n+ <route method=\"GET\" url=\"/V1/amazon-checkout-session/button-payload/:payloadType\">\n+ <service class=\"Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\" method=\"getButtonPayload\"/>\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"
},
{
"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": "@@ -30,16 +30,13 @@ define([\n}\nreturn localStorage;\n};\n- return function (callback, forceReload = false) {\n+ return function (callback) {\nvar cartId = customerData.get('cart')()['data_id'] || window.checkout.storeId;\nvar config = getLocalStorage().get('config') || false;\n- if (forceReload\n- || cartId !== getLocalStorage().get('cart_id')\n- || typeof config.checkout_payload === 'undefined'\n- || !config.checkout_payload.includes(document.URL)) {\n+ if (!config || cartId !== getLocalStorage().get('cart_id')) {\ncallbacks.push(callback);\nif (callbacks.length == 1) {\n- remoteStorage.get(url.build('amazon_pay/checkout/config')).done(function (config) {\n+ remoteStorage.get(url.build('amazon_pay/checkout/config?omit_payloads=true')).done(function (config) {\ngetLocalStorage().set('cart_id', cartId);\ngetLocalStorage().set('config', config);\ndo {\n@@ -47,8 +44,8 @@ define([\n} while (callbacks.length);\n});\n}\n- } else {\n- callback(getLocalStorage().get('config'));\n}\n+\n+ callback(getLocalStorage().get('config'));\n};\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/js/amazon-button.js",
"new_path": "view/frontend/web/js/amazon-button.js",
"diff": "@@ -16,6 +16,7 @@ define([\n'ko',\n'jquery',\n'Amazon_Pay/js/action/checkout-session-config-load',\n+ 'Amazon_Pay/js/action/checkout-session-button-payload-load',\n'Amazon_Pay/js/model/storage',\n'mage/url',\n'Amazon_Pay/js/amazon-checkout',\n@@ -27,6 +28,7 @@ define([\nko,\n$,\ncheckoutSessionConfigLoad,\n+ buttonPayloadLoad,\namazonStorage,\nurl,\namazonCheckout,\n@@ -48,17 +50,9 @@ define([\ndrawing: false,\n- _loadButtonConfig: function (callback, forceReload = false) {\n+ _loadButtonConfig: function (callback) {\ncheckoutSessionConfigLoad(function (checkoutSessionConfig) {\nif (!$.isEmptyObject(checkoutSessionConfig)) {\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- }\n-\ncallback({\nmerchantId: checkoutSessionConfig['merchant_id'],\npublicKeyId: checkoutSessionConfig['public_key_id'],\n@@ -68,11 +62,7 @@ define([\nproductType: this._isPayOnly(checkoutSessionConfig['pay_only']) ? 'PayOnly' : 'PayAndShip',\nplacement: this.options.placement,\nbuttonColor: checkoutSessionConfig['button_color'],\n- createCheckoutSessionConfig: {\n- payloadJSON: payload,\n- signature: signature,\n- publicKeyId: checkoutSessionConfig['public_key_id'],\n- }\n+ publicKeyId: checkoutSessionConfig['public_key_id']\n});\nif (this.options.placement !== \"Checkout\") {\n@@ -81,7 +71,21 @@ define([\n} else {\n$(this.options.hideIfUnavailable).hide();\n}\n- }.bind(this), forceReload);\n+ }.bind(this));\n+ },\n+\n+ _loadInitCheckoutPayload: function (callback, payloadType) {\n+ checkoutSessionConfigLoad(function (checkoutSessionConfig) {\n+ buttonPayloadLoad(function (buttonPayload) {\n+ callback({\n+ createCheckoutSessionConfig: {\n+ payloadJSON: buttonPayload[0],\n+ signature: buttonPayload[1],\n+ publicKeyId: checkoutSessionConfig['public_key_id']\n+ }\n+ });\n+ }, payloadType);\n+ });\n},\n/**\n@@ -109,10 +113,7 @@ define([\n}\nthis._draw();\n-\n- if (this.options.placement === 'Product') {\n- this._redraw();\n- }\n+ this._subscribeToCartUpdates();\n},\n/**\n@@ -130,8 +131,6 @@ define([\n$buttonContainer.empty().append($buttonRoot);\nthis._loadButtonConfig(function (buttonConfig) {\n- // do not use session config for decoupled button\n- delete buttonConfig.createCheckoutSessionConfig;\ntry {\nvar amazonPayButton = amazon.Pay.renderButton('#' + $buttonRoot.empty().removeUniqueId().uniqueId().attr('id'), buttonConfig);\n} catch (e) {\n@@ -174,17 +173,19 @@ define([\n},\n_initCheckout: function (amazonPayButton) {\n- this._loadButtonConfig(function (buttonConfig) {\n- var initConfig = {createCheckoutSessionConfig: buttonConfig.createCheckoutSessionConfig};\n- amazonPayButton.initCheckout(initConfig);\n- }, true);\n+ var payloadType = this.buttonType ?\n+ 'paynow' :\n+ 'checkout';\n+ this._loadInitCheckoutPayload(function (initCheckoutPayload) {\n+ amazonPayButton.initCheckout(initCheckoutPayload);\n+ }, payloadType);\ncustomerData.invalidate('*');\n},\n/**\n* Redraw button if needed\n**/\n- _redraw: function () {\n+ _subscribeToCartUpdates: function () {\nvar self = this;\namazonCheckout.withAmazonCheckout(function (amazon, args) {\n@@ -195,7 +196,6 @@ define([\n}\n});\n});\n-\n},\nclick: function () {\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-889 - Separate checkout button rendering from checkout initiation; ASD-888 - Optionally split payloads/signatures from config response |
21,266 | 14.04.2022 15:09:05 | 14,400 | 191b32cf144f9f93e2bddf376706f7a11d17eb0c | Return error messages from /completeCheckoutSession as strings
to avoid 'Class x doesn't exist' error through the API | [
{
"change_type": "MODIFY",
"old_path": "Api/CheckoutSessionManagementInterface.php",
"new_path": "Api/CheckoutSessionManagementInterface.php",
"diff": "@@ -54,7 +54,7 @@ interface CheckoutSessionManagementInterface\n/**\n* @param mixed $amazonSessionId\n* @param mixed|null $cartId\n- * @return int\n+ * @return mixed\n*/\npublic function completeCheckoutSession($amazonSessionId, $cartId = null);\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -41,6 +41,7 @@ use Magento\\Quote\\Model\\MaskedQuoteIdToQuoteIdInterface;\nuse Magento\\Sales\\Api\\Data\\TransactionInterface as Transaction;\nuse Magento\\Integration\\Model\\Oauth\\TokenFactory as TokenModelFactory;\nuse Magento\\Authorization\\Model\\UserContextInterface as UserContext;\n+use Magento\\Framework\\Phrase\\Renderer\\Translate as Translate;\nclass CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\n{\n@@ -202,6 +203,11 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n*/\nprivate $session;\n+ /**\n+ * @var Translate\n+ */\n+ private $translationRenderer;\n+\n/**\n* CheckoutSessionManagement constructor.\n* @param \\Magento\\Store\\Model\\StoreManagerInterface $storeManager\n@@ -233,6 +239,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n* @param UserContext $userContext\n* @param \\Amazon\\Pay\\Logger\\Logger $logger\n* @param Session $session\n+ * @param Translate $translationRenderer\n*/\npublic function __construct(\n\\Magento\\Store\\Model\\StoreManagerInterface $storeManager,\n@@ -263,7 +270,8 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\nTokenModelFactory $tokenModelFactory,\nUserContext $userContext,\n\\Amazon\\Pay\\Logger\\Logger $logger,\n- Session $session\n+ Session $session,\n+ Translate $translationRenderer\n) {\n$this->storeManager = $storeManager;\n$this->quoteIdMaskFactory = $quoteIdMaskFactory;\n@@ -294,6 +302,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$this->userContext = $userContext;\n$this->logger = $logger;\n$this->session = $session;\n+ $this->translationRenderer = $translationRenderer;\n}\n/**\n@@ -650,7 +659,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n$this->logger->debug(\"Unable to complete Amazon Pay checkout. Can't submit quote id: \" . $quote->getId());\nreturn [\n'success' => false,\n- 'message' => __(\"Unable to complete Amazon Pay checkout\"),\n+ 'message' => $this->getTranslationString('Unable to complete Amazon Pay checkout'),\n];\n}\ntry {\n@@ -739,7 +748,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\nreturn [\n'success' => false,\n- 'message' => __(\n+ 'message' => $this->getTranslationString(\n'Something went wrong. Choose another payment method for checkout and try again.'\n),\n];\n@@ -835,14 +844,33 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\nprotected function getCanceledMessage($amazonSession)\n{\nif ($amazonSession['statusDetails']['reasonCode'] == 'BuyerCanceled') {\n- return __(\"This transaction was cancelled. Please try again.\");\n+ return $this->getTranslationString('This transaction was cancelled. Please try again.');\n} elseif ($amazonSession['statusDetails']['reasonCode'] == 'Declined') {\n- return __(\"This transaction was declined. Please try again using a different payment method.\");\n+ return $this->getTranslationString(\n+ 'This transaction was declined. Please try again using a different payment method.'\n+ );\n}\nreturn $amazonSession['statusDetails']['reasonDescription'];\n}\n+ /**\n+ * Get a translated string to return through the web API\n+ *\n+ * @param string $message\n+ * @return string\n+ */\n+ private function getTranslationString($message)\n+ {\n+ try {\n+ $translation = $this->translationRenderer->render([$message], []);\n+ } catch (\\Exception $e) {\n+ $translation = $message;\n+ }\n+\n+ return $translation;\n+ }\n+\n/**\n* @param mixed $buyerToken\n* @return mixed\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-898 - Return error messages from /completeCheckoutSession as strings
to avoid 'Class x doesn't exist' error through the API |
21,248 | 19.04.2022 19:27:15 | 0 | a5c5de501cac277a88ba6e4e2768110d7968444a | Replaced array_merge spread operator with a more backwards compatible php method | [
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/CheckoutSessionConfig.php",
"new_path": "Model/Resolver/CheckoutSessionConfig.php",
"diff": "@@ -38,6 +38,9 @@ class CheckoutSessionConfig implements ResolverInterface\n{\n$cartId = $args['cartId'] ?? null;\n- return array_merge(...$this->checkoutSessionManagement->getConfig($cartId));\n+ // old php version friendly. later the spread operator can be used for a slight performance increase\n+ // array_merge(...$response);\n+ $response = $this->checkoutSessionManagement->getConfig($cartId);\n+ return array_shift($response);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/CheckoutSessionSignIn.php",
"new_path": "Model/Resolver/CheckoutSessionSignIn.php",
"diff": "@@ -44,6 +44,9 @@ class CheckoutSessionSignIn implements ResolverInterface\nthrow new GraphQlInputException(__('Required parameter \"buyerToken\" is missing'));\n}\n- return array_merge(...$this->checkoutSessionManagement->signIn($buyerToken));\n+ // old php version friendly. later the spread operator can be used for a slight performance increase\n+ // array_merge(...$response);\n+ $response = $this->checkoutSessionManagement->signIn($buyerToken);\n+ return array_shift($response);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/SetCustomerLink.php",
"new_path": "Model/Resolver/SetCustomerLink.php",
"diff": "@@ -48,7 +48,10 @@ class SetCustomerLink implements ResolverInterface\nthrow new GraphQlInputException(__('Required parameter \"password\" is missing'));\n}\n- return array_merge(...$this->checkoutSessionManagementModel->setCustomerLink($buyerToken, $password));\n+ // old php version friendly. later the spread operator can be used for a slight performance increase\n+ // array_merge(...$response);\n+ $response = $this->checkoutSessionManagementModel->setCustomerLink($buyerToken, $password);\n+ return array_shift($response);\n}\n}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | APF-320 - Replaced array_merge spread operator with a more backwards compatible php method |
21,248 | 19.04.2022 19:36:21 | 0 | 638870649c29f3baa00ded6575ef819227869a2a | Added syntax sniffer based fixes | [
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/CheckoutSessionDetails.php",
"new_path": "Model/Resolver/CheckoutSessionDetails.php",
"diff": "@@ -61,7 +61,6 @@ class CheckoutSessionDetails implements ResolverInterface\n];\n}\n-\n/**\n* @param $amazonSessionId\n* @param $queryType\n@@ -85,6 +84,4 @@ class CheckoutSessionDetails implements ResolverInterface\nreturn $result;\n}\n-\n-\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/SetCustomerLink.php",
"new_path": "Model/Resolver/SetCustomerLink.php",
"diff": "@@ -52,6 +52,5 @@ class SetCustomerLink implements ResolverInterface\n// array_merge(...$response);\n$response = $this->checkoutSessionManagementModel->setCustomerLink($buyerToken, $password);\nreturn array_shift($response);\n-\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/UpdateCheckoutSession.php",
"new_path": "Model/Resolver/UpdateCheckoutSession.php",
"diff": "@@ -49,10 +49,9 @@ class UpdateCheckoutSession implements ResolverInterface\nthrow new GraphQlInputException(__('Required parameter \"checkoutSessionId\" is missing'));\n}\n+ $response = $this->checkoutSessionManagementModel->updateCheckoutSession($checkoutSessionId, $cartId) ?? 'N/A';\nreturn [\n- 'redirectUrl' => $this->checkoutSessionManagementModel->updateCheckoutSession($checkoutSessionId,\n- $cartId) ?? 'N/A'\n+ 'redirectUrl' => $response\n];\n}\n-\n}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | APF-320 - Added syntax sniffer based fixes |
21,241 | 04.05.2022 20:20:59 | 18,000 | c3904776a4adc4249701e058210d515dbbdae120 | Version bump to 5.13.0 and update changelog | [
{
"change_type": "MODIFY",
"old_path": "CHANGELOG.md",
"new_path": "CHANGELOG.md",
"diff": "# Change Log\n+## 5.13.0\n+* Added Graphql support\n+* Added endpoints to fetch individual config types\n+* Change how buttons are rendered so they are not blocked waiting for config\n+* Fixed an error when using the REST complete endpoint with a declined card\n+* Updated some translations\n+\n## 5.12.0\n* Change to display billing address for US/JP regions to match EU/UK\n* Fixed a regression with restricted categories\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.12.0\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.13.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.12.0\",\n+ \"version\": \"5.13.0\",\n\"license\": [\n\"Apache-2.0\"\n],\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Version bump to 5.13.0 and update changelog |
21,266 | 05.05.2022 11:06:42 | 14,400 | 6962ebf50669841e65f87a368ff7d6cac55d9cba | Correct config retrieval for Amazon Sign In | [
{
"change_type": "MODIFY",
"old_path": "Controller/Checkout/Config.php",
"new_path": "Controller/Checkout/Config.php",
"diff": "@@ -46,7 +46,7 @@ class Config extends \\Magento\\Framework\\App\\Action\\Action\n*/\npublic function execute()\n{\n- $omitPayloads = isset($this->getRequest()->getParams()['omit_payloads']);\n+ $omitPayloads = filter_var($this->getRequest()->getParams()['omit_payloads'], FILTER_VALIDATE_BOOLEAN);\n$data = $this->amazonCheckoutSession->getConfig($omitPayloads);\nreturn $this->resultJsonFactory->create()->setData($data);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -413,7 +413,7 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n/**\n* {@inheritdoc}\n*/\n- public function getConfig($cartId = null, $omitPayloads = false)\n+ public function getConfig($cartId = null, $omitPayloads = true)\n{\n$result = [];\n$quote = $this->session->getQuoteFromIdOrSession($cartId);\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": "@@ -29,11 +29,11 @@ define([\n}\nreturn localStorage;\n};\n- return function (callback) {\n+ return function (callback, omitPayloads = true) {\nvar cartId = customerData.get('cart')()['data_id'] || window.checkout.storeId;\nvar config = getLocalStorage().get('config') || false;\nif (!config) {\n- remoteStorage.get(url.build('amazon_pay/checkout/config?omit_payloads=true')).done(function (config) {\n+ remoteStorage.get(url.build(`amazon_pay/checkout/config?omit_payloads=${omitPayloads}`)).done(function (config) {\ngetLocalStorage().set('cart_id', cartId);\ngetLocalStorage().set('config', config);\n"
},
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/js/amazon-login-button.js",
"new_path": "view/frontend/web/js/amazon-login-button.js",
"diff": "@@ -46,7 +46,7 @@ define([\npublicKeyId: checkoutSessionConfig['public_key_id']\n}\n});\n- }.bind(this));\n+ }.bind(this), false);\n},\n/**\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Correct config retrieval for Amazon Sign In |
21,266 | 24.05.2022 15:34:17 | 14,400 | fc48072ed0c4772b00bd5ab4c327a43743f3ea1f | Account for whitespace/newline trimming on responses from
MagentoWebDriver's magentoCLI() function | [
{
"change_type": "MODIFY",
"old_path": "Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml",
"new_path": "Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml",
"diff": "<grabTextFrom selector=\"{{CheckoutSuccessMainSection.orderNumber}}\" stepKey=\"orderNumber\" />\n<magentoCLI command=\"amazon:payment:sales:verify-charge-permission\" arguments=\"--orderId {$orderNumber}\" stepKey=\"command\" />\n- <assertEquals stepKey=\"refIdAssert\">\n+ <assertStringContainsString stepKey=\"seeMerchantReferenceIdMatchesOrderNumber\">\n+ <expectedResult type=\"string\">true</expectedResult>\n<actualResult type=\"string\">${command}</actualResult>\n- <expectedResult type=\"string\">true\\n</expectedResult>\n- </assertEquals>\n+ </assertStringContainsString>\n</test>\n</tests>\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Account for whitespace/newline trimming on responses from
MagentoWebDriver's magentoCLI() function |
21,266 | 26.05.2022 09:00:41 | 14,400 | ca853189717b9f750a5a62e60fc9597da22a9d08 | Adjust GraphQL config query to match rest endpoint behavior w/
omitPayloads | [
{
"change_type": "MODIFY",
"old_path": "Model/Resolver/CheckoutSessionConfig.php",
"new_path": "Model/Resolver/CheckoutSessionConfig.php",
"diff": "@@ -37,8 +37,9 @@ class CheckoutSessionConfig implements ResolverInterface\npublic function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)\n{\n$cartId = $args['cartId'] ?? null;\n+ $omitPayloads = $args['omitPayloads'] ?? false;\n- $response = $this->checkoutSessionManagement->getConfig($cartId);\n+ $response = $this->checkoutSessionManagement->getConfig($cartId, $omitPayloads);\nreturn array_shift($response);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "etc/schema.graphqls",
"new_path": "etc/schema.graphqls",
"diff": "type Query {\n- checkoutSessionConfig(cartId: String): CheckoutSessionConfigOutput\n+ checkoutSessionConfig(cartId: String, omitPayloads: Boolean): CheckoutSessionConfigOutput\n@resolver(class:\"Amazon\\\\Pay\\\\Model\\\\Resolver\\\\CheckoutSessionConfig\")\ncheckoutSessionDetails(amazonSessionId: String!, queryTypes: [String!]): CheckoutSessionDetailsOutput\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | GH-1129 - Adjust GraphQL config query to match rest endpoint behavior w/
omitPayloads |
21,266 | 26.05.2022 10:41:18 | 14,400 | 872e2f5ee2ee3328602b63adf0c36478885b4f32 | Add logging if declined payment has no associated charge permission ID,
skip call to closeChargePermission | [
{
"change_type": "MODIFY",
"old_path": "Model/AsyncManagement/Charge.php",
"new_path": "Model/AsyncManagement/Charge.php",
"diff": "@@ -208,12 +208,19 @@ class Charge extends AbstractOperation\n}\nif ($order->canHold() || $order->isPaymentReview()) {\n$this->closeLastTransaction($order);\n+ $chargePermissionId = $order->getPayment()->getAdditionalInformation()['charge_permission_id'] ?? '';\n+ if (!empty($chargePermissionId)) {\n$this->amazonAdapter->closeChargePermission(\n$order->getStoreId(),\n- array_key_exists('charge_permission_id', $order->getPayment()->getAdditionalInformation()) ? $order->getPayment()->getAdditionalInformation()['charge_permission_id'] : \"\",\n+ $chargePermissionId,\n'Canceled due to capture declined.',\ntrue\n);\n+ } else {\n+ $this->asyncLogger->info('Unable to close charge permission for order #' . $order->getIncrementId()\n+ . '; no charge permission ID associated with order');\n+ }\n+\n$this->setOrderState($order, 'canceled');\n$payment = $order->getPayment();\n$transaction = $this->transactionBuilder->setPayment($payment)\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Add logging if declined payment has no associated charge permission ID,
skip call to closeChargePermission |
21,266 | 27.05.2022 09:12:22 | 14,400 | 50720f6629c5c8db476f9e6e4005ae03469fd185 | Retrieve fresh button config when store view changes | [
{
"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": "@@ -22,10 +22,15 @@ define([\n], function ($, _, remoteStorage, url, customerData) {\n'use strict';\n+ const storageKey = 'amzn-checkout-session-config';\n+ $('.switcher-option').on('click', function () {\n+ $.localStorage.remove(storageKey);\n+ });\n+\nvar localStorage = null;\nvar getLocalStorage = function () {\nif (localStorage === null) {\n- localStorage = $.initNamespaceStorage('amzn-checkout-session-config').localStorage;\n+ localStorage = $.initNamespaceStorage(storageKey).localStorage;\n}\nreturn localStorage;\n};\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Retrieve fresh button config when store view changes |
21,241 | 02.06.2022 10:59:19 | 18,000 | c0c09af0e8b298dc1cbcef87c397bf75f8cfba8a | Version bump to 5.13.1 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.13.0\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.13.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.13.0\",\n+ \"version\": \"5.13.1\",\n\"license\": [\n\"Apache-2.0\"\n],\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Version bump to 5.13.1 and update changelog |
21,266 | 21.06.2022 13:20:17 | 14,400 | 0611216ddf32626bf8f8525bbf489bb88f58f820 | Remove characters from Amazon account buyerName if they
violate Magento customer name validations | [
{
"change_type": "MODIFY",
"old_path": "Model/CustomerLinkManagement.php",
"new_path": "Model/CustomerLinkManagement.php",
"diff": "@@ -95,9 +95,10 @@ class CustomerLinkManagement implements \\Amazon\\Pay\\Api\\CustomerLinkManagementIn\npublic function create(AmazonCustomerInterface $amazonCustomer)\n{\n$customerData = $this->customerDataFactory->create();\n+ $sanitizedNames = $this->getSanitizedNameData($amazonCustomer);\n- $customerData->setFirstname($amazonCustomer->getFirstName());\n- $customerData->setLastname($amazonCustomer->getLastName());\n+ $customerData->setFirstname($sanitizedNames['first_name']);\n+ $customerData->setLastname($sanitizedNames['last_name']);\n$customerData->setEmail($amazonCustomer->getEmail());\n$password = $this->random->getRandomString(64);\n@@ -120,4 +121,18 @@ class CustomerLinkManagement implements \\Amazon\\Pay\\Api\\CustomerLinkManagementIn\n$this->customerLinkRepository->save($customerLink);\n}\n+\n+ /**\n+ * @param AmazonCustomerInterface $customer\n+ * @return array\n+ */\n+ private function getSanitizedNameData($customer)\n+ {\n+ $pattern = '/([^\\p{L}\\p{M}\\,\\-\\_\\.\\'\\s\\d]){1,255}+/u';\n+\n+ return [\n+ 'first_name' => trim(preg_replace($pattern, '', htmlspecialchars_decode($customer->getFirstname()))),\n+ 'last_name' => trim(preg_replace($pattern, '', htmlspecialchars_decode($customer->getLastname())))\n+ ];\n+ }\n}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-929 - Remove characters from Amazon account buyerName if they
violate Magento customer name validations |
21,266 | 22.06.2022 09:24:33 | 14,400 | bc024b921bed2b58226b0fadd88ea7e9e23176f4 | Update ExceptionLogger to be compatible with Monolog 2.x and
above | [
{
"change_type": "MODIFY",
"old_path": "Logger/ExceptionLogger.php",
"new_path": "Logger/ExceptionLogger.php",
"diff": "@@ -28,6 +28,6 @@ class ExceptionLogger\npublic function logException(\\Exception $e)\n{\n$message = (string) $e;\n- $this->logger->addError($message);\n+ $this->logger->error($message);\n}\n}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-932 - Update ExceptionLogger to be compatible with Monolog 2.x and
above |
21,266 | 14.07.2022 09:43:23 | 14,400 | d6ff2a803135088bff27bf1265c5020c3a0b4e6e | Prompt for billing address in APB flow when product type is pay only | [
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -738,19 +738,6 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n}\nif ($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- $quote->getBillingAddress()->importCustomerAddressData($customerAddress);\nif (empty($quote->getCustomerEmail())) {\n$quote->setCustomerEmail($amazonSession['buyer']['email']);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/js/amazon-button.js",
"new_path": "view/frontend/web/js/amazon-button.js",
"diff": "@@ -23,7 +23,9 @@ define([\n'Magento_Customer/js/customer-data',\n'Magento_Checkout/js/model/payment/additional-validators',\n'mage/storage',\n- 'Magento_Checkout/js/model/error-processor'\n+ 'Magento_Checkout/js/model/error-processor',\n+ 'Magento_Checkout/js/action/set-billing-address',\n+ 'Magento_Ui/js/model/messageList',\n], function (\nko,\n$,\n@@ -35,7 +37,9 @@ define([\ncustomerData,\nadditionalValidators,\nstorage,\n- errorProcessor\n+ errorProcessor,\n+ setBillingAddressAction,\n+ globalMessageList\n) {\n'use strict';\n@@ -173,12 +177,29 @@ define([\n$('.amazon-button-container .field-tooltip').fadeIn();\nself.drawing = false;\n+\n+ if (self.buttonType === 'PayNow' && self._isPayOnly()) {\n+ customerData.get('checkout-data').subscribe(function (checkoutData) {\n+ const opacity = checkoutData.selectedBillingAddress ? 1 : 0.5;\n+\n+ const shadow = $('.amazon-checkout-button > div')[0].shadowRoot;\n+ $(shadow).find('.amazonpay-button-view1').css('opacity', opacity);\n+ });\n+ }\n});\n}, this);\n}\n},\n_initCheckout: function (amazonPayButton) {\n+ if (this.buttonType === 'PayNow' && this._isPayOnly()) {\n+ if (!customerData.get('checkout-data')().selectedBillingAddress) {\n+ return;\n+ } else {\n+ setBillingAddressAction(globalMessageList);\n+ }\n+ }\n+\nvar payloadType = this.buttonType ?\n'paynow' :\n'checkout';\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": "@@ -44,7 +44,7 @@ define(\nreturn Component.extend({\ndefaults: {\nisAmazonCheckout: ko.observable(amazonStorage.isAmazonCheckout()),\n- isBillingAddressVisible: ko.observable(false),\n+ isBillingAddressVisible: ko.observable(!quote.billingAddress()),\nisIosc: ko.observable($('button.iosc-place-order-button').length > 0),\npaymentDescriptor: ko.observable(''),\nlogo: 'Amazon_Pay/images/logo/Black-L.png',\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-849 - Prompt for billing address in APB flow when product type is pay only |
21,266 | 14.07.2022 10:10:05 | 14,400 | 74ba054e14e9bdfb598d19c29be178f331b78ae4 | Add mixin on Magento_PurchaseOrder address renderer if B2B extensions are installed | [
{
"change_type": "MODIFY",
"old_path": "view/frontend/requirejs-config.js",
"new_path": "view/frontend/requirejs-config.js",
"diff": "@@ -31,6 +31,9 @@ var config = {\n'Magento_Checkout/js/view/shipping-address/address-renderer/default': {\n'Amazon_Pay/js/view/shipping-address/address-renderer/default': true\n},\n+ 'Magento_PurchaseOrder/js/view/checkout/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"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-917 - Add mixin on Magento_PurchaseOrder address renderer if B2B extensions are installed |
21,266 | 20.07.2022 15:35:58 | 14,400 | 15dbf4b363b79b29682f2f25dd6434c1d913ab2e | Add estimatedOrderAmount to checkout button payload, use updateButtonInfo when there are changes to cart | [
{
"change_type": "MODIFY",
"old_path": "Block/Config.php",
"new_path": "Block/Config.php",
"diff": "@@ -62,7 +62,8 @@ class Config extends \\Magento\\Framework\\View\\Element\\Template\n'is_pay_only' => $this->amazonHelper->isPayOnly(),\n'is_lwa_enabled' => $this->isLwaEnabled(),\n'is_guest_checkout_enabled' => $this->amazonConfig->isGuestCheckoutEnabled(),\n- 'has_restricted_products' => $this->amazonHelper->hasRestrictedProducts()\n+ 'has_restricted_products' => $this->amazonHelper->hasRestrictedProducts(),\n+ 'is_multicurrency_enabled' => $this->amazonConfig->multiCurrencyEnabled()\n];\nreturn $config;\n"
},
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/js/amazon-button.js",
"new_path": "view/frontend/web/js/amazon-button.js",
"diff": "@@ -49,6 +49,7 @@ define([\n},\ndrawing: false,\n+ amazonPayButton: null,\n_loadButtonConfig: function (callback) {\ncheckoutSessionConfigLoad(function (checkoutSessionConfig) {\n@@ -75,16 +76,43 @@ define([\n_loadInitCheckoutPayload: function (callback, payloadType) {\ncheckoutSessionConfigLoad(function (checkoutSessionConfig) {\n+ var self = this;\nbuttonPayloadLoad(function (buttonPayload) {\n- callback({\n+ var initCheckoutPayload = {\ncreateCheckoutSessionConfig: {\npayloadJSON: buttonPayload[0],\nsignature: buttonPayload[1],\npublicKeyId: checkoutSessionConfig['public_key_id']\n}\n- });\n+ };\n+\n+ if (payloadType !== 'paynow'\n+ && !amazonStorage.isMulticurrencyEnabled\n+ && !JSON.parse(buttonPayload[0]).recurringMetadata)\n+ {\n+ initCheckoutPayload.estimatedOrderAmount = self._getEstimatedAmount();\n+ }\n+ callback(initCheckoutPayload);\n}, payloadType);\n+ }.bind(this));\n+ },\n+\n+ _getEstimatedAmount: function () {\n+ var currencyCode;\n+ var subtotal = parseFloat(customerData.get('cart')().subtotalAmount).toFixed(2);\n+\n+ checkoutSessionConfigLoad(function (checkoutSessionConfig) {\n+ currencyCode = checkoutSessionConfig['currency'];\n});\n+\n+ if (currencyCode === 'JPY') {\n+ subtotal = parseFloat(subtotal).toFixed(0);\n+ }\n+\n+ return {\n+ amount: subtotal,\n+ currencyCode: currencyCode\n+ };\n},\n/**\n@@ -138,12 +166,12 @@ define([\nthis._loadButtonConfig(function (buttonConfig) {\ntry {\n- var amazonPayButton = amazon.Pay.renderButton('#' + $buttonRoot.empty().removeUniqueId().uniqueId().attr('id'), buttonConfig);\n+ self.amazonPayButton = amazon.Pay.renderButton('#' + $buttonRoot.empty().removeUniqueId().uniqueId().attr('id'), buttonConfig);\n} catch (e) {\nconsole.log('Amazon Pay button render error: ' + e);\nreturn;\n}\n- amazonPayButton.onClick(function() {\n+ self.amazonPayButton.onClick(function() {\nif (self.buttonType === 'PayNow' && !additionalValidators.validate()) {\nreturn false;\n}\n@@ -156,7 +184,7 @@ define([\n).done(\nfunction (response) {\nif (!response.error) {\n- self._initCheckout(amazonPayButton);\n+ self._initCheckout();\n} else {\nerrorProcessor.process(response);\n}\n@@ -167,7 +195,7 @@ define([\n}\n);\n}else{\n- self._initCheckout(amazonPayButton);\n+ self._initCheckout();\n}\n});\n@@ -178,12 +206,13 @@ define([\n}\n},\n- _initCheckout: function (amazonPayButton) {\n+ _initCheckout: function () {\n+ var self = this;\nvar payloadType = this.buttonType ?\n'paynow' :\n'checkout';\nthis._loadInitCheckoutPayload(function (initCheckoutPayload) {\n- amazonPayButton.initCheckout(initCheckoutPayload);\n+ self.amazonPayButton.initCheckout(initCheckoutPayload);\n}, payloadType);\ncustomerData.invalidate('*');\n},\n@@ -200,6 +229,10 @@ define([\nif (!$(self.options.hideIfUnavailable).first().is(':visible')) {\nself._draw();\n}\n+\n+ if (self.amazonPayButton && self.buttonType !== 'PayNow') {\n+ self.amazonPayButton.updateButtonInfo(self._getEstimatedAmount());\n+ }\n});\n});\n},\n@@ -209,7 +242,6 @@ define([\n}\n});\n-\nvar cart = customerData.get('cart'),\ncustomer = customerData.get('customer'),\ncanCheckoutWithAmazon = false;\n"
},
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/js/model/storage.js",
"new_path": "view/frontend/web/js/model/storage.js",
"diff": "@@ -31,11 +31,13 @@ define([\nvar isLwaEnabled = amazonPayConfig.getValue('is_lwa_enabled');\nvar isGuestCheckoutEnabled = amazonPayConfig.getValue('is_guest_checkout_enabled');\n+ var isMulticurrencyEnabled = amazonPayConfig.getValue('is_multicurrency_enabled');\nreturn {\nisEnabled: isEnabled,\nisLwaEnabled: isLwaEnabled,\nisGuestCheckoutEnabled: isGuestCheckoutEnabled,\n+ isMulticurrencyEnabled: isMulticurrencyEnabled,\n/**\n* Is checkout using Amazon Pay?\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-943 - Add estimatedOrderAmount to checkout button payload, use updateButtonInfo when there are changes to cart |
21,269 | 21.07.2022 11:01:38 | 21,600 | e76d2fd4c37da349affc78071486c60d8487c834 | asd-946 hide AKE options for JPY-ja | [
{
"change_type": "MODIFY",
"old_path": "view/adminhtml/templates/system/config/autokeyexchange_admin.phtml",
"new_path": "view/adminhtml/templates/system/config/autokeyexchange_admin.phtml",
"diff": "*/\n/* @var \\Amazon\\Pay\\Block\\Adminhtml\\System\\Config\\AutoKeyExchangeAdmin $block */\n+$currency = strtoupper($block->getCurrency());\n?>\n<br/>\n<div data-mage-init='{\n\"Amazon_Pay/js/autokeyexchange\": <?= $block->escapeHtml($block->getJsonConfig()) ?> }'\nid=\"amazon_autokeyexchange\">\n- <?php if (!$block->getCurrency()): // Auto Key Exchange not supported ?>\n+ <?php if (!$currency): // Auto Key Exchange not supported ?>\n<div id=\"autokeyexchange_unsupported\">\n<?= $block->escapeHtml(__('An unsupported currency is currently selected. ' .\n'Please review our configuration guide.')); ?>\n</a>\n</span>\n</div>\n-\n+ <?php elseif($currency == 'JPY'): // JPY (JA) AKE not supported ?>\n+ <div></div>\n<?php else: ?>\n<div id=\"autokeyexchange-hint\">\n<?= $block->escapeHtml(\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | asd-946 hide AKE options for JPY-ja |
21,266 | 22.07.2022 12:15:33 | 14,400 | 56184fd53ae4ef5f7b1abfd5b2ca1a82bf7e3809 | Remove js dependency that accesses window.checkoutConfig
when not on checkout page | [
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/js/amazon-button.js",
"new_path": "view/frontend/web/js/amazon-button.js",
"diff": "@@ -24,7 +24,6 @@ define([\n'Magento_Checkout/js/model/payment/additional-validators',\n'mage/storage',\n'Magento_Checkout/js/model/error-processor',\n- 'Magento_Checkout/js/action/set-billing-address',\n'Magento_Ui/js/model/messageList',\n], function (\nko,\n@@ -38,7 +37,6 @@ define([\nadditionalValidators,\nstorage,\nerrorProcessor,\n- setBillingAddressAction,\nglobalMessageList\n) {\n'use strict';\n@@ -226,6 +224,7 @@ define([\nif (!customerData.get('checkout-data')().selectedBillingAddress) {\nreturn;\n} else {\n+ var setBillingAddressAction = require('Magento_Checkout/js/action/set-billing-address');\nsetBillingAddressAction(globalMessageList);\n}\n}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-849 - Remove js dependency that accesses window.checkoutConfig
when not on checkout page |
21,269 | 22.07.2022 11:22:59 | 21,600 | 9db636c44641f45e6589eeeaee2c52a5a6ebb7b9 | asd-946 add null check before strtoupper call | [
{
"change_type": "MODIFY",
"old_path": "Block/Adminhtml/System/Config/AutoKeyExchangeAdmin.php",
"new_path": "Block/Adminhtml/System/Config/AutoKeyExchangeAdmin.php",
"diff": "@@ -58,6 +58,8 @@ class AutoKeyExchangeAdmin extends \\Magento\\Framework\\View\\Element\\Template\n*/\npublic function getCurrency()\n{\n- return $this->autokeyexchange->getCurrency();\n+ $currency = $this->autokeyexchange->getCurrency();\n+ if($currency) $currency = strtoupper($currency);\n+ return $currency;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "view/adminhtml/templates/system/config/autokeyexchange_admin.phtml",
"new_path": "view/adminhtml/templates/system/config/autokeyexchange_admin.phtml",
"diff": "*/\n/* @var \\Amazon\\Pay\\Block\\Adminhtml\\System\\Config\\AutoKeyExchangeAdmin $block */\n-$currency = strtoupper($block->getCurrency());\n+$currency = $block->getCurrency();\n?>\n<br/>\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | asd-946 add null check before strtoupper call |
21,241 | 22.07.2022 13:54:47 | 18,000 | 69a01a72787b74fefe02a5c80f0ed84d8cc21ac9 | Version bump to 5.14.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.13.1\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.14.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.13.1\",\n+ \"version\": \"5.14.0\",\n\"license\": [\n\"Apache-2.0\"\n],\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Version bump to 5.14.0 and update changelog |
21,266 | 22.08.2022 13:58:08 | 14,400 | 6574b8eab3a6bd079144f1943135962f8fb543ac | Add estimated order amount to button render/updates, remove
decoupled render/checkout | [
{
"change_type": "MODIFY",
"old_path": "Api/CheckoutSessionManagementInterface.php",
"new_path": "Api/CheckoutSessionManagementInterface.php",
"diff": "@@ -22,16 +22,9 @@ interface CheckoutSessionManagementInterface\n{\n/**\n* @param string|null $cartId\n- * @param boolean $omitPayloads\n* @return mixed\n*/\n- public function getConfig($cartId = null, $omitPayloads = false);\n-\n- /**\n- * @param string $payloadType\n- * @return mixed\n- */\n- public function getButtonPayload($payloadType = 'checkout');\n+ public function getConfig($cartId = null);\n/**\n* @param mixed $amazonSessionId\n"
},
{
"change_type": "MODIFY",
"old_path": "Controller/Checkout/Config.php",
"new_path": "Controller/Checkout/Config.php",
"diff": "@@ -46,8 +46,7 @@ class Config extends \\Magento\\Framework\\App\\Action\\Action\n*/\npublic function execute()\n{\n- $omitPayloads = filter_var($this->getRequest()->getParams()['omit_payloads'], FILTER_VALIDATE_BOOLEAN);\n- $data = $this->amazonCheckoutSession->getConfig($omitPayloads);\n+ $data = $this->amazonCheckoutSession->getConfig();\nreturn $this->resultJsonFactory->create()->setData($data);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "CustomerData/CheckoutSession.php",
"new_path": "CustomerData/CheckoutSession.php",
"diff": "@@ -46,9 +46,9 @@ class CheckoutSession\n/**\n* @return array\n*/\n- public function getConfig($omitPayloads)\n+ public function getConfig()\n{\n- $data = $this->checkoutSessionManagement->getConfig(null, $omitPayloads);\n+ $data = $this->checkoutSessionManagement->getConfig();\nif (count($data) > 0) {\n$data = $data[0];\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Model/CheckoutSessionManagement.php",
"new_path": "Model/CheckoutSessionManagement.php",
"diff": "@@ -413,102 +413,43 @@ class CheckoutSessionManagement implements \\Amazon\\Pay\\Api\\CheckoutSessionManage\n/**\n* {@inheritdoc}\n*/\n- public function getConfig($cartId = null, $omitPayloads = true)\n+ public function getConfig($cartId = null)\n{\n$result = [];\n$quote = $this->session->getQuoteFromIdOrSession($cartId);\nif ($this->canCheckoutWithAmazon($quote)) {\n+ $loginButtonPayload = $this->amazonAdapter->generateLoginButtonPayload();\n+ $checkoutButtonPayload = $this->amazonAdapter->generateCheckoutButtonPayload();\n$config = [\n'merchant_id' => $this->amazonConfig->getMerchantId(),\n'currency' => $this->amazonConfig->getCurrencyCode(),\n'button_color' => $this->amazonConfig->getButtonColor(),\n'language' => $this->amazonConfig->getLanguage(),\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'public_key_id' => $this->amazonConfig->getPublicKeyId(),\n];\n- if (!$omitPayloads) {\n- $config = array_merge($config, $this->getLoginButtonPayload(), $this->getCheckoutButtonPayload());\n- }\n-\nif ($quote) {\n// Ensure the totals are up to date, in case the checkout does something to update qty or shipping\n// without collecting totals\n$quote->collectTotals();\n+ $config['pay_only'] = $this->amazonHelper->isPayOnly($quote);\n- if (!$omitPayloads) {\n- $config = array_merge($config, $this->getPayNowButtonPayload($quote));\n- }\n- }\n-\n- $result[] = $config;\n- }\n-\n- return $result;\n- }\n-\n- public function getButtonPayload($payloadType = 'checkout')\n- {\n- switch ($payloadType) {\n- case 'paynow':\n- $quote = $this->session->getQuoteFromIdOrSession();\n- return $this->getPayNowButtonPayload($quote);\n- case 'login':\n- return $this->getLoginButtonPayload();\n- default:\n- return $this->getCheckoutButtonPayload();\n- }\n- }\n-\n- /**\n- * Generate login button payload/signature pair.\n- *\n- * @return mixed\n- */\n- private function getLoginButtonPayload()\n- {\n- $loginButtonPayload = $this->amazonAdapter->generateLoginButtonPayload();\n- $result = [\n- 'login_payload' => $loginButtonPayload,\n- 'login_signature' => $this->amazonAdapter->signButton($loginButtonPayload)\n- ];\n-\n- return $result;\n- }\n-\n- /**\n- * Generate checkout button payload/signature pair.\n- *\n- * @return mixed\n- */\n- private function getCheckoutButtonPayload()\n- {\n- $checkoutButtonPayload = $this->amazonAdapter->generateCheckoutButtonPayload();\n- $result = [\n- 'checkout_payload' => $checkoutButtonPayload,\n- 'checkout_signature' => $this->amazonAdapter->signButton($checkoutButtonPayload)\n- ];\n-\n- return $result;\n- }\n-\n- /**\n- * Generate paynow payload/signature pair.\n- *\n- * @param CartInterface $quote\n- * @return mixed\n- */\n- private function getPayNowButtonPayload($quote)\n- {\n$payNowButtonPayload = $this->amazonAdapter->generatePayNowButtonPayload(\n$quote,\n$this->amazonConfig->getPaymentAction()\n);\n- $result = [\n- 'paynow_payload' => $payNowButtonPayload,\n- 'paynow_signature' => $this->amazonAdapter->signButton($payNowButtonPayload)\n- ];\n+ $config['paynow_payload'] = $payNowButtonPayload;\n+ $config['paynow_signature'] = $this->amazonAdapter->signButton($payNowButtonPayload);\n+ }\n+\n+ $result[] = $config;\n+ }\nreturn $result;\n}\n"
},
{
"change_type": "DELETE",
"old_path": "Plugin/CustomerData/Cart.php",
"new_path": null,
"diff": "-<?php\n-\n-namespace Amazon\\Pay\\Plugin\\CustomerData;\n-\n-use Magento\\Checkout\\Model\\Session;\n-\n-class Cart\n-{\n- /**\n- * @var Session\n- */\n- protected $checkoutSession;\n-\n- /**\n- * @param Session $checkoutSession\n- */\n- public function __construct(\n- Session $checkoutSession\n- ) {\n- $this->checkoutSession = $checkoutSession;\n- }\n-\n- /**\n- * @param \\Magento\\Checkout\\CustomerData\\Cart $subject\n- * @param $result\n- * @return mixed\n- * @throws \\Magento\\Framework\\Exception\\LocalizedException\n- * @throws \\Magento\\Framework\\Exception\\NoSuchEntityException\n- *\n- * Adds virtual cart flag to the cart local storage for button rendering\n- */\n- public function afterGetSectionData(\n- \\Magento\\Checkout\\CustomerData\\Cart $subject,\n- $result\n- ) {\n- $result['amzn_pay_only'] = $this->checkoutSession->getQuote()->isVirtual();\n-\n- return $result;\n- }\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "etc/di.xml",
"new_path": "etc/di.xml",
"diff": "<type name=\"Magento\\Sales\\Model\\Order\">\n<plugin name=\"amazon_payv2_legacy_order\" type=\"Amazon\\Pay\\Plugin\\LegacyPaymentHandler\" />\n</type>\n- <type name=\"Magento\\Checkout\\CustomerData\\Cart\">\n- <plugin name=\"amazon_pay_customerdata_cart\" type=\"Amazon\\Pay\\Plugin\\CustomerData\\Cart\" />\n- </type>\n</config>\n"
},
{
"change_type": "MODIFY",
"old_path": "etc/webapi.xml",
"new_path": "etc/webapi.xml",
"diff": "<resources>\n<resource ref=\"anonymous\" />\n</resources>\n- <data>\n- <parameter name=\"omitPayloads\">%omit_payloads%</parameter>\n- </data>\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- <data>\n- <parameter name=\"omitPayloads\">%omit_payloads%</parameter>\n- </data>\n- </route>\n- <route method=\"GET\" url=\"/V1/amazon-checkout-session/button-payload/:payloadType\">\n- <service class=\"Amazon\\Pay\\Api\\CheckoutSessionManagementInterface\" method=\"getButtonPayload\"/>\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"
},
{
"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": "@@ -22,30 +22,32 @@ define([\n], function ($, _, remoteStorage, url, customerData) {\n'use strict';\n- const storageKey = 'amzn-checkout-session-config';\n- $('.switcher-option').on('click', function () {\n- $.localStorage.remove(storageKey);\n- });\n-\n+ var callbacks = [];\nvar localStorage = null;\nvar getLocalStorage = function () {\nif (localStorage === null) {\n- localStorage = $.initNamespaceStorage(storageKey).localStorage;\n+ localStorage = $.initNamespaceStorage('amzn-checkout-session-config').localStorage;\n}\nreturn localStorage;\n};\n- return function (callback, omitPayloads = true) {\n+ return function (callback, forceReload = false) {\nvar cartId = customerData.get('cart')()['data_id'] || window.checkout.storeId;\nvar config = getLocalStorage().get('config') || false;\n- if (!config) {\n- remoteStorage.get(url.build(`amazon_pay/checkout/config?omit_payloads=${omitPayloads}`)).done(function (config) {\n+ if (forceReload\n+ || cartId !== getLocalStorage().get('cart_id')\n+ || typeof config.checkout_payload === 'undefined'\n+ || !config.checkout_payload.includes(document.URL.slice(0, -1))) {\n+ callbacks.push(callback);\n+ if (callbacks.length == 1) {\n+ remoteStorage.get(url.build('amazon_pay/checkout/config')).done(function (config) {\ngetLocalStorage().set('cart_id', cartId);\ngetLocalStorage().set('config', config);\n-\n- callback(getLocalStorage().get('config'));\n+ do {\n+ callbacks.shift()(config);\n+ } while (callbacks.length);\n});\n}\n- else {\n+ } else {\ncallback(getLocalStorage().get('config'));\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "view/frontend/web/js/amazon-button.js",
"new_path": "view/frontend/web/js/amazon-button.js",
"diff": "@@ -16,7 +16,6 @@ define([\n'ko',\n'jquery',\n'Amazon_Pay/js/action/checkout-session-config-load',\n- 'Amazon_Pay/js/action/checkout-session-button-payload-load',\n'Amazon_Pay/js/model/storage',\n'mage/url',\n'Amazon_Pay/js/amazon-checkout',\n@@ -29,7 +28,6 @@ define([\nko,\n$,\ncheckoutSessionConfigLoad,\n- buttonPayloadLoad,\namazonStorage,\nurl,\namazonCheckout,\n@@ -52,20 +50,43 @@ define([\ndrawing: false,\namazonPayButton: null,\n+ currencyCode: null,\n- _loadButtonConfig: function (callback) {\n+ _loadButtonConfig: function (callback, forceReload = false) {\ncheckoutSessionConfigLoad(function (checkoutSessionConfig) {\nif (!$.isEmptyObject(checkoutSessionConfig)) {\n- callback({\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+ }\n+\n+ self.currencyCode = checkoutSessionConfig['currency'];\n+\n+ var buttonConfig = {\nmerchantId: checkoutSessionConfig['merchant_id'],\npublicKeyId: checkoutSessionConfig['public_key_id'],\n- ledgerCurrency: checkoutSessionConfig['currency'],\n+ ledgerCurrency: self.currencyCode,\nsandbox: checkoutSessionConfig['sandbox'],\ncheckoutLanguage: checkoutSessionConfig['language'],\n- productType: this._isPayOnly() ? 'PayOnly' : 'PayAndShip',\n+ productType: this._isPayOnly(checkoutSessionConfig['pay_only']) ? 'PayOnly' : 'PayAndShip',\nplacement: this.options.placement,\n- buttonColor: checkoutSessionConfig['button_color']\n- });\n+ buttonColor: checkoutSessionConfig['button_color'],\n+ createCheckoutSessionConfig: {\n+ payloadJSON: payload,\n+ signature: signature,\n+ publicKeyId: checkoutSessionConfig['public_key_id'],\n+ }\n+ };\n+\n+ if (this._shouldUseEstimatedAmount())\n+ {\n+ buttonConfig.estimatedOrderAmount = this._getEstimatedAmount();\n+ }\n+\n+ callback(buttonConfig);\nif (this.options.placement !== \"Checkout\") {\n$(this.options.hideIfUnavailable).show();\n@@ -73,68 +94,33 @@ define([\n} else {\n$(this.options.hideIfUnavailable).hide();\n}\n- }.bind(this));\n- },\n-\n- _loadInitCheckoutPayload: function (callback, payloadType) {\n- checkoutSessionConfigLoad(function (checkoutSessionConfig) {\n- var self = this;\n- buttonPayloadLoad(function (buttonPayload) {\n- var initCheckoutPayload = {\n- createCheckoutSessionConfig: {\n- payloadJSON: buttonPayload[0],\n- signature: buttonPayload[1],\n- publicKeyId: checkoutSessionConfig['public_key_id']\n- }\n- };\n-\n- if (payloadType !== 'paynow'\n- && !amazonStorage.isMulticurrencyEnabled\n- && !JSON.parse(buttonPayload[0]).recurringMetadata)\n- {\n- initCheckoutPayload.estimatedOrderAmount = self._getEstimatedAmount();\n- }\n- callback(initCheckoutPayload);\n- }, payloadType);\n- }.bind(this));\n+ }.bind(this), forceReload);\n},\n_getEstimatedAmount: function () {\n- var currencyCode;\n- var subtotal = parseFloat(customerData.get('cart')().subtotalAmount).toFixed(2);\n-\n- checkoutSessionConfigLoad(function (checkoutSessionConfig) {\n- currencyCode = checkoutSessionConfig['currency'];\n- });\n+ var subtotal = (parseFloat(customerData.get('cart')().subtotalAmount) || 0).toFixed(2);\n- if (currencyCode === 'JPY') {\n+ if (self.currencyCode === 'JPY') {\nsubtotal = parseFloat(subtotal).toFixed(0);\n}\nreturn {\namount: subtotal,\n- currencyCode: currencyCode\n+ currencyCode: self.currencyCode\n};\n},\n/**\n+ * @param {boolean} isCheckoutSessionPayOnly\n* @returns {boolean}\n* @private\n*/\n- _isPayOnly: function () {\n- var cartData = customerData.get('cart');\n-\n- // No cart data yet or cart is empty, for the pdp button\n- if (typeof cartData().amzn_pay_only === 'undefined' || parseInt(cartData().summary_count) === 0) {\n- return this.options.payOnly\n+ _isPayOnly: function (isCheckoutSessionPayOnly) {\n+ var result = isCheckoutSessionPayOnly;\n+ if (result && this.options.payOnly !== null) {\n+ result = this.options.payOnly;\n}\n-\n- // Check if cart has items and it's the pdp button\n- if (parseInt(cartData().summary_count) > 0 && this.options.payOnly !== null) {\n- return cartData().amzn_pay_only && this.options.payOnly;\n- }\n-\n- return cartData().amzn_pay_only;\n+ return result;\n},\n/**\n@@ -167,18 +153,26 @@ define([\n$buttonContainer.empty().append($buttonRoot);\nthis._loadButtonConfig(function (buttonConfig) {\n+ // do not use session config for decoupled button\n+ if (self.buttonType === 'PayNow') {\n+ delete buttonConfig.createCheckoutSessionConfig;\n+ }\n+\ntry {\nself.amazonPayButton = amazon.Pay.renderButton('#' + $buttonRoot.empty().removeUniqueId().uniqueId().attr('id'), buttonConfig);\n} catch (e) {\nconsole.log('Amazon Pay button render error: ' + e);\nreturn;\n}\n+\n+ // If onClick is available on the amazonPayButton, then checkout is decoupled from render, indicating this is an APB button\n+ if (self.amazonPayButton.onClick) {\nself.amazonPayButton.onClick(function() {\n- if (self.buttonType === 'PayNow' && !additionalValidators.validate()) {\n+ if (!additionalValidators.validate()) {\nreturn false;\n}\n//This is for compatibility with Iosc. We need to update the customer's Magento session before getting the final config and payload\n- if (self.buttonType === 'PayNow' && self.options.isIosc()) {\n+ if (self.options.isIosc()) {\nstorage.post(\n'checkout/onepage/update',\n\"{}\",\n@@ -200,6 +194,7 @@ define([\nself._initCheckout();\n}\n});\n+ }\n$('.amazon-button-container .field-tooltip').fadeIn();\nself.drawing = false;\n@@ -229,17 +224,15 @@ define([\n}\n}\n- var payloadType = this.buttonType ?\n- 'paynow' :\n- 'checkout';\n- this._loadInitCheckoutPayload(function (initCheckoutPayload) {\n- self.amazonPayButton.initCheckout(initCheckoutPayload);\n- }, payloadType);\n+ this._loadButtonConfig(function (buttonConfig) {\n+ var initConfig = {createCheckoutSessionConfig: buttonConfig.createCheckoutSessionConfig};\n+ self.amazonPayButton.initCheckout(initConfig);\n+ }, true);\ncustomerData.invalidate('*');\n},\n/**\n- * Redraw button if needed\n+ * Update button if needed\n**/\n_subscribeToCartUpdates: function () {\nvar self = this;\n@@ -247,17 +240,25 @@ define([\namazonCheckout.withAmazonCheckout(function (amazon, args) {\nvar cartData = customerData.get('cart');\ncartData.subscribe(function (updatedCart) {\n- if (!$(self.options.hideIfUnavailable).first().is(':visible')) {\n- self._draw();\n+ if (self.options.placement === 'Cart') {\n+ delete self.amazonPayButton;\n}\n-\n- if (self.amazonPayButton && self.buttonType !== 'PayNow') {\n+ if (self.amazonPayButton && self._shouldUseEstimatedAmount())\n+ {\n+ if (updatedCart.summary_count !== 0) {\nself.amazonPayButton.updateButtonInfo(self._getEstimatedAmount());\n}\n+ }\n});\n});\n},\n+ _shouldUseEstimatedAmount: function () {\n+ return this.options.buttonType !== 'PayNow'\n+ && this.options.placement !== 'Product'\n+ && !amazonStorage.isMulticurrencyEnabled;\n+ },\n+\nclick: function () {\nthis.element.children().first().trigger('click');\n}\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | ASD-943 - Add estimated order amount to button render/updates, remove
decoupled render/checkout |
21,266 | 24.08.2022 09:20:28 | 14,400 | 3392cbb0bfb1c7158138293ede920a0bcb255e56 | Version bump to 5.14.1 and update changelog | [
{
"change_type": "MODIFY",
"old_path": "CHANGELOG.md",
"new_path": "CHANGELOG.md",
"diff": "# Change Log\n+## 5.14.1\n+* Changed how buttons are rendered for compatibility with estimated order amount feature\n+* Removed estimated order amount from PDP button\n+\n## 5.14.0\n* Added configurable options for checkout and signin cancel return urls\n* Added estimated order amount to the button payload\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.14.0\n+2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.14.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.14.0\",\n+ \"version\": \"5.14.1\",\n\"license\": [\n\"Apache-2.0\"\n],\n"
}
] | PHP | Apache License 2.0 | amzn/amazon-payments-magento-2-plugin | Version bump to 5.14.1 and update changelog |
737,825 | 19.12.2019 22:11:59 | -28,800 | ebff8c8f14559928cb5365152770d20aa5082221 | Add personal infomation | [
{
"change_type": "MODIFY",
"old_path": ".gitignore",
"new_path": ".gitignore",
"diff": "@@ -14,3 +14,4 @@ Gemfile.lock\nnode_modules\nnpm-debug.log*\nvendor/bundle\n+.idea\n"
},
{
"change_type": "MODIFY",
"old_path": "_config.yml",
"new_path": "_config.yml",
"diff": "# theme : \"minimal-mistakes-jekyll\"\n# remote_theme : \"mmistakes/minimal-mistakes\"\n-minimal_mistakes_skin : \"default\" # \"air\", \"aqua\", \"contrast\", \"dark\", \"dirt\", \"neon\", \"mint\", \"plum\", \"sunrise\"\n+minimal_mistakes_skin : \"plum\" # \"air\", \"aqua\", \"contrast\", \"dark\", \"dirt\", \"neon\", \"mint\", \"plum\", \"sunrise\"\n# Site Settings\nlocale : \"en-US\"\n-title : \"Site Title\"\n+title : \"World Wonderer\"\ntitle_separator : \"-\"\nsubtitle : # site tagline that appears below site title in masthead\n-name : \"Your Name\"\n-description : \"An amazing website.\"\n+name : \"P\"\n+description : \"Reverse engineering | Web crawler\"\nurl : # the base hostname & protocol for your site e.g. \"https://mmistakes.github.io\"\nbaseurl : # the subpath of your site, e.g. \"/blog\"\nrepository : # GitHub username/repo-name e.g. \"mmistakes/minimal-mistakes\"\n@@ -107,15 +107,15 @@ analytics:\n# Site Author\nauthor:\n- name : \"Your Name\"\n+ name : \"P\"\navatar : # path of avatar image, e.g. \"/assets/images/bio-photo.jpg\"\n- bio : \"I am an **amazing** person.\"\n- location : \"Somewhere\"\n+ bio : \"Reverse engineering | Web crawler\"\n+ location : \"Beijing\"\nemail :\nlinks:\n- label: \"Email\"\nicon: \"fas fa-fw fa-envelope-square\"\n- # url: mailto:[email protected]\n+ url: mailto:[email protected]\n- label: \"Website\"\nicon: \"fas fa-fw fa-link\"\n# url: \"https://your-website.com\"\n@@ -127,7 +127,7 @@ author:\n# url: \"https://facebook.com/\"\n- label: \"GitHub\"\nicon: \"fab fa-fw fa-github\"\n- # url: \"https://github.com/\"\n+ url: \"https://github.com/worldwonderer\"\n- label: \"Instagram\"\nicon: \"fab fa-fw fa-instagram\"\n# url: \"https://instagram.com/\"\n"
}
] | JavaScript | MIT License | worldwonderer/worldwonderer.github.io | Add personal infomation |
737,825 | 19.12.2019 22:25:29 | -28,800 | 439fc9e7b57e83f36112573dfeb01135b7b6a417 | Add proxy tower post | [
{
"change_type": "MODIFY",
"old_path": "_config.yml",
"new_path": "_config.yml",
"diff": "@@ -21,7 +21,7 @@ title_separator : \"-\"\nsubtitle : # site tagline that appears below site title in masthead\nname : \"P\"\ndescription : \"Reverse engineering | Web crawler\"\n-url : # the base hostname & protocol for your site e.g. \"https://mmistakes.github.io\"\n+url : \"https://worldwonderer.github.io/\"\nbaseurl : # the subpath of your site, e.g. \"/blog\"\nrepository : # GitHub username/repo-name e.g. \"mmistakes/minimal-mistakes\"\nteaser : # path of fallback teaser image, e.g. \"/assets/images/500x300.png\"\n@@ -108,10 +108,10 @@ analytics:\n# Site Author\nauthor:\nname : \"P\"\n- avatar : # path of avatar image, e.g. \"/assets/images/bio-photo.jpg\"\n+ avatar : \"/assets/images/bio-photo.jpg\"\nbio : \"Reverse engineering | Web crawler\"\nlocation : \"Beijing\"\n- email :\n+ email : \"[email protected]\"\nlinks:\n- label: \"Email\"\nicon: \"fas fa-fw fa-envelope-square\"\n@@ -290,7 +290,7 @@ defaults:\nauthor_profile: true\nread_time: true\ncomments: # true\n- share: true\n+ share: # true\nrelated: true\ntheme: jekyll-theme-slate\n\\ No newline at end of file\n"
},
{
"change_type": "DELETE",
"old_path": "_posts/2019-12-19-test.md",
"new_path": "_posts/2019-12-19-test.md",
"diff": ""
},
{
"change_type": "ADD",
"old_path": "assets/images/bio-photo.jpg",
"new_path": "assets/images/bio-photo.jpg",
"diff": "Binary files /dev/null and b/assets/images/bio-photo.jpg differ\n"
}
] | JavaScript | MIT License | worldwonderer/worldwonderer.github.io | Add proxy tower post |
737,825 | 19.12.2019 22:30:13 | -28,800 | d564e937687aff5c82976c14b70acd0b7e098b28 | Delete navigation.yml | [
{
"change_type": "DELETE",
"old_path": "_data/navigation.yml",
"new_path": null,
"diff": "-# main links\n-main:\n- - title: \"Quick-Start Guide\"\n- url: https://mmistakes.github.io/minimal-mistakes/docs/quick-start-guide/\n- # - title: \"About\"\n- # url: https://mmistakes.github.io/minimal-mistakes/about/\n- # - title: \"Sample Posts\"\n- # url: /year-archive/\n- # - title: \"Sample Collections\"\n- # url: /collection-archive/\n- # - title: \"Sitemap\"\n- # url: /sitemap/\n\\ No newline at end of file\n"
}
] | JavaScript | MIT License | worldwonderer/worldwonderer.github.io | Delete navigation.yml |
737,825 | 19.12.2019 23:41:50 | -28,800 | 6b5d9bad44f59fb867aa8edc834f0e6af2c01feb | Add extract_picture tool | [
{
"change_type": "ADD",
"old_path": "assets/images/20191219/0.jpg",
"new_path": "assets/images/20191219/0.jpg",
"diff": "Binary files /dev/null and b/assets/images/20191219/0.jpg differ\n"
},
{
"change_type": "ADD",
"old_path": "assets/images/20191219/1.jpg",
"new_path": "assets/images/20191219/1.jpg",
"diff": "Binary files /dev/null and b/assets/images/20191219/1.jpg differ\n"
},
{
"change_type": "ADD",
"old_path": "assets/images/20191219/2.jpg",
"new_path": "assets/images/20191219/2.jpg",
"diff": "Binary files /dev/null and b/assets/images/20191219/2.jpg differ\n"
},
{
"change_type": "ADD",
"old_path": "assets/images/20191219/3.jpg",
"new_path": "assets/images/20191219/3.jpg",
"diff": "Binary files /dev/null and b/assets/images/20191219/3.jpg differ\n"
},
{
"change_type": "ADD",
"old_path": "assets/images/20191219/4.jpg",
"new_path": "assets/images/20191219/4.jpg",
"diff": "Binary files /dev/null and b/assets/images/20191219/4.jpg differ\n"
},
{
"change_type": "ADD",
"old_path": "assets/images/20191219/5.jpg",
"new_path": "assets/images/20191219/5.jpg",
"diff": "Binary files /dev/null and b/assets/images/20191219/5.jpg differ\n"
},
{
"change_type": "ADD",
"old_path": "assets/images/20191219/6.jpg",
"new_path": "assets/images/20191219/6.jpg",
"diff": "Binary files /dev/null and b/assets/images/20191219/6.jpg differ\n"
},
{
"change_type": "ADD",
"old_path": "assets/images/20191219/7.jpg",
"new_path": "assets/images/20191219/7.jpg",
"diff": "Binary files /dev/null and b/assets/images/20191219/7.jpg differ\n"
},
{
"change_type": "ADD",
"old_path": "assets/images/20191219/8.jpg",
"new_path": "assets/images/20191219/8.jpg",
"diff": "Binary files /dev/null and b/assets/images/20191219/8.jpg differ\n"
},
{
"change_type": "ADD",
"old_path": "assets/images/20191219/9.jpg",
"new_path": "assets/images/20191219/9.jpg",
"diff": "Binary files /dev/null and b/assets/images/20191219/9.jpg differ\n"
}
] | JavaScript | MIT License | worldwonderer/worldwonderer.github.io | Add extract_picture tool |
737,825 | 16.02.2020 23:18:07 | -28,800 | 7d66167c22cd92ce02b9460af6fa36fc452d1041 | Remove subtitle and change words_per_minute | [
{
"change_type": "MODIFY",
"old_path": "_config.yml",
"new_path": "_config.yml",
"diff": "@@ -18,7 +18,7 @@ minimal_mistakes_skin : \"sunrise\" # \"air\", \"aqua\", \"contrast\", \"dark\", \"dirt\"\nlocale : \"en-US\"\ntitle : \"World Wonderer\"\ntitle_separator : \"-\"\n-subtitle : \"Reverse engineering & Web crawler\"\n+subtitle : \"\"\nname : \"P\"\ndescription : \"Reverse engineering & Web crawler\"\nurl : \"https://worldwonderer.github.io/\"\n@@ -28,7 +28,7 @@ teaser : # path of fallback teaser image, e.g. \"/assets/images\nlogo : \"/assets/images/bio-photo_88x88.jpg\"\nmasthead_title : # overrides the website title displayed in the masthead, use \" \" for no title\n# breadcrumbs : false # true, false (default)\n-words_per_minute : 200\n+words_per_minute : 100\ncomments:\nprovider : \"disqus\"\ndisqus:\n"
}
] | JavaScript | MIT License | worldwonderer/worldwonderer.github.io | Remove subtitle and change words_per_minute |
737,825 | 16.02.2020 23:20:44 | -28,800 | acae37b0efc3a5291c77c5b46a3b525c1f68cee2 | Remove logo and change words_per_minute | [
{
"change_type": "MODIFY",
"old_path": "_config.yml",
"new_path": "_config.yml",
"diff": "@@ -25,10 +25,10 @@ url : \"https://worldwonderer.github.io/\"\nbaseurl : # the subpath of your site, e.g. \"/blog\"\nrepository : # GitHub username/repo-name e.g. \"mmistakes/minimal-mistakes\"\nteaser : # path of fallback teaser image, e.g. \"/assets/images/500x300.png\"\n-logo : \"/assets/images/bio-photo_88x88.jpg\"\n+logo : # \"/assets/images/bio-photo_88x88.jpg\"\nmasthead_title : # overrides the website title displayed in the masthead, use \" \" for no title\n# breadcrumbs : false # true, false (default)\n-words_per_minute : 100\n+words_per_minute : 50\ncomments:\nprovider : \"disqus\"\ndisqus:\n"
}
] | JavaScript | MIT License | worldwonderer/worldwonderer.github.io | Remove logo and change words_per_minute |
258,422 | 27.02.2020 01:37:29 | 18,000 | 46d2b087ab71dd76376b08524c9312d91e141476 | Add disclaimer to report. | [
{
"change_type": "MODIFY",
"old_path": "analysis/report_templates/default.html",
"new_path": "analysis/report_templates/default.html",
"diff": "<!-- Import Materialize CSS -->\n<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css\">\n+ <!-- Import Materialize Icons -->\n+ <link href=\"https://fonts.googleapis.com/icon?family=Material+Icons\" rel=\"stylesheet\">\n</head>\n<body>\n{{ experiment.name }} report\n</h1>\n+ <div class=\"card-panel amber lighten-5\">\n+ <div class=\"row\">\n+ <div class=\"col s1\">\n+ <i class=\"medium material-icons\">warning</i>\n+ </div>\n+ <div class=\"col s11\">\n+ <span class=\"black-text\">\n+ Please consider this as a preliminary report to\n+ demonstrate the capabilities of FuzzBench. While we have\n+ tried our best, we have not confirmed that we configured\n+ everything correctly. We are hoping to work together\n+ with the community to validate results and improve the\n+ set of fuzzers, benchmarks, and their configurations in\n+ the future.\n+ See <a href=\"https://google.github.io/fuzzbench/faq\">FAQ</a>\n+ for more details.\n+ </span>\n+ </div>\n+ </div>\n+ </div>\n+\n<div id=\"experiment\" class=\"section scrollspy\">\n<h2 class=\"green-text text-darken-3\">experiment summary</h2>\nAggregate critical difference diagram showing average ranks when\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Add disclaimer to report. (#3) |
258,388 | 27.02.2020 18:32:26 | 28,800 | 4d66f458cbc88aae71db3f09224773f9f3feccc2 | Remove `$ ` from in front of bash commands.
It makes copy-paste harder. | [
{
"change_type": "MODIFY",
"old_path": "docs/README.md",
"new_path": "docs/README.md",
"diff": "@@ -4,19 +4,19 @@ Use the following instructions to make documentation changes locally.\n## Prerequisites\n```bash\n-$ sudo apt install ruby bundler\n-$ bundle install --path vendor/bundle\n+sudo apt install ruby bundler\n+bundle install --path vendor/bundle\n```\n## Serving locally\n```bash\n-$ bundle exec jekyll serve\n+bundle exec jekyll serve\n```\nor from the project root:\n```bash\n-$ make docs-serve\n+make docs-serve\n```\n## Theme documentation\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/getting-started/adding_a_new_fuzzer.md",
"new_path": "docs/getting-started/adding_a_new_fuzzer.md",
"diff": "@@ -23,9 +23,9 @@ subdirectory will be the name of the fuzzer. The fuzzer name can contain\nalphanumeric characters and underscores and must be a valid python module.\n```bash\n-$ export FUZZER_NAME=<your_fuzzer_name>\n-$ cd fuzzers\n-$ mkdir $FUZZER_NAME\n+export FUZZER_NAME=<your_fuzzer_name>\n+cd fuzzers\n+mkdir $FUZZER_NAME\n```\nYou can verify the name of your fuzzer is valid by running `make run-presubmit`\n@@ -222,21 +222,21 @@ successfully:\n* Build a specific benchmark:\n```shell\n-$ export FUZZER_NAME=afl\n-$ export BENCHMARK_NAME=libpng-1.2.56\n-$ make build-$FUZZER_NAME-$BENCHMARK_NAME\n+export FUZZER_NAME=afl\n+export BENCHMARK_NAME=libpng-1.2.56\n+make build-$FUZZER_NAME-$BENCHMARK_NAME\n```\n* Run the fuzzer in the docker image:\n```shell\n-$ make run-$FUZZER_NAME-$BENCHMARK_NAME\n+make run-$FUZZER_NAME-$BENCHMARK_NAME\n```\n* Building all benchmarks for a fuzzer:\n```shell\n-$ make build-$FUZZER_NAME-all\n+make build-$FUZZER_NAME-all\n```\n*Tips*:\n@@ -245,23 +245,23 @@ $ make build-$FUZZER_NAME-all\n* Start a new shell and run fuzzer there:\n```shell\n- $ make debug-$FUZZER_NAME-$BENCHMARK_NAME\n+ make debug-$FUZZER_NAME-$BENCHMARK_NAME\n```\n* Or, debug an existing fuzzer run in the `make run-*` docker container:\n```shell\n- $ docker container ls\n- $ docker exec -ti <container-id> /bin/bash\n+ docker container ls\n+ docker exec -ti <container-id> /bin/bash\n# E.g. check corpus.\n- $ ls /out/corpus\n+ ls /out/corpus\n```\n* To do builds in parallel, pass -j <number_of_parallel_jobs> to make:\n```shell\n- $ make -j6 build-$FUZZER_NAME-all\n+ make -j6 build-$FUZZER_NAME-all\n```\n* Run `make run-format` to format your code.\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/getting-started/contributing_code.md",
"new_path": "docs/getting-started/contributing_code.md",
"diff": "@@ -32,7 +32,7 @@ FuzzBench.\nYou can run all checks and unit tests for the core functionality using:\n```bash\n-$ make run-presubmit\n+make run-presubmit\n```\nYou can also run the following to format your code or do different checks\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/getting-started/prerequisites.md",
"new_path": "docs/getting-started/prerequisites.md",
"diff": "@@ -21,9 +21,9 @@ This page explains how to set up your environment for using FuzzBench.\nClone the FuzzBench repository to your machine by running the following command:\n```bash\n-$ git clone https://github.com/google/fuzzbench\n-$ cd fuzzbench\n-$ git submodule update --init\n+git clone https://github.com/google/fuzzbench\n+cd fuzzbench\n+git submodule update --init\n```\n## Installing prerequisites\n@@ -45,7 +45,7 @@ docker images periodically.\nInstall make for your linux distribution. E.g. for Ubuntu:\n```bash\n-$ sudo apt-get install build-essential\n+sudo apt-get install build-essential\n```\n### Python programming language\n@@ -61,14 +61,14 @@ If you already have Python installed, you can verify its version by running\nInstall the python dependencies by running the following command:\n```bash\n-$ make install-dependencies\n+make install-dependencies\n```\nThis installs all the dependencies in a virtualenv `.venv`. Activate this\nvirtualenv before running furthur commands.\n```bash\n-$ source .venv/bin/activate\n+source .venv/bin/activate\n```\nYou can exit from this virtualenv anytime using the `deactivate` command.\n@@ -79,7 +79,7 @@ You can verify that your local setup is working correctly by running the\npresubmit checks.\n```bash\n-$ make run-presubmit\n+make run-presubmit\n```\n### Formatting\n@@ -87,5 +87,5 @@ $ make run-presubmit\nYou can format your changes using the following command:\n```bash\n-$ make run-format\n+make run-format\n```\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Remove `$ ` from in front of bash commands. (#6)
It makes copy-paste harder. |
258,388 | 28.02.2020 11:28:26 | 28,800 | 731fb10ddf364527ed18c84d61177aeb63611a31 | Add .pytype to .gitignore | [
{
"change_type": "MODIFY",
"old_path": ".gitignore",
"new_path": ".gitignore",
"diff": "# See the License for the specific language governing permissions and\n# limitations under the License.\n-# Byte-compiled / optimized / DLL files\n+# Byte-compiled / optimized / DLL files.\n__pycache__/\n*.py[cod]\n*$py.class\n-# Environments\n+.pytype/\n+\n+# Virtual environments.\n.env\n.venv\nenv/\nvenv/\nENV/\n-# Reports generated by FuzzBench\n+# Reports generated by FuzzBench.\nreport/\n-# Directories created by Jekyll\n+# Directories created by Jekyll.\n.bundle/\ndocs/_site/\ndocs/vendor/\n\\ No newline at end of file\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Add .pytype to .gitignore (#10) |
258,388 | 28.02.2020 13:08:06 | 28,800 | ea3129e7e02255ca664083705512b277a1ac2040 | [docs] Add docs on setting up a google cloud project.
Also define what an experiment is and improve the running_an_experiment.md doc. | [
{
"change_type": "MODIFY",
"old_path": "docs/advanced-topics/running_an_experiment.md",
"new_path": "docs/advanced-topics/running_an_experiment.md",
"diff": "layout: default\ntitle: Running an experiment\nparent: Advanced topics\n-nav_order: 1\n+nav_order: 3\npermalink: /advanced-topics/running-an-experiment/\n---\n# Running an experiment\n-This page explains how to run an experiment. It requires using Google Cloud.\n-Because most \"users\" of FuzzBench will be using it as a service and not running\n-it themselves, we consider this an advanced topic.\n+**NOTE**: Most users of FuzzBench should simply [add a fuzzer]({{ site.baseurl\n+}}/getting-started/adding-a-new-fuzzer/) and use the FuzzBench service. This\n+document isn't needed for using the FuzzBench service. This document explains\n+how to run an [experiment]({{ site.baseurl }}/reference/glossary/#Experiment) on\n+your own. We don't recommend running experiments on your own for most users.\n+Validating results from the FuzzBench service is a good reason to run an\n+experiment on your own.\n+\n+This document assumes a certain level of knowledge about\n+Google Cloud and FuzzBench. If you haven't already, please follow the\n+[guide on setting up a Google Cloud Project]({{ site.baseurl}}/advanced-topics/setting-up-a-google-cloud-project/)\n+to run your own experiments. This document assumes you already have set up a\n+Google Cloud Project, since running an experiment requires Google Cloud.\n- TOC\n{:toc}\n-Experiments are started by the `run_experiment.py` script. This will create a\n-dispatcher instance on Google Compute Engine which:\n-1. Builds desired fuzzer-benchmark combinations.\n-1. Starts instances to run fuzzing trials with the fuzzer-benchmark\n- builds and stops them when they are done.\n-1. Measures the coverage from these trials.\n-1. Generates reports based on these measurements.\n+This page will walk you through on how to use `run_experiment.py`.\n+Experiments are started by the `run_experiment.py` script. The script will\n+create a dispatcher instance on Google Compute Engine which runs the experiment,\n+including:\n+1. Building desired fuzzer-benchmark combinations.\n+1. Starting instances to run fuzzing trials with the fuzzer-benchmark\n+ builds and stopping them when they are done.\n+1. Measuring the coverage from these trials.\n+1. Generating reports based on these measurements.\n-This page will walkthrough on how to use `run_experiment.py`.\n+The rest of this document will assume all commands are run from the root of\n+FuzzBench.\n# run_experiment.py\n-This page assumes a certain level of knowledge about Google Cloud and FuzzBench.\n-If you haven't already, please check out the guide on setting up a Google Cloud\n-Project to run FuzzBench.\n-{% comment %}\n-TODO(metzman): Write this doc.\n-{% endcomment %}\n-\n## Experiment configuration file\nYou need to create an experiment configuration yaml file.\n-This will contain the configuration parameters for experiments that do not\n+This file contains the configuration parameters for experiments that do not\nchange very often.\nBelow is an example configuration file with explanations of each required\nparameter.\n@@ -47,23 +53,32 @@ parameter.\ntrials: 5\n# The amount of time in seconds that each trial is run for.\n+# 1 day = 24 * 60 * 60 = 86400\nmax_total_time: 86400\n# The name of your Google Cloud project.\n-cloud_project: fuzzbench\n+cloud_project: $PROJECT_NAME\n# The Google Compute Engine zone to run the experiment in.\n-cloud_compute_zone: us-central1-a\n+cloud_compute_zone: $PROJECT_REGION\n# The Google Cloud Storage bucket that will store most of the experiment data.\n-cloud_experiment_bucket: gs://fuzzbench-data\n+cloud_experiment_bucket: gs://$DATA_BUCKET_NAME\n# The bucket where HTML reports and summary data will be stored.\n-cloud_web_bucket: gs://fuzzbench-reports\n+cloud_web_bucket: gs://$REPORT_BUCKET_NAME\n# The connection to use to connect to the Google Cloud SQL instance.\n-cloud_sql_instance_connection_name: \"fuzzbench:us-central1:postgres-experiment-db=tcp:5432\"\n+cloud_sql_instance_connection_name: \"$PROJECT_NAME:$PROJECT_REGION:$POSTGRES_INSTANCE=tcp:5432\"\n```\n+\n+**NOTE:** The values `$PROJECT_NAME`, `$PROJECT_REGION` `$DATA_BUCKET_NAME`,\n+`$REPORT_BUCKET_NAME` `$POSTGRES_INSTANCE` refer to the values of those\n+environment variables that were set in the [guide on setting up a Google Cloud\n+Project]({{ site.baseurl }}/advanced-topics/setting-up-a-google-cloud-project/).\n+For example if `$PROJECT_NAME` is `my-fuzzbench-project`, use\n+`my-fuzzbench-project` and not `$PROJECT_NAME`.\n+\n## Setting the database password\nFind the password for the PostgreSQL instance you are using in your\n@@ -71,28 +86,42 @@ experiment config.\nSet it using the environment variable `POSTGRES_PASSWORD` like so:\n```bash\n-export POSTGRESS_PASSWORD=\"my-super-secret-password\"\n+export POSTGRES_PASSWORD=\"my-super-secret-password\"\n```\n## Benchmarks\n+\nPick the benchmarks you want to use from the `benchmarks/` directory.\n+\nFor example: `freetype2-2017` and `bloaty_fuzz_target`.\n## Fuzzers\n+\nPick the fuzzers you want to use from the `fuzzers/` directory.\nFor example: `libfuzzer` and `afl`.\n## Executing run_experiment.py\n+\nNow that everything is ready, execute `run_experiment.py`:\n```bash\nPYTHONPATH=. python3 experiment/run_experiment.py \\\n--experiment-config experiment-config.yaml \\\n--benchmarks freetype2-2017 bloaty_fuzz_target \\\n---experiment-name experiment-name \\\n+--experiment-name $EXPERIMENT_NAME \\\n--fuzzers afl libfuzzer\n```\n+where `$EXPERIMENT_NAME` is the name you want to give the experiment.\n+\n+## Viewing reports\n+\n+You should eventually be able to see reports from your experiment, that are\n+update at some interval throughout the experiment. However, you may have to wait\n+a while until they first appear since a lot must happen before there is data to\n+generate report. Once they are available, you should be able to view them at:\n+`https://storage.googleapis.com/$REPORT_BUCKET_NAME/$EXPERIMENT_NAME/index.html`\n+\n# Advanced usage\n## Fuzzer configuration files\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "docs/advanced-topics/setting_up_a_google_cloud_project.md",
"diff": "+---\n+layout: default\n+title: Setting up a Google Cloud Project\n+parent: Advanced topics\n+nav_order: 2\n+permalink: /advanced-topics/setting-up-a-google-cloud-project/\n+---\n+\n+# Setting up a Google Cloud Project\n+\n+**NOTE**: Most users of FuzzBench should simply [add a fuzzer]({{ site.baseurl\n+}}/getting-started/adding-a-new-fuzzer/) and use the FuzzBench service. This\n+document isn't needed for using the FuzzBench service. This document explains\n+how to set up a Google Cloud project for running an [experiment]({{ site.baseurl\n+}}/reference/glossary/#Experiment) for the first time. We don't recommend\n+running experiments on your own for most users. Validating results from the\n+FuzzBench service is a good reason to run an experiment on your own.\n+\n+Currently, FuzzBench requires Google Cloud to run experiments (though this may\n+change, see\n+[FAQ]({{ site.baseurl }}/faq/#how-can-i-reproduce-the-results-or-run-fuzzbench-myself)).\n+\n+The rest of this document will assume all commands are run from the root of\n+FuzzBench.\n+\n+## Create the Project\n+\n+* [Create a new Google Cloud Project](https://console.cloud.google.com/projectcreate).\n+\n+* Enable billing when prompted on the Google Cloud website.\n+\n+* Set `$PROJECT_NAME` in the environment:\n+\n+```bash\n+export PROJECT_NAME=<your-project-name>\n+```\n+\n+For the rest of this document, replace `$PROJECT_NAME` with the name of the\n+project you created.\n+\n+* [Install Google Cloud SDK](https://console.cloud.google.com/sdk/install).\n+\n+* Set your default project using gcloud:\n+\n+```bash\n+gcloud config set project $PROJECT_NAME\n+```\n+\n+## Set up the database\n+\n+* [Enable the Compute Engine API](https://console.cloud.google.com/apis/library/compute.googleapis.com?q=compute%20engine)\n+\n+* Create a PostgreSQL (we use PostgreSQL 11) instance using\n+[Google Cloud SQL](https://console.cloud.google.com/sql/create-instance-postgres).\n+This will take a few minutes.\n+We recommend using \"us-central1\" as the region and zone \"a\" as the zone.\n+Certain links provided in this document assume \"us-central1\".\n+Note that the region you choose should be the region you use later for running\n+experiments.\n+\n+* For the rest of this document, we will use `$PROJECT_REGION`,\n+`$POSTGRES_INSTANCE`, and `$POSTGRES_PASSWORD` to refer to the region of the\n+PostgreSQL instance you created, its name, and its password. Set them in your\n+environment:\n+\n+```bash\n+export PROJECT_REGION=<your-postgres-region>\n+export POSTGRES_INSTANCE=<your-postgres-instance-name>\n+export POSTGRES_PASSWORD=<your-postgres-password>\n+```\n+\n+* [Download and install cloud_sql_proxy](https://cloud.google.com/sql/docs/postgres/sql-proxy)\n+\n+```bash\n+wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy\n+```\n+\n+* Connect to your postgres instance using cloud_sql_proxy:\n+\n+```bash\n+./cloud_sql_proxy -instances=$PROJECT_NAME:$PROJECT_REGION:$POSTGRES_INSTANCE=tcp:5432\n+```\n+\n+* (optional, but recommended) Connect to your instance to ensure you\n+ have all of the details right:\n+\n+```bash\n+psql \"host=127.0.0.1 sslmode=disable user=postgres\"\n+```\n+\n+Use `$POSTGRES_PASSWORD` when prompted.\n+\n+* Initialize the postgres database:\n+\n+```bash\n+PYTHONPATH=. alembic upgrade head\n+```\n+\n+If this command fails, double check you set `POSTGRES_PASSWORD` correctly.\n+At this point you can kill the `cloud_sql_proxy` process.\n+\n+## Google Cloud Storage buckets\n+\n+* Set up Google Cloud Storage Buckets by running the commands below:\n+\n+```bash\n+# Bucket for storing experiment artifacts such as corpora, coverage binaries,\n+# crashes etc.\n+gsutil mb gs://$DATA_BUCKET_NAME\n+\n+# Bucket for storing HTML reports.\n+gsutil mb gs://$REPORT_BUCKET_NAME\n+```\n+\n+You can pick any (globally unique) names you'd like for `$DATA_BUCKET_NAME` and\n+`$REPORT_BUCKET_NAME`.\n+\n+* Make the report bucket public so it can be viewed from your browser:\n+\n+```bash\n+gsutil iam ch allUsers:objectViewer gs://$REPORT_BUCKET_NAME\n+```\n+\n+## Dispatcher image and container registry setup\n+\n+* Build the dispatcher image:\n+\n+```bash\n+docker build -f docker/dispatcher-image/Dockerfile \\\n+ -t gcr.io/$PROJECT_NAME/dispatcher-image docker/dispatcher-image/\n+```\n+\n+FuzzBench uses an instance running this image to manage most of the experiment.\n+\n+* [Enable Google Container Registry API](https://console.console.cloud.google.com/apis/api/containerregistry.googleapis.com/overview)\n+to use the container registry.\n+\n+* Push `dispatcher-image` to the docker registry:\n+\n+```bash\n+docker push gcr.io/$PROJECT_NAME/dispatcher-image\n+```\n+\n+* [Switch the registry's visibility to public](https://console.cloud.google.com/gcr/settings).\n+\n+## Enable required APIs\n+\n+* [Enable the IAM API](https://console.cloud.google.com/apis/api/iam.googleapis.com/landing)\n+so that FuzzBench can authenticate to Google Cloud APIs and services.\n+\n+* [Enable the error reporting API](https://console.cloud.google.com/apis/library/clouderrorreporting.googleapis.com)\n+so that FuzzBench can report errors to the\n+[Google Cloud error reporting dashboard](https://console.cloud.google.com/errors)\n+\n+* [Enable Cloud Build API](https://console.cloud.google.com/apis/library/cloudbuild.googleapis.com)\n+so that FuzzBench can build docker images using Google Cloud Build, a platform\n+optimized for doing so.\n+\n+* [Enable Cloud SQL Admin API](https://console.cloud.google.com/apis/library/sqladmin.googleapis.com)\n+so that FuzzBench can connect to the database.\n+\n+## Configure networking\n+\n+* Go to the networking page for the network you want to run your experiment in.\n+[This](https://cloud.console.google.com/networking/subnetworks/details/us-central1/default)\n+is the networking page for the default network in \"us-central1\". It is best if\n+you use `$POSTGRES_REGION` for this.\n+\n+* Click the edit icon. Turn \"Private Google access\" to \"On\". Press \"Save\".\n+\n+* This allows the trial runner instances to use Google Cloud APIs since they do\n+ not have external IP addresses.\n+\n+## Request CPU quota increase\n+\n+* FuzzBench uses a 96 core Google Compute Engine instance for measuring trials\n+and single core instances for each trial in your experiment.\n+\n+* Go to the quotas page for the region you will use for experiments.\n+[This](https://console.cloud.google.com/iam-admin/quotas?location=us-central1)\n+is the quotas page for the \"us-central1\" region.\n+\n+* Select the \"Compute Engine API\" \"CPUs\" quota, fill out contact details and\n+request a quota increase. We recommend requesting a quota limit of \"1000\" as\n+will probably be approved and is large enough for running experiments in a\n+reasonable amount of time.\n+\n+* Wait until you receive an email confirming the quota increase.\n+\n+## Run an experiment\n+\n+* Follow the [guide on running an experiment]({{ site.baseurl }}/advanced-topics/running-an-experiment/)\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/advanced-topics/statistical_analysis.md",
"new_path": "docs/advanced-topics/statistical_analysis.md",
"diff": "layout: default\ntitle: Statistical Analysis\nparent: Advanced topics\n-nav_order: 2\n+nav_order: 1\npermalink: /getting-started/statistical-analysis/\n---\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/reference/glossary.md",
"new_path": "docs/reference/glossary.md",
"diff": "@@ -38,6 +38,22 @@ or a custom one where you explicitly define the steps to checkout code and build\nthe fuzz target\n([example integration](https://github.com/google/fuzzbench/blob/master/benchmarks/vorbis-2017-12-11/build.sh)).\n+### Trial\n+\n+A single fuzzing run on a particular benchmark. For example, we might compare\n+AFL and honggfuzz by running 20 trials of each fuzzer on the libxml2-v2.9.2\n+benchmark.\n+\n+### Experiment\n+\n+A group of [trials](#trial) that are run together to compare fuzzer performance.\n+This usually includes trials from multiple benchmarks and multiple fuzzers. For\n+example, to compare libFuzzer, AFL and honggfuzz, we might run an experiment\n+where each of them fuzz every benchmark. Experiments use the same number of\n+trials for each fuzzer-benchmark pair and a specific amount of time for each\n+trial (typically, 24 hours) so that results are comparable. FuzzBench generates\n+reports for experiments while they are running and after they complete.\n+\n[fuzzing]: https://en.wikipedia.org/wiki/Fuzzing\n[fuzz target]: https://github.com/google/fuzzing/blob/master/docs/glossary.md#fuzz-target\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [docs] Add docs on setting up a google cloud project. (#2)
Also define what an experiment is and improve the running_an_experiment.md doc. |
258,388 | 28.02.2020 13:28:14 | 28,800 | 967034864334f54796f0db375e0a3e8855bc191a | [make] Fix target for all benchmarks from one fuzzer
It should be make build-afl-all not build-all-afl | [
{
"change_type": "MODIFY",
"old_path": "docker/build.mk",
"new_path": "docker/build.mk",
"diff": "@@ -19,7 +19,7 @@ OSS_FUZZ_PROJECTS := $(notdir $(shell find benchmarks -type f -name oss-fuzz.yam\nBASE_TAG := gcr.io/fuzzbench\n-build-all: $(addprefix build-all-,$(FUZZERS))\n+build-all: $(addsuffix -all, $(addprefix build-,$(FUZZERS)))\nbase-image:\n@@ -51,7 +51,7 @@ $(1)-builder: base-builder\n--file fuzzers/$(1)/builder.Dockerfile \\\nfuzzers/$(1)\n-build-all-$(1): $(addprefix build-$(1)-,$(BENCHMARKS))\n+build-$(1)-all: $(addprefix build-$(1)-,$(BENCHMARKS))\nendef\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [make] Fix target for all benchmarks from one fuzzer (#11)
It should be make build-afl-all not build-all-afl |
258,388 | 28.02.2020 14:34:27 | 28,800 | 8e9116763768c2494066687c4402e63555245658 | Remove $ from more bash commands | [
{
"change_type": "MODIFY",
"old_path": "docs/getting-started/adding_a_new_benchmark.md",
"new_path": "docs/getting-started/adding_a_new_benchmark.md",
"diff": "@@ -21,9 +21,9 @@ subdirectory will be the name of the benchmark. The benchmark name can contain\nalphanumeric characters, dots, hyphens and underscores.\n```bash\n-$ export BENCHMARK_NAME=<your_benchmark_name>\n-$ cd benchmarks\n-$ mkdir $BENCHMARK_NAME\n+export BENCHMARK_NAME=<your_benchmark_name>\n+cd benchmarks\n+mkdir $BENCHMARK_NAME\n```\n## OSS-Fuzz benchmarks vs standard benchmarks\n@@ -119,11 +119,11 @@ Once you've got a benchmark integrated, you should test that it builds and runs\nsuccessfully with at least one fuzzer (e.g. afl):\n```shell\n-$ export FUZZER_NAME=afl\n-$ export BENCHMARK_NAME=libpng-1.2.56\n+export FUZZER_NAME=afl\n+export BENCHMARK_NAME=libpng-1.2.56\n-$ make build-$FUZZER_NAME-$BENCHMARK_NAME\n-$ make run-$FUZZER_NAME-$BENCHMARK_NAME\n+make build-$FUZZER_NAME-$BENCHMARK_NAME\n+make run-$FUZZER_NAME-$BENCHMARK_NAME\n```\nIf everything works, submit the integration code via a GitHub pull request.\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Remove $ from more bash commands (#16) |
258,388 | 28.02.2020 14:36:54 | 28,800 | aec55a6dad94246bc1f69fd3df831091ddd8a7f6 | Improve docs
Make miscellaneous improvements based on feedback. | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -10,9 +10,8 @@ techniques.\nFuzzBench provides:\n* An easy API for integrating fuzzers.\n-* Benchmarks from real-world projects, adding an\n- [OSS-Fuzz](https://github.com/google/oss-fuzz) benchmark is a three-line\n- change.\n+* Benchmarks from real-world projects. FuzzBench can use any\n+ [OSS-Fuzz](https://github.com/google/oss-fuzz) project as a benchmark.\n* A reporting library that produces reports with graphs and statistical tests\nto help you understand the significance of results.\n@@ -21,13 +20,14 @@ To participate, submit your fuzzer to run on the FuzzBench platform by following\nhttps://google.github.io/fuzzbench/getting-started/adding-a-new-fuzzer/).\nAfter your integration is accepted, we will run a large-scale experiment using\nyour fuzzer and generate a report comparing your fuzzer to others.\n-See [sample report](https://github.com/google/fuzzbench#sample-report).\n+See [an example report](https://www.fuzzbench.com/reports/sample/index.html).\n## Overview\n![FuzzBench Service diagram](docs/images/FuzzBench-service.png)\n## Sample Report\n-You can view a sample report\n+\n+You can view an example report\n[here](https://www.fuzzbench.com/reports/sample/index.html).\nThis report is generated using 10 fuzzers against 24 real-world benchmarks,\nwith 20 trials each and over a duration of 24 hours.\n@@ -38,13 +38,16 @@ When analyzing reports, we recommend:\nresult.\nPlease provide feedback on any inaccuracies and potential improvements (such as\n-integration changes, new benchmarks, etc) by opening a GitHub issue\n+integration changes, new benchmarks, etc.) by opening a GitHub issue\n[here](https://github.com/google/fuzzbench/issues/new).\n## Documentation\n+\nRead our [detailed documentation](https://google.github.io/fuzzbench/) to learn\nhow to use FuzzBench.\n## Contact\n+\nJoin our [mailing list](https://groups.google.com/g/fuzzbench-users) for\n-discussions and announcements.\n\\ No newline at end of file\n+discussions and announcements, or send us a private email at\n+[[email protected]](mailto:[email protected]).\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/index.md",
"new_path": "docs/index.md",
"diff": "@@ -19,32 +19,34 @@ techniques.\nFuzzBench provides:\n* An easy API for integrating fuzzers.\n-* Benchmarks from real-world projects, adding an\n- [OSS-Fuzz](https://github.com/google/oss-fuzz) benchmark is a three-line\n- change.\n+* Benchmarks from real-world projects. FuzzBench can use any\n+ [OSS-Fuzz](https://github.com/google/oss-fuzz) project as a benchmark.\n* A reporting library that produces reports with graphs and statistical tests\nto help you understand the significance of results.\nTo participate, submit your fuzzer to run on the FuzzBench platform by following\n[our simple guide](\n-https://google.github.io/fuzzbench/getting-started/adding-a-new-fuzzer/).\n+{{ site.baseurl }}/fuzzbench/getting-started/adding-a-new-fuzzer/).\nAfter your integration is accepted, we will run a large-scale experiment using\n-your fuzzer and generate a report comparing your fuzzer to others.\n-See [sample report](https://github.com/google/fuzzbench#sample-report).\n+your fuzzer and generate a report comparing your fuzzer to others, such as AFL\n+and libFuzzer.\n+See [an example report](https://www.fuzzbench.com/reports/sample/index.html).\n## Overview\n![FuzzBench Service diagram](images/FuzzBench-service.png)\nThe process works like this:\n-1. A developer of a fuzzer (or someone else interested)\n-[integrates]({{ site.baseurl }}/getting-started/adding-a-new-fuzzer/) their\n-fuzzer with FuzzBench.\n-1. The integration is merged into the official FuzzBench repo.\n+1. A fuzzer developer (or someone else interested)\n+[integrates a fuzzer]({{ site.baseurl }}/getting-started/adding-a-new-fuzzer/)\n+with FuzzBench.\n+1. The integration is merged into the [\n+FuzzBench repo](https://github.com/google/fuzzbench).\n1. FuzzBench runs an experiment with the new fuzzer on the benchmarks.\n1. FuzzBench publishes a report comparing the performance of the fuzzer to other\nfuzzers both on individual benchmarks and in aggregate.\n## Sample Report\n+\nYou can view a sample report\n[here](https://www.fuzzbench.com/reports/sample/index.html).\nThis report is generated using 10 fuzzers against 24 real-world benchmarks,\n@@ -56,14 +58,17 @@ When analyzing reports, we recommend:\nresult.\nPlease provide feedback on any inaccuracies and potential improvements (such as\n-integration changes, new benchmarks, etc) by opening a GitHub issue\n+integration changes, new benchmarks, etc.) by opening a GitHub issue\n[here](https://github.com/google/fuzzbench/issues/new).\n## Documentation\n+\nRead our [detailed documentation](https://google.github.io/fuzzbench/) to learn\nhow to use FuzzBench.\n## Contact\n+\nJoin our [mailing list](https://groups.google.com/g/fuzzbench-users) for\n-discussions and announcements.\n+discussions and announcements, or send us a private email at\n+[[email protected]](mailto:[email protected]).\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Improve docs (#15)
Make miscellaneous improvements based on feedback. |