Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/2.36.0 #763

Merged
merged 27 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e144658
Improvement: Bump CI versions
michielgerritsen Feb 22, 2024
18137cd
Handle null gift wrapping amount case
ImanuelBertrand Feb 26, 2024
69740a6
Specify the Payment Link Url Scope
Sental Mar 7, 2024
420c483
Bugfix: Create new transaction when the previous transaction is canceled
michielgerritsen Mar 7, 2024
f43b305
Improvement: Bump required mollie/mollie-api-php version
michielgerritsen Mar 11, 2024
d4f7b70
Bugfix: Only create invoice once
michielgerritsen Mar 11, 2024
306a4c6
Feature: Option to set a custom template for payment link orders
michielgerritsen Mar 4, 2024
7346d27
Bugfix: Redirect open banktransfer payments to the success page
michielgerritsen Mar 14, 2024
8a9532d
Bugfix: Update scandi paths mollie/magento2-scandipwa#23
michielgerritsen Mar 18, 2024
946dcfa
Feature: Added Blik
michielgerritsen Mar 18, 2024
2c74bb9
Merge branch 'pr-759' into release-week-11
michielgerritsen Mar 19, 2024
0769f82
Merge branch 'pr-751' into release-week-11
michielgerritsen Mar 19, 2024
7921c60
Merge branch 'improvement/bump-ci-versions' into release-week-11
michielgerritsen Mar 19, 2024
052e3ff
Merge branch 'feature/custom-template-option-for-payment-link' into r…
michielgerritsen Mar 19, 2024
3cd11a9
Merge branch 'bugfix/paymentlink-canceled-orders' into release-week-11
michielgerritsen Mar 19, 2024
e5426d8
Merge branch 'bugfix/only-create-invoice-once' into release-week-11
michielgerritsen Mar 19, 2024
2ac7c79
Merge branch 'improvement/bump-mollie-api-php-version' into release-w…
michielgerritsen Mar 19, 2024
43eb707
Merge branch 'bugfix/redirect-banktransfer-open-to-success' into rele…
michielgerritsen Mar 19, 2024
1957c83
Merge branch 'bugfix/update-scandi-paths' into release-week-11
michielgerritsen Mar 19, 2024
2666183
Updated the check to reflect both payments and orders api responses
michielgerritsen Mar 21, 2024
be4a976
Merge branch 'bugfix/redirect-banktransfer-open-to-success' into rele…
michielgerritsen Mar 21, 2024
c68e9ed
Merge branch 'feature/added-blik' into release-week-11
michielgerritsen Mar 21, 2024
21cb2e1
Revert "Merge branch 'feature/custom-template-option-for-payment-link…
michielgerritsen Mar 25, 2024
950549b
Bugfix: Remove time from ExpiresAt value as it's not allowed
michielgerritsen Mar 25, 2024
765ef91
Bugfix: Force scope ID to be an int
michielgerritsen Mar 25, 2024
e45250c
Add option to switch method for BLIK
michielgerritsen Mar 25, 2024
ec7be4c
Version bump
Marvin-Magmodules Mar 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/end-2-end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ jobs:
matrix:
include:
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.3.7-p3
- PHP_VERSION: php81-fpm
MAGENTO_VERSION: 2.4.6
MAGENTO_VERSION: 2.3.7-p4
- PHP_VERSION: php82-fpm
MAGENTO_VERSION: 2.4.6-p4
runs-on: ubuntu-latest
env:
PHP_VERSION: ${{ matrix.PHP_VERSION }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ jobs:
matrix:
include:
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.3.7-p3
MAGENTO_VERSION: 2.3.7-p4
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.0
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.3-with-replacements
- PHP_VERSION: php81-fpm
MAGENTO_VERSION: 2.4.6
MAGENTO_VERSION: 2.4.6-p4
- PHP_VERSION: php82-fpm
MAGENTO_VERSION: 2.4.6
MAGENTO_VERSION: 2.4.6-p4
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ jobs:
matrix:
include:
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.3.7-p3
MAGENTO_VERSION: 2.3.7-p4
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.0
- PHP_VERSION: php81-fpm
MAGENTO_VERSION: 2.4.6
MAGENTO_VERSION: 2.4.6-p4
- PHP_VERSION: php82-fpm
MAGENTO_VERSION: 2.4.6
MAGENTO_VERSION: 2.4.6-p4

runs-on: ubuntu-latest
steps:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/setup-di-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ jobs:
matrix:
include:
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.3.7-p3
MAGENTO_VERSION: 2.3.7-p4
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.0
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.3-with-replacements
- PHP_VERSION: php81-fpm
MAGENTO_VERSION: 2.4.6
MAGENTO_VERSION: 2.4.6-p4
- PHP_VERSION: php82-fpm
MAGENTO_VERSION: 2.4.6
MAGENTO_VERSION: 2.4.6-p4

runs-on: ubuntu-latest
steps:
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/templates/magento/configure-mollie.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ bin/magento config:set payment/mollie_general/type test &
# Enable all payment methods
bin/magento config:set payment/mollie_methods_applepay/active 1 &
bin/magento config:set payment/mollie_methods_banktransfer/active 1 &
bin/magento config:set payment/mollie_methods_billie/active 1 &
bin/magento config:set payment/mollie_methods_blik/active 1 &
bin/magento config:set payment/mollie_methods_creditcard/active 1 &
bin/magento config:set payment/mollie_methods_giftcard/active 1 &
bin/magento config:set payment/mollie_methods_ideal/active 1 &
Expand All @@ -24,7 +26,6 @@ bin/magento config:set payment/mollie_methods_belfius/active 1 &
bin/magento config:set payment/mollie_methods_eps/active 1 &
bin/magento config:set payment/mollie_methods_giropay/active 1 &
bin/magento config:set payment/mollie_methods_klarnapaylater/active 1 &
bin/magento config:set payment/mollie_methods_billie/active 1 &
bin/magento config:set payment/mollie_methods_paymentlink/active 1 &
bin/magento config:set payment/mollie_methods_paysafecard/active 1 &
bin/magento config:set payment/mollie_methods_pointofsale/active 1 &
Expand All @@ -40,10 +41,16 @@ bin/magento config:set payment/mollie_methods_ideal/add_qr 1 &
bin/magento config:set payment/mollie_general/use_webhooks disabled &

# Configure currency for the swiss store view
bin/magento config:set currency/options/allow EUR,CHF &
bin/magento config:set currency/options/allow EUR,CHF,PLN &

# Swiss scope
bin/magento config:set currency/options/default CHF --scope=ch &
bin/magento config:set payment/mollie_general/currency 0 --scope=ch &

# Polish scope
bin/magento config:set currency/options/default PLN --scope=pl &
bin/magento config:set payment/mollie_general/currency 0 --scope=pl &

wait

if grep -q Magento_TwoFactorAuth "app/etc/config.php"; then
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/templates/magento/merge-config.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,16 @@ $magentoConfig['scopes'] = [
'website_id' => '1',
'group_id' => '1',
'name' => 'Swiss',
'sort_order' => '0',
'sort_order' => '1',
'is_active' => '1'
],
'pl' => [
'store_id' => '3',
'code' => 'pl',
'website_id' => '1',
'group_id' => '1',
'name' => 'Poland',
'sort_order' => '2',
'is_active' => '1'
]
]
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ jobs:
matrix:
include:
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.3.7-p3
MAGENTO_VERSION: 2.3.7-p4
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.0
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.3-with-replacements
- PHP_VERSION: php81-fpm
MAGENTO_VERSION: 2.4.6
MAGENTO_VERSION: 2.4.6-p4
- PHP_VERSION: php82-fpm
MAGENTO_VERSION: 2.4.6
MAGENTO_VERSION: 2.4.6-p4
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand Down
5 changes: 5 additions & 0 deletions Api/Data/PaymentLinkRedirectResultInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ public function isAlreadyPaid(): bool;
* @return string|null
*/
public function getRedirectUrl(): ?string;

