Skip to content

Commit 895eaa2

Browse files
Merge pull request #545 from mollie/release/2.14.0
Release/2.14.0
2 parents d8e4e9a + adccd0d commit 895eaa2

File tree

15 files changed

+105
-20
lines changed

15 files changed

+105
-20
lines changed

.github/workflows/integration-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
- PHP_VERSION: php71-fpm
1010
MAGENTO_VERSION: 2.3.3
1111
- PHP_VERSION: php73-fpm
12-
MAGENTO_VERSION: 2.3.6-p1
12+
MAGENTO_VERSION: 2.3.7-p3
1313
- PHP_VERSION: php73-fpm
14-
MAGENTO_VERSION: 2.4.2
14+
MAGENTO_VERSION: 2.4.0
1515
- PHP_VERSION: php74-fpm
16-
MAGENTO_VERSION: 2.4.2
16+
MAGENTO_VERSION: 2.4.0
1717
- PHP_VERSION: php74-fpm
1818
MAGENTO_VERSION: 2.4.3-with-replacements
1919
- PHP_VERSION: php81-fpm

.github/workflows/phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- PHP_VERSION: php72-fpm
1010
MAGENTO_VERSION: 2.3.4
1111
- PHP_VERSION: php73-fpm
12-
MAGENTO_VERSION: 2.3.7
12+
MAGENTO_VERSION: 2.3.7-p3
1313
- PHP_VERSION: php74-fpm
1414
MAGENTO_VERSION: 2.4.0
1515
- PHP_VERSION: php81-fpm

.github/workflows/setup-di-compile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- PHP_VERSION: php71-fpm
1010
MAGENTO_VERSION: 2.3.3
1111
- PHP_VERSION: php73-fpm
12-
MAGENTO_VERSION: 2.3.6-p1
12+
MAGENTO_VERSION: 2.3.7-p3
1313
- PHP_VERSION: php74-fpm
1414
MAGENTO_VERSION: 2.4.2
1515
- PHP_VERSION: php74-fpm

.github/workflows/unit-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- PHP_VERSION: php71-fpm
1010
MAGENTO_VERSION: 2.3.3
1111
- PHP_VERSION: php73-fpm
12-
MAGENTO_VERSION: 2.3.7
12+
MAGENTO_VERSION: 2.3.7-p3
1313
- PHP_VERSION: php74-fpm
1414
MAGENTO_VERSION: 2.4.0
1515
- PHP_VERSION: php74-fpm
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace Mollie\Payment\Model\Adminhtml\Source;
4+
5+
use Magento\Framework\Data\OptionSourceInterface;
6+
7+
class SecondChancePaymentMethod implements OptionSourceInterface
8+
{
9+
public const USE_PREVIOUS_METHOD = 'use_method_of_original_order';
10+
11+
/**
12+
* @var EnabledMolliePaymentMethod
13+
*/
14+
private $enabledMolliePaymentMethod;
15+
16+
public function __construct(
17+
EnabledMolliePaymentMethod $enabledMolliePaymentMethod
18+
) {
19+
$this->enabledMolliePaymentMethod = $enabledMolliePaymentMethod;
20+
}
21+
22+
public function toOptionArray(): array
23+
{
24+
$options = $this->enabledMolliePaymentMethod->toOptionArray();
25+
26+
array_unshift($options, [
27+
'value' => static::USE_PREVIOUS_METHOD,
28+
'label' => __('Use the method of the original order'),
29+
]);
30+
31+
return $options;
32+
}
33+
}

Model/MollieConfigProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ public function getActiveMethods(MollieApiClient $mollieApi, CartInterface $cart
258258
];
259259
}
260260
} catch (\Exception $e) {
261-
$this->mollieHelper->addTolog('error', 'Function: getActiveMethods: ' . $e->getMessage());
261+
$this->mollieHelper->addTolog('info', 'Function: getActiveMethods: ' . $e->getMessage());
262262
$this->methodData = [];
263263
}
264264

Model/OrderLines.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function getShipmentOrderLines(ShipmentInterface $shipment): array
205205

206206
/** @var OrderInterface $order */
207207
$order = $shipment->getOrder();
208-
$orderHasDiscount = abs($order->getDiscountAmount()) > 0;
208+
$orderHasDiscount = abs($order->getDiscountAmount() ?? 0) > 0;
209209

210210
/** @var \Magento\Sales\Model\Order\Shipment\Item $item */
211211
foreach ($shipment->getItemsCollection() as $item) {

Service/Order/Reorder.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Magento\Sales\Model\Order\Invoice;
1919
use Magento\Sales\Model\Service\InvoiceService;
2020
use Mollie\Payment\Config;
21+
use Mollie\Payment\Model\Adminhtml\Source\SecondChancePaymentMethod;
2122
use Mollie\Payment\Plugin\InventorySales\Model\IsProductSalableForRequestedQtyCondition\IsSalableWithReservationsCondition\DisableCheckForAdminOrders;
2223

2324
class Reorder
@@ -100,7 +101,7 @@ public function create(OrderInterface $originalOrder): OrderInterface
100101

101102
$order = $this->recreate(
102103
$originalOrder,
103-
$this->config->secondChanceUsePaymentMethod($originalOrder->getStoreId())
104+
$this->getPaymentMethod($originalOrder)
104105
);
105106

106107
$this->cancelOriginalOrder($originalOrder);
@@ -213,4 +214,19 @@ private function addCommentHistoryOriginalOrder(OrderInterface $originalOrder, $
213214
$comment = __('We created a new order with increment ID: %1', $newIncrementId);
214215
$this->orderCommentHistory->add($originalOrder, $comment, false);
215216
}
217+
218+
/**
219+
* @param OrderInterface $originalOrder
220+
* @return string|null
221+
*/
222+
public function getPaymentMethod(OrderInterface $originalOrder): ?string
223+
{
224+
$value = $this->config->secondChanceUsePaymentMethod($originalOrder->getStoreId());
225+
226+
if ($value == SecondChancePaymentMethod::USE_PREVIOUS_METHOD) {
227+
return $originalOrder->getPayment()->getMethod();
228+
}
229+
230+
return $value;
231+
}
216232
}

Service/Order/Uncancel/OrderReservation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Mollie\Payment\Service\Order\Uncancel;
44

55
use Magento\Catalog\Model\Indexer\Product\Price\Processor;
6-
use Magento\Framework\App\ObjectManager;
6+
use Magento\Framework\ObjectManagerInterface;
77
use Magento\InventorySales\Model\SalesEvent;
88
use Magento\InventorySalesApi\Api\Data\ItemToSellInterface;
99
use Magento\InventorySalesApi\Api\Data\SalesChannelInterface;
@@ -45,7 +45,7 @@ class OrderReservation
4545
public function __construct(
4646
WebsiteRepositoryInterface $websiteRepository,
4747
Processor $priceIndexer,
48-
ObjectManager $objectManager
48+
ObjectManagerInterface $objectManager
4949
) {
5050
$this->websiteRepository = $websiteRepository;
5151
$this->priceIndexer = $priceIndexer;

Service/Quote/CartContainsRecurringProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function execute(CartInterface $cart): bool
2727
$items = $cart->getItemsCollection()->getItems();
2828
foreach ($items as $item) {
2929
$buyRequest = $item->getOptionByCode('info_buyRequest');
30-
if (strstr($buyRequest->getValue(), 'is_recurring') !== false &&
30+
if ($buyRequest && strstr($buyRequest->getValue(), 'is_recurring') !== false &&
3131
$this->jsonContainsRecurringValue($buyRequest->getValue())) {
3232
return true;
3333
}

0 commit comments

Comments
 (0)