Skip to content

Commit 4aad9bf

Browse files
Merge pull request #859 from mollie/release/2.43.0
Release/2.43.0
2 parents edfeaba + 6bc89d5 commit 4aad9bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1243
-90
lines changed

.github/workflows/end-2-end-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
- name: Start the Magento container
8080
run: |
8181
openssl req -x509 -newkey rsa:4096 -keyout .github/workflows/templates/nginx-proxy/magento.test.key -out .github/workflows/templates/nginx-proxy/magento.test.crt -days 365 -nodes -subj "/CN=magento.test" && \
82-
docker compose -f .github/workflows/templates/docker-compose.yml up -d
82+
docker compose -f .github/workflows/templates/docker-compose.yml up -d --quiet-pull
8383
# Get the URL from ngrok
8484
docker compose -f .github/workflows/templates/docker-compose.yml logs ngrok
8585
MAGENTO_URL=$(docker exec magento-project-community-edition /bin/bash -c "curl -s ngrok:4040/api/tunnels |jq -r \".tunnels[0].public_url\"")

.github/workflows/templates/e2e/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM cypress/included:13.6.2
1+
FROM cypress/included:14.0.1
22

33
WORKDIR /e2e
44

Controller/Checkout/Process.php

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
namespace Mollie\Payment\Controller\Checkout;
88

99
use Magento\Framework\App\ResponseInterface;
10-
use Magento\Framework\DataObject;
11-
use Magento\Framework\Event\ManagerInterface;
1210
use Magento\Framework\Exception\NoSuchEntityException;
1311
use Magento\Sales\Api\OrderRepositoryInterface;
1412
use Mollie\Payment\Model\Mollie as MollieModel;
@@ -18,6 +16,7 @@
1816
use Magento\Framework\App\Action\Context;
1917
use Magento\Checkout\Model\Session;
2018
use Mollie\Payment\Service\Mollie\GetMollieStatusResult;
19+
use Mollie\Payment\Service\Mollie\Order\AddResultMessage;
2120
use Mollie\Payment\Service\Mollie\Order\SuccessPageRedirect;
2221
use Mollie\Payment\Service\Mollie\ProcessTransaction;
2322
use Mollie\Payment\Service\Mollie\ValidateProcessRequest;
@@ -53,11 +52,6 @@ class Process extends Action
5352
*/
5453
private $orderRepository;
5554

56-
/**
57-
* @var ManagerInterface
58-
*/
59-
private $eventManager;
60-
6155
/**
6256
* @var RedirectOnError
6357
*/
@@ -74,6 +68,10 @@ class Process extends Action
7468
* @var SuccessPageRedirect
7569
*/
7670
private $successPageRedirect;
71+
/**
72+
* @var AddResultMessage
73+
*/
74+
private $addResultMessage;
7775

