@jogolabs/billing-sdk-v2 0.0.6 → 0.0.8

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,15 +3,15 @@ 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';
7
+ import { WompiService } from './services/WompiService';
8
8
  type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
9
9
  export declare class Billing {
10
10
  readonly cards: CardsService;
11
11
  readonly health: HealthService;
12
12
  readonly payments: PaymentsService;
13
- readonly subscriptions: SubscriptionsService;
14
13
  readonly webhooks: WebhooksService;
14
+ readonly wompi: WompiService;
15
15
  readonly request: BaseHttpRequest;
16
16
  constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
17
17
  }
@@ -5,14 +5,14 @@ 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");
9
+ const WompiService_1 = require("./services/WompiService");
10
10
  class Billing {
11
11
  cards;
12
12
  health;
13
13
  payments;
14
- subscriptions;
15
14
  webhooks;
15
+ wompi;
16
16
  request;
17
17
  constructor(config, HttpRequest = AxiosHttpRequest_1.AxiosHttpRequest) {
18
18
  this.request = new HttpRequest({
@@ -29,8 +29,8 @@ class Billing {
29
29
  this.cards = new CardsService_1.CardsService(this.request);
30
30
  this.health = new HealthService_1.HealthService(this.request);
31
31
  this.payments = new PaymentsService_1.PaymentsService(this.request);
32
- this.subscriptions = new SubscriptionsService_1.SubscriptionsService(this.request);
33
32
  this.webhooks = new WebhooksService_1.WebhooksService(this.request);
33
+ this.wompi = new WompiService_1.WompiService(this.request);
34
34
  }
35
35
  }
36
36
  exports.Billing = Billing;
@@ -21,5 +21,5 @@ 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';
25
+ export { WompiService } from './services/WompiService';
@@ -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.WompiService = 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,7 @@ 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; } });
45
+ var WompiService_1 = require("./services/WompiService");
46
+ Object.defineProperty(exports, "WompiService", { enumerable: true, get: function () { return WompiService_1.WompiService; } });
@@ -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
  }
@@ -0,0 +1,31 @@
1
+ import type { CancelablePromise } from '../core/CancelablePromise';
2
+ import type { BaseHttpRequest } from '../core/BaseHttpRequest';
3
+ export declare class WompiService {
4
+ readonly httpRequest: BaseHttpRequest;
5
+ constructor(httpRequest: BaseHttpRequest);
6
+ /**
7
+ * Verificar credenciales de Wompi
8
+ * Verifica que el `app_id` y `api_secret` proporcionados sean válidos consultando el endpoint `/Aplicativo` de Wompi. Útil antes de guardar o actualizar un PaymentsProvider para confirmar que las credenciales son correctas.
9
+ *
10
+ * @returns any Credenciales válidas
11
+ * @throws ApiError
12
+ */
13
+ postApiV1WompiVerifyAccess({ requestBody, }: {
14
+ requestBody: {
15
+ /**
16
+ * Application ID de Wompi
17
+ */
18
+ app_id: string;
19
+ /**
20
+ * API secret de Wompi
21
+ */
22
+ api_secret: string;
23
+ };
24
+ }): CancelablePromise<{
25
+ valid?: boolean;
26
+ /**
27
+ * Respuesta de Wompi /Aplicativo
28
+ */
29
+ data?: Record<string, any>;
30
+ }>;
31
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WompiService = void 0;
4
+ class WompiService {
5
+ httpRequest;
6
+ constructor(httpRequest) {
7
+ this.httpRequest = httpRequest;
8
+ }
9
+ /**
10
+ * Verificar credenciales de Wompi
11
+ * Verifica que el `app_id` y `api_secret` proporcionados sean válidos consultando el endpoint `/Aplicativo` de Wompi. Útil antes de guardar o actualizar un PaymentsProvider para confirmar que las credenciales son correctas.
12
+ *
13
+ * @returns any Credenciales válidas
14
+ * @throws ApiError
15
+ */
16
+ postApiV1WompiVerifyAccess({ requestBody, }) {
17
+ return this.httpRequest.request({
18
+ method: 'POST',
19
+ url: '/api/v1/wompi/verify-access',
20
+ body: requestBody,
21
+ mediaType: 'application/json',
22
+ errors: {
23
+ 400: `Faltan app_id o api_secret`,
24
+ 401: `Token JWT ausente o inválido`,
25
+ 422: `Credenciales inválidas según Wompi`,
26
+ },
27
+ });
28
+ }
29
+ }
30
+ exports.WompiService = WompiService;
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.8",
4
4
  "description": "Billing SDK v2 to Jogo Labs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,15 +8,15 @@ 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';
12
+ import { WompiService } from './services/WompiService';
13
13
  type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
14
14
  export class Billing {
15
15
  public readonly cards: CardsService;
16
16
  public readonly health: HealthService;
17
17
  public readonly payments: PaymentsService;
18
- public readonly subscriptions: SubscriptionsService;
19
18
  public readonly webhooks: WebhooksService;
19
+ public readonly wompi: WompiService;
20
20
  public readonly request: BaseHttpRequest;
21
21
  constructor(config?: Partial<OpenAPIConfig>, HttpRequest: HttpRequestConstructor = AxiosHttpRequest) {
22
22
  this.request = new HttpRequest({
@@ -33,8 +33,8 @@ export class Billing {
33
33
  this.cards = new CardsService(this.request);
34
34
  this.health = new HealthService(this.request);
35
35
  this.payments = new PaymentsService(this.request);
36
- this.subscriptions = new SubscriptionsService(this.request);
37
36
  this.webhooks = new WebhooksService(this.request);
37
+ this.wompi = new WompiService(this.request);
38
38
  }
39
39
  }
40
40
 
@@ -29,5 +29,5 @@ 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';
33
+ export { WompiService } from './services/WompiService';
@@ -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
  }
@@ -0,0 +1,48 @@
1
+ /* generated using openapi-typescript-codegen -- do not edit */
2
+ /* istanbul ignore file */
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ import type { CancelablePromise } from '../core/CancelablePromise';
6
+ import type { BaseHttpRequest } from '../core/BaseHttpRequest';
7
+ export class WompiService {
8
+ constructor(public readonly httpRequest: BaseHttpRequest) {}
9
+ /**
10
+ * Verificar credenciales de Wompi
11
+ * Verifica que el `app_id` y `api_secret` proporcionados sean válidos consultando el endpoint `/Aplicativo` de Wompi. Útil antes de guardar o actualizar un PaymentsProvider para confirmar que las credenciales son correctas.
12
+ *
13
+ * @returns any Credenciales válidas
14
+ * @throws ApiError
15
+ */
16
+ public postApiV1WompiVerifyAccess({
17
+ requestBody,
18
+ }: {
19
+ requestBody: {
20
+ /**
21
+ * Application ID de Wompi
22
+ */
23
+ app_id: string;
24
+ /**
25
+ * API secret de Wompi
26
+ */
27
+ api_secret: string;
28
+ },
29
+ }): CancelablePromise<{
30
+ valid?: boolean;
31
+ /**
32
+ * Respuesta de Wompi /Aplicativo
33
+ */
34
+ data?: Record<string, any>;
35
+ }> {
36
+ return this.httpRequest.request({
37
+ method: 'POST',
38
+ url: '/api/v1/wompi/verify-access',
39
+ body: requestBody,
40
+ mediaType: 'application/json',
41
+ errors: {
42
+ 400: `Faltan app_id o api_secret`,
43
+ 401: `Token JWT ausente o inválido`,
44
+ 422: `Credenciales inválidas según Wompi`,
45
+ },
46
+ });
47
+ }
48
+ }
@@ -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
- }