Request parameters (JSON):

  • tenant - (mandatory) - business tenant, e.g. "zegoal"

  • account_id - (conditional; group 1) - Account ID

  • account_name - (conditional; group 1) - Account Name

  • account_code - (conditional; group 1) - Account Code

  • skip_lookup_account - (optional; default false) - is used only when account_id is provided; skips extra call to DB for Account verification

  • product_id - (conditional; group 2) - Product ID (ID of Product in configuration); this is the Product that will be added/sold to Account

  • product_name - (conditional; group 2) - Product Name (name of Product in configuration); this is the Product that will be added/sold to Account

  • lc_status - (optional; default Active) - in which LC Status this Product should be added/sold to Account

  • lc_from - (optional; default now()) - when LC Status of new Product should be applied: immediately (by default) or later, at some point in time

  • params - (optional; default {}) - set personalized parameters' values to a Sold Product
    { param_key : param_value } - setting personalized parameter value
  • replace - (optional; default []) - list of products that Account already has that should be replaced (terminated) by adding/selling new Product
    [0..m]
    sold_product_id - (optional; conditional; group 3) - Sold Product ID of a product that Account already has that should be replaced (terminated)
    product_id - (optional; conditional; group 3) - Product ID of a product that Account already has that should be replaced (terminated)
    product_name - (optional; conditional; group 3) - Product Name of a product that Account already has that should be replaced (terminated)
  • force_tariff_change - (optional; default false) - affects the case when we sell 'primary tariff': if set to false then AddProduct will return error "Another primary tariff is already in place"; if set to true then AddProduct will change tariff from existing to the new one.

[group 1] One of conditional parameters: account_id, or account_name, or account_code - is mandatory to be provided.

[group 2] One of conditional parameters: product_id or product_name - is mandatory to be provided.

Response parameters (JSON):

  • AddProduct
    • request
      • "input" (request parameters) as is; only those parameters that were sent in input
    • response
      • <all request parameters> (filled with default values if were missing in input)
      • TZ - time zone of processing
      • account - object
        • account_id
        • account_name
        • account_code
        • account_type
        • current_lc_status
      • added_products - list
        • [0..n1]
          • sold_product_id
          • product_id
          • product_name
          • product_type
          • product_category
          • product_description
          • current_lc_status
          • lc - list
            • [0..m1]
              • lc_status
              • lc_from
              • lc_to
      • (if any) replaced_products - list
        • [0..n2]
          • sold_product_id
          • product_id
          • product_name
          • product_type
          • product_category
          • product_description
          • current_lc_status
          • lc - list
            • [0..m2]
              • lc_status
              • lc_from
              • lc_to
      • (if any) changed_tariff - object
        • old_tariff - object
          • sold_product_id
          • product_id
          • product_name
          • product_type
          • product_category
          • product_description
          • current_lc_status
          • lc - list
            • [0..m3]
              • lc_status
              • lc_from
              • lc_to
        • new_tariff - object
          • sold_product_id
          • product_id
          • product_name
          • product_type
          • product_category
          • product_description
          • current_lc_status
          • lc - list
            • [0..m4]
              • lc_status
              • lc_from
              • lc_to
      • (if any) added_triggers - list
        • [0..n5]
          • business_name
          • sold_product_id
          • product_id

Example of Request

{
    "tenant": "zegoal",
    "account_id": 2,
    "skip_lookup_account": true,
    "product_id": 4,
    "lc_status": "ACT",
    "force_tariff_change": true,
    "params": {
    	 "number_of_users_admin": 15,
    	 "price_of_user_admin": 5,
    	 "number_of_tasks": 3000,
    	 "gps_tracking": true,
         "custom_forms": 10000,
         "data_storage": 500,
         "api_access": true,
         "order_access": true
    }
}
CODE