7876
public function __construct(
7977
Context $context,
@@ -83,21 +81,21 @@ public function __construct(
8381
MollieHelper $mollieHelper,
8482
OrderRepositoryInterface $orderRepository,
8583
RedirectOnError $redirectOnError,
86-
ManagerInterface $eventManager,
8784
ValidateProcessRequest $validateProcessRequest,
8885
ProcessTransaction $processTransaction,
89-
SuccessPageRedirect $successPageRedirect
86+
SuccessPageRedirect $successPageRedirect,
87+
AddResultMessage $addResultMessage
9088
) {
9189
$this->checkoutSession = $checkoutSession;
9290
$this->paymentHelper = $paymentHelper;
9391
$this->mollieModel = $mollieModel;
9492
$this->mollieHelper = $mollieHelper;
9593
$this->orderRepository = $orderRepository;
9694
$this->redirectOnError = $redirectOnError;
97-
$this->eventManager = $eventManager;
9895
$this->validateProcessRequest = $validateProcessRequest;
9996
$this->processTransaction = $processTransaction;
10097
$this->successPageRedirect = $successPageRedirect;
98+
$this->addResultMessage = $addResultMessage;
10199

102100
parent::__construct($context);
103101
}
@@ -144,31 +142,11 @@ protected function handleNonSuccessResult(GetMollieStatusResult $result, array $
144142
{
145143
$this->checkIfLastRealOrder($orderIds);
146144
$this->checkoutSession->restoreQuote();
147-
$this->addResultMessage($result);
145+
$this->addResultMessage->execute($result);
148146

149147
return $this->_redirect($this->redirectOnError->getUrl());
150148
}
151149

152-
protected function addResultMessage(GetMollieStatusResult $result)
153-
{
154-
if ($result->getStatus() == 'canceled') {
155-
$this->messageManager->addNoticeMessage(__('Payment canceled, please try again.'));
156-
return;
157-
}
158-
159-
if ($result->getStatus() == 'failed' && $result->getMethod()) {
160-
$this->messageManager->addErrorMessage(
161-
__(
162-
'Payment of type %1 has been rejected. Decision is based on order and outcome of risk assessment.',
163-
$result->getMethod()
164-
)
165-
);
166-
return;
167-
}
168-
169-
$this->messageManager->addErrorMessage(__('Transaction failed. Please verify your billing information and payment method, and try again.'));
170-
}
171-
172150
/**
173151
* @param array $orderIds
174152
*/

Model/Adminhtml/Source/CustomerGroup.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public function toOptionArray(): array
2424
{
2525
$groups = $this->groupManagement->getLoggedInGroups();
2626

27+
$notLoggedInGroup = $this->groupManagement->getNotLoggedInGroup();
28+
array_unshift($groups, $notLoggedInGroup);
29+
2730
$output = [];
2831
foreach ($groups as $group) {
2932
$output[] = [

Model/Client/Payments.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,12 @@ public function startTransaction(OrderInterface $order, $mollieApi)
233233
}
234234

235235
if ($method == 'banktransfer') {
236-
$paymentData['billingEmail'] = $order->getCustomerEmail();
236+
$paymentData['billingAddress']['email'] = $order->getCustomerEmail();
237237
$paymentData['dueDate'] = $this->mollieHelper->getBanktransferDueDate($storeId);
238238
}
239239

240240
if ($method == 'przelewy24') {
241-
$paymentData['billingEmail'] = $order->getCustomerEmail();
241+
$paymentData['billingAddress']['email'] = $order->getCustomerEmail();
242242
}
243243

244244
$paymentData = $this->buildTransaction->execute($order, static::CHECKOUT_TYPE, $paymentData);

Model/Methods/MbWay.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/*
3+
* Copyright Magmodules.eu. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Mollie\Payment\Model\Methods;
8+
9+
class MbWay extends \Mollie\Payment\Model\Mollie
10+
{
11+
/**
12+
* Payment method code
13+
*
14+
* @var string
15+
*/
16+
const CODE = 'mollie_methods_mbway';
17+
}

Model/Methods/Multibanco.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/*
3+
* Copyright Magmodules.eu. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Mollie\Payment\Model\Methods;
8+
9+
class Multibanco extends \Mollie\Payment\Model\Mollie
10+
{
11+
/**
12+
* Payment method code
13+
*
14+
* @var string
15+
*/
16+
const CODE = 'mollie_methods_multibanco';
17+
}

Model/Methods/Reorder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use Mollie\Payment\Model\Client\Payments as PaymentsApi;
2929
use Mollie\Payment\Model\Mollie;
3030
use Mollie\Payment\Service\Mollie\GetApiMethod;
31+
use Mollie\Payment\Service\Mollie\LogException;
3132
use Mollie\Payment\Service\OrderLockService;
3233
use Mollie\Payment\Service\Mollie\MollieApiClient;
3334
use Mollie\Payment\Service\Mollie\Timeout;
@@ -72,6 +73,7 @@ public function __construct(
7273
MollieApiClient $mollieApiClient,
7374
TransactionToOrderRepositoryInterface $transactionToOrderRepository,
7475
GetApiMethod $getApiMethod,
76+
LogException $logException,
7577
RequestInterface $request,
7678
$formBlockType,
7779
$infoBlockType,
@@ -100,6 +102,7 @@ public function __construct(
100102
$mollieApiClient,
101103
$transactionToOrderRepository,
102104
$getApiMethod,
105+
$logException,
103106
$formBlockType,
104107
$infoBlockType,
105108
$commandPool,

Model/Methods/Voucher.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use Mollie\Payment\Model\Client\Payments as PaymentsApi;
2929
use Mollie\Payment\Model\Mollie;
3030
use Mollie\Payment\Service\Mollie\GetApiMethod;
31+
use Mollie\Payment\Service\Mollie\LogException;
3132
use Mollie\Payment\Service\OrderLockService;
3233
use Mollie\Payment\Service\Mollie\MollieApiClient;
3334
use Mollie\Payment\Service\Mollie\Timeout;
@@ -68,6 +69,7 @@ public function __construct(
6869
MollieApiClient $mollieApiClient,
6970
TransactionToOrderRepositoryInterface $transactionToOrderRepository,
7071
GetApiMethod $getApiMethod,
72+
LogException $logException,
7173
$formBlockType,
7274
$infoBlockType,
7375
QuoteHasMealVoucherProducts $quoteHasMealVoucherProducts,
@@ -96,6 +98,7 @@ public function __construct(
9698
$mollieApiClient,
9799
$transactionToOrderRepository,
98100
$getApiMethod,
101+
$logException,
99102
$formBlockType,
100103
$infoBlockType,
101104
$commandPool,

Model/Mollie.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
use Mollie\Payment\Model\Client\Payments as PaymentsApi;
3737
use Mollie\Payment\Model\Client\ProcessTransactionResponse;
3838
use Mollie\Payment\Service\Mollie\GetApiMethod;
39+
use Mollie\Payment\Service\Mollie\LogException;
3940
use Mollie\Payment\Service\OrderLockService;
4041
use Mollie\Payment\Service\Mollie\Timeout;
4142
use Mollie\Payment\Service\Mollie\Wrapper\MollieApiClientFallbackWrapper;
@@ -121,6 +122,10 @@ class Mollie extends Adapter
121122
* @var GetApiMethod
122123
*/
123124
private $getApiMethod;
125+
/**
126+
* @var LogException
127+
*/
128+
private $logException;
124129

125130
public function __construct(
126131
ManagerInterface $eventManager,
@@ -142,6 +147,7 @@ public function __construct(
142147
\Mollie\Payment\Service\Mollie\MollieApiClient $mollieApiClient,
143148
TransactionToOrderRepositoryInterface $transactionToOrderRepository,
144149
GetApiMethod $getApiMethod,
150+
LogException $logException,
145151
$formBlockType,
146152
$infoBlockType,
147153
CommandPoolInterface $commandPool = null,
@@ -179,6 +185,7 @@ public function __construct(
179185
$this->mollieApiClient = $mollieApiClient;
180186
$this->transactionToOrderRepository = $transactionToOrderRepository;
181187
$this->getApiMethod = $getApiMethod;
188+
$this->logException = $logException;
182189
}
183190

184191
public function getCode()
@@ -280,7 +287,7 @@ private function startTransactionUsingTheOrdersApi(OrderInterface $order, Mollie
280287
return $this->ordersApi->startTransaction($order, $mollieApi);
281288
});
282289
} catch (\Exception $exception) {
283-
$this->mollieHelper->addTolog('error', $exception->getMessage());
290+
$this->logException->execute($exception);
284291
}
285292

286293
$methodCode = $this->mollieHelper->getMethodCode($order);

0 commit comments

Comments
 (0)