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

    Class CustomerFeeTransferAdminService

    Hierarchy (View Summary)

    Index
    db: B2bDatabase
    instance: (...args: []) => CustomerFeeTransferAdminService = ...

    The process default: the worker queue from the temporal namespace.

    • Parameters

      • __namedParameters: Pick<CustomerFeeTransfer, "description" | "sourceAccountId" | "type"> & {
            customerId: string;
            entityId: string;
            guard?: RecurringChargeGuard;
            idempotencyKey?: string;
            notMonthlyFee?: true;
            recurringFee?: { periodKey: string };
            sourceAmount: BigNumber;
        }
        • customerId: string
        • entityId: string
        • Optionalguard?: RecurringChargeGuard

          Not run on a replay of an existing key: nothing new is written.

        • OptionalidempotencyKey?: string

          Dedupe token: a repeated key returns the existing live transfer, starting a PROCESSING one's workflow if no run holds its id. Absent, every call inserts a row.

          Unlike ledger-account transfers this key does NOT touch the on-chain Mintfx idempotency key — the fee transfer PDA is seeded by the external id (see feeTransferTransaction and ledgerAccountFeeTransferWorkflowActivities).

        • OptionalnotMonthlyFee?: true

          The operator's confirmation that a manual PLATFORM fee is not the monthly fee, required when the customer has a recurring fee configured.

        • OptionalrecurringFee?: { periodKey: string }

          Set by the monthly platform-fee sweep (ENG-3083) to mark this charge as one of its own and record the period it settles.

          Stored on data rather than left implicit in idempotencyKey: the key encodes the period as a suffix, which answers "was this customer billed for August" but cannot answer "every recurring fee taken in August" without a scan no index can serve.

        • sourceAmount: BigNumber

      Returns Promise<
          | { ok: true; value: CreatedFeeTransfer }
          | {
              error:
                  | IdempotencyKeyReused
                  | ServiceError<"INVALID_TRANSFER">
                  | ServiceError<"INVALID_LEDGER_ACCOUNT", { ledgerAccountId: string }>
                  | ServiceError<"RECURRING_FEE_CONFIGURED", { customerId: string }>
                  | RecurringChargeRefused;
              ok: false;
          },
      >

    • Parameters

      • __namedParameters: { id: string }

      Returns Promise<
          {
              ok: true;
              value: {
                  amount: string;
                  lastValidBlockHeight: number;
                  message: SolanaBlockhashTransactionMessage;
                  sourceAccountId: string;
              };
          },
      >

      Solana transaction to execute a transfer from a ledger account to another, with the account it debits and the amount, which signing needs

    • Get a fee transfer by ID. Admin function does not lock down to a customer.

      Parameters

      • __namedParameters: { id: string }

      Returns Promise<
          {
              ok: true;
              value: | Omit<
                  {
                      createdAt: Date;
                      customerExternalId: string;
                      customerId: number;
                      data: {
                          feeDescription?: string;
                          feeType: "IDENTITY"
                          | "ORGANIZATION"
                          | "PLATFORM";
                          notMonthlyFee?: true;
                          recurringFee?: { periodKey: string };
                      };
                      externalId: string;
                      id: number;
                      idempotencyKey: string
                      | null;
                      receipt: { id: string; type: "SOLANA_TRANSACTION_SIGNATURE" } | null;
                      source: { amount: string; currency: string };
                      sourceAccountExternalId: string | null;
                      sourceAccountId: number | null;
                      status: "FAILED" | "PROCESSING" | "COMPLETED" | "CANCELLED";
                      targetAccountExternalId: string | null;
                      targetAccountId: number | null;
                      updatedAt: Date;
                  },
                  | "id"
                  | "externalId"
                  | "organizationId"
                  | "data"
                  | "customerId"
                  | "customerExternalId"
                  | "status"
                  | "identityId"
                  | "sourceAccountId"
                  | "sourceAccountExternalId"
                  | "targetAccountId"
                  | "targetAccountExternalId"
                  | "source",
              > & {
                  description: string
                  | undefined;
                  id: string;
                  source: { amount: BigNumber; currency: "MOVEUSD" };
                  sourceAccountId: string;
                  status: "FAILED" | "PROCESSING" | "COMPLETED" | "CANCELLED";
                  targetAccountId: string;
                  type: "IDENTITY" | "ORGANIZATION" | "PLATFORM";
              } & { sourceCustomerId: string; targetCustomerId: string }
              | null;
          },
      >

    • create's replay of a recurring charge and nothing else: null when no live transfer holds the key, so it never inserts a row or runs a guard.

      Parameters

      • request: Pick<ReplayRequest, "customerId" | "idempotencyKey" | "sourceAmount"> & {
            recurringFee: { periodKey: string };
        }

      Returns Promise<
          | { ok: true; value: CreatedFeeTransfer }
          | { error: IdempotencyKeyReused; ok: false }
          | null,
      >