diff --git a/CHANGELOG.md b/CHANGELOG.md index 27aeb17..8cfc42f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ +## v.2.2.4 +* Добавлена установка дефолтной валюты для оплаты при получении истории +* Добавлено получение суммы оплаты из заказа в CMS, если она не передается по истории + ## v.2.2.3 -* Добавлена исключение при обработка исключений при обновлении пользователя +* добавлена обработка исключений при обновлении пользователя на стороне CMS ## v.2.2.2 * Добавлена передача комментария клиента при создании заказа diff --git a/VERSION b/VERSION index 6b4d157..0476155 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.3 \ No newline at end of file +2.2.4 \ No newline at end of file diff --git a/retailcrm/lib/RetailcrmHistory.php b/retailcrm/lib/RetailcrmHistory.php index 6c4d14e..2f574db 100644 --- a/retailcrm/lib/RetailcrmHistory.php +++ b/retailcrm/lib/RetailcrmHistory.php @@ -446,6 +446,7 @@ class RetailcrmHistory $orderPayment = new OrderPayment(); $orderPayment->payment_method = $payType; $orderPayment->order_reference = $newOrder->reference; + $orderPayment->id_currency = $default_currency; $orderPayment->amount = $payment['amount']; $orderPayment->date_add = $payment['paidAt']; $orderPayment->save(); @@ -501,11 +502,13 @@ class RetailcrmHistory if ($dtype != null) { $orderCarrier->id_carrier = $deliveries[$dtype]; } + if ($dcost != null) { $orderCarrier->shipping_cost_tax_incl = $dcost; $orderCarrier->shipping_cost_tax_excl = $dcost; } + $orderCarrier->id_order = $orderToUpdate->id; $orderCarrier->update(); } } @@ -540,12 +543,20 @@ class RetailcrmHistory $payType = $pay['name']; } } + $paymentType = Module::getModuleName($payments[$ptype]); $orderToUpdate->payment = $paymentType != null ? $paymentType : $payments[$ptype]; $orderPayment = new OrderPayment(); $orderPayment->payment_method = $payType; $orderPayment->order_reference = $orderToUpdate->reference; - $orderPayment->amount = $payment['amount']; + + if (isset($payment['amount'])){ + $orderPayment->amount = $payment['amount']; + } else { + $orderPayment->amount = $orderToUpdate->total_paid; + } + + $orderPayment->id_currency = $default_currency; $orderPayment->date_add = $payment['paidAt']; $orderPayment->save(); } diff --git a/retailcrm/retailcrm.php b/retailcrm/retailcrm.php index e9c6c5e..3779cdf 100644 --- a/retailcrm/retailcrm.php +++ b/retailcrm/retailcrm.php @@ -3,7 +3,7 @@ * @author Retail Driver LCC * @copyright RetailCRM * @license GPL - * @version 2.2.3 + * @version 2.2.4 * @link https://retailcrm.ru * */ @@ -38,7 +38,7 @@ class RetailCRM extends Module { $this->name = 'retailcrm'; $this->tab = 'export'; - $this->version = '2.2.2'; + $this->version = '2.2.4'; $this->author = 'Retail Driver LCC'; $this->displayName = $this->l('RetailCRM'); $this->description = $this->l('Integration module for RetailCRM');