/**
* @return bool
*/
public function isExpired(): bool;
}
11 changes: 11 additions & 0 deletions Api/Data/TransactionToProcessInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,15 @@ public function setOrderId(int $id): TransactionToProcessInterface;
* @return int|null
*/
public function getOrderId(): ?int;

/**
* @param string $type
* @return \Mollie\Payment\Api\Data\TransactionToProcessInterface
*/
public function setType(string $type): TransactionToProcessInterface;

/**
* @return string|null
*/
public function getType(): ?string;
}
6 changes: 6 additions & 0 deletions Controller/Checkout/PaymentLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ public function execute()
return $this->returnStatusCode(404);
}

if ($result->isExpired()) {
$this->messageManager->addErrorMessage(__('Your payment link has expired.'));

return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setUrl('/');
}

if ($result->isAlreadyPaid()) {
$this->messageManager->addSuccessMessage(__('Your order has already been paid.'));

Expand Down
4 changes: 2 additions & 2 deletions Controller/Checkout/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ public function execute()
$result = null;
foreach ($orderIds as $orderId => $paymentToken) {
$order = $this->orderRepository->get($orderId);
$result = $this->processTransaction->execute($orderId, $order->getMollieTransactionId());
$result = $this->processTransaction->execute($orderId, $order->getMollieTransactionId(), 'success');
}
} catch (\Exception $e) {
$this->mollieHelper->addTolog('error', $e->getMessage());
$this->messageManager->addExceptionMessage($e, __('There was an error checking the transaction status.'));
return $this->_redirect($this->redirectOnError->getUrl());
}

