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

    Move a reward program's overfunded excess out of the pool into another ledger account the same customer owns.

    The pool ("Rewards") ledger account is provisioned with ADMIN permissions, so the consumer LedgerAccountTransferService rejects it as a source; the move therefore goes through LedgerAccountTransferAdminService. That admin primitive neither caps the amount nor scopes the target to a customer, so this service owns the two reward-domain invariants it can't enforce:

    1. The amount never exceeds current headroom (funded − committed), so the pool is never drawn below the outstanding reward liability — you can only move out what the program is overfunded by.
    2. The target ledger account belongs to the same customer ("inside the customer"); the admin transfer allows arbitrary cross-customer targets.

    All amounts are MOVEUSD. Idempotency is caller-owned and threaded straight through to the transfer primitive.

    Index
    • Debit the reward pool by amount and credit targetLedgerAccountId, both owned by customerId. Bounded by current headroom (the overfunded excess).

      Parameters

      • __namedParameters: {
            amount: BigNumber;
            customerId: string;
            idempotencyKey: string;
            senderMessage?: string;
            targetLedgerAccountId: string;
        }
        • amount: BigNumber

          MOVEUSD amount to move out of the pool. Must be > 0 and <= headroom.

        • customerId: string
        • idempotencyKey: string

          Caller-owned dedupe token, threaded to the transfer primitive.

        • OptionalsenderMessage?: string
        • targetLedgerAccountId: string

      Returns Promise<
          | { ok: true; value: LedgerAccountTransfer }
          | {
              error:
                  | ServiceError<"REWARD_PROGRAM_NOT_FOUND">
                  | ServiceError<"HEADROOM_UNAVAILABLE">
                  | ServiceError<"INVALID_AMOUNT">
                  | ServiceError<"EXCEEDS_EXCESS", { headroom: string }>
                  | ServiceError<"INVALID_TARGET_ACCOUNT">
                  | LedgerAccountTransferAdminCreateError;
              ok: false;
          },
      >