Customer Data

Customer Data Functions

Overview

A great deal of the NCC data for billing engine usage is configured separately for each ACS customer (service provider). The NCC Charging API offers several accessor functions for retrieving this data within your scripts.

All customer-level data is cached (among all calls) for 300 seconds within the Lua runtime.

ACS Customer IDs

In order to use these functions, you will need to know the ACS customer ID you wish to query. This can be retrieved with the NCC API, either in the platform data (for all customers) or by accessing ACS engine fields (for the active subscriber’s customer).


Periodic Charges

Balance Types

Balance Units

Wallet Types

Product Types

Voucher Types

Named Events


ccs.customer.periodic_charges (acs_cust_id)
  Parameters acs_cust_id The ACS customer ID to retrieve periodic charge information for.
  Returns A (possibly empty) table of periodic charge definitions for the supplied ACS customer, formatted as:

{
	<CCS_PERIODIC_CHARGE.ID> = {
		ID = <CCS_PERIODIC_CHARGE.ID>
		NAME = <CCS_PERIODIC_CHARGE.NAME>
		PC_GROUP_ENTRY_ID = <CCS_PC_GROUP.ID>
		PC_GROUP_ID = <CCS_PC_GROUP.PC_GROUP_NAME_ID>
		ACS_CUST_ID = <CCS_PERIODIC_CHARGE.ACS_CUST_ID>
		RECHARGE_AMOUNT = <CCS_PERIODIC_CHARGE.RECHARGE_AMOUNT>
		WALLET_TYPE_ID = <CCS_PERIODIC_CHARGE.WALLET_TYPE>
		VOUCHER_TYPE_ID = <CCS_PERIODIC_CHARGE.VOUCHER_TYPE>
		BALANCE_TYPE_ID = <CCS_PERIODIC_CHARGE.BALANCE_TYPE_ID>
		ACCT_TYPES = {
			<CCS_AT_PERIODIC_CHARGE.ACCT_TYPE> = {
				ACCT_TYPE_ID = <CCS_AT_PERIODIC_CHARGE.ACCT_TYPE>
				CHARGE_ORDER = <CCS_AT_PERIODIC_CHARGE.CHARGE_ORDER>
			},
			<CCS_AT_PERIODIC_CHARGE.ACCT_TYPE> = {...}
		}
		REPEAT_PERIOD = <CCS_PERIODIC_CHARGE.REPEAT_PERIOD>
		REPEAT_MONTH = <CCS_PERIODIC_CHARGE.REPEAT_MONTH>
		REPEAT_DAY_OF_MONTH = <CCS_PERIODIC_CHARGE.REPEAT_DAY_OF_MONTH>
		REPEAT_DAY_OF_WEEK = <CCS_PERIODIC_CHARGE.REPEAT_DAY_OF_WEEK>
		CHARGE_TIME = <CCS_PERIODIC_CHARGE.CHARGE_TIME>
		PC_GROUP_NAME = <CCS_PC_GROUP_NAME.NAME>
		OPERATION_NAME = <CCS_PERIODIC_CHARGE.OPERATION_NAME>
		CHARGE_STATES = <CCS_PERIODIC_CHARGE.CHARGE_STATES>
		BASED_ON = <CCS_PERIODIC_CHARGE.BASED_ON>
		PRORATING_TYPE = <CCS_PC_PRORATING.TYPE>
		PRORATING_RULE = <CCS_PC_PRORATING.RULE>
	}
	<CCS_PERIODIC_CHARGE.ID> = {...}
}

  Errors If the ACS customer ID provided cannot be converted into a number, the following error will be raised:

ACS customer ID must be provided for periodic charge lookup.

If the retrieved periodic charges are not able to be turned into a table, the following error will be raised:

Retrieved periodic charges are not readable.

Usage This function queries the Lua runtime and extracts all periodic charge details for the provided ACS customer, returning it in a table of values.

local pcs = ccs.customer.periodic_charges (ncc.customer_id_for_name ('Boss'))
ncc.debug ("The Boss service provider has the following periodic charges defined:")
for k, v in pairs (pcs) do
	ncc.debug (v.NAME)
end

This data may come from the Lua runtime cache if it is available and fresh. Otherwise, it is retrieved from the local SLC database.


ccs.get_periodic_charge_by_name (acs_cust_id, periodic_charge_name)
  Parameters acs_cust_id The ACS customer ID to retrieve periodic charge information for.
    periodic_charge_name The name of the periodic charge to retrieve.
  Returns Either nil if no match is found, or a table for a single CCS periodic charge, formatted as:

{
	ID = <CCS_PERIODIC_CHARGE.ID>
	NAME = <CCS_PERIODIC_CHARGE.NAME>
	PC_GROUP_ENTRY_ID = <CCS_PC_GROUP.ID>
	PC_GROUP_ID = <CCS_PC_GROUP.PC_GROUP_NAME_ID>
	ACS_CUST_ID = <CCS_PERIODIC_CHARGE.ACS_CUST_ID>
	RECHARGE_AMOUNT = <CCS_PERIODIC_CHARGE.RECHARGE_AMOUNT>
	WALLET_TYPE_ID = <CCS_PERIODIC_CHARGE.WALLET_TYPE>
	VOUCHER_TYPE_ID = <CCS_PERIODIC_CHARGE.VOUCHER_TYPE>
	BALANCE_TYPE_ID = <CCS_PERIODIC_CHARGE.BALANCE_TYPE_ID>
	ACCT_TYPES = {
		<CCS_AT_PERIODIC_CHARGE.ACCT_TYPE> = {
			ACCT_TYPE_ID = <CCS_AT_PERIODIC_CHARGE.ACCT_TYPE>
			CHARGE_ORDER = <CCS_AT_PERIODIC_CHARGE.CHARGE_ORDER>
		},
		<CCS_AT_PERIODIC_CHARGE.ACCT_TYPE> = {...}
	}
	REPEAT_PERIOD = <CCS_PERIODIC_CHARGE.REPEAT_PERIOD>
	REPEAT_MONTH = <CCS_PERIODIC_CHARGE.REPEAT_MONTH>
	REPEAT_DAY_OF_MONTH = <CCS_PERIODIC_CHARGE.REPEAT_DAY_OF_MONTH>
	REPEAT_DAY_OF_WEEK = <CCS_PERIODIC_CHARGE.REPEAT_DAY_OF_WEEK>
	CHARGE_TIME = <CCS_PERIODIC_CHARGE.CHARGE_TIME>
	PC_GROUP_NAME = <CCS_PC_GROUP_NAME.NAME>
	OPERATION_NAME = <CCS_PERIODIC_CHARGE.OPERATION_NAME>
	CHARGE_STATES = <CCS_PERIODIC_CHARGE.CHARGE_STATES>
	BASED_ON = <CCS_PERIODIC_CHARGE.BASED_ON>
	PRORATING_TYPE = <CCS_PC_PRORATING.TYPE>
	PRORATING_RULE = <CCS_PC_PRORATING.RULE>
}

  Errors None.
Usage This function offers a helper lookup on the periodic charge data on the NCC system. It calls the ccs.customer.periodic_charges function with the supplied ACS customer ID and then searches for the periodic charge name provided, returning the periodic charge details if found. If the periodic charge is not found, nil is returned.

local my_charge = ccs.customer.get_periodic_charge_by_name (ncc.customer_id_for_name ('Boss'), "My Charge")
ncc.debug ("My Charge" uses the " .. my_charge.OPERATION_NAME .. " operation.")


ccs.get_periodic_charge_by_id (acs_cust_id, periodic_charge_id)
  Parameters acs_cust_id The ACS customer ID to retrieve periodic charge information for.
    periodic_charge_id The ID of the periodic charge to retrieve.
  Returns Either nil if no match is found, or a table for a single CCS periodic charge, formatted as:

{
	ID = <CCS_PERIODIC_CHARGE.ID>
	NAME = <CCS_PERIODIC_CHARGE.NAME>
	PC_GROUP_ENTRY_ID = <CCS_PC_GROUP.ID>
	PC_GROUP_ID = <CCS_PC_GROUP.PC_GROUP_NAME_ID>
	ACS_CUST_ID = <CCS_PERIODIC_CHARGE.ACS_CUST_ID>
	RECHARGE_AMOUNT = <CCS_PERIODIC_CHARGE.RECHARGE_AMOUNT>
	WALLET_TYPE_ID = <CCS_PERIODIC_CHARGE.WALLET_TYPE>
	VOUCHER_TYPE_ID = <CCS_PERIODIC_CHARGE.VOUCHER_TYPE>
	BALANCE_TYPE_ID = <CCS_PERIODIC_CHARGE.BALANCE_TYPE_ID>
	ACCT_TYPES = {
		<CCS_AT_PERIODIC_CHARGE.ACCT_TYPE> = {
			ACCT_TYPE_ID = <CCS_AT_PERIODIC_CHARGE.ACCT_TYPE>
			CHARGE_ORDER = <CCS_AT_PERIODIC_CHARGE.CHARGE_ORDER>
		},
		<CCS_AT_PERIODIC_CHARGE.ACCT_TYPE> = {...}
	}
	REPEAT_PERIOD = <CCS_PERIODIC_CHARGE.REPEAT_PERIOD>
	REPEAT_MONTH = <CCS_PERIODIC_CHARGE.REPEAT_MONTH>
	REPEAT_DAY_OF_MONTH = <CCS_PERIODIC_CHARGE.REPEAT_DAY_OF_MONTH>
	REPEAT_DAY_OF_WEEK = <CCS_PERIODIC_CHARGE.REPEAT_DAY_OF_WEEK>
	CHARGE_TIME = <CCS_PERIODIC_CHARGE.CHARGE_TIME>
	PC_GROUP_NAME = <CCS_PC_GROUP_NAME.NAME>
	OPERATION_NAME = <CCS_PERIODIC_CHARGE.OPERATION_NAME>
	CHARGE_STATES = <CCS_PERIODIC_CHARGE.CHARGE_STATES>
	BASED_ON = <CCS_PERIODIC_CHARGE.BASED_ON>
	PRORATING_TYPE = <CCS_PC_PRORATING.TYPE>
	PRORATING_RULE = <CCS_PC_PRORATING.RULE>
}

  Errors None.
Usage This function offers a helper lookup on the periodic charge data on the NCC system. It calls the ccs.customer.periodic_charges function with the supplied ACS customer ID and then searches for the periodic charge ID provided, returning the periodic charge details if found. If the periodic charge is not found, nil is returned.

local x = ccs.customer.get_periodic_charge_by_id (1, 123)
if (x) then 
	-- use charge details for processing


ccs.customer.periodic_charge_id_for_name (acs_cust_id, periodic_charge_name)
  Parameters acs_cust_id The ACS customer ID to retrieve periodic charge information for.
    periodic_charge_name The name of the periodic charge to retrieve the ID for.
  Returns The ID of the periodic charge that has the name provided, or nil if no match was found.
  Errors None.
Usage This is a specialised shortcut version of ccs.customer.get_periodic_charge_by_name that returns only the ID of the periodic charge name provided. If the periodic charge is not found, nil is returned.

local pc = ccs.customer.periodic_charge_id_for_name (123, 'No Such Charge')
if (not pc) then
	-- no charge found with that name


ccs.customer.periodic_charge_name_for_id (acs_cust_id, periodic_charge_id)
  Parameters acs_cust_id The ACS customer ID to retrieve periodic charge information for.
    periodic_charge_id The ID of the periodic charge to retrieve the name for.
  Returns The name of the periodic charge that has the ID provided, or nil if no match was found.
  Errors None.
Usage This is a specialised shortcut version of ccs.customer.get_periodic_charge_by_id that returns only the name of the periodic charge ID provided. If the periodic charge is not found, nil is returned.

if (subscriber_pc_name == 
	ccs.customer.periodic_charge_name_for_id (ncc.engine.acs_customer (), 
	target_pc_id)) then
	-- subscription found, continue


ccs.customer.periodic_charge.can_apply_charge (acs_cust_id, periodic_charge_id)
  Parameters acs_cust_id The ACS customer ID to check periodic charge information for.
    periodic_charge_id The ID of the periodic charge to check.
  Returns If the periodic charge supports a charge being applied during subscription management, returns true. Otherwise, returns false.
  Errors None.
Usage This function checks the specified periodic charge and returns true if the periodic charge has an operation name, recharge amount, or voucher type specified, i.e. is a credit or debit charge.

if (not ccs.customer.periodic_charge.can_apply_charge (acs_cust_id, periodic_charge_id)) then
	error ("Cannot apply a charge to a non-debit and non-credit periodic charge")
end


ccs.customer.periodic_charge.can_prorate (acs_cust_id, periodic_charge_id)
  Parameters acs_cust_id The ACS customer ID to check periodic charge information for.
    periodic_charge_id The ID of the periodic charge to check.
  Returns If the periodic charge supports pro-rating being applied during subscription management, returns true. Otherwise, returns false.
  Errors None.
Usage This function checks the specified periodic charge and returns true if the periodic charge has any pro-rating configuration.

if (not ccs.customer.periodic_charge.can_prorate (acs_cust_id, periodic_charge_id)) then
	error ("Cannot apply pro-rating to periodic charge with no pro-rating rule")
end


ccs.customer.periodic_charge.supports_reference (acs_cust_id, periodic_charge_id)
  Parameters acs_cust_id The ACS customer ID to check periodic charge information for.
    periodic_charge_id The ID of the periodic charge to check.
  Returns If the periodic charge supports a reference date being specified during subscription management, returns true. Otherwise, returns false.
  Errors None.
Usage This function checks the specified periodic charge and returns true if the periodic charge is based on a reference date, rather than fixed configuration.

if (reference_date and 
	not ccs.customer.periodic_charge.supports_reference 
	(acs_cust_id, periodic_charge_id)) then
	error ("Periodic charge " .. periodic_charge_id .. 
	" does not support reference date information")
end


ccs.customer.balance_types (acs_cust_id)
  Parameters acs_cust_id The ACS customer ID to retrieve balance type information for.
  Returns A (possibly empty) table of balance type definitions for the supplied ACS customer, formatted as:

{
	<CCS_BALANCE_TYPE.ID> = {
		NAME = <CCS_BALANCE_TYPE.NAME>
		ID = <CCS_BALANCE_TYPE.ID>
		UNIT = <CCS_BALANCE_TYPE.UNIT>
		ACS_CUST_ID = <CCS_BALANCE_TYPE.ACS_CUST_ID>
		SINGLE_DAY_EXPIRY_ANN_ID = <CCS_BALANCE_TYPE.SINGLE_DAY_EXPIRY_ANN_ID>
		EXPIRY_ANN_ID = <CCS_BALANCE_TYPE.EXPIRY_ANN_ID>
		POSITIVE_ANN_ID = <CCS_BALANCE_TYPE.POSITIVE_ANN_ID>
		NEGATIVE_ANN_ID = <CCS_BALANCE_TYPE.NEGATIVE_ANN_ID>
		CDR_NAME = <CCS_BALANCE_TYPE.CDR_NAME>
		DEFAULT_TYPE = <CCS_BALANCE_TYPE.DEFAULT_TYPE>
		PLAY_ZERO = <CCS_BALANCE_TYPE.PLAY_ZERO>
		EXCLUDE_FROM_CREATION = <CCS_BALANCE_TYPE.EXCLUDE_FROM_CREATION>
		EXP_TYPE = <CCS_BALANCE_TYPE.EXP_TYPE>
		DISPLAYSPENDRATIO = <CCS_BALANCE_TYPE.DISPLAYSPENDRATIO>
		ALLOW = <CCS_BALANCE_TYPE.ALLOW>
		NOTIFICATION = <CCS_BALANCE_TYPE.NOTIFICATION>
		TYPE = <CCS_BALANCE_TYPE.TYPE>
		XBD_DISCOUNT_PERCENTAGE = <CCS_BALANCE_TYPE.XBD_DISCOUNT_PERCENTAGE>
		MAX_BALANCE_VALUE = <CCS_BALANCE_TYPE.MAX_BALANCE_VALUE>
		MAX_BALANCE_POLICY = <CCS_BALANCE_TYPE.MAX_BALANCE_POLICY>
		DELETE_AFTER_EXPIRY = <CCS_BALANCE_TYPE.DELETE_AFTER_EXPIRY>
		EXPIRY_DATE_CALC_BASIS = <CCS_BALANCE_TYPE.EXPIRY_DATE_CALC_BASIS>
		BALANCE_EXPIRY_DATE = <CCS_BALANCE_TYPE.BALANCE_EXPIRY_DATE>
		RECREATE_BKT_ON_EXPIRY = <CCS_BALANCE_TYPE.RECREATE_BKT_ON_EXPIRY>
		ALLOW_CREDIT = <CCS_BALANCE_TYPE.ALLOW_CREDIT>
		QUOTA_VALUE_TAG = <CCS_BALANCE_TYPE.QUOTA_VALUE_TAG>
	}
	<CCS_BALANCE_TYPE.ID> = {...}
}

  Errors If the ACS customer ID provided cannot be converted into a number, the following error will be raised:

ACS customer ID must be provided for balance type lookup.

If the retrieved balance types are not able to be turned into a table, the following error will be raised:

Retrieved balance types are not readable.

Usage This function queries the Lua runtime and extracts all balance type details for the provided ACS customer, returning it in a table of values.

local bals = ccs.customer.balance_types (ncc.customer_id_for_name ('Boss'))
ncc.debug ("The Boss service provider has the following balance types defined:")
for k, v in pairs (bals) do
	ncc.debug (v.NAME)
end

This data may come from the Lua runtime cache if it is available and fresh. Otherwise, it is retrieved from the local SLC database.


ccs.get_balance_type_by_name (acs_cust_id, balance_type_name)
  Parameters acs_cust_id The ACS customer ID to retrieve balance type information for.
    balance_type_name The name of the balance type to retrieve.
  Returns Either nil if no match is found, or a table for a single CCS balance type, formatted as:

{
	NAME = <CCS_BALANCE_TYPE.NAME>
	ID = <CCS_BALANCE_TYPE.ID>
	UNIT = <CCS_BALANCE_TYPE.UNIT>
	ACS_CUST_ID = <CCS_BALANCE_TYPE.ACS_CUST_ID>
	SINGLE_DAY_EXPIRY_ANN_ID = <CCS_BALANCE_TYPE.SINGLE_DAY_EXPIRY_ANN_ID>
	EXPIRY_ANN_ID = <CCS_BALANCE_TYPE.EXPIRY_ANN_ID>
	POSITIVE_ANN_ID = <CCS_BALANCE_TYPE.POSITIVE_ANN_ID>
	NEGATIVE_ANN_ID = <CCS_BALANCE_TYPE.NEGATIVE_ANN_ID>
	CDR_NAME = <CCS_BALANCE_TYPE.CDR_NAME>
	DEFAULT_TYPE = <CCS_BALANCE_TYPE.DEFAULT_TYPE>
	PLAY_ZERO = <CCS_BALANCE_TYPE.PLAY_ZERO>
	EXCLUDE_FROM_CREATION = <CCS_BALANCE_TYPE.EXCLUDE_FROM_CREATION>
	EXP_TYPE = <CCS_BALANCE_TYPE.EXP_TYPE>
	DISPLAYSPENDRATIO = <CCS_BALANCE_TYPE.DISPLAYSPENDRATIO>
	ALLOW = <CCS_BALANCE_TYPE.ALLOW>
	NOTIFICATION = <CCS_BALANCE_TYPE.NOTIFICATION>
	TYPE = <CCS_BALANCE_TYPE.TYPE>
	XBD_DISCOUNT_PERCENTAGE = <CCS_BALANCE_TYPE.XBD_DISCOUNT_PERCENTAGE>
	MAX_BALANCE_VALUE = <CCS_BALANCE_TYPE.MAX_BALANCE_VALUE>
	MAX_BALANCE_POLICY = <CCS_BALANCE_TYPE.MAX_BALANCE_POLICY>
	DELETE_AFTER_EXPIRY = <CCS_BALANCE_TYPE.DELETE_AFTER_EXPIRY>
	EXPIRY_DATE_CALC_BASIS = <CCS_BALANCE_TYPE.EXPIRY_DATE_CALC_BASIS>
	BALANCE_EXPIRY_DATE = <CCS_BALANCE_TYPE.BALANCE_EXPIRY_DATE>
	RECREATE_BKT_ON_EXPIRY = <CCS_BALANCE_TYPE.RECREATE_BKT_ON_EXPIRY>
	ALLOW_CREDIT = <CCS_BALANCE_TYPE.ALLOW_CREDIT>
	QUOTA_VALUE_TAG = <CCS_BALANCE_TYPE.QUOTA_VALUE_TAG>
}

  Errors None.
Usage This function offers a helper lookup on the balance type data on the NCC system. It calls the ccs.customer.balance_types function with the supplied ACS customer ID and then searches for the balance type name provided, returning the balance type details if found. If the balance type is not found, nil is returned.

local gc = ccs.customer.get_balance_type_by_name (acs_cust_id, "General Cash")
ncc.debug ("The General Cash unit type ID for the active customer is " .. gc.UNIT)


ccs.get_balance_type_by_id (acs_cust_id, balance_type_id)
  Parameters acs_cust_id The ACS customer ID to retrieve balance type information for.
    balance_type_id The ID of the balance type to retrieve.
  Returns Either nil if no match is found, or a table for a single CCS balance type, formatted as:

{
	NAME = <CCS_BALANCE_TYPE.NAME>
	ID = <CCS_BALANCE_TYPE.ID>
	UNIT = <CCS_BALANCE_TYPE.UNIT>
	ACS_CUST_ID = <CCS_BALANCE_TYPE.ACS_CUST_ID>
	SINGLE_DAY_EXPIRY_ANN_ID = <CCS_BALANCE_TYPE.SINGLE_DAY_EXPIRY_ANN_ID>
	EXPIRY_ANN_ID = <CCS_BALANCE_TYPE.EXPIRY_ANN_ID>
	POSITIVE_ANN_ID = <CCS_BALANCE_TYPE.POSITIVE_ANN_ID>
	NEGATIVE_ANN_ID = <CCS_BALANCE_TYPE.NEGATIVE_ANN_ID>
	CDR_NAME = <CCS_BALANCE_TYPE.CDR_NAME>
	DEFAULT_TYPE = <CCS_BALANCE_TYPE.DEFAULT_TYPE>
	PLAY_ZERO = <CCS_BALANCE_TYPE.PLAY_ZERO>
	EXCLUDE_FROM_CREATION = <CCS_BALANCE_TYPE.EXCLUDE_FROM_CREATION>
	EXP_TYPE = <CCS_BALANCE_TYPE.EXP_TYPE>
	DISPLAYSPENDRATIO = <CCS_BALANCE_TYPE.DISPLAYSPENDRATIO>
	ALLOW = <CCS_BALANCE_TYPE.ALLOW>
	NOTIFICATION = <CCS_BALANCE_TYPE.NOTIFICATION>
	TYPE = <CCS_BALANCE_TYPE.TYPE>
	XBD_DISCOUNT_PERCENTAGE = <CCS_BALANCE_TYPE.XBD_DISCOUNT_PERCENTAGE>
	MAX_BALANCE_VALUE = <CCS_BALANCE_TYPE.MAX_BALANCE_VALUE>
	MAX_BALANCE_POLICY = <CCS_BALANCE_TYPE.MAX_BALANCE_POLICY>
	DELETE_AFTER_EXPIRY = <CCS_BALANCE_TYPE.DELETE_AFTER_EXPIRY>
	EXPIRY_DATE_CALC_BASIS = <CCS_BALANCE_TYPE.EXPIRY_DATE_CALC_BASIS>
	BALANCE_EXPIRY_DATE = <CCS_BALANCE_TYPE.BALANCE_EXPIRY_DATE>
	RECREATE_BKT_ON_EXPIRY = <CCS_BALANCE_TYPE.RECREATE_BKT_ON_EXPIRY>
	ALLOW_CREDIT = <CCS_BALANCE_TYPE.ALLOW_CREDIT>
	QUOTA_VALUE_TAG = <CCS_BALANCE_TYPE.QUOTA_VALUE_TAG>
}

  Errors None.
Usage This function offers a helper lookup on the balance type data on the NCC system. It calls the ccs.customer.balance_types function with the supplied ACS customer ID and then searches for the balance type ID provided, returning the balance type details if found. If the balance type is not found, nil is returned.

local x = ccs.customer.get_balance_type_by_id (1, 123)
if (x) then 
	-- balance type exists; use details for processing


ccs.customer.balance_type_id_for_name (acs_cust_id, balance_type_name)
  Parameters acs_cust_id The ACS customer ID to retrieve balance type information for.
    balance_type_name The name of the balance type to retrieve the ID for.
  Returns The ID of the balance type that has the name provided, or nil if no match was found.
  Errors None.
Usage This is a specialised shortcut version of ccs.customer.get_balance_type_by_name that returns only the ID of the balance type name provided. If the balance type is not found, nil is returned.

local bal_id = ccs.customer.balance_type_id_for_name ('No Such Balance Type')
if (not bal_id) then
	-- no balance type found with that name


ccs.customer.balance_type_name_for_id (acs_cust_id, balance_type_id)
  Parameters acs_cust_id The ACS customer ID to retrieve balance type information for.
    balance_type_id The ID of the balance type to retrieve the name for.
  Returns The name of the balance type that has the ID provided, or nil if no match was found.
  Errors None.
Usage This is a specialised shortcut version of ccs.customer.get_balance_type_by_id that returns only the name of the balance type ID provided. If the balance type is not found, nil is returned.

if (bal_name == 
	ccs.customer.balance_type_name_for_id (ncc.engine.acs_customer (), 
	target_bal_id)) then
	-- balance matched, continue


ccs.customer.balance_type_is_periodic_charge (acs_cust_id, balance_type_id, lookup_info)
  Parameters acs_cust_id The ACS customer ID to retrieve balance type information for.
    balance_type_id The ID of the balance type to check.
    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns If the balance type is a periodic charge, true. Otherwise false.
  Errors If the ACS customer ID provided does not have any periodic charges:

No periodic charges found for ACS customer ID <acs_cust_id>.

Usage This function examines the periodic charges for the ACS customer ID provided, retrieving them from the runtime if not provided in the lookup_info table. If the balance type ID is found in the periodic charge balance types, true is returned. In all other cases, false is returned.

local bal_type_id = 123
if (ccs.customer.balance_type_is_periodic_charge (1, bal_type_id)) then
	-- process as a periodic charge and not a normal balance type


ccs.customer.balance_units (acs_cust_id)
  Parameters acs_cust_id The ACS customer ID to retrieve balance unit information for.
  Returns A (possibly empty) table of balance unit definitions for the supplied ACS customer, formatted as:

{
	<CCS_BALANCE_UNIT.ID> = {
		NAME = <CCS_BALANCE_UNIT.NAME>
		ID = <CCS_BALANCE_UNIT.ID>
	}
	<CCS_BALANCE_UNIT.ID> = {...}
}

  Errors If the ACS customer ID provided cannot be converted into a number, the following error will be raised:

ACS customer ID must be provided for balance unit lookup.

If the retrieved balance units are not able to be turned into a table, the following error will be raised:

Retrieved balance units are not readable.

Usage This function queries the Lua runtime and extracts all balance unit details for the provided ACS customer, returning it in a table of values.

local units = ccs.customer.balance_units (ncc.customer_id_for_name ('Boss'))
ncc.debug ("The Boss service provider has the following balance units defined:")
for k, v in pairs (units) do
	ncc.debug (v.NAME)
end

This data may come from the Lua runtime cache if it is available and fresh. Otherwise, it is retrieved from the local SLC database.


ccs.get_balance_unit_by_name (acs_cust_id, balance_unit_name)
  Parameters acs_cust_id The ACS customer ID to retrieve balance unit information for.
    balance_unit_name The name of the balance unit to retrieve.
  Returns Either nil if no match is found, or a table for a single CCS balance unit, formatted as:

{
	NAME = <CCS_BALANCE_UNIT.NAME>
	ID = <CCS_BALANCE_UNIT.ID>
}

  Errors None.
Usage This function offers a helper lookup on the balance unit data on the NCC system. It calls the ccs.customer.balance_units function with the supplied ACS customer ID and then searches for the balance unit name provided, returning the balance unit details if found. If the balance unit is not found, nil is returned.

local cash = ccs.customer.get_balance_unit_by_name (acs_cust_id, "Cash")
ncc.debug ("The Cash unit ID for the active customer is " .. cash.ID)


ccs.get_balance_unit_by_id (acs_cust_id, balance_unit_id)
  Parameters acs_cust_id The ACS customer ID to retrieve balance unit information for.
    balance_unit_id The ID of the balance unit to retrieve.
  Returns Either nil if no match is found, or a table for a single CCS balance unit, formatted as:

{
	NAME = <CCS_BALANCE_UNIT.NAME>
	ID = <CCS_BALANCE_UNIT.ID>
}

  Errors None.
Usage This function offers a helper lookup on the balance unit data on the NCC system. It calls the ccs.customer.balance_units function with the supplied ACS customer ID and then searches for the balance unit ID provided, returning the balance unit details if found. If the balance unit is not found, nil is returned.

local x = ccs.customer.get_balance_unit_by_id (1, 123)
if (x) then 
	-- balance unit exists; use details for processing


ccs.customer.balance_unit_id_for_name (acs_cust_id, balance_unit_name)
  Parameters acs_cust_id The ACS customer ID to retrieve balance unit information for.
    balance_unit_name The name of the balance unit to retrieve the ID for.
  Returns The ID of the balance unit that has the name provided, or nil if no match was found.
  Errors None.
Usage This is a specialised shortcut version of ccs.customer.get_balance_unit_by_name that returns only the ID of the balance unit name provided. If the balance unit is not found, nil is returned.

local unit_id = ccs.customer.balance_unit_id_for_name ('No Such Balance Unit')
if (not unit_id) then
	-- no balance unit found with that name


ccs.customer.balance_unit_name_for_id (acs_cust_id, balance_unit_id)
  Parameters acs_cust_id The ACS customer ID to retrieve balance unit information for.
    balance_unit_id The ID of the balance unit to retrieve the name for.
  Returns The name of the balance unit that has the ID provided, or nil if no match was found.
  Errors None.
Usage This is a specialised shortcut version of ccs.customer.get_balance_unit_by_id that returns only the name of the balance unit ID provided. If the balance unit is not found, nil is returned.

if (unit_name == 
	ccs.customer.balance_unit_name_for_id (ncc.engine.acs_customer (), 
	target_unit_id)) then
	-- unit matched, continue


ccs.customer.wallet_types (acs_cust_id)
  Parameters acs_cust_id The ACS customer ID to retrieve wallet type information for.
  Returns A (possibly empty) table of wallet type definitions for the supplied ACS customer, formatted as:

{
	<CCS_WALLET_TYPE.ID> = {
		NAME = <CCS_WALLET_TYPE.NAME>
		ID = <CCS_WALLET_TYPE.ID>
		DEFAULT = <true|false>
	}
	<CCS_WALLET_TYPE.ID> = {...}
}

  Errors If the ACS customer ID provided cannot be converted into a number, the following error will be raised:

ACS customer ID must be provided for wallet type lookup.

If the retrieved wallet types are not able to be turned into a table, the following error will be raised:

Retrieved wallet types are not readable.

Usage This function queries the Lua runtime and extracts all wallet type details for the provided ACS customer, returning it in a table of values.

local wallets = ccs.customer.wallet_types (ncc.customer_id_for_name ('Boss'))
ncc.debug ("The Boss service provider has the following wallet types defined:")
for k, v in pairs (bals) do
	ncc.debug (v.NAME)
end

This data may come from the Lua runtime cache if it is available and fresh. Otherwise, it is retrieved from the local SLC database.


ccs.get_wallet_type_by_name (acs_cust_id, wallet_type_name)
  Parameters acs_cust_id The ACS customer ID to retrieve wallet type information for.
    wallet_type_name The name of the wallet type to retrieve.
  Returns Either nil if no match is found, or a table for a single CCS wallet type, formatted as:

{
	NAME = <CCS_WALLET_TYPE.NAME>
	ID = <CCS_WALLET_TYPE.ID>
	DEFAULT = <true|false>
}

  Errors None.
Usage This function offers a helper lookup on the wallet type data on the NCC system. It calls the ccs.customer.wallet_types function with the supplied ACS customer ID and then searches for the wallet type name provided, returning the wallet type details if found. If the wallet type is not found, nil is returned.

local w = ccs.customer.get_wallet_type_by_name (acs_cust_id, "Primary")
if (w.DEFAULT) then
	ncc.debug ("The Primary wallet type for the active customer is the default type")
end


ccs.get_wallet_type_by_id (acs_cust_id, wallet_type_id)
  Parameters acs_cust_id The ACS customer ID to retrieve wallet type information for.
    wallet_type_id The ID of the wallet type to retrieve.
  Returns Either nil if no match is found, or a table for a single CCS wallet type, formatted as:

{
	NAME = <CCS_WALLET_TYPE.NAME>
	ID = <CCS_WALLET_TYPE.ID>
	DEFAULT = <true|false>
}

  Errors None.
Usage This function offers a helper lookup on the wallet type data on the NCC system. It calls the ccs.customer.wallet_types function with the supplied ACS customer ID and then searches for the wallet type ID provided, returning the wallet type details if found. If the wallet type is not found, nil is returned.

local x = ccs.customer.get_wallet_type_by_id (1, 123)
if (x) then 
	-- wallet type exists; use details for processing


ccs.customer.wallet_type_id_for_name (acs_cust_id, wallet_type_name)
  Parameters acs_cust_id The ACS customer ID to retrieve wallet type information for.
    wallet_type_name The name of the wallet type to retrieve the ID for.
  Returns The ID of the wallet type that has the name provided, or nil if no match was found.
  Errors None.
Usage This is a specialised shortcut version of ccs.customer.get_wallet_type_by_name that returns only the ID of the wallet type name provided. If the wallet type is not found, nil is returned.

local wt_id = ccs.customer.wallet_type_id_for_name ('No Such Wallet Type')
if (not wt_id) then
	-- no wallet type found with that name


ccs.customer.wallet_type_name_for_id (acs_cust_id, wallet_type_id)
  Parameters acs_cust_id The ACS customer ID to retrieve wallet type information for.
    wallet_type_id The ID of the wallet type to retrieve the name for.
  Returns The name of the wallet type that has the ID provided, or nil if no match was found.
  Errors None.
Usage This is a specialised shortcut version of ccs.customer.get_wallet_type_by_id that returns only the name of the wallet type ID provided. If the wallet type is not found, nil is returned.

if (wt_name == 
	ccs.customer.wallet_type_name_for_id (ncc.engine.acs_customer (), 
	target_wt_id)) then
	-- wallet type matched, continue


ccs.customer.product_types (acs_cust_id)
  Parameters acs_cust_id The ACS customer ID to retrieve product type information for.
  Returns A (possibly empty) table of product type definitions for the supplied ACS customer, formatted as:

{
	<CCS_ACCT_TYPE.ID> = {
		NAME = <CCS_ACCT_TYPE.NAME>
		ID = <CCS_ACCT_TYPE.ID>
	}
	<CCS_ACCT_TYPE.ID> = {...}
}

  Errors If the ACS customer ID provided cannot be converted into a number, the following error will be raised:

ACS customer ID must be provided for product type lookup.

If the retrieved product types are not able to be turned into a table, the following error will be raised:

Retrieved product types are not readable.

Usage This function queries the Lua runtime and extracts all product type details for the provided ACS customer, returning it in a table of values.

local products = ccs.customer.product_types (ncc.customer_id_for_name ('Boss'))
ncc.debug ("The Boss service provider has the following product types defined:")
for k, v in pairs (bals) do
	ncc.debug (v.NAME)
end

This data may come from the Lua runtime cache if it is available and fresh. Otherwise, it is retrieved from the local SLC database.


ccs.get_product_type_by_name (acs_cust_id, product_type_name)
  Parameters acs_cust_id The ACS customer ID to retrieve product type information for.
    product_type_name The name of the product type to retrieve.
  Returns Either nil if no match is found, or a table for a single CCS product type, formatted as:

{
	NAME = <CCS_ACCT_TYPE.NAME>
	ID = <CCS_ACCT_TYPE.ID>
}

  Errors None.
Usage This function offers a helper lookup on the product type data on the NCC system. It calls the ccs.customer.product_types function with the supplied ACS customer ID and then searches for the product type name provided, returning the product type details if found. If the product type is not found, nil is returned.

local pt = ccs.customer.get_product_type_by_name (acs_cust_id, "Postpaid")
if (pt) then
	ncc.debug ("The Postpaid product type ID for the active customer is " .. pt.ID)
end


ccs.get_product_type_by_id (acs_cust_id, product_type_id)
  Parameters acs_cust_id The ACS customer ID to retrieve product type information for.
    product_type_id The ID of the product type to retrieve.
  Returns Either nil if no match is found, or a table for a single CCS product type, formatted as:

{
	NAME = <CCS_ACCT_TYPE.NAME>
	ID = <CCS_ACCT_TYPE.ID>
}

  Errors None.
Usage This function offers a helper lookup on the product type data on the NCC system. It calls the ccs.customer.product_types function with the supplied ACS customer ID and then searches for the product type ID provided, returning the product type details if found. If the product type is not found, nil is returned.

local x = ccs.customer.get_product_type_by_id (1, 123)
if (x) then 
	-- product type exists; use details for processing


ccs.customer.product_type_id_for_name (acs_cust_id, product_type_name)
  Parameters acs_cust_id The ACS customer ID to retrieve product type information for.
    product_type_name The name of the product type to retrieve the ID for.
  Returns The ID of the product type that has the name provided, or nil if no match was found.
  Errors None.
Usage This is a specialised shortcut version of ccs.customer.get_product_type_by_name that returns only the ID of the product type name provided. If the product type is not found, nil is returned.

local pt_id = ccs.customer.product_type_id_for_name ('No Such Product Type')
if (not pt_id) then
	-- no product type found with that name


ccs.customer.product_type_name_for_id (acs_cust_id, product_type_id)
  Parameters acs_cust_id The ACS customer ID to retrieve product type information for.
    product_type_id The ID of the product type to retrieve the name for.
  Returns The name of the product type that has the ID provided, or nil if no match was found.
  Errors None.
Usage This is a specialised shortcut version of ccs.customer.get_product_type_by_id that returns only the name of the product type ID provided. If the product type is not found, nil is returned.

if (pt_name == 
	ccs.customer.product_type_name_for_id (ncc.engine.acs_customer (), 
	target_pt_id)) then
	-- product type matched, continue


ccs.customer.voucher_types (acs_cust_id)
  Parameters acs_cust_id The ACS customer ID to retrieve voucher type information for.
  Returns A (possibly empty) table of voucher type definitions for the supplied ACS customer, formatted as:

{
	<CCS_RECHARGE_TYPE.ID> = {
		ID = <CCS_RECHARGE_TYPE.ID>
		NAME = <CCS_RECHARGE_TYPE.NAME>
		ACS_CUST_ID = <CCS_RECHARGE_TYPE.ACS_CUST_ID>
		PRE_USE_EXPIRY = <CCS_RECHARGE_TYPE.PRE_USE_EXPIRY>
		VR_ACCT_EXPIRY_PERIOD = <CCS_RECHARGE_TYPE.VR_ACCT_EXPIRY_PERIOD>
		CDR_DESCRIPTION = <CCS_RECHARGE_TYPE.CDR_DESCRIPTION>
		WALLET_EXP_POLICY = <CCS_RECHARGE_TYPE.WALLET_EXP_POLICY>
		VR_ACCT_EXP_PERIOD_TYPE = <CCS_RECHARGE_TYPE.VR_ACCT_EXP_PERIOD_TYPE>
		TYPE = <CCS_RECHARGE_TYPE.TYPE>
		BONUS_COMPONENT = <CCS_RECHARGE_TYPE.BONUS_COMPONENT>
		}
	}
	<CCS_RECHARGE_TYPE.ID> = {...}
}

  Errors If the ACS customer ID provided cannot be converted into a number, the following error will be raised:

