The payment-history indexes, the payment-logs order/step index and the
visa_master_order_actions table now live in init.{up,down}.sql, so the
folder is back to a single up/down pair. Databases that already ran the
removed migrations need `migrate force 20260702125108` once.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every create, update and delete of a visa/master or sber order is now
recorded in visa_master_order_actions: who did it, finished or failed
(with the exception), and for an update only the columns that changed -
original before, changes after. Marking an order paid when a payment is
finalized is recorded the same way, with no user when the GBÜS callback
did it.
Actions are written in the transaction that changes the order, so one is
on record exactly when its change is; failed ones are written after the
rollback with the values they attempted. The payment finalize records
after its commit instead, so recording never holds up a payment GBÜS has
already taken. Updates that change nothing and creates that fail (no
order to attach to) are not recorded.
GET /visa-master-payment-orders/{id}/actions lists them, newest first;
GET /visa-master-payment-orders/{id}/actions/{actionId} adds original,
changes and exception. Both are staff-only and order-scoped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
To match the old online payment history page:
- apiClientName: billing_visa_master_username / billing_sber_username
- formUrl falls back to the logged register.do response, so finalized
attempts keep it; successUrl is the returnUrl logged with register.do
- callbackStatus ("received") and callbackAt from the attempt's first
callback_received log
- index visa_master_payment_logs (order_id, step) for those lookups
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- GET /payment-history/payments/{id}: single payment attempt with the raw
gateway_response (last HALKBANK JSON) for the "storage" icon modal
- GET /payment-history: sort (id/created_at/status/amount) and order
(asc/desc, default desc) query params
- GET /payment-history/{id}: order logs now newest first
- index on visa_master_order_payments (gateway_status, id DESC)
- regenerate swagger docs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Web users may only CRUD their own records, operators stay in assigned branches, and admin/manager/superadmin keep full access.
Co-authored-by: Cursor <cursoragent@cursor.com>
Replace permission_user with permission_role, enforce RBAC on admin routes, and limit operators to their assigned branches.
Co-authored-by: Cursor <cursoragent@cursor.com>
Fold follow-up migrations into init, expose GET /users/clients and /users/staff, and refresh seed data.
Co-authored-by: Cursor <cursoragent@cursor.com>
Expose GET /loan-paid-off-letters/branches?province_id= for form pickers, require loans.user_id, and proxy the Vite frontend under /online/.
Co-authored-by: Cursor <cursoragent@cursor.com>
Expose distinct regions and etraps-by-region under provinces and branches, and seed real etraps per welayat.
Co-authored-by: Cursor <cursoragent@cursor.com>
Introduces a branch_user join table linking branches to users, plus
create/delete API endpoints under the auth module for managing branch
assignments. The create response includes the branch's localized name
via a join. Regenerated swagger docs to include the new endpoints.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Rename loan_required_documents to loan_order_required_docs, simplify document fields to name/value, and map loan_types columns to name, maturity, notes, and active.
Co-authored-by: Cursor <cursoragent@cursor.com>
Rename users table fields and loan documents table, expand branch billing credentials, switch to /api/admin prefix, refactor auth endpoints, replace PATCH with PUT for status updates, remove file upload APIs, and regenerate Swagger with ordered tags.
Co-authored-by: Cursor <cursoragent@cursor.com>