Table Of Contents

Verify Discounts

The DiscountManagement APS type is used to expose a singleton service that allows an external management system to retrieve detailed price calculation of a product. Since a system is authenticated as a user, the result will depend on the discounts and promotions valid for the account the user works for.

The getDealsForPlans custom operation of the discount manager accepts a list of APS IDs of service plans whose prices must be calculated. Optionally, it is possible to specify the subscription periods that the system is interested in. Otherwise, the response will contain the price calculation for all periods.

Note

The user whose credentials are used to call the getDealsForPlans operation must be allowed to send POST requests to the singleton resource based on the http://www.parallels.com/products/automation/billing APS type as explained in the Set Up the User’s Credentials section.

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... */  }
]

Key:

  • If the request refers to a service plan and does not specify any subscription periods, then the response will contain the price of every subscription period configured in the service plan.

  • The discount manager does not include any taxes into its calculation.

  • The discount manager is context sensitive, meaning it calculates the prices for the requester.