@vrplatform/hyperline-client 1.0.14 → 1.0.15

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.
package/src/client.ts CHANGED
@@ -260,6 +260,17 @@ export class HyperlineAPI {
260
260
  }
261
261
 
262
262
  async updateSubscription(
263
+ id: string,
264
+ data: NonNullable<
265
+ paths['/v2/subscriptions/{id}']['put']['requestBody']
266
+ >['content']['application/json']
267
+ ) {
268
+ return await this.fetch<
269
+ paths['/v2/subscriptions/{id}']['put']['responses'][200]['content']['application/json']
270
+ >(`/v2/subscriptions/${id}`, { method: 'PUT' }, data);
271
+ }
272
+
273
+ async createSubscriptionUpdate(
263
274
  id: string,
264
275
  data: NonNullable<
265
276
  paths['/v1/subscriptions/{id}/update']['post']['requestBody']
@@ -342,10 +353,24 @@ export class HyperlineAPI {
342
353
  );
343
354
  }
344
355
 
345
- async getInvoicesByCustomerId(id: string) {
356
+ async getInvoicesByCustomerId(
357
+ id: string,
358
+ filters?: Partial<operations['getInvoices']['parameters']['query']>
359
+ ) {
360
+ const queryParams = new URLSearchParams();
361
+ queryParams.append('customerId__equals', id);
362
+
363
+ if (filters) {
364
+ Object.entries(filters).forEach(([key, value]) => {
365
+ if (value !== undefined && value !== null) {
366
+ queryParams.append(key, value.toString());
367
+ }
368
+ });
369
+ }
370
+
346
371
  return await this.fetch<
347
372
  paths['/v1/invoices']['get']['responses'][200]['content']['application/json']
348
- >(`/v1/invoices?customerId__equals=${id}`);
373
+ >(`/v1/invoices?${queryParams.toString()}`);
349
374
  }
350
375
 
351
376
  async getInvoiceDownload(id: string) {
@@ -378,6 +403,12 @@ export class HyperlineAPI {
378
403
 
379
404
  // OTHERS
380
405
 
406
+ async getPaymentMethod(customerId: string, paymentMethodId: string) {
407
+ return await this.fetch<
408
+ paths['/v1/customers/{id}/payment-methods/{paymentMethodId}']['get']['responses'][200]['content']['application/json']
409
+ >(`/v1/customers/${customerId}/payment-methods/${paymentMethodId}`);
410
+ }
411
+
381
412
  async createBillableEvent(data: CreateBillableEvent[]) {
382
413
  if (!data.length) return { events_created: [] };
383
414
 
package/src/const.ts CHANGED
@@ -29,6 +29,7 @@ export const HYPERLINE_DEFAULT_PLAN_ID = 'plan_Dyb5P0ICZ6HsIT';
29
29
  export const HYPERLINE_DEFAULT_DEV_PLAN_ID = 'plan_UTCVXFQnKD0oMS';
30
30
  export const HYPERLINE_DEFAULT_PLAN_NAME = 'All-in-One VRP Subscription';
31
31
  export const HYPERLINE_DEFAULT_PRODUCT_ID = 'itm_9NU7ffT14I4ris';
32
+ export const HYPERLINE_DEFAULT_MIN_AMOUNT = 12500;
32
33
 
33
34
  export const HYPERLINE_PARTNER_PLAN_ID = 'plan_vkYJcCz7z0XD0N';
34
35
  export const HYPERLINE_PARTNER_DEV_PLAN_ID = 'plan_8qtj8T4j0W3oiS';
@@ -39,6 +40,7 @@ export const GL_HYPERLINE_DEFAULT_PLAN_ID = 'plan_JXviWSpU5yuokD';
39
40
  export const GL_HYPERLINE_DEFAULT_DEV_PLAN_ID = 'plan_Nnozk8_TfYqTkj';
40
41
  export const GL_HYPERLINE_DEFAULT_PLAN_NAME = 'VRTrust Subscription';
41
42
  export const GL_HYPERLINE_DEFAULT_PRODUCT_ID = 'itm_NRTRBQ0fc8bFGW';
43
+ export const GL_HYPERLINE_DEFAULT_MIN_AMOUNT = 25000;
42
44
 
43
45
  export const GL_HYPERLINE_PARTNER_PLAN_ID = 'plan_vyxckdvUi8X_mr';
44
46
  export const GL_HYPERLINE_PARTNER_DEV_PLAN_ID = 'plan_CVXQ47ErOWANhJ';
@@ -71,7 +73,7 @@ export const WEBHOOKS = {
71
73
 
72
74
  export const CURRENCY_MAP: Record<
73
75
  currency_enum,
74
- HyperlineEntities['Currency'] | undefined
76
+ HyperlineEntities['Invoice']['currency'] | undefined
75
77
  > = {
76
78
  aed: 'AED',
77
79
  afn: 'AFN',