diff --git a/src/Models/Claim.php b/src/Models/Claim.php index c2cd34a..687f706 100644 --- a/src/Models/Claim.php +++ b/src/Models/Claim.php @@ -31,7 +31,7 @@ abstract class Claim extends ClientModel 'message' => 'required|string|min:3', 'brand_id' => 'required|int|min:1', 'subject_id' => 'required|int|min:1', - 'customer_id' => 'sometimes|nullable|int|min:1', + 'hashcode' => 'sometimes|nullable|string|size:36', ]; /** @@ -80,8 +80,10 @@ abstract class Claim extends ClientModel ); // Add customer relation if exist. - $crmCustomer = (new CrmApiV4())->getCustomer($email); - $params['customer_id'] = $crmCustomer; + $crmCustomer = (new CrmApiV4())->getCustomer($email); + if (!is_null($crmCustomer)) { + $params['hashcode'] = $crmCustomer->hashcode; + } // Validate all data. foreach ($params as $key => $value) { diff --git a/src/Transport/Response.php b/src/Transport/Response.php index c6bb81d..af54657 100644 --- a/src/Transport/Response.php +++ b/src/Transport/Response.php @@ -101,7 +101,6 @@ class Response $this->message = $response->getReasonPhrase(); } - // * Body should be json data. if (($decodedJson = $this->tryDecodeJson($this->body->getContents())) === false) { if (Utils::getConfig('app.env') === 'testing') {