Policies

Introduction

Policies define how the OCS will perform rating. A policy consists of both a Policy Types (also called Policy Classes) and Policies. A Policy refers to a specific Policy Type which defines the software logic for how the policy executes. The Policy itself provides hooks and configuration data to the Policy Type.

Policy Types are available system-wide and while pluggable are not configurable through the HTTP API at this stage.

A Policy consists of:

The same type of policy Type may be used multiple times within the OCS - e.g. allowing the OCS to provide Business and Consumer type wallets.

The following policy Types are available within the OCS as part of the default installation.

Policy Description
Location Based Rating Policy This policy is used to select a rate sheet based on a rating group, event time and the source & destination of the requested rating.
Specific Location Policy This policy is used to remove buckets from use in rating based on the source location of the rating request.
Allow Overdraft Policy This policy allows a debit to take a wallet into overdraft.
Static Rating Configuration Policy This policy supports defining a static set of rating configuration which may be applied based on policy selection.

Policy Selection

Policy selection is driven by the policy selector expression engine. Each policy may be given a selector expression which can consider the wallet, the rating request and the policy information to determine if it should be applied to the rating request.

For example, a policy selector may be defined to only apply if the rating context is 100, or 440. A policy selector may be defined to only apply to wallets with the annotation @Group=Prepaid. The flexibility of this approach means that within the OCS engine many policies may be defined, and their application depends on the context of the request.

Built-in Policies

Location Based Rating Policy

Policy Definition

This policy Type is used to select a rate sheet based on a rating group, event time and the source & destination of the requested rating.

Policies that implement this policy type must provide the following configuration:

Field Type Tags Description
rating_group String Optional If provided, the policy instance will match to rating requests that provide the given rating group in their request.
rate_table_schedule Array<RateTable> Required A list of rate tables, and timestamp from when each rate table is effective (see below).
  1. Check the rating group (if it exists) matches the rating request.
  2. Find the best match for source and destination location (supporting missing source and/or destination locations if appropriate).
  3. Return to the engine with rating rule details if match was found.

If a match isn’t found the policy will not be engaged in the rating request.

Rate Table Schedule

Rate tables often should take effect from a specific date/time in the future, so should be scheduled prior. The schedule is stored per policy in an array. Each array element is an object with the following details:

Field Type Tags Description
effective_from String Required An ISO 8601 date/time for when the rate table takes effect.
rate_table String Required The ID of the rate table that is taking effect.

For more information on rate tables see the rate sheet documentation.

Specific Location Policy

The specific location policy Type allows systems to manipulate rating based on the source or destination location of a request.

This policy Type allows for such services as:

When applied, policies of this Type will alter the buckets available during rating by either adding or removing any bucket which has a Specific Location annotation and the location(s) listed in the annotation do not match the source/destination location identified by the rating request.

No configuration parameters are required for the specific location policy Type.

Allow Overdraft Policy

Policy Definition

An overdraft policy using this Type can be applied to a wallet or globally to allow associated wallets to go into overdraft when a rating event charges a wallet.

This policy Type works by adding a temporary bucket to the list of buckets used for a rating event. This bucket is added to the bottom of the bucket cascade list and has the same unit type as the unit being rated.

The bucket will be configured with the Unlimited Value annotation which will allow the bucket to be charged to the extent necessary to allow the debit to succeed.

This policy Type requires the following configuration:

Field Type Tags Description
Keep bucket Boolean required This flag indicates whether the overdraft bucket, if used, should be stored back to the wallet’s bucket list.

Static Rating Configuration Policy

The static rating configuration policy is used to specify rating and reservation configuration for debit and session reservation requests. The following configuration can be added to this policy:

An instance of this policy, if configured to be used, should specify all the above - it is not possible to apply part of the configuration to a rating request even if the configuration itself does not expressly include other information. E.g. If only a balance cascade is defined, the maximum validity period is also defined.

This policy Type requires the following configuration:

Field Type Tags Description
cascade Array optional The array that allows the system to select the buckets to use when fulfilling a rating request. If not included, the default bucket cascade (which is to exclude named and flag buckets) is used.
ratios Array optional An array of unit conversion ratios to use if conversion between units is required for fulfilling this rating request. If not included, the default (which is no unit conversion) is used.
ratio Object optional A single unit conversion ratio, which may be specified instead of an array of ratios.
quantas Object optional A list of units and their quantas, in an object. Without this the default quanta is set to 1 unit for each type.
maximums Object optional A list of units and the maximum reservation that may be granted. Normally set to a multiple of the quanta, if this value is not then it is rounded up during rating to the quanta value.
defaults Object optional A list of units and the default reservation that will be granted if the engine is not given a value for reservation. Normally set to a multiple of the quanta, if this value is not then it is rounded up during rating to the quanta value.
validity_seconds Object optional The number of seconds any reservation that is granted under these rules is granted for. The default is 0 - reservations do not expire automatically.