Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.46.0 #795

Merged
merged 55 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
537cfa5
BP-2368 Modernize other fields
Apr 10, 2023
e046578
added name placeholder, move datepicker format to the input placeholder
Apr 11, 2023
27bbbbc
added bic placeholder
Apr 11, 2023
6e38c80
remove unnecessary ajax calls
Apr 12, 2023
df164be
refactor sepa
Apr 12, 2023
ae42298
refactor payperemail
Apr 12, 2023
b912b03
refactor in3
Apr 18, 2023
e663574
refactor billink
Apr 18, 2023
d2dacb2
refactor giropay
Apr 18, 2023
3c5bc97
fix afterpay sending b2b request after failed b2c request
Apr 18, 2023
8f3d3c4
remove debug
Apr 18, 2023
94f83e9
refactor riverty, make license agreements checked
Apr 19, 2023
c3ff720
Merge remote-tracking branch 'origin/develop' into BP-2368-modernize-…
Apr 19, 2023
74efb7c
add style
Apr 19, 2023
265818e
fix suggestion and broken giftcards
Apr 20, 2023
8fb69bc
BP-2523 Gender selection is not translated for PayPerEmail
Apr 26, 2023
a4dd04e
Merge pull request #710 from buckaroo-it/BP-2368-modernize-other-fields
harli91 May 5, 2023
3cdd3f8
Merge pull request #716 from buckaroo-it/BP-2523-gender-selection-is-…
harli91 May 5, 2023
c0b73ad
BP-2478 Conflict with Amasty order attributes extension (#717)
harli91 May 10, 2023
e33a8cd
BP-1879 Afterpay rejection message is not clear when consumers use a …
harli91 May 18, 2023
30aa81c
BP 2365 Prevent bnpl methods from transaction spam (#722)
harli91 May 22, 2023
fc2329a
v1.45.1 (#727)
harli91 May 25, 2023
63ba44a
Fix afterpay flash messages (#729)
harli91 May 26, 2023
a666e82
Update README.md (#732)
Buckaroo-Rene Jun 12, 2023
c64dc3c
BP-2654 Add Apple Pay currency options for: USD, NOK, SEK, CHF, PLN. …
harli91 Jun 13, 2023
a1e6569
Bp 2661 magento 2 reward points module conflict when using klarna kp …
harli91 Jun 29, 2023
d96bc0a
BP-2488 Persisting invoice number for batch refunds including Klarna/…
harli91 Jun 29, 2023
a60b6e0
BP-2337 Magento giftcard balance is zero after cancellation (#706)
harli91 Jun 30, 2023
8a0bc56
BP-2693 Credit Management / Paylink + Giftcards (#750)
harli91 Jul 5, 2023
e8bd90f
BP-2188] Payment method availability gets checked on shipping address…
harli91 Jul 6, 2023
c1bed1e
BP-2621 Rename 'Creditcards' into 'Credit and debit card' (#746)
harli91 Jul 7, 2023
de8c028
BP-2673 Add payment method: PayByBank (PaymentInitiation) (#749)
harli91 Jul 10, 2023
428fb22
BP-2667 setup:di:compile fails on PHP 7.4 due to newer PHP syntax use…
harli91 Jul 20, 2023
61c679f
BP-2766 Billink B2B input fields (#754)
harli91 Jul 24, 2023
ad7889c
Bp 2767 1 password prefilled fields are ignored (#756)
harli91 Jul 24, 2023
900ae26
BP-2673 Hide PayPerBank issuers except for saved, change selected bac…
harli91 Aug 3, 2023
571f9fe
BP-2817 New Klarna KP response parameter is causing errors in Magento…
harli91 Aug 9, 2023
96c9165
BP-1494 Empty shopping cart giftcards + back button (#771)
harli91 Aug 14, 2023
650158c
BP-2673 change selected style (#769)
harli91 Aug 14, 2023
7f2cb6a
BP-1879 Afterpay NEW rejection message not clear with different billi…
harli91 Aug 16, 2023
d65b707
BP-2853 PayByBank bank selection issue on mobile devices (#777)
harli91 Aug 24, 2023
d15903e
BP-2840 PayByBank improvements (#779)
harli91 Aug 24, 2023
a368ac5
BP-2792 Add In3 API V3 selection (#776)
harli91 Aug 28, 2023
51b3903
BP-2878 Add iDEAL issuer N26 (#783)
harli91 Aug 29, 2023
8b28b0f
BP-2867 Fatal Error: with OneStepCheckout in GuestSaveManager.php #75…
harli91 Aug 29, 2023
3f23cbb
BP-2792 Fix In3 API V3 (#786)
harli91 Aug 30, 2023
c7db298
BP-2537 - Prefilled email also for customer users
LucianTuriacArnia Aug 30, 2023
0780aee
BP-2537 - prefilled email for customer users PPE
LucianTuriacArnia Aug 31, 2023
cc9e41c
Merge pull request #787 from buckaroo-it/BP-2537-prefilled-email-also…
LucianTuriacArnia Aug 31, 2023
60da42d
v1.46.0 (#789)
harli91 Sep 7, 2023
17ea1df
V1.46.0 fix merge (#791)
harli91 Sep 7, 2023
d43379d
fix2
Sep 7, 2023
6706e0b
Merge pull request #794 from buckaroo-it/v1.46.0-fix2
harli91 Sep 7, 2023
bc73a21
Merge branch 'master' of https://github.com/buckaroo-it/Magento2 into…
LucianTuriacArnia Sep 7, 2023
5e2efa5
Merge pull request #796 from buckaroo-it/merge-develop
LucianTuriacArnia Sep 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/icons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ jobs:
php ./rename-icons.php
- name: Copy payment method icons
run: |
cd Media
cd "${{ github.workspace }}/Media/Payment methods/SVG/"
rm -f ideal-qr.svg knaken.svg paylink.svg paybybank.svg
cd ${{ github.workspace }}/Media
cp -R "Payment methods/SVG/." ${{ github.workspace }}/view/adminhtml/web/images/svg/
cp -R "Payment methods/SVG/." ${{ github.workspace }}/view/frontend/web/images/svg/
- name: Copy creditcards icons
Expand All @@ -31,9 +33,12 @@ jobs:
cp -R "Creditcard issuers/SVG/." ${{ github.workspace }}/view/frontend/web/images/creditcards/
- name: Copy giftcards icons
run: |
cd Media
cd "${{ github.workspace }}/Media/Giftcards/SVG/"
rm -f vvvlekkerweg.svg vvvshopchill.svg
cd ${{ github.workspace }}/Media
cp -R "Giftcards/SVG/." ${{ github.workspace }}/view/adminhtml/web/images/giftcards/
cp -R "Giftcards/SVG/." ${{ github.workspace }}/view/frontend/web/images/giftcards/

- name: Copy payment issuers icons
run: |
cd Media
Expand Down
71 changes: 71 additions & 0 deletions Block/Config/Form/Field/LogoSelector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php
/**
* 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 [email protected] 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 [email protected] for more information.
*
* @copyright Copyright (c) Buckaroo B.V.
* @license https://tldrlegal.com/license/mit-license
*/
namespace Buckaroo\Magento2\Block\Config\Form\Field;

use \Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\View\Asset\Repository;
use Magento\Backend\Block\Template\Context;
use Magento\Framework\View\Helper\SecureHtmlRenderer;

class LogoSelector extends Field
{
protected $_template = 'Buckaroo_Magento2::in3_logo.phtml';

protected Repository $assetRepo;

/**
* @param Context $context
* @param array $data
* @param SecureHtmlRenderer|null $secureRenderer
*/
public function __construct(
Context $context,
Repository $assetRepo,
array $data = [],
?SecureHtmlRenderer $secureRenderer = null
) {
$this->assetRepo = $assetRepo;
parent::__construct($context, $data, $secureRenderer);
}

/**
* Return element html
*
* @param AbstractElement $element
* @return string
*/
protected function _getElementHtml(AbstractElement $element)
{
$element->setData('type', 'hidden');
$this->assign("input", $element->getElementHtml());
$this->assign("inputId", $element->getHtmlId());
$this->assign("inputValue", $element->getEscapedValue());
return $this->_toHtml();
}

public function getLogos(): array
{
return [
"in3.svg" => $this->assetRepo->getUrl("Buckaroo_Magento2::images/svg/in3.svg"),
"in3-ideal.svg" => $this->assetRepo->getUrl("Buckaroo_Magento2::images/svg/in3-ideal.svg")
];
}
}
3 changes: 2 additions & 1 deletion Block/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public function getPaymentLogo(string $method): string
"sofortbanking" => "svg/sofort.svg",
"emandate" => "emandate.png",
"pospayment" => "pos.png",
"transfer" => "svg/sepa-credittransfer.svg"
"transfer" => "svg/sepa-credittransfer.svg",
"paybybank" => "paybybank.gif"
];

$name = "svg/{$method}.svg";
Expand Down
28 changes: 28 additions & 0 deletions Controller/Redirect/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ public function execute()
);
$this->logger->addDebug(__METHOD__ . '|5|');

$this->removeCoupon();
$this->removeAmastyGiftcardOnFailed();

return $this->handleProcessedResponse('/');
Expand Down Expand Up @@ -429,6 +430,7 @@ protected function handleFailed($statusCode)

$this->eventManager->dispatch('buckaroo_process_handle_failed_before');

$this->removeCoupon();
$this->removeAmastyGiftcardOnFailed();

if (!$this->getSkipHandleFailedRecreate()) {
Expand Down Expand Up @@ -723,6 +725,32 @@ public function setSkipHandleFailedRecreate($value)
return true;
}

/**
* Remove coupon from failed order if magento enterprise
*
* @return void
*/
protected function removeCoupon()
{
if (method_exists($this->order,'getCouponCode')) {
$couponCode = $this->order->getCouponCode();
$couponFactory = $this->_objectManager->get(\Magento\SalesRule\Model\CouponFactory::class);
if (!(is_object($couponFactory) && method_exists($couponFactory, 'load'))) {
return;
}

$coupon = $couponFactory->load($couponCode, 'code');
$resourceModel = $this->_objectManager->get(\Magento\SalesRule\Model\Spi\CouponResourceInterface::class);
if (!(is_object($resourceModel) && method_exists($resourceModel, 'delete'))) {
return;
}

if (is_int($coupon->getCouponId())) {
$resourceModel->delete($coupon);
}
}
}

/**
* Remove amasty giftcard from failed order
*
Expand Down
2 changes: 1 addition & 1 deletion Gateway/Http/TransactionBuilderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function get($builderType)
);
}

$transactionBuilder = $this->objectManager->get($transactionBuilderClass);
$transactionBuilder = $this->objectManager->create($transactionBuilderClass);
if (!$transactionBuilder instanceof TransactionBuilderInterface) {
throw new \LogicException(
'The transaction builder must implement "Buckaroo\Magento2\Gateway\Http\TransactionBuilderInterface".'
Expand Down
10 changes: 5 additions & 5 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ public function getMode($paymentMethod = null, $store = null)
*/
public function isMobile()
{
$useragent = $_SERVER['HTTP_USER_AGENT'];
$userAgent = $this->httpHeader->getHttpUserAgent();
return preg_match(
'/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',
substr($useragent,0,4)
'/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$userAgent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',
substr($userAgent,0,4)
);
}

Expand Down Expand Up @@ -425,8 +425,8 @@ public function getPaymentMethodsList()
['value' => 'applepay', 'label' => __('Apple Pay')],
['value' => 'billink', 'label' => __('Billink')],
['value' => 'capayablein3', 'label' => __('In3')],
['value' => 'creditcard', 'label' => __('Creditcards')],
['value' => 'creditcards', 'label' => __('Creditcards (Client sided)')],
['value' => 'creditcard', 'label' => __('Credit and debit cards')],
['value' => 'creditcards', 'label' => __('Credit and debit cards (Client sided)')],
['value' => 'emandate', 'label' => __('Digital Debit Authorization')],
['value' => 'eps', 'label' => __('EPS')],
['value' => 'giftcards', 'label' => __('Giftcards')],
Expand Down
50 changes: 0 additions & 50 deletions Model/Checks/CanUseForCountry/CountryProvider.php

This file was deleted.

40 changes: 40 additions & 0 deletions Model/Config/Source/In3ApiVersions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/**
* 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 [email protected] 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 [email protected] for more information.
*
* @copyright Copyright (c) Buckaroo B.V.
* @license https://tldrlegal.com/license/mit-license
*/

namespace Buckaroo\Magento2\Model\Config\Source;

class In3ApiVersions implements \Magento\Framework\Data\OptionSourceInterface
{
public const VERSION_3 = 'V3';
public const VERSION_2 = 'V2';

/**
* Options getter
*
* @return array
*/
public function toOptionArray()
{
return [
['value' => self::VERSION_3, 'label' => __('V3 (In3)')],
['value' => self::VERSION_2, 'label' => __('V2 (Capayable/In2)')]
];
}
}
9 changes: 6 additions & 3 deletions Model/ConfigProvider/Method/AbstractConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ abstract class AbstractConfigProvider extends BaseAbstractConfigProvider impleme
'code' => 'BITSNL2A',
'imgName' => 'yoursafe'
],
[
'name' => 'N26',
'code' => 'NTSBDEB1',
'imgName' => 'n26'
],
];

/**
Expand Down Expand Up @@ -181,7 +186,7 @@ public function getIssuers()
*/
protected function formatIssuers()
{
$issuers = array_map(
return array_map(
function ($issuer) {
if(isset($issuer['imgName'])) {
$issuer['img'] = $this->getImageUrl("ideal/{$issuer['imgName']}", "svg");
Expand All @@ -190,8 +195,6 @@ function ($issuer) {
},
$this->getIssuers()
);

return $issuers;
}

public function getCreditcardLogo(string $code): string
Expand Down
18 changes: 18 additions & 0 deletions Model/ConfigProvider/Method/Applepay.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,22 @@ public function getAvailableButtons()

return $availableButtons;
}

/**
* @return array
*/
public function getBaseAllowedCurrencies()
{
return [
'EUR',
'USD',
'GBP',
'DKK',
'NOK',
'SEK',
'CHF',
'PLN'
];
}

}
29 changes: 29 additions & 0 deletions Model/ConfigProvider/Method/CapayableIn3.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* NOTICE OF LICENSE
*
Expand Down Expand Up @@ -40,6 +41,10 @@ class CapayableIn3 extends AbstractConfigProvider
const XPATH_CAPAYABLEIN3_ORDER_EMAIL = 'payment/buckaroo_magento2_capayablein3/order_email';
const XPATH_CAPAYABLEIN3_AVAILABLE_IN_BACKEND = 'payment/buckaroo_magento2_capayablein3/available_in_backend';

const XPATH_CAPAYABLEIN3_API_VERSION = 'payment/buckaroo_magento2_capayablein3/api_version';
const XPATH_CAPAYABLEIN3_PAYMENT_LOGO = 'payment/buckaroo_magento2_capayablein3/payment_logo';


const XPATH_ALLOWED_CURRENCIES = 'payment/buckaroo_magento2_capayablein3/allowed_currencies';
const XPATH_ALLOW_SPECIFIC = 'payment/buckaroo_magento2_capayablein3/allowspecific';
const XPATH_SPECIFIC_COUNTRY = 'payment/buckaroo_magento2_capayablein3/specificcountry';
Expand Down Expand Up @@ -75,6 +80,7 @@ public function getConfig()
'subtext_style' => $this->getSubtextStyle(),
'subtext_color' => $this->getSubtextColor(),
'allowedCurrencies' => $this->getAllowedCurrencies(),
'logo' => $this->getLogo()
],
],
],
Expand All @@ -96,4 +102,27 @@ public function getPaymentFee($storeId = null)

return $paymentFee ? $paymentFee : false;
}

public function isV3($storeId = null): bool
{
return $this->scopeConfig->getValue(
self::XPATH_CAPAYABLEIN3_API_VERSION,
ScopeInterface::SCOPE_STORE,
$storeId
) !== 'V2';
}
public function getLogo($storeId = null): string
{
$logo = $this->scopeConfig->getValue(
self::XPATH_CAPAYABLEIN3_PAYMENT_LOGO,
ScopeInterface::SCOPE_STORE,
$storeId
);

if (!is_string($logo) || !$this->isV3($storeId)) {
return 'in3.svg';
}

return $logo;
}
}
Loading
Loading