Skip to content

Commit 1c1184d

Browse files
Merge pull request #883 from mollie/release/2.45.0
Release/2.45.0
2 parents eaf1d2d + 421b5ae commit 1c1184d

File tree

169 files changed

+2784
-1092
lines changed

Some content is hidden

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

169 files changed

+2784
-1092
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ jobs:
5252
- PHP_VERSION: php74-fpm
5353
MAGENTO_VERSION: 2.3.7-p4
5454
NO_API_KEY_TEST: false
55-
- PHP_VERSION: php82-fpm
56-
MAGENTO_VERSION: 2.4.6-p5
55+
- PHP_VERSION: php84-fpm
56+
MAGENTO_VERSION: 2.4.8
5757
NO_API_KEY_TEST: false
5858
- PHP_VERSION: php74-fpm
5959
MAGENTO_VERSION: 2.3.7-p4

.github/workflows/integration-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
MAGENTO_VERSION: 2.4.3-with-replacements
1616
- PHP_VERSION: php81-fpm
1717
MAGENTO_VERSION: 2.4.6-p4
18-
- PHP_VERSION: php83-fpm
19-
MAGENTO_VERSION: 2.4.7
18+
- PHP_VERSION: php84-fpm
19+
MAGENTO_VERSION: 2.4.8
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v4

.github/workflows/linting.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,29 @@ jobs:
55
php-73:
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: prestashop/github-action-php-lint/[email protected]
8+
- uses: prestashop/github-action-php-lint/7.3@v2.3.1
99

1010
php-74:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: prestashop/github-action-php-lint/[email protected]
13+
- uses: prestashop/github-action-php-lint/7.4@v2.3.1
1414

1515
php-81:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: prestashop/github-action-php-lint/[email protected]
18+
- uses: prestashop/github-action-php-lint/8.1@v2.3.1
1919

2020
php-82:
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: prestashop/github-action-php-lint/[email protected]
23+
- uses: prestashop/github-action-php-lint/[email protected]
24+
25+
php-83:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: prestashop/github-action-php-lint/[email protected]
29+
30+
php-84:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: prestashop/github-action-php-lint/[email protected]

.github/workflows/phpstan.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
MAGENTO_VERSION: 2.4.0
1313
- PHP_VERSION: php81-fpm
1414
MAGENTO_VERSION: 2.4.6-p4
15-
- PHP_VERSION: php83-fpm
16-
MAGENTO_VERSION: 2.4.7
17-
- PHP_VERSION: php83-fpm
18-
MAGENTO_VERSION: 2.4.7
15+
- PHP_VERSION: php84-fpm
16+
MAGENTO_VERSION: 2.4.8
17+
- PHP_VERSION: php84-fpm
18+
MAGENTO_VERSION: 2.4.8
1919
PHPSTAN_LEVEL: 2
2020

2121
name: PHP ${{ matrix.PHP_VERSION }} Magento ${{ matrix.MAGENTO_VERSION }}${{ matrix.PHPSTAN_LEVEL && format(' Level {0}', matrix.PHPSTAN_LEVEL) || '' }}

.github/workflows/templates/magento/configure-mollie.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ bin/magento config:set payment/mollie_methods_giftcard/active 1
2424
bin/magento config:set payment/mollie_methods_ideal/active 1
2525
bin/magento config:set payment/mollie_methods_kbc/active 1
2626
bin/magento config:set payment/mollie_methods_klarnasliceit/active 1
27+
bin/magento config:set payment/mollie_methods_paybybank/active 1
2728
bin/magento config:set payment/mollie_methods_paypal/active 1
2829
bin/magento config:set payment/mollie_methods_przelewy24/active 1
2930
bin/magento config:set payment/mollie_methods_payconiq/active 1

.github/workflows/unit-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
MAGENTO_VERSION: 2.4.3-with-replacements
1616
- PHP_VERSION: php81-fpm
1717
MAGENTO_VERSION: 2.4.6-p4
18-
- PHP_VERSION: php83-fpm
19-
MAGENTO_VERSION: 2.4.7
18+
- PHP_VERSION: php84-fpm
19+
MAGENTO_VERSION: 2.4.8
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v4

