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

    Customer-scoped escrow transfer request operations. A request is a payment ask that precedes an escrow_transfer; this service is pure customer-scoped CRUD with no on-chain machinery (contrast EscrowTransferService, whose writes run through Temporal/Solana).

    Every read and write filters on customerId (the API caller's customer external id resolved from request.customerId) so one customer can never read or mutate another's requests. Per-actor authorization (only the sender may cancel, only the recipient may reject) is the caller's responsibility — the API has no notion of the acting end user.

    Index

    Constructors

    Methods

    • Record that the recipient accepted the request and was paid: link the fulfilling escrow transfer id and move the request to SENT. Only valid from CREATED, so a second accept (even with a different escrow transfer id) is rejected rather than silently re-linking. An escrow transfer id already linked to a different request trips the unique constraint and surfaces as ESCROW_TRANSFER_ALREADY_LINKED.

      Parameters

      • __namedParameters: { customerId: string; escrowTransferId: string; id: string }

      Returns Promise<
          | { ok: true; value: EscrowTransferRequest }
          | {
              error:
                  | EscrowTransferRequestTransitionError
                  | ServiceError<"ESCROW_TRANSFER_ALREADY_LINKED">;
              ok: false;
          },
      >

    • Customer-scoped search. Filter by senderId (requests this identity sent) and/or recipientPhone (requests addressed to this phone) and/or statuses. Ordered newest-first. The customer-scope is a hard WHERE so no filter combination can leak rows across tenants.

      Parameters

      • __namedParameters: {
            customerId: string;
            page?: number;
            pageSize?: number;
            recipientPhone?: string;
            senderId?: string;
            statuses?: ("CREATED" | "REJECTED" | "CANCELLED" | "SENT")[];
        }
        • customerId: string
        • Optionalpage?: number

          Defaults to 1

        • OptionalpageSize?: number

          Defaults to 50

        • OptionalrecipientPhone?: string
        • OptionalsenderId?: string
        • Optionalstatuses?: ("CREATED" | "REJECTED" | "CANCELLED" | "SENT")[]

      Returns Promise<
          {
              ok: true;
              value: { hasNext: boolean; items: EscrowTransferRequest[]; total: number };
          },
      >