@jogolabs/billing-sdk-v2 0.0.2 → 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.
Files changed (43) hide show
  1. package/dist/billing/src/__generated__/Billing.d.ts +2 -6
  2. package/dist/billing/src/__generated__/Billing.js +3 -9
  3. package/dist/billing/src/__generated__/index.d.ts +1 -19
  4. package/dist/billing/src/__generated__/index.js +3 -33
  5. package/dist/billing/src/__generated__/models/CreateSubscriptionRequest.d.ts +3 -0
  6. package/dist/billing/src/__generated__/models/Subscription.d.ts +9 -5
  7. package/dist/billing/src/__generated__/models/Subscription.js +2 -2
  8. package/dist/billing/src/__generated__/schemas/$CreateSubscriptionRequest.d.ts +1 -0
  9. package/dist/billing/src/__generated__/schemas/$CreateSubscriptionRequest.js +1 -0
  10. package/dist/billing/src/__generated__/schemas/$Subscription.d.ts +13 -11
  11. package/dist/billing/src/__generated__/schemas/$Subscription.js +13 -11
  12. package/dist/billing/src/__generated__/services/SubscriptionsService.d.ts +1 -1
  13. package/dist/billing/src/__generated__/services/SubscriptionsService.js +1 -1
  14. package/dist/billing/src/__generated__/services/WebhooksService.d.ts +29 -0
  15. package/dist/billing/src/__generated__/services/WebhooksService.js +26 -0
  16. package/package.json +1 -1
  17. package/src/billing/src/__generated__/Billing.ts +3 -9
  18. package/src/billing/src/__generated__/index.ts +1 -19
  19. package/src/billing/src/__generated__/models/CreateSubscriptionRequest.ts +3 -0
  20. package/src/billing/src/__generated__/models/Subscription.ts +9 -5
  21. package/src/billing/src/__generated__/schemas/$CreateSubscriptionRequest.ts +1 -0
  22. package/src/billing/src/__generated__/schemas/$Subscription.ts +13 -11
  23. package/src/billing/src/__generated__/services/SubscriptionsService.ts +1 -1
  24. package/src/billing/src/__generated__/services/WebhooksService.ts +41 -0
  25. package/src/billing/src/__generated__/models/CreateMerchantRequest.ts +0 -31
  26. package/src/billing/src/__generated__/models/CreatePackageRequest.ts +0 -13
  27. package/src/billing/src/__generated__/models/Merchant.ts +0 -25
  28. package/src/billing/src/__generated__/models/MerchantProviderConfig.ts +0 -20
  29. package/src/billing/src/__generated__/models/Package.ts +0 -22
  30. package/src/billing/src/__generated__/models/Payment.ts +0 -40
  31. package/src/billing/src/__generated__/models/UpdateMerchantRequest.ts +0 -21
  32. package/src/billing/src/__generated__/models/UpdatePackageRequest.ts +0 -14
  33. package/src/billing/src/__generated__/schemas/$CreateMerchantRequest.ts +0 -44
  34. package/src/billing/src/__generated__/schemas/$CreatePackageRequest.ts +0 -32
  35. package/src/billing/src/__generated__/schemas/$Merchant.ts +0 -39
  36. package/src/billing/src/__generated__/schemas/$MerchantProviderConfig.ts +0 -23
  37. package/src/billing/src/__generated__/schemas/$Package.ts +0 -48
  38. package/src/billing/src/__generated__/schemas/$Payment.ts +0 -48
  39. package/src/billing/src/__generated__/schemas/$UpdateMerchantRequest.ts +0 -35
  40. package/src/billing/src/__generated__/schemas/$UpdatePackageRequest.ts +0 -31
  41. package/src/billing/src/__generated__/services/MerchantsService.ts +0 -90
  42. package/src/billing/src/__generated__/services/PackagesService.ts +0 -150
  43. package/src/billing/src/__generated__/services/PaymentsService.ts +0 -96
