import { ChargebeePortalSession } from './types/Chargebee'; import ApiClient from './ApiClient'; import { GenerateChargebeePortalRequest, GenerateChargebeePortalResponse, } from './types/Chargebee'; import urls from './urls'; export default class ChargebeeClient { async generateChargebeePortal( this: ApiClient, ): Promise { const { portal_session: portalSession } = await this.requestProtected< GenerateChargebeePortalRequest, GenerateChargebeePortalResponse >({ method: 'POST', url: urls.generateChargebeePortal(), // redirect_url must use HTTPS and port 443, 80, 8443, or 8080 // to test this in development try `HTTPS=true PORT=8080 yarn start` body: { redirect_url: window.location.href }, }); return portalSession; } }