POST additive_discounts/ad_hoc_discounts/cancel

This method cancels an ad hoc discount, which is in a pending approval life cycle state or approved but not applied yet. A  single ad hoc discount can be cancelled by each call.

As of CRM.COM R15.0.0 the process is responsible for cancelling ad hoc discount applied on Jobs or Subscriptions with no restrictions. Cancelled ad-hoc discounts which are recurring, i.e. applied for more than one time (in case of subscriptions) may have already been applied for one or more times but cancelled from now on

Resource URL

Parameters

Name

Type

Description

token

String

The token retrieved from the login method

ad_hoc_discount_identifier

(mandatory)

Ad Hoc Discount identifier  

The identifier of the ad hoc discount that will be cancelled. Only ad hoc discounts in a pending approval life cycle state or approved but not applied can be specified. The allowed ad hoc discount identifier fields are the following:

Name

Type

Description

id

(semi-optional)

String

The ID of the ad hoc discount

number

(semi-optional)

String

The number of the ad hoc discount

cancelled_by_identifier

(optional)

User IdentifierThe identifier of the user that cancelled the ad hoc discount. If not specified then it defaults to the user that submitted the request into the system. The allowed user identifier fields are the following:

Name

Type

Description

id

(semi-optional)

String

The ID of the user

username

(semi-optional)

String

The username of the user

cancelled_on

(optional)

DateThe date that the ad hoc discount was cancelled. If not specified then it defaults to the date that the request was submitted into the system.

Restrictions

  • It is mandatory to specify one of the semi-optional parameters.

Response Data

 ad_hoc_discount object response data

Name

Type

Description

id

String

The ID of the retrieved ad hoc discount

number

String

The number of the retrieved ad hoc discount

discount_amountNumberThe discount amount that will be applied,  if the additive discount definition is set up to provide a range of discount based on an amount
discount_percentageNumberThe discount percentage that will be applied,  if the additive discount definition is set up to provide a range of discount based on a percentage
effective_dateDateThe date that the discount becomes effective
expiration_dateDateThe date that the discount will expire
life_cycle_stateStringThe life cycle state of the retrieved ad hoc discount. Supported values are PENDING_APPROVAL, APPROVED and CANCELLED
discount_free_periodTime Period ObjectThe free period that will be provided, measured in days, weeks, months or years.  This information is available if the additive discount definition is set up to provide a range of discount based on free period

Referred Objects Response Data

 period object response data

Name

Type

Description

time_period_valueNumber

The time period value

time_period_uot

String

The time period unit of time. The supported values are the following:

MINUTES, HOURS, DAYS, WEEKS, MONTHS, YEARS

Examples

 Example 1

HTTP Method: POST


Request:

Body:

 {
      "token":"4C5D6C83A5584D928FCBAA30DAA58E36",
      "ad_hoc_discount_identifier":{"number":"14"}
} 



