Wallet Service - rettersoft/rbs-docs GitHub Wiki

Rbs Wallet Service

Actions

Types and Enums
enum TransactionTypes {
  INC = 'INC', // for incremental transactions
  DEC = 'DEC' // for decremental transactions
}

BalanceResponse {
  "projectId": string // related project id
  "balanceId": string // UUID-v4
  "balanceAmount": number // current balance
  "balanceExpireAt": // expiry date of balance
  "balanceMinLimit": number // min balance limit
  "balanceType": string // balance type
  "balanceName": string // balance name
  "transactionsCount": number // transaction history length
  "transactionInProgress": boolean // balance transaction status
  "transactionsChecksum": string // transaction history checksum that hashed with SHA256
  "updateToken": string // for update operations
  "createdAt": string // ISO
  "updatedAt": string // ISO
}

TransactionListItem {
  "amount": number // transaction amount
  "createdAt": number // timestamp in milliseconds
  "expiredAt": number // timestamp in milliseconds
  "id": string // transaction id
  "session": string // operation session UUID-v4
  "type": TransactionTypes
  "requestTimeEpoch": number // timestamp in milliseconds
  "mainTxId": // parent transaction id
}

rbs.wallet.request.CREATE_BALANCE

Create new balance with new UUID. If you set a balanceMinLimit, decremental transactions might fall below zero.

Input {
  "balanceType": string // required, ^[A-Z]+$, length should be 3
  "balanceName": string // optional, Max Length: 60, Default: 'balanceType'
  "balanceMinLimit": number // optional, should be negative and less than zero, Default: 0
}

Output: BalanceResponse

rbs.wallet.request.BALANCE

Get current balance. If balance recalculated, the action refresh the balance.

Input {
  "balanceId": string // balance id UUID-v4
}

Output: BalanceResponse

rbs.wallet.request.EXECUTE_OPERATION

Increase or decrease the balance.

Input {
  "balanceId": string // required, balance id UUID-v4
  "amount": number //required,  should be positive
  "type": TransactionTypes // required
  "ttlInSeconds": number // optional, Note: should not be defined if `type` is DEC
  "subject": string // optional, Max Length: 60
}

Output: BalanceResponse

rbs.wallet.request.TRANSACTION_LIST

List transactions history.

Input {
  "balanceId": string // balance id
  "pageSize": number // optional, should be between 1(inclusive)-1000(inclusive), Default: 100
  "paginationToken": string // optional, pagination token of previous response or other responses
}

Output {
  "transactions": Array<TransactionListItem>,
  "paginationToken": string | undefined
}