ACS customer ID must be provided for voucher type lookup.

If the retrieved voucher types are not able to be turned into a table, the following error will be raised:

Retrieved voucher types are not readable.

Usage This function queries the Lua runtime and extracts all voucher type details for the provided ACS customer, returning it in a table of values.

local vouchers = ccs.customer.voucher_types (ncc.customer_id_for_name ('Boss'))
ncc.debug ("The Boss service provider has the following voucher types defined:")
for k, v in pairs (vouchers) do
	ncc.debug (v.NAME)
end

This data may come from the Lua runtime cache if it is available and fresh. Otherwise, it is retrieved from the local SLC database.


ccs.customer.voucher_type_balances (acs_cust_id)
  Parameters acs_cust_id The ACS customer ID to retrieve voucher type balance information for.
  Returns A (possibly empty) table of voucher type balance definitions for the supplied ACS customer, formatted as:

{
	<CCS_MB_RECHARGE.ID> = {
		ID = <CCS_MB_RECHARGE.ID>
		ACS_CUST_ID = <CCS_MB_RECHARGE.ACS_CUST_ID>
		BALANCE_TYPE_ID = <CCS_MB_RECHARGE.BALANCE_TYPE_ID>
		RECHARGE_TYPE_ID = <CCS_MB_RECHARGE.RECHARGE_TYPE_ID>
		VALUE = <CCS_MB_RECHARGE.VALUE>
		BALANCE_EXPIRY_PERIOD = <CCS_MB_RECHARGE.BALANCE_EXPIRY_PERIOD>
		START_DATE = <CCS_MB_RECHARGE.START_DATE>
		END_DATE = <CCS_MB_RECHARGE.END_DATE>
		NEW_BUCKET = <CCS_MB_RECHARGE.NEW_BUCKET>
		BAL_EXPIRY_POLICY = <CCS_MB_RECHARGE.BAL_EXPIRY_POLICY>
		MISSING_BALANCE_POLICY = <CCS_MB_RECHARGE.MISSING_BALANCE_POLICY>
		REPLACE_BALANCE = <CCS_MB_RECHARGE.REPLACE_BALANCE>
		BAL_EXPIRY_PERIOD_TYPE = <CCS_MB_RECHARGE.BAL_EXPIRY_PERIOD_TYPE>
		SCENARIO = <CCS_MB_RECHARGE.SCENARIO>
		BAL_OFFSET_DATE = <CCS_MB_RECHARGE.BAL_OFFSET_DATE>
		BAL_OFFSET_PERIOD_EXTENSION = <CCS_MB_RECHARGE.BAL_OFFSET_PERIOD_EXTENSION>
		BAL_OFFSET_PERIOD_TYPE = <CCS_MB_RECHARGE.BAL_OFFSET_PERIOD_TYPE>
		VALUE_TYPE = <CCS_MB_RECHARGE.VALUE_TYPE>
		BAL_EXPIRY_DATE = <CCS_MB_RECHARGE.BAL_EXPIRY_DATE>
		BAL_EXPIRY_MONTHS = <CCS_MB_RECHARGE.BAL_EXPIRY_MONTHS>
		TAX_PLAN = <CCS_MB_RECHARGE.TAX_PLAN>
		RELOAD_COUNTER = <CCS_MB_RECHARGE.RELOAD_COUNTER>
		}
	}
	<CCS_MB_RECHARGE.ID> = {...}
}

  Errors If the ACS customer ID provided cannot be converted into a number, the following error will be raised:

