<commit_before>FORMAT: 1A
HOST: https://rss.store.lab.fiware.org/
TITLE: FIWARE Revenue Settlement and Sharing System Open API Specification
DATE: 30 September 2015
VERSION: v4.4.3
PREVIOUS_VERSION: v3.5.2
APIARY_PROJECT: fiwarerss

# FIWARE RSS

The Revenue Settlement and Sharing System (RSS) GE is in charge of distributing the revenues originated by the usage of a given service among the involved stakeholders. In particular, it focuses on distributing part of the revenue generated by a service between the Store Provider and the Service Provider(s) responsible for the service. With the term "service" we refer to both final applications and backend application services (typically exposed through an API). Note that, in the case of composite services, more than one service provider may have to receive a share of the revenues.

Additionally, as a supplementary functionality, expenditure limits functionality is offered in this GE. The expenditure limit API provides a mechanism through which an application provider can limit the amount of money spent by a customer using the services, along a specific time interval.

This document describes the RSS Rest API, including the Stores API, Providers API, Revenue Sharing Models API, CDRs API, and Expenditure Limits API.

## Editors

* Francisco de la Vega, Universidad Politénica de Madrid

## Status

This is a work in progress and is changing on a daily basis. You can check the latest
available version on: <https://github.com/conwetlab/wstore/tree/develop>. 
Please send your comments to <<EMAIL>>.

This specification is licensed under the [FIWARE Open Specification License](https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/FI-WARE_Open_Specification_Legal_Notice_%28implicit_patents_license%29)

## Acknowledgements

The editors would like to express their gratitude to the following people who actively contributed to this specification:
<NAME> and <NAME>.

## Copyright

* Copyright © 2015 by Universidad Politénica de Madrid

## Specification
### Authentication

Each HTTP request against the RSS API requires the inclusion of specific authentication credentials. The specific implementation of this API may support multiple authentication schemes (OAuth, Basic Auth, Token) and will be determined by the specific provider that implements the GE. Please contact the provider to determine the best way to authenticate against this API. Remember that some authentication schemes may require that the API operates using SSL over HTTP (HTTPS).

The RSS provides support for Cookie and OAuth2 authentication being OAuth2 the default in FIWARE Lab.

### Used HTTP Codes


| HTTP Code | Type | Description |
|-----------|------|------------ |
| 200 | OK | Your request has been completed properly |
| 201 | Created | Your resource has been created.|
| 202 | Accepted | Your request has been accepted for processing.|
| 204 | No content | Your request has been processed, but a response is not available. Generally used when deleting entities|
| 400 | Bad Request | The content of your request is not correct (e.g. There is a missing field) |
| 409 | Conflict | The resource you are tring to create already exists |
| 404 | Not Found | The resource you are looking for does not exists |
| 403 | Forbidden | You have no rights to perform the request |
| 401 | Unauthorized | You are not logged in or the Authorization token you are providing is not valid |
| 500 | Internal server error | There was an internal error in the system so your request cannot be completed |

# Group Aggregators Management

API for the management of aggregators that play the role of charging information sources. This API allows to register and retrieve aggregators information.

This API uses the following fields:
*  **aggregatorName** - Display name of the given aggregator
*  **aggragtorId** - Email used to identify the user that is authorized to send changing information (typically an admin of a Store instance)

## Aggregators Collection [/fiware-rss/rss/aggregator]

### List all Aggregators [GET]

+ Request

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

+ Response 200 (application/json)

        [
            {
                "aggregatorName": "WStore",
                "aggregatorId": "<EMAIL>"
            }
        ]

### Register an Aggregator [POST]

+ Request (application/json)

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

    + Body

            {
                "aggregatorName": "WStore",
                "aggregatorId": "<EMAIL>"
            }

+ Response 201

# Group Providers Management

API for the management of providers. Providers are registered in the context of an aggregator, and are the owners of the applications and services that generate the charging information. This API allows to retrieve and register providers.

This API manages the following fields:
*  **aggregatorId** - Aggregator email that identifies the charging information source (Store instance)
*  **providerId** - Id of the given provider. Note that this id only needs to be unique in the context of an aggregator, so the same providerId can be used for different providers if the aggregator is different
*  **providerName** - Display name of the given provider

## Providers Collection [/fiware-rss/rss/providers{?aggregatorId}]

### List all providers [GET]

+ Parameters

    + aggregatorId: <EMAIL> (optional) - Optional parameter used to retrieve only those providers registered for a given aggregator

+ Request

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

+ Response 200 (application/json)

        [
            {
                "aggregatorId": "<EMAIL>",
                "providerId": "conwet",
                "providerName": "CoNWeT"
            }
        ]

### Register a provider [POST]

+ Request (application/json)

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

    + Body

            {
                "aggregatorId": "<EMAIL>",
                "providerId": "conwet",
                "providerName": "CoNWeT"
            }

+ Response 201

# Group Algorithms Management

API for the management of supported Algorithms. Supported algorithms are those that can be used to perform the revenue sharing. This API allows to retrieve supported algorithms

This API manages the following fields:
*  **algorithmId** - ID of the given algorithm
*  **description** - A textual description that explains how the algorithm works

## Algorithms Collection [/fiware-rss/rss/algorithms]

### List Supported Algorithms [GET]

+ Request

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

+ Response 200 (application/json)

        [
            {
                "algorithmId": "FIXED_PERCENTAGE",
                "description": "Fixed percentage distribution of revenues"
            }
        ]

# Group Revenue Sharing Models Management

API for the management of revenue sharing models. A Revenue Sharing Model specifies how the revenues must be distributed between the involved stakeholders. This API allows to retrieve, create, update, and delete revenue sharing models.

This API manages the following fields:
*  **ownerProviderId** - Provider Id of the owner of the model. This provider is the owner of the application and services whose revenues will be distributed using the Revenue Sharing Model
*  **ownerValue** - Value of the owner provider in the Revenue Sharing Model. The semantics of this field depends on the algorithm specified, for example if the algorithm is a fixed precentage, this field will contain the percetage of the revenue that belongs to the owner provider.
*  **productClass** - Id of the Revenue Sharing Model. This field represents a group of services or applications whose revenues are distributed in the same way
*  **algorithmType** - ID of the algorithm that is used in this model
*  **aggregatorId** - Id of the aggregator that represents the Store instance where the applications and services are offered, and thus, must receive part of the revenues
*  **aggregatorValue** - Value of the aggregator in the Revenue Sharing Model
*  **stakeholders** - List of providers that are stakeholders of the applications and services included in a given product class, and thus, must receive part of the revenues. For each stakeholder the following fields are included:
    * stakeholderId - provider Id of the Stakeholder
    * modelValue - Value of the stakeholder in the Revenue Sharing Model

## Revenue Sharing Models Collection [/fiware-rss/rss/models{?aggregatorId}{?appProviderId}{?productClass}]

### List Revenue Sharing models [GET]

+ Parameters

    + aggregatorId: <EMAIL> (optional) - Optional parameter used to filter by aggragtor Id
    + appProviderId: aarranz (optional) - Optional parameter used to filter by provider Id
    + productClass: orionServices (optional) - Optional parameter used to filter by product class

+ Request

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

+ Response 200 (application/json)

        [
            {
                "ownerProviderId": "fdelavega",
                "ownerValue": 60,
                "productClass": "orionServices",
                "algorithmType": "FIXED_PERCENTAGE",
                "aggregatorId": "<EMAIL>",
                "aggregatorValue": 20,
                "stakeholders": [
                    {
                        "stakeholderId": "aarranz",
                        "modelValue": 20
                    }
                ]
            }
        ]

### Create Revenue Sharing Model [POST]

+ Request (application/json)

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

    + Body

            {
                "ownerProviderId": "fdelavega",
                "ownerValue": 60,
                "productClass": "orionServices",
                "algorithmType": "FIXED_PERCENTAGE",
                "aggregatorId": "<EMAIL>",
                "aggregatorValue": 20,
                "stakeholders": [
                    {
                        "stakeholderId": "aarranz",
                        "modelValue": 20
                    }
                ]
            }

+ Response 201


# Group CDRs - Transactions - Management

API for the management of CDR documents describing transactions. This API allows to register and retrieve transactions. Additionally, this API allows to launch the settlement process that aggregates the transactions and calculates the distribution of revenues.

This API manages the following fields:
*  **cdrSource** - Id of the aggregator that represent the Store instance that is generating the charging information
*  **productClass** - Product Class used to identify the revenue sharing model that will be used to distribute the revenues generated in the current transaction
*  **correlationNumber** - Correlation number of the transaction
*  **timestamp** - Timestamp of the transaction
*  **application** - Textual field with the id of the application or service that generates the transaction
*  **transactionType** - Type of transaction. This field can contain "C" for charges and "R" for refunds
*  **event** - Textual field that describes the event that generated the transaction (e.g pay-per-use)
*  **referenceCode** - Reference code that identifies the purchase in the Store instance that generates the transaction
*  **description** - Textual description of the transaction
*  **chargedAmount** - Part of the total charged amount to be distributed. The total amount charged to the customer includes also the field chargedTaxAmount
*  **chargedTaxAmount** - Part of the total charged amount that are taxes. The total amount charged to the customer includes also the field chargedAmount
*  **currency** - Currency of the transaction
*  **customerId** - Id of the customer that acquires the given service or application
*  **appProvider** - provider Id of the owner of the charged applications or services

## Transactions Collection [/fiware-rss/rss/cdrs{?aggregatorId}{?providerId}]

### List Transactions [GET]

+ Parameters

    + aggregatorId: <EMAIL> (optional) - Optional parameter used to filter transactions by aggregatorId
    + providerId: aarranz (optional) - Optional parameter used to filter transactions by providerId 

+ Request

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

+ Response 201 (application/json)

        [
            {
                "cdrSource": "<EMAIL>",
                "productClass": "orionServices",
                "correlationNumber": 112,
                "timestamp": "2015-07-15T19:00:01.000Z",
                "application": "OrionStarterKit",
                "transactionType": "C",
                "event": "use",
                "referenceCode": "555b079d8e05ac213ff15827",
                "description": "Usage of OrionStarterKit Offering",
                "chargedAmount": 10,
                "chargedTaxAmount": 3,
                "currency": "EUR",
                "customerId": "amagan",
                "appProvider": "fdelavega"
            }
        ]

### Create Transaction [POST]

+ Request (application/json)

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

    + Body

            {
                    "cdrSource": "<EMAIL>",
                    "productClass": "orionServices",
                    "correlationNumber": 112,
                    "timestamp": "2015-07-15T19:00:01.000Z",
                    "application": "OrionStarterKit",
                    "transactionType": "C",
                    "event": "use",
                    "referenceCode": "555b079d8e05ac213ff15827",
                    "description": "Usage of OrionStarterKit Offering",
                    "chargedAmount": 10,
                    "chargedTaxAmount": 3,
                    "currency": "EUR",
                    "customerId": "amagan",
                    "appProvider": "fdelavega"
                }

+ Response 201

## Settlement Collection [/fiware-rss/rss/settlement{?aggregatorId}{?providerId}{?productClass}]

### Launch Settlement [GET] 

+ Parameters

    + aggregatorId: <EMAIL> (optional) - Optional parameter used to aggregate only transactions with a given aggregator
    + providerId: aarranz (optional) - Optional parameter used to aggregate only transactions with a given provider 
    + productClass: orionServices (optional) - Optional parameter used to aggregate only transactions with a given product class

+ Request

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

+ Response 202

## Reports Collection [/fiware-rss/rss/settlement/reports{?aggregatorId}{?providerId}{?productClass}]

API for the management of RS Reports generated during the settlement process. This API allows to retrieve RS Reports.

This API manages the following fields:

*  **ownerProviderId** - Provider Id of the owner of the model. This provider is the owner of the application and services whose revenues has been aggregated.
*  **ownerValue** - Amount that has to be paid to the provider.
*  **productClass** - Id of the Revenue Sharing Model that have been applied. This field represents a group of services or applications whose revenues are distributed in the same way 
*  **algorithmType** - ID of the algorithm that have been used.
*  **aggregatorId** - Id of the aggregator that represents the Store instance where the applications and services are offered, and thus, must receive part of the revenues
*  **aggregatorValue** - Amount that has to be paid to the store owners.
*  **currency**: Currency of the different amounts.
*  **timestamp**: Timestamp of the reports.
*  **stakeholders** - List of providers that are stakeholders of the applications and services included in a given product class, and thus, must receive part of the revenues. For each stakeholder the following fields are included:
    * **stakeholderId** - provider Id of the Stakeholder
    * **modelValue** - Amount that has to be paid to the concrete stakeholder

### Get Reports [GET]

+ Parameters

    + aggregatorId: <EMAIL> (optional) - Optional parameter used to get only reports with a given aggregator
    + providerId: aarranz (optional) - Optional parameter used to get only reports with a given provider 
    + productClass: orionServices (optional) - Optional parameter used to get only reports with a given product class

+ Request

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

+ Response 200 (application/json)

        [
            {
                "ownerProviderId": "fdelavega",
                "ownerValue": 4578,
                "productClass": "orionServices",
                "algorithmType": "FIXED_PERCENTAGE",
                "aggregatorId": "<EMAIL>",
                "aggregatorValue": 3000,
                "currency": EUR,
                "timestamp": "2015-07-15T19:00:01"
                "stakeholders": [
                    {
                        "stakeholderId": "aarranz",
                        "modelValue": 2500
                    }
                ]
            }
        ]

# Group Expenditure Limit Management

API for the management of expenditure limits. This API allows to define a couple of limits that allow to control the maximun expenses of customers in different periods of time. This API allows to list, create, modify, and delete expenditure limits.

This API manages the following fields:
*  **service** - Service where the limits are applied<commit_msg>Transferring blueprint from apiary.io<commit_after>FORMAT: 1A
HOST: https://rss.store.lab.fiware.org/
TITLE: FIWARE Revenue Settlement and Sharing System Open API Specification
DATE: 30 September 2015
VERSION: v4.4.3
PREVIOUS_VERSION: v3.5.2
APIARY_PROJECT: fiwarerss

# FIWARE RSS

The Revenue Settlement and Sharing System (RSS) GE is in charge of distributing the revenues originated by the usage of a given service among the involved stakeholders. In particular, it focuses on distributing part of the revenue generated by a service between the Store Provider and the Service Provider(s) responsible for the service. With the term "service" we refer to both final applications and backend application services (typically exposed through an API). Note that, in the case of composite services, more than one service provider may have to receive a share of the revenues.

Additionally, as a supplementary functionality, expenditure limits functionality is offered in this GE. The expenditure limit API provides a mechanism through which an application provider can limit the amount of money spent by a customer using the services, along a specific time interval.

This document describes the RSS Rest API, including the Stores API, Providers API, Revenue Sharing Models API, CDRs API, and Expenditure Limits API.

## Editors

* Francisco de la Vega, Universidad Politénica de Madrid

## Status

This is a work in progress and is changing on a daily basis. You can check the latest
available version on: <https://github.com/conwetlab/wstore/tree/develop>. 
Please send your comments to <<EMAIL>>.

This specification is licensed under the [FIWARE Open Specification License](https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/FI-WARE_Open_Specification_Legal_Notice_%28implicit_patents_license%29)

## Acknowledgements

The editors would like to express their gratitude to the following people who actively contributed to this specification:
<NAME> and <NAME>.

## Copyright

* Copyright © 2015 by Universidad Politénica de Madrid

## Specification
### Authentication

Each HTTP request against the RSS API requires the inclusion of specific authentication credentials. The specific implementation of this API may support multiple authentication schemes (OAuth, Basic Auth, Token) and will be determined by the specific provider that implements the GE. Please contact the provider to determine the best way to authenticate against this API. Remember that some authentication schemes may require that the API operates using SSL over HTTP (HTTPS).

The RSS provides support for Cookie and OAuth2 authentication being OAuth2 the default in FIWARE Lab.

### Used HTTP Codes


| HTTP Code | Type | Description |
|-----------|------|------------ |
| 200 | OK | Your request has been completed properly |
| 201 | Created | Your resource has been created.|
| 202 | Accepted | Your request has been accepted for processing.|
| 204 | No content | Your request has been processed, but a response is not available. Generally used when deleting entities|
| 400 | Bad Request | The content of your request is not correct (e.g. There is a missing field) |
| 409 | Conflict | The resource you are tring to create already exists |
| 404 | Not Found | The resource you are looking for does not exists |
| 403 | Forbidden | You have no rights to perform the request |
| 401 | Unauthorized | You are not logged in or the Authorization token you are providing is not valid |
| 500 | Internal server error | There was an internal error in the system so your request cannot be completed |

# Group Aggregators Management

API for the management of aggregators that play the role of charging information sources. This API allows to register and retrieve aggregators information.

This API uses the following fields:
*  **aggregatorName** - Display name of the given aggregator
*  **aggragtorId** - Email used to identify the user that is authorized to send changing information (typically an admin of a Store instance)

## Aggregators Collection [/fiware-rss/rss/aggregator]

### List all Aggregators [GET]

+ Request

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

+ Response 200 (application/json)

        [
            {
                "aggregatorName": "WStore",
                "aggregatorId": "<EMAIL>"
            }
        ]

### Register an Aggregator [POST]

+ Request (application/json)

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

    + Body

            {
                "aggregatorName": "WStore",
                "aggregatorId": "<EMAIL>"
            }

+ Response 201

# Group Providers Management

API for the management of providers. Providers are registered in the context of an aggregator, and are the owners of the applications and services that generate the charging information. This API allows to retrieve and register providers.

This API manages the following fields:
*  **aggregatorId** - Aggregator email that identifies the charging information source (Store instance)
*  **providerId** - Id of the given provider. Note that this id only needs to be unique in the context of an aggregator, so the same providerId can be used for different providers if the aggregator is different
*  **providerName** - Display name of the given provider

## Providers Collection [/fiware-rss/rss/providers{?aggregatorId}]

### List all providers [GET]

+ Parameters

    + aggregatorId: <EMAIL> (optional) - Optional parameter used to retrieve only those providers registered for a given aggregator

+ Request

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

+ Response 200 (application/json)

        [
            {
                "aggregatorId": "<EMAIL>",
                "providerId": "conwet",
                "providerName": "CoNWeT"
            }
        ]

### Register a provider [POST]

+ Request (application/json)

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

    + Body

            {
                "aggregatorId": "<EMAIL>",
                "providerId": "conwet",
                "providerName": "CoNWeT"
            }

+ Response 201

# Group Algorithms Management

API for the management of supported Algorithms. Supported algorithms are those that can be used to perform the revenue sharing. This API allows to retrieve supported algorithms

This API manages the following fields:
*  **algorithmId** - ID of the given algorithm
*  **description** - A textual description that explains how the algorithm works

## Algorithms Collection [/fiware-rss/rss/algorithms]

### List Supported Algorithms [GET]

+ Request

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

+ Response 200 (application/json)

        [
            {
                "algorithmId": "FIXED_PERCENTAGE",
                "description": "Fixed percentage distribution of revenues"
            }
        ]

# Group Revenue Sharing Models Management

API for the management of revenue sharing models. A Revenue Sharing Model specifies how the revenues must be distributed between the involved stakeholders. This API allows to retrieve, create, update, and delete revenue sharing models.

This API manages the following fields:
*  **ownerProviderId** - Provider Id of the owner of the model. This provider is the owner of the application and services whose revenues will be distributed using the Revenue Sharing Model
*  **ownerValue** - Value of the owner provider in the Revenue Sharing Model. The semantics of this field depends on the algorithm specified, for example if the algorithm is a fixed precentage, this field will contain the percetage of the revenue that belongs to the owner provider.
*  **productClass** - Id of the Revenue Sharing Model. This field represents a group of services or applications whose revenues are distributed in the same way
*  **algorithmType** - ID of the algorithm that is used in this model
*  **aggregatorId** - Id of the aggregator that represents the Store instance where the applications and services are offered, and thus, must receive part of the revenues
*  **aggregatorValue** - Value of the aggregator in the Revenue Sharing Model
*  **stakeholders** - List of providers that are stakeholders of the applications and services included in a given product class, and thus, must receive part of the revenues. For each stakeholder the following fields are included:
    * stakeholderId - provider Id of the Stakeholder
    * modelValue - Value of the stakeholder in the Revenue Sharing Model

## Revenue Sharing Models Collection [/fiware-rss/rss/models{?aggregatorId}{?appProviderId}{?productClass}]

### List Revenue Sharing models [GET]

+ Parameters

    + aggregatorId: <EMAIL> (optional) - Optional parameter used to filter by aggragtor Id
    + appProviderId: aarranz (optional) - Optional parameter used to filter by provider Id
    + productClass: orionServices (optional) - Optional parameter used to filter by product class

+ Request

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

+ Response 200 (application/json)

        [
            {
                "ownerProviderId": "fdelavega",
                "ownerValue": 60,
                "productClass": "orionServices",
                "algorithmType": "FIXED_PERCENTAGE",
                "aggregatorId": "<EMAIL>",
                "aggregatorValue": 20,
                "stakeholders": [
                    {
                        "stakeholderId": "aarranz",
                        "modelValue": 20
                    }
                ]
            }
        ]

### Create Revenue Sharing Model [POST]

+ Request (application/json)

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

    + Body

            {
                "ownerProviderId": "fdelavega",
                "ownerValue": 60,
                "productClass": "orionServices",
                "algorithmType": "FIXED_PERCENTAGE",
                "aggregatorId": "<EMAIL>",
                "aggregatorValue": 20,
                "stakeholders": [
                    {
                        "stakeholderId": "aarranz",
                        "modelValue": 20
                    }
                ]
            }

+ Response 201


# Group CDRs - Transactions - Management

API for the management of CDR documents describing transactions. This API allows to register and retrieve transactions. Additionally, this API allows to launch the settlement process that aggregates the transactions and calculates the distribution of revenues.

This API manages the following fields:
*  **cdrSource** - Id of the aggregator that represent the Store instance that is generating the charging information
*  **productClass** - Product Class used to identify the revenue sharing model that will be used to distribute the revenues generated in the current transaction
*  **correlationNumber** - Correlation number of the transaction
*  **timestamp** - Timestamp of the transaction
*  **application** - Textual field with the id of the application or service that generates the transaction
*  **transactionType** - Type of transaction. This field can contain "C" for charges and "R" for refunds
*  **event** - Textual field that describes the event that generated the transaction (e.g pay-per-use)
*  **referenceCode** - Reference code that identifies the purchase in the Store instance that generates the transaction
*  **description** - Textual description of the transaction
*  **chargedAmount** - Part of the total charged amount to be distributed. The total amount charged to the customer includes also the field chargedTaxAmount
*  **chargedTaxAmount** - Part of the total charged amount that are taxes. The total amount charged to the customer includes also the field chargedAmount
*  **currency** - Currency of the transaction
*  **customerId** - Id of the customer that acquires the given service or application
*  **appProvider** - provider Id of the owner of the charged applications or services

## Transactions Collection [/fiware-rss/rss/cdrs{?aggregatorId}{?providerId}]

### List Transactions [GET]

+ Parameters

    + aggregatorId: <EMAIL> (optional) - Optional parameter used to filter transactions by aggregatorId
    + providerId: aarranz (optional) - Optional parameter used to filter transactions by providerId 

+ Request

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

+ Response 201 (application/json)

        [
            {
                "cdrSource": "<EMAIL>",
                "productClass": "orionServices",
                "correlationNumber": 112,
                "timestamp": "2015-07-15T19:00:01.000Z",
                "application": "OrionStarterKit",
                "transactionType": "C",
                "event": "use",
                "referenceCode": "555b079d8e05ac213ff15827",
                "description": "Usage of OrionStarterKit Offering",
                "chargedAmount": 10,
                "chargedTaxAmount": 3,
                "currency": "EUR",
                "customerId": "amagan",
                "appProvider": "fdelavega"
            }
        ]

