Discount subscription

Endpoint can be called by:

GET /contractChanges/{id}?includeDiscountSubscriptions=All&includeContract=false

Parameter values for the includeDiscountSubscriptions:

Parameter valueDescription
AllContains unchanged and changed discount subscriptions
ChangedContains only changed discount subscriptions
None(Default) Contains no discount

Example response for a component subscription change

{
    "Id": "647dc226715e7089c55b777f",
    "Type": "DiscountSubscriptionChange",
    "Timestamp": "2023-06-05T11:08:22.7690000Z",
    "OrderId": "647dc2267d976744f219d4a6",
    "ContractId": "647dbc1a715e7089c55b7696",
    "ChangeDate": "2023-06-28T10:43:34.4870000Z",
    "NewPlanVariantId": "63e62a0d9864a09b6e4b2048",
    "NewPlanId": "63e62a0d9864a09b6e4b2045",
    "DiscountSubscriptions": [
        {
            "Id": "647dbcea715e7089c55b76eb",
            "Before": {
                "Id": "647dbcea715e7089c55b76eb",
                "DiscountId": "647dbc9e715e7089c55b76c7",
                "StartDate": "2023-06-05T10:45:53.0000000Z",
                "EndDate": "2023-06-05T11:01:42.7100000Z",
                "Status": "Ended"
            },
            "After": {
                "Id": "647dbcea715e7089c55b76eb",
                "DiscountId": "647dbc9e715e7089c55b76c7",
                "StartDate": "2023-06-05T10:45:53.0000000Z",
                "EndDate": "2023-06-05T11:01:42.7100000Z",
                "Status": "Ended"
            }
        },
        {
            "Id": "647dc210715e7089c55b7746",
            "Before": {
                "Id": "647dc210715e7089c55b7746",
                "DiscountId": "63e62a0d9864a09b6e4b204d",
                "StartDate": "2023-06-05T10:43:34.4870000Z",
                "EndDate": "2023-07-05T10:43:34.4870000Z",
                "Status": "Active"
            },
            "After": {
                "Id": "647dc210715e7089c55b7746",
                "DiscountId": "63e62a0d9864a09b6e4b204d",
                "StartDate": "2023-06-05T10:43:34.4870000Z",
                "EndDate": "2023-06-28T10:43:34.4870000Z",
                "Status": "Active"
            }
        }
    ]
}

T1 Discount subscription creation and a direct start

{  
    "ContractId": "647dbc1a715e7089c55b7696",  
    "CustomerId": "647dbc1a715e7089c55b7692",  
    "ExternalCustomerId": "631765",  
    "ContractChangeId": "647dbcf0715e7089c55b76fb",  
    "ContractChangeType": "DiscountSubscriptionChange",
    "Event": "ContractChanged",  
    "EntityId": "63b2d4405b49105c19fa7714"
}
{   
     "Id": "647dbcf0715e7089c55b76fb",    
     "Type": "DiscountSubscriptionChange",    
     "Timestamp": "2023-06-05T10:46:08.3870000Z",  
     "OrderId": "647dbcea933e0da52685c6c0",  
     "ContractId": "647dbc1a715e7089c55b7696",    
     "ChangeDate": "2023-06-05T10:45:53.0000000Z",    
     "NewPlanVariantId": "63e62a0d9864a09b6e4b2048",    
     "NewPlanId": "63e62a0d9864a09b6e4b2045",    
     "DiscountSubscriptions": [
        {            
                    "Id": "647dbcea715e7089c55b76eb",
                    "After": {
                        "Id": "647dbcea715e7089c55b76eb",     
                        "DiscountId": "647dbc9e715e7089c55b76c7",               
                        "StartDate": "2023-06-05T10:45:53.0000000Z",
                        "Status": "Active"    
                     }
        } 
   ]
}

T2 Discount end scheduled

{  
    "ContractId": "647dbc1a715e7089c55b7696",  
    "CustomerId": "647dbc1a715e7089c55b7692",  
    "ExternalCustomerId": "631765",  
    "ContractChangeId": "647dc099715e7089c55b7733",  
    "ContractChangeType": "DiscountSubscriptionChange",
    "Event": "ContractChanged",  
    "EntityId": "63b2d4405b49105c19fa7714"
}
{   
     "Id": "647dc099715e7089c55b7733",    
     "Type": "DiscountSubscriptionChange",    
     "Timestamp": "2023-06-05T10:46:08.3870000Z",  
     "OrderId": "647dbcea933e0da52685c6c0",  
     "ContractId": "647dbc1a715e7089c55b7696",    
     "ChangeDate": "2023-06-05T10:45:53.0000000Z",    
     "NewPlanVariantId": "63e62a0d9864a09b6e4b2048",    
     "NewPlanId": "63e62a0d9864a09b6e4b2045",    
     "DiscountSubscriptions": [
        {            
                    "Id": "647dbcea715e7089c55b76eb",
                    "Before": {
                        "Id": "647dbcea715e7089c55b76eb",     
                        "DiscountId": "647dbc9e715e7089c55b76c7",               
                        "StartDate": "2023-06-05T10:45:53.0000000Z",
                        "Status": "Active"    
                    },            
                    "After": {
                        "Id": "647dbcea715e7089c55b76eb",     
                        "DiscountId": "647dbc9e715e7089c55b76c7",               
                        "StartDate": "2023-06-05T10:45:53.0000000Z",
                        "EndDate": "2023-06-06T11:01:42.7100000Z",
                        "Status": "Active"    
                     },
        } 
   ]
}

T3 Discount subscription ends

{  
    "ContractId": "647dbc1a715e7089c55b7696",  
    "CustomerId": "647dbc1a715e7089c55b7692",  
    "ExternalCustomerId": "631765",  
    "ContractChangeId": "647dc176f7458d1b16e5b281",  
    "ContractChangeType": "Timebased",
    "Event": "ContractChanged",  
    "EntityId": "63b2d4405b49105c19fa7714"
}
{   
     "Id": "647dc176f7458d1b16e5b281",    
     "Type": "Timebased",    
     "Timestamp": "2023-06-06T11:01:42.7100000Z",  
     "OrderId": "647dc098e415ee5b549429c1",  
     "ContractId": "647dbc1a715e7089c55b7696",        
     "NewPlanVariantId": "63e62a0d9864a09b6e4b2048",    
     "NewPlanId": "63e62a0d9864a09b6e4b2045",    
     "DiscountSubscriptions": [
        {            
                    "Id": "647dbcea715e7089c55b76eb",
                    "Before": {
                        "Id": "647dbcea715e7089c55b76eb",     
                        "DiscountId": "647dbc9e715e7089c55b76c7",               
                        "StartDate": "2023-06-05T10:45:53.0000000Z",
                        "EndDate": "2023-06-06T11:01:42.7100000Z",
                        "Status": "Active"    
                    },            
                    "After": {
                        "Id": "647dbcea715e7089c55b76eb",     
                        "DiscountId": "647dbc9e715e7089c55b76c7",               
                        "StartDate": "2023-06-05T10:45:53.0000000Z",
                        "EndDate": "2023-06-06T11:01:42.7100000Z",
                       "Status": "Ended"  
                     },
        } 
   ]
}

Response object contains:

  • A complete list of discount subscriptions as a list with Before and After states for each object,
  • Detection of active discount subscriptions has to be done evaluating around the Timestamp of the contract change compared to the StartDate or EndDate of the DiscountSubscription as well as the Status.

What’s Next