@jogolabs/billing-sdk-v2 0.0.6 → 0.0.7

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.
@@ -3,14 +3,12 @@ import type { OpenAPIConfig } from './core/OpenAPI';
3
3
  import { CardsService } from './services/CardsService';
4
4
  import { HealthService } from './services/HealthService';
5
5
  import { PaymentsService } from './services/PaymentsService';
6
- import { SubscriptionsService } from './services/SubscriptionsService';
7
6
  import { WebhooksService } from './services/WebhooksService';
8
7
  type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
9
8
  export declare class Billing {
10
9
  readonly cards: CardsService;
11
10
  readonly health: HealthService;
12
11
  readonly payments: PaymentsService;
13
- readonly subscriptions: SubscriptionsService;
14
12
  readonly webhooks: WebhooksService;
15
13
  readonly request: BaseHttpRequest;
16
14
  constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
@@ -5,13 +5,11 @@ const AxiosHttpRequest_1 = require("./core/AxiosHttpRequest");
5
5
  const CardsService_1 = require("./services/CardsService");
6
6
  const HealthService_1 = require("./services/HealthService");
7
7
  const PaymentsService_1 = require("./services/PaymentsService");
8
- const SubscriptionsService_1 = require("./services/SubscriptionsService");
9
8
  const WebhooksService_1 = require("./services/WebhooksService");
10
9
  class Billing {
11
10
  cards;
12
11
  health;
13
12
  payments;
14
- subscriptions;
15
13
  webhooks;
16
14
  request;
17
15
  constructor(config, HttpRequest = AxiosHttpRequest_1.AxiosHttpRequest) {
@@ -29,7 +27,6 @@ class Billing {
29
27
  this.cards = new CardsService_1.CardsService(this.request);
30
28
  this.health = new HealthService_1.HealthService(this.request);
31
29
  this.payments = new PaymentsService_1.PaymentsService(this.request);
32
- this.subscriptions = new SubscriptionsService_1.SubscriptionsService(this.request);
33
30
  this.webhooks = new WebhooksService_1.WebhooksService(this.request);
34
31
  }
35
32
  }
@@ -21,5 +21,4 @@ export { $TokenizeCardRequest } from './schemas/$TokenizeCardRequest';
21
21
  export { CardsService } from './services/CardsService';
22
22
  export { HealthService } from './services/HealthService';
23
23
  export { PaymentsService } from './services/PaymentsService';
24
- export { SubscriptionsService } from './services/SubscriptionsService';
25
24
  export { WebhooksService } from './services/WebhooksService';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebhooksService = exports.SubscriptionsService = exports.PaymentsService = exports.HealthService = exports.CardsService = exports.$TokenizeCardRequest = exports.$Subscription = exports.$SavedCard = exports.$Error = exports.$CreateSubscriptionResponse = exports.$CreateSubscriptionRequest = exports.$ConsumeClassResponse = exports.Subscription = exports.SavedCard = exports.OpenAPI = exports.CancelError = exports.CancelablePromise = exports.BaseHttpRequest = exports.ApiError = exports.Billing = void 0;
3
+ exports.WebhooksService = exports.PaymentsService = exports.HealthService = exports.CardsService = exports.$TokenizeCardRequest = exports.$Subscription = exports.$SavedCard = exports.$Error = exports.$CreateSubscriptionResponse = exports.$CreateSubscriptionRequest = exports.$ConsumeClassResponse = exports.Subscription = exports.SavedCard = exports.OpenAPI = exports.CancelError = exports.CancelablePromise = exports.BaseHttpRequest = exports.ApiError = exports.Billing = void 0;
4
4
  /* generated using openapi-typescript-codegen -- do not edit */
5
5
  /* istanbul ignore file */
6
6
  /* tslint:disable */
@@ -40,7 +40,5 @@ var HealthService_1 = require("./services/HealthService");
40
40
  Object.defineProperty(exports, "HealthService", { enumerable: true, get: function () { return HealthService_1.HealthService; } });
41
41
  var PaymentsService_1 = require("./services/PaymentsService");
42
42
  Object.defineProperty(exports, "PaymentsService", { enumerable: true, get: function () { return PaymentsService_1.PaymentsService; } });
43
- var SubscriptionsService_1 = require("./services/SubscriptionsService");
44
- Object.defineProperty(exports, "SubscriptionsService", { enumerable: true, get: function () { return SubscriptionsService_1.SubscriptionsService; } });
45
43
  var WebhooksService_1 = require("./services/WebhooksService");
46
44
  Object.defineProperty(exports, "WebhooksService", { enumerable: true, get: function () { return WebhooksService_1.WebhooksService; } });
@@ -7,7 +7,10 @@ export type SavedCard = {
7
7
  spaceId?: string;
8
8
  provider?: SavedCard.provider;
9
9
  lastFour?: string;
10
- cardBrand?: string | null;
10
+ /**
11
+ * Card brand detected from provider or BIN range (VISA, MASTERCARD, AMEX, DISCOVER)
12
+ */
13
+ cardBrand?: string;
11
14
  expirationMonth?: number;
12
15
  expirationYear?: number;
13
16
  isDefault?: boolean;
@@ -18,7 +18,7 @@ export declare const $SavedCard: {
18
18
  };
19
19
  readonly cardBrand: {
20
20
  readonly type: "string";
21
- readonly isNullable: true;
21
+ readonly description: "Card brand detected from provider or BIN range (VISA, MASTERCARD, AMEX, DISCOVER)";
22
22
  };
23
23
  readonly expirationMonth: {
24
24
  readonly type: "number";
@@ -25,7 +25,7 @@ exports.$SavedCard = {
25
25
  },
26
26
  cardBrand: {
27
27
  type: 'string',
28
- isNullable: true,
28
+ description: `Card brand detected from provider or BIN range (VISA, MASTERCARD, AMEX, DISCOVER)`,
29
29
  },
30
30
  expirationMonth: {
31
31
  type: 'number',
@@ -22,6 +22,7 @@ class CardsService {
22
22
  errors: {
23
23
  400: `Datos de tarjeta inválidos`,
24
24
  401: `Token JWT ausente o inválido`,
25
+ 409: `Tarjeta duplicada (mismos últimos 4 dígitos, expiración y cliente)`,
25
26
  },
26
27
  });
27
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jogolabs/billing-sdk-v2",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Billing SDK v2 to Jogo Labs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,14 +8,12 @@ import { AxiosHttpRequest } from './core/AxiosHttpRequest';
8
8
  import { CardsService } from './services/CardsService';
9
9
  import { HealthService } from './services/HealthService';
10
10
  import { PaymentsService } from './services/PaymentsService';
11
- import { SubscriptionsService } from './services/SubscriptionsService';
12
11
  import { WebhooksService } from './services/WebhooksService';
13
12
  type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
14
13
  export class Billing {
15
14
  public readonly cards: CardsService;
16
15
  public readonly health: HealthService;
17
16
  public readonly payments: PaymentsService;
18
- public readonly subscriptions: SubscriptionsService;
19
17
  public readonly webhooks: WebhooksService;
20
18
  public readonly request: BaseHttpRequest;
21
19
  constructor(config?: Partial<OpenAPIConfig>, HttpRequest: HttpRequestConstructor = AxiosHttpRequest) {
@@ -33,7 +31,6 @@ export class Billing {
33
31
  this.cards = new CardsService(this.request);
34
32
  this.health = new HealthService(this.request);
35
33
  this.payments = new PaymentsService(this.request);
36
- this.subscriptions = new SubscriptionsService(this.request);
37
34
  this.webhooks = new WebhooksService(this.request);
38
35
  }
39
36
  }
@@ -29,5 +29,4 @@ export { $TokenizeCardRequest } from './schemas/$TokenizeCardRequest';
29
29
  export { CardsService } from './services/CardsService';
30
30
  export { HealthService } from './services/HealthService';
31
31
  export { PaymentsService } from './services/PaymentsService';
32
- export { SubscriptionsService } from './services/SubscriptionsService';
33
32
  export { WebhooksService } from './services/WebhooksService';
@@ -11,7 +11,10 @@ export type SavedCard = {
11
11
  spaceId?: string;
12
12
  provider?: SavedCard.provider;
13
13
  lastFour?: string;
14
- cardBrand?: string | null;
14
+ /**
15
+ * Card brand detected from provider or BIN range (VISA, MASTERCARD, AMEX, DISCOVER)
16
+ */
17
+ cardBrand?: string;
15
18
  expirationMonth?: number;
16
19
  expirationYear?: number;
17
20
  isDefault?: boolean;
@@ -22,7 +22,7 @@ export const $SavedCard = {
22
22
  },
23
23
  cardBrand: {
24
24
  type: 'string',
25
- isNullable: true,
25
+ description: `Card brand detected from provider or BIN range (VISA, MASTERCARD, AMEX, DISCOVER)`,
26
26
  },
27
27
  expirationMonth: {
28
28
  type: 'number',
@@ -28,6 +28,7 @@ export class CardsService {
28
28
  errors: {
29
29
  400: `Datos de tarjeta inválidos`,
30
30
  401: `Token JWT ausente o inválido`,
31
+ 409: `Tarjeta duplicada (mismos últimos 4 dígitos, expiración y cliente)`,
31
32
  },
32
33
  });
33
34
  }
@@ -1,185 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do not edit */
2
- /* istanbul ignore file */
3
- /* tslint:disable */
4
- /* eslint-disable */
5
- import type { ConsumeClassResponse } from '../models/ConsumeClassResponse';
6
- import type { CreateSubscriptionRequest } from '../models/CreateSubscriptionRequest';
7
- import type { CreateSubscriptionResponse } from '../models/CreateSubscriptionResponse';
8
- import type { Subscription } from '../models/Subscription';
9
- import type { CancelablePromise } from '../core/CancelablePromise';
10
- import type { BaseHttpRequest } from '../core/BaseHttpRequest';
11
- export class SubscriptionsService {
12
- constructor(public readonly httpRequest: BaseHttpRequest) {}
13
- /**
14
- * Crear y pagar una suscripción
15
- * Crea una suscripción para el cliente autenticado y ejecuta el cobro al proveedor de pago configurado para el negocio.
16
- * **Flujo con tarjeta guardada (recomendado para renovaciones):** Enviar `savedCardId` + `cvv`. Si el pago completa de inmediato, retorna `201` con la suscripción activa.
17
- * **Flujo con tarjeta nueva (3DS):** Enviar datos de tarjeta directamente. Wompi puede requerir autenticación 3DS, en cuyo caso retorna `202` con un `redirectUrl`. Redirigir al cliente a esa URL. La suscripción se activará automáticamente cuando Wompi envíe el webhook de confirmación.
18
- *
19
- * @returns CreateSubscriptionResponse Suscripción creada y activa (pago completado sin 3DS)
20
- * @throws ApiError
21
- */
22
- public postApiV1Subscriptions({
23
- requestBody,
24
- }: {
25
- requestBody: CreateSubscriptionRequest,
26
- }): CancelablePromise<CreateSubscriptionResponse> {
27
- return this.httpRequest.request({
28
- method: 'POST',
29
- url: '/api/v1/subscriptions',
30
- body: requestBody,
31
- mediaType: 'application/json',
32
- errors: {
33
- 400: `Datos de pago incompletos`,
34
- 401: `Token JWT ausente o inválido`,
35
- },
36
- });
37
- }
38
- /**
39
- * Mis suscripciones
40
- * Retorna todas las suscripciones del cliente autenticado.
41
- * @returns Subscription Lista de suscripciones del cliente
42
- * @throws ApiError
43
- */
44
- public getApiV1SubscriptionsMe(): CancelablePromise<Array<Subscription>> {
45
- return this.httpRequest.request({
46
- method: 'GET',
47
- url: '/api/v1/subscriptions/me',
48
- errors: {
49
- 401: `Token JWT ausente o inválido`,
50
- },
51
- });
52
- }
53
- /**
54
- * Suscripciones de un cliente (admin)
55
- * Retorna las suscripciones de un cliente específico. Uso interno/admin — el negocio puede consultar el estado de sus clientes.
56
- *
57
- * @returns Subscription Lista de suscripciones
58
- * @throws ApiError
59
- */
60
- public getApiV1SubscriptionsCustomer({
61
- customerId,
62
- }: {
63
- /**
64
- * ID del cliente en jogo-backend
65
- */
66
- customerId: string,
67
- }): CancelablePromise<Array<Subscription>> {
68
- return this.httpRequest.request({
69
- method: 'GET',
70
- url: '/api/v1/subscriptions/customer/{customerId}',
71
- path: {
72
- 'customerId': customerId,
73
- },
74
- errors: {
75
- 401: `Token JWT ausente o inválido`,
76
- },
77
- });
78
- }
79
- /**
80
- * Detalle de una suscripción
81
- * @returns Subscription Detalle de la suscripción
82
- * @throws ApiError
83
- */
84
- public getApiV1Subscriptions({
85
- id,
86
- }: {
87
- id: string,
88
- }): CancelablePromise<Subscription> {
89
- return this.httpRequest.request({
90
- method: 'GET',
91
- url: '/api/v1/subscriptions/{id}',
92
- path: {
93
- 'id': id,
94
- },
95
- errors: {
96
- 401: `Token JWT ausente o inválido`,
97
- 404: `Suscripción no encontrada`,
98
- },
99
- });
100
- }
101
- /**
102
- * Registrar uso de una clase
103
- * Descuenta una clase del saldo disponible en la suscripción. Solo aplica a suscripciones en estado `active` con clases restantes.
104
- *
105
- * @returns ConsumeClassResponse Clase registrada exitosamente
106
- * @throws ApiError
107
- */
108
- public postApiV1SubscriptionsConsume({
109
- id,
110
- }: {
111
- id: string,
112
- }): CancelablePromise<ConsumeClassResponse> {
113
- return this.httpRequest.request({
114
- method: 'POST',
115
- url: '/api/v1/subscriptions/{id}/consume',
116
- path: {
117
- 'id': id,
118
- },
119
- errors: {
120
- 400: `Sin clases disponibles o suscripción inactiva/vencida`,
121
- 401: `Token JWT ausente o inválido`,
122
- 403: `La suscripción no pertenece al cliente`,
123
- },
124
- });
125
- }
126
- /**
127
- * Cancelar suscripción
128
- * Cancela la suscripción y desactiva la renovación automática. El cliente mantiene acceso hasta la fecha de vencimiento.
129
- *
130
- * @returns Subscription Suscripción cancelada
131
- * @throws ApiError
132
- */
133
- public postApiV1SubscriptionsCancel({
134
- id,
135
- }: {
136
- id: string,
137
- }): CancelablePromise<Subscription> {
138
- return this.httpRequest.request({
139
- method: 'POST',
140
- url: '/api/v1/subscriptions/{id}/cancel',
141
- path: {
142
- 'id': id,
143
- },
144
- errors: {
145
- 401: `Token JWT ausente o inválido`,
146
- 403: `Forbidden`,
147
- 409: `La suscripción ya está cancelada`,
148
- },
149
- });
150
- }
151
- /**
152
- * Renovar suscripción manualmente
153
- * Renueva una suscripción usando la tarjeta guardada previamente. Requiere CVV por cumplimiento PCI. Si el pago requiere 3DS, retorna `redirectUrl` para completar la autenticación.
154
- *
155
- * @returns CreateSubscriptionResponse Suscripción renovada
156
- * @throws ApiError
157
- */
158
- public postApiV1SubscriptionsRenew({
159
- id,
160
- requestBody,
161
- }: {
162
- id: string,
163
- requestBody: {
164
- /**
165
- * CVV de la tarjeta guardada
166
- */
167
- cvv: string;
168
- },
169
- }): CancelablePromise<CreateSubscriptionResponse> {
170
- return this.httpRequest.request({
171
- method: 'POST',
172
- url: '/api/v1/subscriptions/{id}/renew',
173
- path: {
174
- 'id': id,
175
- },
176
- body: requestBody,
177
- mediaType: 'application/json',
178
- errors: {
179
- 400: `CVV requerido o no hay tarjeta guardada`,
180
- 401: `Token JWT ausente o inválido`,
181
- 403: `Forbidden`,
182
- },
183
- });
184
- }
185
- }