fix: fix floating point precision error

This commit is contained in:
Björn Fromme committed 2025-10-18 17:44:24 +02:00
1 parent b894bbf5e6
commit e6c47019d5
2 files changed
+40 -3

No files matched your search

@@ -89,9 +89,9 @@ class Step3Controller extends AbstractController
);
}
// Validate price match (exact comparison)
$apiTotal = $inquiryResponse->totalPrice ?? 0.0;
$calculatedTotal = $this->priceCalculator->calculateGrandTotal($bookingCreateDto);
// Validate price match (rounded to cent precision to avoid floating-point errors)
$apiTotal = round($inquiryResponse->totalPrice ?? 0.0, 2);
$calculatedTotal = round($this->priceCalculator->calculateGrandTotal($bookingCreateDto), 2);
if ($apiTotal !== $calculatedTotal) {
return $this->handleApiError(