Files
clinicpro/migrations/Version20260715075904.php
hamedandClaude Opus 4.8 b459d082a4 feat: port payment management tab from tauri to admin dashboard
Add per-clinic payment methods (bank accounts + POS/card-reader devices)
under the "مدیریت پرداخت" settings tab at /admin/my-financial, ported from
clinic-pro-tauri's mock-only PaymentManagement tab into a real persisted
feature. These records are referenceable (by uuid) from patient invoices to
record which method a service payment was made with.

Backend (new src/PaymentMethod domain):
- BankAccount + Pos entities, repositories, PaymentMethodService (validation,
  ownership scoping, create/update/toggle logic).
- Thin PaymentMethodController exposing /api/v1/my/payment-methods/{bank-accounts,pos}
  (GET/POST/PUT + PATCH .../status), guarded to clinic/doctor/secretary/admin.
- Migration for bank_accounts + pos_devices tables.
- Functional tests (success + validation/404/403 + empty boundaries).
- docs/api/payment-method.md.

Frontend:
- Replace MyFinancialPage content with the payment-management UI (two tabs,
  tables, add/edit modals, status toggle) using the admin design system.
- usePaymentMethods hook (TanStack Query) + presentational components.
- Update page test to cover tabs, data, empty state and the add modal.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-15 11:39:32 +03:30

38 lines
2.2 KiB
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20260715075904 extends AbstractMigration
{
public function getDescription(): string
{
return 'Create bank_accounts and pos_devices tables (clinic payment methods)';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE bank_accounts (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, bank_name VARCHAR(100) NOT NULL, card_number VARCHAR(32) DEFAULT NULL, account_number VARCHAR(64) NOT NULL, shaba_number VARCHAR(34) DEFAULT NULL, is_active TINYINT NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX UNIQ_FB88842BD17F50A6 (uuid), INDEX idx_bank_accounts_user (user_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('CREATE TABLE pos_devices (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, bank_name VARCHAR(100) NOT NULL, serial_number VARCHAR(64) DEFAULT NULL, terminal_number VARCHAR(64) NOT NULL, account_number VARCHAR(64) DEFAULT NULL, is_active TINYINT NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX UNIQ_7C0A337CD17F50A6 (uuid), INDEX idx_pos_devices_user (user_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('ALTER TABLE bank_accounts ADD CONSTRAINT FK_FB88842BA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE RESTRICT');
$this->addSql('ALTER TABLE pos_devices ADD CONSTRAINT FK_7C0A337CA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE RESTRICT');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE bank_accounts DROP FOREIGN KEY FK_FB88842BA76ED395');
$this->addSql('ALTER TABLE pos_devices DROP FOREIGN KEY FK_7C0A337CA76ED395');
$this->addSql('DROP TABLE bank_accounts');
$this->addSql('DROP TABLE pos_devices');
}
}