fix: wrong displayed amounts while doing transaction User by card
This commit is contained in:
parent
b653f158d6
commit
03ea53764d
|
@ -760,9 +760,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);
|
||||
|
||||
$identification = Identification::where('id_user', $user->id)->first();
|
||||
$countryCurrency = CountriesCurrency::findOrFail($init_country);
|
||||
|
@ -773,7 +773,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' => $this->toMoneyAmount($transaction->montant_net, $init_country, $final_country),
|
||||
'currency' => $countryCurrency->currency_code,
|
||||
'payment_method' => 'CARD',
|
||||
'customer_id' => $user->id,
|
||||
|
@ -804,7 +804,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);
|
||||
|
@ -843,9 +843,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();
|
||||
|
@ -857,7 +857,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' => $this->toMoneyAmount($transaction->montant_net, $init_country, $final_country),
|
||||
'currency' => $countryCurrency->currency_code,
|
||||
'payment_method' => 'CARD',
|
||||
'customer_id' => $user->id,
|
||||
|
@ -922,7 +922,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;
|
||||
|
@ -2144,7 +2144,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) {
|
||||
|
@ -2378,9 +2378,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'] = $request->montant + $data['frais'];
|
||||
$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
|
||||
$final_country = $walletUser->user->network->country->id;
|
||||
|
@ -2397,9 +2397,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'] = $request->montant + $data['frais'];
|
||||
$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');
|
||||
|
@ -2609,7 +2609,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);
|
||||
|
||||
|
|
|
@ -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,8 +123,8 @@ 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
|
||||
|
@ -134,8 +134,8 @@ 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,
|
||||
|
|
|
@ -123,8 +123,8 @@ 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
|
||||
|
@ -134,8 +134,8 @@ 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,
|
||||
|
|
Loading…
Reference in New Issue