/** * A single **subscription plan** returned by the MoneyHash API */ export interface SubscriptionPlan { /** Unique identifier of the plan. */ id?: string; /** Name of the plan. */ name?: string; /** Description of the plan. */ description?: string; /** The plan currency. */ currency?: string; /** Charge amount. */ amount?: number; /** One-time onboarding or setup fee. */ one_time_fee?: number; /** * How often the plan recurs. */ recurrency?: number; /** Cycle unit for `recurrency`. */ recurrency_unit?: string; /** Total number of recurring cycles. */ recurring_cycles?: number; /** Free-trial duration. */ trial_period?: number; /** Flat discount applied. */ discount_amount?: number; /** Percentage discount applied. */ discount_percentage?: number; /** Number of cycles for which the discount applies. */ discount_cycles?: number; /** Indicates whether the plan is live or not. */ is_live?: boolean; /** `true` if the customer already has an active subscription to this plan. */ already_subscribed?: boolean; /** Time when the plan was created. */ created?: string; } export function subscriptionPlanFromJson(jsonMap: { [key: string]: any; }): SubscriptionPlan { return { id: jsonMap.id, name: jsonMap.name, description: jsonMap.description, currency: jsonMap.currency, amount: jsonMap.amount, one_time_fee: jsonMap.one_time_fee, recurrency: jsonMap.recurrency, recurrency_unit: jsonMap.recurrency_unit, recurring_cycles: jsonMap.recurring_cycles, trial_period: jsonMap.trial_period, discount_amount: jsonMap.discount_amount, discount_percentage: jsonMap.discount_percentage, discount_cycles: jsonMap.discount_cycles, is_live: jsonMap.is_live, already_subscribed: jsonMap.already_subscribed, created: jsonMap.created, }; }