@parra/parra-js-sdk 0.2.30 → 0.2.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,23 @@
1
1
  import { HTTPClient } from "@parra/http-client";
2
+ export interface CreateCheckoutSessionRequestBody {
3
+ plan_id: string;
4
+ }
5
+ export interface CheckoutSession {
6
+ url: string;
7
+ }
8
+ export interface CreateCustomerRequestBody {
9
+ name: string;
10
+ tenant_id: string;
11
+ }
12
+ export interface Customer {
13
+ id: string;
14
+ created_at: string;
15
+ updated_at: string;
16
+ deleted_at?: string | null;
17
+ name: string;
18
+ tenant_id: string;
19
+ stripe_customer_id: string;
20
+ }
2
21
  export interface CreateTenantRequestBody {
3
22
  name: string;
4
23
  is_test: boolean;
@@ -292,6 +311,8 @@ declare class ParraAPI {
292
311
  constructor(http: HTTPClient, options: {
293
312
  baseUrl: string;
294
313
  });
314
+ createCustomer: (body?: CreateCustomerRequestBody | undefined) => Promise<Customer>;
315
+ createCheckoutSession: (body?: CreateCheckoutSessionRequestBody | undefined) => Promise<CheckoutSession>;
295
316
  getTenantById: (tenant_id: string) => Promise<Tenant>;
296
317
  createTenantForUserById: (user_id: string, body?: CreateTenantRequestBody | undefined) => Promise<Tenant>;
297
318
  getTenantsForUserById: (user_id: string) => Promise<TenantListResponse>;
package/dist/ParraAPI.js CHANGED
@@ -26,6 +26,24 @@ var ParraAPI = /** @class */ (function () {
26
26
  var _this = this;
27
27
  this.http = http;
28
28
  this.options = options;
29
+ this.createCustomer = function (body) {
30
+ return _this.http.execute(_this.options.baseUrl + "/v1/customers", {
31
+ method: "post",
32
+ body: JSON.stringify(body),
33
+ headers: {
34
+ "content-type": "application/json",
35
+ },
36
+ });
37
+ };
38
+ this.createCheckoutSession = function (body) {
39
+ return _this.http.execute(_this.options.baseUrl + "/v1/checkout/sessions", {
40
+ method: "post",
41
+ body: JSON.stringify(body),
42
+ headers: {
43
+ "content-type": "application/json",
44
+ },
45
+ });
46
+ };
29
47
  this.getTenantById = function (tenant_id) {
30
48
  return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id, {
31
49
  method: "get",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.30",
3
+ "version": "0.2.32",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",