Skip to content
QiTASC.com / intaQt Built-ins /
Rater Built-ins
/ .. /
Rater Built-ins





Rater Built-ins

Rater Built-ins implement Rater functionality in custom Stepdefs. They use a CSV file that holds tariff configurations based on call durations or events. Unlike the Rater, the Rater Built-ins do not require an extra configuration.

Create Rates

This function creates a file containing the rates. This function creates a file containing the rates. It may either use a CSV file object created with the File Built-in, or may specify a path to where the CSV is stored.

Create Rates with Object from File Built-ins

Returns the file object created with File Built-ins.

Syntax

1
<subscriptionRate List> := createRates(<ratesFile Object>)

Returns
The list of tariffs from the CSV file.

Parameter

Example

1
newRateFile := createRates(myrater)

Create Rates Using Relative Path

Specifies a path to where the CSV is stored and returns the CSV file.

Syntax

1
<subscriptionRate List> := createRates(<ratesFilePath String>)

Returns
The list of tariffs from the CSV file.

Parameter

  • ratesFilePath - The relative path to the Rater file

Example

1
newRateWithPath := createRates("../TestProject01/newrater.csv")

Calculate the Tariff Cost

Returns a tariff's cost based on a specified rounding mode.

Syntax

1
2
<tariffCost Number> := calculateTariffCosts(<tariffs String>,
    <timeRoundingMode String>)

Returns
The calculated costs.

Parameters

  • tariffs - The Rater object created with the createRates function

  • timeRoundingMode - Rounds the call's duration

  • May be one of:

  • UP (Default) - Rounding mode to round away from zero

  • DOWN - Rounding mode to towards zero

  • HALF_DOWN - Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down

  • HALF_UP - Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up

  • CEILING - Rounding mode to round towards positive infinity

  • FLOOR - Rounding mode to round towards negative infinity

Example

1
callCost := calculateTariffCosts(newRateFile, "HALF_UP")

Convert the Charge

Converts a value from one unit to another unit.

Syntax

1
2
<converted Number> := <number Number>, <currencyUnitFrom String>,
    <currencyUnitTo String>, <priceRoundingModeName String>

Returns
The charge's value after conversion.

Parameters

  • number - The value to be converted

  • currencyUnitFrom - The monetary unit (such as, Euro, Dollar) to convert from, as defined in the CSV file

  • currencyUnitTo - The monetary unit to convert to, as defined in the CSV file

Example

1
roundedCost := 20 as myCall from Euro to Cent

Get Tariff

Returns the specified tariff object. The tariff can be used for additional calculations.

Syntax

1
<subscriptionRate Tariff> := getTariff(<tariff String>)

Returns
The tariff object.

Parameter

  • tariff - A tariff defined in the CSV file

Example

1
2
mysubscription := getTariff("economy")
assert mysubscription.calc(30) == 34