PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 2.5.0
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v2.5.0
2.5.0 2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 All 34 releases
← All changes | app/Services/CurrenciesHelper.php +8 -0 2.4.0 → 2.5.0 View file →
@@ -430,8 +430,16 @@
430 430 'XPF' => esc_html__('Cfp Franc', 'fluent-booking'),
431 431 ));
432 432 }
433 433
434 + // Every money write goes through here so the ledger and the gateway cannot diverge.
435 + // Rounds rather than truncates: 2.01 * 100 is 200.99999999999997 in IEEE-754, so
436 + // intval() records 200 where the card is charged 201. Factor is 1 for zero-decimal.
437 + public static function toCents($value, $conversionFactor = 100)
438 + {
439 + return (int) round((float) $value * $conversionFactor);
440 + }
441 +
434 442 public static function isZeroDecimal($currencyCode)
435 443 {
436 444 $currencyCode = strtoupper($currencyCode);
437 445 $zeroDecimals = self::zeroDecimalCurrencies();