Skip to content

Product Catalogue

The Product Catalogue is the admin-only surface (CRM → Product Catalogue) for managing what the operator sells: basic services, bill-cycles, price-plans and bundles (free-unit packages). Every mutation is enforced by the billing back-end over gRPC — so the integrity guards run in the same C++ process that rates and bills, never just in the UI.

Model

Entity Holds Source of truth
Service id (= on-wire svc), name, status service
Price-plan name, status, plus one or more dated versions (each: activation_date, monthly_fee, per-service unit prices) price_plan + price_plan_version + price_plan_service
Bundle name, per-service free units (-1 = unlimited), status bundle + bundle_service
Bill-cycle day of month, status billcycle

Two deliberate separations:

  • Services are fully dynamic. The operator defines as many services as the business sells. service.id is the canonical identifier and equals the on-wire svc carried by every CDR/Charge; the starter seed is 1 = Voice, 2 = SMS, 3 = Data, 4 = MMS.
  • Free units come only from the bundle. Price-plans carry prices; bundles carry allowances. A subscriber's monthly free units are exactly those of their assigned bundle (-1 = unlimited). "Free-unit package" and "bundle" are the same thing.

status is 1 active / 2 retired throughout.

Price-plan versioning

A price-plan does not expire — it versions. Editing a plan creates a new version effective from an activation date (00:00:00); the previous version retires on that date (its retirement date equals the next version's activation). Versions are identified by their date, not a 1.0/1.1 number.

  • price_plan_version (plan_id, activation_date, monthly_fee) holds the versions; each version owns its price book in price_plan_service (version_id, service_id, price).
  • price_plan.monthly_fee is a denormalised copy of the currently-active version's fee for display.
  • RefData ships the full history on REF_Price_plan.versions (PricePlanVersion: activation_date, retirement_date, monthly_fee, status, svc_price). The catalogue's view-history button (left of the edit pen) renders every version with its activated/retired dates.

UpdatePricePlan / CreatePricePlan carry an activation_date (0 = today). A version at the same activation date is replaced in place rather than duplicated.

CDRs rate on a two-dimensional date lookup (see Convergent Rating): (1) which plan the subscriber held at the event date, then (2) which version of that plan was active at the event date.

Operations & guards

All mutations are CRMService RPCs returning CatalogueResponse. A guard refusal surfaces as gRPC FAILED_PRECONDITION whose message names the blockers so the operator knows exactly what to change first.

RPC(s) Guard
AddService, RenameService — (rename e.g. Data → 5G traffic)
RetireService Refused while any active price-plan or bundle still contains the service. The error lists every blocking plan and bundle.
AddBillcycle, RetireBillcycle Retire refused while an active subscriber is assigned to it.
CreatePricePlan, UpdatePricePlan, RetirePricePlan Retire refused while an active subscriber is on the plan.
CreateBundle, UpdateBundle, RetireBundle Retire refused while an active subscriber holds the bundle.

There is also a lifecycle guard: moving a subscriber to ACTIVE (ActivateSubscriber or ReactivateSubscriber) is refused if its assigned plan / bundle / bill-cycle is retired — the message names the retired entity.

Per-subscriber changes & cutover

From a subscriber's page the operator can change the assigned plan, bundle or bill-cycle:

  • ChangeSubscriberPlan / ChangeSubscriberBundle accept a cutover unix timestamp (0 = now). Each appends a row to subscriber_plan_assignment (subscriber_id, plan_id, bundle_id, effective_from). The rater resolves the assignment effective at each event's tstamp, so usage that started before the cutover rates with the previous plan/bundle and usage at or after it rates with the new one (see Convergent Rating).
  • ChangeSubscriberBillcycle is next-cycle: the pending change is stored in subscriber_billcycle_change and applied by DB_layer::applyDueBillcycleChanges() at the start of the bill run once its effective period arrives — the current cycle still bills on the old day.

Persistence notes

  • Per-service plan prices and bundle units are stored in the price_plan_service and bundle_service junction tables and travel on the wire as protobuf maps (REF_Price_plan.svc_price, Bundle.svc_units).
  • Per-service invoice costs likewise live in bill_service, one row per service; see Invoicing.
  • RefData (via GetRefData) carries ref_bundle and the status flag on services, plans and bill-cycles so the CRM can render the full catalogue.