feat(migrations): add national_code_verified flag to users and normalize bank_account representation
- Added a new column `national_code_verified` to the `users` table. - Normalized the `bank_account` field in the `representations` table from a single object to an array of IBANs with a default `verified` status of false. feat(ApiIrService): implement identity verification client for api.ir - Created `ApiIrService` to handle identity verification via api.ir. - Implemented methods for matching national code with mobile and IBAN with national code and birth date. - Added error handling and logging for external API requests.
This commit is contained in:
@@ -35,6 +35,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
#[ORM\Column(name: 'national_code', type: 'string', length: 10, nullable: true)]
|
||||
private ?string $nationalCode = null;
|
||||
|
||||
#[ORM\Column(name: 'national_code_verified', type: 'boolean')]
|
||||
private bool $nationalCodeVerified = false;
|
||||
|
||||
#[ORM\Column(type: 'json')]
|
||||
private array $roles = ['ROLE_USER'];
|
||||
|
||||
@@ -61,6 +64,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
public function getEmail(): ?string { return $this->email; }
|
||||
public function getRealName(): ?string { return $this->realName; }
|
||||
public function getNationalCode(): ?string { return $this->nationalCode; }
|
||||
public function isNationalCodeVerified(): bool { return $this->nationalCodeVerified; }
|
||||
public function getStatus(): int { return $this->status; }
|
||||
public function getCreatedAt(): int { return $this->createdAt; }
|
||||
|
||||
@@ -81,7 +85,17 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
|
||||
public function setEmail(?string $email): self { $this->email = $email; return $this; }
|
||||
public function setRealName(?string $name): self { $this->realName = $name; $this->updatedAt = time(); return $this; }
|
||||
public function setNationalCode(?string $code): self { $this->nationalCode = $code !== null && $code !== '' ? $code : null; $this->updatedAt = time(); return $this; }
|
||||
public function setNationalCode(?string $code): self
|
||||
{
|
||||
$normalized = $code !== null && $code !== '' ? $code : null;
|
||||
if ($normalized !== $this->nationalCode) {
|
||||
$this->nationalCodeVerified = false; // تغییر کد ملی، تأیید قبلی را باطل میکند
|
||||
}
|
||||
$this->nationalCode = $normalized;
|
||||
$this->updatedAt = time();
|
||||
return $this;
|
||||
}
|
||||
public function setNationalCodeVerified(bool $v): self { $this->nationalCodeVerified = $v; $this->updatedAt = time(); return $this; }
|
||||
public function setPasswordHash(?string $hash): self { $this->passwordHash = $hash; $this->updatedAt = time(); return $this; }
|
||||
public function setRoles(array $roles): self { $this->roles = $roles; $this->updatedAt = time(); return $this; }
|
||||
public function setStatus(int $status): self { $this->status = $status; $this->updatedAt = time(); return $this; }
|
||||
|
||||
Reference in New Issue
Block a user