fix: fix floating point precision error

This commit is contained in:
Björn Fromme
2025-10-18 17:44:24 +02:00
parent b894bbf5e6
commit e6c47019d5
2 changed files with 40 additions and 3 deletions
@@ -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(