uuid = Uuid::v4()->toRfc4122(); $this->user = $user; $this->amountRials = $amountRials; $this->bankAccount = $bankAccount; $this->createdAt = time(); $this->updatedAt = time(); } public function getId(): ?int { return $this->id; } public function getUuid(): string { return $this->uuid; } public function getUser(): User { return $this->user; } public function getAmountRials(): int { return $this->amountRials; } public function getStatus(): string { return $this->status; } public function getBankAccount(): ?array { return $this->bankAccount; } public function getAdminNote(): ?string { return $this->adminNote; } public function getReceipt(): ?string { return $this->receipt; } public function setReceipt(?string $receipt): self { $this->receipt = $receipt; $this->updatedAt = time(); return $this; } public function approve(int $adminUserId, ?string $note = null): self { $this->status = self::STATUS_APPROVED; $this->reviewedBy = $adminUserId; $this->reviewedAt = time(); $this->adminNote = $note; $this->updatedAt = time(); return $this; } public function reject(int $adminUserId, string $note): self { $this->status = self::STATUS_REJECTED; $this->reviewedBy = $adminUserId; $this->reviewedAt = time(); $this->adminNote = $note; $this->updatedAt = time(); return $this; } public function markPaid(?string $receipt = null): self { $this->status = self::STATUS_PAID; if ($receipt !== null) $this->receipt = $receipt; $this->updatedAt = time(); return $this; } public function toArray(): array { return [ 'uuid' => $this->uuid, 'amount_rials' => $this->amountRials, 'status' => $this->status, 'bank_account' => $this->bankAccount, 'admin_note' => $this->adminNote, 'receipt' => $this->receipt, 'reviewed_at' => $this->reviewedAt, 'created_at' => $this->createdAt, ]; } }