ACS customer ID must be provided for voucher type balance lookup.

If the retrieved voucher type balances are not able to be turned into a table, the following error will be raised:

Retrieved voucher type balances are not readable.

Usage This function queries the Lua runtime and extracts all voucher type balances for the provided ACS customer, returning it in a table of values.

local vouchers = ccs.customer.voucher_type_balances (ncc.customer_id_for_name ('Boss'))
ncc.debug ("The Boss service provider has the following voucher type balances defined:")
for k, v in pairs (vouchers) do
	ncc.debug ("Balance Type: " .. v.BALANCE_TYPE_ID .. ", value: " .. v.VALUE)
end

This data may come from the Lua runtime cache if it is available and fresh. Otherwise, it is retrieved from the local SLC database.

  Usage Notes Note that in order for this function to be available, the NCC SLC must have the CCS_MB_RECHARGE table manually created and replicated on the SLC - by default it is only created and available on VWS nodes.


ccs.customer.get_voucher_type_by_name (acs_cust_id, voucher_type_name)
  Parameters acs_cust_id The ACS customer ID to retrieve voucher type information for.
    voucher_type_name The name of the voucher type to retrieve.
  Returns Either nil if no match is found, or a table for a single CCS voucher type, formatted as:

{
	ID = <CCS_RECHARGE_TYPE.ID>
	NAME = <CCS_RECHARGE_TYPE.NAME>
	ACS_CUST_ID = <CCS_RECHARGE_TYPE.ACS_CUST_ID>
	PRE_USE_EXPIRY = <CCS_RECHARGE_TYPE.PRE_USE_EXPIRY>
	VR_ACCT_EXPIRY_PERIOD = <CCS_RECHARGE_TYPE.VR_ACCT_EXPIRY_PERIOD>
	CDR_DESCRIPTION = <CCS_RECHARGE_TYPE.CDR_DESCRIPTION>
	WALLET_EXP_POLICY = <CCS_RECHARGE_TYPE.WALLET_EXP_POLICY>
	VR_ACCT_EXP_PERIOD_TYPE = <CCS_RECHARGE_TYPE.VR_ACCT_EXP_PERIOD_TYPE>
	TYPE = <CCS_RECHARGE_TYPE.TYPE>
	BONUS_COMPONENT = <CCS_RECHARGE_TYPE.BONUS_COMPONENT>
}

  Errors If the ACS customer ID provided cannot be converted into a number, the following error will be raised:

