Skip to content

Commit b418e60

Browse files
vinodsowdagardanielcivitCopilot
authored
PHPSDK-174: Fix UnitPrice sometimes having more than 10 decimals (#379)
* PHPSDK-174: Fix UnitPrice sometimes having more than 10 decimals * PHPSDK-174: Fix UnitPrice sometimes having more than 10 decimals (#380) * PHPSDK-174: Fix UnitPrice sometimes having more than 10 decimals * PHPSDK-174: Fix UnitPrice sometimes having more than 10 decimals * Update src/ValueObject/CartItem.php Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Daniel Civit <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent c1e489b commit b418e60

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/ValueObject/CartItem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ public function getUnitPrice(): Money
243243
public function getUnitPriceValue(): float
244244
{
245245
if ($this->unitPrice) {
246-
return $this->unitPrice->getAmount() / 100;
246+
return round($this->unitPrice->getAmount() / 100, 10);
247247
}
248248

249-
return $this->unitPriceValue->get() ?? 0.0;
249+
return round(($this->unitPriceValue->get() ?? 0.0), 10);
250250
}
251251

252252
/**

src/ValueObject/UnitPrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class UnitPrice
1414
private $unitPrice;
1515

1616
/**
17-
* Should be given in full units excluding tax, preferably including all decimal places, e.g. 3.305785124
17+
* Should be given in full units excluding tax, preferably including 10 decimal at most, e.g. 3.305785124
1818
*
1919
* @param float $unitPrice
2020
*/

0 commit comments

Comments
 (0)