Api/Data/PendingPaymentReminderInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getEntityId();
3030
* @param int|null $customerId
3131
* @return \Mollie\Payment\Api\Data\PendingPaymentReminderInterface
3232
*/
33-
public function setCustomerId(int $customerId = null);
33+
public function setCustomerId(?int $customerId = null);
3434

3535
/**
3636
* @return int
@@ -41,7 +41,7 @@ public function getCustomerId();
4141
* @param string|null $hash
4242
* @return \Mollie\Payment\Api\Data\PendingPaymentReminderInterface
4343
*/
44-
public function setHash(string $hash = null);
44+
public function setHash(?string $hash = null);
4545

4646
/**
4747
* @return string

Block/Product/View/ApplePay.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ public function getCurrencyCode(): string
6969

7070
public function isEnabled(): bool
7171
{
72-
return $this->config->isProductionMode() &&
73-
$this->config->isMethodActive('mollie_methods_applepay') &&
72+
return $this->config->isMethodActive('mollie_methods_applepay') &&
7473
$this->config->applePayEnableBuyNowButton();
7574
}
7675

Config.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public function getApiKey($storeId = null)
224224
return $apiKey;
225225
}
226226

227-
public function getTestApiKey(int $storeId = null): string
227+
public function getTestApiKey(?int $storeId = null): string
228228
{
229229
$apiKey = trim((string)$this->getPath(static::GENERAL_APIKEY_TEST, $storeId) ?? '');
230230
if (empty($apiKey)) {
@@ -238,7 +238,7 @@ public function getTestApiKey(int $storeId = null): string
238238
return $apiKey;
239239
}
240240

241-
public function getLiveApiKey(int $storeId = null): string
241+
public function getLiveApiKey(?int $storeId = null): string
242242
{
243243
$apiKey = trim((string)$this->getPath(static::GENERAL_APIKEY_LIVE, $storeId) ?? '');
244244
if (empty($apiKey)) {
@@ -283,7 +283,7 @@ public function useManualCapture($storeId): bool
283283
* @param int|null $storeId
284284
* @return bool
285285
*/
286-
public function isMethodsApiEnabled(int $storeId = null): bool
286+
public function isMethodsApiEnabled(?int $storeId = null): bool
287287
{
288288
return $this->isSetFlag(static::ADVANCED_ENABLE_METHODS_API, $storeId);
289289
}
@@ -368,7 +368,7 @@ public function secondChanceEmailDelay($storeId = null)
368368
* @param null|int|string $storeId
369369
* @return string|null
370370
*/
371-
public function secondChanceSendBccTo(int $storeId = null): ?string
371+
public function secondChanceSendBccTo(?int $storeId = null): ?string
372372
{
373373
return $this->getPath(static::GENERAL_SECOND_CHANCE_SEND_BCC_TO, $storeId);
374374
}
@@ -377,7 +377,7 @@ public function secondChanceSendBccTo(int $storeId = null): ?string
377377
* @param null|int|string $storeId
378378
* @return string|null
379379
*/
380-
public function secondChanceUsePaymentMethod(int $storeId = null): ?string
380+
public function secondChanceUsePaymentMethod(?int $storeId = null): ?string
381381
{
382382
return $this->getPath(static::GENERAL_SECOND_CHANCE_USE_PAYMENT_METHOD, $storeId);
383383
}
@@ -559,7 +559,7 @@ public function customPaymentLinkUrl($storeId = null): string
559559
* @param int|null $storeId
560560
* @return bool
561561
*/
562-
public function isMethodActive(string $method, int $storeId = null): bool
562+
public function isMethodActive(string $method, ?int $storeId = null): bool
563563
{
564564
return $this->isSetFlag($this->addMethodToPath(static::PAYMENT_METHOD_PAYMENT_ACTIVE, $method), $storeId);
565565
}
@@ -637,7 +637,7 @@ public function paymentlinkAllowMarkAsPaid($storeId = null)
637637
* @param int|null $storeId
638638
* @return string
639639
*/
640-
public function pointofsaleAllowedCustomerGroups(int $storeId = null)
640+
public function pointofsaleAllowedCustomerGroups(?int $storeId = null)
641641
{
642642
return (string)$this->getPath(static::PAYMENT_POINTOFSALE_ALLOWED_CUSTOMER_GROUPS, $storeId);
643643
}
@@ -782,7 +782,7 @@ public function isMultishippingEnabled(): bool
782782
return $this->moduleManager->isEnabled('Mollie_Multishipping');
783783
}
784784

