/** * @module MobilePlan * @overview Defines the `MobilePlan` class. * * @author Animesh Mishra * @copyright © Animesh Ltd. All Rights Reserved. */ /** * A `MobilePlan` is a prepaid mobile plan that user may opt for * instead of a straight up account top-up. * * Plans are operator and circle-specific and are requested on the * customer's behalf before each recharge request. Plans are never * stored in our databases. */ export class MobilePlan { /** Plan amount. Could be in fraction */ public amount: number /** Plan type. E.g. Roaming or 4G or Special */ public type: string /** Talktime in terms of Rupees */ public talktime: number /** In number of days */ public validity: string /** Any plan-specific details or offers. */ public details: string public constructor(json: any) { this.amount = Number(json.amount) this.type = json.plan_type || json.type this.talktime = Number(json.talktime) this.validity = json.validity this.details = json.remark || json.details } public static InitFromList(plans: Array): Array { let mobilePlans = Array() for(var plan of plans) { mobilePlans.push(new MobilePlan(plan)) } return mobilePlans } } /** * Response set by Rocket in Pocket API when requested a list of all operator-specific, * circle-specific plans. The result is an array of `RocketPlan`. */ interface FindPlanResponse { amount: string, plan_type?: string, remark: string, talktime: string, validity: string }