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 getDealsPerUnit 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 getDealsPerUnit 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

[
   {
      "planId":"edb58c1d-3b0b-41ae-816c-f15fa25ff429",
      "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": "edb58c1d-3b0b-41ae-816c-f15fa25ff429",
    "periodDeals": [
      {
        "period": {
          "unit": "YEARS",
          "duration": 1
        },
        "resources": [
          {
            "resourceId": "25bf1798-0fd1-438f-9e77-08284b3f7075",
            "effectiveFees": [
              {
                "name": "setup",
                "fee": {
                  "value": "1.0",
                  "code": "USD"
                },
                "lowerLimit": 0.0
              },
              {
                "name": "recurring",
                "fee": {
                  "value": "1.5",
                  "code": "USD"
                },
                "lowerLimit": 0.0
              }
            ]
          }
        ],
        "effectiveFees": [
          {
            "name": "recurring",
            "fee": {
              "value": "1.5",
              "code": "USD"
            }
          }
        ]
      },
      {
        "period": {
          "unit": "MONTHS",
          "duration": 1
        },
        "resources": [
          {
            "resourceId": "25bf1798-0fd1-438f-9e77-08284b3f7075",
            "effectiveFees": [
              {
                "name": "setup",
                "fee": {
                  "value": "1.0",
                  "code": "USD"
                },
                "lowerLimit": 0.0
              },
              {
                "name": "recurring",
                "fee": {
                  "value": "1.5",
                  "code": "USD"
                },
                "lowerLimit": 0.0
              }
            ]
          }
        ],
        "effectiveFees": [
          {
            "name": "setup",
            "fee": {
              "value": "1.0",
              "code": "USD"
            }
          },
          {
            "name": "recurring",
            "fee": {
              "value": "1.5",
              "code": "USD"
            }
          }
        ]
      }
    ]
  }
]

There are the following key differences with another pre-sale operation - Estimate the Order Price provided by the order manager:

  • The discount manager estimates the price separately for every explicitly or implicitly specified subscription period, whereas the order manager does it for those service plans and subscription periods that the estimated order contains.

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

  • The discount manager is context sensitive, meaning it calculates the prices for the requester, whereas the order manager does it for the specified account.

There are more complex configurations, for example, when discounts are provided by a parent service plan and when a service plan provides resources with tiered pricing as explained in discount management API examples.