Skip to content

Commit

Permalink
Revert "get hotfix changes"
Browse files Browse the repository at this point in the history
  • Loading branch information
vegimcarkaxhija authored Nov 6, 2024
1 parent d4cd409 commit bde21e7
Show file tree
Hide file tree
Showing 30 changed files with 1,012 additions and 28 deletions.
1 change: 1 addition & 0 deletions Block/Widget/Button/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Toolbar
'buckaroo_magento2_belfius',
'buckaroo_magento2_transfer',
'buckaroo_magento2_eps',
'buckaroo_magento2_giropay',
'buckaroo_magento2_kbc',
'buckaroo_magento2_klarna',
'buckaroo_magento2_klarnakp',
Expand Down
1 change: 1 addition & 0 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ public function getPaymentMethodsList()
['value' => 'emandate', 'label' => __('Digital Debit Authorization')],
['value' => 'eps', 'label' => __('EPS')],
['value' => 'giftcards', 'label' => __('Giftcards')],
['value' => 'giropay', 'label' => __('Giropay')],
['value' => 'ideal', 'label' => __('iDEAL')],
['value' => 'idealprocessing', 'label' => __('iDEAL Processing')],
['value' => 'kbc', 'label' => __('KBC')],
Expand Down
1 change: 1 addition & 0 deletions Model/Config/Source/PaymentMethods/AfterExpiry.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function toOptionArray()
['value' => 'dankort', 'label' => __('Dankort')],
['value' => 'eps', 'label' => __('EPS')],
['value' => 'giftcard', 'label' => __('Giftcards')],
['value' => 'giropay', 'label' => __('Giropay')],
['value' => 'ideal', 'label' => __('iDEAL')],
['value' => 'idealprocessing', 'label' => __('iDEAL Processing')],
['value' => 'maestro', 'label' => __('Maestro')],
Expand Down
1 change: 1 addition & 0 deletions Model/Config/Source/PaymentMethods/PayLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function toOptionArray()
['value' => 'dankort', 'label' => __('Dankort')],
['value' => 'eps', 'label' => __('EPS')],
['value' => 'giftcard', 'label' => __('Giftcards')],
['value' => 'giropay', 'label' => __('Giropay')],
['value' => 'ideal', 'label' => __('iDEAL')],
['value' => 'idealprocessing', 'label' => __('iDEAL Processing')],
['value' => 'maestro', 'label' => __('Maestro')],
Expand Down
5 changes: 5 additions & 0 deletions Model/Config/Source/PaymentMethods/PayPerEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public function toOptionArray()
'label' => __('Giftcards'),
'code' => 'buckaroo_magento2_giftcards'
],
[
'value' => 'giropay',
'label' => __('Giropay'),
'code' => 'buckaroo_magento2_giropay'
],
[
'value' => 'ideal',
'label' => __('iDEAL'),
Expand Down
81 changes: 81 additions & 0 deletions Model/ConfigProvider/Method/Giropay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?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 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
*/

namespace Buckaroo\Magento2\Model\ConfigProvider\Method;

class Giropay extends AbstractConfigProvider
{
const XPATH_GIROPAY_PAYMENT_FEE = 'payment/buckaroo_magento2_giropay/payment_fee';
const XPATH_GIROPAY_PAYMENT_FEE_LABEL = 'payment/buckaroo_magento2_giropay/payment_fee_label';
const XPATH_GIROPAY_ACTIVE = 'payment/buckaroo_magento2_giropay/active';
const XPATH_GIROPAY_SUBTEXT = 'payment/buckaroo_magento2_giropay/subtext';
const XPATH_GIROPAY_SUBTEXT_STYLE = 'payment/buckaroo_magento2_giropay/subtext_style';
const XPATH_GIROPAY_SUBTEXT_COLOR = 'payment/buckaroo_magento2_giropay/subtext_color';
const XPATH_GIROPAY_ACTIVE_STATUS = 'payment/buckaroo_magento2_giropay/active_status';
const XPATH_GIROPAY_ORDER_STATUS_SUCCESS = 'payment/buckaroo_magento2_giropay/order_status_success';
const XPATH_GIROPAY_ORDER_STATUS_FAILED = 'payment/buckaroo_magento2_giropay/order_status_failed';
const XPATH_GIROPAY_AVAILABLE_IN_BACKEND = 'payment/buckaroo_magento2_giropay/available_in_backend';

const XPATH_ALLOWED_CURRENCIES = 'payment/buckaroo_magento2_giropay/allowed_currencies';

const XPATH_ALLOW_SPECIFIC = 'payment/buckaroo_magento2_giropay/allowspecific';
const XPATH_SPECIFIC_COUNTRY = 'payment/buckaroo_magento2_giropay/specificcountry';
const XPATH_SPECIFIC_CUSTOMER_GROUP = 'payment/buckaroo_magento2_giropay/specificcustomergroup';

/**
* @return array|void
*/
public function getConfig()
{
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel(
\Buckaroo\Magento2\Model\Method\Giropay::PAYMENT_METHOD_CODE
);

return [
'payment' => [
'buckaroo' => [
'giropay' => [
'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_GIROPAY_PAYMENT_FEE,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$storeId
);

return $paymentFee ? $paymentFee : false;
}
}
3 changes: 1 addition & 2 deletions Model/ConfigProvider/Method/P24.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ public function getPaymentFee($storeId = null)
public function getBaseAllowedCurrencies()
{
return [
'PLN',
'EUR'
'PLN'
];
}
}
109 changes: 109 additions & 0 deletions Model/Method/Giropay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?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 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
*/

namespace Buckaroo\Magento2\Model\Method;

class Giropay extends AbstractMethod
{
/**
* Payment Code
*/
const PAYMENT_METHOD_CODE = 'buckaroo_magento2_giropay';

/**
* @var string
*/
public $buckarooPaymentMethodCode = 'giropay';

/**
* Payment method code
*
* @var string
*/
protected $_code = self::PAYMENT_METHOD_CODE;

/**
* {@inheritdoc}
*/
public function getOrderTransactionBuilder($payment)
{
$transactionBuilder = $this->transactionBuilderFactory->get('order');

$services = [
'Name' => 'giropay',
'Action' => 'Pay',
'Version' => 2,
];

/**
* @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;
}

protected function getRefundTransactionBuilderVersion()
{
return 2;
}

/**
* {@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 $this->buckarooPaymentMethodCode;
}

protected function getRefundTransactionBuilderChannel()
{
return 'Web';
}
}
30 changes: 14 additions & 16 deletions Model/Service/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory;
use Buckaroo\Magento2\Helper\Data;
use Magento\Framework\App\ResourceConnection;
use Laminas\Db\Sql\Expression;

class Order
{
Expand All @@ -44,17 +43,16 @@ class Order
private Factory $configProviderFactory;

public function __construct(
Account $accountConfig,
MethodFactory $configProviderMethodFactory,
Factory $configProviderFactory,
Account $accountConfig,
MethodFactory $configProviderMethodFactory,
Factory $configProviderFactory,
StoreRepositoryInterface $storeRepository,
CollectionFactory $orderFactory,
OrderStatusFactory $orderStatusFactory,
Data $helper,
Log $logging,
ResourceConnection $resourceConnection
)
{
CollectionFactory $orderFactory,
OrderStatusFactory $orderStatusFactory,
Data $helper,
Log $logging,
ResourceConnection $resourceConnection
) {
$this->accountConfig = $accountConfig;
$this->configProviderMethodFactory = $configProviderMethodFactory;
$this->configProviderFactory = $configProviderFactory;
Expand Down Expand Up @@ -96,11 +94,11 @@ protected function cancelExpiredTransferOrdersPerStore($store)
)
->addFieldToFilter(
'created_at',
['lt' => new Expression('NOW() - INTERVAL ' . $dueDays . ' DAY')]
['lt' => new \Zend_Db_Expr('NOW() - INTERVAL ' . $dueDays . ' DAY')]
)
->addFieldToFilter(
'created_at',
['gt' => new Expression('NOW() - INTERVAL ' . ($dueDays + 7) . ' DAY')]
['gt' => new \Zend_Db_Expr('NOW() - INTERVAL ' . ($dueDays + 7) . ' DAY')]
);

$orderCollection->getSelect()
Expand Down Expand Up @@ -156,11 +154,11 @@ protected function cancelExpiredPPEOrdersPerStore($store)
)
->addFieldToFilter(
'created_at',
['lt' => new Expression('NOW() - INTERVAL ' . $dueDays . ' DAY')]
['lt' => new \Zend_Db_Expr('NOW() - INTERVAL ' . $dueDays . ' DAY')]
)
->addFieldToFilter(
'created_at',
['gt' => new Expression('NOW() - INTERVAL ' . ($dueDays + 7) . ' DAY')]
['gt' => new \Zend_Db_Expr('NOW() - INTERVAL ' . ($dueDays + 7) . ' DAY')]
);

$orderCollection->getSelect()
Expand Down Expand Up @@ -218,7 +216,7 @@ public function cancel($order, $statusCode)
$this->logging->addDebug(__METHOD__ . '|20|');

if (in_array($order->getPayment()->getMethodInstance()->buckarooPaymentMethodCode, ['klarnakp'])) {
$methodInstanceClass = get_class($order->getPayment()->getMethodInstance());
$methodInstanceClass = get_class($order->getPayment()->getMethodInstance());
$methodInstanceClass::$requestOnVoid = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public function toOptionArrayProvider()
[
['value' => 'giftcard', 'label' => 'Giftcards']
],
[
['value' => 'giropay', 'label' => 'Giropay']
],
[
['value' => 'ideal', 'label' => 'iDEAL']
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public function toOptionArrayProvider()
[
['value' => 'giftcard', 'label' => 'Giftcards']
],
[
['value' => 'giropay', 'label' => 'Giropay']
],
[
['value' => 'ideal', 'label' => 'iDEAL']
],
Expand Down
Loading

0 comments on commit bde21e7

Please sign in to comment.