785-
public function processTransactionsInTheQueue(int $storeId = null): bool
785+
public function processTransactionsInTheQueue(?int $storeId = null): bool
786786
{
787787
return $this->isSetFlag(static::GENERAL_PROCESS_TRANSACTION_IN_THE_QUEUE, $storeId);
788788
}
@@ -792,7 +792,7 @@ public function encryptPaymentDetails($storeId = null): bool
792792
return $this->isSetFlag(static::GENERAL_ENCRYPT_PAYMENT_DETAILS, $storeId);
793793
}
794794

795-
public function getApiMethod(string $method, int $storeId = null): string
795+
public function getApiMethod(string $method, ?int $storeId = null): string
796796
{
797797
return (string)$this->getPath(
798798
$this->addMethodToPath(static::PAYMENT_METHOD_API_METHOD, $method),

Controller/ApplePay/BuyNowValidation.php

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
use Magento\Quote\Api\GuestCartRepositoryInterface;
2525
use Magento\Store\Model\StoreManagerInterface;
2626
use Mollie\Payment\Config;
27-
use Mollie\Payment\Helper\General as MollieHelper;
28-
use Mollie\Payment\Model\Mollie;
27+
use Mollie\Payment\Service\Mollie\MollieApiClient;
2928

3029
class BuyNowValidation extends Action
3130
{
@@ -59,16 +58,6 @@ class BuyNowValidation extends Action
5958
*/
6059
private $productRepository;
6160

62-
/**
63-
* @var MollieHelper
64-
*/
65-
private $mollieHelper;
66-
67-
/**
68-
* @var Mollie
69-
*/
70-
private $mollie;
71-
7261
/**
7362
* @var UrlInterface
7463
*/
@@ -83,6 +72,10 @@ class BuyNowValidation extends Action
8372
* @var Config
8473
*/
8574
private $config;
75+
/**
76+
* @var MollieApiClient
77+
*/
78+
private $mollieApiClient;
8679

8780
public function __construct(
8881
Context $context,
@@ -97,8 +90,7 @@ public function __construct(
9790
CartRepositoryInterface $cartRepository,
9891
StoreManagerInterface $storeManager,
9992
ProductRepositoryInterface $productRepository,
100-
MollieHelper $mollieHelper,
101-
Mollie $mollie,
93+
MollieApiClient $mollieApiClient,
10294
UrlInterface $url
10395
) {
10496
parent::__construct($context, $customerSession, $customerRepository, $accountManagement);
@@ -111,9 +103,8 @@ public function __construct(
111103
$this->cartRepository = $cartRepository;
112104
$this->storeManager = $storeManager;
113105
$this->productRepository = $productRepository;
114-
$this->mollieHelper = $mollieHelper;
115-
$this->mollie = $mollie;
116106
$this->url = $url;
107+
$this->mollieApiClient = $mollieApiClient;
117108
}
118109

119110
/**
@@ -194,7 +185,7 @@ public function execute()
194185

195186
try {
196187
$store = $this->storeManager->getStore();
197-
$api = $this->mollie->loadMollieApi($this->mollieHelper->getApiKey($store->getId()));
188+
$api = $this->mollieApiClient->loadByApiKey($this->getLiveApiKey((int)$store->getId()));
198189
$url = $this->url->getBaseUrl();
199190

200191
$result = $api->wallets->requestApplePayPaymentSession(
@@ -220,4 +211,14 @@ public function execute()
220211

221212
return $response;
222213
}
214+
215+
private function getLiveApiKey(int $storeId): string
216+
{
217+
$liveApikey = $this->config->getLiveApiKey($storeId);
218+
if (!$liveApikey) {
219+
throw new \Exception(__('For Apple Pay the live API key is required, even when in test mode'));
220+
}
221+
222+
return $liveApikey;
223+
}
223224
}

Controller/Checkout/ApplePayValidation.php

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
2-
/**
2+
/*
33
* Copyright Magmodules.eu. All rights reserved.
4-
* * See COPYING.txt for license details.
4+
* See COPYING.txt for license details.
55
*/
66

77
namespace Mollie\Payment\Controller\Checkout;
@@ -11,16 +11,11 @@
1111
use Magento\Framework\Controller\ResultFactory;
1212
use Magento\Framework\UrlInterface;
1313
use Magento\Store\Model\StoreManagerInterface;
14-
use Mollie\Payment\Helper\General as MollieHelper;
14+
use Mollie\Payment\Config;
1515
use Mollie\Payment\Model\Mollie;
1616

1717
class ApplePayValidation extends Action
1818
{
19-
/**
20-
* @var MollieHelper
21-
*/
22-
private $mollieHelper;
23-
2419
/**
2520
* @var Mollie
2621
*/
@@ -35,26 +30,30 @@ class ApplePayValidation extends Action
3530
* @var UrlInterface
3631
*/
3732
private $url;
33+
/**
34+
* @var Config
35+
*/
36+
private $config;
3837

3938
public function __construct(
4039
Context $context,
41-
MollieHelper $mollieHelper,
4240
Mollie $mollie,
4341
StoreManagerInterface $storeManager,
44-
UrlInterface $url
42+
UrlInterface $url,
43+
Config $config
4544
) {
4645
parent::__construct($context);
4746

48-
$this->mollieHelper = $mollieHelper;
4947
$this->mollie = $mollie;
5048
$this->storeManager = $storeManager;
5149
$this->url = $url;
50+
$this->config = $config;
5251
}
5352

5453
public function execute()
5554
{
5655
$store = $this->storeManager->getStore();
57-
$api = $this->mollie->loadMollieApi($this->mollieHelper->getApiKey($store->getId()));
56+
$api = $this->mollie->loadMollieApi($this->getLiveApiKey((int)$store->getId()));
5857
$url = $this->url->getBaseUrl();
5958

6059
$result = $api->wallets->requestApplePayPaymentSession(
@@ -67,4 +66,14 @@ public function execute()
6766

6867
return $response;
6968
}
69+
70+
private function getLiveApiKey(int $storeId): string
71+
{
72+
$liveApikey = $this->config->getLiveApiKey($storeId);
73+
if (!$liveApikey) {
74+
throw new \Exception(__('For Apple Pay the live API key is required, even when in test mode'));
75+
}
76+
77+
return $liveApikey;
78+
}
7079
}

Controller/Checkout/Webhook.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private function getOkResponse()
129129
return $result;
130130
}
131131

132-
private function getErrorResponse(int $code, string $message = null): Json
132+
private function getErrorResponse(int $code, ?string $message = null): Json
133133
{
134134
$result = $this->resultFactory->create(ResultFactory::TYPE_JSON);
135135
$result->setData(['error' => true]);

GraphQL/Plugin/PlaceOrder/SetTheRedirectUrl.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public function beforeResolve(
2727
$field,
2828
$context,
2929
$info,
30-
array $value = null,
31-
array $args = null
30+
?array $value = null,
31+
?array $args = null
3232
) {
3333
if (isset($args['input']['mollie_return_url'])) {
3434
$this->transaction->setRedirectUrl($args['input']['mollie_return_url']);

GraphQL/Resolver/Cart/AvailableIssuersForCart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct(
2929
/**
3030
* @inheritDoc
3131
*/
32-
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
32+
public function resolve(Field $field, $context, ResolveInfo $info, ?array $value = null, ?array $args = null)
3333
{
3434
/** @var CartInterface $cart */
3535
$cart = $value['model'];

GraphQL/Resolver/Cart/AvailableIssuersForMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(
2727
/**
2828
* @inheritDoc
2929
*/
30-
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
30+
public function resolve(Field $field, $context, ResolveInfo $info, ?array $value = null, ?array $args = null)
3131
{
3232
$storeId = $context->getExtensionAttributes()->getStore()->getId();
3333
$method = $value['code'];

0 commit comments

Comments
 (0)