Compare commits
10 Commits
20a23ea373
...
4c5b6a4aaf
Author | SHA1 | Date |
---|---|---|
|
4c5b6a4aaf | |
|
454c0254f2 | |
|
f41f4011d4 | |
|
e5ccbaf6c0 | |
|
c4ab2831a0 | |
|
d0ba85c207 | |
|
0f51769a75 | |
|
4540d05eec | |
|
03ea53764d | |
|
b653f158d6 |
|
@ -7,11 +7,13 @@ use App\Models\Agent;
|
|||
use App\Models\AgentPlus;
|
||||
use App\Models\Identification;
|
||||
use App\Models\User;
|
||||
use App\Traits\Helper;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
use Helper;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
|
@ -131,17 +133,6 @@ class UserController extends Controller
|
|||
|
||||
}
|
||||
|
||||
private function generateRandomString($length = 10)
|
||||
{
|
||||
$characters = '23456789abcdefghjkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
public function rattachCard(Request $request, $id_user)
|
||||
{
|
||||
$this->validate($request, [
|
||||
|
|
|
@ -267,9 +267,6 @@ class iLinkTransactionController extends Controller
|
|||
|
||||
$frais = ($init_country != $request->final_country) ? $this->calculateFees($plr_user_wallet_wallet, $request->montant) : $this->calculateFees($plr_user_wallet_wallet_national, $request->montant);
|
||||
$reseauPayeur = PayingNetwork::where('id_network', $request->network_destinataire)->where('id_configWallet', $config->id)->first();
|
||||
if(empty($reseauPayeur)){
|
||||
return $this->errorResponse(__('errors.service_unavailable_in_country'));
|
||||
}
|
||||
$configPayeur = ConfigWallet::where('id_network', $request->network_destinataire)->firstOrFail();
|
||||
|
||||
$fees = 0;
|
||||
|
@ -291,6 +288,12 @@ class iLinkTransactionController extends Controller
|
|||
$transaction->montant_net = $montantDepot = $transaction->montant - $frais - $taxe;
|
||||
$transaction->montant_net_final_country = $this->toMoneyAmount($montantDepot, $init_country, $request->final_country);
|
||||
|
||||
// Verifier si le reseau payeur existe si c'est pas un reseau ilink
|
||||
if ($configPayeur->type != 'ilink' && empty($reseauPayeur)) {
|
||||
return $this->errorResponse(__('errors.service_unavailable_in_country'));
|
||||
}
|
||||
|
||||
|
||||
if (isset($reseauPayeur)) {
|
||||
$transaction->part_reseau_payeur = $frais * $reseauPayeur->taux_partage / 100;
|
||||
$transaction->part_reseau_payeur_final_country = $this->toMoneyAmount($transaction->part_reseau_payeur, $init_country, $request->final_country);
|
||||
|
@ -306,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, $request->final_country);
|
||||
|
||||
if ($configPayeur->type == 'ilink') {
|
||||
$destinataire = $this->verifyiLinkRecipient($request->id_destinataire, $request->final_country);
|
||||
if(!($destinataire instanceof User)){
|
||||
|
@ -418,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);
|
||||
|
@ -757,9 +763,10 @@ class iLinkTransactionController extends Controller
|
|||
$taxe = $this->calculateTax($init_country != $final_country ? $taxesInternationales : $taxesNationales, $frais);
|
||||
$transaction->taxe = $taxe;
|
||||
$transaction->frais = $frais;
|
||||
$montantRetrait = $transaction->montant + ($frais + $taxe);
|
||||
$transaction->montant_net = $this->toMoneyAmount($transaction->montant, $init_country, $final_country);
|
||||
$transaction->montant_net_final_country = $this->toMoneyAmount($montantRetrait, $init_country, $final_country);
|
||||
$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);
|
||||
|
@ -770,7 +777,7 @@ class iLinkTransactionController extends Controller
|
|||
'exp_month' => date("m", strtotime($user->expiration_date)),
|
||||
'exp_year' => date("Y", strtotime($user->expiration_date)),
|
||||
'cvc' => $request->input('cvv'),
|
||||
'amount' => $transaction->montant_net_final_country,
|
||||
'amount' => $transaction->montant_net,
|
||||
'currency' => $countryCurrency->currency_code,
|
||||
'payment_method' => 'CARD',
|
||||
'customer_id' => $user->id,
|
||||
|
@ -790,7 +797,7 @@ class iLinkTransactionController extends Controller
|
|||
$transaction->commission_banque = $this->calculateFees($init_country != $final_country ? $plr_bank_user_cart_cash_international : $plr_bank_user_cart_cash_national, $request->montant, $frais);
|
||||
//Emettre une trame SSL pour recharger le compte de la banque partenaire du montant de sa commission
|
||||
|
||||
$walletUser->balance += $transaction->montant_net;
|
||||
$walletUser->balance += $transaction->montant_net_final_country;
|
||||
$transaction->commission_hyp = $this->calculateFees($init_country != $final_country ? $plr_hyp_user_cart_cash_international : $plr_hyp_user_cart_cash_national, $request->montant, $frais);
|
||||
$walletHyperviseur->balance_com += $transaction->commission_hyp;
|
||||
$transaction->id_wallet_hyp = $walletHyperviseur->id;
|
||||
|
@ -801,7 +808,7 @@ class iLinkTransactionController extends Controller
|
|||
$transaction->save();
|
||||
$message = trans('messages.successful_user_remove_from_cart_to_wallet',
|
||||
['id_transaction' => $transaction->id_transaction, 'amount' => $this->toMoney($transaction->montant, $init_country),
|
||||
'net_init' => $this->toMoney($transaction->montant, $init_country),'net_final' => $this->toMoney($transaction->montant_net_final_country, $final_country),
|
||||
'net_init' => $this->toMoney($transaction->montant_net, $init_country),'net_final' => $this->toMoney($transaction->montant_net_final_country, $final_country),
|
||||
'fees' => $this->toMoney($frais + $taxe, $init_country), 'init_country' => $this->getCountryName($init_country), 'final_country' => $this->getCountryName($final_country),
|
||||
'sender_code' => $user->user_code, 'cart_number' => wordwrap($transaction->numero_carte, 4, ' ', true)]);
|
||||
$this->sendMail($user->email, trans('messages.successful_transaction'), $message);
|
||||
|
@ -840,9 +847,9 @@ class iLinkTransactionController extends Controller
|
|||
$taxe = $this->calculateTax($init_country != $final_country ? $taxesInternationales : $taxesNationales, $frais);
|
||||
$transaction->taxe = $taxe;
|
||||
$transaction->frais = $frais;
|
||||
$montantRetrait = $transaction->montant + ($frais + $taxe);
|
||||
$transaction->montant_net = $this->toMoneyAmount($transaction->montant, $init_country, $final_country);
|
||||
$transaction->montant_net_final_country = $this->toMoneyAmount($montantRetrait, $init_country, $final_country);
|
||||
$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();
|
||||
|
@ -854,7 +861,7 @@ class iLinkTransactionController extends Controller
|
|||
'exp_month' => date("m", strtotime($user->expiration_date)),
|
||||
'exp_year' => date("Y", strtotime($user->expiration_date)),
|
||||
'cvc' => $request->input('cvv'),
|
||||
'amount' => $transaction->montant_net_final_country,
|
||||
'amount' => $transaction->montant_net,
|
||||
'currency' => $countryCurrency->currency_code,
|
||||
'payment_method' => 'CARD',
|
||||
'customer_id' => $user->id,
|
||||
|
@ -919,7 +926,7 @@ class iLinkTransactionController extends Controller
|
|||
if ($init_country != $transaction->final_country)
|
||||
throw new Exception(trans('errors.operation_cannot_performed_in_country'));
|
||||
if ($this->checkPassword($request->code_retrait, $transaction->encrypted_code_retrait, $transaction->code_retrait_salt)) {
|
||||
$montantNet = $transaction->type == 11 ? $transaction->montant_net : $transaction->montant_net_final_country;
|
||||
$montantNet = $transaction->montant_net_final_country;
|
||||
if (in_array($transaction->type, [3, 17])) {
|
||||
$commissionHyp = ($transaction->network_emetteur != $transaction->network_destinataire) ?
|
||||
$transaction->part_reseau_payeur_final_country : $transaction->commission_hyp_final_country;
|
||||
|
@ -1902,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
|
||||
|
@ -1997,8 +2005,8 @@ class iLinkTransactionController extends Controller
|
|||
$transaction->date = $this->getCurrentTime($init_country);
|
||||
$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),
|
||||
['id_transaction' => $transaction->id_transaction, 'amount' => $this->toMoney($transaction->montant, $init_country),'net_final' => $this->toMoney($transaction->montant_net_final_country, $request->final_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'));
|
||||
|
@ -2141,7 +2149,7 @@ class iLinkTransactionController extends Controller
|
|||
$wallet_user = WalletsUser::where('idUser', $user->id)->firstOrFail();
|
||||
|
||||
$transactions = DB::select('SELECT id_wallet_user , operation_fr , operation_en, id_transaction ,network_destinataire, init_country , final_country, date , id , montant , frais , taxe , pays_init , pays_final,
|
||||
destinataire_phone , destinataire_name , nom_destinataire, prenom_destinataire, montant_net ,montant_net_final_country FROM infos_ilink_transaction WHERE id_wallet_user = :id_wallet AND type <> 12 AND type <> 14
|
||||
destinataire_phone , destinataire_name , nom_destinataire, prenom_destinataire, montant_net ,montant_net_final_country, exchange_rate FROM infos_ilink_transaction WHERE id_wallet_user = :id_wallet AND type <> 12 AND type <> 14
|
||||
ORDER BY date DESC LIMIT 10;', ['id_wallet' => $wallet_user->id]);
|
||||
|
||||
foreach ($transactions as $data) {
|
||||
|
@ -2213,13 +2221,27 @@ class iLinkTransactionController extends Controller
|
|||
|
||||
public function calculateCommission(Request $request)
|
||||
{
|
||||
$rules = [
|
||||
$this->validate($request, [
|
||||
'type' => 'required|integer|min:0|not_in:0',
|
||||
'montant' => 'required|numeric|min:0|not_in:0',
|
||||
]);
|
||||
|
||||
$simulator = $request->input('simulator', false); // only for simulator
|
||||
|
||||
if($simulator){
|
||||
$this->validate($request, [
|
||||
'init_country' => 'required|integer|exists:countries,id',
|
||||
'final_country' => 'required|integer|exists:countries,id',
|
||||
]);
|
||||
$init_country = $request->input('init_country');
|
||||
$final_country = $request->input('final_country');
|
||||
}else{
|
||||
$this->validate($request, [
|
||||
'id_wallet_agent' => 'required_without:id_wallet_user|integer|min:0|not_in:0',
|
||||
'id_wallet_user' => 'required_without:id_wallet_agent|integer|min:0|not_in:0',
|
||||
'montant' => 'required|numeric|min:0|not_in:0',
|
||||
];
|
||||
$this->validate($request, $rules);
|
||||
]);
|
||||
}
|
||||
|
||||
if (isset($request->id_wallet_agent)) {
|
||||
$walletAgent = Wallet::findOrFail($request->get('id_wallet_agent'));
|
||||
$network_agent = NetworksAgent::findOrFail($walletAgent->id_networkAgent);
|
||||
|
@ -2229,6 +2251,7 @@ class iLinkTransactionController extends Controller
|
|||
|
||||
|
||||
} else {
|
||||
if(empty($init_country)){
|
||||
$walletUser = WalletsUser::findOrFail($request->id_wallet_user);
|
||||
// Pour les operations à cartes, le pays initial c'est le pays de la carte
|
||||
if(in_array($request->type, [10, 11])){
|
||||
|
@ -2245,6 +2268,8 @@ class iLinkTransactionController extends Controller
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result = ConfigWallet::join('networks', 'networks.id', '=', 'configWallet.id_network')
|
||||
->where('networks.country_id', $init_country)->where('configWallet.type', 'ilink')
|
||||
->select('configWallet.id')->first();
|
||||
|
@ -2280,10 +2305,16 @@ class iLinkTransactionController extends Controller
|
|||
switch ($request->type) {
|
||||
case 1: //User - Envoi wallet à wallet
|
||||
$this->validate($request, [
|
||||
'final_country' => 'required|integer|exists:countries,id',
|
||||
'id_destinataire' => 'required_without:phone_destinataire',
|
||||
'network_destinataire' => 'required|integer|min:0|not_in:0',
|
||||
]);
|
||||
|
||||
if(!$simulator){
|
||||
$this->validate($request, [
|
||||
'final_country' => 'required|integer|exists:countries,id',
|
||||
'id_destinataire' => 'required_without:phone_destinataire'
|
||||
]);
|
||||
}
|
||||
|
||||
$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);
|
||||
//Verifier si c'est pas un reseau ilink
|
||||
|
@ -2297,12 +2328,14 @@ class iLinkTransactionController extends Controller
|
|||
]);
|
||||
$frais += $fees;
|
||||
} else {
|
||||
if(!$simulator){
|
||||
$destinataire = $this->verifyiLinkRecipient($request->id_destinataire, $request->final_country);
|
||||
if(!($destinataire instanceof User)){
|
||||
return $destinataire;
|
||||
}
|
||||
$data['destinataire'] = $destinataire->lastname . ' ' . $destinataire->firstname;
|
||||
}
|
||||
}
|
||||
$taxe = ($init_country != $request->final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
$data['frais'] = round($frais + $taxe, 2);
|
||||
|
||||
|
@ -2311,10 +2344,12 @@ class iLinkTransactionController extends Controller
|
|||
$data['montant_net_final'] = $this->toMoneyWithCurrency($data['montant_net_init'], $init_country, $request->final_country);
|
||||
break;
|
||||
case 2: //User - Envoi de wallet à carte
|
||||
if(!$simulator){
|
||||
$final_country = $walletUser->user->card_country_id;
|
||||
if(empty($final_country)){
|
||||
return $this->errorResponse(trans('errors.no_bank_card_attached'));
|
||||
}
|
||||
}
|
||||
$plr_user_wallet_cart_national = $this->getPaliers($paliers_commission_wallets, 'user_wallet_cart_national');
|
||||
$plr_user_wallet_cart_international = $this->getPaliers($paliers_commission_wallets, 'user_wallet_cart_international');
|
||||
$frais = $this->calculateFees($init_country != $final_country ? $plr_user_wallet_cart_international : $plr_user_wallet_cart_national, $request->montant);
|
||||
|
@ -2361,7 +2396,9 @@ class iLinkTransactionController extends Controller
|
|||
$data['montant_net'] = round($request->montant - $data['frais'], 2);
|
||||
break;
|
||||
case 10: //User - Retrait de carte vers wallet
|
||||
if(!$simulator){
|
||||
$final_country = $walletUser->user->network->country->id;
|
||||
}
|
||||
|
||||
$plr_user_cart_wallet_national = $this->getPaliers($paliers_commission_wallets, 'user_cart_wallet_national');
|
||||
$plr_user_cart_wallet_international = $this->getPaliers($paliers_commission_wallets, 'user_cart_wallet_international');
|
||||
|
@ -2375,12 +2412,14 @@ class iLinkTransactionController extends Controller
|
|||
$frais += $fees;
|
||||
$taxe = $this->calculateTax($init_country != $final_country ? $taxesInternationales : $taxesNationales, $frais);
|
||||
$data['frais'] = round($frais + $taxe, 2);
|
||||
$data['montant_net_init'] = $request->montant;
|
||||
$data['montant_net_init'] = round($request->montant + $data['frais'],2);
|
||||
$data['exchange_rate'] = $this->getExchangeRate($init_country, $final_country);
|
||||
$data['montant_net_final'] = $this->toMoneyWithCurrency(round($request->montant + $data['frais'], 2), $init_country, $final_country);
|
||||
$data['montant_net_final'] = $this->toMoneyWithCurrency(round($request->montant, 2), $init_country, $final_country);
|
||||
break;
|
||||
case 11: // User - Retrait de carte vers cash
|
||||
if(!$simulator){
|
||||
$final_country = $walletUser->user->network->country->id;
|
||||
}
|
||||
|
||||
$plr_user_cart_cash_national = $this->getPaliers($paliers_commission_wallets, 'user_cart_cash_national');
|
||||
$plr_user_cart_cash_international = $this->getPaliers($paliers_commission_wallets, 'user_cart_cash_international');
|
||||
|
@ -2394,9 +2433,9 @@ class iLinkTransactionController extends Controller
|
|||
$frais += $fees;
|
||||
$taxe = $this->calculateTax($init_country != $final_country ? $taxesInternationales : $taxesNationales, $frais);
|
||||
$data['frais'] = round($frais + $taxe, 2);
|
||||
$data['montant_net_init'] = $request->montant;
|
||||
$data['montant_net_init'] = round($request->montant + $data['frais'], 2);
|
||||
$data['exchange_rate'] = $this->getExchangeRate($init_country, $final_country);
|
||||
$data['montant_net_final'] = $this->toMoneyWithCurrency(round($request->montant + $data['frais'], 2), $init_country, $final_country);
|
||||
$data['montant_net_final'] = $this->toMoneyWithCurrency(round($request->montant, 2), $init_country, $final_country);
|
||||
break;
|
||||
case 13: // Agent - Retrait de la carte vers cash
|
||||
$plr_customer_cart_cash_national = $this->getPaliers($paliers_commission_wallets, 'customer_cart_cash_national');
|
||||
|
@ -2485,11 +2524,18 @@ class iLinkTransactionController extends Controller
|
|||
$data['montant_net_final'] = $this->toMoneyWithCurrency($data['montant_net_init'], $init_country, $request->final_country);
|
||||
break;
|
||||
case 21: //User - Retrait de carte vers autre wallet
|
||||
|
||||
$this->validate($request, [
|
||||
'final_country' => 'required|integer|exists:countries,id',
|
||||
'id_destinataire' => 'required_without:phone_destinataire',
|
||||
'network_destinataire' => 'required|integer|min:0|not_in:0',
|
||||
]);
|
||||
|
||||
if(!$simulator){
|
||||
$this->validate($request, [
|
||||
'final_country' => 'required|integer|exists:countries,id',
|
||||
'id_destinataire' => 'required_without:phone_destinataire'
|
||||
]);
|
||||
}
|
||||
|
||||
$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);
|
||||
|
@ -2510,18 +2556,20 @@ class iLinkTransactionController extends Controller
|
|||
'payment_method' => PaymentMethod::WALLET
|
||||
]);
|
||||
} else {
|
||||
if(!$simulator){
|
||||
$destinataire = $this->verifyiLinkRecipient($request->id_destinataire, $request->final_country);
|
||||
if(!($destinataire instanceof User)){
|
||||
return $destinataire;
|
||||
}
|
||||
$data['destinataire'] = $destinataire->lastname . ' ' . $destinataire->firstname;
|
||||
}
|
||||
}
|
||||
|
||||
$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_init'] = round($request->montant + $data['frais'], 2);
|
||||
$data['montant_net_final'] = $this->toMoneyWithCurrency($request->montant, $init_country, $request->final_country);
|
||||
break;
|
||||
default:
|
||||
|
@ -2571,7 +2619,7 @@ class iLinkTransactionController extends Controller
|
|||
if (!$transaction)
|
||||
return $this->errorResponse(trans('errors.transaction_not_exist'), Response::HTTP_NOT_FOUND);
|
||||
|
||||
if (!$this->checkPassword($request->code_retrait, $transaction->encrypted_code_retrait, $transaction->code_retrait_salt))
|
||||
if (!$this->checkPassword(remove_spaces($request->code_retrait), $transaction->encrypted_code_retrait, $transaction->code_retrait_salt))
|
||||
return $this->errorResponse(trans('errors.invalid_withdrawal_code'));
|
||||
|
||||
|
||||
|
@ -2606,7 +2654,7 @@ class iLinkTransactionController extends Controller
|
|||
$data->id_document_destinataire = $identification->id_identity_document;
|
||||
// $data->user_code = $transaction->wallet_user->user->user_code;
|
||||
}
|
||||
$data->montant = $transaction->type == 11 ? $transaction->montant_net : $transaction->montant_net_final_country;
|
||||
$data->montant = $transaction->montant_net_final_country;
|
||||
unset($data->type, $data->init_country, $data->final_country, $data->id_wallet_user, $data->network_destinataire, $data->code_retrait_salt,
|
||||
$data->encrypted_code_retrait, $data->montant_net_final_country, $data->montant_net);
|
||||
|
||||
|
|
|
@ -700,4 +700,15 @@ trait Helper
|
|||
return $destination;
|
||||
}
|
||||
|
||||
|
||||
public function generateRandomString($length = 10)
|
||||
{
|
||||
$characters = '23456789abcdefghjkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class SetTownIdNullableInAgents extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('agents', function (Blueprint $table) {
|
||||
$table->integer('town_id')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('agents', function (Blueprint $table) {
|
||||
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddExchangeRateToWalletiLinkTransaction extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('wallet_ilink_transaction', function (Blueprint $table) {
|
||||
$table->string('exchange_rate')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('wallet_ilink_transaction', function (Blueprint $table) {
|
||||
$table->dropColumn('exchange_rate');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateInfosIlinkTransactionView extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::statement("
|
||||
CREATE OR REPLACE VIEW `infos_ilink_transaction` AS
|
||||
SELECT
|
||||
`wit`.`id` AS `id`,
|
||||
`wit`.`id_transaction` AS `id_transaction`,
|
||||
`wit`.`montant` AS `montant`,
|
||||
`wit`.`montant_net_final_country` AS `montant_net_final_country`,
|
||||
`wit`.`montant_net` AS `montant_net`,
|
||||
`wit`.`encrypted_code_retrait` AS `encrypted_code_retrait`,
|
||||
`wit`.`code_retrait_salt` AS `code_retrait_salt`,
|
||||
`wit`.`status_retrait` AS `status_retrait`,
|
||||
`wit`.`date_retrait` AS `date_retrait`,
|
||||
`wit`.`id_destinataire` AS `id_destinataire`,
|
||||
`wit`.`type_id_destinataire` AS `type_id_destinataire`,
|
||||
`wit`.`network_destinataire` AS `network_destinataire`,
|
||||
`wit`.`type_document_destinataire` AS `type_document_destinataire`,
|
||||
`wit`.`id_document_destinataire` AS `id_document_destinataire`,
|
||||
`wit`.`nom_destinataire` AS `nom_destinataire`,
|
||||
`wit`.`prenom_destinataire` AS `prenom_destinataire`,
|
||||
`wit`.`nom_emetteur` AS `nom_emetteur`,
|
||||
`wit`.`prenom_emetteur` AS `prenom_emetteur`,
|
||||
`wit`.`email_emetteur` AS `email_emetteur`,
|
||||
`wit`.`network_emetteur` AS `network_emetteur`,
|
||||
`wit`.`type_document_emetteur` AS `type_document_emetteur`,
|
||||
`wit`.`id_document_emetteur` AS `id_document_emetteur`,
|
||||
`wit`.`frais` AS `frais`,
|
||||
`wit`.`taxe` AS `taxe`,
|
||||
`wit`.`part_reseau_emetteur` AS `part_reseau_emetteur`,
|
||||
`wit`.`part_reseau_payeur` AS `part_reseau_payeur`,
|
||||
`wit`.`part_reseau_payeur_final_country` AS `part_reseau_payeur_final_country`,
|
||||
`wit`.`status_reseau_payeur` AS `status_reseau_payeur`,
|
||||
`wit`.`numero_carte` AS `numero_carte`,
|
||||
`wit`.`expiration_date` AS `expiration_date`,
|
||||
`wit`.`init_country` AS `init_country`,
|
||||
`wit`.`final_country` AS `final_country`,
|
||||
`wit`.`commission_banque` AS `commission_banque`,
|
||||
`wit`.`commission_ag` AS `commission_ag`,
|
||||
`wit`.`commission_sup` AS `commission_sup`,
|
||||
`wit`.`commission_hyp` AS `commission_hyp`,
|
||||
`wit`.`id_wallet_user` AS `id_wallet_user`,
|
||||
`wit`.`id_wallet_ag` AS `id_wallet_ag`,
|
||||
`wit`.`id_wallet_sup` AS `id_wallet_sup`,
|
||||
`wit`.`id_wallet_hyp` AS `id_wallet_hyp`,
|
||||
`wit`.`id_wallet_hyp_payeur` AS `id_wallet_hyp_payeur`,
|
||||
`wit`.`canceled` AS `canceled`,
|
||||
`wit`.`type` AS `type`,
|
||||
`wit`.`date` AS `date`,
|
||||
`wit`.`exchange_rate` AS `exchange_rate`,
|
||||
`wa`.`lastname` AS `agent`,
|
||||
`wa`.`codeMembre` AS `code_agent`,
|
||||
`wa`.`transactionNumber` AS `phone_agent`,
|
||||
`wa`.`codeParrain` AS `code_parrain`,
|
||||
`tit`.`type` AS `type_transaction`,
|
||||
`tit`.`nom` AS `operation_fr`,
|
||||
`tit`.`name` AS `operation_en`,
|
||||
`tit`.`acteur` AS `acteur`,
|
||||
`wu`.`lastname` AS `user`,
|
||||
`wu`.`phone` AS `user_phone`,
|
||||
`wu`.`user_code` AS `user_code`,
|
||||
`cc`.`currency_code` AS `init_currency`,
|
||||
`cc2`.`currency_code` AS `final_currency`,
|
||||
`cc`.`name` AS `pays_init`,
|
||||
`cc2`.`name` AS `pays_final`,
|
||||
`wu_dest`.`phone` AS `destinataire_phone`,
|
||||
`wu_dest`.`lastname` AS `destinataire_name`
|
||||
FROM
|
||||
((((((`wallet_ilink_transaction` `wit`
|
||||
JOIN `type_ilink_transaction` `tit` ON ((`tit`.`id` = `wit`.`type`)))
|
||||
LEFT JOIN `wallet_agent` `wa` ON ((`wa`.`wallet_id` = `wit`.`id_wallet_ag`)))
|
||||
LEFT JOIN `wallet_user` `wu` ON ((`wu`.`id_wallet` = `wit`.`id_wallet_user`)))
|
||||
LEFT JOIN `wallet_user` `wu_dest` ON ((CONVERT( `wu_dest`.`user_code` USING UTF8MB4) = `wit`.`id_destinataire`)))
|
||||
LEFT JOIN `countries_currencies` `cc` ON ((`wit`.`init_country` = `cc`.`id`)))
|
||||
LEFT JOIN `countries_currencies` `cc2` ON ((`wit`.`final_country` = `cc2`.`id`)))
|
||||
ORDER BY `wit`.`date` DESC
|
||||
");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -123,22 +123,22 @@ Transaction information:
|
|||
- Number: :id_transaction
|
||||
- Amount: :amount
|
||||
- Fees and taxes: :fees
|
||||
- Departure country: :init_country
|
||||
- Net amount: :net_init
|
||||
- Card issuing country: :init_country
|
||||
- Amount incl. VAT: :net_init
|
||||
- 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
|
||||
- Transaction amount: :amount
|
||||
- Fees and taxes: :fees
|
||||
- Departure country: :init_country
|
||||
- Net amount: :net_init
|
||||
- Card issuing country: :init_country
|
||||
- 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"
|
||||
];
|
||||
|
|
|
@ -123,22 +123,22 @@ Informations de la transaction :
|
|||
- Numéro : :id_transaction
|
||||
- Montant : :amount
|
||||
- Frais et taxes : :fees
|
||||
- Pays de départ : :init_country
|
||||
- Montant net : :net_init
|
||||
- Pays d'émission de la carte : :init_country
|
||||
- Montant TTC : :net_init
|
||||
- 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
|
||||
- Montant de la transaction : :amount
|
||||
- Frais et taxes : :fees
|
||||
- Pays de départ : :init_country
|
||||
- Montant net : :net_init
|
||||
- Pays d'émission de la carte : :init_country
|
||||
- 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",
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue