@jogolabs/billing-sdk-v2 0.0.1

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.
Files changed (150) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +18 -0
  3. package/dist/billing/src/__generated__/Billing.d.ts +20 -0
  4. package/dist/billing/src/__generated__/Billing.js +39 -0
  5. package/dist/billing/src/__generated__/core/ApiError.d.ts +10 -0
  6. package/dist/billing/src/__generated__/core/ApiError.js +20 -0
  7. package/dist/billing/src/__generated__/core/ApiRequestOptions.d.ts +13 -0
  8. package/dist/billing/src/__generated__/core/ApiRequestOptions.js +2 -0
  9. package/dist/billing/src/__generated__/core/ApiResult.d.ts +7 -0
  10. package/dist/billing/src/__generated__/core/ApiResult.js +2 -0
  11. package/dist/billing/src/__generated__/core/AxiosHttpRequest.d.ts +14 -0
  12. package/dist/billing/src/__generated__/core/AxiosHttpRequest.js +20 -0
  13. package/dist/billing/src/__generated__/core/BaseHttpRequest.d.ts +8 -0
  14. package/dist/billing/src/__generated__/core/BaseHttpRequest.js +10 -0
  15. package/dist/billing/src/__generated__/core/CancelablePromise.d.ts +20 -0
  16. package/dist/billing/src/__generated__/core/CancelablePromise.js +104 -0
  17. package/dist/billing/src/__generated__/core/OpenAPI.d.ts +16 -0
  18. package/dist/billing/src/__generated__/core/OpenAPI.js +14 -0
  19. package/dist/billing/src/__generated__/core/request.d.ts +34 -0
  20. package/dist/billing/src/__generated__/core/request.js +292 -0
  21. package/dist/billing/src/__generated__/index.d.ts +42 -0
  22. package/dist/billing/src/__generated__/index.js +74 -0
  23. package/dist/billing/src/__generated__/models/ConsumeClassResponse.d.ts +5 -0
  24. package/dist/billing/src/__generated__/models/ConsumeClassResponse.js +2 -0
  25. package/dist/billing/src/__generated__/models/CreateMerchantRequest.d.ts +23 -0
  26. package/dist/billing/src/__generated__/models/CreateMerchantRequest.js +15 -0
  27. package/dist/billing/src/__generated__/models/CreatePackageRequest.d.ts +8 -0
  28. package/dist/billing/src/__generated__/models/CreatePackageRequest.js +2 -0
  29. package/dist/billing/src/__generated__/models/CreateSubscriptionRequest.d.ts +25 -0
  30. package/dist/billing/src/__generated__/models/CreateSubscriptionRequest.js +2 -0
  31. package/dist/billing/src/__generated__/models/CreateSubscriptionResponse.d.ts +8 -0
  32. package/dist/billing/src/__generated__/models/CreateSubscriptionResponse.js +2 -0
  33. package/dist/billing/src/__generated__/models/Error.d.ts +3 -0
  34. package/dist/billing/src/__generated__/models/Error.js +2 -0
  35. package/dist/billing/src/__generated__/models/Merchant.d.ts +20 -0
  36. package/dist/billing/src/__generated__/models/Merchant.js +10 -0
  37. package/dist/billing/src/__generated__/models/MerchantProviderConfig.d.ts +15 -0
  38. package/dist/billing/src/__generated__/models/MerchantProviderConfig.js +11 -0
  39. package/dist/billing/src/__generated__/models/Package.d.ts +14 -0
  40. package/dist/billing/src/__generated__/models/Package.js +2 -0
  41. package/dist/billing/src/__generated__/models/Payment.d.ts +32 -0
  42. package/dist/billing/src/__generated__/models/Payment.js +22 -0
  43. package/dist/billing/src/__generated__/models/SavedCard.d.ts +18 -0
  44. package/dist/billing/src/__generated__/models/SavedCard.js +10 -0
  45. package/dist/billing/src/__generated__/models/Subscription.d.ts +33 -0
  46. package/dist/billing/src/__generated__/models/Subscription.js +14 -0
  47. package/dist/billing/src/__generated__/models/TokenizeCardRequest.d.ts +8 -0
  48. package/dist/billing/src/__generated__/models/TokenizeCardRequest.js +2 -0
  49. package/dist/billing/src/__generated__/models/UpdateMerchantRequest.d.ts +16 -0
  50. package/dist/billing/src/__generated__/models/UpdateMerchantRequest.js +11 -0
  51. package/dist/billing/src/__generated__/models/UpdatePackageRequest.d.ts +9 -0
  52. package/dist/billing/src/__generated__/models/UpdatePackageRequest.js +2 -0
  53. package/dist/billing/src/__generated__/schemas/$ConsumeClassResponse.d.ts +10 -0
  54. package/dist/billing/src/__generated__/schemas/$ConsumeClassResponse.js +17 -0
  55. package/dist/billing/src/__generated__/schemas/$CreateMerchantRequest.d.ts +39 -0
  56. package/dist/billing/src/__generated__/schemas/$CreateMerchantRequest.js +46 -0
  57. package/dist/billing/src/__generated__/schemas/$CreatePackageRequest.d.ts +28 -0
  58. package/dist/billing/src/__generated__/schemas/$CreatePackageRequest.js +35 -0
  59. package/dist/billing/src/__generated__/schemas/$CreateSubscriptionRequest.d.ts +57 -0
  60. package/dist/billing/src/__generated__/schemas/$CreateSubscriptionRequest.js +64 -0
  61. package/dist/billing/src/__generated__/schemas/$CreateSubscriptionResponse.d.ts +13 -0
  62. package/dist/billing/src/__generated__/schemas/$CreateSubscriptionResponse.js +20 -0
  63. package/dist/billing/src/__generated__/schemas/$Error.d.ts +7 -0
  64. package/dist/billing/src/__generated__/schemas/$Error.js +14 -0
  65. package/dist/billing/src/__generated__/schemas/$Merchant.d.ts +35 -0
  66. package/dist/billing/src/__generated__/schemas/$Merchant.js +42 -0
  67. package/dist/billing/src/__generated__/schemas/$MerchantProviderConfig.d.ts +19 -0
  68. package/dist/billing/src/__generated__/schemas/$MerchantProviderConfig.js +26 -0
  69. package/dist/billing/src/__generated__/schemas/$Package.d.ts +43 -0
  70. package/dist/billing/src/__generated__/schemas/$Package.js +50 -0
  71. package/dist/billing/src/__generated__/schemas/$Payment.d.ts +43 -0
  72. package/dist/billing/src/__generated__/schemas/$Payment.js +50 -0
  73. package/dist/billing/src/__generated__/schemas/$SavedCard.d.ts +39 -0
  74. package/dist/billing/src/__generated__/schemas/$SavedCard.js +46 -0
  75. package/dist/billing/src/__generated__/schemas/$Subscription.d.ts +63 -0
  76. package/dist/billing/src/__generated__/schemas/$Subscription.js +70 -0
  77. package/dist/billing/src/__generated__/schemas/$TokenizeCardRequest.d.ts +29 -0
  78. package/dist/billing/src/__generated__/schemas/$TokenizeCardRequest.js +36 -0
  79. package/dist/billing/src/__generated__/schemas/$UpdateMerchantRequest.d.ts +31 -0
  80. package/dist/billing/src/__generated__/schemas/$UpdateMerchantRequest.js +38 -0
  81. package/dist/billing/src/__generated__/schemas/$UpdatePackageRequest.d.ts +27 -0
  82. package/dist/billing/src/__generated__/schemas/$UpdatePackageRequest.js +34 -0
  83. package/dist/billing/src/__generated__/services/CardsService.d.ts +54 -0
  84. package/dist/billing/src/__generated__/services/CardsService.js +89 -0
  85. package/dist/billing/src/__generated__/services/HealthService.d.ts +16 -0
  86. package/dist/billing/src/__generated__/services/HealthService.js +22 -0
  87. package/dist/billing/src/__generated__/services/MerchantsService.d.ts +43 -0
  88. package/dist/billing/src/__generated__/services/MerchantsService.js +71 -0
  89. package/dist/billing/src/__generated__/services/PackagesService.d.ts +66 -0
  90. package/dist/billing/src/__generated__/services/PackagesService.js +110 -0
  91. package/dist/billing/src/__generated__/services/PaymentsService.d.ts +53 -0
  92. package/dist/billing/src/__generated__/services/PaymentsService.js +66 -0
  93. package/dist/billing/src/__generated__/services/SubscriptionsService.d.ts +86 -0
  94. package/dist/billing/src/__generated__/services/SubscriptionsService.js +148 -0
  95. package/dist/billing/src/index.d.ts +1 -0
  96. package/dist/billing/src/index.js +17 -0
  97. package/dist/index.d.ts +11 -0
  98. package/dist/index.js +54 -0
  99. package/package.json +36 -0
  100. package/scripts/generate-api-sdk.js +86 -0
  101. package/scripts/publish.js +72 -0
  102. package/src/billing/src/__generated__/Billing.ts +43 -0
  103. package/src/billing/src/__generated__/core/ApiError.ts +25 -0
  104. package/src/billing/src/__generated__/core/ApiRequestOptions.ts +17 -0
  105. package/src/billing/src/__generated__/core/ApiResult.ts +11 -0
  106. package/src/billing/src/__generated__/core/AxiosHttpRequest.ts +26 -0
  107. package/src/billing/src/__generated__/core/BaseHttpRequest.ts +14 -0
  108. package/src/billing/src/__generated__/core/CancelablePromise.ts +131 -0
  109. package/src/billing/src/__generated__/core/OpenAPI.ts +32 -0
  110. package/src/billing/src/__generated__/core/request.ts +323 -0
  111. package/src/billing/src/__generated__/index.ts +50 -0
  112. package/src/billing/src/__generated__/models/ConsumeClassResponse.ts +10 -0
  113. package/src/billing/src/__generated__/models/CreateMerchantRequest.ts +28 -0
  114. package/src/billing/src/__generated__/models/CreatePackageRequest.ts +13 -0
  115. package/src/billing/src/__generated__/models/CreateSubscriptionRequest.ts +30 -0
  116. package/src/billing/src/__generated__/models/CreateSubscriptionResponse.ts +13 -0
  117. package/src/billing/src/__generated__/models/Error.ts +8 -0
  118. package/src/billing/src/__generated__/models/Merchant.ts +25 -0
  119. package/src/billing/src/__generated__/models/MerchantProviderConfig.ts +20 -0
  120. package/src/billing/src/__generated__/models/Package.ts +19 -0
  121. package/src/billing/src/__generated__/models/Payment.ts +37 -0
  122. package/src/billing/src/__generated__/models/SavedCard.ts +23 -0
  123. package/src/billing/src/__generated__/models/Subscription.ts +38 -0
  124. package/src/billing/src/__generated__/models/TokenizeCardRequest.ts +13 -0
  125. package/src/billing/src/__generated__/models/UpdateMerchantRequest.ts +21 -0
  126. package/src/billing/src/__generated__/models/UpdatePackageRequest.ts +14 -0
  127. package/src/billing/src/__generated__/schemas/$ConsumeClassResponse.ts +14 -0
  128. package/src/billing/src/__generated__/schemas/$CreateMerchantRequest.ts +43 -0
  129. package/src/billing/src/__generated__/schemas/$CreatePackageRequest.ts +32 -0
  130. package/src/billing/src/__generated__/schemas/$CreateSubscriptionRequest.ts +61 -0
  131. package/src/billing/src/__generated__/schemas/$CreateSubscriptionResponse.ts +17 -0
  132. package/src/billing/src/__generated__/schemas/$Error.ts +11 -0
  133. package/src/billing/src/__generated__/schemas/$Merchant.ts +39 -0
  134. package/src/billing/src/__generated__/schemas/$MerchantProviderConfig.ts +23 -0
  135. package/src/billing/src/__generated__/schemas/$Package.ts +47 -0
  136. package/src/billing/src/__generated__/schemas/$Payment.ts +47 -0
  137. package/src/billing/src/__generated__/schemas/$SavedCard.ts +43 -0
  138. package/src/billing/src/__generated__/schemas/$Subscription.ts +67 -0
  139. package/src/billing/src/__generated__/schemas/$TokenizeCardRequest.ts +33 -0
  140. package/src/billing/src/__generated__/schemas/$UpdateMerchantRequest.ts +35 -0
  141. package/src/billing/src/__generated__/schemas/$UpdatePackageRequest.ts +31 -0
  142. package/src/billing/src/__generated__/services/CardsService.ts +115 -0
  143. package/src/billing/src/__generated__/services/HealthService.ts +24 -0
  144. package/src/billing/src/__generated__/services/MerchantsService.ts +90 -0
  145. package/src/billing/src/__generated__/services/PackagesService.ts +150 -0
  146. package/src/billing/src/__generated__/services/PaymentsService.ts +96 -0
  147. package/src/billing/src/__generated__/services/SubscriptionsService.ts +185 -0
  148. package/src/billing/src/index.ts +1 -0
  149. package/src/index.ts +49 -0
  150. package/tsconfig.json +18 -0
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CardsService = void 0;
4
+ class CardsService {
5
+ httpRequest;
6
+ constructor(httpRequest) {
7
+ this.httpRequest = httpRequest;
8
+ }
9
+ /**
10
+ * Tokenizar y guardar una tarjeta
11
+ * Envía los datos de la tarjeta al proveedor de pago configurado para el negocio, obtiene un token seguro y lo guarda asociado al cliente autenticado. Los datos de la tarjeta **nunca se almacenan** en la base de datos de este servicio.
12
+ *
13
+ * @returns SavedCard Tarjeta tokenizada y guardada exitosamente
14
+ * @throws ApiError
15
+ */
16
+ postApiV1CardsTokenize({ requestBody, }) {
17
+ return this.httpRequest.request({
18
+ method: 'POST',
19
+ url: '/api/v1/cards/tokenize',
20
+ body: requestBody,
21
+ mediaType: 'application/json',
22
+ errors: {
23
+ 400: `Datos de tarjeta inválidos`,
24
+ 401: `Token JWT ausente o inválido`,
25
+ },
26
+ });
27
+ }
28
+ /**
29
+ * Listar tarjetas guardadas del cliente
30
+ * Retorna las tarjetas tokenizadas del cliente autenticado para un negocio específico.
31
+ * @returns SavedCard Lista de tarjetas guardadas
32
+ * @throws ApiError
33
+ */
34
+ getApiV1Cards({ merchantId, }) {
35
+ return this.httpRequest.request({
36
+ method: 'GET',
37
+ url: '/api/v1/cards',
38
+ query: {
39
+ 'merchantId': merchantId,
40
+ },
41
+ errors: {
42
+ 400: `merchantId requerido`,
43
+ 401: `Token JWT ausente o inválido`,
44
+ },
45
+ });
46
+ }
47
+ /**
48
+ * Establecer tarjeta predeterminada
49
+ * Marca una tarjeta como predeterminada para renovaciones automáticas. Solo puede haber una tarjeta predeterminada por cliente + negocio.
50
+ *
51
+ * @returns any Tarjeta predeterminada actualizada
52
+ * @throws ApiError
53
+ */
54
+ patchApiV1CardsDefault({ id, requestBody, }) {
55
+ return this.httpRequest.request({
56
+ method: 'PATCH',
57
+ url: '/api/v1/cards/{id}/default',
58
+ path: {
59
+ 'id': id,
60
+ },
61
+ body: requestBody,
62
+ mediaType: 'application/json',
63
+ errors: {
64
+ 401: `Token JWT ausente o inválido`,
65
+ 404: `Tarjeta no encontrada`,
66
+ },
67
+ });
68
+ }
69
+ /**
70
+ * Eliminar tarjeta guardada
71
+ * Desactiva la tarjeta guardada (no se elimina físicamente de la base de datos).
72
+ * @returns void
73
+ * @throws ApiError
74
+ */
75
+ deleteApiV1Cards({ id, }) {
76
+ return this.httpRequest.request({
77
+ method: 'DELETE',
78
+ url: '/api/v1/cards/{id}',
79
+ path: {
80
+ 'id': id,
81
+ },
82
+ errors: {
83
+ 401: `Token JWT ausente o inválido`,
84
+ 403: `La tarjeta no pertenece al cliente`,
85
+ },
86
+ });
87
+ }
88
+ }
89
+ exports.CardsService = CardsService;
@@ -0,0 +1,16 @@
1
+ import type { CancelablePromise } from '../core/CancelablePromise';
2
+ import type { BaseHttpRequest } from '../core/BaseHttpRequest';
3
+ export declare class HealthService {
4
+ readonly httpRequest: BaseHttpRequest;
5
+ constructor(httpRequest: BaseHttpRequest);
6
+ /**
7
+ * Health check
8
+ * Verifica que el servicio está funcionando correctamente.
9
+ * @returns any Servicio en línea
10
+ * @throws ApiError
11
+ */
12
+ getHealth(): CancelablePromise<{
13
+ status?: string;
14
+ service?: string;
15
+ }>;
16
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HealthService = void 0;
4
+ class HealthService {
5
+ httpRequest;
6
+ constructor(httpRequest) {
7
+ this.httpRequest = httpRequest;
8
+ }
9
+ /**
10
+ * Health check
11
+ * Verifica que el servicio está funcionando correctamente.
12
+ * @returns any Servicio en línea
13
+ * @throws ApiError
14
+ */
15
+ getHealth() {
16
+ return this.httpRequest.request({
17
+ method: 'GET',
18
+ url: '/health',
19
+ });
20
+ }
21
+ }
22
+ exports.HealthService = HealthService;
@@ -0,0 +1,43 @@
1
+ import type { CreateMerchantRequest } from '../models/CreateMerchantRequest';
2
+ import type { Merchant } from '../models/Merchant';
3
+ import type { UpdateMerchantRequest } from '../models/UpdateMerchantRequest';
4
+ import type { CancelablePromise } from '../core/CancelablePromise';
5
+ import type { BaseHttpRequest } from '../core/BaseHttpRequest';
6
+ export declare class MerchantsService {
7
+ readonly httpRequest: BaseHttpRequest;
8
+ constructor(httpRequest: BaseHttpRequest);
9
+ /**
10
+ * Registrar negocio con proveedor de pago
11
+ * Registra un negocio y su configuración de proveedor de pago (Wompi). La API Key se encripta con AES-256 antes de guardarse en la base de datos.
12
+ *
13
+ * @returns Merchant Negocio registrado exitosamente
14
+ * @throws ApiError
15
+ */
16
+ postApiV1Merchants({ requestBody, }: {
17
+ requestBody: CreateMerchantRequest;
18
+ }): CancelablePromise<Merchant>;
19
+ /**
20
+ * Obtener negocio por businessId
21
+ * Retorna la configuración del negocio sin incluir la API Key del proveedor de pago.
22
+ *
23
+ * @returns Merchant Configuración del negocio (sin API Key)
24
+ * @throws ApiError
25
+ */
26
+ getApiV1MerchantsBusiness({ businessId, }: {
27
+ /**
28
+ * ID del negocio en jogo-backend
29
+ */
30
+ businessId: string;
31
+ }): CancelablePromise<Merchant>;
32
+ /**
33
+ * Actualizar configuración del negocio
34
+ * Actualiza los datos del negocio. Si se envía `apiKey`, se re-encripta antes de guardarse.
35
+ *
36
+ * @returns Merchant Negocio actualizado
37
+ * @throws ApiError
38
+ */
39
+ putApiV1MerchantsBusiness({ businessId, requestBody, }: {
40
+ businessId: string;
41
+ requestBody: UpdateMerchantRequest;
42
+ }): CancelablePromise<Merchant>;
43
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MerchantsService = void 0;
4
+ class MerchantsService {
5
+ httpRequest;
6
+ constructor(httpRequest) {
7
+ this.httpRequest = httpRequest;
8
+ }
9
+ /**
10
+ * Registrar negocio con proveedor de pago
11
+ * Registra un negocio y su configuración de proveedor de pago (Wompi). La API Key se encripta con AES-256 antes de guardarse en la base de datos.
12
+ *
13
+ * @returns Merchant Negocio registrado exitosamente
14
+ * @throws ApiError
15
+ */
16
+ postApiV1Merchants({ requestBody, }) {
17
+ return this.httpRequest.request({
18
+ method: 'POST',
19
+ url: '/api/v1/merchants',
20
+ body: requestBody,
21
+ mediaType: 'application/json',
22
+ errors: {
23
+ 401: `No autorizado`,
24
+ 409: `El negocio ya está registrado`,
25
+ },
26
+ });
27
+ }
28
+ /**
29
+ * Obtener negocio por businessId
30
+ * Retorna la configuración del negocio sin incluir la API Key del proveedor de pago.
31
+ *
32
+ * @returns Merchant Configuración del negocio (sin API Key)
33
+ * @throws ApiError
34
+ */
35
+ getApiV1MerchantsBusiness({ businessId, }) {
36
+ return this.httpRequest.request({
37
+ method: 'GET',
38
+ url: '/api/v1/merchants/business/{businessId}',
39
+ path: {
40
+ 'businessId': businessId,
41
+ },
42
+ errors: {
43
+ 401: `Token JWT ausente o inválido`,
44
+ 404: `Negocio no encontrado`,
45
+ },
46
+ });
47
+ }
48
+ /**
49
+ * Actualizar configuración del negocio
50
+ * Actualiza los datos del negocio. Si se envía `apiKey`, se re-encripta antes de guardarse.
51
+ *
52
+ * @returns Merchant Negocio actualizado
53
+ * @throws ApiError
54
+ */
55
+ putApiV1MerchantsBusiness({ businessId, requestBody, }) {
56
+ return this.httpRequest.request({
57
+ method: 'PUT',
58
+ url: '/api/v1/merchants/business/{businessId}',
59
+ path: {
60
+ 'businessId': businessId,
61
+ },
62
+ body: requestBody,
63
+ mediaType: 'application/json',
64
+ errors: {
65
+ 401: `Token JWT ausente o inválido`,
66
+ 404: `Negocio no encontrado`,
67
+ },
68
+ });
69
+ }
70
+ }
71
+ exports.MerchantsService = MerchantsService;
@@ -0,0 +1,66 @@
1
+ import type { CreatePackageRequest } from '../models/CreatePackageRequest';
2
+ import type { Package } from '../models/Package';
3
+ import type { UpdatePackageRequest } from '../models/UpdatePackageRequest';
4
+ import type { CancelablePromise } from '../core/CancelablePromise';
5
+ import type { BaseHttpRequest } from '../core/BaseHttpRequest';
6
+ export declare class PackagesService {
7
+ readonly httpRequest: BaseHttpRequest;
8
+ constructor(httpRequest: BaseHttpRequest);
9
+ /**
10
+ * Crear paquete de clases
11
+ * Crea un nuevo paquete de clases para el negocio especificado.
12
+ * @returns Package Paquete creado
13
+ * @throws ApiError
14
+ */
15
+ postApiV1MerchantsPackages({ merchantId, requestBody, }: {
16
+ /**
17
+ * ID del merchant en este servicio
18
+ */
19
+ merchantId: string;
20
+ requestBody: CreatePackageRequest;
21
+ }): CancelablePromise<Package>;
22
+ /**
23
+ * Listar paquetes del negocio
24
+ * Retorna los paquetes de clases disponibles para un negocio. Por defecto solo retorna los activos. Usa `?all=true` para incluir inactivos.
25
+ *
26
+ * @returns Package Lista de paquetes
27
+ * @throws ApiError
28
+ */
29
+ getApiV1MerchantsPackages({ merchantId, all, }: {
30
+ merchantId: string;
31
+ /**
32
+ * Si es `true`, incluye paquetes inactivos
33
+ */
34
+ all?: 'true' | 'false';
35
+ }): CancelablePromise<Array<Package>>;
36
+ /**
37
+ * Obtener paquete por ID
38
+ * @returns Package Detalle del paquete
39
+ * @throws ApiError
40
+ */
41
+ getApiV1MerchantsPackages1({ merchantId, id, }: {
42
+ merchantId: string;
43
+ id: string;
44
+ }): CancelablePromise<Package>;
45
+ /**
46
+ * Actualizar paquete
47
+ * @returns Package Paquete actualizado
48
+ * @throws ApiError
49
+ */
50
+ putApiV1MerchantsPackages({ merchantId, id, requestBody, }: {
51
+ merchantId: string;
52
+ id: string;
53
+ requestBody: UpdatePackageRequest;
54
+ }): CancelablePromise<Package>;
55
+ /**
56
+ * Desactivar paquete
57
+ * Desactiva el paquete (no lo elimina físicamente). Las suscripciones existentes no se ven afectadas.
58
+ *
59
+ * @returns Package Paquete desactivado
60
+ * @throws ApiError
61
+ */
62
+ deleteApiV1MerchantsPackages({ merchantId, id, }: {
63
+ merchantId: string;
64
+ id: string;
65
+ }): CancelablePromise<Package>;
66
+ }
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PackagesService = void 0;
4
+ class PackagesService {
5
+ httpRequest;
6
+ constructor(httpRequest) {
7
+ this.httpRequest = httpRequest;
8
+ }
9
+ /**
10
+ * Crear paquete de clases
11
+ * Crea un nuevo paquete de clases para el negocio especificado.
12
+ * @returns Package Paquete creado
13
+ * @throws ApiError
14
+ */
15
+ postApiV1MerchantsPackages({ merchantId, requestBody, }) {
16
+ return this.httpRequest.request({
17
+ method: 'POST',
18
+ url: '/api/v1/merchants/{merchantId}/packages',
19
+ path: {
20
+ 'merchantId': merchantId,
21
+ },
22
+ body: requestBody,
23
+ mediaType: 'application/json',
24
+ errors: {
25
+ 401: `Token JWT ausente o inválido`,
26
+ },
27
+ });
28
+ }
29
+ /**
30
+ * Listar paquetes del negocio
31
+ * Retorna los paquetes de clases disponibles para un negocio. Por defecto solo retorna los activos. Usa `?all=true` para incluir inactivos.
32
+ *
33
+ * @returns Package Lista de paquetes
34
+ * @throws ApiError
35
+ */
36
+ getApiV1MerchantsPackages({ merchantId, all, }) {
37
+ return this.httpRequest.request({
38
+ method: 'GET',
39
+ url: '/api/v1/merchants/{merchantId}/packages',
40
+ path: {
41
+ 'merchantId': merchantId,
42
+ },
43
+ query: {
44
+ 'all': all,
45
+ },
46
+ });
47
+ }
48
+ /**
49
+ * Obtener paquete por ID
50
+ * @returns Package Detalle del paquete
51
+ * @throws ApiError
52
+ */
53
+ getApiV1MerchantsPackages1({ merchantId, id, }) {
54
+ return this.httpRequest.request({
55
+ method: 'GET',
56
+ url: '/api/v1/merchants/{merchantId}/packages/{id}',
57
+ path: {
58
+ 'merchantId': merchantId,
59
+ 'id': id,
60
+ },
61
+ errors: {
62
+ 404: `Paquete no encontrado`,
63
+ },
64
+ });
65
+ }
66
+ /**
67
+ * Actualizar paquete
68
+ * @returns Package Paquete actualizado
69
+ * @throws ApiError
70
+ */
71
+ putApiV1MerchantsPackages({ merchantId, id, requestBody, }) {
72
+ return this.httpRequest.request({
73
+ method: 'PUT',
74
+ url: '/api/v1/merchants/{merchantId}/packages/{id}',
75
+ path: {
76
+ 'merchantId': merchantId,
77
+ 'id': id,
78
+ },
79
+ body: requestBody,
80
+ mediaType: 'application/json',
81
+ errors: {
82
+ 401: `Token JWT ausente o inválido`,
83
+ 403: `El paquete no pertenece a este negocio`,
84
+ 404: `Paquete no encontrado`,
85
+ },
86
+ });
87
+ }
88
+ /**
89
+ * Desactivar paquete
90
+ * Desactiva el paquete (no lo elimina físicamente). Las suscripciones existentes no se ven afectadas.
91
+ *
92
+ * @returns Package Paquete desactivado
93
+ * @throws ApiError
94
+ */
95
+ deleteApiV1MerchantsPackages({ merchantId, id, }) {
96
+ return this.httpRequest.request({
97
+ method: 'DELETE',
98
+ url: '/api/v1/merchants/{merchantId}/packages/{id}',
99
+ path: {
100
+ 'merchantId': merchantId,
101
+ 'id': id,
102
+ },
103
+ errors: {
104
+ 401: `Token JWT ausente o inválido`,
105
+ 403: `Forbidden`,
106
+ },
107
+ });
108
+ }
109
+ }
110
+ exports.PackagesService = PackagesService;
@@ -0,0 +1,53 @@
1
+ import type { Payment } from '../models/Payment';
2
+ import type { CancelablePromise } from '../core/CancelablePromise';
3
+ import type { BaseHttpRequest } from '../core/BaseHttpRequest';
4
+ export declare class PaymentsService {
5
+ readonly httpRequest: BaseHttpRequest;
6
+ constructor(httpRequest: BaseHttpRequest);
7
+ /**
8
+ * Webhook de notificación de Wompi
9
+ * Endpoint que Wompi llama para notificar el resultado de una transacción. **No requiere autenticación** — es invocado directamente por Wompi.
10
+ * Al recibir un pago completado (`APROBADA`), activa automáticamente la suscripción asociada.
11
+ * Configurar esta URL en el `webhookUrl` del merchant: `POST https://tu-servidor.com/api/v1/webhooks/{merchantId}`
12
+ *
13
+ * @returns any Webhook recibido y procesado
14
+ * @throws ApiError
15
+ */
16
+ postApiV1Webhooks({ merchantId, requestBody, }: {
17
+ /**
18
+ * ID del merchant en este servicio (no el businessId de jogo-backend)
19
+ */
20
+ merchantId: string;
21
+ requestBody: {
22
+ /**
23
+ * ID de la transacción en Wompi
24
+ */
25
+ idTransaccion?: string;
26
+ monto?: number;
27
+ estado?: 'APROBADA' | 'RECHAZADA' | 'PENDIENTE' | 'ERROR';
28
+ /**
29
+ * Metadata enviada al crear la transacción
30
+ */
31
+ datosAdicionales?: Record<string, any>;
32
+ };
33
+ }): CancelablePromise<{
34
+ received?: boolean;
35
+ }>;
36
+ /**
37
+ * Detalle de un pago
38
+ * @returns Payment Detalle del pago incluyendo respuesta del proveedor
39
+ * @throws ApiError
40
+ */
41
+ getApiV1Payments({ id, }: {
42
+ id: string;
43
+ }): CancelablePromise<Payment>;
44
+ /**
45
+ * Historial de pagos de una suscripción
46
+ * Retorna todos los pagos realizados para una suscripción específica, ordenados por fecha descendente.
47
+ * @returns Payment Historial de pagos
48
+ * @throws ApiError
49
+ */
50
+ getApiV1PaymentsSubscription({ subscriptionId, }: {
51
+ subscriptionId: string;
52
+ }): CancelablePromise<Array<Payment>>;
53
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentsService = void 0;
4
+ class PaymentsService {
5
+ httpRequest;
6
+ constructor(httpRequest) {
7
+ this.httpRequest = httpRequest;
8
+ }
9
+ /**
10
+ * Webhook de notificación de Wompi
11
+ * Endpoint que Wompi llama para notificar el resultado de una transacción. **No requiere autenticación** — es invocado directamente por Wompi.
12
+ * Al recibir un pago completado (`APROBADA`), activa automáticamente la suscripción asociada.
13
+ * Configurar esta URL en el `webhookUrl` del merchant: `POST https://tu-servidor.com/api/v1/webhooks/{merchantId}`
14
+ *
15
+ * @returns any Webhook recibido y procesado
16
+ * @throws ApiError
17
+ */
18
+ postApiV1Webhooks({ merchantId, requestBody, }) {
19
+ return this.httpRequest.request({
20
+ method: 'POST',
21
+ url: '/api/v1/webhooks/{merchantId}',
22
+ path: {
23
+ 'merchantId': merchantId,
24
+ },
25
+ body: requestBody,
26
+ mediaType: 'application/json',
27
+ });
28
+ }
29
+ /**
30
+ * Detalle de un pago
31
+ * @returns Payment Detalle del pago incluyendo respuesta del proveedor
32
+ * @throws ApiError
33
+ */
34
+ getApiV1Payments({ id, }) {
35
+ return this.httpRequest.request({
36
+ method: 'GET',
37
+ url: '/api/v1/payments/{id}',
38
+ path: {
39
+ 'id': id,
40
+ },
41
+ errors: {
42
+ 401: `Token JWT ausente o inválido`,
43
+ 404: `Pago no encontrado`,
44
+ },
45
+ });
46
+ }
47
+ /**
48
+ * Historial de pagos de una suscripción
49
+ * Retorna todos los pagos realizados para una suscripción específica, ordenados por fecha descendente.
50
+ * @returns Payment Historial de pagos
51
+ * @throws ApiError
52
+ */
53
+ getApiV1PaymentsSubscription({ subscriptionId, }) {
54
+ return this.httpRequest.request({
55
+ method: 'GET',
56
+ url: '/api/v1/payments/subscription/{subscriptionId}',
57
+ path: {
58
+ 'subscriptionId': subscriptionId,
59
+ },
60
+ errors: {
61
+ 401: `Token JWT ausente o inválido`,
62
+ },
63
+ });
64
+ }
65
+ }
66
+ exports.PaymentsService = PaymentsService;
@@ -0,0 +1,86 @@
1
+ import type { ConsumeClassResponse } from '../models/ConsumeClassResponse';
2
+ import type { CreateSubscriptionRequest } from '../models/CreateSubscriptionRequest';
3
+ import type { CreateSubscriptionResponse } from '../models/CreateSubscriptionResponse';
4
+ import type { Subscription } from '../models/Subscription';
5
+ import type { CancelablePromise } from '../core/CancelablePromise';
6
+ import type { BaseHttpRequest } from '../core/BaseHttpRequest';
7
+ export declare class SubscriptionsService {
8
+ readonly httpRequest: BaseHttpRequest;
9
+ constructor(httpRequest: BaseHttpRequest);
10
+ /**
11
+ * Crear y pagar una suscripción
12
+ * Crea una suscripción para el cliente autenticado y ejecuta el cobro al proveedor de pago configurado para el negocio.
13
+ * **Flujo con tarjeta guardada (recomendado para renovaciones):** Enviar `savedCardId` + `cvv`. Si el pago completa de inmediato, retorna `201` con la suscripción activa.
14
+ * **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.
15
+ *
16
+ * @returns CreateSubscriptionResponse Suscripción creada y activa (pago completado sin 3DS)
17
+ * @throws ApiError
18
+ */
19
+ postApiV1Subscriptions({ requestBody, }: {
20
+ requestBody: CreateSubscriptionRequest;
21
+ }): CancelablePromise<CreateSubscriptionResponse>;
22
+ /**
23
+ * Mis suscripciones
24
+ * Retorna todas las suscripciones del cliente autenticado.
25
+ * @returns Subscription Lista de suscripciones del cliente
26
+ * @throws ApiError
27
+ */
28
+ getApiV1SubscriptionsMe(): CancelablePromise<Array<Subscription>>;
29
+ /**
30
+ * Suscripciones de un cliente (admin)
31
+ * Retorna las suscripciones de un cliente específico. Uso interno/admin — el negocio puede consultar el estado de sus clientes.
32
+ *
33
+ * @returns Subscription Lista de suscripciones
34
+ * @throws ApiError
35
+ */
36
+ getApiV1SubscriptionsCustomer({ customerId, }: {
37
+ /**
38
+ * ID del cliente en jogo-backend
39
+ */
40
+ customerId: string;
41
+ }): CancelablePromise<Array<Subscription>>;
42
+ /**
43
+ * Detalle de una suscripción
44
+ * @returns Subscription Detalle de la suscripción con info del paquete populada
45
+ * @throws ApiError
46
+ */
47
+ getApiV1Subscriptions({ id, }: {
48
+ id: string;
49
+ }): CancelablePromise<Subscription>;
50
+ /**
51
+ * Registrar uso de una clase
52
+ * Descuenta una clase del saldo disponible en la suscripción. Solo aplica a suscripciones en estado `active` con clases restantes.
53
+ *
54
+ * @returns ConsumeClassResponse Clase registrada exitosamente
55
+ * @throws ApiError
56
+ */
57
+ postApiV1SubscriptionsConsume({ id, }: {
58
+ id: string;
59
+ }): CancelablePromise<ConsumeClassResponse>;
60
+ /**
61
+ * Cancelar suscripción
62
+ * Cancela la suscripción y desactiva la renovación automática. El cliente mantiene acceso hasta la fecha de vencimiento.
63
+ *
64
+ * @returns Subscription Suscripción cancelada
65
+ * @throws ApiError
66
+ */
67
+ postApiV1SubscriptionsCancel({ id, }: {
68
+ id: string;
69
+ }): CancelablePromise<Subscription>;
70
+ /**
71
+ * Renovar suscripción manualmente
72
+ * 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.
73
+ *
74
+ * @returns CreateSubscriptionResponse Suscripción renovada
75
+ * @throws ApiError
76
+ */
77
+ postApiV1SubscriptionsRenew({ id, requestBody, }: {
78
+ id: string;
79
+ requestBody: {
80
+ /**
81
+ * CVV de la tarjeta guardada
82
+ */
83
+ cvv: string;
84
+ };
85
+ }): CancelablePromise<CreateSubscriptionResponse>;
86
+ }