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

    Admin withdrawal-quote reads. Extends WithdrawalQuoteCache, which owns the withdrawal-quote-search namespace these reads go through.

    Hierarchy (View Summary)

    Index
    cache: ServiceCache<
        CachedSearchPage<
            {
                createdAt: Date;
                customerId: string;
                deviceIpAddress: string
                | null;
                deviceLocation: { lat: number; long: number; source: "ip" } | null;
                entityId: string;
                expiresAt: Date;
                fees: (
                    {
                        amount: BigNumber;
                        receiver: "CUSTOMER"
                        | "PROVIDER"
                        | "CFX";
                        type: "FIXED" | "VARIABLE";
                    } & { currency: string }
                )[];
                id: string;
                metadata: {
                    brand?: string;
                    marketing?: {
                        fbp?: string;
                        gclid?: string;
                        sub1?: string;
                        sub2?: string;
                        sub3?: string;
                        userAgent?: string;
                        utmCampaign?: string;
                        utmContent?: string;
                        utmMedium?: string;
                        utmSource?: string;
                    };
                };
                methodData: | {
                    achBatchId?: string;
                    bankId?: string;
                    sourceLedgerAccountId?: string;
                    speed?: "same-day"
                    | "next-day";
                    type: "ACH_CREDIT";
                    vendorId?: string;
                }
                | {
                    achId: string;
                    bankId?: string;
                    sourceLedgerAccountId?: string;
                    type: "ACH_DEBIT";
                    vendorId?: string;
                }
                | {
                    bankId?: string;
                    beneficiaryReference?: string;
                    purpose: WireWithdrawalPurpose;
                    senderMessage?: string;
                    sourceLedgerAccountId: string;
                    type: "SWIFT_WIRE"
                    | "US_WIRE";
                    vendorId?: string;
                    wireBatchId?: string;
                }
                | {
                    country: string;
                    sourceLedgerAccountId?: string;
                    type: "AF_WITHDRAWAL";
                    withdrawalType: "bank"
                    | "momo";
                }
                | {
                    asset?: {
                        decimals: number;
                        mint: string;
                        symbol: string;
                        tokenProgram: string;
                    };
                    sourceLedgerAccountId: string;
                    type: "BLOCKCHAIN";
                }
                | {
                    bankId?: string;
                    sourceLedgerAccountId?: string;
                    type: "US_INSTANT";
                    vendorId?: string;
                }
                | {
                    bankId?: string;
                    drawdownId: string;
                    sourceAccountId: string;
                    type: "US_WIRE_DRAWDOWN";
                    vendorId?: string;
                }
                | null;
                methodId: | "ACH_CREDIT"
                | "ACH_DEBIT"
                | "BLOCKCHAIN"
                | "MX_SPEI"
                | "US_WIRE_DRAWDOWN"
                | "US_INSTANT"
                | "SWIFT_WIRE"
                | "US_WIRE"
                | "AF_WITHDRAWAL";
                paymentInstrumentId: string;
                productQuoteId: string;
                providerQuoteId: string
                | null;
                sourceAmount: BigNumber;
                sourceAmountAfterFees: BigNumber;
                sourceCurrency: string;
                status: "ACTIVE" | "ACCEPTED" | "REJECTED" | "EXPIRED";
                targetAmount: BigNumber;
                targetAmountAfterFees: BigNumber;
                targetCurrency: string;
                unsignedWithdrawalTransaction: string | null;
                updatedAt: Date;
                walletAddress: Address;
                walletBlockchain: string;
            },
        >,
    >
    db: B2bDatabase
    instance: (...args: []) => WithdrawalQuoteAdminService = ...

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

    • Files the quote in a batch unless it is already in one, and answers with the batch that holds it. The check and the write share the quote's row lock: a quote moved after its batch went out in a file is paid twice. A batch that is filed or being filed is refused with BATCH_NOT_OPEN.

      Parameters

      • args: { id: string } & ({ achBatchId: string } | { wireBatchId: string })

      Returns Promise<{ ok: true; value: string } | { error: BatchNotOpenError; ok: false }>

    • Parameters

      • args: {
            customerId: string;
            deviceIpAddress: string | null;
            deviceLocation: { lat: number; long: number; source: "ip" } | null;
            entityId: string;
            expiresAt: Date;
            fees: (
                {
                    amount: BigNumber;
                    receiver: "CUSTOMER"
                    | "PROVIDER"
                    | "CFX";
                    type: "FIXED" | "VARIABLE";
                } & { currency: string }
            )[];
            metadata: {
                brand?: string;
                marketing?: {
                    fbp?: string;
                    gclid?: string;
                    sub1?: string;
                    sub2?: string;
                    sub3?: string;
                    userAgent?: string;
                    utmCampaign?: string;
                    utmContent?: string;
                    utmMedium?: string;
                    utmSource?: string;
                };
            };
            methodData: | {
                achBatchId?: string;
                bankId?: string;
                sourceLedgerAccountId?: string;
                speed?: "same-day"
                | "next-day";
                type: "ACH_CREDIT";
                vendorId?: string;
            }
            | {
                achId: string;
                bankId?: string;
                sourceLedgerAccountId?: string;
                type: "ACH_DEBIT";
                vendorId?: string;
            }
            | {
                bankId?: string;
                beneficiaryReference?: string;
                purpose: WireWithdrawalPurpose;
                senderMessage?: string;
                sourceLedgerAccountId: string;
                type: "SWIFT_WIRE"
                | "US_WIRE";
                vendorId?: string;
                wireBatchId?: string;
            }
            | {
                country: string;
                sourceLedgerAccountId?: string;
                type: "AF_WITHDRAWAL";
                withdrawalType: "bank"
                | "momo";
            }
            | {
                asset?: {
                    decimals: number;
                    mint: string;
                    symbol: string;
                    tokenProgram: string;
                };
                sourceLedgerAccountId: string;
                type: "BLOCKCHAIN";
            }
            | {
                bankId?: string;
                sourceLedgerAccountId?: string;
                type: "US_INSTANT";
                vendorId?: string;
            }
            | {
                bankId?: string;
                drawdownId: string;
                sourceAccountId: string;
                type: "US_WIRE_DRAWDOWN";
                vendorId?: string;
            }
            | null;
            methodId: | "ACH_CREDIT"
            | "ACH_DEBIT"
            | "BLOCKCHAIN"
            | "MX_SPEI"
            | "US_WIRE_DRAWDOWN"
            | "US_INSTANT"
            | "SWIFT_WIRE"
            | "US_WIRE"
            | "AF_WITHDRAWAL";
            paymentInstrumentId: string;
            productQuoteId: string;
            providerQuoteId: string
            | null;
            sourceAmount: BigNumber;
            sourceAmountAfterFees: BigNumber;
            sourceCurrency: string;
            targetAmount: BigNumber;
            targetAmountAfterFees: BigNumber;
            targetCurrency: string;
            tx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>;
            unsignedWithdrawalTransaction: string;
            walletAddress: Address;
            walletBlockchain: string;
        }

      Returns Promise<
          {
              createdAt: Date;
              customerId: string;
              deviceIpAddress: string
              | null;
              deviceLocation: { lat: number; long: number; source: "ip" } | null;
              entityId: string;
              expiresAt: Date;
              fees: (
                  {
                      amount: BigNumber;
                      receiver: "CUSTOMER"
                      | "PROVIDER"
                      | "CFX";
                      type: "FIXED" | "VARIABLE";
                  } & { currency: string }
              )[];
              id: string;
              metadata: {
                  brand?: string;
                  marketing?: {
                      fbp?: string;
                      gclid?: string;
                      sub1?: string;
                      sub2?: string;
                      sub3?: string;
                      userAgent?: string;
                      utmCampaign?: string;
                      utmContent?: string;
                      utmMedium?: string;
                      utmSource?: string;
                  };
              };
              methodData: | {
                  achBatchId?: string;
                  bankId?: string;
                  sourceLedgerAccountId?: string;
                  speed?: "same-day"
                  | "next-day";
                  type: "ACH_CREDIT";
                  vendorId?: string;
              }
              | {
                  achId: string;
                  bankId?: string;
                  sourceLedgerAccountId?: string;
                  type: "ACH_DEBIT";
                  vendorId?: string;
              }
              | {
                  bankId?: string;
                  beneficiaryReference?: string;
                  purpose: WireWithdrawalPurpose;
                  senderMessage?: string;
                  sourceLedgerAccountId: string;
                  type: "SWIFT_WIRE"
                  | "US_WIRE";
                  vendorId?: string;
                  wireBatchId?: string;
              }
              | {
                  country: string;
                  sourceLedgerAccountId?: string;
                  type: "AF_WITHDRAWAL";
                  withdrawalType: "bank"
                  | "momo";
              }
              | {
                  asset?: {
                      decimals: number;
                      mint: string;
                      symbol: string;
                      tokenProgram: string;
                  };
                  sourceLedgerAccountId: string;
                  type: "BLOCKCHAIN";
              }
              | {
                  bankId?: string;
                  sourceLedgerAccountId?: string;
                  type: "US_INSTANT";
                  vendorId?: string;
              }
              | {
                  bankId?: string;
                  drawdownId: string;
                  sourceAccountId: string;
                  type: "US_WIRE_DRAWDOWN";
                  vendorId?: string;
              }
              | null;
              methodId: | "ACH_CREDIT"
              | "ACH_DEBIT"
              | "BLOCKCHAIN"
              | "MX_SPEI"
              | "US_WIRE_DRAWDOWN"
              | "US_INSTANT"
              | "SWIFT_WIRE"
              | "US_WIRE"
              | "AF_WITHDRAWAL";
              paymentInstrumentId: string;
              productQuoteId: string;
              providerQuoteId: string
              | null;
              sourceAmount: BigNumber;
              sourceAmountAfterFees: BigNumber;
              sourceCurrency: string;
              status: "ACTIVE" | "ACCEPTED" | "REJECTED" | "EXPIRED";
              targetAmount: BigNumber;
              targetAmountAfterFees: BigNumber;
              targetCurrency: string;
              unsignedWithdrawalTransaction: string | null;
              updatedAt: Date;
              walletAddress: Address;
              walletBlockchain: string;
          },
      >

    • Get a withdrawal by ID without customer restriction

      Parameters

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

      Returns Promise<
          {
              ok: true;
              value: | {
                  createdAt: Date;
                  customerId: string;
                  deviceIpAddress: string
                  | null;
                  deviceLocation: { lat: number; long: number; source: "ip" } | null;
                  entityId: string;
                  expiresAt: Date;
                  fees: (
                      {
                          amount: BigNumber;
                          receiver: "CUSTOMER"
                          | "PROVIDER"
                          | "CFX";
                          type: "FIXED" | "VARIABLE";
                      } & { currency: string }
                  )[];
                  id: string;
                  metadata: {
                      brand?: string;
                      marketing?: {
                          fbp?: string;
                          gclid?: string;
                          sub1?: string;
                          sub2?: string;
                          sub3?: string;
                          userAgent?: string;
                          utmCampaign?: string;
                          utmContent?: string;
                          utmMedium?: string;
                          utmSource?: string;
                      };
                  };
                  methodData: | {
                      achBatchId?: string;
                      bankId?: string;
                      sourceLedgerAccountId?: string;
                      speed?: "same-day"
                      | "next-day";
                      type: "ACH_CREDIT";
                      vendorId?: string;
                  }
                  | {
                      achId: string;
                      bankId?: string;
                      sourceLedgerAccountId?: string;
                      type: "ACH_DEBIT";
                      vendorId?: string;
                  }
                  | {
                      bankId?: string;
                      beneficiaryReference?: string;
                      purpose: WireWithdrawalPurpose;
                      senderMessage?: string;
                      sourceLedgerAccountId: string;
                      type: "SWIFT_WIRE"
                      | "US_WIRE";
                      vendorId?: string;
                      wireBatchId?: string;
                  }
                  | {
                      country: string;
                      sourceLedgerAccountId?: string;
                      type: "AF_WITHDRAWAL";
                      withdrawalType: "bank"
                      | "momo";
                  }
                  | {
                      asset?: {
                          decimals: number;
                          mint: string;
                          symbol: string;
                          tokenProgram: string;
                      };
                      sourceLedgerAccountId: string;
                      type: "BLOCKCHAIN";
                  }
                  | {
                      bankId?: string;
                      sourceLedgerAccountId?: string;
                      type: "US_INSTANT";
                      vendorId?: string;
                  }
                  | {
                      bankId?: string;
                      drawdownId: string;
                      sourceAccountId: string;
                      type: "US_WIRE_DRAWDOWN";
                      vendorId?: string;
                  }
                  | null;
                  methodId: | "ACH_CREDIT"
                  | "ACH_DEBIT"
                  | "BLOCKCHAIN"
                  | "MX_SPEI"
                  | "US_WIRE_DRAWDOWN"
                  | "US_INSTANT"
                  | "SWIFT_WIRE"
                  | "US_WIRE"
                  | "AF_WITHDRAWAL";
                  paymentInstrumentId: string;
                  productQuoteId: string;
                  providerQuoteId: string
                  | null;
                  sourceAmount: BigNumber;
                  sourceAmountAfterFees: BigNumber;
                  sourceCurrency: string;
                  status: "ACTIVE" | "ACCEPTED" | "REJECTED" | "EXPIRED";
                  targetAmount: BigNumber;
                  targetAmountAfterFees: BigNumber;
                  targetCurrency: string;
                  unsignedWithdrawalTransaction: string | null;
                  updatedAt: Date;
                  walletAddress: Address;
                  walletBlockchain: string;
              }
              | 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: {
            data: Partial<
                Simplify<
                    Pick<WithdrawalQuote, "status" | "paymentInstrumentId"> & {
                        providerQuoteId?: WithdrawalQuote["providerQuoteId"];
                    },
                >,
            >;
            ids: string[];
            tx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>;
        }

      Returns Promise<
          {
              ok: true;
              value: {
                  createdAt: Date;
                  customerId: string;
                  deviceIpAddress: string
                  | null;
                  deviceLocation: { lat: number; long: number; source: "ip" } | null;
                  entityId: string;
                  expiresAt: Date;
                  fees: (
                      {
                          amount: BigNumber;
                          receiver: "CUSTOMER"
                          | "PROVIDER"
                          | "CFX";
                          type: "FIXED" | "VARIABLE";
                      } & { currency: string }
                  )[];
                  id: string;
                  metadata: {
                      brand?: string;
                      marketing?: {
                          fbp?: string;
                          gclid?: string;
                          sub1?: string;
                          sub2?: string;
                          sub3?: string;
                          userAgent?: string;
                          utmCampaign?: string;
                          utmContent?: string;
                          utmMedium?: string;
                          utmSource?: string;
                      };
                  };
                  methodData: | {
                      achBatchId?: string;
                      bankId?: string;
                      sourceLedgerAccountId?: string;
                      speed?: "same-day"
                      | "next-day";
                      type: "ACH_CREDIT";
                      vendorId?: string;
                  }
                  | {
                      achId: string;
                      bankId?: string;
                      sourceLedgerAccountId?: string;
                      type: "ACH_DEBIT";
                      vendorId?: string;
                  }
                  | {
                      bankId?: string;
                      beneficiaryReference?: string;
                      purpose: WireWithdrawalPurpose;
                      senderMessage?: string;
                      sourceLedgerAccountId: string;
                      type: "SWIFT_WIRE"
                      | "US_WIRE";
                      vendorId?: string;
                      wireBatchId?: string;
                  }
                  | {
                      country: string;
                      sourceLedgerAccountId?: string;
                      type: "AF_WITHDRAWAL";
                      withdrawalType: "bank"
                      | "momo";
                  }
                  | {
                      asset?: {
                          decimals: number;
                          mint: string;
                          symbol: string;
                          tokenProgram: string;
                      };
                      sourceLedgerAccountId: string;
                      type: "BLOCKCHAIN";
                  }
                  | {
                      bankId?: string;
                      sourceLedgerAccountId?: string;
                      type: "US_INSTANT";
                      vendorId?: string;
                  }
                  | {
                      bankId?: string;
                      drawdownId: string;
                      sourceAccountId: string;
                      type: "US_WIRE_DRAWDOWN";
                      vendorId?: string;
                  }
                  | null;
                  methodId: | "ACH_CREDIT"
                  | "ACH_DEBIT"
                  | "BLOCKCHAIN"
                  | "MX_SPEI"
                  | "US_WIRE_DRAWDOWN"
                  | "US_INSTANT"
                  | "SWIFT_WIRE"
                  | "US_WIRE"
                  | "AF_WITHDRAWAL";
                  paymentInstrumentId: string;
                  productQuoteId: string;
                  providerQuoteId: string
                  | null;
                  sourceAmount: BigNumber;
                  sourceAmountAfterFees: BigNumber;
                  sourceCurrency: string;
                  status: "ACTIVE" | "ACCEPTED" | "REJECTED" | "EXPIRED";
                  targetAmount: BigNumber;
                  targetAmountAfterFees: BigNumber;
                  targetCurrency: string;
                  unsignedWithdrawalTransaction: string | null;
                  updatedAt: Date;
                  walletAddress: Address;
                  walletBlockchain: string;
              }[];
          },
      >