# Account Termination

This service is used to request a termincation on the account.

# Special notes:

Enterprise partners can terminate their client's account if there's positive balance on the account.

# Request Configuration

# Request Endpoint

/api/Account/PostTermination

# 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
terdate DateTime Date when account should be terminated. terDate cannot be in the past.

# 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. Invalid Date

    reason: terDate must not be in the past

    {
        "Failed: Invalid date.";
    }
    
  4. Duplicated Request

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

    {
        "ERROR: Suspension request submitted already!";
    }
    
LastUpdated: 11/26/2020, 6:51:22 AM