Skip to content

Commit

Permalink
Send integer cents to Square to avoid their incorrect rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbmarshall committed Aug 7, 2023
1 parent f25cd4f commit bb26364
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Action/CaptureAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function execute($request) {
]);

$amount_money = new \Square\Models\Money();
$amount_money->setAmount($model['amount'] * 100);
$amount_money->setAmount(round($model['amount'] * 100));
$amount_money->setCurrency($model['currency']);

$body = new \Square\Models\CreatePaymentRequest(
Expand Down Expand Up @@ -199,7 +199,7 @@ public function execute($request) {
$order_line_item->setCatalogObjectId($this->getSquareCatalogueObject($client, $line_item['name']));

$line_amount_money = new \Square\Models\Money();
$line_amount_money->setAmount($line_item['amount'] * 100);
$line_amount_money->setAmount(round($line_item['amount'] * 100));
$line_amount_money->setCurrency($model['currency']);
$order_line_item->setBasePriceMoney($line_amount_money);
if ($line_item['note'] ?? '') {
Expand Down

0 comments on commit bb26364

Please sign in to comment.