Skip to content
Snippets Groups Projects
Commit f1eb59fd authored by samuelsov's avatar samuelsov Committed by mattwire
Browse files

Fixing fatal 'Rounding is necessary...'

parent 846da36a
Branches
Tags
1 merge request!248extensions/stripe#470 (rounding issue)
......@@ -10,6 +10,7 @@
*/
use Brick\Money\Money;
use Brick\Math\RoundingMode;
use Civi\Api4\ContributionRecur;
use Civi\Api4\PaymentprocessorWebhook;
use Civi\Api4\StripeCustomer;
......@@ -294,7 +295,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
* @throws \Brick\Money\Exception\UnknownCurrencyException
*/
public function getAmountFormattedForStripeAPI(PropertyBag $propertyBag): string {
return Money::of($propertyBag->getAmount(), $propertyBag->getCurrency())->getMinorAmount()->getIntegralPart();
return Money::of($propertyBag->getAmount(), $propertyBag->getCurrency(), NULL, RoundingMode::HALF_EVEN)->getMinorAmount()->getIntegralPart();
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment