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 6.2.6 #1030

Merged
merged 31 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
de2fd29
Merge pull request #1023 from mollie/develop
MarijusCoding Jan 15, 2025
c79068a
[INTERNAL] init
MarijusCoding Jan 15, 2025
6c8234d
Merge pull request #1028 from mollie/INTERNAL/changelog
MarijusCoding Jan 15, 2025
1149d65
Merge pull request #1029 from mollie/develop
MarijusCoding Jan 15, 2025
87068d9
[INTERNAL] fix
MarijusCoding Jan 16, 2025
19a6bb0
Merge pull request #1031 from mollie/INTERNAL/htaccess-zip
MarijusCoding Jan 16, 2025
1599785
Merge branch 'master' of github.com:mollie/PrestaShop into release-6.2.6
MarijusCoding Jan 16, 2025
0ad9a7a
[PIPRES-527] added security token and encrypting it to use in webhook…
MarijusCoding Jan 20, 2025
c649186
[PIPRES-527] add on every webhook argument with security token encrypted
MarijusCoding Jan 21, 2025
5a6cf56
[PIPRES-527] cs fixer
MarijusCoding Jan 21, 2025
cbf3b70
[PIPRES-527] fix
MarijusCoding Jan 21, 2025
0ee23d2
[PIPRES-527] fix
MarijusCoding Jan 21, 2025
4c1e9c9
[PIPRES-527] fix
MarijusCoding Jan 21, 2025
2b27055
[PIPRES-527] hash
MarijusCoding Jan 21, 2025
592dfa6
[PIPRES-527] fix
MarijusCoding Jan 21, 2025
51d4daa
[PIPRES-527] whitespace
MarijusCoding Jan 21, 2025
3a4f433
[PIPRES-527] fix
MarijusCoding Jan 21, 2025
6737eef
[PIPRES-527] refactor
MarijusCoding Jan 21, 2025
a287f97
[PIPRES-527] delete method
MarijusCoding Jan 21, 2025
1d33495
[PIPRES-527] fix
MarijusCoding Jan 22, 2025
3aebfd6
[PIPRES-527] cslint
MarijusCoding Jan 22, 2025
d243b12
Merge pull request #1033 from mollie/PIPRES-527/klarna-double-orders
MarijusCoding Jan 22, 2025
ed4af20
[INTERNAL] init
MarijusCoding Jan 24, 2025
35dd178
[INTERNAL] init fix
MarijusCoding Jan 24, 2025
0476408
[INTERNAL] fix
MarijusCoding Jan 24, 2025
6155820
Update src/Service/MollieOrderCreationService.php
MarijusCoding Jan 24, 2025
8ea08ba
[INTERNAL] fix
MarijusCoding Jan 24, 2025
1f759fd
Merge pull request #1036 from mollie/INTERNAL/exception-onscreen
MarijusCoding Jan 24, 2025
eb31dd3
Merge pull request #1034 from mollie/INTERNAL/changelog-6.2.6
MarijusCoding Jan 24, 2025
3e0ca1c
[INTERNAL] init
MarijusCoding Jan 27, 2025
286457f
Merge pull request #1037 from mollie/INTERNAL/undefined-index
MarijusCoding Jan 29, 2025
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
10 changes: 10 additions & 0 deletions .github/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>

# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

# Changelog #

## Changes in release 6.2.6 ##
+ Improved checkout process
+ Fixed duplicate order status issue

## Changes in release 6.2.5 ##
+ Fixed issue with order status on multishop
+ Phone number validation improvements
Expand Down
5 changes: 3 additions & 2 deletions controllers/front/return.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ public function initContent()
$this->setWarning($data['msg_details']);

Tools::redirect(Context::getContext()->link->getPageLink('cart', true));
} elseif (PaymentMethod::BANKTRANSFER === $data['mollie_info']['method']
} elseif (isset($data['mollie_info']['method'])
&& PaymentMethod::BANKTRANSFER === $data['mollie_info']['method']
&& PaymentStatus::STATUS_OPEN === $data['mollie_info']['bank_status']
) {
$data['msg_details'] = $this->module->l('The payment is still being processed. You\'ll be notified when the bank or merchant confirms the payment./merchant.', self::FILE_NAME);
Expand All @@ -141,7 +142,7 @@ public function initContent()
[
'ajax' => 1,
'action' => 'getStatus',
'transaction_id' => $data['mollie_info']['transaction_id'],
'transaction_id' => $data['mollie_info']['transaction_id'] ?? null,
'key' => $key,
'cart_id' => $idCart,
'order_number' => $orderNumber,
Expand Down
11 changes: 10 additions & 1 deletion controllers/front/webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ public function initContent(): void
));
}

if (!$tools->getValue('security_token')) {
$logger->debug(sprintf('Missing security token in %s', self::FILE_NAME));

$this->ajaxResponse(JsonResponse::error(
$this->module->l('Missing security token', self::FILE_NAME),
HttpStatusCode::HTTP_BAD_REQUEST
));
}

$transactionId = (string) $tools->getValue('id');

