Commit 2f2fce04 authored by Daniel's avatar Daniel
Browse files

Hotfix false capture calculation

parent f051570b
......@@ -56,6 +56,7 @@ class Capture implements CommandInterface
try {
$paymentDO = SubjectReader::readPayment($commandSubject);
$amount = SubjectReader::readAmount($commandSubject);
$orderId = $paymentDO->getOrder()->getOrderIncrementId();
$request = $this->captureRequestFactory->create($orderId, $amount);
......
......@@ -13,6 +13,6 @@ class SubjectReader extends \Magento\Payment\Gateway\Helper\SubjectReader
*/
public static function readAmount(array $subject): int
{
return (int) parent::readAmount($subject) * 100;
return round(parent::readAmount($subject) * 100, 2);
}
}
......@@ -17,7 +17,7 @@ class AmountBuilder
public function buildFromQuote(Quote $quote): Amount
{
$amount = new Amount();
$amount->setAmount((int) (round($quote->getGrandTotal(), 2) * 100));
$amount->setAmount(round($quote->getGrandTotal(), 2) * 100);
return $amount;
}
......@@ -29,7 +29,7 @@ class AmountBuilder
public function buildFromOrder(OrderAdapterInterface $order): Amount
{
$amount = new Amount();
$amount->setAmount((int) (round($order->getGrandTotalAmount(), 2) * 100));
$amount->setAmount(round($order->getGrandTotalAmount(), 2) * 100);
return $amount;
}
......
......@@ -74,7 +74,7 @@ class BasketBuilder
{
$basketItem = new BasketItem();
$basketItemAmount = new Amount();
$basketItemAmount->setAmount((int) (round($rowTotal, 2) * 100));
$basketItemAmount->setAmount(round($rowTotal, 2) * 100);
$basketItem->setBasketItemText($name);
$basketItem->setBasketItemCount($qty);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment