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

    Customer-tier CRUD over product_fee_rule. Always operates on the type='CUSTOMER' slice. Customer rules can only ADD markup (admin baseline stacks beneath); negative fixedFeeAmount / variableFeeBps are rejected with INVALID_FEE_RULE on both create() and update().

    Identity / version split: see ProductFeeRuleAdminService for the full description. Edits insert a new version row and re-point currentVersionId in one transaction.

    Internal admins must use ProductFeeRuleAdminService instead.

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    Methods

    • Parameters

      • input: {
            customerId: string;
            description?: string;
            effectiveFrom?: Instant;
            fixedFeeAmount?: BigNumber;
            label?: string;
            matcher?: Matcher;
            priority: number;
            routeId: string;
            variableFeeBps?: BigNumber;
        }
        • customerId: string
        • Optionaldescription?: string
        • OptionaleffectiveFrom?: Instant

          When this version becomes effective. Defaults to now() at the DB layer when omitted. Pass a future Temporal.Instant to schedule a change.

        • OptionalfixedFeeAmount?: BigNumber
        • Optionallabel?: string
        • Optionalmatcher?: Matcher
        • priority: number
        • routeId: string
        • OptionalvariableFeeBps?: BigNumber

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

    • TS-side symmetric evaluation of fee rules for a single route. Thin wrapper over search() + the shared pickWinningRule picker — mirrors the SQL CTE precedence in ProductRouteService.search().

      Returns the winning rule's fee terms (or null if no rule matches). The caller stacks this on top of the route's vendor-baseline fees.

      Parameters

      • input: {
            criteria: MatcherCriteria;
            customerId: string;
            now?: Instant;
            routeId: string;
        }

      Returns Promise<ProductFeeRule | null>

    • Returns fee rules visible to this customer:

      • admin-global (customerId IS NULL)
      • admin-for-this-customer (type='ADMIN', customerId=input.customerId)
      • customer-tier (type='CUSTOMER', customerId=input.customerId)

      Pass types: ["CUSTOMER"] from a controller to restrict to the customer's own writable slice. Write paths always operate on the CUSTOMER slice regardless of this filter.

      Parameters

      • input: {
            createdAt?: DbTimestampCriteria<Instant>;
            customerId: string;
            ids?: string[];
            orderBy?: "createdAt" | "updatedAt" | "priority";
            page?: number;
            pageSize?: number;
            routeIds?: string[];
            statuses?: ("ACTIVE" | "DISABLED")[];
            types?: ("ADMIN" | "CUSTOMER")[];
            updatedAt?: DbTimestampCriteria<Instant>;
        }

      Returns Promise<{ ok: true; value: { hasNext: boolean; items: ProductFeeRule[] } }>

    • Parameters

      • input: {
            customerId: string;
            data: {
                description?: string | null;
                effectiveFrom?: Instant;
                fixedFeeAmount?: BigNumber | null;
                label?: string | null;
                matcher?: Matcher;
                priority?: number;
                status?: "ACTIVE" | "DISABLED";
                variableFeeBps?: BigNumber | null;
            };
            id: string;
        }

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