fix: missing recipient while doing ilink world transaction v3

This commit is contained in:
Djery-Tom 2023-10-04 13:59:47 +01:00
parent d7fde1e98c
commit dc90b670fb
1 changed files with 5 additions and 8 deletions

View File

@ -1820,8 +1820,8 @@ class iLinkTransactionController extends Controller
$transaction->numero_carte = $user->numero_carte;
} else {
$this->validate($request, [
'nom_destinataire' => 'required',
'prenom_destinataire' => 'required',
'nom_destinataire' => 'nullable|string',
'prenom_destinataire' => 'nullable|string',
'numero_carte' => 'required',
'expiration_date' => 'required|date_format:m/y|after_or_equal:today',
'customer_name' => 'nullable|string',
@ -1919,8 +1919,8 @@ class iLinkTransactionController extends Controller
'payment_method' => 'CARD',
'customer_id' => $user->id,
'customer_email' => $user->email,
'customer_name' => $withLinkedCard ? $identification->firstname : $request->input('customer_name', $destinataire?->firstname ?? $identification?->firstname),
'customer_surname' => $withLinkedCard ? $identification->lastname : $request->input('customer_surname', $destinataire?->lastname ?? $identification?->lastname ),
'customer_name' => $withLinkedCard ? $identification->firstname : $request->input('customer_name'),
'customer_surname' => $withLinkedCard ? $identification->lastname : $request->input('customer_surname'),
'customer_address' => $withLinkedCard ? $identification->town : $request->input('customer_address'),
'customer_city' => $withLinkedCard ? $identification->town : $request->input('customer_city'),
'customer_country' => $country->code_country,
@ -1933,8 +1933,7 @@ class iLinkTransactionController extends Controller
// Envoyer l'argent au destinataire
if ($configPayeur->type == 'ilink') {
$destinataire = User::where($transaction->type_id_destinataire, $request->id_destinataire)->first();
if ($destinataire) { // Si c'est un wallet ilink
if (!empty($destinataire)) { // Si c'est un wallet ilink
$transaction->nom_destinataire = $destinataire->lastname;
$transaction->prenom_destinataire = $destinataire->firstname;
if ($destinataire->network->country->id == $request->final_country) {
@ -1945,8 +1944,6 @@ class iLinkTransactionController extends Controller
$country = Country::findOrFail($request->final_country);
throw new Exception(trans('errors.wallet_country_not_match', ['country' => $country->name]), 500);
}
} else {
throw new Exception(trans('errors.wallet_not_defined'), 500);
}
//Mise a jour des comissions et compensation