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

    Owns deposit-search. DepositAdminService is the only deposit writer; a deposit row embeds its quote, so quote writers bust it through DepositQuoteCache.

    Hierarchy (View Summary)

    Index
    cache: ServiceCache<CachedSearchPage<Deposit>>
    db: B2bDatabase
    instance: (...args: []) => DepositAdminService = ...

    The process default: built from each dependency's own instance().

    • Parameters

      • args: {
            data?: Omit<
                { idempotencyKey?: string } & (
                    | {
                        merchantId?: string;
                        retailChain?: string;
                        retailerName?: string;
                        storeAddress1?: string;
                        storeAddress2?: string;
                        storeCity?: string;
                        storeCounty?: string;
                        storeLatitude?: string;
                        storeLongitude?: string;
                        storeName?: string;
                        storeNumber?: string;
                        storeState?: string;
                        storeTransactionDate?: string;
                        storeZipcode?: string;
                        type: "CASH";
                    }
                    | { type: "US_WIRE" }
                    | { type: "SWIFT_WIRE" }
                    | { type: "US_BANK_ACH" }
                    | { type: "RTP" }
                    | { type: "FEDNOW" }
                    | { type: "ACH_CREDIT" }
                ),
                "idempotencyKey",
            >;
            idempotencyKey: string;
            onCancelled?: "return" | "recreate";
            quoteId: string;
            tx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>;
        }
        • Optionaldata?: Omit<
              { idempotencyKey?: string } & (
                  | {
                      merchantId?: string;
                      retailChain?: string;
                      retailerName?: string;
                      storeAddress1?: string;
                      storeAddress2?: string;
                      storeCity?: string;
                      storeCounty?: string;
                      storeLatitude?: string;
                      storeLongitude?: string;
                      storeName?: string;
                      storeNumber?: string;
                      storeState?: string;
                      storeTransactionDate?: string;
                      storeZipcode?: string;
                      type: "CASH";
                  }
                  | { type: "US_WIRE" }
                  | { type: "SWIFT_WIRE" }
                  | { type: "US_BANK_ACH" }
                  | { type: "RTP" }
                  | { type: "FEDNOW" }
                  | { type: "ACH_CREDIT" }
              ),
              "idempotencyKey",
          >
        • idempotencyKey: string
        • OptionalonCancelled?: "return" | "recreate"

          What to do when the key already resolves to a CANCELLED deposit. A live deposit under the key is returned idempotently on both.

          • "return" (default) hands back the terminal row. The public accept path takes a customer-supplied key, and idempotency there means the same key always answers the same thing.
          • "recreate" inserts a fresh deposit and leaves the cancelled row as history. Only the processFromBankTransaction rails ask for this, where the key is a bankTransactionId and a re-drive means "process this credit", not "give me the previous answer". Throws DepositCancelledAfterMintError when the dead deposit already minted.

          Reviving a cancelled deposit is not one of the modes: the Green Dot AUTH arm of the consumption drain does that itself, where the authorisation sequence it belongs to is readable.

        • quoteId: string
        • Optionaltx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>

      Returns Promise<Deposit>

    • The deposit while it is still in one of statuses, read from the database. For a guard that acts on that status, where a stale cached status would let it act on a deposit that has since settled or cancelled.

      Parameters

      • __namedParameters: {
            id: string;
            statuses: (
                "PENDING"
                | "CANCELLED"
                | "PROCESSING"
                | "COMPLETED"
                | "RETURNED"
            )[];
        }

      Returns Promise<{ ok: true; value: Deposit | null }>

    • Get a deposit by ID without customer restriction

      Parameters

      • __namedParameters: {
            id: string;
            includeHistory?: boolean;
            tx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>;
        }

      Returns Promise<{ ok: true; value: Deposit | null }>

    • Clear each customer's membership tag and each record tag wherever cached, and always this namespace's collection tag. keys are exact deletes in this instance's key space: the only bust a null client honours.

      Parameters

      • __namedParameters: {
            customerIds: readonly string[];
            keys?: readonly CacheKey[];
            records?: readonly string[];
        }

      Returns Promise<void>

    • Tags for a page: the scope its query searched (each customer's membership tag, else the collection tag), so an empty page is bustable too, plus the records it projects and the fields that chose or ordered its rows.

      Parameters

      • __namedParameters: {
            customerIds: readonly string[] | undefined;
            fields?: readonly string[];
            records?: readonly string[];
        }

      Returns string[]

    • Parameters

      • args: {
            bankTransactionId?: string;
            data: {
                feeSweepTxId?: string | null;
                feeSweepTxType?: "SOLANA_TRANSACTION_SIGNATURE" | null;
                receiptId?: string | null;
                receiptType?: "SOLANA_TRANSACTION_SIGNATURE" | null;
                status?: "PENDING" | "CANCELLED" | "PROCESSING" | "COMPLETED" | "RETURNED";
                storeData?: Partial<
                    Omit<
                        { idempotencyKey?: string } & {
                            merchantId?: string;
                            retailChain?: string;
                            retailerName?: string;
                            storeAddress1?: string;
                            storeAddress2?: string;
                            storeCity?: string;
                            storeCounty?: string;
                            storeLatitude?: string;
                            storeLongitude?: string;
                            storeName?: string;
                            storeNumber?: string;
                            storeState?: string;
                            storeTransactionDate?: string;
                            storeZipcode?: string;
                            type: "CASH";
                        },
                        "type"
                        | "idempotencyKey",
                    >,
                >;
            };
            expectedStatuses?: (
                "PENDING"
                | "CANCELLED"
                | "PROCESSING"
                | "COMPLETED"
                | "RETURNED"
            )[];
            id: string;
            reason?: string;
            unlessInAchFile?: boolean;
        }
        • OptionalbankTransactionId?: string

          The bank transaction (an ACH return) that made this transition, recorded beside reason.

        • data: {
              feeSweepTxId?: string | null;
              feeSweepTxType?: "SOLANA_TRANSACTION_SIGNATURE" | null;
              receiptId?: string | null;
              receiptType?: "SOLANA_TRANSACTION_SIGNATURE" | null;
              status?: "PENDING" | "CANCELLED" | "PROCESSING" | "COMPLETED" | "RETURNED";
              storeData?: Partial<
                  Omit<
                      { idempotencyKey?: string } & {
                          merchantId?: string;
                          retailChain?: string;
                          retailerName?: string;
                          storeAddress1?: string;
                          storeAddress2?: string;
                          storeCity?: string;
                          storeCounty?: string;
                          storeLatitude?: string;
                          storeLongitude?: string;
                          storeName?: string;
                          storeNumber?: string;
                          storeState?: string;
                          storeTransactionDate?: string;
                          storeZipcode?: string;
                          type: "CASH";
                      },
                      "type"
                      | "idempotencyKey",
                  >,
              >;
          }
        • OptionalexpectedStatuses?: ("PENDING" | "CANCELLED" | "PROCESSING" | "COMPLETED" | "RETURNED")[]

          Compare-and-set: from any other status nothing is written or published.

        • id: string
        • Optionalreason?: string

          Why the status changed, recorded on the transition and surfaced as failure_reason. Set by operators and by the machine paths that cancel a deposit — a CANCELLED write without one is indistinguishable from the others on the history row.

        • OptionalunlessInAchFile?: boolean

          Refuse while the deposit's ACH batch is on an unarchived file, whose NACHA contents already carry its entry. Checked under locks file creation waits on.

      Returns Promise<{ applied: true } | { applied: false; inAchFile: boolean }>

    • The key get reads through on the admin surface: { ids: [id], includeHistory, pageSize: 1 } plus search's page default. Writers pass both includeHistory variants so read-after-write holds under a null client.

      Parameters

      • __namedParameters: { id: string }

      Returns CacheKey[]