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


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>
    }
    <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>
}

  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>
}

  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