From a9fefc4fb8766faf9de233dc22fdece066300499 Mon Sep 17 00:00:00 2001 From: Ivan Chaplygin Date: Wed, 12 Jul 2023 14:01:47 +0300 Subject: [PATCH] =?UTF-8?q?ref=20#91040=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B0=D1=87=D0=B0=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82?= =?UTF-8?q?=D1=80=D0=B0=20subscribed=20=D0=BF=D0=BE=20=D0=B0=D0=BF=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/apiclient/traits/customerstrait.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/intaro.retailcrm/lib/component/apiclient/traits/customerstrait.php b/intaro.retailcrm/lib/component/apiclient/traits/customerstrait.php index fb4e6b78..4b0bc955 100644 --- a/intaro.retailcrm/lib/component/apiclient/traits/customerstrait.php +++ b/intaro.retailcrm/lib/component/apiclient/traits/customerstrait.php @@ -99,6 +99,7 @@ trait CustomersTrait public function customersCreate(CustomersCreateRequest $request): ?CustomerChangeResponse { $serialized = Serializer::serializeArray($request); + $serialized = $this->setBooleanParameters($serialized); $response = $this->client->customersCreate($serialized['customer'] ?? [], $request->site); return Deserializer::deserializeArray($response->getResponseBody(), CustomerChangeResponse::class); @@ -182,4 +183,18 @@ trait CustomersTrait return Deserializer::deserializeArray($response->getResponseBody(), HistoryResponse::class); } + + /** + * @param array $serializedRequest + * @return array + */ + private function setBooleanParameters($serializedRequest) + { + if (empty($serializedRequest['customer']['subscribed'])) + { + $serializedRequest['customer']['subscribed'] = false; + } + + return $serializedRequest; + } }