import { EType } from "le-coffre-resources/dist/Admin/Subscription"; import BaseAdmin from "../BaseAdmin"; export interface IPostStripeParams { type: EType; nb_seats: number; } export type IPostStripeResponse = { url: string; }; export type IGetClientPortalSessionResponse = { url: string; }; export default class Stripe extends BaseAdmin { private static instance: Stripe; private readonly baseURl = this.namespaceUrl.concat("/stripe"); private constructor() { super(); } public static getInstance() { if (!this.instance) { return new Stripe(); } else { return this.instance; } } public async post(body: IPostStripeParams) { const url = new URL(this.baseURl); try { console.log(body); return await this.postRequest(url, body as any); } catch (err) { this.onError(err); return Promise.reject(err); } } public async getClientPortalSession(stripe_subscription_id: string) { console.log(stripe_subscription_id); const url = new URL(this.baseURl.concat(`/${stripe_subscription_id}`)); try { return await this.getRequest(url); } catch (err) { this.onError(err); return Promise.reject(err); } } }