if (!$transactionId) {
Expand All @@ -81,7 +90,7 @@ public function initContent(): void
$lockResult = $this->applyLock(sprintf(
'%s-%s',
self::FILE_NAME,
$transactionId
$tools->getValue('security_token')
));

if (!$lockResult->isSuccessful()) {
Expand Down
2 changes: 1 addition & 1 deletion mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function __construct()
{
$this->name = 'mollie';
$this->tab = 'payments_gateways';
$this->version = '6.2.5';
$this->version = '6.2.6';
$this->author = 'Mollie B.V.';
$this->need_instance = 1;
$this->bootstrap = true;
Expand Down
7 changes: 2 additions & 5 deletions src/Service/MollieOrderCreationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Mollie\Config\Config;
use Mollie\DTO\OrderData;
use Mollie\DTO\PaymentData;
use Mollie\Errors\Http\HttpStatusCode;
use Mollie\Exception\OrderCreationException;
use Mollie\Handler\ErrorHandler\ErrorHandler;
use Mollie\Handler\Exception\OrderExceptionHandler;
Expand Down Expand Up @@ -66,11 +65,9 @@ public function createMollieOrder($data, MolPaymentMethod $paymentMethodObj)
try {
$apiPayment = $this->createPayment($data, $paymentMethodObj->method);
} catch (OrderCreationException $e) {
$errorHandler = ErrorHandler::getInstance();
$errorHandler->handle($e, HttpStatusCode::HTTP_BAD_REQUEST, true);
throw $e;
} catch (Exception $e) {
$errorHandler = ErrorHandler::getInstance();
$errorHandler->handle($e, HttpStatusCode::HTTP_INTERNAL_SERVER_ERROR, true);
throw $e;
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/Service/MolliePaymentMailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Mollie\Api\Resources\Payment;
use Mollie\Api\Types\PaymentStatus;
use Mollie\Repository\PaymentMethodRepository;
use Mollie\Utility\HashUtility;
use Mollie\Utility\SecureKeyUtility;
use Mollie\Utility\TransactionUtility;
use Order;
Expand Down Expand Up @@ -185,7 +186,9 @@ public function sendSecondChanceMailWithPaymentApi(MollieApiClient $api, $transa
$paymentData['webhookUrl'] = $context->link->getModuleLink(
'mollie',
'webhook',
[],
[
'security_token' => HashUtility::hash($cart->secure_key),
],
true,
null,
$cart->id_shop
Expand Down
6 changes: 6 additions & 0 deletions src/Service/OrderStatusService.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ public function setOrderStatus($orderId, $statusId, $useExistingPayment = null,
if (0 === (int) $statusId) {
return;
}

$order = new Order((int) $orderId);
$orderHistory = $order->getHistory($order->id_lang, $statusId);

if (!empty($orderHistory)) {
return;
}

if (!Validate::isLoadedObject($order)) {
return;
Expand Down
9 changes: 7 additions & 2 deletions src/Service/PaymentMethodService.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
use Mollie\Subscription\Validator\SubscriptionOrderValidator;
use Mollie\Utility\CustomLogoUtility;
use Mollie\Utility\EnvironmentUtility;
use Mollie\Utility\HashUtility;
use Mollie\Utility\LocaleUtility;
use Mollie\Utility\SecureKeyUtility;
use Mollie\Utility\TextFormatUtility;
Expand Down Expand Up @@ -316,7 +317,9 @@ public function getPaymentData(
$webhookUrl = $this->context->getModuleLink(
'mollie',
'webhook',
[],
[
'security_token' => HashUtility::hash($cart->secure_key),
],
true
);

Expand Down Expand Up @@ -451,7 +454,9 @@ public function getPaymentData(
$payment->setWebhookUrl($this->context->getModuleLink(
'mollie',
'webhook',
[],
[
'security_token' => HashUtility::hash($cart->secure_key),
],
true
));

Expand Down
10 changes: 5 additions & 5 deletions src/Service/TransactionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function processTransaction($apiPayment)
}

/** @var int $orderId */
$orderId = Order::getOrderByCartId((int) $apiPayment->metadata->cart_id);
$orderId = Order::getIdByCartId((int) $apiPayment->metadata->cart_id);

$cart = new Cart($apiPayment->metadata->cart_id);

Expand Down Expand Up @@ -213,7 +213,7 @@ public function processTransaction($apiPayment)
$this->orderStatusService->setOrderStatus($orderId, $apiPayment->status);
}

$orderId = Order::getOrderByCartId((int) $apiPayment->metadata->cart_id);
$orderId = Order::getIdByCartId((int) $apiPayment->metadata->cart_id);
}
break;
case Config::MOLLIE_API_STATUS_ORDER:
Expand Down Expand Up @@ -295,7 +295,7 @@ public function processTransaction($apiPayment)
}
}

$orderId = Order::getOrderByCartId((int) $apiPayment->metadata->cart_id);
$orderId = Order::getIdByCartId((int) $apiPayment->metadata->cart_id);
}

if (!$orderId) {
Expand Down Expand Up @@ -507,7 +507,7 @@ private function handlePaymentDescription(Payment $apiPayment)
{
$paymentMethod = $this->paymentMethodRepository->getPaymentBy('order_reference', $apiPayment->description);
if ($paymentMethod) {
$orderId = Order::getOrderByCartId($paymentMethod['cart_id']);
$orderId = Order::getIdByCartId($paymentMethod['cart_id']);
if (!$orderId) {
return;
}
Expand All @@ -523,7 +523,7 @@ private function handleOrderDescription(MollieOrderAlias $apiPayment)
{
$paymentMethod = $this->paymentMethodRepository->getPaymentBy('order_reference', $apiPayment->orderNumber);
if ($paymentMethod) {
$orderId = Order::getOrderByCartId($paymentMethod['cart_id']);
$orderId = Order::getIdByCartId($paymentMethod['cart_id']);
if (!$orderId) {
return;
}
Expand Down
Loading