fix: calculation of commissions for all transactions
Missing to calculate taxe before frais
This commit is contained in:
parent
80b62f9644
commit
f7a027874f
|
@ -250,8 +250,6 @@ class iLinkTransactionController extends Controller
|
|||
$this->checkReguationsLimits($walletUser->id, $init_country, $request->final_country, $transaction->montant);
|
||||
|
||||
$frais = ($init_country != $request->final_country) ? $this->calculateFees($plr_user_wallet_wallet, $request->montant) : $this->calculateFees($plr_user_wallet_wallet_national, $request->montant);
|
||||
$taxe = ($init_country != $request->final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
|
||||
$reseauPayeur = PayingNetwork::where('id_network', $request->network_destinataire)->where('id_configWallet', $config->id)->first();
|
||||
$configPayeur = ConfigWallet::where('id_network', $request->network_destinataire)->firstOrFail();
|
||||
|
||||
|
@ -267,6 +265,8 @@ class iLinkTransactionController extends Controller
|
|||
|
||||
$frais += $fees;
|
||||
|
||||
$taxe = ($init_country != $request->final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
|
||||
$transaction->frais = $frais;
|
||||
$transaction->taxe = $taxe;
|
||||
$transaction->montant_net = $montantDepot = $transaction->montant - $frais - $taxe;
|
||||
|
@ -387,7 +387,10 @@ class iLinkTransactionController extends Controller
|
|||
|
||||
$frais += $fees;
|
||||
|
||||
$transaction->montant_net = $montantDepot = $transaction->montant - $frais;
|
||||
$taxe = $this->calculateTax($taxesNationales, $frais);
|
||||
$transaction->taxe = $taxe;
|
||||
|
||||
$transaction->montant_net = $montantDepot = $transaction->montant - $frais - $taxe;
|
||||
$identification = Identification::with(['country'])->where('id_user', $user->id)->first();
|
||||
$customer_country_code = $identification ? Country::where('name', $identification->country)->first()?->code_country : $user->network->country->code_country;
|
||||
|
||||
|
@ -704,7 +707,10 @@ class iLinkTransactionController extends Controller
|
|||
'payment_method' => PaymentMethod::CARD
|
||||
]);
|
||||
$frais += $fees;
|
||||
$transaction->montant_net = $montantRetrait = $transaction->montant + $frais;
|
||||
$taxe = $this->calculateTax($taxesNationales, $frais);
|
||||
$transaction->taxe = $taxe;
|
||||
|
||||
$transaction->montant_net = $montantRetrait = $transaction->montant + ($frais + $taxe);
|
||||
$identification = Identification::where('id_user', $user->id)->first();
|
||||
$customer_country_code = $identification ? Country::where('name', $identification->country)->first()?->code_country : $user->network->country->code_country;
|
||||
|
||||
|
@ -781,7 +787,9 @@ class iLinkTransactionController extends Controller
|
|||
'payment_method' => PaymentMethod::CARD
|
||||
]);
|
||||
$frais += $fees;
|
||||
$transaction->montant_net = $montantRetrait = $transaction->montant + $frais;
|
||||
$taxe = $this->calculateTax($taxesNationales, $frais);
|
||||
$transaction->taxe = $taxe;
|
||||
$transaction->montant_net = $montantRetrait = $transaction->montant + ($frais + $taxe);
|
||||
$transaction->montant_net_final_country = $transaction->montant;
|
||||
|
||||
$identification = Identification::where('id_user', $user->id)->first();
|
||||
|
@ -962,8 +970,9 @@ class iLinkTransactionController extends Controller
|
|||
'payment_method' => PaymentMethod::CARD
|
||||
]);
|
||||
$frais += $fees;
|
||||
|
||||
$montantRetrait = $transaction->montant + $frais;
|
||||
$taxe = $this->calculateTax($taxesNationales, $frais);
|
||||
$transaction->taxe = $taxe;
|
||||
$montantRetrait = $transaction->montant + ($frais + $taxe);
|
||||
$transaction->montant_net = $montantRetrait;
|
||||
|
||||
$payment_transaction_id = $request->input('payment_transaction_id');
|
||||
|
@ -1095,9 +1104,7 @@ class iLinkTransactionController extends Controller
|
|||
|
||||
//Verification des limites reglementaires
|
||||
$this->checkReguationsLimits($request->id_document_emetteur, $init_country, $request->final_country, $transaction->montant, true);
|
||||
|
||||
$frais = ($init_country != $request->final_country) ? $this->calculateFees($plr_agent_depot_autre_wallet, $request->montant) : $this->calculateFees($plr_agent_depot_autre_wallet_national, $request->montant);
|
||||
$taxe = ($init_country != $request->final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
$fees = $this->getBasicTransactionFees([
|
||||
'amount' => $request->montant,
|
||||
'country_id' => $init_country,
|
||||
|
@ -1105,6 +1112,8 @@ class iLinkTransactionController extends Controller
|
|||
'payment_method' => PaymentMethod::WALLET
|
||||
]);
|
||||
$frais += $fees;
|
||||
|
||||
$taxe = ($init_country != $request->final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
$montantDepot = $request->montant - $frais - $taxe;
|
||||
$transaction->montant_net = $montantDepot;
|
||||
$transaction->montant_net_final_country = $this->toMoneyAmount($montantDepot, $init_country, $request->final_country);
|
||||
|
@ -1208,7 +1217,10 @@ class iLinkTransactionController extends Controller
|
|||
'payment_method' => PaymentMethod::CARD
|
||||
]);
|
||||
$frais += $fees;
|
||||
$montantDepot = $transaction->montant - $frais;
|
||||
$taxe = $this->calculateTax($taxesNationales, $frais);
|
||||
$transaction->taxe = $taxe;
|
||||
|
||||
$montantDepot = $transaction->montant - $frais - $taxe;
|
||||
$transaction->montant_net = $montantDepot;
|
||||
|
||||
// PayOut through payment service
|
||||
|
@ -1763,7 +1775,6 @@ class iLinkTransactionController extends Controller
|
|||
//Verification des limites reglementaires
|
||||
$this->checkReguationsLimits($walletUser->id, $init_country, $request->final_country, $transaction->montant);
|
||||
$frais = $this->calculateFees($init_country != $request->final_country ? $plr_user_cart_autre_wallet_international : $plr_user_cart_autre_wallet_national, $request->montant);
|
||||
$taxe = $this->calculateTax($init_country != $request->final_country ? $taxesInternationales : $taxesNationales, $frais);
|
||||
$fees = $this->getBasicTransactionFees([
|
||||
'amount' => $request->montant,
|
||||
'country_id' => $init_country,
|
||||
|
@ -1771,6 +1782,8 @@ class iLinkTransactionController extends Controller
|
|||
'payment_method' => PaymentMethod::CARD
|
||||
]);
|
||||
$frais += $fees;
|
||||
|
||||
$taxe = $this->calculateTax($init_country != $request->final_country ? $taxesInternationales : $taxesNationales, $frais);
|
||||
$transaction->frais = $frais;
|
||||
$transaction->taxe = $taxe;
|
||||
$transaction->montant_net = $montantRetrait = $transaction->montant + $frais + $taxe;
|
||||
|
@ -2131,7 +2144,6 @@ class iLinkTransactionController extends Controller
|
|||
]);
|
||||
$configNetworkDestinataire = ConfigWallet::where('id_network', $request->network_destinataire)->firstOrFail();
|
||||
$frais = ($init_country != $request->final_country) ? $this->calculateFees($plr_user_wallet_wallet, $request->montant) : $this->calculateFees($plr_user_wallet_wallet_national, $request->montant);
|
||||
$taxe = ($init_country != $request->final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
//Verifier si c'est pas un reseau ilink
|
||||
if ($configNetworkDestinataire->type != 'ilink') {
|
||||
$data['destinataire'] = $request->id_destinataire;
|
||||
|
@ -2147,7 +2159,9 @@ class iLinkTransactionController extends Controller
|
|||
$destinataire = User::where('user_code', $request->id_destinataire)->orWhere('phone', $request->id_destinataire)->first();
|
||||
$data['destinataire'] = $destinataire ? $destinataire->lastname . ' ' . $destinataire->firstname : $request->id_destinataire;
|
||||
}
|
||||
$taxe = ($init_country != $request->final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
$data['frais'] = round($frais + $taxe, 2);
|
||||
|
||||
$data['montant_net_init'] = round($request->montant - $data['frais'], 2);
|
||||
$data['exchange_rate'] = $this->getExchangeRate($init_country, $request->final_country);
|
||||
$data['montant_net_final'] = $this->toMoneyWithCurrency($data['montant_net_init'], $init_country, $request->final_country);
|
||||
|
@ -2162,7 +2176,9 @@ class iLinkTransactionController extends Controller
|
|||
'payment_type' => PaymentType::CASH_IN,
|
||||
'payment_method' => PaymentMethod::CARD
|
||||
]);
|
||||
$data['frais'] = round($frais + $fees, 2);
|
||||
$frais += $fees;
|
||||
$taxe = $this->calculateTax($taxesNationales, $frais);
|
||||
$data['frais'] = round($frais + $taxe, 2);
|
||||
$data['montant_net'] = round($request->montant - $data['frais'], 2);
|
||||
break;
|
||||
case 3: // User - Envoi wallet à cash
|
||||
|
@ -2192,7 +2208,9 @@ class iLinkTransactionController extends Controller
|
|||
'payment_type' => PaymentType::CASH_OUT,
|
||||
'payment_method' => PaymentMethod::CARD
|
||||
]);
|
||||
$data['frais'] = round($frais + $fees, 2);
|
||||
$frais += $fees;
|
||||
$taxe = $this->calculateTax($taxesNationales, $frais);
|
||||
$data['frais'] = round($frais + $taxe, 2);
|
||||
$data['montant_net'] = round($request->montant + $data['frais'], 2);
|
||||
break;
|
||||
case 11: // User - Retrait de carte vers cash
|
||||
|
@ -2205,7 +2223,9 @@ class iLinkTransactionController extends Controller
|
|||
'payment_type' => PaymentType::CASH_OUT,
|
||||
'payment_method' => PaymentMethod::CARD
|
||||
]);
|
||||
$data['frais'] = round($frais + $fees, 2);
|
||||
$frais += $fees;
|
||||
$taxe = $this->calculateTax($taxesNationales, $frais);
|
||||
$data['frais'] = round($frais + $taxe, 2);
|
||||
$data['montant_net'] = round($request->montant + $data['frais'], 2);
|
||||
break;
|
||||
case 13: // Agent - Retrait de la carte vers cash
|
||||
|
@ -2218,7 +2238,9 @@ class iLinkTransactionController extends Controller
|
|||
'payment_type' => PaymentType::CASH_OUT,
|
||||
'payment_method' => PaymentMethod::CARD
|
||||
]);
|
||||
$data['frais'] = round($frais + $fees, 2);
|
||||
$frais += $fees;
|
||||
$taxe = $this->calculateTax($taxesNationales, $frais);
|
||||
$data['frais'] = round($frais + $taxe, 2);
|
||||
$data['montant_net'] = round($request->montant + $data['frais'], 2);
|
||||
break;
|
||||
case 14: // Agent - Envoi de cash vers wallet iLink
|
||||
|
@ -2241,14 +2263,15 @@ class iLinkTransactionController extends Controller
|
|||
'final_country' => 'required|integer|exists:countries,id',
|
||||
]);
|
||||
$frais = ($init_country != $request->final_country) ? $this->calculateFees($plr_agent_depot_autre_wallet, $request->montant) : $this->calculateFees($plr_agent_depot_autre_wallet_national, $request->montant);
|
||||
$taxe = ($init_country != $request->final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
$fees = $this->getBasicTransactionFees([
|
||||
'amount' => $request->montant,
|
||||
'country_id' => $init_country,
|
||||
'payment_type' => PaymentType::CASH_IN,
|
||||
'payment_method' => PaymentMethod::WALLET
|
||||
]);
|
||||
$data['frais'] = round($frais + $taxe + $fees, 2);
|
||||
$frais += $fees;
|
||||
$taxe = ($init_country != $request->final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
$data['frais'] = round($frais + $taxe, 2);
|
||||
$data['montant_net_init'] = round($request->montant - $data['frais'], 2);
|
||||
$data['exchange_rate'] = $this->getExchangeRate($init_country, $request->final_country);
|
||||
$data['montant_net_final'] = $this->toMoneyWithCurrency($data['montant_net_init'], $init_country, $request->final_country);
|
||||
|
@ -2263,7 +2286,9 @@ class iLinkTransactionController extends Controller
|
|||
'payment_type' => PaymentType::CASH_IN,
|
||||
'payment_method' => PaymentMethod::CARD
|
||||
]);
|
||||
$data['frais'] = round($frais + $fees, 2);
|
||||
$frais += $fees;
|
||||
$taxe = $this->calculateTax($taxesNationales, $frais);
|
||||
$data['frais'] = round($frais + $taxe, 2);
|
||||
$data['montant_net'] = round($request->montant - $data['frais'], 2);
|
||||
break;
|
||||
case 17: // Agent - Envoi de cash vers cash
|
||||
|
@ -2284,14 +2309,15 @@ class iLinkTransactionController extends Controller
|
|||
$plr_user_cart_autre_wallet_national = $this->getPaliers($paliers_commission_wallets, 'user_cart_autre_wallet_national');
|
||||
$plr_user_cart_autre_wallet_international = $this->getPaliers($paliers_commission_wallets, 'user_cart_autre_wallet_international');
|
||||
$frais = $this->calculateFees($init_country != $request->final_country ? $plr_user_cart_autre_wallet_international : $plr_user_cart_autre_wallet_national, $request->montant);
|
||||
$taxe = $this->calculateTax($init_country != $request->final_country ? $taxesInternationales : $taxesNationales, $frais);
|
||||
$fees = $this->getBasicTransactionFees([
|
||||
'amount' => $request->montant,
|
||||
'country_id' => $init_country,
|
||||
'payment_type' => PaymentType::CASH_OUT,
|
||||
'payment_method' => PaymentMethod::CARD
|
||||
]);
|
||||
$data['frais'] = round($frais + $taxe + $fees, 2);
|
||||
$frais += $fees;
|
||||
$taxe = $this->calculateTax($init_country != $request->final_country ? $taxesInternationales : $taxesNationales, $frais);
|
||||
$data['frais'] = round($frais + $taxe, 2);
|
||||
$data['exchange_rate'] = $this->getExchangeRate($init_country, $request->final_country);
|
||||
$data['montant_net'] = round($request->montant + $data['frais'], 2);
|
||||
$data['montant_net_final'] = $this->toMoneyWithCurrency($request->montant, $init_country, $request->final_country);
|
||||
|
|
Loading…
Reference in New Issue