Subscriber and Wallet Data
Subscriber and Wallet Data
Overview
The Logic Node exposes all available subscriber and wallet data for use within your scripts, giving you the power to directly manipulate and query this information.
Subscriber data is never cached by the Lua runtime. However, the NCC framework may decide internally to return cached information if it determines that no changes have taken place - for example, if you perform two wallet information requests without any wallet update request between them. There is no way to avoid this caching of information by NCC.
Subscriber Data
Wallet Data
Wallet Updates
Utility Functions
| ▲ ccs.subscriber_for_cli (cli) | |||
|---|---|---|---|
| Parameters | cli | The MSISDN/CLI of the subscriber to retrieve information for. | |
| Returns |
Either nil if the subscriber was not found, or a table of subscriber information, formatted as:
|
||
| Errors |
If no cli is provided:
If the
If the response from the node is not parseable:
|
||
| Usage |
This function queries the Lua runtime and extracts the subscriber information for the given CLI/MSISDN from the SLC database.
The primary and secondary wallet information fields are only returned if the subscriber has wallets of that type. |
||
| ▲ ccs.subscriber () | |||
|---|---|---|---|
| Parameters | None. | ||
| Returns | As forccs.subscriber_for_cli. | ||
| Errors | As forccs.subscriber_for_cli. | ||
| Usage |
This is a shorthand version of that queries for the current logical subscriber.
|
||
| ▲ ccs.wallet.get () | |||
|---|---|---|---|
| Parameters | None. | ||
| Returns |
Either nil if no wallet was returned, or a table of wallet information, formatted as:
|
||
| Errors |
If the active domain has insufficient capabilities for the getWallet action:
If the retrieved wallet information is not parseable:
|
||
| Usage |
This function performs the getWallet chassis action and returns the information for the active wallet for the logical subscriber.
|
||
| ▲ ccs.wallets.get (cli) | |||
|---|---|---|---|
| Parameters | cli | The MSISDN/CLI of the subscriber to retrieve information for. | |
| Returns |
Either nil if no wallet was returned, or a table of wallet information, formatted as:
|
||
| Errors |
If no cli is provided:
If the
If the active domain has insufficient capabilities for the
If the retrieved wallet information is not parseable:
|
||
| Usage |
This function performs the alternateWalletDetails chassis action and returns the (somewhat limited) information for the CLI specified.
|
||
| ▲ ccs.wallet.info () | |||
|---|---|---|---|
| Parameters | None. | ||
| Returns |
Either nil if no wallet was returned, or a table of wallet information, formatted as:
|
||
| Errors |
If the active domain has insufficient capabilities for the walletInfo action:
If the retrieved wallet information is not parseable:
If no base wallet information is returned from the node:
If no wallet balance information is returned from the node:
|
||
| Usage |
This function performs the walletInfo chassis action and returns the information for the active wallet for the logical subscriber.
|
||
| ▲ ccs.wallet.extended_info () | |||
|---|---|---|---|
| Parameters | None. | ||
| Returns |
Either nil if no wallet was returned, or a table of wallet information, formatted as perccs..wallet.info but with bucket information as well:
|
||
| Errors |
If the active domain has insufficient capabilities for the extendedWalletInfo action:
If the retrieved wallet information is not parseable:
If no base wallet information is returned from the node:
If no wallet balance information is returned from the node:
If no wallet bucket information is returned from the node:
If bucket information is found for a balance type that is not in the balance information:
If bucket information for a balance type is not parseable:
|
||
| Usage |
This function performs the extendedWalletInfo chassis action and returns the information for the active wallet for the logical subscriber.
|
||
| ▲ ccs.wallet.update (wallet) | |||
|---|---|---|---|
| Parameters | wallet |
A (limited) table of values, similar to the return value ofccs..wallet.info:
At least one of the first three fields must be set. Unexpected values in the table will be ignored, so the results of accs..wallet.info call can be updated and returned in an update. However, any values specified in the table will be sent in the update action as changes. |
|
| Returns |
true if the update was successful, otherwise false.
|
||
| Errors |
If the active domain has insufficient capabilities for the walletUpdate action:
If no wallet update information is provided:
If there is no state, last access, and activation date information in the wallet table:
If the wallet update status returned from the thread is not readable:
|
||
| Usage |
This function performs the walletUpdate chassis action and submits the provided information as an update for the active wallet for the logical subscriber. If no errors occur, the status of the update is returned as either true or false.
|
||
| ▲ ccs.wallet.extended_update (wallet, lookup_info) | |||
|---|---|---|---|
| Parameters | wallet |
A (limited) table of values, similar to the return value ofccs.wallet.extended_info:
At least one of the first three fields must be set. Unexpected values in the table will be ignored, so the results of accs..wallet.info can be updated and returned in an update. If more than one balance type is specified, each balance will be sent as a separate update. Any state or start date change(s) will be sent with the first balance update. The bucket ID, expiry, and start date fields are optional and should only be altered if you’re sure you know what you’re doing. |
|
| lookup_info | A table of subscriber lookup information. Optional; will be automatically retrieved if not provided. | ||
| Returns |
true if the update was successful, otherwise false.
|
||
| Errors |
If the active domain has insufficient capabilities for the extendedWalletUpdate action:
If no subscriber information can be retrieved:
If no wallet update information is provided:
If there is no state, start date, or balances in the wallet table:
If the wallet table has balances that are not in a table:
If any balance type has a non-numeric balance type ID:
If any balance value has a non-numeric value:
If the wallet update status returned from the thread is not readable:
|
||
| Usage |
This function performs the extendedWalletUpdate chassis action and submits the provided information as an update for the active wallet for the logical subscriber. It allows direct bucket replacement and creation. If no errors occur, the status of the update is returned as either true or false.
Note: Setting a bucket expiry of 0 will cause a bucket to never expire, even if a subsequent expiry date is re-applied. This is the inbuilt internal behaviour of the NCC platform. |
||
| ▲ ccs.wallet.fill_lookup_info (lookup_info) | |||
|---|---|---|---|
| Parameters | lookup_info |
Either nil or a fully- or partially-populated table of results the same as this function returns.
|
|
| Returns |
Retrieved subscriber, wallet, and customer information in this format:
|
||
| Errors |
If lookup_info is provided but is not in a table:
If subscriber information cannot be retrieved for the logical subscriber:
If no extended wallet information can be retrieved for the logical subscriber:
If no wallet information can be retrieved for the logical subscriber:
|
||
| Usage |
This function is used by many other NCC API functions, particularly periodic charge management, to serve as a function-level cache for subscriber, wallet, and service information in order to prevent multiple lookups across operations.
You can fill the table used in this function up yourself, either totally or partially, and the NCC API functions that use it will use the data you provided rather than get fresh copies. For the most part, this function can be ignored; it will be used automatically where required. |
||
| ▲ ccs.wallet.get_balance (wallet, balance_id) | |||
|---|---|---|---|
| Parameters | wallet | A wallet structure, as returned byccs..wallet.info orccs.wallet.extended_info. | |
| balance_id | The ID of the balance structure to return. | ||
| Returns |
Either nil if the balance_id cannot be found in the wallet, or a single balance type table in this format:
|
||
| Errors | None. | ||
| Usage |
This function serves as a shortcut accessor to select balance types from wallet information returned byccs..wallet.info orccs.wallet.extended_info. It returns the balance structure requested or nil if the balance does not exist in the wallet information provided.
|
||
| ▲ ccs.wallet.get_bucket (balance, balance_id) | |||
|---|---|---|---|
| Parameters | balance | A balance structure, as returned by ccs.wallet.get_balance. | |
| bucket_id | The ID of the balance structure to return. | ||
| Returns |
Either nil if the bucket_id cannot be found in the balance, or a single bucket table in this format:
|
||
| Errors | None. | ||
| Usage |
This function serves as a shortcut accessor to select buckets from balance types returned by ccs.wallet.extended_info (ccs.wallet.info does not return buckets). It returns the bucket structure requested or nil if the bucket does not exist in the balance information provided.
|
||