potential money formater for g2apay
<?php
class G2APayMoneyFormatter
{
public function getAmount(MoneyInterface $money): string
{
$amount = $money->format();
// if decimal part nullable - round to integer
if ((float) $amount === round($amount)) {
return (string) round($amount);
}
// if the last decimal digit is 0 - remove it
if (0 === (int) substr($amount, -1)) {
return (string) round($amount, 1);
}
return $amount;
}
}