MngProcessManualCashierTransaction¶
Processes a manual Cashier transaction.
For manual deposits Cashier posts OP_BALANCE_IN. For manual withdrawals
Cashier posts OP_BALANCE_OUT. The command records approved_by,
approved_time, processed_by, and processed_time on the transaction. The
full transaction response fields are listed in
MngGetCashierTransaction.
Before submitting the balance operation, Cashier durably records the
transaction as status 11 (processing_ledger) and creates a pending linked
balance-operation record. A successful result changes the transaction to 3
(credited) for deposits or 10 (completed) for withdrawals. A rejected
ledger result changes it to 4 (credit_failed) or 5 (failed).
Calling this command for a transaction already in status 3, 10, or 11
returns its existing transaction without submitting another balance
operation. After restart, Cashier reconciles a durable pending operation against
the existing finance trade; it never resubmits an uncertain operation. If the
command returns a server error after status 11 was stored, inspect the
transaction and balance_operations using
MngGetCashierTransaction before taking
further action.
A new processing attempt is allowed after a definitive failed or
credit_failed result only when the linked operation is no longer pending,
submitted, or done. Check the operation record first; do not treat a timeout or
status 11 as a definitive failure.
The processable source-manual statuses are 0 (created), 9
(manual_review), 4 (credit_failed), and 5 (failed). Provider-source
transactions, pending_payment, and provider_confirmed transactions are not
processable by this command.
Cashier also retries reconciliation of existing pending/submitted finance
trades at startup and about every 10 seconds. It matches an existing trade to
the saved operation; it does not create another trade. A matching trade must
also be acknowledged as committed in the separate trading database before
Cashier applies its result to the transaction. A runtime-cache match by itself
does not finish the operation, and the Cashier and trading databases are not
one atomic transaction. If there is no unique matching trade or durable commit
acknowledgement, the transaction remains in status 11 for review/recovery.
When the operation already has a trade order, a temporary cache miss waits for
that order and is never rebound to an older attempt. Recovery without a saved
order id excludes trades already bound to another operation.
Access¶
The command accepts manager, admin, and CRM manager sessions. Effective access is resolved from the enabled staff manager record: a super admin may process without CRM finance flags; otherwise the manager needs CRM access, and an ordinary CRM manager needs the approval permission below. A brand-scoped CRM admin bypasses the operation-specific finance flag.
| Role | Required permissions |
|---|---|
SESSION_CRM_ADMIN |
access_crm = 1; no additional finance permission flags required for a brand admin |
SESSION_CRM_MANAGER |
access_crm = 1, approve_finance = 1 |
SESSION_MANAGER, SESSION_ADMIN |
Super-admin managers are allowed; other callers need CRM access and the required finance permission |
The manager record must exist and be enabled. CRM managers remain constrained by customer/account scope, including brand and desk. CRM admins bypass these manual-method permission/scope checks, but not business checks: customer deposit/withdrawal gates, account availability and transaction processing rules still apply. The backend uses the resolved staff manager id for audit/processing. Checks run inside the handler, including direct Moleculer calls; they are not only router metadata.
Request Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
id |
int | Yes | Cashier transaction id |
Response¶
Returns transaction with the complete Cashier transaction structure.
{
"transaction": {
"id": 481,
"customer_id": 95,
"login": 2000009,
"type": 1,
"provider": "manual",
"method": "crypto",
"provider_config_id": 12,
"provider_payment_id": "",
"amount": 50.0,
"currency": "EUR",
"account_currency": "EUR",
"converted_amount": 50.0,
"conversion_rate": 1.0,
"status": 11,
"failure_reason": "",
"idempotency_key": "wd-001",
"comment": "Crypto withdrawal",
"metadata_json": "{\"details\":{\"asset\":\"USDT\",\"network\":\"TRC20\",\"address\":\"TXabc1234567890\"}}",
"source": 1,
"approved_by": 12,
"approved_time": 1790580100,
"processed_by": 12,
"processed_time": 0,
"reject_reason": "",
"created_time": 1790580000,
"updated_time": 1790580100,
"attributed_manager_id": 0,
"owner_manager_id": 12
}
}
Errors¶
| Code | Error | Description |
|---|---|---|
400 |
INVALID_DATA |
Missing or invalid transaction id |
400 |
RET_ERR_PARAMS |
Transaction is not a manual-source transaction or its status is not processable |
409 |
RET_TRADE_NO_MONEY |
Withdrawal exceeds the account's withdrawable amount or violates the group's margin/reserve policy; the transaction is returned with a definitive failed status |
403 |
RET_NOT_ENOUGH_RIGHTS |
Caller lacks approval permission or transaction scope |
404 |
RET_ERR_NOTFOUND |
Transaction does not exist |
5xx |
RET_TECH_PROBLEM |
Durable transaction/ledger state could not be written; inspect the returned transaction when present |
Workflow events¶
After a successful final transaction update, the command starts one of these workflow triggers:
cashier.deposit.approvedwhen a deposit reachesCASHIER_STATUS_CREDITED;cashier.withdrawal.approvedwhen a withdrawal reachesCASHIER_STATUS_COMPLETED.
If an active matching rule executes cashier.publish_approved, the server publishes the
same-named Moleculer event. Calling the command for a transaction already in its final
approved status returns without publishing a duplicate event. Publication is
asynchronous and is not delivery confirmation.
Request Example¶
{
"command": "MngProcessManualCashierTransaction",
"extID": "1",
"data": {
"id": 15
}
}