+ Fix bugs on currency rounding
This commit is contained in:
parent
d8743775c7
commit
21414cc8e9
|
@ -649,7 +649,7 @@ class iLinkTransactionController extends Controller
|
||||||
$data['destinataire'] = $destinataire ? $destinataire->lastname . ' ' . $destinataire->firstname : $request->id_destinataire;
|
$data['destinataire'] = $destinataire ? $destinataire->lastname . ' ' . $destinataire->firstname : $request->id_destinataire;
|
||||||
$data['frais'] = $frais + $taxe;
|
$data['frais'] = $frais + $taxe;
|
||||||
$data['montant_net_init'] = $request->montant - $frais - $taxe;
|
$data['montant_net_init'] = $request->montant - $frais - $taxe;
|
||||||
$data['montant_net_final'] = $this->toMoneyWithCurrency($request->montant - $frais - $taxe, $init_country ,$request->final_country );
|
$data['montant_net_final'] = $this->toMoneyWithCurrency($data['montant_net_init'], $init_country ,$request->final_country );
|
||||||
return $this->successResponse($data);
|
return $this->successResponse($data);
|
||||||
break;
|
break;
|
||||||
case 2: //User - Envoi de wallet à carte
|
case 2: //User - Envoi de wallet à carte
|
||||||
|
|
|
@ -90,7 +90,7 @@ trait Helper
|
||||||
$converter = new CurrencyConverter($provider);
|
$converter = new CurrencyConverter($provider);
|
||||||
$init_country = Country::findOrFail($init_country);
|
$init_country = Country::findOrFail($init_country);
|
||||||
$final_country = Country::findOrFail($final_country);
|
$final_country = Country::findOrFail($final_country);
|
||||||
$init_money = Money::of(round($amount, 2),$init_country->currency->code,new CustomContext(2));
|
$init_money = Money::of(round(str_replace(',' , '',number_format($amount,2)), 2),$init_country->currency->code,new CustomContext(2));
|
||||||
return $converter->convert($init_money, $final_country->currency->code, RoundingMode::DOWN);
|
return $converter->convert($init_money, $final_country->currency->code, RoundingMode::DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue