diff --git a/data/storage/mysql/create_tariffplan_tables.sql b/data/storage/mysql/create_tariffplan_tables.sql index b05d8fe3e..b9762a776 100644 --- a/data/storage/mysql/create_tariffplan_tables.sql +++ b/data/storage/mysql/create_tariffplan_tables.sql @@ -59,7 +59,7 @@ CREATE TABLE `tp_destination_rates` ( `rates_tag` varchar(24) NOT NULL, PRIMARY KEY (`id`), KEY `tpid` (`tpid`), - UNIQUE KEY `tpid_tag_dst_rates` (`tpid`,`tag`,`destinations_tag`, `rates_tag`) + UNIQUE KEY `tpid_tag_dst_rates` (`tpid`,`tag`,`destinations_tag`) ); -- diff --git a/docs/api_tpdestinationrates.rst b/docs/api_tpdestinationrates.rst new file mode 100644 index 000000000..36b0e6407 --- /dev/null +++ b/docs/api_tpdestinationrates.rst @@ -0,0 +1,220 @@ +Apier.SetTPDestinationRate +++++++++++++++++++++++++++ + + +Creates a new DestinationRate profile within a tariff plan. + +**Request**: + + Data: + :: + + type TPDestinationRate struct { + TPid string // Tariff plan id + DestinationRateId string // DestinationRate profile id + DestinationRates []DestinationRate // Set of destinationid-rateid bindings + } + + type DestinationRate struct { + DestinationId string // The destination identity + RateId string // The rate identity + } + + Mandatory parameters: ``[]string{"TPid", "DestinationRateId", "DestinationRates"}`` + + *JSON sample*: + :: + + { + "id": 2, + "method": "Apier.SetTPDestinationRate", + "params": [ + { + "DestinationRateId": "DST_RATE_1", + "DestinationRates": [ + { + "DestinationId": "FIST_DST2", + "RateId": "SAMPLE_RATE_4" + }, + { + "DestinationId": "DST_2", + "RateId": "SAMPLE_RATE_4" + }, + { + "DestinationId": "DST_3", + "RateId": "SAMPLE_RATE_5" + } + ], + "TPid": "FIST_TP" + } + ] + } + +**Reply**: + + Data: + :: + + string + + Possible answers: + ``OK`` - Success. + + *JSON sample*: + :: + + { + "error": null, + "id": 2, + "result": "OK" + } + +**Errors**: + + ``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request. + + ``SERVER_ERROR`` - Server error occurred. + + ``DUPLICATE`` - The specified combination of TPid/DestinationRateId already exists in StorDb. + + +Apier.GetTPDestinationRate ++++++++++++++++ + +Queries specific DestinationRate profile on tariff plan. + +**Request**: + + Data: + :: + + type AttrGetTPDestinationRate struct { + TPid string // Tariff plan id + DestinationRateId string // Rate id + } + + Mandatory parameters: ``[]string{"TPid", "DestinationRateId"}`` + + *JSON sample*: + :: + + { + "id": 2, + "method": "Apier.GetTPDestinationRate", + "params": [ + { + "DestinationRateId": "DST_RATE_1", + "TPid": "FIST_TP" + } + ] + } + +**Reply**: + + Data: + :: + + type TPDestinationRate struct { + TPid string // Tariff plan id + DestinationRateId string // DestinationRate profile id + DestinationRates []DestinationRate // Set of destinationid-rateid bindings + } + + type DestinationRate struct { + DestinationId string // The destination identity + RateId string // The rate identity + } + + *JSON sample*: + :: + + { + "error": null, + "id": 2, + "result": { + "DestinationRateId": "DST_RATE_1", + "DestinationRates": [ + { + "DestinationId": "DST_2", + "RateId": "SAMPLE_RATE_4" + }, + { + "DestinationId": "DST_3", + "RateId": "SAMPLE_RATE_5" + }, + { + "DestinationId": "FIST_DST2", + "RateId": "SAMPLE_RATE_4" + } + ], + "TPid": "FIST_TP" + } + } + + +**Errors**: + + ``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request. + + ``SERVER_ERROR`` - Server error occurred. + + ``NOT_FOUND`` - Requested DestinationRate id not found. + + +Apier.GetTPDestinationRateIds ++++++++++++++++++++++++++++++ + +Queries DestinationRate identities on specific tariff plan. + +**Request**: + + Data: + :: + + type AttrTPDestinationRateIds struct { + TPid string // Tariff plan id + } + + Mandatory parameters: ``[]string{"TPid"}`` + + *JSON sample*: + :: + + { + "id": 3, + "method": "Apier.GetTPDestinationRateIds", + "params": [ + { + "TPid": "FIST_TP" + } + ] + } + +**Reply**: + + Data: + :: + + []string + + *JSON sample*: + :: + + { + "error": null, + "id": 3, + "result": [ + "DST_RATE_1", + "DST_RATE_2", + "DST_RATE_3" + ] + } + +**Errors**: + + ``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request. + + ``SERVER_ERROR`` - Server error occurred. + + ``NOT_FOUND`` - Requested tariff plan not found. + diff --git a/docs/apicalls.rst b/docs/apicalls.rst index dbc830444..b03a9683c 100644 --- a/docs/apicalls.rst +++ b/docs/apicalls.rst @@ -130,16 +130,6 @@ TariffPlan api_tp -Destinations -~~~~~~~~~~~~ - -.. toctree:: - :maxdepth: 2 - - api_tpdestinations - - - Timings ~~~~~~~ @@ -149,6 +139,15 @@ Timings api_tptimings +Destinations +~~~~~~~~~~~~ + +.. toctree:: + :maxdepth: 2 + + api_tpdestinations + + Rates ~~~~~~~ @@ -158,6 +157,15 @@ Rates api_tprates +DestinationRates +~~~~~~~ + +.. toctree:: + :maxdepth: 2 + + api_tpdestinationrates + + GetTPRateTiming SetTPRateTiming