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.39.0 #784

Merged
merged 24 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
48dc9dd
Improvement: Prevent multiple 'Registered notification about captured…
michielgerritsen May 21, 2024
0f7af4e
Feature: iDeal 2.0
michielgerritsen May 23, 2024
26be4e0
Improvement: Check if the order can be reordered when expired
michielgerritsen May 30, 2024
0376293
Bugfix: Redirect completed status to success page #781
michielgerritsen Jun 3, 2024
697ab5f
Bugfix: Prevent uncanceled orders to go to the complete status
michielgerritsen Jun 10, 2024
99a7fec
Improvement: Open version group by default #776
michielgerritsen Jun 10, 2024
fe0417e
Improvement: Add documentation button
michielgerritsen Jun 10, 2024
f2e10f7
Bugfix: Prevent 'The payment method is not active in your website pro…
michielgerritsen May 21, 2024
6d55dac
Improvement: CI versions bump
michielgerritsen Jun 6, 2024
34a7bc5
Merge branch 'improvement/open-version-by-default' into release-week-23
michielgerritsen Jun 12, 2024
c29b153
Merge branch 'bugfix/prevent-to-go-to-complete' into release-week-23
michielgerritsen Jun 12, 2024
f19d70f
Merge branch 'improvement/ci-versions-bump' into release-week-23
michielgerritsen Jun 12, 2024
7dd757a
Merge branch 'bugfix/redirect-completed-to-success-page' into release…
michielgerritsen Jun 12, 2024
bcb682d
Merge branch 'improvement/check-if-can-be-reordered' into release-wee…
michielgerritsen Jun 12, 2024
8dd3926
Merge branch 'improvement/prevent-multiple-captured-amount-notificati…
michielgerritsen Jun 12, 2024
a31e82c
Merge branch 'bugfix/this-method-is-not-active' into release-week-23
michielgerritsen Jun 12, 2024
eec7962
Merge branch 'feature/ideal-2.0' into release-week-23
michielgerritsen Jun 12, 2024
d2cd077
Fix GraphQL test
michielgerritsen Jun 12, 2024
cef76a9
Bugfix: Prevent previously canceled orders to go to the completed sta…
michielgerritsen Jun 12, 2024
4eb96cd
Rollback Magento version for e2e tests due to CPU issues
michielgerritsen Jun 13, 2024
6bb7a12
Revert lint against PHP 8.3 due to repo access limits
Marvin-Magmodules Jun 13, 2024
b3530ea
Do not select issuers in tests anymore
michielgerritsen Jun 14, 2024
a5a55f8
Merge branch 'pr/783' into release/2.39.0
Marvin-Magmodules Jun 17, 2024
bee0b12
Version bump
Marvin-Magmodules Jun 17, 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
5 changes: 4 additions & 1 deletion .github/workflows/end-2-end-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: End-2-end
on:
push:
tags:
- '*'
pull_request:
types:
- opened
Expand Down Expand Up @@ -49,7 +52,7 @@ jobs:
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.3.7-p4
- PHP_VERSION: php82-fpm
MAGENTO_VERSION: 2.4.6-p4
MAGENTO_VERSION: 2.4.6-p5
runs-on: ubuntu-latest
env:
PHP_VERSION: ${{ matrix.PHP_VERSION }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
MAGENTO_VERSION: 2.4.3-with-replacements
- PHP_VERSION: php81-fpm
MAGENTO_VERSION: 2.4.6-p4
- PHP_VERSION: php82-fpm
MAGENTO_VERSION: 2.4.6-p4
- PHP_VERSION: php83-fpm
MAGENTO_VERSION: 2.4.7
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
php-82:
runs-on: ubuntu-latest
steps:
- uses: prestashop/github-action-php-lint/8.2@v2.1
- uses: prestashop/github-action-php-lint/8.2@v2.1
4 changes: 2 additions & 2 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
MAGENTO_VERSION: 2.4.0
- PHP_VERSION: php81-fpm
MAGENTO_VERSION: 2.4.6-p4
- PHP_VERSION: php82-fpm
MAGENTO_VERSION: 2.4.6-p4
- PHP_VERSION: php83-fpm
MAGENTO_VERSION: 2.4.7

runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/setup-di-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
MAGENTO_VERSION: 2.4.3-with-replacements
- PHP_VERSION: php81-fpm
MAGENTO_VERSION: 2.4.6-p4
- PHP_VERSION: php82-fpm
MAGENTO_VERSION: 2.4.6-p4
- PHP_VERSION: php83-fpm
MAGENTO_VERSION: 2.4.7

runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
MAGENTO_VERSION: 2.4.3-with-replacements
- PHP_VERSION: php81-fpm
MAGENTO_VERSION: 2.4.6-p4
- PHP_VERSION: php82-fpm
MAGENTO_VERSION: 2.4.6-p4
- PHP_VERSION: php83-fpm
MAGENTO_VERSION: 2.4.7
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand Down
53 changes: 53 additions & 0 deletions Block/Adminhtml/System/Config/Button/Documentation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Mollie\Payment\Block\Adminhtml\System\Config\Button;

use Exception;
use Magento\Backend\Block\Template\Context;
use Magento\Backend\Block\Widget\Button;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Mollie\Payment\Config;

/**
* Version check button class
*/
class Documentation extends Field
{
/**
* @var string
*/
protected $_template = 'Mollie_Payment::system/config/button/documentation.phtml';

public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
return parent::render($element);
}

public function _getElementHtml(AbstractElement $element)
{
return $this->_toHtml();
}

/**
* @return mixed
*/
public function getButtonHtml()
{
$buttonData = ['id' => 'mm-mollie-button_version', 'label' => __('Check for latest versions')];
try {
$button = $this->getLayout()->createBlock(
Button::class
)->setData($buttonData);
return $button->toHtml();
} catch (Exception $e) {
return false;
}
}
}
2 changes: 1 addition & 1 deletion Controller/Checkout/Process.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/**
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/
Expand Down
36 changes: 3 additions & 33 deletions Helper/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Mollie\Payment\Logger\MollieLogger;
use Magento\SalesRule\Model\Coupon;
use Magento\SalesRule\Model\ResourceModel\Coupon\Usage as CouponUsage;
use Mollie\Payment\Service\Mollie\PaymentMethods;
use Mollie\Payment\Service\Order\CancelOrder;
use Mollie\Payment\Service\Order\MethodCode;
use Mollie\Payment\Service\Order\Transaction;
Expand Down Expand Up @@ -615,41 +616,10 @@ public function getBanktransferDueDate($storeId = 0)
*
* @return array
*/
public function getAllActiveMethods($storeId)
public function getAllActiveMethods($storeId): array
{
$activeMethods = [];
$methodCodes = [
'mollie_methods_applepay',
'mollie_methods_alma',
'mollie_methods_bancomatpay',
'mollie_methods_bancontact',
'mollie_methods_banktransfer',
'mollie_methods_belfius',
'mollie_methods_billie',
'mollie_methods_blik',
'mollie_methods_creditcard',
'mollie_methods_directdebit',
'mollie_methods_eps',
'mollie_methods_giftcard',
'mollie_methods_giropay',
'mollie_methods_ideal',
'mollie_methods_in3',
'mollie_methods_kbc',
'mollie_methods_klarna',
'mollie_methods_klarnapaylater',
'mollie_methods_klarnapaynow',
'mollie_methods_klarnasliceit',
'mollie_methods_voucher',
'mollie_methods_mybank',
'mollie_methods_paypal',
'mollie_methods_paysafecard',
'mollie_methods_pointofsale',
'mollie_methods_przelewy24',
'mollie_methods_sofort',
'mollie_methods_twint',
];

foreach ($methodCodes as $methodCode) {
foreach (PaymentMethods::METHODS as $methodCode) {
$activePath = 'payment/' . $methodCode . '/active';
$active = $this->getStoreConfig($activePath, $storeId);

Expand Down
6 changes: 3 additions & 3 deletions Model/Adminhtml/Source/MolliePaymentMethod.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/**
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/
Expand Down Expand Up @@ -30,7 +30,7 @@ public function toOptionArray()
return array_merge(
[['value' => '', 'label' => __('None')]],
[['value' => 'first_mollie_method', 'label' => __('First available Mollie method')]],
$this->methods->getCodeswithTitle()
$this->methods->getCodesWithTitle()
);
}
}
}
2 changes: 1 addition & 1 deletion Model/Client/Orders/Processors/SuccessfulPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private function handleWebhookCall(OrderInterface $order, MollieOrder $mollieOrd
$payment->setTransactionId($paymentId);
$payment->setCurrencyCode($order->getBaseCurrencyCode());

if ($mollieOrder->isPaid()) {
if ($order->getState() != \Magento\Sales\Model\Order::STATE_PROCESSING && $mollieOrder->isPaid()) {
$payment->setIsTransactionClosed(true);
$payment->registerCaptureNotification($order->getBaseGrandTotal(), true);
}
Expand Down
7 changes: 6 additions & 1 deletion Model/Client/Payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,13 @@ public function processResponse(OrderInterface $order, $payment)

$this->eventManager->dispatch('mollie_process_response', $eventData);
$this->eventManager->dispatch('mollie_process_response_payments_api', $eventData);

$this->mollieHelper->addTolog('response', $payment);

// The order is canceled before but now restarted, so uncancel the order.
if ($order->getState() == Order::STATE_CANCELED) {
$this->mollieHelper->uncancelOrder($order);
}

$order->getPayment()->setAdditionalInformation('checkout_url', $payment->getCheckoutUrl());
$order->getPayment()->setAdditionalInformation('checkout_type', self::CHECKOUT_TYPE);
$order->getPayment()->setAdditionalInformation('payment_status', $payment->status);
Expand Down
3 changes: 2 additions & 1 deletion Model/Mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,8 @@ public function getOrderIdsByTransactionId(string $transactionId): array
public function getIssuers(MollieApiClient $mollieApi = null, string $method, string $issuerListType, int $count = 0): ?array
{
$issuers = [];
if (empty($mollieApi) || $issuerListType == 'none') {
// iDeal 2.0 does not have issuers anymore.
if (empty($mollieApi) || $issuerListType == 'none' || $method == 'mollie_methods_ideal') {
return $issuers;
}

Expand Down
42 changes: 6 additions & 36 deletions Model/MollieConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Mollie\Payment\Service\Mollie\ApplePay\SupportedNetworks;
use Mollie\Payment\Service\Mollie\GetIssuers;
use Mollie\Payment\Service\Mollie\MethodParameters;
use Mollie\Payment\Service\Mollie\PaymentMethods;

/**
* Class MollieConfigProvider
Expand All @@ -29,39 +30,6 @@
*/
class MollieConfigProvider implements ConfigProviderInterface
{
/**
* @var array
*/
private $methodCodes = [
'mollie_methods_applepay',
'mollie_methods_alma',
'mollie_methods_bancomatpay',
'mollie_methods_bancontact',
'mollie_methods_banktransfer',
'mollie_methods_belfius',
'mollie_methods_billie',
'mollie_methods_blik',
'mollie_methods_creditcard',
'mollie_methods_directdebit',
'mollie_methods_eps',
'mollie_methods_giftcard',
'mollie_methods_giropay',
'mollie_methods_ideal',
'mollie_methods_in3',
'mollie_methods_kbc',
'mollie_methods_klarna',
'mollie_methods_klarnapaylater',
'mollie_methods_klarnapaynow',
'mollie_methods_klarnasliceit',
'mollie_methods_mybank',
'mollie_methods_paypal',
'mollie_methods_paysafecard',
'mollie_methods_pointofsale',
'mollie_methods_przelewy24',
'mollie_methods_sofort',
'mollie_methods_twint',
'mollie_methods_voucher',
];
/**
* @var array
*/
Expand Down Expand Up @@ -141,7 +109,7 @@ public function __construct(
$this->methodParameters = $methodParameters;
$this->supportedNetworks = $supportedNetworks;

foreach ($this->methodCodes as $code) {
foreach (PaymentMethods::METHODS as $code) {
$this->methods[$code] = $this->getMethodInstance($code);
}
}
Expand Down Expand Up @@ -193,11 +161,12 @@ public function getConfig(): array
$this->mollieHelper->addTolog('error', $exception->getMessage());
}

foreach ($this->methodCodes as $code) {
foreach (PaymentMethods::METHODS as $code) {
if (empty($this->methods[$code])) {
continue;
}

$isActive = array_key_exists($code, $activeMethods);
$isAvailable = $this->methods[$code]->isActive();

$config['payment']['image'][$code] = '';
Expand All @@ -208,8 +177,9 @@ public function getConfig(): array
}

if ($isAvailable &&
$isActive &&
$mollieApi &&
in_array($code, ['mollie_methods_ideal', 'mollie_methods_kbc', 'mollie_methods_giftcard'])
in_array($code, ['mollie_methods_kbc', 'mollie_methods_giftcard'])
) {
$config = $this->getIssuers($mollieApi, $code, $config);
}
Expand Down
12 changes: 6 additions & 6 deletions Service/Magento/PaymentLinkRedirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,19 @@ public function execute(string $orderId): PaymentLinkRedirectResult
throw new NotFoundException(__('Order not found'));
}

if ($this->isPaymentLinkExpired->execute($order)) {
if (in_array($order->getState(), [Order::STATE_PROCESSING, Order::STATE_COMPLETE])) {
return $this->paymentLinkRedirectResultFactory->create([
'redirectUrl' => null,
'isExpired' => true,
'alreadyPaid' => false,
'isExpired' => false,
'alreadyPaid' => true,
]);
}

if (in_array($order->getState(), [Order::STATE_PROCESSING, Order::STATE_COMPLETE])) {
if ($this->isPaymentLinkExpired->execute($order) || !$order->canReorder()) {
return $this->paymentLinkRedirectResultFactory->create([
'redirectUrl' => null,
'isExpired' => false,
'alreadyPaid' => true,
'isExpired' => true,
'alreadyPaid' => false,
]);
}

Expand Down
7 changes: 6 additions & 1 deletion Service/Mollie/GetMollieStatusResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public function shouldRedirectToSuccessPage(): bool
return true;
}

return in_array($status, ['pending', 'paid', 'authorized']);
return in_array($status, [
'pending',
'paid',
'authorized',
'completed', // Completed is mainly to support digital products
]);
}
}
23 changes: 10 additions & 13 deletions Service/Mollie/PaymentMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,7 @@ class PaymentMethods
*/
private $config;

public function __construct(
Config $config
) {
$this->config = $config;
}

/**
* @var array
*/
private $methods = [
public const METHODS = [
'mollie_methods_applepay',
'mollie_methods_alma',
'mollie_methods_bancomatpay',
Expand Down Expand Up @@ -55,12 +46,18 @@ public function __construct(
'mollie_methods_voucher',
];

public function getCodes()
public function __construct(
Config $config
) {
$this->config = $config;
}

public function getCodes(): array
{
return $this->methods;
return static::METHODS;
}

public function getCodeswithTitle()
public function getCodesWithTitle(): array
{
return array_map(function ($method) {
return [
Expand Down
Loading
Loading