Files
GuwandykA 11e1fa4972
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled
visamaster: record order actions for the "Ammallar" table
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>
2026-10-25 22:39:42 +05:00

15 lines
610 B
Go

package visamasteractions
import "context"
type Repository interface {
// OwnerInfo returns the order's owner/branch so the handler can run
// rbac.GuardOrder without importing cards/visamaster. Deleted orders
// are included: their actions stay readable.
OwnerInfo(ctx context.Context, orderID int64) (userID *int64, branchID int64, err error)
List(ctx context.Context, filter ListFilter) (ListOrderActionDTO, error)
// GetByID returns orderID's action actionID - pgx.ErrNoRows if it
// belongs to another order.
GetByID(ctx context.Context, orderID, actionID int64) (OrderActionDetailDTO, error)
}