Monobank payment settings
Purpose
TBD by human
Identity & key fields
- Primary key:
id(uuid, defaultgen_random_uuid()). token(text, NOT NULL).paymentId(uuid, NOT NULL, UNIQUE, FK →payments.settings.id, on-delete cascade).
business meaning: TBD by human
Invariants
paymentIdis UNIQUE → one Monobank credential row per payment-settings row (enforced in tktspace-backend/libs/shared/data-access-db/src/lib/schema/payments.schema.ts).paymentIdON DELETE CASCADE (enforced in tktspace-backend/libs/shared/data-access-db/src/lib/schema/payments.schema.ts).tokenNOT NULL (enforced in tktspace-backend/libs/shared/data-access-db/src/lib/schema/payments.schema.ts).
business invariants: TBD by human
Lifecycle
No explicit lifecycle.
Relationships
- Payment settings (ENT-036) —
paymentId→payments.settings.id, UNIQUE, on-delete cascade. 1:1.
API surfaces
| Surface | Exposed | Notes |
|---|---|---|
| client | no — secret token | — |
| business | yes — managed via payments-admin module | Swagger UI |
| super-admin | no | — |
Known gotchas / open questions
- Stores
tokenin plaintext text — encryption-at-rest TBD by infra. - Note that
company_subscriptions.mono_wallet_idis a separate Monobank concept (saved-card token for auto-renewal on the platform side); the token here is the company’s merchant API token.