UNPKG

crisp-api

Version:

Crisp API wrapper for Node - official, maintained by Crisp

88 lines (87 loc) 2.91 kB
/************************************************************************** * IMPORTS ***************************************************************************/ import BaseResource from "./BaseResource"; /************************************************************************** * TYPES ***************************************************************************/ export type PlanSubscription = { id?: string; name?: string; price?: number; since?: string; trialing?: boolean; trial_end?: string; trial_end_date?: string; bill_period?: PlanSubscriptionBillPeriod; bill_valid_until?: string; active?: boolean; sandbox?: boolean; website?: PlanSubscriptionWebsite; coupon_redeemed?: boolean; card_id?: string; owner?: PlanSubscriptionOwner; }; export type PlanSubscriptionBillPeriod = "monthly" | "yearly"; export type PlanSubscriptionWebsite = { id?: string; name?: string; domain?: string; logo?: string; }; export type PlanSubscriptionOwner = { user_id?: string; email?: string; first_name?: string; last_name?: string; }; export type PlanSubscriptionCoupon = { code?: string; policy?: PlanSubscriptionCouponPolicy; redeem_limit?: number; expire_at?: string; }; export type PlanSubscriptionCouponPolicy = { rebate_percent?: number; trial_days?: number; }; /************************************************************************** * CLASSES ***************************************************************************/ /** * Crisp PlanSubscription Resource */ declare class PlanSubscriptionService extends BaseResource { /** * List All Active Plan Subscriptions */ listAllActiveSubscriptions(): Promise<PlanSubscription[]>; /** * Get Plan Subscription For A Website */ getPlanSubscriptionForWebsite(websiteID: string): Promise<PlanSubscription>; /** * Subscribe Website To Plan */ subscribeWebsiteToPlan(websiteID: string, planID: string): Promise<any>; /** * Unsubscribe Plan From Website */ unsubscribePlanFromWebsite(websiteID: string): Promise<any>; /** * Change Bill Period For Website Plan Subscription */ changeBillPeriodForWebsitePlanSubscription(websiteID: string, period: PlanSubscriptionBillPeriod): Promise<any>; /** * Check Coupon Availability For Website Plan Subscription */ checkCouponAvailabilityForWebsitePlanSubscription(websiteID: string, code: string): Promise<PlanSubscriptionCoupon>; /** * Redeem Coupon For Website Plan Subscription */ redeemCouponForWebsitePlanSubscription(websiteID: string, code: string): Promise<any>; } /************************************************************************** * EXPORTS ***************************************************************************/ export default PlanSubscriptionService;