diff --git a/Helper/General.php b/Helper/General.php index d615f9ade28..524f749ce52 100755 --- a/Helper/General.php +++ b/Helper/General.php @@ -614,6 +614,7 @@ public function getAllActiveMethods($storeId) 'mollie_methods_klarnasliceit', 'mollie_methods_giftcard', 'mollie_methods_przelewy24', + 'mollie_methods_applepay', ]; foreach ($methodCodes as $methodCode) { diff --git a/Model/Methods/ApplePay.php b/Model/Methods/ApplePay.php new file mode 100644 index 00000000000..de8406565ed --- /dev/null +++ b/Model/Methods/ApplePay.php @@ -0,0 +1,25 @@ +checkoutSession->getQuote(); $amount = $this->mollieHelper->getOrderAmountByQuote($quote); - $params = ["amount[value]" => $amount['value'], - "amount[currency]" => $amount['currency'], - "resource" => "orders" + $params = [ + 'amount[value]' => $amount['value'], + 'amount[currency]' => $amount['currency'], + 'resource' => 'orders', + 'includeWallets' => 'applepay', ]; $apiMethods = $mollieApi->methods->all($params); diff --git a/README.md b/README.md index 14c00f33234..6a8b07fdd27 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,9 @@ Mollie requires no minimum costs, no fixed contracts, no hidden costs. At Mollie - Klarna -- Giftcards +- Giftcards + +- Apple Pay ## Configuration, FAQ and Troubleshooting ## If you experience problems with the extension installation, setup or whenever you need more information about how to setup the Mollie Payment extension in Magento 2.x, please see our [WIKI Page](https://github.com/mollie/magento2/wiki) or send an e-mail to [info@mollie.com](mailto:info@mollie.com) with an exact description of the problem. diff --git a/etc/adminhtml/methods.xml b/etc/adminhtml/methods.xml index 3474226f9ef..64293ec2635 100644 --- a/etc/adminhtml/methods.xml +++ b/etc/adminhtml/methods.xml @@ -24,4 +24,5 @@ + diff --git a/etc/adminhtml/methods/applepay.xml b/etc/adminhtml/methods/applepay.xml new file mode 100644 index 00000000000..a59839411eb --- /dev/null +++ b/etc/adminhtml/methods/applepay.xml @@ -0,0 +1,92 @@ + + + + + + + Magento\Config\Model\Config\Source\Yesno + payment/mollie_methods_applepay/active + Please note: This payment method is only visible when the users device has Apple Pay enabled.]]> + + + + payment/mollie_methods_applepay/title + + 1 + + + + + Mollie\Payment\Model\Adminhtml\Source\Method + payment/mollie_methods_applepay/method + + 1 + + Payment API
Use the Payment API Platform for the transactions.

+ Order API
Use the new Order API Platform and get additional insights in the orders. + Read more.]]>
+
+ + + payment/mollie_methods_applepay/payment_description +
+ {ordernumber}: The order number for this transaction
+ {storename}: The name of the store

+ (Note: This only works when the method is set to Payments API) + ]]>
+ + payment + 1 + +
+ + + Magento\Payment\Model\Config\Source\Allspecificcountries + payment/mollie_methods_applepay/allowspecific + + 1 + + + + + Magento\Directory\Model\Config\Source\Country + 1 + payment/mollie_methods_applepay/specificcountry + + 1 + + + + + payment/mollie_methods_applepay/min_order_total + + 1 + + + + + payment/mollie_methods_applepay/max_order_total + + 1 + + + + + validate-number + payment/mollie_methods_applepay/sort_order + + 1 + + +
+
\ No newline at end of file diff --git a/etc/config.xml b/etc/config.xml index 68fd3380305..00608f4af43 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -186,6 +186,15 @@ 0 + + 0 + Mollie\Payment\Model\Methods\ApplePay + Apple Pay + {ordernumber} + order + 0 + + diff --git a/etc/payment.xml b/etc/payment.xml index 50f82d7cbd7..e395b090309 100644 --- a/etc/payment.xml +++ b/etc/payment.xml @@ -55,5 +55,8 @@ 0 + + 0 + diff --git a/view/frontend/layout/checkout_index_index.xml b/view/frontend/layout/checkout_index_index.xml index 07af04da5c6..0aec70a4fa4 100644 --- a/view/frontend/layout/checkout_index_index.xml +++ b/view/frontend/layout/checkout_index_index.xml @@ -76,6 +76,9 @@ true + + true + diff --git a/view/frontend/web/js/view/payment/method-renderer.js b/view/frontend/web/js/view/payment/method-renderer.js index 23e43f35da7..33e11a4ec0d 100644 --- a/view/frontend/web/js/view/payment/method-renderer.js +++ b/view/frontend/web/js/view/payment/method-renderer.js @@ -33,6 +33,17 @@ define( {type: 'mollie_methods_giftcard', component: giftcardComponent}, {type: 'mollie_methods_przelewy24', component: defaultComponent} ]; + + /** + * Only add Apple Pay if the current client supports Apple Pay. + */ + if (window.ApplePaySession && window.ApplePaySession.canMakePayments()) { + methods.push({ + type: 'mollie_methods_applepay', + component: defaultComponent + }); + } + $.each(methods, function (k, method) { if (window.checkoutConfig.payment.isActive[method['type']]) { rendererList.push(method);