Skip to content

Commit

Permalink
fix: enforce data types to call our insurance API
Browse files Browse the repository at this point in the history
  • Loading branch information
olance committed Nov 13, 2024
1 parent 609ba97 commit b8bf29f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion alma/lib/Model/CustomerModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getEmail()
*/
public function getBirthday()
{
if ($this->birthday === '0000-00-00') {
if (strpos($this->birthday, '0000-00-00') !== false) {
return null;
}

Expand Down
9 changes: 5 additions & 4 deletions alma/lib/Services/InsuranceApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ public function subscribeInsurance($subscriptionData, $order, $orderPayment = fa
try {
$result = $this->almaApiClient->insurance->subscription(
$subscriptionData,
$order->id,
strval($order->id),
$idTransaction,
$this->context->cookie->checksum,
$order->id_cart
strval($order->id_cart)
);

if (isset($result['subscriptions'])) {
Expand All @@ -184,11 +184,12 @@ public function subscribeInsurance($subscriptionData, $order, $orderPayment = fa
} catch (\Exception $e) {
Logger::instance()->error(
sprintf(
'[Alma] Error when subscribing insurance contract, message "%s", trace "%s", subscriptionData : "%s", idTransaction : "%s"',
'[Alma] Error when subscribing insurance contract, message "%s", trace "%s", subscriptionData : "%s", idTransaction : "%s", API response: "%s"',
$e->getMessage(),
$e->getTraceAsString(),
json_encode($subscriptionData),
$idTransaction
$idTransaction,
$e->response ? json_encode($e->response->json) : null
)
);
}
Expand Down

0 comments on commit b8bf29f

Please sign in to comment.