Banks

Events

These events are emitted by the Inventory API (btrz-api-inventory) when banks are created, updated, or deleted.

Action Event name
Create a new bank (POST /banks) banks.created
Update an existing bank (PUT /banks/:bankId) banks.updated
Delete an existing bank (DELETE /banks/:bankId) banks.deleted

Payload example — banks.created

{
  "attemptId": "ac79fa35-b3fa-4c20-a176-71440ce88a26",
  "created": 1673988987,
  "data": {
    "_id": "63c70b7a12b83f071f725479",
    "accountId": "52a377ec430c7d4e220001fc",
    "accountNumbers": [
      {
        "number": "000001-10000456",
        "currency": "CAD",
        "alias": "Main account"
      }
    ],
    "createdAt": {
      "offset": 0,
      "value": "2023-01-17T20:56:26.111Z"
    },
    "createdBy": "55fc2f318791db6e1a0000b6",
    "name": "ACME bank",
    "depositAlgorithmCode": null,
    "updatedAt": {
      "offset": 0,
      "value": "2023-01-17T20:56:26.111Z"
    },
    "updatedBy": "55fc2f318791db6e1a0000b6"
  },
  "event": "banks.created",
  "id": "f45eaba7-bd2d-4063-8fc7-d39714707d12",
  "livemode": false
}

Field descriptions — data (banks.created / banks.updated)

Field Type Description
_id string Bank id (24 hex characters).
accountId string Account (provider) id.
name string The name of the bank.
depositAlgorithmCode string Algorithm used to generate the reference number for the bank accounts.
accountNumbers array List of account number objects (see below).
createdBy string User id that created this resource (24 hex characters).
updatedBy string User id that last updated this resource (24 hex characters).
createdAt object BzDate: date the bank was created.
updatedAt object BzDate: date the bank was last updated.

accountNumbers (each item):

Field Type Description
number string The account number.
currency string ISO code for the currency supported by this account.
alias string Friendly name for the account (e.g. for combo boxes).
referenceNumber string Optional reference number.
operatingCompany string Optional operating company name.
operatingCompanyId string Optional operating company id.
shiftLocationIds array Optional list of station ids (shift locations).

Payload example — banks.updated

{
  "attemptId": "33d466ef-7fb5-479a-bc12-855c75239b40",
  "created": 1673989017,
  "data": {
    "_id": "63c70b7a12b83f071f725479",
    "accountId": "52a377ec430c7d4e220001fc",
    "accountNumbers": [
      {
        "number": "000001-10000456",
        "currency": "CAD",
        "alias": "Main account"
      }
    ],
    "createdAt": {
      "offset": 0,
      "value": "2023-01-17T20:56:26.111Z"
    },
    "createdBy": "55fc2f318791db6e1a0000b6",
    "name": "Royal bank 22",
    "updatedAt": {
      "offset": 0,
      "value": "2023-01-17T20:56:36.875Z"
    },
    "updatedBy": "55fc2f318791db6e1a0000b6"
  },
  "event": "banks.updated",
  "id": "9022be32-766d-4119-ae08-a693b117e60f",
  "livemode": false
}

(Field descriptions for data are the same as for banks.created.)

Payload example — banks.deleted

{
  "attemptId": "51d8130e-5d62-4188-b6f6-fc7bc5f3be71",
  "created": 1673989007,
  "data": {
    "bankId": "63c70b7a12b83f071f725479"
  },
  "event": "banks.deleted",
  "id": "7de4f283-0582-4c68-910a-cdae73af3452",
  "livemode": false
}

Field descriptions — data (banks.deleted)

Field Type Description
bankId string The id of the bank that was deleted (24 hex characters).