In this document:
The considered APS type (download
)
extends the Resource APS type(s) and looks as follows:
{
"name": "DiscountManagement",
"id": "http://www.odin.com/oa/billing/discount-management/1.0",
"apsVersion": "2.0",
"implements": [
"http://aps-standard.org/types/core/resource/1.0"
],
"access": {
"public": true
},
"operations": {
"getDealsForPlans": {
"path": "/deals/get-for-plans",
"verb": "POST",
"response": {
"type": "array"
},
"errorResponse": {
"type": "object"
},
"parameters": {
"plans": {
"kind": "body",
"type": "array",
"required": true
}
}
}
},
"structures": {
"PeriodDeals": {
"type": "object",
"properties": {
"period": {
"type": "Period",
"required": true
},
"resources": {
"type": "array",
"items": {
"type": "ResourceDeals"
}
},
"effectiveFees": {
"type": "array",
"items": {
"type": "EffectiveFees"
}
}
}
},
"Period": {
"type": "object",
"properties": {
"unit": {
"type": "String",
"enum": [
"MONTHS",
"YEARS"
]
},
"duration": {
"type": "integer"
}
}
},
"ResourceDeals": {
"type": "object",
"properties": {
"resourceId": {
"type": "string",
"required": true
},
"effectiveFees": {
"type": "array",
"items": {
"type": "EffectiveFees"
}
}
}
},
"EffectiveFees": {
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true
},
"fee": {
"type": "Currency"
},
"msrp": {
"type": "Currency"
},
"discount": {
"type": "Discount"
},
"quantity": {
"type": "number"
}
}
},
"Currency": {
"type": "object",
"properties": {
"value": {
"type": "string"
},
"code": {
"type": "String)"
}
}
},
"Discount": {
"type": "object",
"properties": {
"type": {
"type": "String",
"enum": [
"PERCENT",
"FIXED"
]
},
"value": {
"type": "number"
},
"amount": {
"type": "number"
}
}
},
"PlanDeals": {
"type": "object",
"properties": {
"planId": {
"type": "string",
"required": true
},
"periodDeals": {
"type": "array",
"required": true,
"items": {
"type": "PeriodDeals"
}
}
}
},
"Plan": {
"type": "object",
"properties": {
"planId": {
"type": "string",
"required": true
},
"periods": {
"type": "array",
"items": {
"type": "Period"
}
}
}
}
}
}
The APS type is used to create a singleton APS resource exposing its operations for API calls. The call syntax depends on the operation. For example, a call of an operation that accepts input parameters both in the URL string and in the body looks as follows:
POST /aps/2/services/discount-manager/<operation-path>?<query-params>
{/*<body params>*/}
In the above call, the verb can be either GET, PUT, POST, or DELETE as specified in the definition of the operation.
OPERATION |
VERB |
PATH |
RETURNS |
Description |
---|---|---|---|---|
POST |
/deals/get-for-plans |
Deals for provided plan periods |
Gets collection of deals for a plan period. Every deal value contains plan period cost/price details. If a plan has resource rates configured, deal values for them will be returned too. |
HTTP Request
POST /aps/2/services/discount-manager/deals/get-for-plans
Description
Gets collection of deals for a plan period. Every deal value contains plan period cost/price details. If a plan has resource rates configured, deal values for them will be returned too.
Parameters
PARAMETER |
TYPE |
DESCRIPTION |
---|---|---|
plans |
Array |
Collection of plans with periods to gets deals for |
Returns
Deals for provided plan periods
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
period |
Required |
Service plan period. |
||
resources |
Array of ResourceDeals |
Not Required |
Resource deals by service plan period. |
|
effectiveFees |
Array of EffectiveFees |
Not Required |
Effective fees for service plan periods. |
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
unit |
Enum |
Not Required |
Period unit. Available values are “MONTHS” and “YEARS”. |
|
duration |
Integer |
Not Required |
Period duration. |
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
resourceId |
String |
Required |
Resource APS ID. |
|
effectiveFees |
Array of EffectiveFees |
Not Required |
Effective fees for the service plan resources. |
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
name |
String |
Required |
Fee name. |
|
fee |
Not Required |
Fee value. |
||
msrp |
Not Required |
Manufacturer’s Suggested Retail Price. |
||
discount |
Not Required |
Applicable discount. |
||
quantity |
Number |
Not Required |
Quantity. |
Basic currency structure.
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
value |
String |
Not Required |
Amount. |
|
code |
String) |
Not Required |
Currency Code |
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
type |
Enum |
Not Required |
Discount type. Possible values are “PERCENT”, “FIXED”. |
|
value |
Number |
Not Required |
Discount value. |
|
amount |
Number |
Not Required |
Discount amount. |
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
planId |
String |
Required |
Service plan APS ID. |
|
periodDeals |
Array of PeriodDeals |
Required |
Plan period deals. See PeriodDeals. |
The following example shows a request for two periods of one plan and all available periods of another plan:
POST /aps/2/services/discount-manager/deals/get-for-plans
[
{
"planId":"89cd2116-a54f-4335-b1bd-d49ae7d0b8d3",
"periods":[
{
"unit":"MONTHS",
"duration":1
},
{
"unit":"YEARS",
"duration":1
}
]
},
{
"planId":"267421f6-836e-4216-ac47-81d3c76c587f"
}
]
The response contains the price components for the requested service plans with discounts valid for the requester, for example:
HTTP/1.1 200 OK
[
{
"planId": "89cd2116-a54f-4335-b1bd-d49ae7d0b8d3",
"periodDeals": [
{
"period": {
"unit": "YEARS",
"duration": 1
},
"resources": [
{
"resourceId": "af3c352b-0679-4653-ba5a-3cb616708ae4",
"effectiveFees": [
{
"name": "setup",
"fee": {
"value": "0.0",
"code": "USD"
}
},
{
"name": "recurring",
"fee": {
"value": "1.5",
"code": "USD"
},
"msrp": {
"value": "1.5",
"code": "USD"
}
},
]
}
],
"effectiveFees": [
{
"name": "setup",
"fee": {
"value": "0.0",
"code": "USD"
}
},
{
"name": "recurring",
"fee": {
"value": "1.5",
"code": "USD"
},
"msrp": {
"value": "1.5",
"code": "USD"
}
}
]
},
{
"period": {
"unit": "MONTHS",
"duration": 1
},
"resources": [
{
"resourceId": "af3c352b-0679-4653-ba5a-3cb616708ae4",
"effectiveFees": [
{
"name": "setup",
"fee": {
"value": "1.0",
"code": "USD"
}
},
{
"name": "recurring",
"fee": {
"value": "1.5",
"code": "USD"
}
}
]
}
],
"effectiveFees": [
{
"name": "setup",
"fee": {
"value": "1.0",
"code": "USD"
}
},
{
"name": "recurring",
"fee": {
"value": "1.5",
"code": "USD"
}
}
]
}
]
},
{ /* Another service plan... */ }
]