From 4980b58141a6b9fdc5758f0ec113e26f404b9b4f Mon Sep 17 00:00:00 2001
From: Can Demiralp
Date: Tue, 24 Dec 2024 09:21:00 +0100
Subject: [PATCH 1/7] Revert "[ECP-9543] Enable Dependabot with basic
configuration (#2820)" (#2830)
This reverts commit e8bb4ec73b9b8fe42238f7b641e326ec4ff7c432.
Co-authored-by: Can Demiralp
---
.github/dependabot.yml | 20 --------------------
1 file changed, 20 deletions(-)
delete mode 100644 .github/dependabot.yml
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
deleted file mode 100644
index 9c9805543..000000000
--- a/.github/dependabot.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-version: 2
-
-updates:
- - package-ecosystem: "composer"
- directory: "/"
- schedule:
- interval: "daily"
- open-pull-requests-limit: 3
- labels:
- - "dependencies"
- target-branch: "main"
-
- - package-ecosystem: "docker"
- directory: "/"
- schedule:
- interval: "daily"
- open-pull-requests-limit: 3
- labels:
- - "dependencies"
- target-branch: "main"
From d02c7f6ca6d111d651fb96e1a4ee9bf8f729d40d Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Tue, 24 Dec 2024 09:44:56 +0100
Subject: [PATCH 2/7] chore(deps): update dependency squizlabs/php_codesniffer
to ~3.11.0 (#2829)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index ed7b5a459..a9a2f6eec 100755
--- a/composer.json
+++ b/composer.json
@@ -23,7 +23,7 @@
"require-dev": {
"phpunit/phpunit": "~9.6.1",
"magento/magento-coding-standard": "*",
- "squizlabs/php_codesniffer": "~3.8.0"
+ "squizlabs/php_codesniffer": "~3.11.0"
},
"autoload": {
"files": [
From 2f018987f805ef76d22660497f3a154067f27912 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Tue, 24 Dec 2024 10:21:28 +0100
Subject: [PATCH 3/7] chore(deps): update mcr.microsoft.com/playwright docker
tag to v1.49.1 (#2825)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
---
.github/docker-compose.e2e.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/docker-compose.e2e.yml b/.github/docker-compose.e2e.yml
index 468be5840..10893da3a 100644
--- a/.github/docker-compose.e2e.yml
+++ b/.github/docker-compose.e2e.yml
@@ -1,7 +1,7 @@
version: '3'
services:
playwright:
- image: mcr.microsoft.com/playwright:v1.49.0
+ image: mcr.microsoft.com/playwright:v1.49.1
shm_size: 1gb
ipc: host
cap_add:
From 10722e4458caf4e9645beb73bc923720593a164d Mon Sep 17 00:00:00 2001
From: QuentinvRooyen <128705165+QuentinvRooyen@users.noreply.github.com>
Date: Tue, 24 Dec 2024 10:21:54 +0100
Subject: [PATCH 4/7] [ECP-9301] - Update Help Article URLs (#2826)
* Update Support Email - OpenInvoice Tooltip
* Update Adyen Help Articles URL
* Update Adyen Help Articles URL
* Update Help Article URLs
---------
Co-authored-by: Can Demiralp
---
view/adminhtml/templates/support/js.phtml | 120 ++++++++++------------
1 file changed, 54 insertions(+), 66 deletions(-)
diff --git a/view/adminhtml/templates/support/js.phtml b/view/adminhtml/templates/support/js.phtml
index 865b1b8ec..175681cb4 100644
--- a/view/adminhtml/templates/support/js.phtml
+++ b/view/adminhtml/templates/support/js.phtml
@@ -20,38 +20,38 @@ require([
const linksMapping = {
required_settings: [
{
- title: 'Magento plugin setup',
- href: 'https://docs.adyen.com/plugins/magento-2/set-up-the-plugin-in-magento#step-3-configure-the-plugin-in-magento'
+ title: 'Adobe Commerce plugin setup',
+ href: 'https://docs.adyen.com/plugins/adobe-commerce/set-up-the-plugin-in-adobe-commerce/'
},
{
title: 'How to request a new merchant account',
href: 'https://www.adyen.com/education/europe/english/modules/customer-area'
},
{
- title: 'Why Apple pay is not working',
- href: 'https://www.adyen.help/hc/en-us/articles/4871941388444-how-can-i-handle-errors-with-my-applepay-payments'
+ title: 'Why is Apple pay not working',
+ href: 'https://help.adyen.com/knowledge/ecommerce-integrations/drop-in-and-components/why-do-i-receive-a-422-error-with-apple-pay-when-using-adyens-certificate'
},
{
title: 'Go-live checklist',
- href: 'https://docs.adyen.com/plugins/magento-2/go-live-checklist'
+ href: 'https://docs.adyen.com/plugins/adobe-commerce/go-live-checklist'
},
{
title: 'Troubleshooting guide',
- href: 'https://docs.adyen.com/plugins/magento-2/troubleshooting'
+ href: 'https://docs.adyen.com/plugins/adobe-commerce/troubleshooting/'
},
{
title: 'Why do I get the error 401 Unauthorized?',
- href: 'https://www.adyen.help/hc/en-us/articles/5231709306652-why-do-i-get-the-error-401-unauthorized'
+ href: 'https://help.adyen.com/knowledge/ecommerce-integrations/error-codes/why-do-i-get-the-error-401-unauthorized'
}
],
card_payments: [
{
title: 'How to configure card payments ',
- href: 'https://docs.adyen.com/plugins/magento-2/set-up-the-payment-methods-in-magento#api-credit-card-payments'
+ href: 'https://docs.adyen.com/plugins/adobe-commerce/set-up-the-payment-methods-in-adobe-commerce'
},
{
title: 'What are supported schemes?',
- href: 'https://docs.adyen.com/plugins/magento-2/supported-payment-methods#credit-and-debit-cards'
+ href: 'https://docs.adyen.com/plugins/adobe-commerce/supported-payment-methods'
},
{
title: '3D Secure 2 Component integration',
@@ -61,11 +61,11 @@ require([
card_tokenization: [
{
title: 'How to set up tokenization',
- href: 'https://docs.adyen.com/plugins/magento-2/set-up-tokenization'
+ href: 'https://docs.adyen.com/plugins/adobe-commerce/set-up-tokenization'
},
{
title: 'Video: How to set up tokenization',
- href: 'https://help.adyen.com/academy/how-to-videos/plugins/how-to-set-up-tokenization-in-your-magento-plugin'
+ href: 'https://help.adyen.com/knowledge/plugins/adobe-commerce/how-do-i-set-up-tokenization-in-adobe-commerce'
},
{
title: 'Difference between One-off, Subscription and Top-ups',
@@ -73,25 +73,25 @@ require([
},
{
title: 'Why do I receive a 800 Contract not found error?',
- href: 'https://www.adyen.help/hc/en-us/articles/5231491632668-why-do-i-receive-a-800-contract-not-found-error'
+ href: 'https://help.adyen.com/knowledge/ecommerce-integrations/error-codes/why-do-i-receive-a-800-contract-not-found-error'
},
{
title: 'Why do I receive a 803 PaymentDetail not found error?',
- href: 'https://www.adyen.help/hc/en-us/articles/5231662267420-why-do-i-receive-a-803-paymentdetail-not-found-error'
+ href: 'https://help.adyen.com/knowledge/ecommerce-integrations/error-codes/why-do-i-receive-a-803-paymentdetail-not-found-error'
},
{
title: 'Why does my recurring transaction give the error "invalid card number"?',
- href: 'https://www.adyen.help/hc/en-us/articles/5234058320412-why-does-my-recurring-transaction-give-the-error-invalid-card-number'
+ href: 'https://help.adyen.com/knowledge/ecommerce-integrations/tokenization/why-does-my-recurring-transaction-give-the-error-invalid-card-number'
}
],
alt_payment_methods: [
{
- title: 'Why are Adyen alternative payment methods not showing up in Magento?',
- href: 'https://www.adyen.help/hc/en-us/articles/5034154365340-Why-are-Adyen-alternative-payment-methods-not-showing-up-in-Magento-'
+ title: 'Why are Adyen alternative payment methods not showing up in Adobe Commerce?',
+ href: 'https://help.adyen.com/knowledge/plugins/adobe-commerce/why-arent-all-payment-methods-displayed-adobe-commerce'
},
{
title: 'Supported Payment Methods',
- href: 'https://docs.adyen.com/plugins/magento-2/supported-payment-methods#credit-and-debit-cards'
+ href: 'https://docs.adyen.com/plugins/adobe-commerce/supported-payment-methods/'
},
{
title: 'How to add payment methods in Customer Area',
@@ -99,19 +99,15 @@ require([
},
{
title: 'How do I deactivate or delete a payment method?',
- href: 'https://www.adyen.help/hc/en-us/articles/5439872869404-how-do-i-deactivate-or-delete-a-payment-method'
+ href: 'https://help.adyen.com/knowledge/payment-methods/manage-payment-methods/how-do-i-deactivate-or-delete-a-payment-method'
},
{
title: 'Video: How to add payment methods in Customer Area',
href: 'https://www.adyen.com/education/europe/english/modules/customer-area'
},
{
- title: 'How do I change the order of payment methods on my checkout page?',
- href: 'https://www.adyen.help/hc/en-us/articles/4871657923612-how-can-i-change-the-order-of-my-payment-methods'
- },
- {
- title: 'How can we change the order of the payment methods inside Magento 2?',
- href: 'https://www.adyen.help/hc/en-us/articles/5034413982876-how-can-we-change-the-order-of-the-payment-methods-inside-magento-2'
+ title: 'How can we change the order of the payment methods inside Adobe Commerce 2?',
+ href: 'https://help.adyen.com/knowledge/plugins/adobe-commerce/how-can-i-change-the-order-of-the-payment-methods-adobe-commerce'
}
],
pos_integration: [
@@ -127,123 +123,115 @@ require([
pay_by_link: [
{
title: 'How to set up Pay By Link in the plugin',
- href: 'https://docs.adyen.com/plugins/magento-2/set-up-the-payment-methods-in-magento#pay-by-link'
+ href: 'https://docs.adyen.com/plugins/adobe-commerce/set-up-the-payment-methods-in-adobe-commerce/#pay-by-link'
},
{
title: 'Video: How to set up PayByLink',
- href: 'https://help.adyen.com/academy/how-to-videos/plugins/how-to-set-up-pay-by-link-in-your-magento-plugin'
+ href: 'https://help.adyen.com/academy/how-to-videos/plugins/how-to-set-up-pay-by-link-in-your-adobe-commerce-plugin'
}
],
adyen_giving: [
{
title: 'How to set up Donations in the plugin',
- href: 'https://docs.adyen.com/plugins/magento-2/set-up-the-payment-methods-in-magento#donations'
+ href: 'https://docs.adyen.com/plugins/adobe-commerce/set-up-the-payment-methods-in-adobe-commerce/#donations'
},
{
title: 'Video: How to set up Adyen Giving',
- href: 'https://help.adyen.com/academy/how-to-videos/plugins/how-to-set-up-giving-in-your-magento-plugin/'
+ href: 'https://help.adyen.com/academy/how-to-videos/plugins/how-to-set-up-giving-in-your-adobe-commerce-plugin'
}
],
advanced_settings: [
{
- title: 'Why does the order status in Magento remain on "Payment Review"?',
- href: 'https://www.adyen.help/hc/en-us/articles/5033911246876-Why-does-the-order-status-in-Magento-remain-on-Payment-Review-'
+ title: 'Why does the order status in Adobe Commerce remain on "Payment Review"?',
+ href: 'https://help.adyen.com/knowledge/plugins/adobe-commerce/why-is-my-payment-pending-in-adobe-commerce'
},
{
- title: 'Why is the text in Magento not being translated?',
- href: 'https://www.adyen.help/hc/en-us/articles/5034181926300-Why-is-the-text-in-Magento-not-being-translated-'
+ title: 'Why is the text in Adobe Commerce not being translated?',
+ href: 'https://help.adyen.com/knowledge/plugins/adobe-commerce/why-is-the-text-in-adobe-commerce-not-being-translated'
},
{
- title: 'How can we customise the Magento 2 plugin?',
- href: 'https://www.adyen.help/hc/en-us/articles/5034486805532-How-can-we-customise-the-Magento-2-plugin-'
+ title: 'How can we customise the Adobe Commerce plugin?',
+ href: 'https://help.adyen.com/knowledge/plugins/adobe-commerce/how-can-we-customise-the-adobe-commerce-plugin'
},
{
- title: 'Why is my order status Settled or SentForSettle after I refunded it on Magento?',
- href: 'https://www.adyen.help/hc/en-us/articles/5034488629660-Why-is-my-order-status-Settled-or-SentForSettle-after-I-refunded-it-on-Magento-'
+ title: 'Why is my order status Settled or SentForSettle after I refunded it on Adobe Commerce?',
+ href: 'https://help.adyen.com/knowledge/plugins/adobe-commerce/why-is-my-order-status-settled-or-sentforsettle-after-i-refunded-it-on-adobe-commerce'
},
{
title: 'Why are Klarna payments stuck in Pending?',
- href: 'https://www.adyen.help/hc/en-us/articles/5032453938460-why-are-klarna-payments-stuck-in-pending'
- },
- {
- title: 'Why are the orders not created in Magento after a payment is processed in Adyen?',
- href: 'https://www.adyen.help/hc/en-us/articles/5033911246876-why-does-the-order-status-in-magento-remain-on-payment-review'
+ href: 'https://help.adyen.com/knowledge/plugins/using-plugins/why-are-klarna-payments-still-pending'
},
{
title: 'How can I change the capture settings of my payment method?',
- href: 'https://www.adyen.help/hc/en-us/articles/5003914234140-how-can-i-change-the-capture-settings-of-my-payment-method'
+ href: 'https://help.adyen.com/knowledge/payment-methods/manage-payment-methods/how-can-i-change-the-capture-settings-of-my-payment-method'
}
],
payment_status: [
{
- title: 'Why is my order status Settled or SentForSettle after I refunded it on Magento?',
- href: 'https://www.adyen.help/hc/en-us/articles/5034488629660-Why-is-my-order-status-Settled-or-SentForSettle-after-I-refunded-it-on-Magento-'
+ title: 'Why is my order status Settled or SentForSettle after I refunded it on Adobe Commerce?',
+ href: 'https://help.adyen.com/knowledge/plugins/adobe-commerce/why-is-my-order-status-settled-or-sentforsettle-after-i-refunded-it-on-adobe-commerce'
},
{
title: 'Why are Klarna payments stuck in Pending?',
- href: 'https://www.adyen.help/hc/en-us/articles/5032453938460-why-are-klarna-payments-stuck-in-pending'
+ href: 'https://help.adyen.com/knowledge/plugins/using-plugins/why-are-klarna-payments-still-pending'
},
- {
- title: 'Why does the order status in Magento remain on "Payment Review"?',
- href: 'https://www.adyen.help/hc/en-us/articles/5033911246876-Why-does-the-order-status-in-Magento-remain-on-Payment-Review-'
- }
],
failed_transaction: [
{
title: 'What does it mean if a payment is refused because 3d-secure: Authentication failed?',
- href: 'https://www.adyen.help/hc/en-us/articles/5295691501596-what-does-it-mean-if-a-payment-is-refused-because-3dsecure-authentication-failed'
+ href: 'https://help.adyen.com/knowledge/3d-secure/3ds-response-codes/what-does-it-mean-if-a-payment-is-refused-because-3d-secure-authentication-failed'
},
{
title: 'Why is my payment canceled?',
- href: 'https://www.adyen.help/hc/en-us/articles/4545692297884-why-is-my-payment-canceled'
+ href: 'https://help.adyen.com/knowledge/payments/payment-statuses/why-is-my-payment-canceled'
},
{
title: 'Why do I receive a 905 Payment details are not supported error?',
- href: 'https://www.adyen.help/hc/en-us/articles/5231655519004-why-do-i-receive-a-905-payment-details-are-not-supported-error'
+ href: 'https://help.adyen.com/knowledge/ecommerce-integrations/error-codes/why-do-i-receive-a-905-payment-details-are-not-supported-error'
},
{
title: 'Why do I receive a 403 or 010 Not Allowed error?',
- href: 'https://www.adyen.help/hc/en-us/articles/5231707550364-why-do-i-receive-a-403-or-010-not-allowed-error'
+ href: 'https://help.adyen.com/knowledge/ecommerce-integrations/error-codes/why-do-i-receive-a-403-or-010-not-allowed-error'
},
{
title: 'Why do I receive the error 422 : Unable to Decrypt Data using the Card Component or Drop-In?',
- href: 'https://www.adyen.help/hc/en-us/articles/5233146584988-why-do-i-receive-the-error-422-unable-to-decrypt-data-using-the-card-component-or-dropin'
+ href: 'https://help.adyen.com/knowledge/ecommerce-integrations/drop-in-and-components/why-do-i-receive-the-error-422-unable-to-decrypt-data-using-the-card-component-or-dropin'
},
{
title: 'Why do I receive a 807 Invalid combination of shopper interaction and recurring contract error?',
- href: 'https://www.adyen.help/hc/en-us/articles/5231605902492-why-do-i-receive-a-807-invalid-combination-of-shopper-interaction-and-recurring-contract-error'
+ href: 'https://help.adyen.com/knowledge/ecommerce-integrations/error-codes/why-do-i-receive-a-807-invalid-combination-of-shopper-interaction-and-recurring-contract-error'
},
{
title: 'Why do I get errorCode 908: invalid request with HTTP status 500?',
- href: 'https://www.adyen.help/hc/en-us/articles/5231513160220-why-do-i-get-errorcode-908-invalid-request-with-http-status-500'
+ href: 'https://help.adyen.com/knowledge/ecommerce-integrations/error-codes/why-do-i-get-errorcode-908-invalid-request-with-http-status-500'
}
],
offer: [
{
- title: 'Why does the order status in Magento remain on "Payment Review"?',
- href: 'https://www.adyen.help/hc/en-us/articles/5033911246876-Why-does-the-order-status-in-Magento-remain-on-Payment-Review-'
+ title: 'Why does the order status in Adobe Commerce remain on "Payment Review"?',
+ href: 'https://docs.adyen.com/plugins/adobe-commerce/troubleshooting/#orders'
}
],
webhooks: [
{
title: 'How to set up notifications in Customer Area',
- href: 'https://docs.adyen.com/plugins/magento-2/set-up-adyen-customer-area'
+ href: 'https://docs.adyen.com/plugins/adobe-commerce/set-up-adyen-customer-area/?tab=manual_2#step-3-set-up-webhooks'
},
{
- title: 'Why does the order status in Magento remain on "Payment Review"?',
- href: 'https://www.adyen.help/hc/en-us/articles/5033911246876-Why-does-the-order-status-in-Magento-remain-on-Payment-Review-'
+ title: 'Why does the order status in Adobe Commerce remain on "Payment Review"?',
+ href: 'https://docs.adyen.com/plugins/adobe-commerce/troubleshooting/#orders'
},
{
- title: 'Why does Magento 2 does not receive notifications?',
- href: 'https://www.adyen.help/hc/en-us/articles/5034412585116-Why-does-Magento-2-does-not-receive-notifications-'
+ title: 'Why does Adobe Commerce not receive notifications?',
+ href: 'https://help.adyen.com/knowledge/plugins/adobe-commerce/why-does-adobe-commerce-does-not-receive-notifications'
},
{
- title: 'I get a 301, 302 or 401 error in Magento when testing the notification endpoint',
- href: 'https://www.adyen.help/hc/en-us/articles/5034799389980-I-get-a-301-302-or-401-error-in-Magento-when-testing-the-notification-endpoint'
+ title: 'I get a 301, 302 or 401 error in Adobe Commerce when testing the notification endpoint',
+ href: 'https://help.adyen.com/knowledge/plugins/adobe-commerce/why-am-i-receiving-301-302-or-401-error-in-adobe-commerce'
},
{
title: 'How can I get additional data in standard Notifications?',
- href: 'https://www.adyen.help/hc/en-us/articles/5234558016540-how-can-i-get-additional-data-in-standard-notifications'
+ href: 'https://help.adyen.com/knowledge/ecommerce-integrations/webhooks/how-can-i-get-additional-data-in-standard-webhooks'
}
]
};
From 9270f000d40f26ebebd7e250ac4c232c10fd53f1 Mon Sep 17 00:00:00 2001
From: Andreas Schrammel
Date: Tue, 24 Dec 2024 10:37:57 +0100
Subject: [PATCH 5/7] Remove invoice send without config check (#2814)
Remove sending of the invoice email without former check if invoice emails are enabled.
Co-authored-by: Can Demiralp
---
Helper/Invoice.php | 2 --
1 file changed, 2 deletions(-)
diff --git a/Helper/Invoice.php b/Helper/Invoice.php
index 1a71d6540..9f9942230 100644
--- a/Helper/Invoice.php
+++ b/Helper/Invoice.php
@@ -437,8 +437,6 @@ public function createInvoiceFromWebhook(Order $order, Notification $notificatio
);
$transactionSave->save();
- $this->sendInvoiceMail($invoice);
-
//Send Invoice mail to customer
$invoiceAutoMail = (bool)$this->scopeConfig->isSetFlag(
InvoiceIdentity::XML_PATH_EMAIL_ENABLED,
From 09dfcf32efab159f84264f6a7574376c9a1ee5e9 Mon Sep 17 00:00:00 2001
From: Can Demiralp
Date: Tue, 24 Dec 2024 10:48:18 +0100
Subject: [PATCH 6/7] [ECP-9240] Refactor the process to download the Apple Pay
domain association file, and change the misleading UI field label (#2818)
* [ECP-9240] Refactor download process
* [ECP-9240] Write unit tests for the controller
* [ECP-9240] Formatting
* [ECP-9240] Write unit tests
* [ECP-9240] Convert string label to phrase for localisation
* [ECP-9240] Start using CDN to download domain association file
---------
Co-authored-by: Can Demiralp
---
.../DownloadApplePayCertificate.php | 158 ------------------
.../DownloadApplePayDomainAssociationFile.php | 82 +++++++++
...> ApplePayDomainAssociationFileButton.php} | 14 +-
...nloadApplePayDomainAssociationFileTest.php | 144 ++++++++++++++++
...pplePayDomainAssociationFileButtonTest.php | 102 +++++++++++
.../adyen_alternative_payment_methods.xml | 4 +-
.../templates/config/applepay_button.phtml | 3 -
...lepay_domain_association_file_button.phtml | 4 +
8 files changed, 341 insertions(+), 170 deletions(-)
delete mode 100644 Controller/Adminhtml/Configuration/DownloadApplePayCertificate.php
create mode 100644 Controller/Adminhtml/Configuration/DownloadApplePayDomainAssociationFile.php
rename Model/Config/Adminhtml/{ApplepayCertificateButton.php => ApplePayDomainAssociationFileButton.php} (76%)
create mode 100644 Test/Unit/Controller/Adminhtml/Configuration/DownloadApplePayDomainAssociationFileTest.php
create mode 100644 Test/Unit/Model/Config/Adminhtml/ApplePayDomainAssociationFileButtonTest.php
delete mode 100644 view/adminhtml/templates/config/applepay_button.phtml
create mode 100644 view/adminhtml/templates/config/applepay_domain_association_file_button.phtml
diff --git a/Controller/Adminhtml/Configuration/DownloadApplePayCertificate.php b/Controller/Adminhtml/Configuration/DownloadApplePayCertificate.php
deleted file mode 100644
index 5af0c4dce..000000000
--- a/Controller/Adminhtml/Configuration/DownloadApplePayCertificate.php
+++ /dev/null
@@ -1,158 +0,0 @@
-
- */
-
-namespace Adyen\Payment\Controller\Adminhtml\Configuration;
-
-use Adyen\AdyenException;
-use Adyen\Payment\Helper\Config;
-use Adyen\Payment\Logger\AdyenLogger;
-use Magento\Framework\App\ResponseInterface;
-use Magento\Framework\Controller\Result\Redirect;
-use Magento\Framework\Controller\ResultInterface;
-use Magento\Framework\Exception\FileSystemException;
-use Magento\Framework\Exception\LocalizedException;
-use Magento\Framework\Filesystem\DirectoryList;
-use Magento\Backend\App\Action\Context;
-use Magento\Framework\Controller\ResultFactory;
-use Magento\Backend\App\Action;
-use Magento\Framework\Filesystem\Io\File;
-use Exception;
-use ZipArchive;
-
-class DownloadApplePayCertificate extends Action
-{
- const READ_LENGTH = 2048;
- const MAX_FILES = 10;
- const MAX_SIZE = 1000000;
- const MAX_RATIO = 5;
- const FILE_NAME = 'apple-developer-merchantid-domain-association';
- const APPLEPAY_CERTIFICATE_URL = 'https://docs.adyen.com/payment-methods/apple-pay/web-component/apple-developer-merchantid-domain-association-2024.zip';
- private $directoryList;
- private $fileIo;
- private $adyenLogger;
-
- public function __construct(
- Context $context,
- DirectoryList $directoryList,
- File $fileIo,
- AdyenLogger $adyenLogger
- )
- {
- parent::__construct($context);
- $this->directoryList = $directoryList;
- $this->fileIo = $fileIo;
- $this->adyenLogger = $adyenLogger;
- }
-
- /**
- * @return ResponseInterface|Redirect|Redirect&ResultInterface|ResultInterface
- * @throws FileSystemException
- * @throws LocalizedExceptionff
- */
- public function execute()
- {
- $redirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
- $redirect->setUrl($this->_redirect->getRefererUrl());
-
- $pubPath = $this->directoryList->getPath('pub');
- $directoryName = '.well-known';
-
- $wellknownPath = $pubPath . '/' . $directoryName;
- $applepayPath = $wellknownPath . '/' . self::FILE_NAME;
-
- $applepayUrl = self::APPLEPAY_CERTIFICATE_URL;
-
- try {
- if ($this->fileIo->checkAndCreateFolder($wellknownPath, 0700)) {
- $this->downloadAndUnzip($applepayUrl, $wellknownPath);
- } else {
- $this->fileIo->chmod($wellknownPath, 0770);
- if (!$this->fileIo->fileExists($applepayPath)) {
- $this->downloadAndUnzip($applepayUrl, $wellknownPath);
- }
- }
- } catch (Exception $e) {
- $errormessage = 'Failed to download the ApplePay certificate, please do so manually';
- $this->adyenLogger->addAdyenWarning($errormessage);
- $this->messageManager->addErrorMessage($errormessage);
- }
-
- return $redirect;
- }
-
- /**
- * @param string $applepayUrl
- * @param string $applepayPath
- * @return void
- * @throws LocalizedException
- */
- private function downloadAndUnzip(string $applepayUrl, string $applepayPath)
- {
- $tmpPath = tempnam(sys_get_temp_dir(), self::FILE_NAME);
- file_put_contents($tmpPath, file_get_contents($applepayUrl));
-
- $zip = new ZipArchive;
- $fileCount = 0;
- $totalSize = 0;
-
- if ($zip->open($tmpPath) === true) {
- for ($i = 0; $i < $zip->numFiles; $i++) {
- $filename = $zip->getNameIndex($i);
- if (self::FILE_NAME !== $filename) {
- continue;
- }
- $stats = $zip->statIndex($i);
-
- // Prevent ZipSlip path traversal (S6096)
- if (strpos($filename, '../') !== false ||
- substr($filename, 0, 1) === '/') {
- throw new AdyenException('The zip file is trying to ZipSlip please check the file');
- }
-
- if (substr($filename, -1) !== '/') {
- $fileCount++;
- if ($fileCount > 10) {
- // Reached max. number of files
- throw new AdyenException('Reached max number of files please check the zip file');
- }
-
- $applepayCerticateFilestream = $zip->getStream($filename); // Compliant
- $currentSize = 0;
- while (!feof($applepayCerticateFilestream)) {
- $currentSize += self::READ_LENGTH;
- $totalSize += self::READ_LENGTH;
-
- if ($totalSize > self::MAX_SIZE) {
- // Reached max. size
- throw new AdyenException('The file is larger than expected please check the zip file');
- }
-
- // Additional protection: check compression ratio
- if ($stats['comp_size'] > 0) {
- $ratio = $currentSize / $stats['comp_size'];
- if ($ratio > self::MAX_RATIO) {
- // Reached max. compression ratio
- throw new AdyenException('The uncompressed file is larger than expected');
- }
- }
- file_put_contents(
- $applepayPath .'/' . $filename,
- fread($applepayCerticateFilestream, $totalSize),
- FILE_APPEND
- );
- }
- fclose($applepayCerticateFilestream);
- }
- }
- $zip->close();
- }
- }
-}
diff --git a/Controller/Adminhtml/Configuration/DownloadApplePayDomainAssociationFile.php b/Controller/Adminhtml/Configuration/DownloadApplePayDomainAssociationFile.php
new file mode 100644
index 000000000..0726b316c
--- /dev/null
+++ b/Controller/Adminhtml/Configuration/DownloadApplePayDomainAssociationFile.php
@@ -0,0 +1,82 @@
+
+ */
+
+namespace Adyen\Payment\Controller\Adminhtml\Configuration;
+
+use Adyen\Payment\Logger\AdyenLogger;
+use Exception;
+use Magento\Framework\App\ResponseInterface;
+use Magento\Framework\Controller\ResultInterface;
+use Magento\Framework\Exception\FileSystemException;
+use Magento\Framework\Filesystem\DirectoryList;
+use Magento\Backend\App\Action\Context;
+use Magento\Framework\Controller\ResultFactory;
+use Magento\Backend\App\Action;
+use Magento\Framework\Filesystem\Io\File;
+
+class DownloadApplePayDomainAssociationFile extends Action
+{
+ const FILE_NAME = 'apple-developer-merchantid-domain-association';
+ const REMOTE_PATH = 'https://bae81f955b.cdn.adyen.com/checkoutshopper/.well-known';
+ const PUB_PATH = 'pub';
+ const WELL_KNOWN_PATH = '.well-known';
+
+ public function __construct(
+ private readonly Context $context,
+ private readonly DirectoryList $directoryList,
+ private readonly File $fileIo,
+ private readonly AdyenLogger $adyenLogger
+ ) {
+ parent::__construct($context);
+ }
+
+ /**
+ * @return ResultInterface|ResponseInterface
+ * @throws FileSystemException
+ */
+ public function execute(): ResultInterface|ResponseInterface
+ {
+ $redirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
+ $redirect->setUrl($this->_redirect->getRefererUrl());
+
+ try {
+ $pubPath = $this->directoryList->getPath(self::PUB_PATH);
+
+ $this->fileIo->checkAndCreateFolder(
+ sprintf("%s/%s", $pubPath, self::WELL_KNOWN_PATH),
+ 0700
+ );
+
+ $source = sprintf("%s/%s", self::REMOTE_PATH, self::FILE_NAME);
+ $destination = sprintf("%s/%s/%s", $pubPath, self::WELL_KNOWN_PATH, self::FILE_NAME);
+
+ $file = $this->fileIo->read($source, $destination);
+
+ if (!$file) {
+ $errorMessage =
+ __('Error while downloading Apple Pay domain association file from the remote source!');
+ $this->adyenLogger->error(sprintf("%s %s", $errorMessage, $source));
+ $this->messageManager->addErrorMessage($errorMessage);
+ } else {
+ $successMessage = __('Apple Pay domain association file has been downloaded successfully!');
+ $this->adyenLogger->addAdyenDebug($successMessage);
+ $this->messageManager->addSuccessMessage($successMessage);
+ }
+ } catch (Exception $e) {
+ $errorMessage =
+ __('Unknown error while downloading Apple Pay domain association file!');
+ $this->adyenLogger->error(sprintf("%s %s", $errorMessage, $e->getMessage()));
+ $this->messageManager->addErrorMessage($errorMessage);
+ }
+
+ return $redirect;
+ }
+}
diff --git a/Model/Config/Adminhtml/ApplepayCertificateButton.php b/Model/Config/Adminhtml/ApplePayDomainAssociationFileButton.php
similarity index 76%
rename from Model/Config/Adminhtml/ApplepayCertificateButton.php
rename to Model/Config/Adminhtml/ApplePayDomainAssociationFileButton.php
index 4dc52c5de..16de30dd4 100644
--- a/Model/Config/Adminhtml/ApplepayCertificateButton.php
+++ b/Model/Config/Adminhtml/ApplePayDomainAssociationFileButton.php
@@ -16,14 +16,14 @@
use Magento\Backend\Helper\Data;
use Magento\Framework\Data\Form\Element\AbstractElement;
-class ApplepayCertificateButton extends Field
+class ApplePayDomainAssociationFileButton extends Field
{
- const APPLEPAY_BUTTON = 'Adyen_Payment::config/applepay_button.phtml';
+ const APPLEPAY_BUTTON = 'Adyen_Payment::config/applepay_domain_association_file_button.phtml';
/**
* @var Data
*/
- protected $backendHelper;
+ protected Data $backendHelper;
/**
* @param Context $context
@@ -40,9 +40,9 @@ public function __construct(
}
/**
- * @return $this|ApplepayCertificateButton
+ * @return $this|ApplePayDomainAssociationFileButton
*/
- protected function _prepareLayout()
+ protected function _prepareLayout(): ApplePayDomainAssociationFileButton|static
{
parent::_prepareLayout();
@@ -57,7 +57,7 @@ protected function _prepareLayout()
* @param AbstractElement $element
* @return string
*/
- protected function _getElementHtml(AbstractElement $element)
+ protected function _getElementHtml(AbstractElement $element): string
{
$this->addData([
'id' => 'addbutton_button',
@@ -73,6 +73,6 @@ protected function _getElementHtml(AbstractElement $element)
*/
public function getActionUrl(): string
{
- return $this->backendHelper->getUrl("adyen/configuration/DownloadApplePayCertificate");
+ return $this->backendHelper->getUrl("adyen/configuration/DownloadApplePayDomainAssociationFile");
}
}
diff --git a/Test/Unit/Controller/Adminhtml/Configuration/DownloadApplePayDomainAssociationFileTest.php b/Test/Unit/Controller/Adminhtml/Configuration/DownloadApplePayDomainAssociationFileTest.php
new file mode 100644
index 000000000..954e61f63
--- /dev/null
+++ b/Test/Unit/Controller/Adminhtml/Configuration/DownloadApplePayDomainAssociationFileTest.php
@@ -0,0 +1,144 @@
+redirectMock = $this->createMock(RedirectInterface::class);
+
+ $this->resultMock = $this->createGeneratedMock(
+ Redirect::class
+ );
+
+ $this->resultFactoryMock = $this->createGeneratedMock(
+ ResultFactory::class,
+ ['create']
+ );
+ $this->resultFactoryMock->method('create')->willReturn($this->resultMock);
+
+ $this->managerMock = $this->createMock(ManagerInterface::class);
+
+ $this->contextMock = $this->createMock(Context::class);
+ $this->contextMock->method('getResultFactory')->willReturn($this->resultFactoryMock);
+ $this->contextMock->method('getRedirect')->willReturn($this->redirectMock);
+ $this->contextMock->method('getMessageManager')->willReturn($this->managerMock);
+
+ $this->directoryListMock = $this->createMock(DirectoryList::class);
+ $this->fileIoMock = $this->createMock(File::class);
+ $this->adyenLoggerMock = $this->createMock(AdyenLogger::class);
+
+
+ $this->downloadApplePayDomainAssociationFile = new DownloadApplePayDomainAssociationFile(
+ $this->contextMock,
+ $this->directoryListMock,
+ $this->fileIoMock,
+ $this->adyenLoggerMock
+ );
+ }
+
+ /**
+ * @return void
+ * @throws FileSystemException
+ */
+ public function testDownloadFileSuccessfully(): void
+ {
+ $this->directoryListMock->method('getPath')
+ ->with('pub')
+ ->willReturn('/var/www/html/pub');
+
+ $this->fileIoMock->method('checkAndCreateFolder')
+ ->with('/var/www/html/pub/.well-known')
+ ->willReturn(true);
+
+ $this->fileIoMock->method('read')
+ ->with(
+ 'https://bae81f955b.cdn.adyen.com/checkoutshopper/.well-known/apple-developer-merchantid-domain-association',
+ '/var/www/html/pub/.well-known/apple-developer-merchantid-domain-association'
+ )
+ ->willReturn(true);
+
+ $this->adyenLoggerMock->expects($this->atLeastOnce())->method('addAdyenDebug');
+ $this->managerMock->expects($this->once())->method('addSuccessMessage');
+
+ $redirectResponse = $this->downloadApplePayDomainAssociationFile->execute();
+
+ $this->assertInstanceOf(Redirect::class, $redirectResponse);
+ }
+
+ /**
+ * @return void
+ * @throws FileSystemException
+ */
+ public function testHttpNotFound(): void
+ {
+ $this->directoryListMock->method('getPath')
+ ->with('pub')
+ ->willReturn('/var/www/html/pub');
+
+ $this->fileIoMock->method('checkAndCreateFolder')
+ ->with('/var/www/html/pub/.well-known')
+ ->willReturn(true);
+
+ $this->fileIoMock->method('read')
+ ->with(
+ 'https://bae81f955b.cdn.adyen.com/checkoutshopper/.well-known/apple-developer-merchantid-domain-association',
+ '/var/www/html/pub/.well-known/apple-developer-merchantid-domain-association'
+ )
+ ->willReturn(false);
+
+ $this->adyenLoggerMock->expects($this->atLeastOnce())->method('error');
+ $this->managerMock->expects($this->once())->method('addErrorMessage');
+
+ $redirectResponse = $this->downloadApplePayDomainAssociationFile->execute();
+
+ $this->assertInstanceOf(Redirect::class, $redirectResponse);
+ }
+
+ /**
+ * @return void
+ * @throws FileSystemException
+ */
+ public function testFileSystemIOError(): void
+ {
+ $this->directoryListMock->method('getPath')
+ ->with('pub')
+ ->willReturn('/var/www/html/pub');
+
+ $this->fileIoMock->method('checkAndCreateFolder')
+ ->willThrowException(new LocalizedException(__('mock error message')));
+
+ $this->adyenLoggerMock->expects($this->atLeastOnce())->method('error');
+ $this->managerMock->expects($this->once())->method('addErrorMessage');
+
+ $redirectResponse = $this->downloadApplePayDomainAssociationFile->execute();
+
+ $this->assertInstanceOf(Redirect::class, $redirectResponse);
+ }
+}
diff --git a/Test/Unit/Model/Config/Adminhtml/ApplePayDomainAssociationFileButtonTest.php b/Test/Unit/Model/Config/Adminhtml/ApplePayDomainAssociationFileButtonTest.php
new file mode 100644
index 000000000..f79be89c4
--- /dev/null
+++ b/Test/Unit/Model/Config/Adminhtml/ApplePayDomainAssociationFileButtonTest.php
@@ -0,0 +1,102 @@
+createMock(ObjectManagerInterface::class);
+ ObjectManager::setInstance($objectManagerMock);
+
+ $this->managerMock = $this->createMock(ManagerInterface::class);
+ $this->scopeConfigMock = $this->createMock(ScopeConfigInterface::class);
+
+ $this->contextMock = $this->createMock(Context::class);
+ $this->contextMock->method('getScopeConfig')->willReturn($this->scopeConfigMock);
+ $this->contextMock->method('getEventManager')->willReturn($this->managerMock);
+
+ $this->backendHelperMock = $this->createMock(Data::class);
+ $this->layoutMock = $this->createMock(LayoutInterface::class);
+
+ $this->applePayDomainAssociationFileButton = new ApplePayDomainAssociationFileButton(
+ $this->contextMock,
+ $this->backendHelperMock,
+ []
+ );
+ }
+
+ /**
+ * @return void
+ */
+ public function tearDown(): void
+ {
+ $this->applePayDomainAssociationFileButton = null;
+ }
+
+ /**
+ * Asserts default HTML template value
+ *
+ * @return void
+ */
+ public function testGetElementHtml()
+ {
+ $expected = ' | | |
';
+
+ $result = $this->applePayDomainAssociationFileButton
+ ->render($this->createMock(AbstractElement::class));
+
+ $this->assertEquals($expected, $result);
+ }
+
+ /**
+ * Asserts return type of the button's backend model
+ *
+ * @return void
+ */
+ public function testPrepareLayout()
+ {
+ $result = $this->applePayDomainAssociationFileButton->setLayout($this->layoutMock);
+ $this->assertInstanceOf(ApplePayDomainAssociationFileButton::class, $result);
+ }
+
+ /**
+ * Asserts file download controller URL
+ *
+ * @return void
+ */
+ public function testGetActionUrl()
+ {
+ $expected = 'https://www.magento.demo/adyen/configuration/DownloadApplePayDomainAssociationFile';
+ $this->backendHelperMock->expects($this->once())
+ ->method('getUrl')
+ ->with('adyen/configuration/DownloadApplePayDomainAssociationFile', [])
+ ->willReturn($expected);
+
+ $url = $this->applePayDomainAssociationFileButton->getActionUrl();
+
+ $this->assertEquals($expected, $url);
+ }
+}
diff --git a/etc/adminhtml/system/adyen_alternative_payment_methods.xml b/etc/adminhtml/system/adyen_alternative_payment_methods.xml
index 21dcfb7a8..ae858674c 100755
--- a/etc/adminhtml/system/adyen_alternative_payment_methods.xml
+++ b/etc/adminhtml/system/adyen_alternative_payment_methods.xml
@@ -19,8 +19,8 @@
Set up additional payment methods to accept online and in-app payments and eliminate the need for traditional card-based transactions.
]]>
-
- Adyen\Payment\Model\Config\Adminhtml\ApplepayCertificateButton
+
+ Adyen\Payment\Model\Config\Adminhtml\ApplePayDomainAssociationFileButton
diff --git a/view/adminhtml/templates/config/applepay_button.phtml b/view/adminhtml/templates/config/applepay_button.phtml
deleted file mode 100644
index e57195c9f..000000000
--- a/view/adminhtml/templates/config/applepay_button.phtml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/view/adminhtml/templates/config/applepay_domain_association_file_button.phtml b/view/adminhtml/templates/config/applepay_domain_association_file_button.phtml
new file mode 100644
index 000000000..a25f33302
--- /dev/null
+++ b/view/adminhtml/templates/config/applepay_domain_association_file_button.phtml
@@ -0,0 +1,4 @@
+
+
From 6c468e019cc060556437d0885ccd3320334ba0f9 Mon Sep 17 00:00:00 2001
From: candemiralp <20255503+candemiralp@users.noreply.github.com>
Date: Tue, 24 Dec 2024 09:48:37 +0000
Subject: [PATCH 7/7] chore(release): bump to 9.12.2
---
VERSION | 2 +-
composer.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/VERSION b/VERSION
index 69dd35629..be62bf9b1 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-9.12.1
+9.12.2
diff --git a/composer.json b/composer.json
index a9a2f6eec..6c775c934 100755
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
"name": "adyen/module-payment",
"description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.",
"type": "magento2-module",
- "version": "9.12.1",
+ "version": "9.12.2",
"license": "MIT",
"repositories": [
{