### Create Transaction [POST]

+ Request (application/json)

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

    + Body

            {
                    "cdrSource": "<EMAIL>",
                    "productClass": "orionServices",
                    "correlationNumber": 112,
                    "timestamp": "2015-07-15T19:00:01.000Z",
                    "application": "OrionStarterKit",
                    "transactionType": "C",
                    "event": "use",
                    "referenceCode": "555b079d8e05ac213ff15827",
                    "description": "Usage of OrionStarterKit Offering",
                    "chargedAmount": 10,
                    "chargedTaxAmount": 3,
                    "currency": "EUR",
                    "customerId": "amagan",
                    "appProvider": "fdelavega"
                }

+ Response 201

## Settlement Collection [/fiware-rss/rss/settlement{?aggregatorId}{?providerId}{?productClass}]

### Launch Settlement [GET] 

+ Parameters

    + aggregatorId: <EMAIL> (optional) - Optional parameter used to aggregate only transactions with a given aggregator
    + providerId: aarranz (optional) - Optional parameter used to aggregate only transactions with a given provider 
    + productClass: orionServices (optional) - Optional parameter used to aggregate only transactions with a given product class

+ Request

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

+ Response 202

## Reports Collection [/fiware-rss/rss/settlement/reports{?aggregatorId}{?providerId}{?productClass}]

API for the management of RS Reports generated during the settlement process. This API allows to retrieve RS Reports.

This API manages the following fields:

*  **ownerProviderId** - Provider Id of the owner of the model. This provider is the owner of the application and services whose revenues has been aggregated.
*  **ownerValue** - Amount that has to be paid to the provider.
*  **productClass** - Id of the Revenue Sharing Model that have been applied. This field represents a group of services or applications whose revenues are distributed in the same way 
*  **algorithmType** - ID of the algorithm that have been used.
*  **aggregatorId** - Id of the aggregator that represents the Store instance where the applications and services are offered, and thus, must receive part of the revenues
*  **aggregatorValue** - Amount that has to be paid to the store owners.
*  **currency**: Currency of the different amounts.
*  **timestamp**: Timestamp of the reports.
*  **stakeholders** - List of providers that are stakeholders of the applications and services included in a given product class, and thus, must receive part of the revenues. For each stakeholder the following fields are included:
    * **stakeholderId** - provider Id of the Stakeholder
    * **modelValue** - Amount that has to be paid to the concrete stakeholder

### Get Reports [GET]

+ Parameters

    + aggregatorId: <EMAIL> (optional) - Optional parameter used to get only reports with a given aggregator
    + providerId: aarranz (optional) - Optional parameter used to get only reports with a given provider 
    + productClass: orionServices (optional) - Optional parameter used to get only reports with a given product class

+ Request

    + Headers

            Authorization: Bearer YOUR_OAUTH2_TOKEN

+ Response 200 (application/json)

        [
            {
                "ownerProviderId": "fdelavega",
                "ownerValue": 4578,
                "productClass": "orionServices",
                "algorithmType": "FIXED_PERCENTAGE",
                "aggregatorId": "<EMAIL>",
                "aggregatorValue": 3000,
                "currency": EUR,
                "timestamp": "2015-07-15T19:00:01",
                "stakeholders": [
                    {
                        "stakeholderId": "aarranz",
                        "modelValue": 2500
                    }
                ]
            }
        ]

# Group Expenditure Limit Management

API for the management of expenditure limits. This API allows to define a couple of limits that allow to control the maximun expenses of customers in different periods of time. This API allows to list, create, modify, and delete expenditure limits.

This API manages the following fields:
*  **service** - Service where the limits are applied
{'fraction_non_alphanumeric': 0.07295683720398777, 'fraction_numerical': 0.012283257634187448, 'mean_word_length': 2.868714775113272, 'pattern_counts': {'":': 138, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6556165', 'n_tokens_mistral': 9121, 'n_tokens_neox': 8278, 'n_words': 3782}