@jogolabs/billing-sdk-v2 0.0.3 → 0.0.5
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 -0
- package/dist/billing/src/__generated__/Billing.js +3 -0
- package/dist/billing/src/__generated__/index.d.ts +1 -0
- package/dist/billing/src/__generated__/index.js +3 -1
- package/dist/billing/src/__generated__/services/PaymentsService.d.ts +24 -35
- package/dist/billing/src/__generated__/services/PaymentsService.js +6 -43
- package/dist/billing/src/__generated__/services/WebhooksService.d.ts +2 -1
- package/dist/billing/src/__generated__/services/WebhooksService.js +2 -1
- package/package.json +1 -1
- package/src/billing/src/__generated__/Billing.ts +3 -0
- package/src/billing/src/__generated__/index.ts +1 -0
- package/src/billing/src/__generated__/services/PaymentsService.ts +58 -0
- package/src/billing/src/__generated__/services/WebhooksService.ts +2 -1
|
@@ -2,12 +2,14 @@ import type { BaseHttpRequest } from './core/BaseHttpRequest';
|
|
|
2
2
|
import type { OpenAPIConfig } from './core/OpenAPI';
|
|
3
3
|
import { CardsService } from './services/CardsService';
|
|
4
4
|
import { HealthService } from './services/HealthService';
|
|
5
|
+
import { PaymentsService } from './services/PaymentsService';
|
|
5
6
|
import { SubscriptionsService } from './services/SubscriptionsService';
|
|
6
7
|
import { WebhooksService } from './services/WebhooksService';
|
|
7
8
|
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
8
9
|
export declare class Billing {
|
|
9
10
|
readonly cards: CardsService;
|
|
10
11
|
readonly health: HealthService;
|
|
12
|
+
readonly payments: PaymentsService;
|
|
11
13
|
readonly subscriptions: SubscriptionsService;
|
|
12
14
|
readonly webhooks: WebhooksService;
|
|
13
15
|
readonly request: BaseHttpRequest;
|
|
@@ -4,11 +4,13 @@ exports.Billing = void 0;
|
|
|
4
4
|
const AxiosHttpRequest_1 = require("./core/AxiosHttpRequest");
|
|
5
5
|
const CardsService_1 = require("./services/CardsService");
|
|
6
6
|
const HealthService_1 = require("./services/HealthService");
|
|
7
|
+
const PaymentsService_1 = require("./services/PaymentsService");
|
|
7
8
|
const SubscriptionsService_1 = require("./services/SubscriptionsService");
|
|
8
9
|
const WebhooksService_1 = require("./services/WebhooksService");
|
|
9
10
|
class Billing {
|
|
10
11
|
cards;
|
|
11
12
|
health;
|
|
13
|
+
payments;
|
|
12
14
|
subscriptions;
|
|
13
15
|
webhooks;
|
|
14
16
|
request;
|
|
@@ -26,6 +28,7 @@ class Billing {
|
|
|
26
28
|
});
|
|
27
29
|
this.cards = new CardsService_1.CardsService(this.request);
|
|
28
30
|
this.health = new HealthService_1.HealthService(this.request);
|
|
31
|
+
this.payments = new PaymentsService_1.PaymentsService(this.request);
|
|
29
32
|
this.subscriptions = new SubscriptionsService_1.SubscriptionsService(this.request);
|
|
30
33
|
this.webhooks = new WebhooksService_1.WebhooksService(this.request);
|
|
31
34
|
}
|
|
@@ -20,5 +20,6 @@ export { $Subscription } from './schemas/$Subscription';
|
|
|
20
20
|
export { $TokenizeCardRequest } from './schemas/$TokenizeCardRequest';
|
|
21
21
|
export { CardsService } from './services/CardsService';
|
|
22
22
|
export { HealthService } from './services/HealthService';
|
|
23
|
+
export { PaymentsService } from './services/PaymentsService';
|
|
23
24
|
export { SubscriptionsService } from './services/SubscriptionsService';
|
|
24
25
|
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.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.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;
|
|
4
4
|
/* generated using openapi-typescript-codegen -- do not edit */
|
|
5
5
|
/* istanbul ignore file */
|
|
6
6
|
/* tslint:disable */
|
|
@@ -38,6 +38,8 @@ var CardsService_1 = require("./services/CardsService");
|
|
|
38
38
|
Object.defineProperty(exports, "CardsService", { enumerable: true, get: function () { return CardsService_1.CardsService; } });
|
|
39
39
|
var HealthService_1 = require("./services/HealthService");
|
|
40
40
|
Object.defineProperty(exports, "HealthService", { enumerable: true, get: function () { return HealthService_1.HealthService; } });
|
|
41
|
+
var PaymentsService_1 = require("./services/PaymentsService");
|
|
42
|
+
Object.defineProperty(exports, "PaymentsService", { enumerable: true, get: function () { return PaymentsService_1.PaymentsService; } });
|
|
41
43
|
var SubscriptionsService_1 = require("./services/SubscriptionsService");
|
|
42
44
|
Object.defineProperty(exports, "SubscriptionsService", { enumerable: true, get: function () { return SubscriptionsService_1.SubscriptionsService; } });
|
|
43
45
|
var WebhooksService_1 = require("./services/WebhooksService");
|
|
@@ -1,53 +1,42 @@
|
|
|
1
|
-
import type { Payment } from '../models/Payment';
|
|
2
1
|
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
3
2
|
import type { BaseHttpRequest } from '../core/BaseHttpRequest';
|
|
4
3
|
export declare class PaymentsService {
|
|
5
4
|
readonly httpRequest: BaseHttpRequest;
|
|
6
5
|
constructor(httpRequest: BaseHttpRequest);
|
|
7
6
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
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/{spaceId}`
|
|
7
|
+
* Iniciar cobro Wompi para un payment de jogo-backend
|
|
8
|
+
* Recibe el ID de un Payment ya creado en jogo-backend (status: pending), ejecuta el cobro vía Wompi y retorna el redirectUrl 3DS si aplica. El webhook de Wompi actualizará el status del Payment en jogo-backend al completarse.
|
|
12
9
|
*
|
|
13
|
-
* @returns any
|
|
10
|
+
* @returns any Cobro iniciado. redirectUrl presente si requiere 3DS.
|
|
14
11
|
* @throws ApiError
|
|
15
12
|
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Space ID from jogo-backend
|
|
19
|
-
*/
|
|
20
|
-
spaceId: string;
|
|
13
|
+
postApiV1PaymentsCharge({ requestBody, }: {
|
|
21
14
|
requestBody: {
|
|
22
15
|
/**
|
|
23
|
-
* ID
|
|
16
|
+
* ID del Payment en jogo-backend
|
|
24
17
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
paymentId: string;
|
|
19
|
+
spaceId: string;
|
|
20
|
+
amount: number;
|
|
28
21
|
/**
|
|
29
|
-
*
|
|
22
|
+
* ID de la tarjeta guardada en billing-server (MongoDB _id)
|
|
30
23
|
*/
|
|
31
|
-
|
|
24
|
+
savedCardId: string;
|
|
25
|
+
cvv: string;
|
|
26
|
+
/**
|
|
27
|
+
* Total de clases del plan (opcional, se envía en metadata a Wompi)
|
|
28
|
+
*/
|
|
29
|
+
classesTotal?: number;
|
|
30
|
+
/**
|
|
31
|
+
* ID de la suscripción (opcional, metadata)
|
|
32
|
+
*/
|
|
33
|
+
subscriptionId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* ID del plan (opcional, metadata)
|
|
36
|
+
*/
|
|
37
|
+
planId?: string;
|
|
32
38
|
};
|
|
33
39
|
}): CancelablePromise<{
|
|
34
|
-
|
|
40
|
+
redirectUrl?: string | null;
|
|
35
41
|
}>;
|
|
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
42
|
}
|
|
@@ -7,57 +7,20 @@ class PaymentsService {
|
|
|
7
7
|
this.httpRequest = httpRequest;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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/{spaceId}`
|
|
10
|
+
* Iniciar cobro Wompi para un payment de jogo-backend
|
|
11
|
+
* Recibe el ID de un Payment ya creado en jogo-backend (status: pending), ejecuta el cobro vía Wompi y retorna el redirectUrl 3DS si aplica. El webhook de Wompi actualizará el status del Payment en jogo-backend al completarse.
|
|
14
12
|
*
|
|
15
|
-
* @returns any
|
|
13
|
+
* @returns any Cobro iniciado. redirectUrl presente si requiere 3DS.
|
|
16
14
|
* @throws ApiError
|
|
17
15
|
*/
|
|
18
|
-
|
|
16
|
+
postApiV1PaymentsCharge({ requestBody, }) {
|
|
19
17
|
return this.httpRequest.request({
|
|
20
18
|
method: 'POST',
|
|
21
|
-
url: '/api/v1/
|
|
22
|
-
path: {
|
|
23
|
-
'spaceId': spaceId,
|
|
24
|
-
},
|
|
19
|
+
url: '/api/v1/payments/charge',
|
|
25
20
|
body: requestBody,
|
|
26
21
|
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
22
|
errors: {
|
|
23
|
+
400: `Parámetros faltantes o tarjeta no encontrada`,
|
|
61
24
|
401: `Token JWT ausente o inválido`,
|
|
62
25
|
},
|
|
63
26
|
});
|
|
@@ -6,7 +6,8 @@ export declare class WebhooksService {
|
|
|
6
6
|
/**
|
|
7
7
|
* Webhook de notificación de Wompi
|
|
8
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"`:
|
|
9
|
+
* Al recibir `ResultadoTransaccion: "ExitosaAprobada"`: - Actualiza el Payment en jogo-backend a `completed` con responseLog, paymentRefId y paymentMethodId. El hook de Keystone en jogo-backend propaga el status al Credit automáticamente.
|
|
10
|
+
* En caso de `Rechazada`, `NoAprobada` o `Error`: - Actualiza el Payment a `canceled`.
|
|
10
11
|
*
|
|
11
12
|
* @returns any Webhook recibido y procesado
|
|
12
13
|
* @throws ApiError
|
|
@@ -9,7 +9,8 @@ class WebhooksService {
|
|
|
9
9
|
/**
|
|
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
|
-
* Al recibir `ResultadoTransaccion: "ExitosaAprobada"`:
|
|
12
|
+
* Al recibir `ResultadoTransaccion: "ExitosaAprobada"`: - Actualiza el Payment en jogo-backend a `completed` con responseLog, paymentRefId y paymentMethodId. El hook de Keystone en jogo-backend propaga el status al Credit automáticamente.
|
|
13
|
+
* En caso de `Rechazada`, `NoAprobada` o `Error`: - Actualiza el Payment a `canceled`.
|
|
13
14
|
*
|
|
14
15
|
* @returns any Webhook recibido y procesado
|
|
15
16
|
* @throws ApiError
|
package/package.json
CHANGED
|
@@ -7,12 +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 { PaymentsService } from './services/PaymentsService';
|
|
10
11
|
import { SubscriptionsService } from './services/SubscriptionsService';
|
|
11
12
|
import { WebhooksService } from './services/WebhooksService';
|
|
12
13
|
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
13
14
|
export class Billing {
|
|
14
15
|
public readonly cards: CardsService;
|
|
15
16
|
public readonly health: HealthService;
|
|
17
|
+
public readonly payments: PaymentsService;
|
|
16
18
|
public readonly subscriptions: SubscriptionsService;
|
|
17
19
|
public readonly webhooks: WebhooksService;
|
|
18
20
|
public readonly request: BaseHttpRequest;
|
|
@@ -30,6 +32,7 @@ export class Billing {
|
|
|
30
32
|
});
|
|
31
33
|
this.cards = new CardsService(this.request);
|
|
32
34
|
this.health = new HealthService(this.request);
|
|
35
|
+
this.payments = new PaymentsService(this.request);
|
|
33
36
|
this.subscriptions = new SubscriptionsService(this.request);
|
|
34
37
|
this.webhooks = new WebhooksService(this.request);
|
|
35
38
|
}
|
|
@@ -28,5 +28,6 @@ export { $TokenizeCardRequest } from './schemas/$TokenizeCardRequest';
|
|
|
28
28
|
|
|
29
29
|
export { CardsService } from './services/CardsService';
|
|
30
30
|
export { HealthService } from './services/HealthService';
|
|
31
|
+
export { PaymentsService } from './services/PaymentsService';
|
|
31
32
|
export { SubscriptionsService } from './services/SubscriptionsService';
|
|
32
33
|
export { WebhooksService } from './services/WebhooksService';
|
|
@@ -0,0 +1,58 @@
|
|
|
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 PaymentsService {
|
|
8
|
+
constructor(public readonly httpRequest: BaseHttpRequest) {}
|
|
9
|
+
/**
|
|
10
|
+
* Iniciar cobro Wompi para un payment de jogo-backend
|
|
11
|
+
* Recibe el ID de un Payment ya creado en jogo-backend (status: pending), ejecuta el cobro vía Wompi y retorna el redirectUrl 3DS si aplica. El webhook de Wompi actualizará el status del Payment en jogo-backend al completarse.
|
|
12
|
+
*
|
|
13
|
+
* @returns any Cobro iniciado. redirectUrl presente si requiere 3DS.
|
|
14
|
+
* @throws ApiError
|
|
15
|
+
*/
|
|
16
|
+
public postApiV1PaymentsCharge({
|
|
17
|
+
requestBody,
|
|
18
|
+
}: {
|
|
19
|
+
requestBody: {
|
|
20
|
+
/**
|
|
21
|
+
* ID del Payment en jogo-backend
|
|
22
|
+
*/
|
|
23
|
+
paymentId: string;
|
|
24
|
+
spaceId: string;
|
|
25
|
+
amount: number;
|
|
26
|
+
/**
|
|
27
|
+
* ID de la tarjeta guardada en billing-server (MongoDB _id)
|
|
28
|
+
*/
|
|
29
|
+
savedCardId: string;
|
|
30
|
+
cvv: string;
|
|
31
|
+
/**
|
|
32
|
+
* Total de clases del plan (opcional, se envía en metadata a Wompi)
|
|
33
|
+
*/
|
|
34
|
+
classesTotal?: number;
|
|
35
|
+
/**
|
|
36
|
+
* ID de la suscripción (opcional, metadata)
|
|
37
|
+
*/
|
|
38
|
+
subscriptionId?: string;
|
|
39
|
+
/**
|
|
40
|
+
* ID del plan (opcional, metadata)
|
|
41
|
+
*/
|
|
42
|
+
planId?: string;
|
|
43
|
+
},
|
|
44
|
+
}): CancelablePromise<{
|
|
45
|
+
redirectUrl?: string | null;
|
|
46
|
+
}> {
|
|
47
|
+
return this.httpRequest.request({
|
|
48
|
+
method: 'POST',
|
|
49
|
+
url: '/api/v1/payments/charge',
|
|
50
|
+
body: requestBody,
|
|
51
|
+
mediaType: 'application/json',
|
|
52
|
+
errors: {
|
|
53
|
+
400: `Parámetros faltantes o tarjeta no encontrada`,
|
|
54
|
+
401: `Token JWT ausente o inválido`,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -9,7 +9,8 @@ export class WebhooksService {
|
|
|
9
9
|
/**
|
|
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
|
-
* Al recibir `ResultadoTransaccion: "ExitosaAprobada"`:
|
|
12
|
+
* Al recibir `ResultadoTransaccion: "ExitosaAprobada"`: - Actualiza el Payment en jogo-backend a `completed` con responseLog, paymentRefId y paymentMethodId. El hook de Keystone en jogo-backend propaga el status al Credit automáticamente.
|
|
13
|
+
* En caso de `Rechazada`, `NoAprobada` o `Error`: - Actualiza el Payment a `canceled`.
|
|
13
14
|
*
|
|
14
15
|
* @returns any Webhook recibido y procesado
|
|
15
16
|
* @throws ApiError
|