Skip to content

Commit

Permalink
Merge branch 'refs/heads/develop' into BP-3652-Implement-Buckaroo-Hos…
Browse files Browse the repository at this point in the history
…ted-Fields

# Conflicts:
#	i18n/de_DE.csv
#	i18n/nl_NL.csv
  • Loading branch information
vegimcarkaxhija committed Sep 27, 2024
2 parents 4fabbcf + 8f6698d commit 10f74bf
Show file tree
Hide file tree
Showing 39 changed files with 253 additions and 1,059 deletions.
1 change: 0 additions & 1 deletion Block/Widget/Button/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ 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: 0 additions & 1 deletion Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ 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: 0 additions & 1 deletion Model/Config/Source/PaymentMethods/AfterExpiry.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ 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: 0 additions & 1 deletion Model/Config/Source/PaymentMethods/PayLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ 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: 0 additions & 5 deletions Model/Config/Source/PaymentMethods/PayPerEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ 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: 0 additions & 81 deletions Model/ConfigProvider/Method/Giropay.php

This file was deleted.

104 changes: 0 additions & 104 deletions Model/Method/Giropay.php

This file was deleted.

30 changes: 16 additions & 14 deletions Model/Service/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
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 @@ -43,16 +44,17 @@ 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 @@ -94,11 +96,11 @@ protected function cancelExpiredTransferOrdersPerStore($store)
)
->addFieldToFilter(
'created_at',
['lt' => new \Zend_Db_Expr('NOW() - INTERVAL ' . $dueDays . ' DAY')]
['lt' => new Expression('NOW() - INTERVAL ' . $dueDays . ' DAY')]
)
->addFieldToFilter(
'created_at',
['gt' => new \Zend_Db_Expr('NOW() - INTERVAL ' . ($dueDays + 7) . ' DAY')]
['gt' => new Expression('NOW() - INTERVAL ' . ($dueDays + 7) . ' DAY')]
);

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

$orderCollection->getSelect()
Expand Down Expand Up @@ -216,7 +218,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
40 changes: 0 additions & 40 deletions Model/Total/Quote/BuckarooAlreadyPay.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,46 +47,6 @@ public function __construct(
$this->giftcardCollection = $giftcardCollection;
}

/**
* Collect grand total address amount
*
* @param \Magento\Quote\Model\Quote $quote
* @param \Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment
* @param \Magento\Quote\Model\Quote\Address\Total $total
* @return $this
*
* @throws \LogicException
*/
public function collect(
\Magento\Quote\Model\Quote $quote,
\Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment,
\Magento\Quote\Model\Quote\Address\Total $total
) {
parent::collect($quote, $shippingAssignment, $total);

// Ensure that shipping assignment has items, otherwise skip processing.
if (!$shippingAssignment->getItems()) {
return $this;
}

$orderId = $quote->getReservedOrderId();
$alreadyPaidAmount = $this->groupTransaction->getAlreadyPaid($orderId);

// Ensure totals are properly initialized.
$total->setTotalAmount($this->getCode(), 0);
$total->setBaseTotalAmount($this->getCode(), 0);

// Adjust the grand total only if the already paid amount is greater than zero.
if ($alreadyPaidAmount > 0) {
$total->addTotalAmount($this->getCode(), -$alreadyPaidAmount);
$total->addBaseTotalAmount($this->getCode(), -$alreadyPaidAmount);

}

return $this;
}


/**
* Add buckaroo fee information to address
*
Expand Down
3 changes: 1 addition & 2 deletions Model/Total/Quote/BuckarooFee.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ public function collect(

// Check if already paid amount is affecting the calculation
if ($this->groupTransaction->getAlreadyPaid($orderId) > 0) {
// Optionally, you could log or debug here to ensure no early returns affect the fee calculation.
$this->logging->addDebug('Already paid detected, but continuing to add fee.');
return $this;
}

// Ensure payment method is set correctly
Expand Down
4 changes: 1 addition & 3 deletions Model/Total/Quote/BuckarooFeeHyva.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ public function collect(

// Check if already paid amount is affecting the calculation
if ($this->groupTransaction->getAlreadyPaid($orderId) > 0) {
// Optionally, you could log or debug here to ensure no early returns affect the fee calculation.
$this->logging->addDebug('Already paid detected, but continuing to add fee.');
return $this;
}

// Ensure payment method is set correctly
Expand Down Expand Up @@ -172,7 +171,6 @@ public function collect(
// Set the fee on the total object for further calculations
$total->setBuckarooFee($paymentFee);
$total->setBaseBuckarooFee($basePaymentFee);
$total->setGrandTotal($total->getGrandTotal() + $paymentFee);

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion Service/Software/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Data
const MODULE_CODE = 'Buckaroo_Magento2';

/** Version of Module */
const BUCKAROO_VERSION = '1.49.4';
const BUCKAROO_VERSION = '1.50.1';

/** @var ProductMetadataInterface */
private $productMetadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ public function toOptionArrayProvider()
[
['value' => 'giftcard', 'label' => 'Giftcards']
],
[
['value' => 'giropay', 'label' => 'Giropay']
],
[
['value' => 'ideal', 'label' => 'iDEAL']
],
Expand Down
Loading

0 comments on commit 10f74bf

Please sign in to comment.