From 5db4bfb1d2b27c3b01cd36836e82e31e06699a09 Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Mon, 29 Apr 2024 13:16:43 +0200 Subject: [PATCH 01/11] Bugfix: Hide non-applicable Apple Pay options --- etc/adminhtml/methods/applepay.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/adminhtml/methods/applepay.xml b/etc/adminhtml/methods/applepay.xml index 0fefe3579f8..0fedcfc76ed 100644 --- a/etc/adminhtml/methods/applepay.xml +++ b/etc/adminhtml/methods/applepay.xml @@ -85,6 +85,7 @@ Mollie\Payment\Model\Adminhtml\Source\ApplePayButtonColor 1 + direct 1 @@ -98,6 +99,7 @@ Mollie\Payment\Model\Adminhtml\Source\ApplePayButtonText 1 + direct 1 @@ -124,6 +126,7 @@ Mollie\Payment\Model\Adminhtml\Source\ApplePayButtonColor 1 + direct 1 @@ -137,6 +140,7 @@ Mollie\Payment\Model\Adminhtml\Source\ApplePayButtonText 1 + direct 1 From 1c15ca8e77b9fd94772890b910b331389efae1fe Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Mon, 29 Apr 2024 14:45:18 +0200 Subject: [PATCH 02/11] Feature: Added Bancomat Pay --- .../templates/magento/configure-mollie.sh | 1 + Helper/General.php | 1 + Model/Methods/Bancomat.php | 24 +++ Model/MollieConfigProvider.php | 1 + README.md | 1 + Service/Mollie/PaymentMethods.php | 1 + .../cypress/e2e/magento/checkout.cy.js | 1 + .../Etc/Config/MethodsConfigurationTest.php | 1 + Test/Integration/Helper/GeneralTest.php | 1 + .../Model/Methods/BancomatTest.php | 12 ++ .../Model/MollieConfigProviderTest.php | 1 + .../Service/Config/PaymentFeeTest.php | 1 + .../Order/CreateInvoiceOnShipmentTest.php | 1 - composer.json | 2 + etc/adminhtml/methods.xml | 1 + etc/adminhtml/methods/bancomat.xml | 151 ++++++++++++++++++ etc/adminhtml/methods/bancontact.xml | 2 +- etc/adminhtml/methods/banktransfer.xml | 2 +- etc/adminhtml/methods/belfius.xml | 2 +- etc/adminhtml/methods/billie.xml | 2 +- etc/adminhtml/methods/blik.xml | 2 +- etc/adminhtml/methods/creditcard.xml | 2 +- etc/adminhtml/methods/directdebit.xml | 2 +- etc/adminhtml/methods/eps.xml | 2 +- etc/adminhtml/methods/giftcard.xml | 2 +- etc/adminhtml/methods/giropay.xml | 2 +- etc/adminhtml/methods/ideal.xml | 2 +- etc/adminhtml/methods/in3.xml | 2 +- etc/adminhtml/methods/kbc.xml | 2 +- etc/adminhtml/methods/klarna.xml | 2 +- etc/adminhtml/methods/klarnapaylater.xml | 2 +- etc/adminhtml/methods/klarnapaynow.xml | 2 +- etc/adminhtml/methods/klarnasliceit.xml | 2 +- etc/adminhtml/methods/mybank.xml | 2 +- etc/adminhtml/methods/paymentlink.xml | 2 +- etc/adminhtml/methods/paypal.xml | 2 +- etc/adminhtml/methods/paysafecard.xml | 2 +- etc/adminhtml/methods/pointofsale.xml | 2 +- etc/adminhtml/methods/przelewy24.xml | 2 +- etc/adminhtml/methods/sofort.xml | 2 +- etc/adminhtml/methods/twint.xml | 2 +- etc/adminhtml/methods/voucher.xml | 2 +- etc/config.xml | 19 +++ etc/di.xml | 45 ++++++ etc/graphql/di.xml | 1 + etc/payment.xml | 3 + i18n/de_DE.csv | 1 + i18n/en_US.csv | 1 + i18n/es_ES.csv | 1 + i18n/fr_FR.csv | 1 + i18n/nl_NL.csv | 1 + .../templates/form/mollie_paymentlink.phtml | 1 + view/adminhtml/web/images/bancomat.svg | 11 ++ view/frontend/layout/checkout_index_index.xml | 3 + view/frontend/web/images/methods/bancomat.svg | 11 ++ .../web/js/view/payment/method-renderer.js | 1 + 56 files changed, 326 insertions(+), 27 deletions(-) create mode 100644 Model/Methods/Bancomat.php create mode 100644 Test/Integration/Model/Methods/BancomatTest.php create mode 100644 etc/adminhtml/methods/bancomat.xml create mode 100644 view/adminhtml/web/images/bancomat.svg create mode 100644 view/frontend/web/images/methods/bancomat.svg diff --git a/.github/workflows/templates/magento/configure-mollie.sh b/.github/workflows/templates/magento/configure-mollie.sh index 3cab4876433..e9ab85a8518 100644 --- a/.github/workflows/templates/magento/configure-mollie.sh +++ b/.github/workflows/templates/magento/configure-mollie.sh @@ -23,6 +23,7 @@ bin/magento config:set payment/mollie_methods_paypal/active 1 & bin/magento config:set payment/mollie_methods_przelewy24/active 1 & bin/magento config:set payment/mollie_methods_alma/active 1 & bin/magento config:set payment/mollie_methods_bancontact/active 1 & +bin/magento config:set payment/mollie_methods_bancomat/active 1 & bin/magento config:set payment/mollie_methods_belfius/active 1 & bin/magento config:set payment/mollie_methods_eps/active 1 & bin/magento config:set payment/mollie_methods_giropay/active 1 & diff --git a/Helper/General.php b/Helper/General.php index 242f055885d..c34ecf681c1 100755 --- a/Helper/General.php +++ b/Helper/General.php @@ -621,6 +621,7 @@ public function getAllActiveMethods($storeId) $methodCodes = [ 'mollie_methods_applepay', 'mollie_methods_alma', + 'mollie_methods_bancomat', 'mollie_methods_bancontact', 'mollie_methods_banktransfer', 'mollie_methods_belfius', diff --git a/Model/Methods/Bancomat.php b/Model/Methods/Bancomat.php new file mode 100644 index 00000000000..2c6586c9ade --- /dev/null +++ b/Model/Methods/Bancomat.php @@ -0,0 +1,24 @@ + { const availableMethods = Cypress.env('mollie_available_methods'); [ 'alma', + 'bancomat', 'bancontact', 'banktransfer', 'belfius', diff --git a/Test/Integration/Etc/Config/MethodsConfigurationTest.php b/Test/Integration/Etc/Config/MethodsConfigurationTest.php index b5dd4a45797..e27254d492a 100644 --- a/Test/Integration/Etc/Config/MethodsConfigurationTest.php +++ b/Test/Integration/Etc/Config/MethodsConfigurationTest.php @@ -16,6 +16,7 @@ public function methods(): array return [ ['mollie_methods_applepay'], ['mollie_methods_alma'], + ['mollie_methods_bancomat'], ['mollie_methods_bancontact'], ['mollie_methods_banktransfer'], ['mollie_methods_belfius'], diff --git a/Test/Integration/Helper/GeneralTest.php b/Test/Integration/Helper/GeneralTest.php index 2361be46d23..c4326854074 100644 --- a/Test/Integration/Helper/GeneralTest.php +++ b/Test/Integration/Helper/GeneralTest.php @@ -143,6 +143,7 @@ public function getMethodCodeDataProvider() 'applepay' => ['mollie_methods_applepay', 'applepay'], 'alma' => ['mollie_methods_alma', 'alma'], + 'bancomat' => ['mollie_methods_bancomat', 'bancomat'], 'bancontact' => ['mollie_methods_bancontact', 'bancontact'], 'banktransfer' => ['mollie_methods_banktransfer', 'banktransfer'], 'belfius' => ['mollie_methods_belfius', 'belfius'], diff --git a/Test/Integration/Model/Methods/BancomatTest.php b/Test/Integration/Model/Methods/BancomatTest.php new file mode 100644 index 00000000000..00e7341b109 --- /dev/null +++ b/Test/Integration/Model/Methods/BancomatTest.php @@ -0,0 +1,12 @@ +assertArrayHasKey('mollie_methods_applepay', $result['payment']['image']); $this->assertArrayHasKey('mollie_methods_alma', $result['payment']['image']); + $this->assertArrayHasKey('mollie_methods_bancomat', $result['payment']['image']); $this->assertArrayHasKey('mollie_methods_bancontact', $result['payment']['image']); $this->assertArrayHasKey('mollie_methods_banktransfer', $result['payment']['image']); $this->assertArrayHasKey('mollie_methods_belfius', $result['payment']['image']); diff --git a/Test/Integration/Service/Config/PaymentFeeTest.php b/Test/Integration/Service/Config/PaymentFeeTest.php index 13388b2c0e3..91d7de77dd9 100644 --- a/Test/Integration/Service/Config/PaymentFeeTest.php +++ b/Test/Integration/Service/Config/PaymentFeeTest.php @@ -25,6 +25,7 @@ public function isAvailableForMethodProvider() return [ ['mollie_methods_applepay', true], ['mollie_methods_alma', true], + ['mollie_methods_bancomat', true], ['mollie_methods_bancontact', true], ['mollie_methods_banktransfer', true], ['mollie_methods_belfius', true], diff --git a/Test/Integration/Service/Mollie/Order/CreateInvoiceOnShipmentTest.php b/Test/Integration/Service/Mollie/Order/CreateInvoiceOnShipmentTest.php index fa68bb60df7..53e3c288c86 100644 --- a/Test/Integration/Service/Mollie/Order/CreateInvoiceOnShipmentTest.php +++ b/Test/Integration/Service/Mollie/Order/CreateInvoiceOnShipmentTest.php @@ -2,7 +2,6 @@ namespace Mollie\Payment\Test\Integration\Service\Mollie\Order; -use Mollie\Payment\Model\Adminhtml\Source\InvoiceMoment; use Mollie\Payment\Model\Methods\Bancontact; use Mollie\Payment\Model\Methods\Banktransfer; use Mollie\Payment\Model\Methods\Billie; diff --git a/composer.json b/composer.json index e10f2156b2c..70736e173ef 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,8 @@ "apple pay", "alma", "bancontact", + "bancomat", + "bancomat pay", "banktransfer", "belfius", "belfius direct net", diff --git a/etc/adminhtml/methods.xml b/etc/adminhtml/methods.xml index d3402c05eb3..d4f2dc122cc 100644 --- a/etc/adminhtml/methods.xml +++ b/etc/adminhtml/methods.xml @@ -7,6 +7,7 @@ + diff --git a/etc/adminhtml/methods/bancomat.xml b/etc/adminhtml/methods/bancomat.xml new file mode 100644 index 00000000000..80cfe0b28ac --- /dev/null +++ b/etc/adminhtml/methods/bancomat.xml @@ -0,0 +1,151 @@ + + + + + + + Magento\Config\Model\Config\Source\Yesno + payment/mollie_methods_bancomat/active + + + + payment/mollie_methods_bancomat/title + + 1 + + + + + Mollie\Payment\Model\Adminhtml\Source\Method + payment/mollie_methods_bancomat/method + + 1 + + here + to read more about the differences between the Payment and Orders API.]]> + + + + payment/mollie_methods_bancomat/payment_description + + + payment + 1 + + + + + validate-digits-range digits-range-1-365 + payment/mollie_methods_bancomat/days_before_expire + + 1 + order + + How many days before orders for this method becomes expired? Leave empty to use default expiration (28 days) + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + payment/mollie_methods_bancomat/allowspecific + + 1 + + + + + Magento\Directory\Model\Config\Source\Country + 1 + payment/mollie_methods_bancomat/specificcountry + + 1 + + + + + payment/mollie_methods_bancomat/min_order_total + + 1 + + + + + payment/mollie_methods_bancomat/max_order_total + + 1 + + + + + payment/mollie_methods_bancomat/payment_surcharge_type + Mollie\Payment\Model\Adminhtml\Source\PaymentFeeType + + 1 + + + + + payment/mollie_methods_bancomat/payment_surcharge_fixed_amount + Mollie\Payment\Model\Adminhtml\Backend\VerifiyPaymentFee + validate-not-negative-number + + 1 + fixed_fee,fixed_fee_and_percentage + + + + + payment/mollie_methods_bancomat/payment_surcharge_percentage + Mollie\Payment\Model\Adminhtml\Backend\VerifiyPaymentFee + validate-number-range number-range-0-10 + + 1 + percentage,fixed_fee_and_percentage + + + + + payment/mollie_methods_bancomat/payment_surcharge_limit + + Mollie\Payment\Model\Adminhtml\Backend\VerifiyPaymentFee + validate-not-negative-number + + 1 + percentage,fixed_fee_and_percentage + + + + + payment/mollie_methods_bancomat/payment_surcharge_tax_class + \Magento\Tax\Model\TaxClass\Source\Product + + 1 + fixed_fee,percentage,fixed_fee_and_percentage + + + + + validate-number + payment/mollie_methods_bancomat/sort_order + + 1 + + + + diff --git a/etc/adminhtml/methods/bancontact.xml b/etc/adminhtml/methods/bancontact.xml index 74a44308b04..28fbf32e411 100644 --- a/etc/adminhtml/methods/bancontact.xml +++ b/etc/adminhtml/methods/bancontact.xml @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - 0 1 + + 1 + Mollie\Payment\Model\Methods\Bancomat + Bancomat Pay + {ordernumber} + payment + order + 0 + + 1 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 1 + 1 Mollie\Payment\Model\Methods\Banktransfer diff --git a/etc/di.xml b/etc/di.xml index 9fb71038043..7318ae4aac2 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -507,6 +507,51 @@ + + + + Magento\Payment\Block\Form + Mollie\Payment\Block\Info\Base + MollieBancomatValueHandlerPool + MollieCommandPool + MollieBancomatValidatorPool + + + + + + + MollieBancomatConfigValueHandler + + + + + + + MollieBancomatConfig + + + + + + Mollie\Payment\Model\Methods\Bancomat::CODE + + + + + + + MollieBancomatCountryValidator + + + + + + + MollieBancomatConfig + + + diff --git a/etc/graphql/di.xml b/etc/graphql/di.xml index 5017366df3e..1b96dea2894 100644 --- a/etc/graphql/di.xml +++ b/etc/graphql/di.xml @@ -10,6 +10,7 @@ Mollie\Payment\GraphQL\DataProvider Mollie\Payment\GraphQL\DataProvider + Mollie\Payment\GraphQL\DataProvider Mollie\Payment\GraphQL\DataProvider Mollie\Payment\GraphQL\DataProvider Mollie\Payment\GraphQL\DataProvider diff --git a/etc/payment.xml b/etc/payment.xml index 16c2a8ede56..c391d18c3b1 100644 --- a/etc/payment.xml +++ b/etc/payment.xml @@ -15,6 +15,9 @@ 0 + + 0 + 0 diff --git a/i18n/de_DE.csv b/i18n/de_DE.csv index 55074350eb4..5f5c7067919 100644 --- a/i18n/de_DE.csv +++ b/i18n/de_DE.csv @@ -194,6 +194,7 @@ "Sorting Order","Sortierreihenfolge" "Alma","Alma" "Bancontact","Bancontact" +"Bancomat Pay","Bancomat Pay" "Banktransfer","Banküberweisung" "Status Pending","Status ausstehend" "We recommend using another 'pending' status as the default Magento pending status can automatically cancel the order before the payment expiry time is reached.
By default the status ""Pending Payment"" is not visible for customers, therefore we advise you to create a new status for this, which should also be visible to the customer, informing them they still have to complete their payment.","Wir empfehlen, einen anderen als den standardmäßigen ausstehenden Status von Magento zu verwenden, da die Zahlung bei diesem vor Ablauf der Zahlungsfrist automatisch storniert werden kann.
Standardmäßig ist der Status „Ausstehende Zahlung“ für den Kunden nicht sichtbar. Wir empfehlen Ihnen daher, einen neuen Status zu erstellen, der auch für den Kunden sichtbar ist und ihm mitteilt, dass er die Zahlung noch vervollständigen muss." diff --git a/i18n/en_US.csv b/i18n/en_US.csv index b09a1b55a5c..47dd21fa85c 100644 --- a/i18n/en_US.csv +++ b/i18n/en_US.csv @@ -194,6 +194,7 @@ "Sorting Order","Sorting Order" "Alma","Alma" "Bancontact","Bancontact" +"Bancomat Pay","Bancomat Pay" "Banktransfer","Banktransfer" "Status Pending","Status Pending" "We recommend using another 'pending' status as the default Magento pending status can automatically cancel the order before the payment expiry time is reached.
By default the status ""Pending Payment"" is not visible for customers, therefore we advise you to create a new status for this, which should also be visible to the customer, informing them they still have to complete their payment.","We recommend using another 'pending' status as the default Magento pending status can automatically cancel the order before the payment expiry time is reached.
By default the status ""Pending Payment"" is not visible for customers, therefore we advise you to create a new status for this, which should also be visible to the customer, informing them they still have to complete their payment." diff --git a/i18n/es_ES.csv b/i18n/es_ES.csv index b8a8db57c49..c15a6c313dc 100644 --- a/i18n/es_ES.csv +++ b/i18n/es_ES.csv @@ -194,6 +194,7 @@ "Sorting Order","Orden de clasificación" "Alma","Alma" "Bancontact","Contacto bancario" +"Bancomat Pay","Bancomat Pay" "Banktransfer","Transferencia bancaria" "Status Pending","Estado pendiente" "We recommend using another 'pending' status as the default Magento pending status can automatically cancel the order before the payment expiry time is reached.
By default the status ""Pending Payment"" is not visible for customers, therefore we advise you to create a new status for this, which should also be visible to the customer, informing them they still have to complete their payment.","Recomendamos utilizar otro estado 'pendiente', ya que el estado pendiente por defecto de Magento puede cancelar automáticamente el pedido antes de que se llegue a la fecha de vencimiento del pago.
Por defecto, el estado «Pago pendiente» no es visible para los clientes, por lo que le aconsejamos que cree un nuevo estado para esto, que también debería ser visible para el cliente, que le informe de que todavía tiene que completar su pago." diff --git a/i18n/fr_FR.csv b/i18n/fr_FR.csv index 4128f6df607..364504e61d7 100644 --- a/i18n/fr_FR.csv +++ b/i18n/fr_FR.csv @@ -194,6 +194,7 @@ "Sorting Order","Tri des commandes" "Alma","Alma" "Bancontact","Bancontact" +"Bancomat Pay","Bancomat Pay" "Banktransfer","Virement bancaire" "Status Pending","Statut en attente" "We recommend using another 'pending' status as the default Magento pending status can automatically cancel the order before the payment expiry time is reached.
By default the status ""Pending Payment"" is not visible for customers, therefore we advise you to create a new status for this, which should also be visible to the customer, informing them they still have to complete their payment.","Nous vous recommandons d'utiliser un autre statut «en attente», car le statut en attente Magento par défaut peut annuler automatiquement la commande avant même l'expiration du délai de paiement.
Comme le statut «Paiement en attente» n'est pas visible par défaut par les clients, nous vous recommandons de créer un nouveau statut qui sera visible par la clientèle et l'informera qu'elle doit finaliser son paiement." diff --git a/i18n/nl_NL.csv b/i18n/nl_NL.csv index ce54e3eba97..159fb1dd14a 100644 --- a/i18n/nl_NL.csv +++ b/i18n/nl_NL.csv @@ -194,6 +194,7 @@ "Sorting Order","Sorteervolgorde" "Alma","Alma" "Bancontact","Bancontact" +"Bancomat Pay","Bancomat Pay" "Banktransfer","Bankoverschrijving" "Status Pending","Status openstaand" "We recommend using another 'pending' status as the default Magento pending status can automatically cancel the order before the payment expiry time is reached.
By default the status ""Pending Payment"" is not visible for customers, therefore we advise you to create a new status for this, which should also be visible to the customer, informing them they still have to complete their payment.","Wij raden u aan om een andere status voor 'openstaand' te gebruiken, omdat de standaard Magento-status 'openstaand' de bestelling automatisch kan annuleren, voordat de vervaltermijn is afgelopen.
Standaard is de status 'openstaande betaling' niet zichtbaar voor klanten, daarom adviseren wij u om hiervoor een nieuwe status aan te maken, die ook zichtbaar is voor de klant, om hem te laten weten dat hij zijn betaling nog dient te voltooien." diff --git a/view/adminhtml/templates/form/mollie_paymentlink.phtml b/view/adminhtml/templates/form/mollie_paymentlink.phtml index ba4307efcd2..0bd03b44ecd 100644 --- a/view/adminhtml/templates/form/mollie_paymentlink.phtml +++ b/view/adminhtml/templates/form/mollie_paymentlink.phtml @@ -18,6 +18,7 @@ $code; ?>" style="display:none">
- + diff --git a/view/adminhtml/web/images/bancomat.svg b/view/adminhtml/web/images/bancomatpay.svg similarity index 100% rename from view/adminhtml/web/images/bancomat.svg rename to view/adminhtml/web/images/bancomatpay.svg diff --git a/view/frontend/layout/checkout_index_index.xml b/view/frontend/layout/checkout_index_index.xml index 168ef03c03b..f9bcb490a6b 100644 --- a/view/frontend/layout/checkout_index_index.xml +++ b/view/frontend/layout/checkout_index_index.xml @@ -33,7 +33,7 @@ true - + true diff --git a/view/frontend/web/images/methods/bancomat.svg b/view/frontend/web/images/methods/bancomatpay.svg similarity index 100% rename from view/frontend/web/images/methods/bancomat.svg rename to view/frontend/web/images/methods/bancomatpay.svg diff --git a/view/frontend/web/js/view/payment/method-renderer.js b/view/frontend/web/js/view/payment/method-renderer.js index 3787b288218..aeb260dc740 100644 --- a/view/frontend/web/js/view/payment/method-renderer.js +++ b/view/frontend/web/js/view/payment/method-renderer.js @@ -30,7 +30,7 @@ define( var methods = [ {type: 'mollie_methods_alma', component: defaultComponent}, - {type: 'mollie_methods_bancomat', component: defaultComponent}, + {type: 'mollie_methods_bancomatpay', component: defaultComponent}, {type: 'mollie_methods_bancontact', component: defaultComponent}, {type: 'mollie_methods_banktransfer', component: defaultComponent}, {type: 'mollie_methods_belfius', component: defaultComponent},