From 2660026770ada889913f4b66bb52ec210aebdaef Mon Sep 17 00:00:00 2001 From: "a.baraliu" Date: Wed, 4 Sep 2024 13:43:24 +0200 Subject: [PATCH 1/2] adding blik as a payment method 1/2 --- Block/Widget/Button/Toolbar.php | 3 +- Helper/Data.php | 1 + .../Source/PaymentMethods/AfterExpiry.php | 3 +- .../Config/Source/PaymentMethods/PayLink.php | 3 +- .../Source/PaymentMethods/PayPerEmail.php | 5 + Model/ConfigProvider/Method/Blik.php | 28 +++ etc/adminhtml/system/payment_methods/blik.xml | 172 ++++++++++++++++++ etc/adminhtml/system/payment_methods_list.xml | 4 +- etc/config.xml | 32 +++- etc/di.xml | 30 +++ etc/frontend/di.xml | 2 + etc/payment.xml | 3 + i18n/nl_NL.csv | 4 +- view/frontend/layout/checkout_index_index.xml | 3 + 14 files changed, 284 insertions(+), 9 deletions(-) create mode 100644 Model/ConfigProvider/Method/Blik.php create mode 100644 etc/adminhtml/system/payment_methods/blik.xml diff --git a/Block/Widget/Button/Toolbar.php b/Block/Widget/Button/Toolbar.php index f58c39f07..ccb5ab6b0 100644 --- a/Block/Widget/Button/Toolbar.php +++ b/Block/Widget/Button/Toolbar.php @@ -60,7 +60,8 @@ class Toolbar 'buckaroo_magento2_wechatpay', 'buckaroo_magento2_p24', 'buckaroo_magento2_trustly', - 'buckaroo_magento2_pospayment' + 'buckaroo_magento2_pospayment', + 'buckaroo_magento2_blik' ]; /** diff --git a/Helper/Data.php b/Helper/Data.php index 7a200c914..33fc6546f 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -483,6 +483,7 @@ public function getPaymentMethodsList() ['value' => 'transfer', 'label' => __('Bank Transfer')], ['value' => 'trustly', 'label' => __('Trustly')], ['value' => 'wechatpay', 'label' => __('WeChatPay')], + ['value' => 'blik', 'label' => __('Blik')] ]; } diff --git a/Model/Config/Source/PaymentMethods/AfterExpiry.php b/Model/Config/Source/PaymentMethods/AfterExpiry.php index 7e5abccd5..99bb8a516 100644 --- a/Model/Config/Source/PaymentMethods/AfterExpiry.php +++ b/Model/Config/Source/PaymentMethods/AfterExpiry.php @@ -56,7 +56,8 @@ public function toOptionArray(): array ['value' => 'alipay', 'label' => __('Alipay')], ['value' => 'wechatpay', 'label' => __('WeChatPay')], ['value' => 'p24', 'label' => __('P24')], - ['value' => 'trustly', 'label' => __('Trustly')] + ['value' => 'trustly', 'label' => __('Trustly')], + ['value' => 'blik', 'label' => __('Blik')] ]; } } diff --git a/Model/Config/Source/PaymentMethods/PayLink.php b/Model/Config/Source/PaymentMethods/PayLink.php index 126dc955f..f54708a88 100644 --- a/Model/Config/Source/PaymentMethods/PayLink.php +++ b/Model/Config/Source/PaymentMethods/PayLink.php @@ -55,7 +55,8 @@ public function toOptionArray(): array ['value' => 'alipay', 'label' => __('Alipay')], ['value' => 'wechatpay', 'label' => __('WeChatPay')], ['value' => 'p24', 'label' => __('P24')], - ['value' => 'trustly', 'label' => __('Trustly')] + ['value' => 'trustly', 'label' => __('Trustly')], + ['value' => 'blik', 'label' => __('Blik')] ]; } } diff --git a/Model/Config/Source/PaymentMethods/PayPerEmail.php b/Model/Config/Source/PaymentMethods/PayPerEmail.php index da3a5b8ba..5533548d0 100644 --- a/Model/Config/Source/PaymentMethods/PayPerEmail.php +++ b/Model/Config/Source/PaymentMethods/PayPerEmail.php @@ -149,6 +149,11 @@ public function toOptionArray(): array 'value' => 'trustly', 'label' => __('Trustly'), 'code' => 'buckaroo_magento2_trustly' + ], + [ + 'value' => 'blik', + 'label' => __('Blik'), + 'code' => 'buckaroo_magento2_blik' ] ]; } diff --git a/Model/ConfigProvider/Method/Blik.php b/Model/ConfigProvider/Method/Blik.php new file mode 100644 index 000000000..565f812c7 --- /dev/null +++ b/Model/ConfigProvider/Method/Blik.php @@ -0,0 +1,28 @@ + + + + + + + Buckaroo\Magento2\Block\Config\Form\Field\Fieldset + + + + + Buckaroo\Magento2\Model\Config\Source\Enablemode + payment/buckaroo_magento2_blik/active + + + + + + payment/buckaroo_magento2_blik/title + + + + + + payment/buckaroo_magento2_blik/subtext + + + + + + Buckaroo\Magento2\Model\Config\Source\SubtextStyle + payment/buckaroo_magento2_blik/subtext_style + + + + + + payment/buckaroo_magento2_blik/subtext_color + Buckaroo\Magento2\Block\Config\Form\Field\ColorPicker + + + + + + + payment/buckaroo_magento2_blik/sort_order + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + payment/buckaroo_magento2_blik/order_email + + + + + Configuration > Sales > Tax.]]> + payment/buckaroo_magento2_blik/payment_fee + Buckaroo\Magento2\Model\Config\Backend\PaymentFee + + + + + + payment/buckaroo_magento2_blik/payment_fee_label + + + + + + Magento\Config\Model\Config\Source\Yesno + payment/buckaroo_magento2_blik/active_status + + + + + + To make a new status available it needs to be assigned to the correct state. See Magento documentation about state and status. + Buckaroo\Magento2\Model\Config\Source\StatusesSuccess + payment/buckaroo_magento2_blik/order_status_success + + 1 + + + + + + + To make a new status available it needs to be assigned to the correct state. See Magento documentation about state and status. + Buckaroo\Magento2\Model\Config\Source\StatusesFailed + payment/buckaroo_magento2_blik/order_status_failed + + 1 + + + + + + + + + The payment method shows only for orders with an order amount greater than the minimum amount. + payment/buckaroo_magento2_blik/min_amount + Buckaroo\Magento2\Model\Config\Backend\Price + + + + + + The payment method shows only for orders with an order amount smaller than the maximum amount. + payment/buckaroo_magento2_blik/max_amount + Buckaroo\Magento2\Model\Config\Backend\Price + + + + + Buckaroo\Magento2\Model\Config\Source\SpecificCustomerGroups + 1 + payment/buckaroo_magento2_blik/specificcustomergroup + + + + + Buckaroo\Magento2\Model\Config\Source\AllOrSpecificCountries + payment/buckaroo_magento2_blik/allowspecific + + + + + + Magento\Config\Model\Config\Source\Locale\Country + payment/buckaroo_magento2_blik/specificcountry + + 1 + + + + + + + Your contract with Buckaroo must allow for the selected currencies to be used with this payment method. + payment/buckaroo_magento2_blik/allowed_currencies + Buckaroo\Magento2\Model\Config\Source\AllowedCurrencies::blik + Buckaroo\Magento2\Model\Config\Backend\AllowedCurrencies + + + + + diff --git a/etc/adminhtml/system/payment_methods_list.xml b/etc/adminhtml/system/payment_methods_list.xml index daeac4715..ab5436025 100644 --- a/etc/adminhtml/system/payment_methods_list.xml +++ b/etc/adminhtml/system/payment_methods_list.xml @@ -84,5 +84,7 @@ - + + + diff --git a/etc/config.xml b/etc/config.xml index e7b69376b..332073fde 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -102,7 +102,7 @@ buckaroo_magento2 order 0 - amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,giftcard,giropay,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius + amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,giftcard,giropay,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius,blik 0 0 0 @@ -241,7 +241,7 @@ buckaroo_magento2 order 1 - amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,giftcard,giropay,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius + amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,giftcard,giropay,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius,blik 0 0 0 @@ -353,6 +353,30 @@ 1 + + 0 + BlikFacade + pending + Buckaroo Blik + 0 + 150 + 1 + Fee + buckaroo_magento2 + order + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 0 AfterpayOldFacade @@ -420,8 +444,8 @@ 1 1 1 - amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,sepadirectdebit,giftcard,giropay,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius - amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,giftcard,giropay,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius + amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,sepadirectdebit,giftcard,giropay,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius,blik + amex,bancontactmrcash,cartebancaire,cartebleuevisa,nexi,postepay,dankort,eps,giftcard,giropay,ideal,mastercard,paypal,sofortueberweisung,transfer,visa,maestro,visaelectron,vpay,alipay,wechatpay,p24,trustly,belfius,blik 7 1 0 diff --git a/etc/di.xml b/etc/di.xml index a54979ea5..6eff47582 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -412,6 +412,10 @@ knaken Buckaroo\Magento2\Model\ConfigProvider\Method\Knaken + + blik + Buckaroo\Magento2\Model\ConfigProvider\Method\Blik + @@ -1868,6 +1872,32 @@ + + + + + + Buckaroo\Magento2\Model\ConfigProvider\Method\Blik::CODE + BlikValueHandlerPool + + + + + + + BlikConfigValueHandler + + + + + + + Buckaroo\Magento2\Model\ConfigProvider\Method\Blik + + + + + diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index a0d70b123..7be831eed 100644 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -62,6 +62,8 @@ Buckaroo\Magento2\Model\ConfigProvider\Method\MBWay Buckaroo\Magento2\Model\ConfigProvider\Method\Multibanco Buckaroo\Magento2\Model\ConfigProvider\Method\Knaken + Buckaroo\Magento2\Model\ConfigProvider\Method\Blik + diff --git a/etc/payment.xml b/etc/payment.xml index 09ecad021..04783f740 100644 --- a/etc/payment.xml +++ b/etc/payment.xml @@ -135,5 +135,8 @@ 0 + + 0 + diff --git a/i18n/nl_NL.csv b/i18n/nl_NL.csv index 03718ddd6..3172853a9 100644 --- a/i18n/nl_NL.csv +++ b/i18n/nl_NL.csv @@ -90,6 +90,8 @@ "Enable SOFORT","SOFORT inschakelen" "Belfius","Belfius" "Enable Belfius","Belfius inschakelen" +"Blik","Blik" +"Enable Blik","Blik inschakelen" "Alipay","Alipay" "Enable Alipay","Alipay inschakelen" "WeChatPay","WeChatPay" @@ -652,4 +654,4 @@ "Riverty customer type","Klanttype voor Riverty" "Min order amount for B2B (in Base Currency)","Minimale bestelhoeveelheid voor B2B (in standaard valuta)" "Max order amount for B2B (in Base Currency)","Maximale bestelhoeveelheid voor B2B (in standaard valuta)" -"Enable iDIN verification","iDIN verificatie inschakelen" \ No newline at end of file +"Enable iDIN verification","iDIN verificatie inschakelen" diff --git a/view/frontend/layout/checkout_index_index.xml b/view/frontend/layout/checkout_index_index.xml index 66a2bc07e..8e6a879ed 100644 --- a/view/frontend/layout/checkout_index_index.xml +++ b/view/frontend/layout/checkout_index_index.xml @@ -135,6 +135,9 @@ true + + true + true From 8d861cfd7bde7d792523ff432928f209ec275be2 Mon Sep 17 00:00:00 2001 From: "a.baraliu" Date: Thu, 5 Sep 2024 09:22:07 +0200 Subject: [PATCH 2/2] adding blik as a payment method 2/2 (refactor branch) --- Model/ConfigProvider/Method/Blik.php | 6 + etc/adminhtml/system/payment_methods_list.xml | 4 +- etc/config.xml | 2 +- view/base/web/images/svg/blik.svg | 35 ++++++ view/frontend/layout/checkout_index_index.xml | 6 +- .../web/js/view/payment/buckaroo-payments.js | 5 + .../payment/buckaroo_magento2_blik.html | 109 ++++++++++++++++++ 7 files changed, 161 insertions(+), 6 deletions(-) create mode 100644 view/base/web/images/svg/blik.svg create mode 100644 view/frontend/web/template/payment/buckaroo_magento2_blik.html diff --git a/Model/ConfigProvider/Method/Blik.php b/Model/ConfigProvider/Method/Blik.php index 565f812c7..c9ff164dc 100644 --- a/Model/ConfigProvider/Method/Blik.php +++ b/Model/ConfigProvider/Method/Blik.php @@ -25,4 +25,10 @@ class Blik extends AbstractConfigProvider { public const CODE = 'buckaroo_magento2_blik'; + /** + * @var array + */ + protected $allowedCurrencies = [ + 'PLN' + ]; } diff --git a/etc/adminhtml/system/payment_methods_list.xml b/etc/adminhtml/system/payment_methods_list.xml index ab5436025..21055c693 100644 --- a/etc/adminhtml/system/payment_methods_list.xml +++ b/etc/adminhtml/system/payment_methods_list.xml @@ -84,7 +84,7 @@ - + - + diff --git a/etc/config.xml b/etc/config.xml index 332073fde..b0317e140 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -357,7 +357,7 @@ 0 BlikFacade pending - Buckaroo Blik + Blik 0 150 1 diff --git a/view/base/web/images/svg/blik.svg b/view/base/web/images/svg/blik.svg new file mode 100644 index 000000000..d0cd6578b --- /dev/null +++ b/view/base/web/images/svg/blik.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/view/frontend/layout/checkout_index_index.xml b/view/frontend/layout/checkout_index_index.xml index 8e6a879ed..061faa2ed 100644 --- a/view/frontend/layout/checkout_index_index.xml +++ b/view/frontend/layout/checkout_index_index.xml @@ -129,13 +129,13 @@ true - + true - + true - + true diff --git a/view/frontend/web/js/view/payment/buckaroo-payments.js b/view/frontend/web/js/view/payment/buckaroo-payments.js index 46c1684b1..16bc4612f 100644 --- a/view/frontend/web/js/view/payment/buckaroo-payments.js +++ b/view/frontend/web/js/view/payment/buckaroo-payments.js @@ -121,6 +121,11 @@ define( component: 'Buckaroo_Magento2/js/view/payment/method-renderer/default', config: {buckaroo: window.checkoutConfig.payment.buckaroo.buckaroo_magento2_belfius} }, + { + type: 'buckaroo_magento2_blik', + component: 'Buckaroo_Magento2/js/view/payment/method-renderer/default', + config: {buckaroo: window.checkoutConfig.payment.buckaroo.buckaroo_magento2_blik} + }, { type: 'buckaroo_magento2_eps', component: 'Buckaroo_Magento2/js/view/payment/method-renderer/default', diff --git a/view/frontend/web/template/payment/buckaroo_magento2_blik.html b/view/frontend/web/template/payment/buckaroo_magento2_blik.html new file mode 100644 index 000000000..d42cbfb1b --- /dev/null +++ b/view/frontend/web/template/payment/buckaroo_magento2_blik.html @@ -0,0 +1,109 @@ +
+
+
+
+ + +
+
+ +
+ +
+ Blik Logo +
+
+
+
+ +
+ + + + +
+ + + +
+ + +
+
+
+
+ + +
+ + + +
+ +
+
+
+
+ + +
+ + + +
+ +
+
+ +
+
+ + +
+ +
+ +
+