| 
									
										
										
										
											2020-06-19 13:48:27 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Created by Reliese Model. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace App\Models; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use Carbon\Carbon; | 
					
						
							|  |  |  | use Illuminate\Database\Eloquent\Model; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Class WalletIlinkTransaction | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @property int $id | 
					
						
							|  |  |  |  * @property float $montant | 
					
						
							| 
									
										
										
										
											2020-06-19 19:31:32 +00:00
										 |  |  |  * @property float $montant_depot | 
					
						
							| 
									
										
										
										
											2020-06-19 13:48:27 +00:00
										 |  |  |  * @property float $montant_retrait | 
					
						
							| 
									
										
										
										
											2020-06-19 18:33:10 +00:00
										 |  |  |  * @property string $encrypted_code_retrait | 
					
						
							|  |  |  |  * @property string $code_retrait_salt | 
					
						
							| 
									
										
										
										
											2020-06-19 13:48:27 +00:00
										 |  |  |  * @property int $status_retrait | 
					
						
							| 
									
										
										
										
											2020-06-20 15:08:13 +00:00
										 |  |  |  * @property Carbon $date_retrait | 
					
						
							| 
									
										
										
										
											2020-06-19 13:48:27 +00:00
										 |  |  |  * @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 | 
					
						
							| 
									
										
										
										
											2020-06-19 18:33:10 +00:00
										 |  |  |  * @property string $email_emetteur | 
					
						
							| 
									
										
										
										
											2020-06-21 21:49:24 +00:00
										 |  |  |  * @property int $network_emetteur | 
					
						
							| 
									
										
										
										
											2020-06-19 18:33:10 +00:00
										 |  |  |  * @property string $type_document_emetteur | 
					
						
							| 
									
										
										
										
											2020-06-19 19:31:32 +00:00
										 |  |  |  * @property string $id_document_emetteur | 
					
						
							| 
									
										
										
										
											2020-06-19 13:48:27 +00:00
										 |  |  |  * @property float $frais | 
					
						
							|  |  |  |  * @property float $taxe | 
					
						
							| 
									
										
										
										
											2020-06-21 21:49:24 +00:00
										 |  |  |  * @property float $part_reseau_emetteur | 
					
						
							|  |  |  |  * @property float $part_reseau_payeur | 
					
						
							| 
									
										
										
										
											2020-06-19 13:48:27 +00:00
										 |  |  |  * @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 int $id_wallet_user | 
					
						
							|  |  |  |  * @property int $id_wallet_ag | 
					
						
							|  |  |  |  * @property int $id_wallet_sup | 
					
						
							|  |  |  |  * @property int $id_wallet_hyp | 
					
						
							|  |  |  |  * @property int $canceled | 
					
						
							|  |  |  |  * @property int $type | 
					
						
							|  |  |  |  * @property Carbon $date | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @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 | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-06-21 21:49:24 +00:00
										 |  |  |     protected $table = 'wallet_ilink_transaction'; | 
					
						
							|  |  |  |     public $timestamps = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     protected $casts = [ | 
					
						
							|  |  |  |         'montant' => 'float', | 
					
						
							|  |  |  |         'montant_depot' => 'float', | 
					
						
							|  |  |  |         'montant_retrait' => 'float', | 
					
						
							|  |  |  |         'status_retrait' => 'int', | 
					
						
							|  |  |  |         'network_destinataire' => 'int', | 
					
						
							|  |  |  |         'network_emetteur' => 'int', | 
					
						
							|  |  |  |         'frais' => 'float', | 
					
						
							|  |  |  |         'taxe' => 'float', | 
					
						
							|  |  |  |         'part_reseau_emetteur' => 'float', | 
					
						
							|  |  |  |         'part_reseau_payeur' => 'float', | 
					
						
							|  |  |  |         'init_country' => 'int', | 
					
						
							|  |  |  |         'final_country' => 'int', | 
					
						
							|  |  |  |         'commission_banque' => 'float', | 
					
						
							|  |  |  |         'commission_ag' => 'float', | 
					
						
							|  |  |  |         'commission_sup' => 'float', | 
					
						
							|  |  |  |         'commission_hyp' => 'float', | 
					
						
							|  |  |  |         'id_wallet_user' => 'int', | 
					
						
							|  |  |  |         'id_wallet_ag' => 'int', | 
					
						
							|  |  |  |         'id_wallet_sup' => 'int', | 
					
						
							|  |  |  |         'id_wallet_hyp' => 'int', | 
					
						
							|  |  |  |         'canceled' => 'int', | 
					
						
							|  |  |  |         'type' => 'int' | 
					
						
							|  |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     protected $dates = [ | 
					
						
							| 
									
										
										
										
											2020-06-20 15:08:13 +00:00
										 |  |  |         'date_retrait', | 
					
						
							| 
									
										
										
										
											2020-06-21 21:49:24 +00:00
										 |  |  |         'expiration_date', | 
					
						
							|  |  |  |         'date' | 
					
						
							|  |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     protected $fillable = [ | 
					
						
							|  |  |  |         'montant', | 
					
						
							|  |  |  |         'montant_depot', | 
					
						
							|  |  |  |         'montant_retrait', | 
					
						
							|  |  |  |         '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', | 
					
						
							|  |  |  |         'numero_carte', | 
					
						
							|  |  |  |         'expiration_date', | 
					
						
							|  |  |  |         'init_country', | 
					
						
							|  |  |  |         'final_country', | 
					
						
							|  |  |  |         'commission_banque', | 
					
						
							|  |  |  |         'commission_ag', | 
					
						
							|  |  |  |         'commission_sup', | 
					
						
							|  |  |  |         'commission_hyp', | 
					
						
							|  |  |  |         'id_wallet_user', | 
					
						
							|  |  |  |         'id_wallet_ag', | 
					
						
							|  |  |  |         'id_wallet_sup', | 
					
						
							|  |  |  |         'id_wallet_hyp', | 
					
						
							|  |  |  |         'canceled', | 
					
						
							|  |  |  |         'type', | 
					
						
							|  |  |  |         'date' | 
					
						
							|  |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function country() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->belongsTo(Country::class, 'final_country'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function wallet() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->belongsTo(Wallet::class, 'id_wallet_sup'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function wallets_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'); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-06-19 13:48:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-19 19:31:32 +00:00
										 |  |  |     // Regles de validation
 | 
					
						
							| 
									
										
										
										
											2020-06-19 13:48:27 +00:00
										 |  |  |     //Envoi de cash vers wallet iLink
 | 
					
						
							| 
									
										
										
										
											2020-06-20 15:08:13 +00:00
										 |  |  |     public function cash_wallet_rules() | 
					
						
							| 
									
										
										
										
											2020-06-19 13:48:27 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         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_if:facade,front|size:3', | 
					
						
							|  |  |  |             'expiration_date'=>'required_if:facade,front|date_format:m/y|after_or_equal:today', | 
					
						
							|  |  |  |         ]; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-06-19 18:33:10 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     public function cash_cash_rules() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return [ | 
					
						
							|  |  |  |             'init_country' =>'required|integer|min:0|not_in:0', | 
					
						
							|  |  |  |             'final_country' =>'required|integer|min:0|not_in:0', | 
					
						
							|  |  |  |             'nom_emetteur'=>'required', | 
					
						
							|  |  |  |             'prenom_emetteur'=>'required', | 
					
						
							|  |  |  |             'type_document_emetteur'=>'required', | 
					
						
							|  |  |  |             'id_document_emetteur'=>'required', | 
					
						
							|  |  |  |             'nom_destinataire'=>'required', | 
					
						
							|  |  |  |             'prenom_destinataire'=>'required', | 
					
						
							|  |  |  |             'type_document_destinataire'=>'required', | 
					
						
							|  |  |  |             'id_document_destinataire'=>'required', | 
					
						
							| 
									
										
										
										
											2020-06-20 15:08:13 +00:00
										 |  |  |             'id_destinataire' => 'required', | 
					
						
							|  |  |  |         ]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function remove_cash_rules(){ | 
					
						
							|  |  |  |         return [ | 
					
						
							|  |  |  |             'id_transaction' =>'required|integer|min:0|not_in:0', | 
					
						
							|  |  |  |             'code_retrait' =>'required|size:16', | 
					
						
							| 
									
										
										
										
											2020-06-21 21:49:24 +00:00
										 |  |  |         ]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function send_wallet_wallet_rules(){ | 
					
						
							|  |  |  |         return [ | 
					
						
							|  |  |  |             'init_country' =>'required|integer|min:0|not_in:0', | 
					
						
							|  |  |  |             'final_country' =>'required|integer|min:0|not_in:0', | 
					
						
							| 
									
										
										
										
											2020-06-22 15:09:26 +00:00
										 |  |  |             'type_document_destinataire'=>'required', | 
					
						
							|  |  |  |             'id_document_destinataire'=>'required', | 
					
						
							|  |  |  |             'id_destinataire' =>'required_without:phone_destinataire', | 
					
						
							| 
									
										
										
										
											2020-06-21 21:49:24 +00:00
										 |  |  |             'network_destinataire'=>'required|integer|min:0|not_in:0', | 
					
						
							| 
									
										
										
										
											2020-06-19 18:33:10 +00:00
										 |  |  |         ]; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-06-19 13:48:27 +00:00
										 |  |  | } |