fix: 🐛 update claim customer relation with hashcode

This commit is contained in:
Alexis Gousseau 2025-10-06 16:48:44 +02:00
parent 3d25f43f8d
commit a7be8bbc46
No known key found for this signature in database
GPG key ID: 4A614CB3DBBA2406
2 changed files with 5 additions and 4 deletions

View file

@ -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) {

View file

@ -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') {