if ($result !== null && in_array($result->getStatus(), ['paid', 'authorized'])) {
if ($result !== null && $result->shouldRedirectToSuccessPage()) {
try {
$this->successPageRedirect->execute($order, $orderIds);
return $this->getResponse();
Expand Down
1 change: 1 addition & 0 deletions GraphQL/Resolver/Checkout/PaymentLinkRedirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
return [
'already_paid' => $result->isAlreadyPaid(),
'redirect_url' => $result->getRedirectUrl(),
'is_expired' => $result->isExpired(),
];
}
}
2 changes: 1 addition & 1 deletion GraphQL/Resolver/Checkout/ProcessTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value

$order = $this->orderRepository->get($tokenModel->getOrderId());
$result = $this->processTransaction->execute($tokenModel->getOrderId(), $order->getMollieTransactionId());
$redirectToSuccessPage = in_array($result->getStatus(), ['pending', 'paid', 'authorized']);
$redirectToSuccessPage = $result->shouldRedirectToSuccessPage();

$cart = null;
if ($tokenModel->getCartId()) {
Expand Down
1 change: 1 addition & 0 deletions Helper/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ public function getAllActiveMethods($storeId)
'mollie_methods_banktransfer',
'mollie_methods_belfius',
'mollie_methods_billie',
'mollie_methods_blik',
'mollie_methods_creditcard',
'mollie_methods_directdebit',
'mollie_methods_eps',
Expand Down
2 changes: 1 addition & 1 deletion Model/Adminhtml/Backend/ChangeApiMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function afterSave()
{
$apiKey = $this->getApiKey($this->getValue());
if ($apiKey) {
$this->updateProfileId->execute($apiKey, $this->getScope(), $this->getScopeId());
$this->updateProfileId->execute($apiKey, $this->getScope(), (int)$this->getScopeId());
}

return parent::afterSave();
Expand Down
15 changes: 13 additions & 2 deletions Model/Client/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ public function startTransaction(OrderInterface $order, $mollieApi)

$transactionId = $order->getMollieTransactionId();
if (!empty($transactionId)) {
$mollieOrder = $mollieApi->orders->get($transactionId);
return $mollieOrder->getCheckoutUrl();
return $this->getCheckoutUrl($mollieApi, $order);
}

$paymentToken = $this->paymentTokenForOrder->execute($order);
Expand Down Expand Up @@ -900,4 +899,16 @@ private function getCaptureAmount(OrderInterface $order, InvoiceInterface $invoi

return $order->getBaseGrandTotal();
}

private function getCheckoutUrl(MollieApiClient $mollieApi, OrderInterface $order): string
{
$mollieOrder = $mollieApi->orders->get($order->getMollieTransactionId());
if ($checkoutUrl = $mollieOrder->getCheckoutUrl()) {
return $checkoutUrl;
}

// There is no checkout URL, the transaction is either canceled or expired. Create a new transaction.
$order->setMollieTransactionId(null);
return $this->startTransaction($order, $mollieApi);
}
}
3 changes: 2 additions & 1 deletion Model/Client/Orders/Processors/SuccessfulPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ private function handleWebhookCall(OrderInterface $order, MollieOrder $mollieOrd
}

if ($mollieOrder->isAuthorized() &&
$this->mollieHelper->getInvoiceMoment($order->getStoreId()) == InvoiceMoment::ON_AUTHORIZE
$this->mollieHelper->getInvoiceMoment($order->getStoreId()) == InvoiceMoment::ON_AUTHORIZE &&
$order->getInvoiceCollection()->count() === 0
) {
$payment->setIsTransactionClosed(false);
$payment->registerAuthorizationNotification($order->getBaseGrandTotal(), true);
Expand Down
24 changes: 24 additions & 0 deletions Model/Methods/Blik.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Model\Mollie;

/**
* Class Blik
*
* @package Mollie\Payment\Model\Methods
*/
class Blik extends Mollie
{
/**
* Payment method code
*
* @var string
*/
const CODE = 'mollie_methods_blik';
}
1 change: 1 addition & 0 deletions Model/MollieConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class MollieConfigProvider implements ConfigProviderInterface
'mollie_methods_banktransfer',
'mollie_methods_belfius',
'mollie_methods_billie',
'mollie_methods_blik',
'mollie_methods_creditcard',
'mollie_methods_directdebit',
'mollie_methods_eps',
Expand Down
17 changes: 17 additions & 0 deletions Model/Queue/TransactionToProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ class TransactionToProcess implements TransactionToProcessInterface
*/
private $orderId = null;

/**
* @var null | string
*/
private $type = null;

public function setTransactionId(string $id): TransactionToProcessInterface
{
$this->transactionId = $id;
Expand All @@ -45,4 +50,16 @@ public function getOrderId(): ?int
{
return $this->orderId;
}

public function setType(string $type): TransactionToProcessInterface
{
$this->type = $type;

return $this;
}

public function getType(): ?string
{
return $this->type;
}
}
2 changes: 1 addition & 1 deletion Queue/Handler/TransactionProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function execute(TransactionToProcessInterface $data): void
$order = $this->orderRepository->get($data->getOrderId());
$order->setMollieTransactionId($data->getTransactionId());

$this->mollieModel->processTransactionForOrder($order, 'webhook');
$this->mollieModel->processTransactionForOrder($order, $data->getType());
} catch (\Throwable $throwable) {
$this->config->addToLog('error', [
'from' => 'TransactionProcessor consumer',
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Mollie requires no minimum costs, no fixed contracts, no hidden costs. At Mollie
- Bank transfer
- Belfius Pay Button
- Billie
- Blik
- Credit card (VISA, MasterCard, Maestro and American Express)
- EPS
- Gift cards (Webshop Giftcard, Podium Cadeaukaart, VVV Cadeaukaart, YourGift etc.)
Expand Down
Loading
Loading