smc-hub
Version:
CoCalc: Backend webserver component
47 lines (46 loc) • 1.91 kB
TypeScript
import { PostgreSQL } from "../postgres/types";
import Stripe from "stripe";
interface HubClient {
account_id: string;
dbg: (f: string) => Function;
database: PostgreSQL;
push_to_client: Function;
error_to_client: Function;
assert_user_is_in_group: Function;
}
declare type Message = any;
export declare class StripeClient {
private client;
conn: Stripe;
private stripe_customer_id?;
constructor(client: HubClient);
private dbg;
private get_customer_id;
need_customer_id(): Promise<string>;
private stripe_api_pager_options;
private get_customer;
handle_mesg(mesg: Message): Promise<void>;
mesg_get_customer(_mesg: Message): Promise<Message>;
mesg_create_source(mesg: Message): Promise<void>;
private create_new_stripe_customer_from_card_token;
private add_card_to_existing_stripe_customer;
mesg_delete_source(mesg: Message): Promise<void>;
mesg_set_default_source(mesg: Message): Promise<void>;
update_database(): Promise<any>;
mesg_update_source(mesg: Message): Promise<void>;
sales_tax(customer_id: string): Promise<number>;
mesg_create_subscription(mesg: Message): Promise<void>;
mesg_cancel_subscription(mesg: Message): Promise<void>;
mesg_update_subscription(mesg: Message): Promise<void>;
mesg_get_subscriptions(mesg: Message): Promise<Message>;
mesg_get_coupon(mesg: Message): Promise<Message>;
private validate_coupon;
mesg_get_charges(mesg: Message): Promise<Message>;
mesg_get_invoices(mesg: Message): Promise<Message>;
mesg_admin_create_invoice_item(mesg: Message): Promise<void>;
mesg_get_available_upgrades(_mesg: Message): Promise<Message>;
mesg_remove_all_upgrades(mesg: Message): Promise<void>;
mesg_sync_site_license_subscriptions(): Promise<void>;
}
export declare function stripe_name(first_name: any, last_name: any): string;
export {};