Periodic Charge Functions

Overview

The NCC Charging API offers a periodic charge management functions for usage within your scripts.

All periodic charge state and subscription information and operations are for the current logical subscriber only.

Subscriber periodic charge information is never cached.


Subscription State

Subscription Management

Data Lookup


ccs.periodic_charge.get_charge_state (periodic_charge_id, lookup_info)
  Parameters periodic_charge_id The periodic charge ID to retrieve state information about for the logical subscriber.
    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns A periodic charge state entry with the state of the periodic charge for the current logical subscriber. If no periodic charge information is found, the 'Unsubscribed' (2) state will be returned for consistency with NCC's built-in periodic charge functions.
  Errors If no periodic_charge_id is provided:

Periodic charge ID must be supplied.

If no periodic charges are retrieved for the logical subscriber's ACS customer or the periodic charge information is not able to be turned into a table:

No periodic charge with ID <periodic_charge_id> found for ACS customer ID <acs_cust_id>.

Usage This function queries the Lua runtime for subscriber and customer data and looks for the periodic charge specified, returning its state as a periodic charge state entry. Any subscriber lookup information provided will be used instead of performing fresh retrieval operations.

local s = ccs.periodic_charge.get_charge_state (3)
if (s.CLASS == 'Active') then
    if (s.NAME == 'Pre-Charge 2') then
        -- perform specific processing for this state
    end
else
    -- charge is not active
end


ccs.periodic_charge.is_active (periodic_charge_id, lookup_info)
  Parameters periodic_charge_id The periodic charge ID to retrieve state information about for the logical subscriber.
    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns If the specified periodic charge's state for the current logical subscriber has the class 'Active', returns true. Otherwise, returns false.
  Errors None.
Usage This function offers a helper lookup on the periodic charge state for the current logical subscriber. It calls the ccs.periodic_charge.get_charge_state function with the supplied periodic charge ID and lookup information, if any, and then checks the class of the given periodic charge. If the class of the periodic charge is 'Active', the function returns true. Otherwise, the function returns false.

if (ccs.periodic_charge.is_active 
    (ccs.customer.periodic_charge_id_for_name ('My Charge'))) then
    -- active subscription


ccs.periodic_charge.is_grace (periodic_charge_id, lookup_info)
  Parameters periodic_charge_id The periodic charge ID to retrieve state information about for the logical subscriber.
    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns If the specified periodic charge's state for the current logical subscriber has the class 'Grace', returns true. Otherwise, returns false.
  Errors None.
Usage This function offers a helper lookup on the periodic charge state for the current logical subscriber. It calls the ccs.periodic_charge.get_charge_state function with the supplied periodic charge ID and lookup information, if any, and then checks the class of the given periodic charge. If the class of the periodic charge is 'Grace', the function returns true. Otherwise, the function returns false.

if (ccs.periodic_charge.is_grace 
    (ccs.customer.periodic_charge_id_for_name ('My Charge'))) then
    -- grace subscription


ccs.periodic_charge.is_subscribed (periodic_charge_id, lookup_info)
  Parameters periodic_charge_id The periodic charge ID to retrieve state information about for the logical subscriber.
    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns If the specified periodic charge's state for the current logical subscriber has the class 'Grace' or the class 'Active', returns true. Otherwise, returns false.
  Errors None.
Usage This function offers a helper lookup on the periodic charge state for the current logical subscriber. It calls the ccs.periodic_charge.get_charge_state function with the supplied periodic charge ID and lookup information, if any, and then checks the class of the given periodic charge. If the class of the periodic charge is 'Grace' or 'Active', the function returns true. Otherwise, the function returns false.

if (ccs.periodic_charge.is_subscribed (123)) then
    -- subscription is either in grace or active state


ccs.periodic_charge.is_terminated (periodic_charge_id, lookup_info)
  Parameters periodic_charge_id The periodic charge ID to retrieve state information about for the logical subscriber.
    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns If the specified periodic charge's state for the current logical subscriber has the class 'Terminated', returns true. Otherwise, returns false.
  Errors None.
