@jogolabs/billing-sdk-v2 0.0.1 → 0.0.3
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/dist/billing/src/__generated__/Billing.d.ts +2 -6
- package/dist/billing/src/__generated__/Billing.js +3 -9
- package/dist/billing/src/__generated__/index.d.ts +1 -19
- package/dist/billing/src/__generated__/index.js +3 -33
- package/dist/billing/src/__generated__/models/CreateMerchantRequest.d.ts +4 -1
- package/dist/billing/src/__generated__/models/CreateSubscriptionRequest.d.ts +7 -1
- package/dist/billing/src/__generated__/models/Merchant.d.ts +2 -2
- package/dist/billing/src/__generated__/models/Package.d.ts +4 -1
- package/dist/billing/src/__generated__/models/Payment.d.ts +4 -1
- package/dist/billing/src/__generated__/models/SavedCard.d.ts +4 -1
- package/dist/billing/src/__generated__/models/Subscription.d.ts +13 -6
- package/dist/billing/src/__generated__/models/Subscription.js +2 -2
- package/dist/billing/src/__generated__/models/TokenizeCardRequest.d.ts +4 -1
- package/dist/billing/src/__generated__/schemas/$CreateMerchantRequest.d.ts +2 -1
- package/dist/billing/src/__generated__/schemas/$CreateMerchantRequest.js +2 -1
- package/dist/billing/src/__generated__/schemas/$CreateSubscriptionRequest.d.ts +3 -1
- package/dist/billing/src/__generated__/schemas/$CreateSubscriptionRequest.js +3 -1
- package/dist/billing/src/__generated__/schemas/$Merchant.d.ts +2 -2
- package/dist/billing/src/__generated__/schemas/$Merchant.js +2 -2
- package/dist/billing/src/__generated__/schemas/$Package.d.ts +2 -1
- package/dist/billing/src/__generated__/schemas/$Package.js +2 -1
- package/dist/billing/src/__generated__/schemas/$Payment.d.ts +2 -1
- package/dist/billing/src/__generated__/schemas/$Payment.js +2 -1
- package/dist/billing/src/__generated__/schemas/$SavedCard.d.ts +2 -1
- package/dist/billing/src/__generated__/schemas/$SavedCard.js +2 -1
- package/dist/billing/src/__generated__/schemas/$Subscription.d.ts +15 -12
- package/dist/billing/src/__generated__/schemas/$Subscription.js +15 -12
- package/dist/billing/src/__generated__/schemas/$TokenizeCardRequest.d.ts +2 -1
- package/dist/billing/src/__generated__/schemas/$TokenizeCardRequest.js +2 -1
- package/dist/billing/src/__generated__/services/CardsService.d.ts +3 -3
- package/dist/billing/src/__generated__/services/CardsService.js +3 -3
- package/dist/billing/src/__generated__/services/MerchantsService.d.ts +5 -5
- package/dist/billing/src/__generated__/services/MerchantsService.js +7 -7
- package/dist/billing/src/__generated__/services/PackagesService.d.ts +11 -11
- package/dist/billing/src/__generated__/services/PackagesService.js +15 -15
- package/dist/billing/src/__generated__/services/PaymentsService.d.ts +4 -4
- package/dist/billing/src/__generated__/services/PaymentsService.js +4 -4
- package/dist/billing/src/__generated__/services/SubscriptionsService.d.ts +1 -1
- package/dist/billing/src/__generated__/services/SubscriptionsService.js +1 -1
- package/dist/billing/src/__generated__/services/WebhooksService.d.ts +29 -0
- package/dist/billing/src/__generated__/services/WebhooksService.js +26 -0
- package/package.json +1 -1
- package/src/billing/src/__generated__/Billing.ts +3 -9
- package/src/billing/src/__generated__/index.ts +1 -19
- package/src/billing/src/__generated__/models/CreateSubscriptionRequest.ts +7 -1
- package/src/billing/src/__generated__/models/SavedCard.ts +4 -1
- package/src/billing/src/__generated__/models/Subscription.ts +13 -6
- package/src/billing/src/__generated__/models/TokenizeCardRequest.ts +4 -1
- package/src/billing/src/__generated__/schemas/$CreateSubscriptionRequest.ts +3 -1
- package/src/billing/src/__generated__/schemas/$SavedCard.ts +2 -1
- package/src/billing/src/__generated__/schemas/$Subscription.ts +15 -12
- package/src/billing/src/__generated__/schemas/$TokenizeCardRequest.ts +2 -1
- package/src/billing/src/__generated__/services/CardsService.ts +5 -5
- package/src/billing/src/__generated__/services/SubscriptionsService.ts +1 -1
- package/src/billing/src/__generated__/services/WebhooksService.ts +41 -0
- package/src/billing/src/__generated__/models/CreateMerchantRequest.ts +0 -28
- package/src/billing/src/__generated__/models/CreatePackageRequest.ts +0 -13
- package/src/billing/src/__generated__/models/Merchant.ts +0 -25
- package/src/billing/src/__generated__/models/MerchantProviderConfig.ts +0 -20
- package/src/billing/src/__generated__/models/Package.ts +0 -19
- package/src/billing/src/__generated__/models/Payment.ts +0 -37
- package/src/billing/src/__generated__/models/UpdateMerchantRequest.ts +0 -21
- package/src/billing/src/__generated__/models/UpdatePackageRequest.ts +0 -14
- package/src/billing/src/__generated__/schemas/$CreateMerchantRequest.ts +0 -43
- package/src/billing/src/__generated__/schemas/$CreatePackageRequest.ts +0 -32
- package/src/billing/src/__generated__/schemas/$Merchant.ts +0 -39
- package/src/billing/src/__generated__/schemas/$MerchantProviderConfig.ts +0 -23
- package/src/billing/src/__generated__/schemas/$Package.ts +0 -47
- package/src/billing/src/__generated__/schemas/$Payment.ts +0 -47
- package/src/billing/src/__generated__/schemas/$UpdateMerchantRequest.ts +0 -35
- package/src/billing/src/__generated__/schemas/$UpdatePackageRequest.ts +0 -31
- package/src/billing/src/__generated__/services/MerchantsService.ts +0 -90
- package/src/billing/src/__generated__/services/PackagesService.ts +0 -150
- package/src/billing/src/__generated__/services/PaymentsService.ts +0 -96
|
@@ -17,17 +17,17 @@ export declare class MerchantsService {
|
|
|
17
17
|
requestBody: CreateMerchantRequest;
|
|
18
18
|
}): CancelablePromise<Merchant>;
|
|
19
19
|
/**
|
|
20
|
-
* Obtener negocio por
|
|
20
|
+
* Obtener negocio por spaceId
|
|
21
21
|
* Retorna la configuración del negocio sin incluir la API Key del proveedor de pago.
|
|
22
22
|
*
|
|
23
23
|
* @returns Merchant Configuración del negocio (sin API Key)
|
|
24
24
|
* @throws ApiError
|
|
25
25
|
*/
|
|
26
|
-
getApiV1MerchantsBusiness({
|
|
26
|
+
getApiV1MerchantsBusiness({ spaceId, }: {
|
|
27
27
|
/**
|
|
28
28
|
* ID del negocio en jogo-backend
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
spaceId: string;
|
|
31
31
|
}): CancelablePromise<Merchant>;
|
|
32
32
|
/**
|
|
33
33
|
* Actualizar configuración del negocio
|
|
@@ -36,8 +36,8 @@ export declare class MerchantsService {
|
|
|
36
36
|
* @returns Merchant Negocio actualizado
|
|
37
37
|
* @throws ApiError
|
|
38
38
|
*/
|
|
39
|
-
putApiV1MerchantsBusiness({
|
|
40
|
-
|
|
39
|
+
putApiV1MerchantsBusiness({ spaceId, requestBody, }: {
|
|
40
|
+
spaceId: string;
|
|
41
41
|
requestBody: UpdateMerchantRequest;
|
|
42
42
|
}): CancelablePromise<Merchant>;
|
|
43
43
|
}
|
|
@@ -26,18 +26,18 @@ class MerchantsService {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Obtener negocio por
|
|
29
|
+
* Obtener negocio por spaceId
|
|
30
30
|
* Retorna la configuración del negocio sin incluir la API Key del proveedor de pago.
|
|
31
31
|
*
|
|
32
32
|
* @returns Merchant Configuración del negocio (sin API Key)
|
|
33
33
|
* @throws ApiError
|
|
34
34
|
*/
|
|
35
|
-
getApiV1MerchantsBusiness({
|
|
35
|
+
getApiV1MerchantsBusiness({ spaceId, }) {
|
|
36
36
|
return this.httpRequest.request({
|
|
37
37
|
method: 'GET',
|
|
38
|
-
url: '/api/v1/merchants/business/{
|
|
38
|
+
url: '/api/v1/merchants/business/{spaceId}',
|
|
39
39
|
path: {
|
|
40
|
-
'
|
|
40
|
+
'spaceId': spaceId,
|
|
41
41
|
},
|
|
42
42
|
errors: {
|
|
43
43
|
401: `Token JWT ausente o inválido`,
|
|
@@ -52,12 +52,12 @@ class MerchantsService {
|
|
|
52
52
|
* @returns Merchant Negocio actualizado
|
|
53
53
|
* @throws ApiError
|
|
54
54
|
*/
|
|
55
|
-
putApiV1MerchantsBusiness({
|
|
55
|
+
putApiV1MerchantsBusiness({ spaceId, requestBody, }) {
|
|
56
56
|
return this.httpRequest.request({
|
|
57
57
|
method: 'PUT',
|
|
58
|
-
url: '/api/v1/merchants/business/{
|
|
58
|
+
url: '/api/v1/merchants/business/{spaceId}',
|
|
59
59
|
path: {
|
|
60
|
-
'
|
|
60
|
+
'spaceId': spaceId,
|
|
61
61
|
},
|
|
62
62
|
body: requestBody,
|
|
63
63
|
mediaType: 'application/json',
|
|
@@ -12,11 +12,11 @@ export declare class PackagesService {
|
|
|
12
12
|
* @returns Package Paquete creado
|
|
13
13
|
* @throws ApiError
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
postApiV1SpacesPackages({ spaceId, requestBody, }: {
|
|
16
16
|
/**
|
|
17
|
-
* ID
|
|
17
|
+
* Space ID from jogo-backend
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
spaceId: string;
|
|
20
20
|
requestBody: CreatePackageRequest;
|
|
21
21
|
}): CancelablePromise<Package>;
|
|
22
22
|
/**
|
|
@@ -26,8 +26,8 @@ export declare class PackagesService {
|
|
|
26
26
|
* @returns Package Lista de paquetes
|
|
27
27
|
* @throws ApiError
|
|
28
28
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
getApiV1SpacesPackages({ spaceId, all, }: {
|
|
30
|
+
spaceId: string;
|
|
31
31
|
/**
|
|
32
32
|
* Si es `true`, incluye paquetes inactivos
|
|
33
33
|
*/
|
|
@@ -38,8 +38,8 @@ export declare class PackagesService {
|
|
|
38
38
|
* @returns Package Detalle del paquete
|
|
39
39
|
* @throws ApiError
|
|
40
40
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
getApiV1SpacesPackages1({ spaceId, id, }: {
|
|
42
|
+
spaceId: string;
|
|
43
43
|
id: string;
|
|
44
44
|
}): CancelablePromise<Package>;
|
|
45
45
|
/**
|
|
@@ -47,8 +47,8 @@ export declare class PackagesService {
|
|
|
47
47
|
* @returns Package Paquete actualizado
|
|
48
48
|
* @throws ApiError
|
|
49
49
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
putApiV1SpacesPackages({ spaceId, id, requestBody, }: {
|
|
51
|
+
spaceId: string;
|
|
52
52
|
id: string;
|
|
53
53
|
requestBody: UpdatePackageRequest;
|
|
54
54
|
}): CancelablePromise<Package>;
|
|
@@ -59,8 +59,8 @@ export declare class PackagesService {
|
|
|
59
59
|
* @returns Package Paquete desactivado
|
|
60
60
|
* @throws ApiError
|
|
61
61
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
deleteApiV1SpacesPackages({ spaceId, id, }: {
|
|
63
|
+
spaceId: string;
|
|
64
64
|
id: string;
|
|
65
65
|
}): CancelablePromise<Package>;
|
|
66
66
|
}
|
|
@@ -12,12 +12,12 @@ class PackagesService {
|
|
|
12
12
|
* @returns Package Paquete creado
|
|
13
13
|
* @throws ApiError
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
postApiV1SpacesPackages({ spaceId, requestBody, }) {
|
|
16
16
|
return this.httpRequest.request({
|
|
17
17
|
method: 'POST',
|
|
18
|
-
url: '/api/v1/
|
|
18
|
+
url: '/api/v1/spaces/{spaceId}/packages',
|
|
19
19
|
path: {
|
|
20
|
-
'
|
|
20
|
+
'spaceId': spaceId,
|
|
21
21
|
},
|
|
22
22
|
body: requestBody,
|
|
23
23
|
mediaType: 'application/json',
|
|
@@ -33,12 +33,12 @@ class PackagesService {
|
|
|
33
33
|
* @returns Package Lista de paquetes
|
|
34
34
|
* @throws ApiError
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
getApiV1SpacesPackages({ spaceId, all, }) {
|
|
37
37
|
return this.httpRequest.request({
|
|
38
38
|
method: 'GET',
|
|
39
|
-
url: '/api/v1/
|
|
39
|
+
url: '/api/v1/spaces/{spaceId}/packages',
|
|
40
40
|
path: {
|
|
41
|
-
'
|
|
41
|
+
'spaceId': spaceId,
|
|
42
42
|
},
|
|
43
43
|
query: {
|
|
44
44
|
'all': all,
|
|
@@ -50,12 +50,12 @@ class PackagesService {
|
|
|
50
50
|
* @returns Package Detalle del paquete
|
|
51
51
|
* @throws ApiError
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
getApiV1SpacesPackages1({ spaceId, id, }) {
|
|
54
54
|
return this.httpRequest.request({
|
|
55
55
|
method: 'GET',
|
|
56
|
-
url: '/api/v1/
|
|
56
|
+
url: '/api/v1/spaces/{spaceId}/packages/{id}',
|
|
57
57
|
path: {
|
|
58
|
-
'
|
|
58
|
+
'spaceId': spaceId,
|
|
59
59
|
'id': id,
|
|
60
60
|
},
|
|
61
61
|
errors: {
|
|
@@ -68,12 +68,12 @@ class PackagesService {
|
|
|
68
68
|
* @returns Package Paquete actualizado
|
|
69
69
|
* @throws ApiError
|
|
70
70
|
*/
|
|
71
|
-
|
|
71
|
+
putApiV1SpacesPackages({ spaceId, id, requestBody, }) {
|
|
72
72
|
return this.httpRequest.request({
|
|
73
73
|
method: 'PUT',
|
|
74
|
-
url: '/api/v1/
|
|
74
|
+
url: '/api/v1/spaces/{spaceId}/packages/{id}',
|
|
75
75
|
path: {
|
|
76
|
-
'
|
|
76
|
+
'spaceId': spaceId,
|
|
77
77
|
'id': id,
|
|
78
78
|
},
|
|
79
79
|
body: requestBody,
|
|
@@ -92,12 +92,12 @@ class PackagesService {
|
|
|
92
92
|
* @returns Package Paquete desactivado
|
|
93
93
|
* @throws ApiError
|
|
94
94
|
*/
|
|
95
|
-
|
|
95
|
+
deleteApiV1SpacesPackages({ spaceId, id, }) {
|
|
96
96
|
return this.httpRequest.request({
|
|
97
97
|
method: 'DELETE',
|
|
98
|
-
url: '/api/v1/
|
|
98
|
+
url: '/api/v1/spaces/{spaceId}/packages/{id}',
|
|
99
99
|
path: {
|
|
100
|
-
'
|
|
100
|
+
'spaceId': spaceId,
|
|
101
101
|
'id': id,
|
|
102
102
|
},
|
|
103
103
|
errors: {
|
|
@@ -8,16 +8,16 @@ export declare class PaymentsService {
|
|
|
8
8
|
* Webhook de notificación de Wompi
|
|
9
9
|
* Endpoint que Wompi llama para notificar el resultado de una transacción. **No requiere autenticación** — es invocado directamente por Wompi.
|
|
10
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/{
|
|
11
|
+
* Configurar esta URL en el `webhookUrl` del merchant: `POST https://tu-servidor.com/api/v1/webhooks/{spaceId}`
|
|
12
12
|
*
|
|
13
13
|
* @returns any Webhook recibido y procesado
|
|
14
14
|
* @throws ApiError
|
|
15
15
|
*/
|
|
16
|
-
postApiV1Webhooks({
|
|
16
|
+
postApiV1Webhooks({ spaceId, requestBody, }: {
|
|
17
17
|
/**
|
|
18
|
-
* ID
|
|
18
|
+
* Space ID from jogo-backend
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
spaceId: string;
|
|
21
21
|
requestBody: {
|
|
22
22
|
/**
|
|
23
23
|
* ID de la transacción en Wompi
|
|
@@ -10,17 +10,17 @@ class PaymentsService {
|
|
|
10
10
|
* Webhook de notificación de Wompi
|
|
11
11
|
* Endpoint que Wompi llama para notificar el resultado de una transacción. **No requiere autenticación** — es invocado directamente por Wompi.
|
|
12
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/{
|
|
13
|
+
* Configurar esta URL en el `webhookUrl` del merchant: `POST https://tu-servidor.com/api/v1/webhooks/{spaceId}`
|
|
14
14
|
*
|
|
15
15
|
* @returns any Webhook recibido y procesado
|
|
16
16
|
* @throws ApiError
|
|
17
17
|
*/
|
|
18
|
-
postApiV1Webhooks({
|
|
18
|
+
postApiV1Webhooks({ spaceId, requestBody, }) {
|
|
19
19
|
return this.httpRequest.request({
|
|
20
20
|
method: 'POST',
|
|
21
|
-
url: '/api/v1/webhooks/{
|
|
21
|
+
url: '/api/v1/webhooks/{spaceId}',
|
|
22
22
|
path: {
|
|
23
|
-
'
|
|
23
|
+
'spaceId': spaceId,
|
|
24
24
|
},
|
|
25
25
|
body: requestBody,
|
|
26
26
|
mediaType: 'application/json',
|
|
@@ -41,7 +41,7 @@ export declare class SubscriptionsService {
|
|
|
41
41
|
}): CancelablePromise<Array<Subscription>>;
|
|
42
42
|
/**
|
|
43
43
|
* Detalle de una suscripción
|
|
44
|
-
* @returns Subscription Detalle de la suscripción
|
|
44
|
+
* @returns Subscription Detalle de la suscripción
|
|
45
45
|
* @throws ApiError
|
|
46
46
|
*/
|
|
47
47
|
getApiV1Subscriptions({ id, }: {
|
|
@@ -63,7 +63,7 @@ class SubscriptionsService {
|
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Detalle de una suscripción
|
|
66
|
-
* @returns Subscription Detalle de la suscripción
|
|
66
|
+
* @returns Subscription Detalle de la suscripción
|
|
67
67
|
* @throws ApiError
|
|
68
68
|
*/
|
|
69
69
|
getApiV1Subscriptions({ id, }) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
2
|
+
import type { BaseHttpRequest } from '../core/BaseHttpRequest';
|
|
3
|
+
export declare class WebhooksService {
|
|
4
|
+
readonly httpRequest: BaseHttpRequest;
|
|
5
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
6
|
+
/**
|
|
7
|
+
* Webhook de notificación de Wompi
|
|
8
|
+
* Endpoint que Wompi llama para notificar el resultado de una transacción. **No requiere autenticación** — es invocado directamente por Wompi.
|
|
9
|
+
* Al recibir `ResultadoTransaccion: "ExitosaAprobada"`: 1. Obtiene el plan desde jogo-backend usando `cliente.paymentId` 2. Busca suscripción existente (pending/active/due) para el cliente 3. Si no existe → crea una nueva activa 4. Si existe → la activa y extiende la fecha de vencimiento
|
|
10
|
+
*
|
|
11
|
+
* @returns any Webhook recibido y procesado
|
|
12
|
+
* @throws ApiError
|
|
13
|
+
*/
|
|
14
|
+
postApiV1Webhooks({ requestBody, }: {
|
|
15
|
+
requestBody: {
|
|
16
|
+
IdTransaccion?: string;
|
|
17
|
+
Monto?: number;
|
|
18
|
+
ResultadoTransaccion?: 'ExitosaAprobada' | 'Rechazada' | 'Pendiente' | 'Error';
|
|
19
|
+
DatosAdicionales?: Record<string, any>;
|
|
20
|
+
cliente?: {
|
|
21
|
+
jogoId?: string;
|
|
22
|
+
paymentId?: string;
|
|
23
|
+
subscriptionId?: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}): CancelablePromise<{
|
|
27
|
+
received?: boolean;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebhooksService = void 0;
|
|
4
|
+
class WebhooksService {
|
|
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 `ResultadoTransaccion: "ExitosaAprobada"`: 1. Obtiene el plan desde jogo-backend usando `cliente.paymentId` 2. Busca suscripción existente (pending/active/due) para el cliente 3. Si no existe → crea una nueva activa 4. Si existe → la activa y extiende la fecha de vencimiento
|
|
13
|
+
*
|
|
14
|
+
* @returns any Webhook recibido y procesado
|
|
15
|
+
* @throws ApiError
|
|
16
|
+
*/
|
|
17
|
+
postApiV1Webhooks({ requestBody, }) {
|
|
18
|
+
return this.httpRequest.request({
|
|
19
|
+
method: 'POST',
|
|
20
|
+
url: '/api/v1/webhooks',
|
|
21
|
+
body: requestBody,
|
|
22
|
+
mediaType: 'application/json',
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.WebhooksService = WebhooksService;
|
package/package.json
CHANGED
|
@@ -7,18 +7,14 @@ import type { OpenAPIConfig } from './core/OpenAPI';
|
|
|
7
7
|
import { AxiosHttpRequest } from './core/AxiosHttpRequest';
|
|
8
8
|
import { CardsService } from './services/CardsService';
|
|
9
9
|
import { HealthService } from './services/HealthService';
|
|
10
|
-
import { MerchantsService } from './services/MerchantsService';
|
|
11
|
-
import { PackagesService } from './services/PackagesService';
|
|
12
|
-
import { PaymentsService } from './services/PaymentsService';
|
|
13
10
|
import { SubscriptionsService } from './services/SubscriptionsService';
|
|
11
|
+
import { WebhooksService } from './services/WebhooksService';
|
|
14
12
|
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
15
13
|
export class Billing {
|
|
16
14
|
public readonly cards: CardsService;
|
|
17
15
|
public readonly health: HealthService;
|
|
18
|
-
public readonly merchants: MerchantsService;
|
|
19
|
-
public readonly packages: PackagesService;
|
|
20
|
-
public readonly payments: PaymentsService;
|
|
21
16
|
public readonly subscriptions: SubscriptionsService;
|
|
17
|
+
public readonly webhooks: WebhooksService;
|
|
22
18
|
public readonly request: BaseHttpRequest;
|
|
23
19
|
constructor(config?: Partial<OpenAPIConfig>, HttpRequest: HttpRequestConstructor = AxiosHttpRequest) {
|
|
24
20
|
this.request = new HttpRequest({
|
|
@@ -34,10 +30,8 @@ export class Billing {
|
|
|
34
30
|
});
|
|
35
31
|
this.cards = new CardsService(this.request);
|
|
36
32
|
this.health = new HealthService(this.request);
|
|
37
|
-
this.merchants = new MerchantsService(this.request);
|
|
38
|
-
this.packages = new PackagesService(this.request);
|
|
39
|
-
this.payments = new PaymentsService(this.request);
|
|
40
33
|
this.subscriptions = new SubscriptionsService(this.request);
|
|
34
|
+
this.webhooks = new WebhooksService(this.request);
|
|
41
35
|
}
|
|
42
36
|
}
|
|
43
37
|
|
|
@@ -11,40 +11,22 @@ export { OpenAPI } from './core/OpenAPI';
|
|
|
11
11
|
export type { OpenAPIConfig } from './core/OpenAPI';
|
|
12
12
|
|
|
13
13
|
export type { ConsumeClassResponse } from './models/ConsumeClassResponse';
|
|
14
|
-
export { CreateMerchantRequest } from './models/CreateMerchantRequest';
|
|
15
|
-
export type { CreatePackageRequest } from './models/CreatePackageRequest';
|
|
16
14
|
export type { CreateSubscriptionRequest } from './models/CreateSubscriptionRequest';
|
|
17
15
|
export type { CreateSubscriptionResponse } from './models/CreateSubscriptionResponse';
|
|
18
16
|
export type { Error } from './models/Error';
|
|
19
|
-
export { Merchant } from './models/Merchant';
|
|
20
|
-
export { MerchantProviderConfig } from './models/MerchantProviderConfig';
|
|
21
|
-
export type { Package } from './models/Package';
|
|
22
|
-
export { Payment } from './models/Payment';
|
|
23
17
|
export { SavedCard } from './models/SavedCard';
|
|
24
18
|
export { Subscription } from './models/Subscription';
|
|
25
19
|
export type { TokenizeCardRequest } from './models/TokenizeCardRequest';
|
|
26
|
-
export { UpdateMerchantRequest } from './models/UpdateMerchantRequest';
|
|
27
|
-
export type { UpdatePackageRequest } from './models/UpdatePackageRequest';
|
|
28
20
|
|
|
29
21
|
export { $ConsumeClassResponse } from './schemas/$ConsumeClassResponse';
|
|
30
|
-
export { $CreateMerchantRequest } from './schemas/$CreateMerchantRequest';
|
|
31
|
-
export { $CreatePackageRequest } from './schemas/$CreatePackageRequest';
|
|
32
22
|
export { $CreateSubscriptionRequest } from './schemas/$CreateSubscriptionRequest';
|
|
33
23
|
export { $CreateSubscriptionResponse } from './schemas/$CreateSubscriptionResponse';
|
|
34
24
|
export { $Error } from './schemas/$Error';
|
|
35
|
-
export { $Merchant } from './schemas/$Merchant';
|
|
36
|
-
export { $MerchantProviderConfig } from './schemas/$MerchantProviderConfig';
|
|
37
|
-
export { $Package } from './schemas/$Package';
|
|
38
|
-
export { $Payment } from './schemas/$Payment';
|
|
39
25
|
export { $SavedCard } from './schemas/$SavedCard';
|
|
40
26
|
export { $Subscription } from './schemas/$Subscription';
|
|
41
27
|
export { $TokenizeCardRequest } from './schemas/$TokenizeCardRequest';
|
|
42
|
-
export { $UpdateMerchantRequest } from './schemas/$UpdateMerchantRequest';
|
|
43
|
-
export { $UpdatePackageRequest } from './schemas/$UpdatePackageRequest';
|
|
44
28
|
|
|
45
29
|
export { CardsService } from './services/CardsService';
|
|
46
30
|
export { HealthService } from './services/HealthService';
|
|
47
|
-
export { MerchantsService } from './services/MerchantsService';
|
|
48
|
-
export { PackagesService } from './services/PackagesService';
|
|
49
|
-
export { PaymentsService } from './services/PaymentsService';
|
|
50
31
|
export { SubscriptionsService } from './services/SubscriptionsService';
|
|
32
|
+
export { WebhooksService } from './services/WebhooksService';
|
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
/* tslint:disable */
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
export type CreateSubscriptionRequest = {
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Space ID from jogo-backend
|
|
8
|
+
*/
|
|
9
|
+
spaceId: string;
|
|
10
|
+
/**
|
|
11
|
+
* Plan ID from jogo-backend
|
|
12
|
+
*/
|
|
7
13
|
packageId: string;
|
|
8
14
|
autoRenew?: boolean;
|
|
9
15
|
customerEmail: string;
|
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
/* istanbul ignore file */
|
|
3
3
|
/* tslint:disable */
|
|
4
4
|
/* eslint-disable */
|
|
5
|
-
import type { Package } from './Package';
|
|
6
5
|
export type Subscription = {
|
|
7
6
|
_id?: string;
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Space ID from jogo-backend
|
|
9
|
+
*/
|
|
10
|
+
spaceId?: string;
|
|
9
11
|
/**
|
|
10
12
|
* ID del cliente en jogo-backend
|
|
11
13
|
*/
|
|
12
14
|
customerId?: string;
|
|
13
|
-
|
|
15
|
+
/**
|
|
16
|
+
* ID del plan en jogo-backend
|
|
17
|
+
*/
|
|
18
|
+
planId?: string;
|
|
14
19
|
status?: Subscription.status;
|
|
15
20
|
autoRenew?: boolean;
|
|
16
21
|
classesTotal?: number;
|
|
@@ -19,18 +24,20 @@ export type Subscription = {
|
|
|
19
24
|
* Campo virtual calculado: classesTotal - classesUsed
|
|
20
25
|
*/
|
|
21
26
|
readonly classesRemaining?: number;
|
|
27
|
+
price?: number;
|
|
28
|
+
currency?: string;
|
|
29
|
+
durationDays?: number;
|
|
22
30
|
startDate?: string;
|
|
23
31
|
endDate?: string;
|
|
24
32
|
savedCardId?: string | null;
|
|
25
|
-
lastPaymentId?: string | null;
|
|
26
33
|
createdAt?: string;
|
|
27
34
|
updatedAt?: string;
|
|
28
35
|
};
|
|
29
36
|
export namespace Subscription {
|
|
30
37
|
export enum status {
|
|
31
|
-
|
|
38
|
+
PENDING = 'pending',
|
|
32
39
|
ACTIVE = 'active',
|
|
33
|
-
|
|
40
|
+
DUE = 'due',
|
|
34
41
|
CANCELLED = 'cancelled',
|
|
35
42
|
SUSPENDED = 'suspended',
|
|
36
43
|
}
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
export const $CreateSubscriptionRequest = {
|
|
6
6
|
properties: {
|
|
7
|
-
|
|
7
|
+
spaceId: {
|
|
8
8
|
type: 'string',
|
|
9
|
+
description: `Space ID from jogo-backend`,
|
|
9
10
|
isRequired: true,
|
|
10
11
|
},
|
|
11
12
|
packageId: {
|
|
12
13
|
type: 'string',
|
|
14
|
+
description: `Plan ID from jogo-backend`,
|
|
13
15
|
isRequired: true,
|
|
14
16
|
},
|
|
15
17
|
autoRenew: {
|
|
@@ -7,20 +7,17 @@ export const $Subscription = {
|
|
|
7
7
|
_id: {
|
|
8
8
|
type: 'string',
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
spaceId: {
|
|
11
11
|
type: 'string',
|
|
12
|
+
description: `Space ID from jogo-backend`,
|
|
12
13
|
},
|
|
13
14
|
customerId: {
|
|
14
15
|
type: 'string',
|
|
15
16
|
description: `ID del cliente en jogo-backend`,
|
|
16
17
|
},
|
|
17
|
-
|
|
18
|
-
type: '
|
|
19
|
-
|
|
20
|
-
type: 'string',
|
|
21
|
-
}, {
|
|
22
|
-
type: 'Package',
|
|
23
|
-
}],
|
|
18
|
+
planId: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: `ID del plan en jogo-backend`,
|
|
24
21
|
},
|
|
25
22
|
status: {
|
|
26
23
|
type: 'Enum',
|
|
@@ -39,6 +36,16 @@ export const $Subscription = {
|
|
|
39
36
|
description: `Campo virtual calculado: classesTotal - classesUsed`,
|
|
40
37
|
isReadOnly: true,
|
|
41
38
|
},
|
|
39
|
+
price: {
|
|
40
|
+
type: 'number',
|
|
41
|
+
format: 'float',
|
|
42
|
+
},
|
|
43
|
+
currency: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
},
|
|
46
|
+
durationDays: {
|
|
47
|
+
type: 'number',
|
|
48
|
+
},
|
|
42
49
|
startDate: {
|
|
43
50
|
type: 'string',
|
|
44
51
|
format: 'date-time',
|
|
@@ -51,10 +58,6 @@ export const $Subscription = {
|
|
|
51
58
|
type: 'string',
|
|
52
59
|
isNullable: true,
|
|
53
60
|
},
|
|
54
|
-
lastPaymentId: {
|
|
55
|
-
type: 'string',
|
|
56
|
-
isNullable: true,
|
|
57
|
-
},
|
|
58
61
|
createdAt: {
|
|
59
62
|
type: 'string',
|
|
60
63
|
format: 'date-time',
|
|
@@ -38,21 +38,21 @@ export class CardsService {
|
|
|
38
38
|
* @throws ApiError
|
|
39
39
|
*/
|
|
40
40
|
public getApiV1Cards({
|
|
41
|
-
|
|
41
|
+
spaceId,
|
|
42
42
|
}: {
|
|
43
43
|
/**
|
|
44
44
|
* ID del merchant para filtrar las tarjetas
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
spaceId: string,
|
|
47
47
|
}): CancelablePromise<Array<SavedCard>> {
|
|
48
48
|
return this.httpRequest.request({
|
|
49
49
|
method: 'GET',
|
|
50
50
|
url: '/api/v1/cards',
|
|
51
51
|
query: {
|
|
52
|
-
'
|
|
52
|
+
'spaceId': spaceId,
|
|
53
53
|
},
|
|
54
54
|
errors: {
|
|
55
|
-
400: `
|
|
55
|
+
400: `spaceId requerido`,
|
|
56
56
|
401: `Token JWT ausente o inválido`,
|
|
57
57
|
},
|
|
58
58
|
});
|
|
@@ -70,7 +70,7 @@ export class CardsService {
|
|
|
70
70
|
}: {
|
|
71
71
|
id: string,
|
|
72
72
|
requestBody: {
|
|
73
|
-
|
|
73
|
+
spaceId: string;
|
|
74
74
|
},
|
|
75
75
|
}): CancelablePromise<{
|
|
76
76
|
message?: string;
|
|
@@ -78,7 +78,7 @@ export class SubscriptionsService {
|
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* Detalle de una suscripción
|
|
81
|
-
* @returns Subscription Detalle de la suscripción
|
|
81
|
+
* @returns Subscription Detalle de la suscripción
|
|
82
82
|
* @throws ApiError
|
|
83
83
|
*/
|
|
84
84
|
public getApiV1Subscriptions({
|