@@ -2,18 +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 { MerchantsService } from './services/MerchantsService';
6
- import { PackagesService } from './services/PackagesService';
7
- import { PaymentsService } from './services/PaymentsService';
8
5
  import { SubscriptionsService } from './services/SubscriptionsService';
6
+ import { WebhooksService } from './services/WebhooksService';
9
7
  type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
10
8
  export declare class Billing {
11
9
  readonly cards: CardsService;
12
10
  readonly health: HealthService;
13
- readonly merchants: MerchantsService;
14
- readonly packages: PackagesService;
15
- readonly payments: PaymentsService;
16
11
  readonly subscriptions: SubscriptionsService;
12
+ readonly webhooks: WebhooksService;
17
13
  readonly request: BaseHttpRequest;
18
14
  constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
19
15
  }
@@ -4,17 +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 MerchantsService_1 = require("./services/MerchantsService");
8
- const PackagesService_1 = require("./services/PackagesService");
9
- const PaymentsService_1 = require("./services/PaymentsService");
10
7
  const SubscriptionsService_1 = require("./services/SubscriptionsService");
8
+ const WebhooksService_1 = require("./services/WebhooksService");
11
9
  class Billing {
12
10
  cards;
13
11
  health;
14
- merchants;
15
- packages;
16
- payments;
17
12
  subscriptions;
13
+ webhooks;
18
14
  request;
19
15
  constructor(config, HttpRequest = AxiosHttpRequest_1.AxiosHttpRequest) {
20
16
  this.request = new HttpRequest({
@@ -30,10 +26,8 @@ class Billing {
30
26
  });
31
27
  this.cards = new CardsService_1.CardsService(this.request);
32
28
  this.health = new HealthService_1.HealthService(this.request);
33
- this.merchants = new MerchantsService_1.MerchantsService(this.request);
34
- this.packages = new PackagesService_1.PackagesService(this.request);
35
- this.payments = new PaymentsService_1.PaymentsService(this.request);
36
29
  this.subscriptions = new SubscriptionsService_1.SubscriptionsService(this.request);
30
+ this.webhooks = new WebhooksService_1.WebhooksService(this.request);
37
31
  }
38
32
  }
39
33
  exports.Billing = Billing;
@@ -5,38 +5,20 @@ export { CancelablePromise, CancelError } from './core/CancelablePromise';
5
5
  export { OpenAPI } from './core/OpenAPI';
6
6
  export type { OpenAPIConfig } from './core/OpenAPI';
7
7
  export type { ConsumeClassResponse } from './models/ConsumeClassResponse';
8
- export { CreateMerchantRequest } from './models/CreateMerchantRequest';
9
- export type { CreatePackageRequest } from './models/CreatePackageRequest';
10
8
  export type { CreateSubscriptionRequest } from './models/CreateSubscriptionRequest';
11
9
  export type { CreateSubscriptionResponse } from './models/CreateSubscriptionResponse';
12
10
  export type { Error } from './models/Error';
13
- export { Merchant } from './models/Merchant';
14
- export { MerchantProviderConfig } from './models/MerchantProviderConfig';
15
- export type { Package } from './models/Package';
16
- export { Payment } from './models/Payment';
17
11
  export { SavedCard } from './models/SavedCard';
18
12
  export { Subscription } from './models/Subscription';
19
13
  export type { TokenizeCardRequest } from './models/TokenizeCardRequest';
20
- export { UpdateMerchantRequest } from './models/UpdateMerchantRequest';
21
- export type { UpdatePackageRequest } from './models/UpdatePackageRequest';
22
14
  export { $ConsumeClassResponse } from './schemas/$ConsumeClassResponse';
23
- export { $CreateMerchantRequest } from './schemas/$CreateMerchantRequest';
24
- export { $CreatePackageRequest } from './schemas/$CreatePackageRequest';
25
15
  export { $CreateSubscriptionRequest } from './schemas/$CreateSubscriptionRequest';
26
16
  export { $CreateSubscriptionResponse } from './schemas/$CreateSubscriptionResponse';
27
17
  export { $Error } from './schemas/$Error';
28
- export { $Merchant } from './schemas/$Merchant';
29
- export { $MerchantProviderConfig } from './schemas/$MerchantProviderConfig';
30
- export { $Package } from './schemas/$Package';
31
- export { $Payment } from './schemas/$Payment';
32
18
  export { $SavedCard } from './schemas/$SavedCard';
33
19
  export { $Subscription } from './schemas/$Subscription';
34
20
  export { $TokenizeCardRequest } from './schemas/$TokenizeCardRequest';
35
- export { $UpdateMerchantRequest } from './schemas/$UpdateMerchantRequest';
36
- export { $UpdatePackageRequest } from './schemas/$UpdatePackageRequest';
37
21
  export { CardsService } from './services/CardsService';
38
22
  export { HealthService } from './services/HealthService';
39
- export { MerchantsService } from './services/MerchantsService';
40
- export { PackagesService } from './services/PackagesService';
41
- export { PaymentsService } from './services/PaymentsService';
42
23
  export { SubscriptionsService } from './services/SubscriptionsService';
24
+ export { WebhooksService } from './services/WebhooksService';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubscriptionsService = exports.PaymentsService = exports.PackagesService = exports.MerchantsService = exports.HealthService = exports.CardsService = exports.$UpdatePackageRequest = exports.$UpdateMerchantRequest = exports.$TokenizeCardRequest = exports.$Subscription = exports.$SavedCard = exports.$Payment = exports.$Package = exports.$MerchantProviderConfig = exports.$Merchant = exports.$Error = exports.$CreateSubscriptionResponse = exports.$CreateSubscriptionRequest = exports.$CreatePackageRequest = exports.$CreateMerchantRequest = exports.$ConsumeClassResponse = exports.UpdateMerchantRequest = exports.Subscription = exports.SavedCard = exports.Payment = exports.MerchantProviderConfig = exports.Merchant = exports.CreateMerchantRequest = exports.OpenAPI = exports.CancelError = exports.CancelablePromise = exports.BaseHttpRequest = exports.ApiError = exports.Billing = void 0;
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;
4
4
  /* generated using openapi-typescript-codegen -- do not edit */
5
5
  /* istanbul ignore file */
6
6
  /* tslint:disable */
@@ -16,59 +16,29 @@ Object.defineProperty(exports, "CancelablePromise", { enumerable: true, get: fun
16
16
  Object.defineProperty(exports, "CancelError", { enumerable: true, get: function () { return CancelablePromise_1.CancelError; } });
17
17
  var OpenAPI_1 = require("./core/OpenAPI");
18
18
  Object.defineProperty(exports, "OpenAPI", { enumerable: true, get: function () { return OpenAPI_1.OpenAPI; } });
19
- var CreateMerchantRequest_1 = require("./models/CreateMerchantRequest");
20
- Object.defineProperty(exports, "CreateMerchantRequest", { enumerable: true, get: function () { return CreateMerchantRequest_1.CreateMerchantRequest; } });
21
- var Merchant_1 = require("./models/Merchant");
22
- Object.defineProperty(exports, "Merchant", { enumerable: true, get: function () { return Merchant_1.Merchant; } });
23
- var MerchantProviderConfig_1 = require("./models/MerchantProviderConfig");
24
- Object.defineProperty(exports, "MerchantProviderConfig", { enumerable: true, get: function () { return MerchantProviderConfig_1.MerchantProviderConfig; } });
25
- var Payment_1 = require("./models/Payment");
26
- Object.defineProperty(exports, "Payment", { enumerable: true, get: function () { return Payment_1.Payment; } });
27
19
  var SavedCard_1 = require("./models/SavedCard");
28
20
  Object.defineProperty(exports, "SavedCard", { enumerable: true, get: function () { return SavedCard_1.SavedCard; } });
29
21
  var Subscription_1 = require("./models/Subscription");
30
22
  Object.defineProperty(exports, "Subscription", { enumerable: true, get: function () { return Subscription_1.Subscription; } });
31
- var UpdateMerchantRequest_1 = require("./models/UpdateMerchantRequest");
32
- Object.defineProperty(exports, "UpdateMerchantRequest", { enumerable: true, get: function () { return UpdateMerchantRequest_1.UpdateMerchantRequest; } });
33
23
  var _ConsumeClassResponse_1 = require("./schemas/$ConsumeClassResponse");
34
24
  Object.defineProperty(exports, "$ConsumeClassResponse", { enumerable: true, get: function () { return _ConsumeClassResponse_1.$ConsumeClassResponse; } });
35
- var _CreateMerchantRequest_1 = require("./schemas/$CreateMerchantRequest");
36
- Object.defineProperty(exports, "$CreateMerchantRequest", { enumerable: true, get: function () { return _CreateMerchantRequest_1.$CreateMerchantRequest; } });
37
- var _CreatePackageRequest_1 = require("./schemas/$CreatePackageRequest");
38
- Object.defineProperty(exports, "$CreatePackageRequest", { enumerable: true, get: function () { return _CreatePackageRequest_1.$CreatePackageRequest; } });
39
25
  var _CreateSubscriptionRequest_1 = require("./schemas/$CreateSubscriptionRequest");
40
26
  Object.defineProperty(exports, "$CreateSubscriptionRequest", { enumerable: true, get: function () { return _CreateSubscriptionRequest_1.$CreateSubscriptionRequest; } });
41
27
  var _CreateSubscriptionResponse_1 = require("./schemas/$CreateSubscriptionResponse");
42
28
  Object.defineProperty(exports, "$CreateSubscriptionResponse", { enumerable: true, get: function () { return _CreateSubscriptionResponse_1.$CreateSubscriptionResponse; } });
43
29
  var _Error_1 = require("./schemas/$Error");
44
30
  Object.defineProperty(exports, "$Error", { enumerable: true, get: function () { return _Error_1.$Error; } });
45
- var _Merchant_1 = require("./schemas/$Merchant");
46
- Object.defineProperty(exports, "$Merchant", { enumerable: true, get: function () { return _Merchant_1.$Merchant; } });
47
- var _MerchantProviderConfig_1 = require("./schemas/$MerchantProviderConfig");
48
- Object.defineProperty(exports, "$MerchantProviderConfig", { enumerable: true, get: function () { return _MerchantProviderConfig_1.$MerchantProviderConfig; } });
49
- var _Package_1 = require("./schemas/$Package");
50
- Object.defineProperty(exports, "$Package", { enumerable: true, get: function () { return _Package_1.$Package; } });
51
- var _Payment_1 = require("./schemas/$Payment");
52
- Object.defineProperty(exports, "$Payment", { enumerable: true, get: function () { return _Payment_1.$Payment; } });
53
31
  var _SavedCard_1 = require("./schemas/$SavedCard");
54
32
  Object.defineProperty(exports, "$SavedCard", { enumerable: true, get: function () { return _SavedCard_1.$SavedCard; } });
55
33
  var _Subscription_1 = require("./schemas/$Subscription");
56
34
  Object.defineProperty(exports, "$Subscription", { enumerable: true, get: function () { return _Subscription_1.$Subscription; } });
57
35
  var _TokenizeCardRequest_1 = require("./schemas/$TokenizeCardRequest");
58
36
  Object.defineProperty(exports, "$TokenizeCardRequest", { enumerable: true, get: function () { return _TokenizeCardRequest_1.$TokenizeCardRequest; } });
59
- var _UpdateMerchantRequest_1 = require("./schemas/$UpdateMerchantRequest");
60
- Object.defineProperty(exports, "$UpdateMerchantRequest", { enumerable: true, get: function () { return _UpdateMerchantRequest_1.$UpdateMerchantRequest; } });
61
- var _UpdatePackageRequest_1 = require("./schemas/$UpdatePackageRequest");
62
- Object.defineProperty(exports, "$UpdatePackageRequest", { enumerable: true, get: function () { return _UpdatePackageRequest_1.$UpdatePackageRequest; } });
63
37
  var CardsService_1 = require("./services/CardsService");
64
38
  Object.defineProperty(exports, "CardsService", { enumerable: true, get: function () { return CardsService_1.CardsService; } });
65
39
  var HealthService_1 = require("./services/HealthService");
66
40
  Object.defineProperty(exports, "HealthService", { enumerable: true, get: function () { return HealthService_1.HealthService; } });
67
- var MerchantsService_1 = require("./services/MerchantsService");
68
- Object.defineProperty(exports, "MerchantsService", { enumerable: true, get: function () { return MerchantsService_1.MerchantsService; } });
69
- var PackagesService_1 = require("./services/PackagesService");
70
- Object.defineProperty(exports, "PackagesService", { enumerable: true, get: function () { return PackagesService_1.PackagesService; } });
71
- var PaymentsService_1 = require("./services/PaymentsService");
72
- Object.defineProperty(exports, "PaymentsService", { enumerable: true, get: function () { return PaymentsService_1.PaymentsService; } });
73
41
  var SubscriptionsService_1 = require("./services/SubscriptionsService");
74
42
  Object.defineProperty(exports, "SubscriptionsService", { enumerable: true, get: function () { return SubscriptionsService_1.SubscriptionsService; } });
43
+ var WebhooksService_1 = require("./services/WebhooksService");
44
+ Object.defineProperty(exports, "WebhooksService", { enumerable: true, get: function () { return WebhooksService_1.WebhooksService; } });
@@ -3,6 +3,9 @@ export type CreateSubscriptionRequest = {
3
3
  * Space ID from jogo-backend
4
4
  */
5
5
  spaceId: string;
6
+ /**
7
+ * Plan ID from jogo-backend
8
+ */
6
9
  packageId: string;
7
10
  autoRenew?: boolean;
8
11
  customerEmail: string;
@@ -1,4 +1,3 @@
1
- import type { Package } from './Package';
2
1
  export type Subscription = {
3
2
  _id?: string;
4
3
  /**
@@ -9,7 +8,10 @@ export type Subscription = {
9
8
  * ID del cliente en jogo-backend
10
9
  */
11
10
  customerId?: string;
12
- packageId?: (string | Package);
11
+ /**
12
+ * ID del plan en jogo-backend
13
+ */
14
+ planId?: string;
13
15
  status?: Subscription.status;
14
16
  autoRenew?: boolean;
15
17
  classesTotal?: number;
@@ -18,18 +20,20 @@ export type Subscription = {
18
20
  * Campo virtual calculado: classesTotal - classesUsed
19
21
  */
20
22
  readonly classesRemaining?: number;
23
+ price?: number;
24
+ currency?: string;
25
+ durationDays?: number;
21
26
  startDate?: string;
22
27
  endDate?: string;
23
28
  savedCardId?: string | null;
24
- lastPaymentId?: string | null;
25
29
  createdAt?: string;
26
30
  updatedAt?: string;
27
31
  };
28
32
  export declare namespace Subscription {
29
33
  enum status {
30
- PENDING_PAYMENT = "pending_payment",
34
+ PENDING = "pending",
31
35
  ACTIVE = "active",
32
- EXPIRED = "expired",
36
+ DUE = "due",
33
37
  CANCELLED = "cancelled",
34
38
  SUSPENDED = "suspended"
35
39
  }
@@ -5,9 +5,9 @@ var Subscription;
5
5
  (function (Subscription) {
6
6
  let status;
7
7
  (function (status) {
8
- status["PENDING_PAYMENT"] = "pending_payment";
8
+ status["PENDING"] = "pending";
9
9
  status["ACTIVE"] = "active";
10
- status["EXPIRED"] = "expired";
10
+ status["DUE"] = "due";
11
11
  status["CANCELLED"] = "cancelled";
12
12
  status["SUSPENDED"] = "suspended";
13
13
  })(status = Subscription.status || (Subscription.status = {}));
@@ -7,6 +7,7 @@ export declare const $CreateSubscriptionRequest: {
7
7
  };
8
8
  readonly packageId: {
9
9
  readonly type: "string";
10
+ readonly description: "Plan ID from jogo-backend";
10
11
  readonly isRequired: true;
11
12
  };
12
13
  readonly autoRenew: {
@@ -14,6 +14,7 @@ exports.$CreateSubscriptionRequest = {
14
14
  },
15
15
  packageId: {
16
16
  type: 'string',
17
+ description: `Plan ID from jogo-backend`,
17
18
  isRequired: true,
18
19
  },
19
20
  autoRenew: {
@@ -11,13 +11,9 @@ export declare const $Subscription: {
11
11
  readonly type: "string";
12
12
  readonly description: "ID del cliente en jogo-backend";
13
13
  };
14
- readonly packageId: {
15
- readonly type: "one-of";
16
- readonly contains: readonly [{
17
- readonly type: "string";
18
- }, {
19
- readonly type: "Package";
20
- }];
14
+ readonly planId: {
15
+ readonly type: "string";
16
+ readonly description: "ID del plan en jogo-backend";
21
17
  };
22
18
  readonly status: {
23
19
  readonly type: "Enum";
@@ -36,6 +32,16 @@ export declare const $Subscription: {
36
32
  readonly description: "Campo virtual calculado: classesTotal - classesUsed";
37
33
  readonly isReadOnly: true;
38
34
  };
35
+ readonly price: {
36
+ readonly type: "number";
37
+ readonly format: "float";
38
+ };
39
+ readonly currency: {
40
+ readonly type: "string";
41
+ };
42
+ readonly durationDays: {
43
+ readonly type: "number";
44
+ };
39
45
  readonly startDate: {
40
46
  readonly type: "string";
41
47
  readonly format: "date-time";
@@ -48,10 +54,6 @@ export declare const $Subscription: {
48
54
  readonly type: "string";
49
55
  readonly isNullable: true;
50
56
  };
51
- readonly lastPaymentId: {
52
- readonly type: "string";
53
- readonly isNullable: true;
54
- };
55
57
  readonly createdAt: {
56
58
  readonly type: "string";
57
59
  readonly format: "date-time";
@@ -18,13 +18,9 @@ exports.$Subscription = {
18
18
  type: 'string',
19
19
  description: `ID del cliente en jogo-backend`,
20
20
  },
21
- packageId: {
22
- type: 'one-of',
23
- contains: [{
24
- type: 'string',
25
- }, {
26
- type: 'Package',
27
- }],
21
+ planId: {
22
+ type: 'string',
23
+ description: `ID del plan en jogo-backend`,
28
24
  },
29
25
  status: {
30
26
  type: 'Enum',
@@ -43,6 +39,16 @@ exports.$Subscription = {
43
39
  description: `Campo virtual calculado: classesTotal - classesUsed`,
44
40
  isReadOnly: true,
45
41
  },
42
+ price: {
43
+ type: 'number',
44
+ format: 'float',
45
+ },
46
+ currency: {
47
+ type: 'string',
48
+ },
49
+ durationDays: {
50
+ type: 'number',
51
+ },
46
52
  startDate: {
47
53
  type: 'string',
48
54
  format: 'date-time',
@@ -55,10 +61,6 @@ exports.$Subscription = {
55
61
  type: 'string',
56
62
  isNullable: true,
57
63
  },
58
- lastPaymentId: {
59
- type: 'string',
60
- isNullable: true,
61
- },
62
64
  createdAt: {
63
65
  type: 'string',
64
66
  format: 'date-time',
@@ -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 con info del paquete populada
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 con info del paquete populada
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jogolabs/billing-sdk-v2",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Billing SDK v2 to Jogo Labs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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';
@@ -7,6 +7,9 @@ export type CreateSubscriptionRequest = {
7
7
  * Space ID from jogo-backend
8
8
  */
9
9
  spaceId: string;
10
+ /**
11
+ * Plan ID from jogo-backend
12
+ */
10
13
  packageId: string;
11
14
  autoRenew?: boolean;
12
15
  customerEmail: string;
@@ -2,7 +2,6 @@
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
  /**
@@ -13,7 +12,10 @@ export type Subscription = {
13
12
  * ID del cliente en jogo-backend
14
13
  */
15
14
  customerId?: string;
16
- packageId?: (string | Package);
15
+ /**
16
+ * ID del plan en jogo-backend
17
+ */
18
+ planId?: string;
17
19
  status?: Subscription.status;
18
20
  autoRenew?: boolean;
19
21
  classesTotal?: number;
@@ -22,18 +24,20 @@ export type Subscription = {
22
24
  * Campo virtual calculado: classesTotal - classesUsed
23
25
  */
24
26
  readonly classesRemaining?: number;
27
+ price?: number;
28
+ currency?: string;
29
+ durationDays?: number;
25
30
  startDate?: string;
26
31
  endDate?: string;
27
32
  savedCardId?: string | null;
28
- lastPaymentId?: string | null;
29
33
  createdAt?: string;
30
34
  updatedAt?: string;
31
35
  };
32
36
  export namespace Subscription {
33
37
  export enum status {
34
- PENDING_PAYMENT = 'pending_payment',
38
+ PENDING = 'pending',
35
39
  ACTIVE = 'active',
36
- EXPIRED = 'expired',
40
+ DUE = 'due',
37
41
  CANCELLED = 'cancelled',
38
42
  SUSPENDED = 'suspended',
39
43
  }
@@ -11,6 +11,7 @@ export const $CreateSubscriptionRequest = {
11
11
  },
12
12
  packageId: {
13
13
  type: 'string',
14
+ description: `Plan ID from jogo-backend`,
14
15
  isRequired: true,
15
16
  },
16
17
  autoRenew: {
@@ -15,13 +15,9 @@ export const $Subscription = {
15
15
  type: 'string',
16
16
  description: `ID del cliente en jogo-backend`,
17
17
  },
18
- packageId: {
19
- type: 'one-of',
20
- contains: [{
21
- type: 'string',
22
- }, {
23
- type: 'Package',
24
- }],
18
+ planId: {
19
+ type: 'string',
20
+ description: `ID del plan en jogo-backend`,
25
21
  },
26
22
  status: {
27
23
  type: 'Enum',
@@ -40,6 +36,16 @@ export const $Subscription = {
40
36
  description: `Campo virtual calculado: classesTotal - classesUsed`,
41
37
  isReadOnly: true,
42
38
  },
39
+ price: {
40
+ type: 'number',
41
+ format: 'float',
42
+ },
43
+ currency: {
44
+ type: 'string',
45
+ },
46
+ durationDays: {
47
+ type: 'number',
48
+ },
43
49
  startDate: {
44
50
  type: 'string',
45
51
  format: 'date-time',
@@ -52,10 +58,6 @@ export const $Subscription = {
52
58
  type: 'string',
53
59
  isNullable: true,
54
60
  },
55
- lastPaymentId: {
56
- type: 'string',
57
- isNullable: true,
58
- },
59
61
  createdAt: {
60
62
  type: 'string',
61
63
  format: 'date-time',
@@ -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 con info del paquete populada
81
+ * @returns Subscription Detalle de la suscripción
82
82
  * @throws ApiError
83
83
  */
84
84
  public getApiV1Subscriptions({