@cfxlabsinc/b2b-services
    Preparing search index...

    Read-only query services to fetch normalised transactions across all products

    If you need more info about a transaction, fetch it using its specific service. Transaction Service will remain generic and high-level.

    Index
    • Count transactions grouped by method, scoped to the given statuses (e.g. ["PROCESSING"] for in-flight / stuck transactions). Returns one entry per method that has at least one matching row; methods with zero matches are omitted. Order is unspecified — callers sort.

      Parameters

      • __namedParameters: { statuses: ("PROCESSING" | "COMPLETED" | "FAILED" | "RETURNED")[] }

      Returns Promise<
          {
              ok: true;
              value: {
                  counts: {
                      count: number;
                      method: | "DEPOSIT_BLOCKCHAIN"
                      | "DEPOSIT_DIRECT"
                      | "DEPOSIT_US_BANK_ACH"
                      | "DEPOSIT_ACH_CREDIT"
                      | "DEPOSIT_RTP"
                      | "DEPOSIT_US_CASH"
                      | "DEPOSIT_US_WIRE"
                      | "DEPOSIT_SWIFT_WIRE"
                      | "REDEMPTION"
                      | "SWAP"
                      | "FEE_TRANSFER"
                      | "TRANSFER"
                      | "TRANSFER_NETWORK"
                      | "WITHDRAW_AF_BANK"
                      | "WITHDRAW_AF_MOMO"
                      | "WITHDRAW_MX_SPEI"
                      | "WITHDRAW_SWIFT_WIRE"
                      | "WITHDRAW_US_BANK_ACH"
                      | "WITHDRAW_US_INSTANT"
                      | "WITHDRAW_ACH_PULL"
                      | "WITHDRAW_US_WIRE_DRAWDOWN"
                      | "WITHDRAW_US_WIRE"
                      | "WITHDRAW_BLOCKCHAIN"
                      | "VIRTUAL_CARD"
                      | "PHYSICAL_CARD"
                      | "ESCROW_TRANSFER"
                      | "REWARD";
                  }[];
              };
          },
      >

    • Fetch a single transaction, optionally pinned to a specific leg. Delegates to search (a pageSize: 1 lookup) instead of running its own query, so the UNION, enrichment JOINs, and row mapper stay defined in exactly one place.

      A transaction id is NOT unique on its own — one id spans CREDIT/DEBIT legs, fee/return sub-rows, and (admin-wide) multiple customer audiences (a card txn's cardholder leg and issuer leg share id+type but belong to different customers; see Transaction.id). The read model's unique key is the (id, type, subType, customerId) tuple — pass whichever parts the caller knows to land on the exact row. With only id, returns whichever leg sorts first (default newest createdAt), which is enough for id-scoped state checks like on-chain settlement (per-transaction, leg-agnostic).

      Parameters

      • __namedParameters: {
            customerId?: string;
            id?: string;
            key?: string;
            subType?: "RETURN" | "FEE" | "CLEARING" | null;
            type?: "CREDIT" | "DEBIT";
        }
        • OptionalcustomerId?: string

          Narrow to a single customer audience of the transaction.

        • Optionalid?: string

          Transaction id; optional when pinning by the exact Transaction.key.

        • Optionalkey?: string

          Exact unique-identity Transaction.key (id-type-subType). When set it resolves the single matching row directly via search({ keys: [key] }), superseding the tuple params below.

        • OptionalsubType?: "RETURN" | "FEE" | "CLEARING" | null

          Sub-row selector, mirroring search's subtypes tri-state: a value matches that sub-row (FEE / RETURN), null matches the main (non-subtyped) leg, and undefined doesn't filter on sub-row.

        • Optionaltype?: "CREDIT" | "DEBIT"

          Narrow to the CREDIT or DEBIT leg.

      Returns Promise<Transaction & { customerId: string } | null>