Skip to content

Commit 1b4b9b6

Browse files
author
Radosław Karkut
committed
Release 2.0.6
1 parent c48971e commit 1b4b9b6

File tree

9 files changed

+64
-12
lines changed

9 files changed

+64
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [2.0.6] - 2025-11-12
4+
### Fix
5+
- Fixed: Handle TimeZone during orders processing
6+
37
## [2.0.5] - 2025-10-07
48
### Fix
59
- Fixed: cart handling for disabled WebConnect

classes/WebserviceSpecificManagementGetresponseModule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ private function getPluginDetails()
192192

193193
return json_encode(
194194
[
195-
'plugin_version' => '2.0.5',
195+
'plugin_version' => '2.0.6',
196196
'prestashop_version' => _PS_VERSION_,
197197
'php_version' => phpversion(),
198198
'shops' => $shops,

config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<module>
33
<name>grprestashop</name>
44
<displayName><![CDATA[GetResponse]]></displayName>
5-
<version><![CDATA[2.0.5]]></version>
5+
<version><![CDATA[2.0.6]]></version>
66
<description><![CDATA[Add your Prestashop contacts to GetResponse.]]></description>
77
<author><![CDATA[GetResponse]]></author>
88
<tab><![CDATA[emailing]]></tab>

grprestashop.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct()
4242
{
4343
$this->name = 'grprestashop';
4444
$this->tab = 'emailing';
45-
$this->version = '2.0.5';
45+
$this->version = '2.0.6';
4646
$this->author = 'GetResponse';
4747
$this->need_instance = 0;
4848
$this->module_key = '311ef191c3135b237511d18c4bc27369';

src/Ecommerce/Application/Adapter/CartAdapter.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@
2424
use GetResponse\Ecommerce\DomainModel\Cart;
2525
use GetResponse\Ecommerce\DomainModel\Line;
2626
use GetResponse\SharedKernel\CartRecoveryHelper;
27+
use GetResponse\SharedKernel\DateTimeNormalizer;
2728

2829
if (!defined('_PS_VERSION_')) {
2930
exit;
3031
}
3132

3233
class CartAdapter
3334
{
35+
use DateTimeNormalizer;
36+
3437
/**
3538
* @param int $cartId
3639
* @param string|null $visitorUuid
@@ -77,8 +80,8 @@ public function getCartById(int $cartId, ?string $visitorUuid): Cart
7780
$prestashopCart->getOrderTotal(true),
7881
$currency->iso_code,
7982
$cartRecoveryUrl,
80-
$prestashopCart->date_add,
81-
$prestashopCart->date_upd
83+
$this->getDateWithTimeZone($prestashopCart->date_add),
84+
$this->getDateWithTimeZone($prestashopCart->date_upd)
8285
);
8386
}
8487
}

src/Ecommerce/Application/Adapter/OrderAdapter.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@
2424
use GetResponse\Ecommerce\DomainModel\Address;
2525
use GetResponse\Ecommerce\DomainModel\Line;
2626
use GetResponse\Ecommerce\DomainModel\Order;
27+
use GetResponse\SharedKernel\DateTimeNormalizer;
2728

2829
if (!defined('_PS_VERSION_')) {
2930
exit;
3031
}
3132

3233
class OrderAdapter
3334
{
35+
use DateTimeNormalizer;
36+
3437
public function getOrderById(int $orderId): Order
3538
{
3639
$customerAdapter = new CustomerAdapter();
@@ -101,8 +104,8 @@ public function getOrderById(int $orderId): Order
101104
$this->getOrderStatus($prestashopOrder),
102105
$shippingAddress,
103106
$billingAddress,
104-
$prestashopOrder->date_add,
105-
$prestashopOrder->date_upd
107+
$this->getDateWithTimeZone($prestashopOrder->date_add),
108+
$this->getDateWithTimeZone($prestashopOrder->date_upd)
106109
);
107110
}
108111

src/Ecommerce/Application/Adapter/ProductAdapter.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@
2323
use GetResponse\Ecommerce\DomainModel\Category;
2424
use GetResponse\Ecommerce\DomainModel\Product;
2525
use GetResponse\Ecommerce\DomainModel\Variant;
26+
use GetResponse\SharedKernel\DateTimeNormalizer;
2627

2728
if (!defined('_PS_VERSION_')) {
2829
exit;
2930
}
3031

3132
class ProductAdapter
3233
{
34+
use DateTimeNormalizer;
35+
3336
const PRODUCT_STATUS_PUBLISH = 'publish';
3437
const PRODUCT_STATUS_DRAFT = 'draft';
3538
const SKU_PREFIX = 'sku_';
@@ -125,8 +128,8 @@ public function getProductById(int $productId, int $languageId): Product
125128
$manufacture->name,
126129
$categories,
127130
$variants,
128-
$product->date_add,
129-
$product->date_upd,
131+
$this->getDateWithTimeZone($product->date_add),
132+
$this->getDateWithTimeZone($product->date_upd),
130133
$product->active === '1' ? self::PRODUCT_STATUS_PUBLISH : self::PRODUCT_STATUS_DRAFT
131134
);
132135
}

src/MessageSender/Infrastructure/HttpClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ private function sendRequest(string $url, \JsonSerializable $object, string $met
6363
$options = [
6464
CURLOPT_URL => $url,
6565
CURLOPT_ENCODING => 'gzip,deflate',
66-
CURLOPT_FRESH_CONNECT => 1,
67-
CURLOPT_RETURNTRANSFER => 1,
66+
CURLOPT_FRESH_CONNECT => true,
67+
CURLOPT_RETURNTRANSFER => true,
6868
CURLOPT_TIMEOUT => self::TIMEOUT,
6969
CURLOPT_HTTPHEADER => $headers,
7070
];
7171

7272
if ($method === self::POST) {
73-
$options[CURLOPT_POST] = 1;
73+
$options[CURLOPT_POST] = true;
7474
$options[CURLOPT_POSTFIELDS] = json_encode($object->jsonSerialize());
7575
}
7676

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* Copyright since 2007 PrestaShop SA and Contributors
4+
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
5+
*
6+
* NOTICE OF LICENSE
7+
*
8+
* This source file is subject to the Academic Free License version 3.0
9+
* that is bundled with this package in the file LICENSE.md.
10+
* It is also available through the world-wide-web at this URL:
11+
* https://opensource.org/licenses/AFL-3.0
12+
* If you did not receive a copy of the license and are unable to
13+
* obtain it through the world-wide-web, please send an email
14+
* to [email protected] so we can send you a copy immediately.
15+
*
16+
* @author PrestaShop SA and Contributors <[email protected]>
17+
* @copyright Since 2007 PrestaShop SA and Contributors
18+
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
19+
*/
20+
21+
namespace GetResponse\SharedKernel;
22+
23+
if (!defined('_PS_VERSION_')) {
24+
exit;
25+
}
26+
27+
trait DateTimeNormalizer
28+
{
29+
private function getDateWithTimeZone(string $date): string
30+
{
31+
try {
32+
$dateTimeZone = new \DateTimeZone(\Configuration::get('PS_TIMEZONE'));
33+
} catch (\Exception $e) {
34+
$dateTimeZone = new \DateTimeZone('UTC');
35+
}
36+
37+
return (new \DateTime($date, $dateTimeZone))->format('c');
38+
}
39+
}

0 commit comments

Comments
 (0)