Example of Response:

  {
   "processing_result":    {
      "text": "success",
      "status": "ok",
      "code": 0
   },
   "processing_date": "2019-09-04 09:37:44",
   "AddProduct":    {
      "response":       {
         "tenant": "zegoal",
         "skip_lookup_account": true,
         "replaced_products": [         {
            "sold_product_id": 1,
            "product_type": "primary tariff",
            "product_name": "TRIAL",
            "product_id": 5,
            "product_description": "Услуга Триал",
            "product_category": "combined",
            "params": {},
            "lc": [            {
               "lc_to": "",
               "lc_status": "TRM",
               "lc_from": "2019-09-04 09:37:43"
            }],
            "id": 1,
            "current_lc_status": "TRM"
         }],
         "replace": [         {
            "sold_product_id": 1,
            "product_name": "TRIAL",
            "product_id": 5
         }],
         "product_id": 4,
         "personal_prices":          [
                        {
               "price_id": 41,
               "overriden_price": 5,
               "multiplier": 15
            },
                        {
               "price_id": 43,
               "overriden_price": 3000
            },
                        {
               "price_id": 48,
               "multiplier": 15
            }
         ],
         "params":          {
            "price_of_user_admin": 5,
            "order_access": true,
            "number_of_users_admin": 15,
            "number_of_tasks": 3000,
            "gps_tracking": true,
            "data_storage": 500,
            "custom_forms": 10000,
            "api_access": true
         },
         "lc_status": "ACT",
         "lc_from": "2019-09-04 09:37:42",
         "force_tariff_change": true,
         "changed_tariff":          {
            "old_tariff":             {
               "sold_product_id": 1,
               "product_type": "primary tariff",
               "product_name": "TRIAL",
               "product_id": 5,
               "product_description": "Услуга Триал",
               "product_category": "combined",
               "params": {},
               "lc": [               {
                  "lc_to": "",
                  "lc_status": "TRM",
                  "lc_from": "2019-09-04 09:37:43"
               }],
               "id": 1,
               "current_lc_status": "TRM"
            },
            "new_tariff":             {
               "sold_product_id": 40,
               "product_type": "primary tariff",
               "product_name": "PRO",
               "product_id": 4,
               "product_description": "Услуга ПРО",
               "product_category": "combined",
               "params":                {
                  "price_of_user_admin": 5,
                  "order_access": true,
                  "number_of_users_admin": 15,
                  "number_of_tasks": 3000,
                  "gps_tracking": true,
                  "data_storage": 500,
                  "custom_forms": 10000,
                  "api_access": true
               },
               "lc": [               {
                  "lc_to": "",
                  "lc_status": "ACT",
                  "lc_from": "2019-09-04 09:37:42"
               }],
               "id": 40,
               "current_lc_status": "ACT"
            }
         },
         "added_triggers": [         {
            "sold_product_id": 40,
            "product_id": 4,
            "period": "monthly_1st_to_1st",
            "business_name": "PRO"
         }],
         "added_products": [         {
            "sold_product_id": 40,
            "product_type": "primary tariff",
            "product_name": "PRO",
            "product_id": 4,
            "product_description": "Услуга ПРО",
            "product_category": "combined",
            "params":             {
               "price_of_user_admin": 5,
               "order_access": true,
               "number_of_users_admin": 15,
               "number_of_tasks": 3000,
               "gps_tracking": true,
               "data_storage": 500,
               "custom_forms": 10000,
               "api_access": true
            },
            "lc": [            {
               "lc_to": "",
               "lc_status": "ACT",
               "lc_from": "2019-09-04 09:37:42"
            }],
            "id": 40,
            "current_lc_status": "ACT"
         }],
         "account_id": 1,
         "account":          {
            "current_lc_status": "Trial",
            "account_type": "Postpaid",
            "account_name": "name01",
            "account_id": 1,
            "account_code": "code01"
         },
         "TZ": "Europe/Minsk"
      },
      "request":       {
         "tenant": "zegoal",
         "skip_lookup_account": true,
         "product_id": 4,
         "params":          {
            "price_of_user_admin": 5,
            "order_access": true,
            "number_of_users_admin": 15,
            "number_of_tasks": 3000,
            "gps_tracking": true,
            "data_storage": 500,
            "custom_forms": 10000,
            "api_access": true
         },
         "lc_status": "ACT",
         "force_tariff_change": true,
         "account_id": 1
      }
   }
}
CODE