Usage This function offers a helper lookup on the periodic charge state for the current logical subscriber. It calls the ccs.periodic_charge.get_charge_state function with the supplied periodic charge ID and lookup information, if any, and then checks the class of the given periodic charge. If the class of the periodic charge is 'Terminated', the function returns true. Otherwise, the function returns false.

if (ccs.periodic_charge.is_terminated 
    (ccs.customer.periodic_charge_id_for_name ('My Charge'))) then
    -- terminated subscription


ccs.periodic_charge.is_unsubscribed (periodic_charge_id, lookup_info)
  Parameters periodic_charge_id The periodic charge ID to retrieve state information about for the logical subscriber.
    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns If the specified periodic charge's state for the current logical subscriber has the class 'Unsubscribed', returns true. Otherwise, returns false.
  Errors None.
Usage This function offers a helper lookup on the periodic charge state for the current logical subscriber. It calls the ccs.periodic_charge.get_charge_state function with the supplied periodic charge ID and lookup information, if any, and then checks the class of the given periodic charge. If the class of the periodic charge is 'Unsubscribed', the function returns true. Otherwise, the function returns false.

if (ccs.periodic_charge.is_unsubscribed 
    (ccs.customer.periodic_charge_id_for_name ('My Charge'))) then
    -- unsubscribed subscription


ccs.periodic_charge.is_unavailable (periodic_charge_id, lookup_info)
  Parameters periodic_charge_id The periodic charge ID to retrieve state information about for the logical subscriber.
    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns If the specified periodic charge's state for the current logical subscriber has the class 'Unavailable', returns true. Otherwise, returns false.
  Errors None.
Usage This function offers a helper lookup on the periodic charge state for the current logical subscriber. It calls the ccs.periodic_charge.get_charge_state function with the supplied periodic charge ID and lookup information, if any, and then checks the class of the given periodic charge. If the class of the periodic charge is 'Unavailable', the function returns true. Otherwise, the function returns false.

if (ccs.periodic_charge.is_unavailable 
    (ccs.customer.periodic_charge_id_for_name ('My Charge'))) then
    -- unavailable subscription


ccs.periodic_charge.get_charge_class (periodic_charge_id, lookup_info)
  Parameters periodic_charge_id The periodic charge ID to retrieve information about for the logical subscriber.
    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns Returns the CLASS of the periodic charge state the current logical subscriber's specified periodic charge.
  Errors None.
Usage This function offers a helper lookup on the periodic charge state for the current logical subscriber. It calls the ccs.periodic_charge.get_charge_state function with the supplied periodic charge ID and lookup information, if any, and then returns the class of the given periodic charge.

local sub_pc_class = ccs.periodic_charge.get_charge_class (123)
ncc.debug ("Periodic charge 123 is " .. sub_pc_class)


ccs.periodic_charge.subscribed_to_group (periodic_charge_id, lookup_info)
  Parameters pc_group_id The periodic charge group ID to retrieve information about for the logical subscriber.
    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns If the current logical subscriber is subscribed to any periodic charge in the specified periodic charge group, returns true. Otherwise, returns false.
  Errors None.
Usage This function checks to see if the current logical subscriber has any Active or Grace subscriptions to any periodic charge in the specified periodic charge group, and returns true if any are found. If the subscriber has no such subscription, false is returned.

