Calculating, Converting and Rounding Charges ¶
The following calculation steps are used to:
-
Calculate how much a call or SMS should be charged.
-
Convert currencies.
-
Round a call and calculate the charge for the resulting value.
These steps use variables defined in the Rater For details about the Rater, refer to its section in the intaQt Manual's intaQt Basics chapter.
Calculation Steps |
---|
Calculating the Charge |
Convert the Charge |
Calculate the Charge with Conversion |
Calculating the Rounded Call |
Calculating the Charge ¶
Calculating the charge can be done by:
-
Verifying that an amount consisting of the tariff for the call duration (or amount of SMS) correlates to a fixed value.
-
Verifying that an amount corresponds to the result of a calculation.
Syntax
1 2 | the charge for <tariff Identifier>(<amount Number>) is <charge Number> |
-
tariff - The tariff defined in the Rater.
-
amount - One of call duration in seconds or the amount of SMS sent.
-
charge - The total charge calculated for the call duration or amount of SMS sent. This may be any expression that resolves to a number.
Examples
1 2 3 | Then the charge for CH_01(20) is 120 Then the charge for CH_02(20) is (120 - 60) Then the charge for CH_01(10) is (balance1 - balance2) |
- deferred
Convert the Charge ¶
Converts a value from one unit to another unit.
Syntax
1 2 | convert <value Any> as <name Identifier> from <currencyUnitFrom Identifier> to <currencyUnitTo Identifier> |
-
value - This may be any expression that resolves to a numerical value, e.g. a number, a calculation such as
(10+6)
, or a context object. -
name - The variable that stores the conversion result.
-
currencyUnitFrom - The monetary unit (e.g. Euro, Dollar) to convert from, as defined in the Rater configuration.
-
currencyUnitTo - The monetary unit (e.g. Euro, Dollar) to convert to, as defined in the Rater configuration.
Example
1 | And convert myCredit as specialCredit from Euro to Cent |
Calculate the Charge with Conversion ¶
The following step calculates the charge and converts it to another unit. For example, from Euro to Cent.
Syntax
1 2 | calculate the charge for <amount Number> of <tariff Identifier> converted from <currenctUnitFrom Identifier> to <currencyUnitTo Identifier> as <name Identifier> |
Parameters
-
amount - One of call duration in seconds or the amount of SMS sent.
-
tariff - The tariff defined in the Rater.
-
currenctUnitFrom - The monetary unit (e.g. Euro, Dollar) to be converted from, as defined in the Rater configuration.
-
currencyUnitTo - The unit to convert to, as defined in the Rater configuration.
-
name - Stores the conversion result.
Example
1 2 | And calculate the charge for 20 of CH_01 converted from Euro to Cent as callCostMOC |
Calculating the Rounded Call ¶
Returns a rounded value for the call duration and calculates the resulting charge.
Syntax
1 2 | calculate the rounded call duration for <amount Number> of <tariff Identifier> as <name Identifier> |
Parameters
-
amount - The call duration in seconds.
-
tariff - The tariff defined in the Rater.
-
name - The variable that stores the conversion result.
Example
1 | And calculate the rounded call duration for 65 of CH_02 as roundedIncrement
|
In the example above, if the billing increment was defined as 60:30
in the Rater, the call curation of 65
seconds returns 90
according to the charge used.