diff --git a/CHANGELOG.md b/CHANGELOG.md index fb86d54..623d31d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,19 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## Unreleased + +## 2.5.7 - 2021-04-09 + +### Fixed +- Fixed an issue where order dates weren’t being sent to Vend with time zones. The format now conforms to RFC3339. + + ## 2.5.6 - 2021-03-11 ### Fixed - Fixed an issue where order level discounts weren’t showing the tax inside them + ## 2.5.5 - 2021-01-05 ### Fixed diff --git a/src/services/Orders.php b/src/services/Orders.php index cecd17a..1e8a19f 100644 --- a/src/services/Orders.php +++ b/src/services/Orders.php @@ -19,6 +19,7 @@ use craft\commerce\models\LineItem; use craft\commerce\Plugin as CommercePlugin; use craft\helpers\Json; +use DateTimeInterface; use Exception; use Throwable; use yii\base\InvalidConfigException; @@ -203,12 +204,12 @@ public function registerSale(int $orderId) { 'customer_id' => $vendCustomerId, 'user_id' => $settings->vend_userId, 'status' => 'CLOSED', - 'sale_date' => $order->dateOrdered->format('Y-m-d H:i:s'), + 'sale_date' => $order->dateOrdered->format(DateTimeInterface::RFC3339), 'register_sale_products' => [], 'register_sale_payments' => [ [ 'retailer_payment_type_id' => $settings->vend_retailerPaymentTypeId, - 'payment_date' => $order->dateOrdered->format('Y-m-d H:i:s'), + 'payment_date' => $order->dateOrdered->format(DateTimeInterface::RFC3339), 'amount' => $order->getTotalPaid() ] ]