Order Attributes. Attributes Validation

The Order Attributes URL allows a service to request additional data when a subscription is ordered in ActivePlatform. The Attributes Validation URL is used to validate the specified values.

The general flow for the Order Attributes and Attributes Validation events includes the following steps:

  1. A user orders a vendor's service via ActivePlatform.
  2. As part of the provisioning process, ActivePlatform calls the Order Attributes URL of a microservice and sends information about the reseller and distributor attributes of the product.

    POST /order/attributes

    Body:

    Name

    Data type

    Description

    resellerobjectInformation about the reseller who sold the subscription to a service plan of a product via ActivePlatform (see Viewing and updating reseller general information in the Operator Comtrol Panel guide)

    idintegerThe reseller ID

    namestringThe reseller name

    company_namestringThe company name

    first_addressstringAddress line 1

    second_addressstringAddress line 2

    citystringCity

    regionstringRegion

    zipstringZip code

    countrystringCountry code

    company_phonestringThe company's phone number in the international format

    company_emailstringThe company's email address

    currencystringThe reseller currency code

    attributesobjectThe list of the product attributes (key-value pairs) applied to the reseller (see Extending the reseller object and Product attributes):

    core_attributesobjectThe list of public custom attributes (key-value pairs) applied to the reseller in ActivePlatform (see in the Viewing the list of attributes Operator Comtrol Panel guide):
    • {reseller_attribute_key} — the custom attribute key.
    • {reseller_attribute_value} — the custom attribute value.
    distributorobjectInformation about the distributor (a reseller in ActivePlatform, see Viewing and updating reseller general information in the Operator Comtrol Panel guide) who received the published product (see Add distributors)

    idintegerThe distributor ID

    namestringThe distributor name

    regionstringThe distributor location: region

    currencystringThe distributor currency code

    attributesobjectThe list of the product attributes applied to a distributor (see Extending the distributor object and Product attributes):
    attributes_forstring
    Defines the target Panel to display additional order attributes:

    Usually, all attributes are displayed for a manager and customer without any difference. However, in some cases, an attribute should be displayed for a manager only. For instance, a reseller's code for a discount (see Approval Code in Kaspersky (PAYG, Yearly). Service specifics in Services. Operator Guide), which does not have any sense for a customer, will not be included in the microservice response and thus not displayed in the Customer Control Panel if attributes_for = client.

  3. The microservice returns to ActivePlatform a JSON with the information required for the subscription provisioning.

    Response status: 200

    Response body:

    Name

    Data type

    Description

    attributesarray of objectsInformation about the order attributes required for the subscription provisioning

    labelstringAttribute name (see Label name in Product attributes)

    typestringAttribute data type (see Type in Product attributes)

    keystringAttribute key (see Key in Product attributes)

    descriptionstringAttribute description

    prioritystringAttribute priority (see Weight in Product attributes)

    default_valuestringAttribute default value

    hintstringText of a hint for an attribute to display to the user on a page with the order attributes

    values

    array

    List of valid values of an attribute, if applied
  4. ActivePlatform displays to the user a page for specifying the values of the order attributes from the JSON.
  5. The user specifies the values of the order attributes.

  6. ActivePlatform sends a JSON to the microservice to the Attributes Validation URL to validate the specified values.

    POST /attributes/validation

    Body:

    Name

    Data type

    Description

    resellerobjectInformation about the reseller who sold the subscription to a service plan of a product via ActivePlatform (see Viewing and updating reseller general information in the Operator Comtrol Panel guide)

    idintegerThe reseller ID

    namestringThe reseller name

    company_namestringThe company name

    first_addressstringAddress line 1

    second_addressstringAddress line 2

    citystringCity

    regionstringRegion

    zipstringZip code

    countrystringCountry code

    company_phonestringThe company's phone number in the international format

    company_emailstringThe company's email address

    currencystringThe reseller currency code

    attributesobjectThe list of the product attributes (key-value pairs) applied to the reseller (see Extending the reseller object and Product attributes):

    core_attributesobjectThe list of public custom attributes (key-value pairs) applied to the reseller in ActivePlatform (see in the Viewing the list of attributes Operator Comtrol Panel guide):
    • {reseller_attribute_key} — the custom attribute key.
    • {reseller_attribute_value} — the custom attribute value.
    distributorobjectInformation about the distributor (a reseller in ActivePlatform, see Viewing and updating reseller general information in the Operator Comtrol Panel guide) who received the published product (see Add distributors)

    idintegerThe distributor ID

    namestringThe distributor name

    regionstringThe distributor location: region

    currencystringThe distributor currency code

    attributesobjectThe list of the product attributes applied to a distributor (see Extending the distributor object and Product attributes):
    {order attributes}stringThe list order attributes (key-value pairs) for validation:
    • {order_attribute_key} — the order attribute key.
    • {order_attribute_value} — the order attribute value specified by a user.
    attributes_forstringDefines the origin Panel for the specified additional order attributes:
    • client — the Customer Control Panel (/plugin/vendor_service/client/attributes/new).
    • reseller — the Operator Control Panel (/plugin/vendor_service/attributes/new) or API (see Validate the reseller's Plan order attributes).
  7. The vendor's service validates the data:
    • If the data is not valid, the microservice sends back a JSON with the error message.

      Response status: 200

      Response body:

      Name

      Data type

      Description

      {order_attribute_key}stringThe order attribute key of the attribute with a value caused an error
      {error description}arrayThe text of the order attribute error to display to the user on a page with the order attributes
    • If the data is valid:
      1. The microservice attaches the provided data to the JSON to send it to the service provider and create a subscription (see Subscription Create).
      2. The microservice responds to ActivePlatform with an empty JSON and status: 200.

Event and response examples

An example describes ordering a subscription to the Google Workspace (G Suite) service (see Ordering a "Google Workspace" Subscription in Services. User documentation):

  1.  Example request of order attributes for the specified reseller:

    POST http://g-suite.activeplatform.com/v1/order/attributes
    {
      "reseller": {
        "id": 2,
        "name": "Root",
        "company_name": "Dev acc",
        "first_address": "Street building",
        "second_address": "",
        "city": "City",
        "region": "Region",
        "zip": "220000",
        "country": "US",
        "company_phone": "+123555456",
        "company_email": "email@example.com",
        "currency": "USD",
        "attributes": {
          "reseller_admin_email": "admin@example.com",
          "service_account_email": "AP0500",
          "certificate": "==="
        },
        "core_attributes": {
          "kaspersky_reseller_pin": "********"
        }
      },
      "distributor": {
        "id": 1,
        "name": "Example LLC",
        "region": "Quinsk",
        "currency": "USD",
        "attributes": {
          "reseller_public_id": "1234a5678"
        }
      },
      "attributes_for": "reseller"
    }
  2. Example respond with information about order attributes:
    HTTP code status: 200 OK

    {
       "attributes":[
          {
             "label":"Domain name",
             "type":"string",
             "key":"domain_name",
             "description":"",
             "priority":"1",
             "default_value":"",
             "hint":"Enter the domain name of your legal entity. Your G Suite Account will be registered to the domain name you specified, for instance, example.com. You will need to confirm the ownership of the domain after the registration.",
             "values":[]
          },
          {
             "label":"Alternate customer email",
             "type":"string",
             "key":"customer_alternate_email",
             "description":"",
             "priority":"2",
             "default_value":"",
             "hint":"Specify alternate email as secondary contact used if something happens such as service outage or a security issue. Email should not contain the same domain as Domain name field.",
             "values":[]
          },
          {
             "label":"Administrator's account username",
             "type":"string",
             "key":"admin_login",
             "description":"",
             "priority":"3",
             "default_value":"",
             "hint":"Enter the name of the Account owner. The name will be used as a login. The Account owner can add other Subscription users.",
             "values":[]
          },
          {
             "label":"Domain name",
             "type":"string",
             "key":"transfer_domain_name",
             "description":"",
             "priority":"4",
             "default_value":"",
             "hint":"Enter your main domain on Google, for instance, example.com.",
             "values":[]
          },
          {
             "label":"Transfer token",
             "type":"string",
             "key":"transfer_token",
             "description":"",
             "priority":"5",
             "default_value":"",
             "hint":"A Transfer Token is a 16-digit alphanumeric code that can be generated from the Google admin console by the link.",
             "values":[]
          }
       ]
    }
  3. Example request to validate the values of the order attributes specified by a user:

    POST http://g-suite.activeplatform.com/v1/attributes/validation
    {
      "reseller": {
        "id": 2,
        "name": "Root",
        "company_name": "Dev acc",
        "first_address": "Street building",
        "second_address": "",
        "city": "City",
        "region": "Region",
        "zip": "220000",
        "country": "US",
        "company_phone": "+123555456",
        "company_email": "email@example.com",
        "currency": "USD",
        "attributes": {
          "reseller_admin_email": "admin@example.com",
          "service_account_email": "AP0500",
          "certificate": "==="
        },
        "core_attributes": {
          "kaspersky_reseller_pin": "********"
        }
      },
      "distributor": {
        "id": 1,
        "name": "Example LLC",
        "region": "Quinsk",
        "currency": "USD",
        "attributes": {
          "reseller_public_id": "1234a5678"
        }
      },
      "domain_name": "example.com",
      "customer_alternate_email": "email@example.net",
      "admin_login": "Owner",
      "attributes_for": "reseller"
    }
  4. Example respond with the validation results:
    • If the data is not valid:

      HTTP code status: 200 OK

      {
         "admin_login":[
            "Wrong admin login. Only Latin alphanumeric symbols are allowed"
         ]
      }
    • If the data is valid:

      HTTP code status: 200 OK

      {
      }

If a sent JSON is not valid, a microservice returns an error message:
HTTP code status: 400 Bad request

{
   "title":"Invalid JSON",
   "description":"Could not parse JSON body — Expecting value: line 1 column 1 (char 0)"
}