ACS customer ID must be provided for voucher type lookup.

If the voucher type name is not provided, the following error will be raised:

Voucher type name must be provided for voucher type lookup.

Usage This function offers a helper lookup on the voucher type data on the NCC system. It calls the ccs.customer.voucher_types function with the supplied ACS customer ID and then searches for the voucher type name provided, returning the voucher type details if found. If the voucher type is not found, nil is returned.

local my_voucher = ccs.customer.get_voucher_type_by_name (ncc.customer_id_for_name ('Boss'), "My Voucher")
ncc.debug ("My Voucher" has a pre-use expiry of " .. my_voucher.PRE_USE_EXPIRY .. " days.")


ccs.customer.get_voucher_type_by_id (acs_cust_id, voucher_type_id)
  Parameters acs_cust_id The ACS customer ID to retrieve voucher type information for.
    voucher_type_id The ID of the voucher type to retrieve.
  Returns Either nil if no match is found, or a table for a single CCS voucher type, formatted as:

{
	ID = <CCS_RECHARGE_TYPE.ID>
	NAME = <CCS_RECHARGE_TYPE.NAME>
	ACS_CUST_ID = <CCS_RECHARGE_TYPE.ACS_CUST_ID>
	PRE_USE_EXPIRY = <CCS_RECHARGE_TYPE.PRE_USE_EXPIRY>
	VR_ACCT_EXPIRY_PERIOD = <CCS_RECHARGE_TYPE.VR_ACCT_EXPIRY_PERIOD>
	CDR_DESCRIPTION = <CCS_RECHARGE_TYPE.CDR_DESCRIPTION>
	WALLET_EXP_POLICY = <CCS_RECHARGE_TYPE.WALLET_EXP_POLICY>
	VR_ACCT_EXP_PERIOD_TYPE = <CCS_RECHARGE_TYPE.VR_ACCT_EXP_PERIOD_TYPE>
	TYPE = <CCS_RECHARGE_TYPE.TYPE>
	BONUS_COMPONENT = <CCS_RECHARGE_TYPE.BONUS_COMPONENT>
}

  Errors If the ACS customer ID provided cannot be converted into a number, the following error will be raised:

ACS customer ID must be provided for voucher type lookup.

If the voucher type ID is not provided, the following error will be raised:

Voucher type ID must be provided for voucher type lookup.

Usage This function offers a helper lookup on the voucher type data on the NCC system. It calls the ccs.customer.voucher_types function with the supplied ACS customer ID and then searches for the voucher type ID provided, returning the voucher type details if found. If the voucher type is not found, nil is returned.

local my_voucher = ccs.customer.get_voucher_type_by_id (ncc.customer_id_for_name ('Boss'), 50)
ncc.debug ("My Voucher" has a pre-use expiry of " .. my_voucher.PRE_USE_EXPIRY .. " days.")


ccs.customer.get_voucher_type_balances (acs_cust_id, voucher_type)
  Parameters acs_cust_id The ACS customer ID to retrieve voucher type information for.
    voucher_type The table entry (ccs.customer.voucher_types) of the voucher type to retrieve balance information for.
  Returns If no match is found, an unchanged table is returned. If a match is found, the provided table has the balances added, formatted as:

{
	ID = <CCS_RECHARGE_TYPE.ID>
	NAME = <CCS_RECHARGE_TYPE.NAME>
	ACS_CUST_ID = <CCS_RECHARGE_TYPE.ACS_CUST_ID>
	PRE_USE_EXPIRY = <CCS_RECHARGE_TYPE.PRE_USE_EXPIRY>
	VR_ACCT_EXPIRY_PERIOD = <CCS_RECHARGE_TYPE.VR_ACCT_EXPIRY_PERIOD>
	CDR_DESCRIPTION = <CCS_RECHARGE_TYPE.CDR_DESCRIPTION>
	WALLET_EXP_POLICY = <CCS_RECHARGE_TYPE.WALLET_EXP_POLICY>
	VR_ACCT_EXP_PERIOD_TYPE = <CCS_RECHARGE_TYPE.VR_ACCT_EXP_PERIOD_TYPE>
	TYPE = <CCS_RECHARGE_TYPE.TYPE>
	BONUS_COMPONENT = <CCS_RECHARGE_TYPE.BONUS_COMPONENT>
	BALANCES[CCS_MB_RECHARGE.BALANCE_TYPE_ID] = {
		ID = <CCS_MB_RECHARGE.ID>
		ACS_CUST_ID = <CCS_MB_RECHARGE.ACS_CUST_ID>
		BALANCE_TYPE_ID = <CCS_MB_RECHARGE.BALANCE_TYPE_ID>
		RECHARGE_TYPE_ID = <CCS_MB_RECHARGE.RECHARGE_TYPE_ID>
		VALUE = <CCS_MB_RECHARGE.VALUE>
		BALANCE_EXPIRY_PERIOD = <CCS_MB_RECHARGE.BALANCE_EXPIRY_PERIOD>
		START_DATE = <CCS_MB_RECHARGE.START_DATE>
		END_DATE = <CCS_MB_RECHARGE.END_DATE>
		NEW_BUCKET = <CCS_MB_RECHARGE.NEW_BUCKET>
		BAL_EXPIRY_POLICY = <CCS_MB_RECHARGE.BAL_EXPIRY_POLICY>
		MISSING_BALANCE_POLICY = <CCS_MB_RECHARGE.MISSING_BALANCE_POLICY>
		REPLACE_BALANCE = <CCS_MB_RECHARGE.REPLACE_BALANCE>
		BAL_EXPIRY_PERIOD_TYPE = <CCS_MB_RECHARGE.BAL_EXPIRY_PERIOD_TYPE>
		SCENARIO = <CCS_MB_RECHARGE.SCENARIO>
		BAL_OFFSET_DATE = <CCS_MB_RECHARGE.BAL_OFFSET_DATE>
		BAL_OFFSET_PERIOD_EXTENSION = <CCS_MB_RECHARGE.BAL_OFFSET_PERIOD_EXTENSION>
		BAL_OFFSET_PERIOD_TYPE = <CCS_MB_RECHARGE.BAL_OFFSET_PERIOD_TYPE>
		VALUE_TYPE = <CCS_MB_RECHARGE.VALUE_TYPE>
		BAL_EXPIRY_DATE = <CCS_MB_RECHARGE.BAL_EXPIRY_DATE>
		BAL_EXPIRY_MONTHS = <CCS_MB_RECHARGE.BAL_EXPIRY_MONTHS>
		TAX_PLAN = <CCS_MB_RECHARGE.TAX_PLAN>
		RELOAD_COUNTER = <CCS_MB_RECHARGE.RELOAD_COUNTER>
	}
	BALANCES[CCS_MB_RECHARGE.BALANCE_TYPE_ID] = {...}
}

  Errors If the ACS customer ID provided cannot be converted into a number, the following error will be raised:

ACS customer ID must be provided for voucher type lookup.

If the voucher provided is not provided or is not a table, the following error will be raised:

Voucher type table must be provided to get voucher type balances.

Usage This function takes the provided voucher type, and offers a helper lookup on the voucher type balances data on the NCC system, which is added to the voucher type as a sub-table. It calls the ccs.customer.voucher_type_balances function with the supplied ACS customer ID and then compares the related voucher type ID (RECHARGE_TYPE_ID) provided, and adds any matches as a sub-table. The provided voucher_type table is unchanged if there are no matches.

local my_voucher = ccs.customer.get_voucher_type_by_id (ncc.customer_id_for_name ('Boss'), 50)
local my_voucher_balances = ccs.customer.get_voucher_type_balances(ncc.customer_id_for_name ('Boss'), my_voucher)
ncc.debug ("Voucher " .. my_voucher.NAME .. " has the following balances: ")
for k, v in pairs (my_voucher_balances.BALANCES) do
	ncc.debug ("Balance Type: " .. v.BALANCE_TYPE_ID .. ", value: " .. v.VALUE)
end


ccs.customer.named_events (acs_cust_id)
  Parameters acs_cust_id The ACS customer ID to retrieve named event information for.
  Returns A (possibly empty) table of voucher type definitions for the supplied ACS customer, formatted as:

{
	<CCS_EVENT_TYPE.ID> = {
	ID = <CCS_EVENT_TYPE.ID>
	NAME = <CCS_EVENT_TYPE.EVENT_NAME>
	ACS_CUST_ID = <CCS_EVENT_TYPE.ACS_CUST_ID>
	CCS_EVENT_CLASS_NAME = <CCS_EVENT_CLASS.CLASS_NAME>
	EVENT_COST = <CCS_EVENT_TYPE.EVENT_COST>
	USE_FREE_SMS = <CCS_EVENT_TYPE.USE_FREE_SMS>
	USE_PROMO_DEST_SMS = <CCS_EVENT_TYPE.USE_PROMO_DEST_SMS>
	EVENT_TIME_COST = <CCS_EVENT_TYPE.EVENT_TIME_COST>
	EVENT_DATA_COST = <CCS_EVENT_TYPE.EVENT_DATA_COST>
	EVENT_UNIT_COST = <CCS_EVENT_TYPE.EVENT_UNIT_COST>
	EVENT_IS_FREE = <CCS_EVENT_TYPE.EVENT_IS_FREE>
	EVENT_CASCADE = <CCS_EVENT_TYPE.EVENT_CASCADE>
	SINGLE_BALANCE = <CCS_EVENT_TYPE.SINGLE_BALANCE>
	TAX_PLAN = <CCS_EVENT_TYPE.TAX_PLAN>
	RESERVABLE = <CCS_EVENT_TYPE.RESERVABLE>
	}
	<CCS_EVENT_TYPE.ID> = {...}
}

  Errors If the ACS customer ID provided cannot be converted into a number, the following error will be raised:

ACS customer ID must be provided for named event lookup.

If the retrieved named events are not able to be turned into a table, the following error will be raised:

Retrieved named events are not readable.

Usage This function queries the Lua runtime and extracts all named event details for the provided ACS customer, returning it in a table of values.

local named_events = ccs.customer.named_events (ncc.customer_id_for_name ('Boss'))
ncc.debug ("The Boss service provider has the following named events defined:")
for k, v in pairs (named_events) do
	ncc.debug (v.EVENT_NAME)
end

This data may come from the Lua runtime cache if it is available and fresh. Otherwise, it is retrieved from the local SLC database.



ccs.customer.get_named_event_by_name (acs_cust_id, named_event_name, named_event_class)
  Parameters acs_cust_id The ACS customer ID to retrieve named event information for.
    named_event_name The name of the named event to retrieve.
    named_event_class The class of the named event to retrieve. Optional; the first named event that matches provided named_event_name will be returned. Note that the name of a named event is only unique by class.
  Returns Either nil if no match is found, or a table for a single CCS named event, formatted as:

{
	ID = <CCS_EVENT_TYPE.ID>
	NAME = <CCS_EVENT_TYPE.EVENT_NAME>
	ACS_CUST_ID = <CCS_EVENT_TYPE.ACS_CUST_ID>
	CCS_EVENT_CLASS = <CCS_EVENT_CLASS.CLASS_NAME>
	EVENT_COST = <CCS_EVENT_TYPE.EVENT_COST>
	USE_FREE_SMS = <CCS_EVENT_TYPE.USE_FREE_SMS>
	USE_PROMO_DEST_SMS = <CCS_EVENT_TYPE.USE_PROMO_DEST_SMS>
	EVENT_TIME_COST = <CCS_EVENT_TYPE.EVENT_TIME_COST>
	EVENT_DATA_COST = <CCS_EVENT_TYPE.EVENT_DATA_COST>
	EVENT_UNIT_COST = <CCS_EVENT_TYPE.EVENT_UNIT_COST>
	EVENT_IS_FREE = <CCS_EVENT_TYPE.EVENT_IS_FREE>
	EVENT_CASCADE = <CCS_EVENT_TYPE.EVENT_CASCADE>
	SINGLE_BALANCE = <CCS_EVENT_TYPE.SINGLE_BALANCE>
	TAX_PLAN = <CCS_EVENT_TYPE.TAX_PLAN>
	RESERVABLE = <CCS_EVENT_TYPE.RESERVABLE>
}

  Errors If the ACS customer ID provided cannot be converted into a number, the following error will be raised:

ACS customer ID must be provided for named event lookup.

If the named event name is not provided, the following error will be raised:

Named event name must be provided for named event lookup.

Usage This function offers a helper lookup on the named event data on the NCC system. It calls the ccs.customer.named_events function with the supplied ACS customer ID and then searches for the named event name provided (and optionally, the named event class), returning the named event details if found. If the named event is not found, nil is returned.

local my_named_event = ccs.customer.get_named_event_by_name (ncc.customer_id_for_name ('Boss'), "My Named Event", "My Class")
ncc.debug ("My Named Event" has an event code of  " .. my_named_event.EVENT_COST .. ".")


ccs.customer.get_named_event_by_id (acs_cust_id, named_event_id)
  Parameters acs_cust_id The ACS customer ID to retrieve named event information for.
    named_event_id The ID of the named event to retrieve.
  Returns Either nil if no match is found, or a table for a single CCS named event, formatted as:

{
	ID = <CCS_EVENT_TYPE.ID>
	NAME = <CCS_EVENT_TYPE.EVENT_NAME>
	ACS_CUST_ID = <CCS_EVENT_TYPE.ACS_CUST_ID>
	CCS_EVENT_CLASS = <CCS_EVENT_CLASS.CLASS_NAME>
	EVENT_COST = <CCS_EVENT_TYPE.EVENT_COST>
	USE_FREE_SMS = <CCS_EVENT_TYPE.USE_FREE_SMS>
	USE_PROMO_DEST_SMS = <CCS_EVENT_TYPE.USE_PROMO_DEST_SMS>
	EVENT_TIME_COST = <CCS_EVENT_TYPE.EVENT_TIME_COST>
	EVENT_DATA_COST = <CCS_EVENT_TYPE.EVENT_DATA_COST>
	EVENT_UNIT_COST = <CCS_EVENT_TYPE.EVENT_UNIT_COST>
	EVENT_IS_FREE = <CCS_EVENT_TYPE.EVENT_IS_FREE>
	EVENT_CASCADE = <CCS_EVENT_TYPE.EVENT_CASCADE>
	SINGLE_BALANCE = <CCS_EVENT_TYPE.SINGLE_BALANCE>
	TAX_PLAN = <CCS_EVENT_TYPE.TAX_PLAN>
	RESERVABLE = <CCS_EVENT_TYPE.RESERVABLE>
}

  Errors If the ACS customer ID provided cannot be converted into a number, the following error will be raised:

ACS customer ID must be provided for named event lookup.

If the named event ID is not provided, the following error will be raised:

Named event ID must be provided for named event lookup.

Usage This function offers a helper lookup on the named event data on the NCC system. It calls the ccs.customer.named_events function with the supplied ACS customer ID and then searches for the named event name provided, returning the named event details if found. If the named event is not found, nil is returned.

local my_named_event = ccs.customer.get_named_event_by_name (ncc.customer_id_for_name ('Boss'), "My Named Event")
ncc.debug ("My Named Event" has an event code of  " .. my_named_event.EVENT_COST .. ".")