# Plan Suspension

This service is used to request suspensions.

# Special notes:

Various preconditions on the client's account must be met before sending a successful request, please see all responses on the failed request about eligibility of sending a suspension request.

# Request Configuration

# Request Endpoint

/api/Account/PostSuspension

# Request Method

POST

# Request Headers

Name Type Description
aaid string Use aaid returned from Login
token string Use token returned from Login
cnum string Currently use cnum returned from PhoneBox Customer Care, will automate this process

# Request Parameters:

Name Type Description
reason string reason must be either one of the below.
  1. lost
  2. vacation
sdate DateTime Date when plan suspension should become effective. If reason is vacation, then the value of sdate must follow below conditions:
  1. sdate cannot be in the past.
  2. sdate must always be 2nd of the month.
  3. cut off date: 3 DAY before the 2nd Day of the Next Month.
  4. If requested BEFORE cut off date, the earliest sdate must be 2nd of the following month.
  5. If requested AFTER cut off date, the earliest sdate must be 2nd of one month after the following month.
  6. Eg. if requested between July 1st to July 29th , the earliest sdate should be August 2nd.
  7. Eg. if requested between July 30th to August 1st , the earliest sdate should be September 2nd.
edate DateTime reason of requesing a plan change. more details on this coming soon.
notes string Additional notes, can be empty ('')

# Request Body

None

# Sample Reqeust

# Sample Request URL

http://localhost:60904/api/Activation/GetTotalPrepaid?orderSimCard=True&PlanID=6666&CountryId=42&ProvinceCode=BC&start=2020-10-31&promocode=MyPromoCode

# cURL

curl --location --request GET 'http://localhost:60904/api/Activation/GetTotalPrepaid?orderSimCard=True&PlanID=6666&CountryId=42&ProvinceCode=BC&start=2020-10-31&promocode=MyPromoCode' \
--header 'client: 6666' \
--header 'apitoken: foqxcFJ82EhecRXnIZbeQbb8m9/dFFHO'

# Python - Requests

import requests
url = "http://localhost:60904/api/Activation/GetTotalPrepaid"

params = {
        'orderSimCard': 'True', 
        'PlanID': '66666',
        'CountryId': '247',
        'ProvinceCode': 'ON',
        'start': '2020-10-31',
        'promocode': 'MyPromoCode' 
}

headers = {
    'client': '1234',
    'apitoken': 'foqxcFJ82EhecRXnIZbeQbb8m9/dFFHO'
}
response = requests.get(url, headers=headers, params=params)

print(response.text.encode('utf8'))

# NodeJs -Axios

var axios = require('axios');

var data = {};

const params = new URLSearchParams({
    carrier: 'R',
    promocode: 'MyPromoCode'
}).toString();

const url =
    "https://testmyaccount.azurewebsites.net/api/Activation/PrepaidPlans" +
    params;



axios
    .get(
        url,
        {
            headers: {
                client: '66666',
                apitoken: 'foqxcFJ82EhecRXnIZbeQbb8m9'
            },
            params: {
                orderSimCard: 'True', 
                PlanID: '66666',
                CountryId: '247',
                ProvinceCode: 'ON',
                start: '2020-10-31',
                promocode: 'MyPromoCode' 
            }
        }
    )
    .then(res => {
        console.log(JSON.parse(res.data));
    })
    .catch(err => {
        console.log(err);
    });

# Response

# Success

return a list of JSON containing below information

[[
    {
        "currency": "CAD",
        "plan_Amt": 45.00,
        "prorate_Duration": "Oct 31, 2020~Nov 01, 2020",
        "charge_Duration": "Nov 02, 2020~Dec 01, 2020",
        "prorate_Amt": 3.00,
        "simcard_amt": 0.0,
        "subtotal": 48.00,
        "gst_rate": 5.000,
        "pst_rate": 7.000,
        "gst_Amt": 2.40,
        "pst_Amt": 3.36,
        "promo_Amt": 0.00,
        "total": 53.76,
        "prorate_Start": "Oct 31, 2020",
        "prorate_End": "Nov 01, 2020",
        "prorate_DataCap": "204.80 MB",
        "firstmonth_DataCap": "204.80 MB",
        "charge_Start": "Nov 02, 2020",
        "dataaddon_Fee": 0.0,
        "prorate_Pct": 0.07
    }
]

# Fail

  1. Failed Authorization

    reason: wrong login credential or client number cnum does not belong to this partner

    {
        "Message": "Authorization has been denied for this request."
    }
    
  2. Wrong Client Info

    reason: entered invalid client number cnum

    {
        "ERROR: Cannot find client info!";
    }
    
  3. Wrong Reason

    reason: entered invalid reason

    {
        "ERROR: The reason is supposed to be vacation or lost.;"
    }
    
  4. Duplicated Request

    reason: there is a pending supension request on this client's account

    {
        "ERROR: Suspension request submitted already!";
    }
    
  5. Account cannot be suspended

    reason: account balance must be non-positive when requesting suspension and reason is vacation.

    {
        "ERROR: Balance should not more than 0;"
    }
    
  6. Wrong Start Date

    reason: sdate must be 2nd of the month when requesting suspension and reason is vacation.

    {
        "ERROR: The start date is supposed to be 2.";
    }
    
  7. Wrong Start Date

    reason: sdate must be following the condition regarding to cut off date when requesting suspension and reason is vacation.

    {
        "ERROR: The start date is invalid.";
    }
    
LastUpdated: 6/1/2021, 11:03:06 PM