From a453841da15041c0c8fbd48aab7cb83a94c68aa9 Mon Sep 17 00:00:00 2001 From: "a.baraliu" Date: Wed, 21 Aug 2024 14:02:37 +0200 Subject: [PATCH 01/16] BP-3684-Add-payment-method-Blik-Magento-2 --- Block/Widget/Button/Toolbar.php | 3 +- Helper/Data.php | 1 + .../Source/PaymentMethods/AfterExpiry.php | 1 + .../Config/Source/PaymentMethods/PayLink.php | 1 + .../Source/PaymentMethods/PayPerEmail.php | 5 + Model/ConfigProvider/Method/Blik.php | 87 +++++++++ Model/Method/Blik.php | 98 ++++++++++ etc/adminhtml/system/payment_methods.xml | 3 + etc/adminhtml/system/payment_methods/blik.xml | 177 ++++++++++++++++++ etc/config.xml | 22 ++- etc/di.xml | 4 + etc/frontend/di.xml | 2 + etc/payment.xml | 3 + i18n/nl_NL.csv | 2 + view/frontend/layout/checkout_index_index.xml | 3 + .../web/js/view/payment/buckaroo-payments.js | 4 + .../js/view/payment/method-renderer/blik.js | 130 +++++++++++++ .../payment/buckaroo_magento2_blik.html | 63 +++++++ 18 files changed, 604 insertions(+), 5 deletions(-) create mode 100644 Model/ConfigProvider/Method/Blik.php create mode 100644 Model/Method/Blik.php create mode 100644 etc/adminhtml/system/payment_methods/blik.xml create mode 100644 view/frontend/web/js/view/payment/method-renderer/blik.js create mode 100644 view/frontend/web/template/payment/buckaroo_magento2_blik.html diff --git a/Block/Widget/Button/Toolbar.php b/Block/Widget/Button/Toolbar.php index dcf916306..058ddb6f3 100644 --- a/Block/Widget/Button/Toolbar.php +++ b/Block/Widget/Button/Toolbar.php @@ -62,7 +62,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 2dead63f8..e9adc82bd 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -453,6 +453,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 72f6f8e1f..6ac456f77 100644 --- a/Model/Config/Source/PaymentMethods/AfterExpiry.php +++ b/Model/Config/Source/PaymentMethods/AfterExpiry.php @@ -54,6 +54,7 @@ public function toOptionArray() ['value' => 'wechatpay', 'label' => __('WeChatPay')], ['value' => 'p24', 'label' => __('P24')], ['value' => 'trustly', 'label' => __('Trustly')], + ['value' => 'blik', 'label' => __('Blik')], ]; return $options; diff --git a/Model/Config/Source/PaymentMethods/PayLink.php b/Model/Config/Source/PaymentMethods/PayLink.php index 00a008c66..7de64040d 100644 --- a/Model/Config/Source/PaymentMethods/PayLink.php +++ b/Model/Config/Source/PaymentMethods/PayLink.php @@ -54,6 +54,7 @@ public function toOptionArray() ['value' => 'wechatpay', 'label' => __('WeChatPay')], ['value' => 'p24', 'label' => __('P24')], ['value' => 'trustly', 'label' => __('Trustly')], + ['value' => 'blik', 'label' => __('Blik')], ]; return $options; diff --git a/Model/Config/Source/PaymentMethods/PayPerEmail.php b/Model/Config/Source/PaymentMethods/PayPerEmail.php index a84fb8378..f191f7d0a 100644 --- a/Model/Config/Source/PaymentMethods/PayPerEmail.php +++ b/Model/Config/Source/PaymentMethods/PayPerEmail.php @@ -149,6 +149,11 @@ public function toOptionArray() '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..8ea414eec --- /dev/null +++ b/Model/ConfigProvider/Method/Blik.php @@ -0,0 +1,87 @@ +getBuckarooPaymentFeeLabel( + \Buckaroo\Magento2\Model\Method\Blik::PAYMENT_METHOD_CODE + ); + + return [ + 'payment' => [ + 'buckaroo' => [ + 'blik' => [ + 'paymentFeeLabel' => $paymentFeeLabel, + 'subtext' => $this->getSubtext(), + 'subtext_style' => $this->getSubtextStyle(), + 'subtext_color' => $this->getSubtextColor(), + 'allowedCurrencies' => $this->getAllowedCurrencies(), + ], + ], + ], + ]; + } + + /** + * @param null|int $storeId + * + * @return float + */ + public function getPaymentFee($storeId = null) + { + $paymentFee = $this->scopeConfig->getValue( + self::XPATH_BLIK_PAYMENT_FEE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + + return $paymentFee ? $paymentFee : false; + } +} diff --git a/Model/Method/Blik.php b/Model/Method/Blik.php new file mode 100644 index 000000000..f35143304 --- /dev/null +++ b/Model/Method/Blik.php @@ -0,0 +1,98 @@ +transactionBuilderFactory->get('order'); + + $services = [ + 'Name' => 'blik', + 'Action' => 'Pay', + 'Version' => 0, + ]; + + /** + * @noinspection PhpUndefinedMethodInspection + */ + $transactionBuilder->setOrder($payment->getOrder()) + ->setServices($services) + ->setMethod('TransactionRequest'); + + return $transactionBuilder; + } + + /** + * {@inheritdoc} + */ + public function getCaptureTransactionBuilder($payment) + { + return false; + } + + /** + * {@inheritdoc} + */ + public function getAuthorizeTransactionBuilder($payment) + { + return false; + } + + /** + * {@inheritdoc} + */ + public function getVoidTransactionBuilder($payment) + { + return true; + } + + /** + * @param \Magento\Sales\Api\Data\OrderPaymentInterface|\Magento\Payment\Model\InfoInterface $payment + * + * @return bool|string + */ + public function getPaymentMethodName($payment) + { + return 'blik'; + } +} diff --git a/etc/adminhtml/system/payment_methods.xml b/etc/adminhtml/system/payment_methods.xml index 16022b639..2aa07251a 100644 --- a/etc/adminhtml/system/payment_methods.xml +++ b/etc/adminhtml/system/payment_methods.xml @@ -118,5 +118,8 @@ + + + diff --git a/etc/adminhtml/system/payment_methods/blik.xml b/etc/adminhtml/system/payment_methods/blik.xml new file mode 100644 index 000000000..382f2eda7 --- /dev/null +++ b/etc/adminhtml/system/payment_methods/blik.xml @@ -0,0 +1,177 @@ + + + + + + + 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 + + + + + + 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 + + + + + + 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 + + + + + + + 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 + + + + + Buckaroo\Magento2\Model\Config\Source\AllOrSpecificCountries + payment/buckaroo_magento2_blik/allowspecific + + + + + + Magento\Config\Model\Config\Source\Locale\Country + payment/buckaroo_magento2_blik/specificcountry + + 1 + + + + + + + Magento developer client restrictions. + Magento\Config\Model\Config\Source\Yesno + payment/buckaroo_magento2_blik/limit_by_ip + + + + + Buckaroo\Magento2\Model\Config\Source\SpecificCustomerGroups + 1 + payment/buckaroo_magento2_blik/specificcustomergroup + + + + diff --git a/etc/config.xml b/etc/config.xml index 69a228f78..015334031 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -95,7 +95,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 @@ -182,7 +182,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 @@ -290,8 +290,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 @@ -595,6 +595,20 @@ 0 + + 0 + Buckaroo\Magento2\Model\Method\Blik + pending + Buckaroo Blik + 0 + 350 + 1 + Fee + buckaroo_magento2 + order + 0 + + diff --git a/etc/di.xml b/etc/di.xml index ab7e0ea45..89cf99a36 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -385,6 +385,10 @@ knaken Buckaroo\Magento2\Model\ConfigProvider\Method\Knaken + + blik + Buckaroo\Magento2\Model\ConfigProvider\Method\Blik + diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index 005d75f47..6bd197d3b 100644 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -64,6 +64,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 7aaa8bea3..80e06896c 100644 --- a/etc/payment.xml +++ b/etc/payment.xml @@ -141,5 +141,8 @@ 0 + + 0 + diff --git a/i18n/nl_NL.csv b/i18n/nl_NL.csv index f5b6d96d8..dce359c4c 100644 --- a/i18n/nl_NL.csv +++ b/i18n/nl_NL.csv @@ -101,6 +101,8 @@ "Enable Trustly","Trustly inschakelen" "Giropay","Giropay" "Enable Giropay","Giropay inschakelen" +"Blik","Blik" +"Enable Blik","Blik inschakelen" "Refunding","Terugbetaling" "Enable or disable refunding.","Schakel de creditering/terugstorten in of uit." "Set to 'No' refunds must be done manualy in Payment Plaza.","Bij de selectie 'Nee' worden credit memo's in Magento niet aangeboden bij Payment Plaza." diff --git a/view/frontend/layout/checkout_index_index.xml b/view/frontend/layout/checkout_index_index.xml index e5ff51df4..de5ecd060 100644 --- a/view/frontend/layout/checkout_index_index.xml +++ b/view/frontend/layout/checkout_index_index.xml @@ -209,6 +209,9 @@ 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 a6c5484f1..efa1abc6a 100644 --- a/view/frontend/web/js/view/payment/buckaroo-payments.js +++ b/view/frontend/web/js/view/payment/buckaroo-payments.js @@ -188,6 +188,10 @@ define( { type: 'buckaroo_magento2_knaken', component: 'Buckaroo_Magento2/js/view/payment/method-renderer/knaken' + }, + { + type: 'buckaroo_magento2_blik', + component: 'Buckaroo_Magento2/js/view/payment/method-renderer/blik' } ); /** diff --git a/view/frontend/web/js/view/payment/method-renderer/blik.js b/view/frontend/web/js/view/payment/method-renderer/blik.js new file mode 100644 index 000000000..844576cd8 --- /dev/null +++ b/view/frontend/web/js/view/payment/method-renderer/blik.js @@ -0,0 +1,130 @@ +/** + * NOTICE OF LICENSE + * + * This source file is subject to the MIT License + * It is available through the world-wide-web at this URL: + * https://tldrlegal.com/license/mit-license + * If you are unable to obtain it through the world-wide-web, please send an email + * to support@buckaroo.nl so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this module to newer + * versions in the future. If you wish to customize this module for your + * needs please contact support@buckaroo.nl for more information. + * + * @copyright Copyright (c) Buckaroo B.V. + * @license https://tldrlegal.com/license/mit-license + */ +/*browser:true*/ +/*global define*/ +define( + [ + 'jquery', + 'Magento_Checkout/js/view/payment/default', + 'Magento_Checkout/js/model/payment/additional-validators', + 'Buckaroo_Magento2/js/action/place-order', + 'ko', + 'Magento_Checkout/js/checkout-data', + 'Magento_Checkout/js/action/select-payment-method', + 'buckaroo/checkout/common' + ], + function ( + $, + Component, + additionalValidators, + placeOrderAction, + ko, + checkoutData, + selectPaymentMethodAction, + checkoutCommon + ) { + 'use strict'; + + return Component.extend( + { + defaults: { + template: 'Buckaroo_Magento2/payment/buckaroo_magento2_blik' + }, + redirectAfterPlaceOrder: false, + paymentFeeLabel : window.checkoutConfig.payment.buckaroo.blik.paymentFeeLabel, + subtext : window.checkoutConfig.payment.buckaroo.blik.subtext, + subTextStyle : checkoutCommon.getSubtextStyle('blik'), + currencyCode : window.checkoutConfig.quoteData.quote_currency_code, + baseCurrencyCode : window.checkoutConfig.quoteData.base_currency_code, + + /** + * @override + */ + initialize : function (options) { + if (checkoutData.getSelectedPaymentMethod() == options.index) { + window.checkoutConfig.buckarooFee.title(this.paymentFeeLabel); + } + + return this._super(options); + }, + + /** + * Place order. + * + * placeOrderAction has been changed from Magento_Checkout/js/action/place-order to our own version + * (Buckaroo_Magento2/js/action/place-order) to prevent redirect and handle the response. + */ + placeOrder: function (data, event) { + var self = this, + placeOrder; + + if (event) { + event.preventDefault(); + } + + if (this.validate() && additionalValidators.validate()) { + this.isPlaceOrderActionAllowed(false); + placeOrder = placeOrderAction(this.getData(), this.redirectAfterPlaceOrder, this.messageContainer); + + $.when(placeOrder).fail( + function () { + self.isPlaceOrderActionAllowed(true); + } + ).done(this.afterPlaceOrder.bind(this)); + return true; + } + return false; + }, + + afterPlaceOrder: function () { + var response = window.checkoutConfig.payment.buckaroo.response; + checkoutCommon.redirectHandle(response); + }, + + selectPaymentMethod: function () { + window.checkoutConfig.buckarooFee.title(this.paymentFeeLabel); + + selectPaymentMethodAction(this.getData()); + checkoutData.setSelectedPaymentMethod(this.item.method); + return true; + }, + + payWithBaseCurrency: function () { + var allowedCurrencies = window.checkoutConfig.payment.buckaroo.blik.allowedCurrencies; + + return allowedCurrencies.indexOf(this.currencyCode) < 0; + }, + + getPayWithBaseCurrencyText: function () { + var text = $.mage.__('The transaction will be processed using %s.'); + + return text.replace('%s', this.baseCurrencyCode); + } + } + ); + } +); + + + + + + + + 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..bc2caa4ab --- /dev/null +++ b/view/frontend/web/template/payment/buckaroo_magento2_blik.html @@ -0,0 +1,63 @@ +
+
+
+
+ + +
+
+ +
+
+
+ +
+
+ + + +
+ +
+
+ +
+
+ + +
+ +
+ + + + + + +
+ + + +
+ +
+
From 41a3cc3f2891d92189045cfb2ea54bb8456b420d Mon Sep 17 00:00:00 2001 From: "a.baraliu" Date: Wed, 21 Aug 2024 14:52:59 +0200 Subject: [PATCH 02/16] code consistency --- Model/Config/Source/PaymentMethods/AfterExpiry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/Config/Source/PaymentMethods/AfterExpiry.php b/Model/Config/Source/PaymentMethods/AfterExpiry.php index 6ac456f77..661e8016e 100644 --- a/Model/Config/Source/PaymentMethods/AfterExpiry.php +++ b/Model/Config/Source/PaymentMethods/AfterExpiry.php @@ -54,7 +54,7 @@ public function toOptionArray() ['value' => 'wechatpay', 'label' => __('WeChatPay')], ['value' => 'p24', 'label' => __('P24')], ['value' => 'trustly', 'label' => __('Trustly')], - ['value' => 'blik', 'label' => __('Blik')], + ['value' => 'blik', 'label' => __('Blik')], ]; return $options; From 88ea81f68cf9e707f8bd48954812daabff1368ad Mon Sep 17 00:00:00 2001 From: Sander Date: Wed, 28 Aug 2024 13:32:37 +0200 Subject: [PATCH 03/16] BP-3709-Change "Riverty/Afterpay" logo to the new "Riverty" logo (Magento 2) --- Block/Info.php | 4 ++-- .../web/template/payment/buckaroo_magento2_afterpay.html | 2 +- .../web/template/payment/buckaroo_magento2_afterpay2.html | 2 +- .../web/template/payment/buckaroo_magento2_afterpay20.html | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Block/Info.php b/Block/Info.php index fe76fec66..5a2f0e08f 100644 --- a/Block/Info.php +++ b/Block/Info.php @@ -94,8 +94,8 @@ public function getPayPerEmailMethod() public function getPaymentLogo(string $method): string { $mappings = [ - "afterpay2" => "svg/afterpay.svg", - "afterpay20" => "svg/afterpay.svg", + "afterpay2" => "svg/riverty.svg", + "afterpay20" => "svg/riverty.svg", "capayablein3" => "svg/in3.svg", "capayablepostpay" => "svg/in3.svg", "creditcard" => "svg/creditcards.svg", diff --git a/view/frontend/web/template/payment/buckaroo_magento2_afterpay.html b/view/frontend/web/template/payment/buckaroo_magento2_afterpay.html index 6fc7ac74b..a7e9547de 100644 --- a/view/frontend/web/template/payment/buckaroo_magento2_afterpay.html +++ b/view/frontend/web/template/payment/buckaroo_magento2_afterpay.html @@ -14,7 +14,7 @@
- +
diff --git a/view/frontend/web/template/payment/buckaroo_magento2_afterpay2.html b/view/frontend/web/template/payment/buckaroo_magento2_afterpay2.html index 79b1a28d4..ade5d7b37 100644 --- a/view/frontend/web/template/payment/buckaroo_magento2_afterpay2.html +++ b/view/frontend/web/template/payment/buckaroo_magento2_afterpay2.html @@ -14,7 +14,7 @@
- +
diff --git a/view/frontend/web/template/payment/buckaroo_magento2_afterpay20.html b/view/frontend/web/template/payment/buckaroo_magento2_afterpay20.html index 1968dc26e..31264d319 100644 --- a/view/frontend/web/template/payment/buckaroo_magento2_afterpay20.html +++ b/view/frontend/web/template/payment/buckaroo_magento2_afterpay20.html @@ -14,7 +14,7 @@
- +
From e3baca9ed9e77e14d08c1b272b26078675de722e Mon Sep 17 00:00:00 2001 From: Sander Date: Wed, 28 Aug 2024 13:36:10 +0200 Subject: [PATCH 04/16] BP-3709-Change "Riverty/Afterpay" logo to the new "Riverty" logo (Magento 2) --- .github/workflows/icons.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/icons.yml b/.github/workflows/icons.yml index 0b3c9df64..aad12a079 100644 --- a/.github/workflows/icons.yml +++ b/.github/workflows/icons.yml @@ -22,7 +22,7 @@ jobs: - name: Copy payment method icons run: | cd "${{ github.workspace }}/Media/Payment methods/SVG/" - rm -f ideal-qr.svg knaken.svg paylink.svg paybybank.svg pos-nfc.svg riverty.svg + rm -f ideal-qr.svg knaken.svg paylink.svg paybybank.svg pos-nfc.svg cd ${{ github.workspace }}/Media cp -R "Payment methods/SVG/." ${{ github.workspace }}/view/base/web/images/svg/ - name: Copy creditcards icons From 0add8181197802caf7b5c29ee018053510044976 Mon Sep 17 00:00:00 2001 From: SandervdHulst Date: Wed, 28 Aug 2024 12:13:48 +0000 Subject: [PATCH 05/16] Apply logo changes from media repository --- view/base/web/images/svg/riverty.svg | 195 +++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 view/base/web/images/svg/riverty.svg diff --git a/view/base/web/images/svg/riverty.svg b/view/base/web/images/svg/riverty.svg new file mode 100644 index 000000000..9a5f0d199 --- /dev/null +++ b/view/base/web/images/svg/riverty.svg @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + From 95049f9a63240af7a480249de20f2c516aba2dde Mon Sep 17 00:00:00 2001 From: Sander Date: Wed, 28 Aug 2024 15:00:35 +0200 Subject: [PATCH 06/16] BP-3727-Increased payment method logo size for enhanced visibility and recognition --- view/frontend/web/css/styles.css | 2 +- .../web/template/payment/buckaroo_magento2_paybybank.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/view/frontend/web/css/styles.css b/view/frontend/web/css/styles.css index 60e7df017..7afb0da75 100644 --- a/view/frontend/web/css/styles.css +++ b/view/frontend/web/css/styles.css @@ -5,7 +5,7 @@ align-items: center; } .bk-img-wrap { - width: 40px; + width: 50px; margin-right:10px; align-items: center; display: flex; diff --git a/view/frontend/web/template/payment/buckaroo_magento2_paybybank.html b/view/frontend/web/template/payment/buckaroo_magento2_paybybank.html index 82e84795a..28fb1e276 100644 --- a/view/frontend/web/template/payment/buckaroo_magento2_paybybank.html +++ b/view/frontend/web/template/payment/buckaroo_magento2_paybybank.html @@ -14,7 +14,7 @@
- +
From f3ffc4c5033e04e224649f74d731334d5c2078ae Mon Sep 17 00:00:00 2001 From: "v.carkaxhija" Date: Mon, 2 Sep 2024 14:41:59 +0200 Subject: [PATCH 07/16] hyva checkout fee calculation --- Model/Total/Quote/BuckarooFeeHyva.php | 258 ++++++++++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 Model/Total/Quote/BuckarooFeeHyva.php diff --git a/Model/Total/Quote/BuckarooFeeHyva.php b/Model/Total/Quote/BuckarooFeeHyva.php new file mode 100644 index 000000000..4de318092 --- /dev/null +++ b/Model/Total/Quote/BuckarooFeeHyva.php @@ -0,0 +1,258 @@ +setCode('buckaroo_fee_hyva'); + + $this->configProviderAccount = $configProviderAccount; + $this->configProviderBuckarooFee = $configProviderBuckarooFee; + $this->configProviderMethodFactory = $configProviderMethodFactory; + $this->priceCurrency = $priceCurrency; + $this->catalogHelper = $catalogHelper; + + $this->groupTransaction = $groupTransaction; + $this->logging = $logging; + $this->taxCalculation = $taxCalculation; + } + + /** + * Add buckaroo fee information to address + * + * @param Quote $quote + * @param Total $total + * @return array + */ + public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Quote\Address\Total $total) + { + // Determine whether to include tax in the fee value based on your configuration settings + $includeTax = $this->configProviderBuckarooFee->getPaymentFeeTax() == \Buckaroo\Magento2\Model\Config\Source\TaxClass\Calculation::DISPLAY_TYPE_INCLUDING_TAX; + + // Calculate the value based on the settings (either including or excluding tax) + $value = $includeTax ? $total->getBuckarooFeeInclTax() : $total->getBuckarooFee(); + + return [ + 'code' => $this->getCode(), + 'title' => $this->getLabel(), + 'value' => $value + ]; + } + + /** + * @param \Buckaroo\Magento2\Model\Method\AbstractMethod $methodInstance + * @param \Magento\Quote\Model\Quote $quote + * @param bool $inclTax + * + * @return bool|false|float + * @throws \Buckaroo\Magento2\Exception + */ + public function getBaseFee( + \Buckaroo\Magento2\Model\Method\AbstractMethod $methodInstance, + \Magento\Quote\Model\Quote $quote, + $inclTax = false + ) { + $buckarooPaymentMethodCode = $methodInstance->buckarooPaymentMethodCode; + if (!$this->configProviderMethodFactory->has($buckarooPaymentMethodCode)) { + return false; + } + + $configProvider = $this->configProviderMethodFactory->get($buckarooPaymentMethodCode); + $basePaymentFee = trim($configProvider->getPaymentFee($quote->getStore())); + + if (is_numeric($basePaymentFee)) { + if (in_array($buckarooPaymentMethodCode, ['billink','afterpay20','afterpay','paypal'])) { + + $inclTax = $this->configProviderBuckarooFee->getPaymentFeeTax() == + Calculation::DISPLAY_TYPE_INCLUDING_TAX; + + if ($inclTax) { + $request = $this->taxCalculation->getRateRequest(null, null, null, $quote->getStore()); + $taxClassId = $this->configProviderBuckarooFee->getTaxClass($quote->getStore()); + $percent = $this->taxCalculation->getRate($request->setProductClassId($taxClassId)); + if ($percent > 0) { + return $basePaymentFee / (1 + ($percent / 100)); + } + } + return $basePaymentFee; + } else { + if ($inclTax) { + return $basePaymentFee; + } + /** + * Payment fee is a number + */ + return $this->getFeePrice($basePaymentFee); + } + + } elseif (strpos($basePaymentFee, '%') === false) { + /** + * Payment fee is invalid + */ + return false; + } + + /** + * Payment fee is a percentage + */ + $percentage = floatval($basePaymentFee); + if ($quote->getShippingAddress()) { + $address = $quote->getShippingAddress(); + } else { + $address = $quote->getBillingAddress(); + } + + $total = 0; + + $feePercentageMode = $this->configProviderAccount->getFeePercentageMode($quote->getStore()); + + switch ($feePercentageMode) { + case 'subtotal': + $total = $address->getBaseSubtotal(); + break; + case 'subtotal_incl_tax': + $total = $address->getBaseSubtotalTotalInclTax(); + break; + } + + $basePaymentFee = ($percentage / 100) * $total; + + return $basePaymentFee; + } + + /** + * Get payment fee price with correct tax + * + * @param float $price + * @param null $priceIncl + * + * @param \Magento\Framework\DataObject|null $pseudoProduct + * + * @return float + * @throws \Buckaroo\Magento2\Exception + */ + public function getFeePrice($price, $priceIncl = null, \Magento\Framework\DataObject $pseudoProduct = null) + { + if ($pseudoProduct === null) { + $pseudoProduct = new \Magento\Framework\DataObject(); + } + + $pseudoProduct->setTaxClassId($this->configProviderBuckarooFee->getTaxClass()); + + /** + * @noinspection PhpUndefinedMethodInspection + */ + if ($priceIncl === null + && $this->configProviderBuckarooFee->getPaymentFeeTax() == Calculation::DISPLAY_TYPE_INCLUDING_TAX + ) { + $priceIncl = true; + } else { + $priceIncl = false; + } + + $price = $this->catalogHelper->getTaxPrice( + $pseudoProduct, + $price, + false, + null, + null, + null, + null, + $priceIncl + ); + + return $price; + } + + /** + * Get Buckaroo label + * + * @return \Magento\Framework\Phrase + */ + public function getLabel() + { + return __('Fee'); + } +} From 6beea0fa02220cea473fd8cf04ee5174b5ab8a25 Mon Sep 17 00:00:00 2001 From: "v.carkaxhija" Date: Mon, 2 Sep 2024 14:45:30 +0200 Subject: [PATCH 08/16] hyva checkout fee calculation --- etc/sales.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/sales.xml b/etc/sales.xml index efc9fdc18..a884141fb 100644 --- a/etc/sales.xml +++ b/etc/sales.xml @@ -25,6 +25,9 @@ + + + From e802b4ada009395cd86c6ebbdef0b6a9d3cff9d8 Mon Sep 17 00:00:00 2001 From: "a.baraliu" Date: Tue, 3 Sep 2024 14:47:59 +0200 Subject: [PATCH 09/16] added web as a refund channel --- Model/Method/Blik.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Model/Method/Blik.php b/Model/Method/Blik.php index f35143304..6cf882733 100644 --- a/Model/Method/Blik.php +++ b/Model/Method/Blik.php @@ -95,4 +95,9 @@ public function getPaymentMethodName($payment) { return 'blik'; } + + protected function getRefundTransactionBuilderChannel() + { + return 'Web'; + } } From 5f59ce35db3a59177215f654124f9091db0b82c3 Mon Sep 17 00:00:00 2001 From: AlbinaBaraliu Date: Tue, 3 Sep 2024 12:48:11 +0000 Subject: [PATCH 10/16] Apply logo changes from media repository --- view/base/web/images/svg/afterpay.svg | 341 ++++++++++++++------------ 1 file changed, 185 insertions(+), 156 deletions(-) diff --git a/view/base/web/images/svg/afterpay.svg b/view/base/web/images/svg/afterpay.svg index 2b28dc73d..9a5f0d199 100644 --- a/view/base/web/images/svg/afterpay.svg +++ b/view/base/web/images/svg/afterpay.svg @@ -1,166 +1,195 @@ + viewBox="0 0 94.45 70.92" style="enable-background:new 0 0 94.45 70.92;" xml:space="preserve"> + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + From e64625300651af90c51f72a39d4c88c25e00977b Mon Sep 17 00:00:00 2001 From: "v.carkaxhija" Date: Tue, 3 Sep 2024 17:07:17 +0200 Subject: [PATCH 11/16] remove Buckaroo from label --- etc/config.xml | 70 +++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/etc/config.xml b/etc/config.xml index 189cccd36..4a10236a0 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -41,7 +41,7 @@ 0 Buckaroo\Magento2\Model\Method\Ideal pending - Buckaroo iDEAL + iDEAL 0 10 1 @@ -57,7 +57,7 @@ 0 Buckaroo\Magento2\Model\Method\PayByBank pending - Buckaroo PayByBank + PayByBank 0 350 1 @@ -71,7 +71,7 @@ 0 Buckaroo\Magento2\Model\Method\IdealProcessing pending - Buckaroo iDEAL Processing + iDEAL Processing 0 10 1 @@ -86,7 +86,7 @@ 0 Buckaroo\Magento2\Model\Method\SepaDirectDebit pending - Buckaroo SEPA Direct Debit + SEPA Direct Debit 0 110 4 @@ -102,7 +102,7 @@ 0 Buckaroo\Magento2\Model\Method\Paypal pending - Buckaroo PayPal + PayPal 0 90 1 @@ -121,7 +121,7 @@ 0 Buckaroo\Magento2\Model\Method\Payconiq pending - Buckaroo Payconiq + Payconiq 0 90 1 @@ -135,7 +135,7 @@ 0 Buckaroo\Magento2\Model\Method\Creditcard pending - Buckaroo Creditcard and Debit Cards + Creditcard and Debit Cards 0 30 1 @@ -156,7 +156,7 @@ 0 Buckaroo\Magento2\Model\Method\Creditcards pending - Buckaroo Creditcard and Debit Cards + Creditcard and Debit Cards 35 1 Fee @@ -170,7 +170,7 @@ 0 Buckaroo\Magento2\Model\Method\Transfer pending - Buckaroo Transfer + Transfer 0 100 1 @@ -189,7 +189,7 @@ 0 Buckaroo\Magento2\Model\Method\Giropay pending - Buckaroo Giropay + Giropay 0 160 1 @@ -203,7 +203,7 @@ 0 Buckaroo\Magento2\Model\Method\Mrcash pending - Buckaroo Bancontact/Mister Cash + Bancontact/Mister Cash 0 140 1 @@ -220,7 +220,7 @@ 0 Buckaroo\Magento2\Model\Method\Sofortbanking pending - Buckaroo Sofort + Sofort 0 150 1 @@ -234,7 +234,7 @@ 0 Buckaroo\Magento2\Model\Method\Belfius pending - Buckaroo Belfius + Belfius 0 150 1 @@ -248,7 +248,7 @@ 0 Buckaroo\Magento2\Model\Method\Afterpay pending - Buckaroo Riverty + Riverty 0 150 1 @@ -264,7 +264,7 @@ 0 Buckaroo\Magento2\Model\Method\Afterpay2 pending - Buckaroo Riverty 2 + Riverty 2 0 160 1 @@ -280,7 +280,7 @@ 0 Buckaroo\Magento2\Model\Method\PayPerEmail pending - Buckaroo PayPerEmail + PayPerEmail 0 170 1 @@ -300,7 +300,7 @@ 0 Buckaroo\Magento2\Model\Method\Eps pending - Buckaroo EPS + EPS 0 180 1 @@ -314,7 +314,7 @@ 0 Buckaroo\Magento2\Model\Method\Giftcards pending - Buckaroo Giftcards + Giftcards 190 1 Fee @@ -327,7 +327,7 @@ 0 Buckaroo\Magento2\Model\Method\Kbc pending - Buckaroo KBC + KBC 0 210 1 @@ -341,7 +341,7 @@ 0 Buckaroo\Magento2\Model\Method\Knaken pending - Buckaroo Knaken Settle + Knaken Settle 0 300 1 @@ -355,7 +355,7 @@ 0 Buckaroo\Magento2\Model\Method\Multibanco pending - Buckaroo Multibanco + Multibanco 0 211 1 @@ -369,7 +369,7 @@ 0 Buckaroo\Magento2\Model\Method\MBWay pending - Buckaroo MBWay + MBWay 0 212 1 @@ -383,7 +383,7 @@ 0 Buckaroo\Magento2\Model\Method\PayLink pending - Buckaroo PayLink + PayLink 0 215 1 @@ -397,7 +397,7 @@ 0 Buckaroo\Magento2\Model\Method\Klarna\PayLater pending - Buckaroo Klarna: Pay later + Klarna: Pay later 220 1 Fee @@ -411,7 +411,7 @@ 0 Buckaroo\Magento2\Model\Method\Klarnakp pending - Buckaroo Klarna: Pay later + Klarna: Pay later 220 1 Fee @@ -425,7 +425,7 @@ 0 Buckaroo\Magento2\Model\Method\Klarna\Klarnain pending - Buckaroo Klarna: Slice it + Klarna: Slice it 220 1 Fee @@ -439,7 +439,7 @@ 0 Buckaroo\Magento2\Model\Method\Emandate pending - Buckaroo Digitale Incassomachtiging + Digitale Incassomachtiging 1 nl 0 @@ -455,7 +455,7 @@ 0 Buckaroo\Magento2\Model\Method\Afterpay20 pending - Buckaroo Riverty + Riverty 0 240 1 @@ -488,7 +488,7 @@ 0 Buckaroo\Magento2\Model\Method\Applepay pending - Buckaroo Apple Pay + Apple Pay 0 240 1 @@ -515,7 +515,7 @@ 0 Buckaroo\Magento2\Model\Method\Alipay pending - Buckaroo Alipay + Alipay 0 270 1 @@ -529,7 +529,7 @@ 0 Buckaroo\Magento2\Model\Method\Wechatpay pending - Buckaroo WeChatPay + WeChatPay 0 280 1 @@ -543,7 +543,7 @@ 0 Buckaroo\Magento2\Model\Method\P24 pending - Buckaroo Przelewy24 + Przelewy24 0 290 1 @@ -557,7 +557,7 @@ 0 Buckaroo\Magento2\Model\Method\Trustly pending - Buckaroo Trustly + Trustly 0 300 1 @@ -571,7 +571,7 @@ 0 Buckaroo\Magento2\Model\Method\Pospayment pending - Buckaroo Point of Sale + Point of Sale 0 320 1 @@ -585,7 +585,7 @@ 0 Buckaroo\Magento2\Model\Method\Voucher pending - Buckaroo Voucher + Voucher 0 340 1 From 55354f818143b2a9261885261275b0e1fa0f4f28 Mon Sep 17 00:00:00 2001 From: vegimcarkaxhija Date: Wed, 4 Sep 2024 08:32:52 +0000 Subject: [PATCH 12/16] Apply logo changes from media repository --- view/base/web/images/svg/afterpay.svg | 341 ++++++++++++++------------ 1 file changed, 185 insertions(+), 156 deletions(-) diff --git a/view/base/web/images/svg/afterpay.svg b/view/base/web/images/svg/afterpay.svg index 2b28dc73d..9a5f0d199 100644 --- a/view/base/web/images/svg/afterpay.svg +++ b/view/base/web/images/svg/afterpay.svg @@ -1,166 +1,195 @@ + viewBox="0 0 94.45 70.92" style="enable-background:new 0 0 94.45 70.92;" xml:space="preserve"> + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + From d769fc3e19872248e8051c66e2ca3a582c9afa63 Mon Sep 17 00:00:00 2001 From: vegimcarkaxhija Date: Wed, 4 Sep 2024 08:35:30 +0000 Subject: [PATCH 13/16] Apply logo changes from media repository --- view/base/web/images/svg/afterpay.svg | 341 ++++++++++++++------------ 1 file changed, 185 insertions(+), 156 deletions(-) diff --git a/view/base/web/images/svg/afterpay.svg b/view/base/web/images/svg/afterpay.svg index 2b28dc73d..9a5f0d199 100644 --- a/view/base/web/images/svg/afterpay.svg +++ b/view/base/web/images/svg/afterpay.svg @@ -1,166 +1,195 @@ + viewBox="0 0 94.45 70.92" style="enable-background:new 0 0 94.45 70.92;" xml:space="preserve"> + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + From af26fee72fb06312a0bd19230dff338aae9cf62f Mon Sep 17 00:00:00 2001 From: "v.carkaxhija" Date: Wed, 4 Sep 2024 12:43:35 +0200 Subject: [PATCH 14/16] removed Buckaroo from Blik title --- etc/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/config.xml b/etc/config.xml index a4adfcb1f..320d22a16 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -599,7 +599,7 @@ 0 Buckaroo\Magento2\Model\Method\Blik pending - Buckaroo Blik + Blik 0 350 1 From 5562de78ca9c2e08603b054571c8018429feab27 Mon Sep 17 00:00:00 2001 From: "a.baraliu" Date: Wed, 4 Sep 2024 13:53:00 +0200 Subject: [PATCH 15/16] unregister current invoice after transaction is saved --- Model/Service/CreateInvoice.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Model/Service/CreateInvoice.php b/Model/Service/CreateInvoice.php index 9854719ae..1a6be2e9c 100644 --- a/Model/Service/CreateInvoice.php +++ b/Model/Service/CreateInvoice.php @@ -135,6 +135,8 @@ public function createInvoiceGeneralSetting(Order $order, array $invoiceItems): $transactionSave->save(); + $this->registry->unregister('current_invoice'); + $payment = $invoice->getOrder()->getPayment(); $transactionKey = (string)$payment->getAdditionalInformation( @@ -225,4 +227,4 @@ public function addTransactionData($payment, $transactionKey = false, $datas = f return $payment; } -} \ No newline at end of file +} From 4a451c7eb5fab07a6b09911c932ea8e9bd1bfe69 Mon Sep 17 00:00:00 2001 From: Sander Date: Mon, 9 Sep 2024 12:54:58 +0200 Subject: [PATCH 16/16] BP-3730-Update, test & release (1.49.4) --- Api/PaypalExpressQuoteCreateInterface.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Api/PaypalExpressQuoteCreateInterface.php b/Api/PaypalExpressQuoteCreateInterface.php index 948873ee0..74947cd96 100644 --- a/Api/PaypalExpressQuoteCreateInterface.php +++ b/Api/PaypalExpressQuoteCreateInterface.php @@ -22,6 +22,7 @@ namespace Buckaroo\Magento2\Api; use Buckaroo\Magento2\Api\Data\PaypalExpress\ShippingAddressRequestInterface; +use Buckaroo\Magento2\Api\Data\QuoteCreateResponseInterface; interface PaypalExpressQuoteCreateInterface { @@ -31,8 +32,8 @@ interface PaypalExpressQuoteCreateInterface * @param \Buckaroo\Magento2\Api\Data\PaypalExpress\ShippingAddressRequestInterface $shipping_address * @param string $page * @param string|null $order_data - * @return \Buckaroo\Magento2\Api\Data\PaypalExpress\QuoteCreateResponseInterface - */ + * @return QuoteCreateResponseInterface + */ public function execute( ShippingAddressRequestInterface $shipping_address, string $page,