Named Events
Named Event Functions
Overview
The NCC Charging API allows you to reserve, confirm, revoke, or directly charge named events to a billing domain.
All named event operations are for the current logical subscriber only.
Named Event Status
The result of named event requests made through the Logic Node are returned as enumerated values. These can be directly accessed for their value or their text equivalent.
Direct Named Event Statuses
ccs = {
    named_event = {
        status = {
            direct = {
                value = {
                    ["SUCCESS"] = 0,
                    ["INSUFFICIENT_FUNDS"] = 1,
                    ["NOT_ALLOWED"] = 2,
                    ["COMMS_ERROR"] = 3,
                    ["SYSTEM_ERROR"] = 4,
                    ["NO_RESERVATION"] = 5
                },
                text = {
                    [0] = "success",
                    [1] = "insufficient funds",
                    [2] = "not allowed",
                    [3] = "communications error",
                    [4] = "system error",
                    [5] = "no reservation placed"
                }
            }
        }
    }
}
Note that the ‘no reservation’ code for direct named events is included for completeness only, as it is defined in the NCC API. This code is not expected to occur and should be considered a system error.
Reserve Named Event Statuses
ccs = {
    named_event = {
        status = {
            reserve = {
                value = {
                    ["SUCCESS"] = 0,
                    ["INSUFFICIENT_FUNDS"] = 1,
                    ["MAX_CONCURRENT"] = 2,
                    ["NOT_ALLOWED"] = 3,
                    ["COMMS_ERROR"] = 4,
                    ["SYSTEM_ERROR"] = 5,
                    ["INVALID_STATE"] = 6
                },
                text = {
                    [0] = "success",
                    [1] = "insufficient funds",
                    [2] = "maximum concurrent accesses exceeded",
                    [3] = "not allowed",
                    [4] = "communications error",
                    [5] = "system error",
                    [6] = "invalid wallet state"
                }
            }
        }
    }
}
Confirm Named Event Statuses
ccs = {
    named_event = {
        status = {
            confirm = {
                value = {
                    ["SUCCESS"] = 0,
                    ["INSUFFICIENT_FUNDS"] = 1,
                    ["NOT_ALLOWED"] = 2,
                    ["COMMS_ERROR"] = 3,
                    ["SYSTEM_ERROR"] = 4,
                    ["NO_RESERVATION"] = 5
                },
                text = {
                    [0] = "success",
                    [1] = "insufficient funds",
                    [2] = "not allowed",
                    [3] = "communications error",
                    [4] = "system error",
                    [5] = "no reservation placed"
                }
            }
        }
    }
}
Revoke Named Event Statuses
ccs = {
    named_event = {
        status = {
            revoke = {
                value = {
                    ["SUCCESS"] = 0,
                    ["FAILED"] = 1,
                    ["NO_RESERVATION"] = 2
                },
                text = {
                    [0] = "success",
                    [1] = "failed",
                    [2] = "no reservation placed"
                }
            }
        }
    }
}
Functions
- ccs.named_event.direct
 - ccs.named_event.reserve
 - ccs.named_event.confirm
 - ccs.named_event.revoke
 - ccs.named_event.successful
 
| ▲ ccs.named_event.direct (named_event_info) | |||
|---|---|---|---|
| Parameters | named_event_info | 
A table of named event information for the operation, formatted as:
 | 
    |
| Returns | A direct named event status code. | ||
| Errors | 
If named event information is not supplied in a table:
 
 If no named event class is supplied: 
 If no named event name is supplied: 
 If minimum units is specified but is not able to be turned into a number: 
 If maximum units is specified but is not able to be turned into a number: 
 If the ignore balance limits indicator is specified but is neither true nor false: 
 If discount percentage is specified but is not able to be turned into a number: 
 If the named event status is not able to be turned into a number: 
 If the named event status is not recognised as a valid named event status code: 
  | 
    ||
| Usage | 
Use this function to send a direct (i.e. no reserve/confirm) named event request to the active billing domain. The information provided in named_event_info will depend on the configuration of the named event you are requesting.
 | 
    ||
| ▲ ccs.named_event.reserve (named_event_info) | |||
|---|---|---|---|
| Parameters | named_event_info | As for ccs.named_event.direct. | |
| Returns | A reserve named event status code. | ||
| Errors | As for ccs.named_event.direct. | ||
| Usage | 
Use this function to send a named event reservation request to the active billing domain. The information provided in named_event_info will depend on the configuration of the named event you are requesting.
Only one reservation can be active at a time during an NCC interaction. This can apply even across multiple instances of the Logic Node, so is not enforced. If the reservation is successful but not confirmed or revoked then it will remain on the subscriber’s account, and the billing engine will be responsible for closing it when stale.  | 
    ||
| ▲ ccs.named_event.confirm (named_event_info) | |||
|---|---|---|---|
| Parameters | named_event_info | 
A table of named event information for the operation, formatted as:
~~~~language-lua
{
USED_UNITS =  | 
    |
| Returns | A confirm named event status code. | ||
| Errors | 
If named event information is supplied, but not in a table:
 
 If used units is specified but is not able to be turned into a number: 
 If the named event status is not parseable: 
 If the named event status is not able to be turned into a number: 
 If the named event status is not recognised as a valid named event status code: 
  | 
    ||
| Usage | 
Use this function to confirm a previously-sent named event reservation on the active billing domain. 
 As reservation confirmation may occur across multiple instances of the Logic Node in a single control plan, no checking is done to ensure a previous reservation has occurred.  | 
    ||
| ▲ ccs.named_event.revoke (named_event_info) | |||
|---|---|---|---|
| Parameters | named_event_info | 
A table of named event information for the operation, formatted as:
 | 
    |
| Returns | A revoke named event status code. | ||
| Errors | 
If named event information is supplied, but not in a table:
 
 If the named event status is not parseable: 
 If the named event status is not able to be turned into a number: 
 If the named event status is not recognised as a valid named event status code: 
  | 
    ||
| Usage | 
Use this function to revoke a previously-sent named event reservation on the active billing domain. 
 As reservation revocation may occur across multiple instances of the Logic Node in a single control plan, no checking is done to ensure a previous reservation has occurred.  | 
    ||
| ▲ ccs.named_event.successful (result) | |||
|---|---|---|---|
| Parameters | result | The result value from a previous ccs.named_event.direct, ccs.named_event.reserve, ccs.named_event.confirm, or ccs.named_event.revoke function call. | |
| Returns | 
true if the named event operation was successful, otherwise false.
 | 
    ||
| Errors | None. | ||
| Usage | 
This is a shortcut function to check the provided result against the four "successful" named event statuses.
 | 
    ||