if (ccs.periodic_charge.subscribed_to_group (pc.PC_GROUP_ID) then
    error ("Logical subscriber is already subscribed to a periodic charge in the '" ..
            pc.PC_GROUP_NAME .. "' periodic charge group")
end


ccs.periodic_charge.is_valid_product (periodic_charge_id, lookup_info)
  Parameters periodic_charge_id The periodic charge ID to retrieve information about for the logical subscriber.
    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns If the current logical subscriber's active wallet has a product type that the specified periodic charge is associated with, returns true. Otherwise, returns false.
  Errors None.
Usage This function checks the specified periodic charge and returns true if the periodic charge is associated with the current logical subscriber's active wallet's product type, i.e. is available to be subscribed to barring other qualifiers.

local w = ccs.wallet.get ()
if (not ccs.periodic_charge.is_valid_product (periodic_charge_id, { WALLET = w })) then
    error ("Periodic charge ID " .. periodic_charge_id ..
           " is not valid for product type ID " .. w.PRODUCT_ID)
end


ccs.periodic_charge.subscribe (periodic_charge_info, lookup_info)
  Parameters periodic_charge_info A table of periodic charge information for the operation, formatted as:

{
    PERIODIC_CHARGE_ID = <periodic charge ID>
        -- mandatory
    EXTRA_INFORMATION = <additional EDR details>
        -- pipe-separated TAG=VALUE pairs, optional
    APPLY_CHARGE = <true|false>
        -- whether to apply a subscription charges, optional
    PRORATE = <true|false>
        -- whether to apply prorating, optional
        -- prorate only applies if apply_charge is true
    -- date/repetition fields depend on PC definition
    REPEAT_MONTH = <month of the year to repeat on>
        -- 0-indexed, optional
    REPEAT_DAY_OF_MONTH = <day of the month to repeat on>
        -- 1-indexed, optional
    REPEAT_DAY_OF_WEEK = <day of the week to repeat on>
        -- 0-indexed, optional
    REFERENCE_DATE = <epoch or integer for start/reference date>
        -- type depends on charge configuration, optional
}

    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns Nothing.
  Errors This operation takes place via an extended wallet update transaction with the NCC runtime; errors listed under that function may also occur.

If periodic charge information is not supplied in a table:

Periodic charge information must be supplied in a table.

If no periodic charge ID is supplied:

Periodic charge ID must be supplied.

If the logical subscriber's product type is not valid for the periodic charge specified:

Periodic charge ID <periodic_charge_id> is not valid for product type ID <product type ID>.

If the logical subscriber's active wallet state is not Active or Dormant:

Cannot subscribe <wallet state> wallets to a periodic charge.

If the logical subscriber's active wallet already has a subscription to the specified periodic charge:

Logical subscriber is already subscribed to periodic charge ID <periodic_charge_id>.

If the logical subscriber's active wallet already has a subscription to another periodic charge in the same group as the specified periodic charge:

Logical subscriber is already subscribed to a periodic charge in the <group name> periodic charge group.

If the apply charge indicator is specified but is neither true nor false:

Apply charge indicator must be true or false, if supplied.

If the apply charge indicator is true but the periodic charge does not support applying a charge:

Cannot apply a charge to a non-debit and non-credit periodic charge.

If the pro-rate indicator is specified but is neither true nor false:

Pro-rating indicator must be true or false, if supplied.

If the pro-rate indicator is true but the apply charge indicator is not true:

Cannot apply pro-rating without apply charge being set.

If the pro-rate indicator is true but the periodic charge does not support pro-rating:

Cannot apply pro-rating to periodic charge with no pro-rating rule.

If the reference date field is supplied but the periodic charge does not support reference dates:

Periodic charge <periodic_charge_id> does not support reference date information.

If repetition or reference date information is supplied for a daily periodic charge:

Repetition information cannot be specified for daily periodic charges.

If monthly repetition information is supplied for a weekly periodic charge:

Weekly periodic charges cannot have month-based repetition.

If the repeat day of week is specified but is not a valid number:

Repeat day of week must be a number (0..6), if specified.

If weekly repetition information is supplied for a monthly, quarterly, half-yearly, or annual periodic charge:

<freqency> periodic charges cannot have week-based repetition.

If the repeat day of month is specified but is not a valid number:

Repeat day of month must be a number (1..31), if specified.

If the repeat month of year is specified but is not a valid number:

Repeat month for must be a number (0..11), if specified.

If repetition information is specified for a custom-frequency periodic charge: Custom periodic charges cannot have a repeat day of the week specified. Custom periodic charges cannot have a repeat day of the month specified. Custom periodic charges cannot have a repeat month specified.

Should any of the following errors occur, contact N-Squared Support: Invalid new periodic charge state value: <action value>. Unable to retrieve periodic charge state for value: <action value>. Unknown periodic charge frequency: <frequency>.

Usage Use this function to subscribe the current logical subscriber to a specified periodic charge. The information provided in periodic_charge_info will depend on the configuration of the periodic charge you are subscribing to.

ccs.periodic_charge.subscribe ({ PERIODIC_CHARGE_ID = 43})
-- logical subscriber is now subscribed to periodic charge ID 43
local pinfo = {
    PERIODIC_CHARGE_ID = 42,
    APPLY_CHARGE = true,
    PRORATE = false,
    REPEAT_DAY_OF_MONTH = 1
}
ccs.periodic_charge.subscribe (pinfo)
--[[
logical subscriber is now subscribed to periodic charge ID 42, repeating on the 1st of each month. This subscription will apply a full charge or credit, depending on the periodic charge configuration.
]]


ccs.periodic_charge.unsubscribe (periodic_charge_info, lookup_info)
  Parameters periodic_charge_info A table of periodic charge information for the operation, formatted as:

{
    PERIODIC_CHARGE_ID = <periodic charge ID>
        -- mandatory
    EXTRA_INFORMATION = <additional EDR details>
        -- pipe-separated TAG=VALUE pairs, optional
}

    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns Nothing.
  Errors This operation takes place via an extended wallet update transaction with the NCC runtime; errors listed under that function may also occur.

If periodic charge information is not supplied in a table:

Periodic charge information must be supplied in a table.

If no periodic charge ID is supplied:

Periodic charge ID must be supplied.

If the logical subscriber does not have a subscription to the periodic charge specified:

Logical subscriber is not subscribed to periodic charge ID <periodic_charge_id>.

Should any of the following errors occur, contact N-Squared Support: Invalid new periodic charge state value: <action value>. Unable to retrieve periodic charge state for value: <action value>.

Usage Use this function to unsubscribe the current logical subscriber from the specified periodic charge.

ccs.periodic_charge.unsubscribe ({ PERIODIC_CHARGE_ID = 43, 
                                   EXTRA_INFORMATION = "PRODUCT=POSTPAY"})
local s = ccs.periodic_charge.get_charge_state ().NAME (43) -- "Unsubscribed"


ccs.periodic_charge.to_grace (periodic_charge_info, lookup_info)
  Parameters periodic_charge_info A table of periodic charge information for the operation, formatted as:

{
    PERIODIC_CHARGE_ID = <periodic charge ID>
        -- mandatory
    EXTRA_INFORMATION = <additional EDR details>
        -- pipe-separated TAG=VALUE pairs, optional
}

    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns Nothing.
  Errors This operation takes place via an extended wallet update transaction with the NCC runtime; errors listed under that function may also occur.

If periodic charge information is not supplied in a table:

Periodic charge information must be supplied in a table.

If no periodic charge ID is supplied:

Periodic charge ID must be supplied.

If the logical subscriber does not have a subscription to the periodic charge specified:

Logical subscriber is not subscribed to periodic charge ID <periodic_charge_id>.

Should any of the following errors occur, contact N-Squared Support: Invalid new periodic charge state value: <action value>. Unable to retrieve periodic charge state for value: <action value>.

Usage Use this function to move the current logical subscriber's specified periodic charge subscription to the Grace state.

ccs.periodic_charge.to_grace ({ PERIODIC_CHARGE_ID = 43})
local s = ccs.periodic_charge.get_charge_state ().CLASS (43) -- "Grace"


ccs.periodic_charge.terminate (periodic_charge_info, lookup_info)
  Parameters periodic_charge_info A table of periodic charge information for the operation, formatted as:

{
    PERIODIC_CHARGE_ID = <periodic charge ID>
        -- mandatory
    EXTRA_INFORMATION = <additional EDR details>
        -- pipe-separated TAG=VALUE pairs, optional
}

    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns Nothing.
  Errors This operation takes place via an extended wallet update transaction with the NCC runtime; errors listed under that function may also occur.

If periodic charge information is not supplied in a table:

Periodic charge information must be supplied in a table.

If no periodic charge ID is supplied:

Periodic charge ID must be supplied.

If the logical subscriber does not have a subscription to the periodic charge specified:

Logical subscriber is not subscribed to periodic charge ID <periodic_charge_id>.

Should any of the following errors occur, contact N-Squared Support: Invalid new periodic charge state value: <action value>. Unable to retrieve periodic charge state for value: <action value>.

Usage Use this function to move the current logical subscriber's specified periodic charge subscription to the Terminated state.

ccs.periodic_charge.terminate ({ PERIODIC_CHARGE_ID = 43})
local s = ccs.periodic_charge.get_charge_state ().CLASS (43) -- "Terminated"


ccs.periodic_charge.charge_alignment (periodic_charge_info, lookup_info)
  Parameters periodic_charge_info A table of periodic charge information for the operation, formatted as:

{
    PERIODIC_CHARGE_ID = <periodic charge ID>
        -- mandatory
    EXTRA_INFORMATION = <additional EDR details>
        -- pipe-separated TAG=VALUE pairs, optional
    APPLY_CHARGE = <true|false>
        -- whether to apply a subscription charges, optional
    PRORATE = <true|false>
        -- whether to apply prorating, optional
        -- prorate only applies if apply_charge is true
    -- date/repetition fields depend on PC definition
    REPEAT_MONTH = <month of the year to repeat on>
        -- 0-indexed, optional
    REPEAT_DAY_OF_MONTH = <day of the month to repeat on>
        -- 1-indexed, optional
    REPEAT_DAY_OF_WEEK = <day of the week to repeat on>
        -- 0-indexed, optional
    REFERENCE_DATE = <epoch or integer for start/reference date>
        -- type depends on charge configuration, optional
}

    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns Nothing.
  Errors This operation takes place via an extended wallet update transaction with the NCC runtime; errors listed under that function may also occur.

If periodic charge information is not supplied in a table:

Periodic charge information must be supplied in a table.

If no periodic charge ID is supplied:

Periodic charge ID must be supplied.

If the logical subscriber's product type is not valid for the periodic charge specified:

Periodic charge ID <periodic_charge_id> is not valid for product type ID <product type ID>.

If the logical subscriber's active wallet state is not Active or Dormant:

Cannot subscribe <wallet state> wallets to a periodic charge.

If the logical subscriber is not subscribed to the periodic charge specified:

Logical subscriber is not subscribed to periodic charge ID <periodic_charge_id>.

If the apply charge indicator is specified but is neither true nor false:

Apply charge indicator must be true or false, if supplied.

If the apply charge indicator is true but the periodic charge does not support applying a charge:

Cannot apply a charge to a non-debit and non-credit periodic charge.

If the pro-rate indicator is specified but is neither true nor false:

Pro-rating indicator must be true or false, if supplied.

If the pro-rate indicator is true but the apply charge indicator is not true:

Cannot apply pro-rating without apply charge being set.

If the pro-rate indicator is true but the periodic charge does not support pro-rating:

Cannot apply pro-rating to periodic charge with no pro-rating rule.

If the reference date field is supplied but the periodic charge does not support reference dates:

Periodic charge <periodic_charge_id> does not support reference date information.

If repetition or reference date information is supplied for a daily periodic charge:

Repetition information cannot be specified for daily periodic charges.

If monthly repetition information is supplied for a weekly periodic charge:

Weekly periodic charges cannot have month-based repetition.

If the repeat day of week is specified but is not a valid number:

Repeat day of week must be a number (0..6), if specified.

If weekly repetition information is supplied for a monthly, quarterly, half-yearly, or annual periodic charge:

<freqency> periodic charges cannot have week-based repetition.

If the repeat day of month is specified but is not a valid number:

Repeat day of month must be a number (1..31), if specified.

If the repeat month of year is specified but is not a valid number:

Repeat month for must be a number (0..11), if specified.

If repetition information is specified for a custom-frequency periodic charge: Custom periodic charges cannot have a repeat day of the week specified. Custom periodic charges cannot have a repeat day of the month specified. Custom periodic charges cannot have a repeat month specified.

If no repetition or reference information is supplied:

Repetition or reference information must be supplied for charge alignment.

Should any of the following errors occur, contact N-Squared Support: Invalid new periodic charge state value: <action value>. Unable to retrieve periodic charge state for value: <action value>. Unknown periodic charge frequency: <frequency>.

Usage Use this function to realign the repetition information or reference date of the specified periodic charge for the current logical subscriber. The information provided in periodic_charge_info will depend on the configuration of the periodic charge you are subscribing to.

ccs.periodic_charge.charge_alignment ({ PERIODIC_CHARGE_ID = 43, REPEAT_DAY_OF_WEEK = 6})
-- logical subscriber is now charged each Sunday


ccs.periodic_charge.transfer_to (periodic_charge_info, lookup_info)
  Parameters periodic_charge_info A table of periodic charge information for the operation, formatted as:

{
    PERIODIC_CHARGE_ID = <periodic charge ID>
        -- mandatory
    EXTRA_INFORMATION = <additional EDR details>
        -- pipe-separated TAG=VALUE pairs, optional
}

    lookup_info A table of subscriber lookup information. Optional; will be automatically retrieved if not provided.
  Returns Nothing.
  Errors This operation takes place via an extended wallet update transaction with the NCC runtime; errors listed under that function may also occur.

If periodic charge information is not supplied in a table:

Periodic charge information must be supplied in a table.

If no periodic charge ID is supplied:

Periodic charge ID must be supplied.

If the logical subscriber does not have a subscription to any periodic charge in the same group as the periodic charge specified:

Logical subscriber is not subscribed to any periodic charge in the <periodic charge group> group.

If the logical subscriber's current subscription within the periodic charge group of the specified periodic charge is not active:

Logical subscriber's periodic charge ID <current periodic charge ID> is not active; cannot transfer.

If the periodic charge to transfer to is not in a periodic charge group:

Target periodic charge is not in a periodic charge group; transfer forbidden.

Should any of the following errors occur, contact N-Squared Support:

Invalid new periodic charge state value: <action value>. Unable to retrieve periodic charge state for value: <action value>. Unable to retrieve current periodic charge information for ID <periodic charge ID>.

Usage Use this function to transfer a current, Active periodic charge subscription in a periodic charge group to another periodic charge within that group.

-- assumes periodic charge IDs 42 and 43 are in the same group!
ccs.periodic_charge.subscribe ({ PERIODIC_CHARGE_ID = 42 })
ccs.periodic_charge.transfer_to ({ PERIODIC_CHARGE_ID = 43 })
ncc.debug (ccs.periodic_charge.get_charge_class (42).CLASS)
    -- "Unsubscribed"
ncc.debug (ccs.periodic_charge.get_charge_class (43).CLASS)
    -- "Active"


ccs.periodic_charge.get_state_by_name (state_name)
  Parameters state_name The name of the periodic charge state to retrieve.
  Returns Either nil if no match is found, or a table for a single periodic charge state, formatted as:

{
    NAME = <periodic charge state name>
    ID = <periodic charge state ID>
    CLASS = <periodic charge class name>
}

  Errors None.
Usage This function returns a single periodic charge state matching the name provided, or nil if no matching state was found.

local state = ccs.periodic_charge.get_state_by_name ('Unavailable')


ccs.periodic_charge.get_state_by_id (state_id)
  Parameters state_id The ID of the periodic charge state to retrieve.
  Returns Either nil if no match is found, or a table for a single periodic charge state, formatted as:

{
    NAME = <periodic charge state name>
    ID = <periodic charge state ID>
    CLASS = <periodic charge class name>
}

  Errors None.
Usage This function returns a single periodic charge state matching the ID provided, or nil if no matching state was found.

local active = ccs.periodic_charge.get_state_by_ID (6)


ccs.periodic_charge.state_id_for_name (state_name)
  Parameters state_name The name of the periodic charge state to retrieve the ID for.
  Returns The ID of the periodic charge state with the provided name, or nil if no match is found.
  Errors None.
Usage This is a specialised shortcut version of ccs.periodic_charge.get_state_by_name that returns only the ID of the periodic charge state with the name provided. If the periodic charge state is not found, nil is returned.

local terminated_id = ccs.periodic_charge.state_id_for_name ('Terminated')


ccs.periodic_charge.state_name_for_id (state_id)
  Parameters state_id The ID of the periodic charge state to retrieve the name for.
  Returns The name of the periodic charge state with the provided ID, or nil if no match is found.
  Errors None.
Usage This is a specialised shortcut version of ccs.periodic_charge.get_state_by_id that returns only the name of the periodic charge state with the ID provided. If the periodic charge state is not found, nil is returned.

local terminated_name = ccs.periodic_charge.state_name_for_id (1)


ccs.periodic_charge.get_period_by_name (period_name)
  Parameters period_name The name of the periodic charge period to retrieve.
  Returns Either nil if no match is found, or a table for a single periodic charge period, formatted as:

{
    NAME = <periodic charge period name>
    ID = <periodic charge period ID>
}

  Errors None.
Usage This function returns a single periodic charge period matching the name provided, or nil if no matching period was found.

local period = ccs.periodic_charge.get_period_by_name ('Daily')


ccs.periodic_charge.get_period_by_id (period_id)
  Parameters period_id The ID of the periodic charge period to retrieve.
  Returns Either nil if no match is found, or a table for a single periodic charge period, formatted as:

{
    NAME = <periodic charge period name>
    ID = <periodic charge period ID>
    CLASS = <periodic charge class name>
}

  Errors None.
Usage This function returns a single periodic charge period matching the ID provided, or nil if no matching period was found.

local custom_frequency = ccs.periodic_charge.get_period_by_ID (6)


ccs.periodic_charge.period_id_for_name (period_name)
  Parameters period_name The name of the periodic charge period to retrieve the ID for.
  Returns The ID of the periodic charge period with the provided name, or nil if no match is found.
  Errors None.
Usage This is a specialised shortcut version of ccs.periodic_charge.get_period_by_name that returns only the ID of the periodic charge period with the name provided. If the periodic charge period is not found, nil is returned.

local weekly_id = ccs.periodic_charge.period_id_for_name ('Weekly')


ccs.periodic_charge.period_name_for_id (period_id)
  Parameters period_id The ID of the periodic charge period to retrieve the name for.
  Returns The name of the periodic charge period with the provided ID, or nil if no match is found.
  Errors None.
Usage This is a specialised shortcut version of ccs.periodic_charge.get_period_by_id that returns only the name of the periodic charge period with the ID provided. If the periodic charge period is not found, nil is returned.

local quarterly = ccs.periodic_charge.period_name_for_id (3)


ccs.periodic_charge.get_action_by_name (action_name)
  Parameters action_name The name of the periodic charge action to retrieve.
  Returns Either nil if no match is found, or a table for a single periodic charge action, formatted as:

{
    NAME = <periodic charge action name>
    ID = <periodic charge action ID>
}

  Errors None.
Usage This function returns a single periodic charge action matching the name provided, or nil if no matching action was found.

local unsub = ccs.periodic_charge.get_action_by_name ('Unsubscribe')


ccs.periodic_charge.get_action_by_id (action_id)
  Parameters action_id The ID of the periodic charge action to retrieve.
  Returns Either nil if no match is found, or a table for a single periodic charge action, formatted as:

{
    NAME = <periodic charge action name>
    ID = <periodic charge action ID>
    CLASS = <periodic charge class name>
}

  Errors None.
Usage This function returns a single periodic charge action matching the ID provided, or nil if no matching action was found.

local terminate = ccs.periodic_charge.get_action_by_ID (101)


ccs.periodic_charge.action_id_for_name (action_name)
  Parameters action_name The name of the periodic charge action to retrieve the ID for.
  Returns The ID of the periodic charge action with the provided name, or nil if no match is found.
  Errors None.
Usage This is a specialised shortcut version of ccs.periodic_charge.get_action_by_name that returns only the ID of the periodic charge action with the name provided. If the periodic charge action is not found, nil is returned.

local align_id = ccs.periodic_charge.action_id_for_name ('Charge Alignment')


ccs.periodic_charge.action_name_for_id (action_id)
  Parameters action_id The ID of the periodic charge action to retrieve the name for.
  Returns The name of the periodic charge action with the provided ID, or nil if no match is found.
  Errors None.
Usage This is a specialised shortcut version of ccs.periodic_charge.get_action_by_id that returns only the name of the periodic charge action with the ID provided. If the periodic charge action is not found, nil is returned.

local grace = ccs.periodic_charge.action_name_for_id (104)