From 1f7d3679fd206fad8b99bb76afe3a94757b1efba Mon Sep 17 00:00:00 2001 From: Ruslan Efanov Date: Thu, 15 Jul 2021 14:41:16 +0300 Subject: [PATCH] fix code review --- .../system/library/retailcrm/lib/service/OrderManager.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/upload/system/library/retailcrm/lib/service/OrderManager.php b/src/upload/system/library/retailcrm/lib/service/OrderManager.php index 54a4647..64ad1a5 100644 --- a/src/upload/system/library/retailcrm/lib/service/OrderManager.php +++ b/src/upload/system/library/retailcrm/lib/service/OrderManager.php @@ -39,8 +39,7 @@ class OrderManager { public function createOrder($order_data, $order_products, $order_totals) { $order = $this->prepareOrder($order_data, $order_products, $order_totals); - if ( - !isset($order['customer']) + if (!isset($order['customer']) || (isset($order['customer']['externalId']) && !$this->checkExistCustomer($order['customer']['externalId'])) ) { @@ -177,8 +176,7 @@ class OrderManager { * * @return bool */ - private function checkExistCustomer($customerExternalId) - { + private function checkExistCustomer($customerExternalId) { $result = $this->api->customersGet($customerExternalId); return $result && $result->isSuccessful() && $result->offsetExists('customer');