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

    Entity-aware product service

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Convenience method to check both product activation and limits (if sourceAmount is provided)

      Most products should invoke this before allowing consumers to transact

      Parameters

      • __namedParameters: {
            customerId: string;
            entityId: string;
            getAggregateUsage?: (input: GetUsageInput[]) => Promise<BigNumber[]>;
            getUsage: (input: GetUsageInput[]) => Promise<BigNumber[]>;
            productName:
                | "organization.v1"
                | "identity.v1"
                | "card.physical_card.v1"
                | "card.virtual_card.v1"
                | "deposit.us_cash.v1"
                | "deposit.rtp.v1"
                | "deposit.us_bank_ach.v1"
                | "deposit.ach_credit.v1"
                | "deposit.us_wire.v1"
                | "deposit.swift_wire.v1"
                | "transfer.redemption.v1"
                | "swap.v1"
                | "withdraw.blockchain.v1"
                | "withdraw.ke_bank.v1"
                | "withdraw.ke_momo.v1"
                | "withdraw.mx_bank_spei.v1"
                | "withdraw.swift_wire.v1"
                | "withdraw.tg_momo.v1"
                | "withdraw.us_bank_ach.v1"
                | "withdraw.us_instant.v1"
                | "withdraw.us_wire.v1"
                | "withdraw.ach_pull.v1"
                | "withdraw.us_wire_drawdown.v1"
                | "account.virtual-account.v1";
            regionCode?: string;
            sourceAmount: BigNumber
            | null;
            sourceCurrency: string;
            targetCurrency: string;
        }
        • customerId: string
        • entityId: string
        • OptionalgetAggregateUsage?: (input: GetUsageInput[]) => Promise<BigNumber[]>

          Applicable to deposit.* and withdraw.* products currently

        • getUsage: (input: GetUsageInput[]) => Promise<BigNumber[]>
        • productName:
              | "organization.v1"
              | "identity.v1"
              | "card.physical_card.v1"
              | "card.virtual_card.v1"
              | "deposit.us_cash.v1"
              | "deposit.rtp.v1"
              | "deposit.us_bank_ach.v1"
              | "deposit.ach_credit.v1"
              | "deposit.us_wire.v1"
              | "deposit.swift_wire.v1"
              | "transfer.redemption.v1"
              | "swap.v1"
              | "withdraw.blockchain.v1"
              | "withdraw.ke_bank.v1"
              | "withdraw.ke_momo.v1"
              | "withdraw.mx_bank_spei.v1"
              | "withdraw.swift_wire.v1"
              | "withdraw.tg_momo.v1"
              | "withdraw.us_bank_ach.v1"
              | "withdraw.us_instant.v1"
              | "withdraw.us_wire.v1"
              | "withdraw.ach_pull.v1"
              | "withdraw.us_wire_drawdown.v1"
              | "account.virtual-account.v1"
        • OptionalregionCode?: string

          2-letter country subdivision code, e.g. US states

        • sourceAmount: BigNumber | null

          Can be null for products that do not accept source amount upfront

        • sourceCurrency: string
        • targetCurrency: string

      Returns Promise<
          | { ok: true; value: { status: "OK" } }
          | {
              error:
                  | ServiceError<"ENTITY_NOT_FOUND" | "NO_COUNTRY">
                  | ServiceError<"PRODUCT_INACTIVE" | "PRODUCT_BLOCKED">
                  | ServiceError<"LIMIT_EXCEEDED", ProductLimitViolation>
                  | ServiceError<"ENTITY_NOT_FOUND">;
              ok: false;
          },
      >

      Whether the provided entity and criteria can transact with the given product

      // without amount
      entityProductService.can({
      product: "swap.v1",
      entityId: "id_...",
      customerId: "cust_...",
      sourceCurrency: "MOVEUSD",
      targetCurrency: "USDC"
      })

      // with amount
      entityProductService.can({
      product: "swap.v1",
      entityId: "id_...",
      customerId: "cust_...",
      sourceCurrency: "MOVEUSD",
      targetCurrency: "USDC",
      sourceAmount: {
      value: new BigNumber(100),
      getUsage: (input) => {
      return this.getUsage({...input, entityId, customerId });
      }
      }
      })
    • Parameters

      • __namedParameters: {
            customerId: string;
            entityId: string;
            productName:
                | "organization.v1"
                | "identity.v1"
                | "card.physical_card.v1"
                | "card.virtual_card.v1"
                | "deposit.us_cash.v1"
                | "deposit.rtp.v1"
                | "deposit.us_bank_ach.v1"
                | "deposit.ach_credit.v1"
                | "deposit.us_wire.v1"
                | "deposit.swift_wire.v1"
                | "transfer.redemption.v1"
                | "swap.v1"
                | "withdraw.blockchain.v1"
                | "withdraw.ke_bank.v1"
                | "withdraw.ke_momo.v1"
                | "withdraw.mx_bank_spei.v1"
                | "withdraw.swift_wire.v1"
                | "withdraw.tg_momo.v1"
                | "withdraw.us_bank_ach.v1"
                | "withdraw.us_instant.v1"
                | "withdraw.us_wire.v1"
                | "withdraw.ach_pull.v1"
                | "withdraw.us_wire_drawdown.v1"
                | "account.virtual-account.v1";
            regionCode?: string;
        }
        • customerId: string
        • entityId: string
        • productName:
              | "organization.v1"
              | "identity.v1"
              | "card.physical_card.v1"
              | "card.virtual_card.v1"
              | "deposit.us_cash.v1"
              | "deposit.rtp.v1"
              | "deposit.us_bank_ach.v1"
              | "deposit.ach_credit.v1"
              | "deposit.us_wire.v1"
              | "deposit.swift_wire.v1"
              | "transfer.redemption.v1"
              | "swap.v1"
              | "withdraw.blockchain.v1"
              | "withdraw.ke_bank.v1"
              | "withdraw.ke_momo.v1"
              | "withdraw.mx_bank_spei.v1"
              | "withdraw.swift_wire.v1"
              | "withdraw.tg_momo.v1"
              | "withdraw.us_bank_ach.v1"
              | "withdraw.us_instant.v1"
              | "withdraw.us_wire.v1"
              | "withdraw.ach_pull.v1"
              | "withdraw.us_wire_drawdown.v1"
              | "account.virtual-account.v1"
        • OptionalregionCode?: string

          2-letter country subdivision code, e.g. US states

      Returns Promise<
          | { ok: true; value: ProductActivation }
          | { error: ServiceError; ok: false },
      >

      Whether the product is active for the given entity