diff --git a/app/PaymentDrivers/Stripe/Utilities.php b/app/PaymentDrivers/Stripe/Utilities.php index 586871d08a93..dd04e64aec21 100644 --- a/app/PaymentDrivers/Stripe/Utilities.php +++ b/app/PaymentDrivers/Stripe/Utilities.php @@ -18,7 +18,7 @@ trait Utilities public function convertFromStripeAmount($amount, $precision, $currency) { - if($currency->code == "JPY") + if(in_array($amount, ["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"])) return $amount; return $amount / pow(10, $precision); @@ -28,7 +28,7 @@ trait Utilities public function convertToStripeAmount($amount, $precision, $currency) { - if($currency->code == "JPY") + if(in_array($amount, ["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"])) return $amount; return round(($amount * pow(10, $precision)),0); diff --git a/tests/Unit/ZeroDecimalTest.php b/tests/Unit/ZeroDecimalTest.php new file mode 100644 index 000000000000..ca0ed4534010 --- /dev/null +++ b/tests/Unit/ZeroDecimalTest.php @@ -0,0 +1,41 @@ +assertTrue(in_array("KRW", $this->currencies)); + + } + +} +