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

    Program CRUD and grants (PROGRAM_ROUTING.md § 3.1, § 3.3). A grant is a permission: a customer may hold any number of programs, of any vendor.

    Index
    instance: (...args: []) => ProgramAdminService = ...

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

    • Whether an operator may grant each program: it is live, and a live ACTIVE route's version in effect names it. Without that route nothing could be placed under the grant, and RouteFusion onboarding would fail (§ 3.6).

      Parameters

      • __namedParameters: {
            programIds: string[];
            tx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>;
        }

      Returns Promise<{ ok: true; value: undefined } | { error: RoutedError; ok: false }>

    • Parameters

      • args: {
            bankAccountId?: string | null;
            bankId?: string | null;
            beneficiaryName?: string | null;
            description?: string | null;
            name: string;
            providerProgramId?: string | null;
            vendorId: Vendor;
        }

      Returns Promise<{ ok: true; value: Program } | { error: CreateError; ok: false }>

    • Soft-deletes a program, refused while any customer holds a grant on it. Deleting a deleted program succeeds and publishes again, as a retry.

      Parameters

      • __namedParameters: { id: string }

      Returns Promise<{ ok: true; value: undefined } | { error: DeleteError; ok: false }>

    • Grants the program to the customer, alongside any other grant they hold, the same vendor's included (§ 3.3). Re-granting a held program is a no-op. Refuses a program no placement route names; see checkRouted.

      Parameters

      • args: { customerId: string; grantedBy: string; programId: string }

      Returns Promise<
          | { ok: true; value: GrantChange }
          | { error: GrantError | RoutedError; ok: false },
      >

    • grant's body inside the caller's transaction, so the caller's own write commits or rolls back with it. Call invalidateGrant after the commit.

      Parameters

      • tx: PgAsyncTransaction
      • __namedParameters: { customerId: string; grantedBy: string; programId: string }

      Returns Promise<{ ok: true; value: GrantChange } | { error: GrantError; ok: false }>

    • After a grant or revoke commits: busts the program cache it touched and publishes it. A re-grant of a held program publishes again. Best-effort, since a caller's retry finds its grant committed and never calls this again.

      Parameters

      • change: GrantChange

      Returns Promise<void>

    • Removes the customer's grant on the program. Existing virtual accounts and memos are untouched (§ 4.5): only new minting stops.

      Parameters

      • args: { customerId: string; programId: string }

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

    • revoke's body inside the caller's transaction. Call invalidateGrant after the commit.

      Parameters

      • tx: PgAsyncTransaction
      • __namedParameters: { customerId: string; programId: string }

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

    • Edits a live program. null clears a nullable field and an omitted one is left alone. The provider program id may change only while no grant or virtual account references it: both carry it as the program's identity.

      Parameters

      • args: {
            active?: boolean;
            bankAccountId?: string | null;
            bankId?: string | null;
            beneficiaryName?: string | null;
            description?: string | null;
            id: string;
            name?: string;
            providerProgramId?: string | null;
        }

      Returns Promise<{ ok: true; value: Program } | { error: UpdateError; ok: false }>