diff --git a/app/Http/Controllers/iLinkTransactionController.php b/app/Http/Controllers/iLinkTransactionController.php index 8b86317..d0bd7c2 100755 --- a/app/Http/Controllers/iLinkTransactionController.php +++ b/app/Http/Controllers/iLinkTransactionController.php @@ -250,9 +250,6 @@ class iLinkTransactionController extends Controller try { DB::beginTransaction(); - $transaction->exchange_rate = $this->getExchangeRate($init_country, $final_country ?? $init_country); - - switch ($type->id) { case 1: //User - Envoi wallet à wallet $this->validate($request, $transaction->send_wallet_wallet_rules()); @@ -312,6 +309,8 @@ class iLinkTransactionController extends Controller $transaction->type_id_destinataire = $request->input('type_id_destinataire'); $transaction->nom_destinataire = $request->nom_destinataire; $transaction->prenom_destinataire = $request->prenom_destinataire; + $transaction->exchange_rate = $this->getExchangeRate($init_country, $final_country); + if ($configPayeur->type == 'ilink') { $destinataire = $this->verifyiLinkRecipient($request->id_destinataire, $request->final_country); if(!($destinataire instanceof User)){ @@ -424,6 +423,7 @@ class iLinkTransactionController extends Controller $transaction->frais = $frais; $transaction->montant_net = $montantDepot = $transaction->montant - $frais - $taxe; $transaction->montant_net_final_country = $this->toMoneyAmount($montantDepot, $init_country, $final_country); + $transaction->exchange_rate = $this->getExchangeRate($init_country, $final_country); $identification = Identification::with(['country'])->where('id_user', $user->id)->first(); $countryCurrency = CountriesCurrency::findOrFail($final_country); @@ -765,6 +765,8 @@ class iLinkTransactionController extends Controller $transaction->frais = $frais; $transaction->montant_net = $transaction->montant + ($frais + $taxe); // Montant de retrait $transaction->montant_net_final_country = $this->toMoneyAmount($transaction->montant, $init_country, $final_country); + $transaction->exchange_rate = $this->getExchangeRate($init_country, $final_country); + $identification = Identification::where('id_user', $user->id)->first(); $countryCurrency = CountriesCurrency::findOrFail($init_country); @@ -847,6 +849,7 @@ class iLinkTransactionController extends Controller $transaction->frais = $frais; $transaction->montant_net = $transaction->montant + ($frais + $taxe); // Montant de retrait $transaction->montant_net_final_country = $this->toMoneyAmount($transaction->montant, $init_country, $final_country); + $transaction->exchange_rate = $this->getExchangeRate($init_country, $final_country); $countryCurrency = CountriesCurrency::findOrFail($init_country); $identification = Identification::where('id_user', $user->id)->first(); @@ -1906,6 +1909,7 @@ class iLinkTransactionController extends Controller $transaction->commission_hyp = $transaction->part_reseau_emetteur; $transaction->id_transaction = $this->getTransactionID(); $transaction->type_id_destinataire = $request->input('type_id_destinataire'); + $transaction->exchange_rate = $this->getExchangeRate($init_country, $request->final_country); // Verifier si le reseau payeur existe si c'est pas un reseau ilink @@ -2002,7 +2006,7 @@ class iLinkTransactionController extends Controller $transaction->save(); $message = trans('messages.successful_user_remove_from_cart_to_other_wallet', ['id_transaction' => $transaction->id_transaction, 'amount' => $this->toMoney($transaction->montant, $init_country), - 'total' => $this->toMoney($montantRetrait, $init_country), 'fees' => $this->toMoney($frais, $init_country), + 'total' => $this->toMoney($montantRetrait, $init_country), 'fees' => $this->toMoney($frais, $init_country),'init_country' => $this->getCountryName($init_country), 'final_country' => $this->getCountryName($request->final_country), 'sender_code' => $transaction->id_destinataire, 'cart_number' => wordwrap($transaction->numero_carte, 4, ' ', true)]); $this->sendMail($user->email, trans('messages.successful_transaction'), $message); $response_message = ($message . trans('messages.sent_by_mail')); diff --git a/resources/lang/en/messages.php b/resources/lang/en/messages.php index 93a7224..3c9b9aa 100755 --- a/resources/lang/en/messages.php +++ b/resources/lang/en/messages.php @@ -128,7 +128,7 @@ Transaction information: - Card number: :cart_number - Country of destination: :final_country - Recipient account:: sender_code - - Net amount: :net_final", + - Amount: :net_final", 'successful_user_remove_from_cart_to_cash' => "Withdrawing money from your card to cash Transaction information: - Number: :id_transaction @@ -138,7 +138,7 @@ Transaction information: - Amount incl. VAT: :net_init - Card number: :cart_number - Country of destination: :final_country - - Net amount: :net_final, + - Amount: :net_final, - User code: :sender_code - Withdrawal code: :code", 'successful_agent_remove_cash' => 'Withdrawal of money from a geolocated agent @@ -324,9 +324,12 @@ Transaction Information: 'successful_user_remove_from_cart_to_other_wallet' => "Withdraw money from your card to another account Transaction information : - Number: :id_transaction - - Transaction amount: :amount - - Fees: :fees - - Total withdrawal amount: :total - - Recipient account: :sender_code - - Card number: :cart_number" + - Amount : :amount + - Fees and taxes: :fees + - Country of card issue: :init_country + - Amount incl. VAT: :total + - Card number: :cart_number + - Country of destination: :final_country + - Destination account: :sender_code + - Amount: :net_final" ]; diff --git a/resources/lang/fr/messages.php b/resources/lang/fr/messages.php index 263dbe0..f441d73 100755 --- a/resources/lang/fr/messages.php +++ b/resources/lang/fr/messages.php @@ -128,7 +128,7 @@ Informations de la transaction : - Numéro de la carte : :cart_number - Pays de destination : :final_country - Compte destinataire : :sender_code - - Montant net : :net_final", + - Montant : :net_final", 'successful_user_remove_from_cart_to_cash' => "Retrait d'argent de votre carte vers cash Informations de la transaction : - Numéro : :id_transaction @@ -138,7 +138,7 @@ Informations de la transaction : - Montant TTC : :net_init - Numéro de la carte : :cart_number - Pays de destination : :final_country - - Montant net : :net_final, + - Montant : :net_final, - Code utilisateur : :sender_code - Code de retrait : :code", 'successful_agent_remove_cash' => 'Retrait d\'argent chez un agent géolocalisé @@ -325,9 +325,12 @@ Informations de la transaction : 'successful_user_remove_from_cart_to_other_wallet' => "Retrait d'argent de votre carte vers un autre compte Informations de la transaction : - Numéro : :id_transaction - - Montant de la transaction : :amount - - Frais : :fees - - Montant total de retrait: :total + - Montant : :amount + - Frais et taxes : :fees + - Pays d'émission de la carte : :init_country + - Montant TTC : :total + - Numéro de la carte : :cart_number + - Pays de destination : :final_country - Compte destinataire : :sender_code - - Numero de la carte : :cart_number" + - Montant : :net_final", ];