263 lines
7.3 KiB
PHP
263 lines
7.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class WalletIlinkTransaction
|
|
*
|
|
* @property int $id
|
|
* @property string $id_transaction
|
|
* @property float $montant
|
|
* @property float $montant_net_final_country
|
|
* @property float $montant_net
|
|
* @property string $encrypted_code_retrait
|
|
* @property string $code_retrait_salt
|
|
* @property int $status_retrait
|
|
* @property Carbon $date_retrait
|
|
* @property string $id_destinataire
|
|
* @property string $type_id_destinataire
|
|
* @property int $network_destinataire
|
|
* @property string $type_document_destinataire
|
|
* @property string $id_document_destinataire
|
|
* @property string $nom_destinataire
|
|
* @property string $prenom_destinataire
|
|
* @property string $nom_emetteur
|
|
* @property string $prenom_emetteur
|
|
* @property string $email_emetteur
|
|
* @property int $network_emetteur
|
|
* @property string $type_document_emetteur
|
|
* @property string $id_document_emetteur
|
|
* @property float $frais
|
|
* @property float $taxe
|
|
* @property float $part_reseau_emetteur
|
|
* @property float $part_reseau_payeur
|
|
* @property float $part_reseau_payeur_final_country
|
|
* @property string status_reseau_payeur
|
|
* @property string $numero_carte
|
|
* @property Carbon $expiration_date
|
|
* @property int $init_country
|
|
* @property int $final_country
|
|
* @property float $commission_banque
|
|
* @property float $commission_ag
|
|
* @property float $commission_sup
|
|
* @property float $commission_hyp
|
|
* @property float commission_hyp_final_country
|
|
* @property int $id_wallet_user
|
|
* @property int $id_wallet_ag
|
|
* @property int $id_wallet_sup
|
|
* @property int $id_wallet_hyp
|
|
* @property int $id_wallet_hyp_payeur
|
|
* @property int $canceled
|
|
* @property int $type
|
|
* @property Carbon $date
|
|
* @property string pspReference
|
|
* @property bool $from_network_emetteur
|
|
* @property string|null $id_transaction_network_emetteur
|
|
* @property float $montant_commission
|
|
*
|
|
* @property Country $country
|
|
* @property Wallet $wallet
|
|
* @property WalletsUser $wallets_user
|
|
* @property TypeIlinkTransaction $type_ilink_transaction
|
|
* @property Network $network
|
|
*
|
|
* @package App\Models
|
|
*/
|
|
class WalletIlinkTransaction extends Model
|
|
{
|
|
protected $table = 'wallet_ilink_transaction';
|
|
public $timestamps = false;
|
|
|
|
protected $casts = [
|
|
'montant' => 'float',
|
|
'montant_net_final_country' => 'float',
|
|
'montant_net' => 'float',
|
|
'status_retrait' => 'int',
|
|
'network_destinataire' => 'int',
|
|
'network_emetteur' => 'int',
|
|
'frais' => 'float',
|
|
'taxe' => 'float',
|
|
'part_reseau_emetteur' => 'float',
|
|
'part_reseau_payeur' => 'float',
|
|
'part_reseau_payeur_final_country' => 'float',
|
|
'init_country' => 'int',
|
|
'final_country' => 'int',
|
|
'commission_banque' => 'float',
|
|
'commission_ag' => 'float',
|
|
'commission_sup' => 'float',
|
|
'commission_hyp' => 'float',
|
|
'commission_hyp_final_country' => 'float',
|
|
'id_wallet_user' => 'int',
|
|
'id_wallet_ag' => 'int',
|
|
'id_wallet_sup' => 'int',
|
|
'id_wallet_hyp' => 'int',
|
|
'id_wallet_hyp_payeur' => 'int',
|
|
'canceled' => 'int',
|
|
'type' => 'int',
|
|
'from_network_emetteur' => 'bool',
|
|
'montant_commission' => 'float'
|
|
];
|
|
|
|
protected $dates = [
|
|
'date_retrait',
|
|
'expiration_date',
|
|
'date'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'id_transaction',
|
|
'montant',
|
|
'montant_net_final_country',
|
|
'montant_net',
|
|
'encrypted_code_retrait',
|
|
'code_retrait_salt',
|
|
'status_retrait',
|
|
'date_retrait',
|
|
'id_destinataire',
|
|
'type_id_destinataire',
|
|
'network_destinataire',
|
|
'type_document_destinataire',
|
|
'id_document_destinataire',
|
|
'nom_destinataire',
|
|
'prenom_destinataire',
|
|
'nom_emetteur',
|
|
'prenom_emetteur',
|
|
'email_emetteur',
|
|
'network_emetteur',
|
|
'type_document_emetteur',
|
|
'id_document_emetteur',
|
|
'frais',
|
|
'taxe',
|
|
'part_reseau_emetteur',
|
|
'part_reseau_payeur',
|
|
'part_reseau_payeur_final_country',
|
|
'status_reseau_payeur',
|
|
'numero_carte',
|
|
'expiration_date',
|
|
'init_country',
|
|
'final_country',
|
|
'commission_banque',
|
|
'commission_ag',
|
|
'commission_sup',
|
|
'commission_hyp',
|
|
'commission_hyp_final_country',
|
|
'id_wallet_user',
|
|
'id_wallet_ag',
|
|
'id_wallet_sup',
|
|
'id_wallet_hyp',
|
|
'id_wallet_hyp_payeur',
|
|
'canceled',
|
|
'type',
|
|
'date',
|
|
'pspReference',
|
|
'from_network_emetteur',
|
|
'id_transaction_network_emetteur',
|
|
'montant_commission'
|
|
];
|
|
|
|
public function country()
|
|
{
|
|
return $this->belongsTo(Country::class, 'final_country');
|
|
}
|
|
|
|
public function wallet()
|
|
{
|
|
return $this->belongsTo(Wallet::class, 'id_wallet_hyp_payeur');
|
|
}
|
|
|
|
public function wallet_user()
|
|
{
|
|
return $this->belongsTo(WalletsUser::class, 'id_wallet_user');
|
|
}
|
|
|
|
public function type_ilink_transaction()
|
|
{
|
|
return $this->belongsTo(TypeIlinkTransaction::class, 'type');
|
|
}
|
|
|
|
public function network()
|
|
{
|
|
return $this->belongsTo(Network::class, 'network_emetteur');
|
|
}
|
|
|
|
// Regles de validation
|
|
//Envoi de cash vers wallet iLink
|
|
public function cash_wallet_rules()
|
|
{
|
|
return [
|
|
'user_code'=>'required',
|
|
// 'init_country' =>'required|integer|min:0|not_in:0',
|
|
// 'final_country' =>'required|integer|min:0|not_in:0',
|
|
];
|
|
}
|
|
|
|
public function card_rules()
|
|
{
|
|
return [
|
|
'numero_carte'=>'required',
|
|
'cvv'=>'required|size:3',
|
|
'expiration_date'=>'required|date_format:m/y|after_or_equal:today',
|
|
];
|
|
}
|
|
|
|
public function user_card_rules()
|
|
{
|
|
return [
|
|
'cvv'=>'required|size:3',
|
|
];
|
|
}
|
|
|
|
public function cash_cash_rules()
|
|
{
|
|
return [
|
|
'final_country' =>'required|integer|min:0|not_in:0',
|
|
'network_destinataire' => 'required|integer|min:0|not_in:0',
|
|
'nom_emetteur'=>'required',
|
|
'prenom_emetteur'=>'required',
|
|
'type_document_emetteur'=>'required',
|
|
'id_document_emetteur'=>'required',
|
|
'email_emetteur' => 'required',
|
|
'nom_destinataire'=>'required',
|
|
'prenom_destinataire'=>'required',
|
|
'type_document_destinataire'=>'required',
|
|
// 'id_document_destinataire'=>'required'
|
|
];
|
|
}
|
|
|
|
public function remove_cash_rules(){
|
|
return [
|
|
'id_transaction' =>'required',
|
|
'code_retrait' =>'required|size:16',
|
|
];
|
|
}
|
|
/// User Operation rules
|
|
public function send_wallet_wallet_rules(){
|
|
return [
|
|
'final_country' =>'required|integer|min:0|not_in:0',
|
|
'type_document_destinataire'=>'required',
|
|
// 'id_document_destinataire'=>'required',
|
|
'id_destinataire' =>'required_without:phone_destinataire',
|
|
'network_destinataire'=>'required|integer|min:0|not_in:0',
|
|
];
|
|
}
|
|
|
|
public function send_wallet_cash_rules(){
|
|
return [
|
|
'final_country' =>'required|integer|min:0|not_in:0',
|
|
'nom_destinataire'=>'required',
|
|
'prenom_destinataire'=>'required',
|
|
'type_document_destinataire'=>'required',
|
|
// 'id_document_destinataire'=>'required',
|
|
'id_destinataire' =>'required_without:phone_destinataire',
|
|
'network_destinataire'=>'required|integer|min:0|not_in:0',
|
|
];
|
|
}
|
|
}
|