Response:

 {
    "data": {
        "log_information": {
            "created_by_unit": {
                "alternative_code": "adminunit",
                "group_name": null,
                "community_name": null,
                "name": "Admin Unit",
                "description": "admin unit",
                "id": "1"
            },
            "updated_by_unit": {
                "alternative_code": "adminunit",
                "group_name": null,
                "community_name": null,
                "name": "Admin Unit",
                "description": "admin unit",
                "id": "1"
            },
            "created_date": "2018-06-18T12:56:46",
            "updated_date": "2018-06-18T13:02:26",
            "updated_by_user": {
                "person_name": null,
                "id": "1",
                "email": null,
                "username": "MPAdministrator"
            },
            "created_by_user": {
                "person_name": null,
                "id": "1",
                "email": null,
                "username": "MPAdministrator"
            }
        },
        "applied": false,
        "discount_amount": null,
        "for": null,
        "currency_rate_period": null,
        "approved_on": "2018-06-18T12:56:19",
        "discount_percentage": 26,
        "subscription": {
            "number": "S0000009447",
            "first_activated_date": "2018-06-18T10:17:06",
            "rating_state": "PENDING",
            "accounts_receivable": {
                "number": "ACR0000008718",
                "name": "ACR0000008718 Test 18062018_01",
                "id": "5DD09993C3B64A10A594494CF6211D3C",
                "life_cycle_state": "ACTIVE",
                "account_owner": {
                    "company_profile": null,
                    "company_name": null,
                    "name": "Test 18062018_01",
                    "last_name": "18062018_01",
                    "id": "922DBE8C2A1046AFADC133E52DFC9E97",
                    "life_cycle_state": "FINANCIAL",
                    "middle_name": null,
                    "title": null,
                    "type": "PERSON",
                    "first_name": "Test",
                    "demographics": {
                        "id_number": "18062018_01",
                        "gender": null,
                        "country_of_residence": {
                            "alternative_code": "CYP",
                            "three_character_code": "CYP",
                            "name": "CYPRUS",
                            "id": "181",
                            "two_character_code": "CY"
                        },
                        "date_of_birth": {
                            "month": null,
                            "year": null,
                            "day": null
                        },
                        "industry_sector": null,
                        "industry": null,
                        "name_day": {
                            "month": null,
                            "day": null
                        },
                        "passport_number_expiration_date": null,
                        "id_number_expiration_date": null,
                        "passport_number": null,
                        "social_security_number": null,
                        "id_issued_by_country": null,
                        "passport_issued_by_country": null
                    }
                }
            },
            "id": "F23960758EE549FEBAEEAACE895C8BBC",
            "life_cycle_state": "EFFECTIVE",
            "type": {
                "alternative_code": "normalsub",
                "name": "Normal",
                "description": null,
                "id": "D1BAE6454A2248189EBCD7ADD3B4B65F",
                "classification": "FLEXIBLE"
            }
        },
        "expiration_date": null,
        "udf_date_2": null,
        "udf_date_1": null,
        "udf_date_4": null,
        "products_set": [
            {
                "product": {
                    "code": "Bronze",
                    "product_type": {
                        "meter_reading_type": null,
                        "service_type": "TERMED",
                        "used_for_provisioning": true,
                        "alternative_code": "Main Packages",
                        "udr_type": null,
                        "composition_method": "FLAT",
                        "name": "Main Packages",
                        "description": null,
                        "id": "E186E293AAAB49EE86A729540A4287FE",
                        "classification": "SERVICES",
                        "physical_good_type": null
                    },
                    "alternative_code": "B",
                    "description": "Bronze",
                    "id": "F50CC52934BD4F119B6E18E215A4FC55",
                    "priority_level": null
                },
                "id": "711F596A557247F5AA36CC6058CA7264"
            }
        ],
        "udf_date_3": null,
        "number": "14",
        "udf_float_3": null,
        "udf_float_4": null,
        "effective_date": null,
        "id": "C6F0301851834CBC82AA19B8437A12E4",
        "udf_float_1": null,
        "approval_method": "AUTOMATIC",
        "udf_float_2": null,
        "udf_string_2": null,
        "udf_string_3": null,
        "udf_string_4": null,
        "udf_string_5": null,
        "cancelled_by": null,
        "udf_string_1": null,
        "additive_discount_definition": {
            "alternative_code": "PAT",
            "name": "Pricing Audit Trail",
            "id": "5DCEED7D776741EFAEDE281FB797AE06",
            "life_cycle_state": "EFFECTIVE",
            "classification": "SUBSCRIPTIONS",
            "type": "AD_HOC"
        },
        "life_cycle_state": "CANCELLED",
        "cancelled_on": null,
        "provided_on": "2018-06-18T12:56:19",
        "approved_by": {
            "person_name": null,
            "id": "1",
            "email": null,
            "username": "MPAdministrator"
        },
        "applied_on": null,
        "provided_by": {
            "person_name": null,
            "id": "1",
            "email": null,
            "username": "MPAdministrator"
        },
        "renew": null,
        "udf_string_6": null,
        "job": null,
        "udf_string_7": null,
        "discount_free_usage": null,
        "udf_string_8": null
    },
    "status": {
        "code": "OK",
        "description": "",
        "message": ""
    }
}