@venturialstd/kira 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 (66) hide show
  1. package/README.md +213 -0
  2. package/dist/clients/kira.client.d.ts +14 -0
  3. package/dist/clients/kira.client.d.ts.map +1 -0
  4. package/dist/clients/kira.client.js +49 -0
  5. package/dist/clients/kira.client.js.map +1 -0
  6. package/dist/constants/index.d.ts +4 -0
  7. package/dist/constants/index.d.ts.map +1 -0
  8. package/dist/constants/index.js +20 -0
  9. package/dist/constants/index.js.map +1 -0
  10. package/dist/constants/kira-payment.constant.d.ts +211 -0
  11. package/dist/constants/kira-payment.constant.d.ts.map +1 -0
  12. package/dist/constants/kira-payment.constant.js +236 -0
  13. package/dist/constants/kira-payment.constant.js.map +1 -0
  14. package/dist/constants/kira.constant.d.ts +11 -0
  15. package/dist/constants/kira.constant.d.ts.map +1 -0
  16. package/dist/constants/kira.constant.js +16 -0
  17. package/dist/constants/kira.constant.js.map +1 -0
  18. package/dist/constants/kira.settings.constant.d.ts +7 -0
  19. package/dist/constants/kira.settings.constant.d.ts.map +1 -0
  20. package/dist/constants/kira.settings.constant.js +10 -0
  21. package/dist/constants/kira.settings.constant.js.map +1 -0
  22. package/dist/entities/index.d.ts +2 -0
  23. package/dist/entities/index.d.ts.map +1 -0
  24. package/dist/entities/index.js +18 -0
  25. package/dist/entities/index.js.map +1 -0
  26. package/dist/entities/kira-payment-link.entity.d.ts +26 -0
  27. package/dist/entities/kira-payment-link.entity.d.ts.map +1 -0
  28. package/dist/entities/kira-payment-link.entity.js +177 -0
  29. package/dist/entities/kira-payment-link.entity.js.map +1 -0
  30. package/dist/index.d.ts +12 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +28 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/kira.module.d.ts +3 -0
  35. package/dist/kira.module.d.ts.map +1 -0
  36. package/dist/kira.module.js +33 -0
  37. package/dist/kira.module.js.map +1 -0
  38. package/dist/services/index.d.ts +4 -0
  39. package/dist/services/index.d.ts.map +1 -0
  40. package/dist/services/index.js +20 -0
  41. package/dist/services/index.js.map +1 -0
  42. package/dist/services/kira-api.service.d.ts +21 -0
  43. package/dist/services/kira-api.service.d.ts.map +1 -0
  44. package/dist/services/kira-api.service.js +149 -0
  45. package/dist/services/kira-api.service.js.map +1 -0
  46. package/dist/services/kira-payment-link.service.d.ts +17 -0
  47. package/dist/services/kira-payment-link.service.d.ts.map +1 -0
  48. package/dist/services/kira-payment-link.service.js +94 -0
  49. package/dist/services/kira-payment-link.service.js.map +1 -0
  50. package/dist/settings/kira.settings.d.ts +3 -0
  51. package/dist/settings/kira.settings.d.ts.map +1 -0
  52. package/dist/settings/kira.settings.js +55 -0
  53. package/dist/settings/kira.settings.js.map +1 -0
  54. package/dist/types/index.d.ts +3 -0
  55. package/dist/types/index.d.ts.map +1 -0
  56. package/dist/types/index.js +19 -0
  57. package/dist/types/index.js.map +1 -0
  58. package/dist/types/kira-api.types.d.ts +82 -0
  59. package/dist/types/kira-api.types.d.ts.map +1 -0
  60. package/dist/types/kira-api.types.js +3 -0
  61. package/dist/types/kira-api.types.js.map +1 -0
  62. package/dist/types/kira.config.type.d.ts +10 -0
  63. package/dist/types/kira.config.type.d.ts.map +1 -0
  64. package/dist/types/kira.config.type.js +3 -0
  65. package/dist/types/kira.config.type.js.map +1 -0
  66. package/package.json +65 -0
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.KiraModule = void 0;
10
+ const axios_1 = require("@nestjs/axios");
11
+ const common_1 = require("@nestjs/common");
12
+ const typeorm_1 = require("@nestjs/typeorm");
13
+ const core_1 = require("@venturialstd/core");
14
+ const kira_client_1 = require("./clients/kira.client");
15
+ const entities_1 = require("./entities");
16
+ const services_1 = require("./services");
17
+ let KiraModule = class KiraModule {
18
+ };
19
+ exports.KiraModule = KiraModule;
20
+ exports.KiraModule = KiraModule = __decorate([
21
+ (0, common_1.Module)({
22
+ imports: [
23
+ core_1.SharedModule.forRoot({}),
24
+ core_1.SettingsModule,
25
+ axios_1.HttpModule,
26
+ typeorm_1.TypeOrmModule.forFeature([entities_1.KiraPaymentLink]),
27
+ ],
28
+ controllers: [],
29
+ providers: [kira_client_1.KiraClient, services_1.KiraApiService, services_1.KiraPaymentLinkService],
30
+ exports: [kira_client_1.KiraClient, services_1.KiraApiService, services_1.KiraPaymentLinkService],
31
+ })
32
+ ], KiraModule);
33
+ //# sourceMappingURL=kira.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kira.module.js","sourceRoot":"","sources":["../src/kira.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yCAA2C;AAC3C,2CAAwC;AACxC,6CAAgD;AAChD,6CAAkE;AAElE,uDAAmD;AACnD,yCAA6C;AAC7C,yCAAoE;AAa7D,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IAXtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,mBAAY,CAAC,OAAO,CAAC,EAAE,CAAC;YACxB,qBAAc;YACd,kBAAU;YACV,uBAAa,CAAC,UAAU,CAAC,CAAC,0BAAe,CAAC,CAAC;SAC5C;QACD,WAAW,EAAE,EAAE;QACf,SAAS,EAAE,CAAC,wBAAU,EAAE,yBAAc,EAAE,iCAAsB,CAAC;QAC/D,OAAO,EAAE,CAAC,wBAAU,EAAE,yBAAc,EAAE,iCAAsB,CAAC;KAC9D,CAAC;GACW,UAAU,CAAG"}
@@ -0,0 +1,4 @@
1
+ export * from '../clients/kira.client';
2
+ export * from './kira-api.service';
3
+ export * from './kira-payment-link.service';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../clients/kira.client"), exports);
18
+ __exportStar(require("./kira-api.service"), exports);
19
+ __exportStar(require("./kira-payment-link.service"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,qDAAmC;AACnC,8DAA4C"}
@@ -0,0 +1,21 @@
1
+ import { HttpService } from '@nestjs/axios';
2
+ import { AppLogger } from '@venturialstd/core';
3
+ import { KiraClient } from '../clients/kira.client';
4
+ import { KiraApiOperationType } from '../constants/kira.constant';
5
+ import { KiraConfig } from '../types/kira.config.type';
6
+ export declare class KiraApiService {
7
+ private readonly httpService;
8
+ private readonly kiraClient;
9
+ private readonly logger;
10
+ private readonly defaultBaseUrl;
11
+ private tokenCache;
12
+ constructor(httpService: HttpService, kiraClient: KiraClient, logger: AppLogger);
13
+ private getCredentials;
14
+ private getCacheKey;
15
+ authenticate(config?: KiraConfig | null): Promise<string>;
16
+ makeApiCall<T>(operationType: KiraApiOperationType, endpoint: string, method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', body?: Record<string, unknown>, config?: KiraConfig | null, _correlationId?: string): Promise<T>;
17
+ getApiKey(config?: KiraConfig | null): Promise<string>;
18
+ getBaseUrl(config?: KiraConfig | null): Promise<string>;
19
+ clearTokenCache(config?: KiraConfig | null): void;
20
+ }
21
+ //# sourceMappingURL=kira-api.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kira-api.service.d.ts","sourceRoot":"","sources":["../../src/services/kira-api.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAyB,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,qBACa,cAAc;IAMvB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAPzB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAsC;IAErE,OAAO,CAAC,UAAU,CAAgE;gBAG/D,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,SAAS;YAQtB,cAAc;IAO5B,OAAO,CAAC,WAAW;IAQb,YAAY,CAAC,MAAM,GAAE,UAAU,GAAG,IAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAsE/D,WAAW,CAAC,CAAC,EACjB,aAAa,EAAE,oBAAoB,EACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAgB,EAC3D,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,MAAM,GAAE,UAAU,GAAG,IAAW,EAChC,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,CAAC,CAAC;IA0DP,SAAS,CAAC,MAAM,GAAE,UAAU,GAAG,IAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ5D,UAAU,CAAC,MAAM,GAAE,UAAU,GAAG,IAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IASnE,eAAe,CAAC,MAAM,GAAE,UAAU,GAAG,IAAW,GAAG,IAAI;CASxD"}
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var KiraApiService_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.KiraApiService = void 0;
14
+ const axios_1 = require("@nestjs/axios");
15
+ const common_1 = require("@nestjs/common");
16
+ const core_1 = require("@venturialstd/core");
17
+ const rxjs_1 = require("rxjs");
18
+ const kira_client_1 = require("../clients/kira.client");
19
+ let KiraApiService = KiraApiService_1 = class KiraApiService {
20
+ httpService;
21
+ kiraClient;
22
+ logger;
23
+ defaultBaseUrl = 'https://api.balampay.com/sandbox';
24
+ tokenCache = new Map();
25
+ constructor(httpService, kiraClient, logger) {
26
+ this.httpService = httpService;
27
+ this.kiraClient = kiraClient;
28
+ this.logger = logger;
29
+ this.logger.setContext(KiraApiService_1.name);
30
+ }
31
+ async getCredentials(config = null) {
32
+ return await this.kiraClient.getCredentials(config);
33
+ }
34
+ getCacheKey(apiKey, clientId) {
35
+ return `${apiKey}:${clientId}`;
36
+ }
37
+ async authenticate(config = null) {
38
+ const credentials = await this.getCredentials(config);
39
+ const { apiKey, clientId, password, baseUrl } = credentials;
40
+ const cacheKey = this.getCacheKey(apiKey, clientId);
41
+ const cached = this.tokenCache.get(cacheKey);
42
+ const now = Date.now();
43
+ if (cached && cached.expiresAt > now + 60000) {
44
+ return cached.token;
45
+ }
46
+ const finalBaseUrl = baseUrl || this.defaultBaseUrl;
47
+ const endpoint = '/auth';
48
+ const url = `${finalBaseUrl}${endpoint}`;
49
+ const authRequest = {
50
+ client_id: clientId,
51
+ password: password,
52
+ };
53
+ const headers = {
54
+ 'Content-Type': 'application/json',
55
+ 'x-api-key': apiKey,
56
+ };
57
+ try {
58
+ const startTime = Date.now();
59
+ const response = await (0, rxjs_1.firstValueFrom)(this.httpService.post(url, authRequest, { headers }));
60
+ const responseTime = Date.now() - startTime;
61
+ const responseData = response.data;
62
+ const accessToken = responseData.data?.access_token || responseData.access_token;
63
+ const expiresIn = responseData.data?.expires_in || responseData.expires_in || 3600;
64
+ const tokenType = responseData.data?.token_type || responseData.token_type || 'Bearer';
65
+ if (!accessToken) {
66
+ throw new Error('Failed to authenticate: No access token in response');
67
+ }
68
+ const formattedToken = `${tokenType} ${accessToken}`;
69
+ const expiresAt = now + expiresIn * 1000;
70
+ this.tokenCache.set(cacheKey, {
71
+ token: formattedToken,
72
+ expiresAt,
73
+ });
74
+ this.logger.log(`Kira authentication successful (took ${responseTime}ms)`);
75
+ return formattedToken;
76
+ }
77
+ catch (error) {
78
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
79
+ this.logger.error(`Kira authentication failed: ${errorMessage}`, {
80
+ error: error instanceof Error ? error.stack : String(error),
81
+ });
82
+ throw error;
83
+ }
84
+ }
85
+ async makeApiCall(operationType, endpoint, method = 'GET', body, config = null, _correlationId) {
86
+ const credentials = await this.getCredentials(config);
87
+ const finalBaseUrl = credentials.baseUrl || this.defaultBaseUrl;
88
+ const token = await this.authenticate(config);
89
+ const url = `${finalBaseUrl}${endpoint}`;
90
+ const headers = {
91
+ 'Content-Type': 'application/json',
92
+ Authorization: token,
93
+ 'x-api-key': credentials.apiKey,
94
+ };
95
+ const startTime = Date.now();
96
+ try {
97
+ const response = await (0, rxjs_1.firstValueFrom)(this.httpService.request({
98
+ method,
99
+ url,
100
+ headers,
101
+ data: body,
102
+ }));
103
+ const responseTime = Date.now() - startTime;
104
+ const responseData = response.data;
105
+ const statusCode = response.status;
106
+ this.logger.log(`Kira API call successful: ${method} ${endpoint} (${statusCode}) - ${responseTime}ms`);
107
+ return responseData;
108
+ }
109
+ catch (error) {
110
+ const _responseTime = Date.now() - startTime;
111
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
112
+ const statusCode = error.response?.status;
113
+ const _responseData = error
114
+ .response?.data;
115
+ this.logger.error(`Kira API call failed: ${method} ${endpoint} (${statusCode || 'N/A'}) - ${errorMessage}`, {
116
+ error: error instanceof Error ? error.stack : String(error),
117
+ statusCode,
118
+ endpoint,
119
+ method,
120
+ });
121
+ throw error;
122
+ }
123
+ }
124
+ async getApiKey(config = null) {
125
+ const credentials = await this.getCredentials(config);
126
+ return credentials.apiKey;
127
+ }
128
+ async getBaseUrl(config = null) {
129
+ const credentials = await this.getCredentials(config);
130
+ return credentials.baseUrl || this.defaultBaseUrl;
131
+ }
132
+ clearTokenCache(config = null) {
133
+ if (config && config.auth) {
134
+ const cacheKey = this.getCacheKey(config.auth.apiKey, config.auth.clientId);
135
+ this.tokenCache.delete(cacheKey);
136
+ }
137
+ else {
138
+ this.tokenCache.clear();
139
+ }
140
+ }
141
+ };
142
+ exports.KiraApiService = KiraApiService;
143
+ exports.KiraApiService = KiraApiService = KiraApiService_1 = __decorate([
144
+ (0, common_1.Injectable)(),
145
+ __metadata("design:paramtypes", [axios_1.HttpService,
146
+ kira_client_1.KiraClient,
147
+ core_1.AppLogger])
148
+ ], KiraApiService);
149
+ //# sourceMappingURL=kira-api.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kira-api.service.js","sourceRoot":"","sources":["../../src/services/kira-api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yCAA4C;AAC5C,2CAA4C;AAC5C,6CAA+C;AAC/C,+BAAsC;AAEtC,wDAA2E;AAMpE,IAAM,cAAc,sBAApB,MAAM,cAAc;IAMN;IACA;IACA;IAPF,cAAc,GAAG,kCAAkC,CAAC;IAE7D,UAAU,GAAsD,IAAI,GAAG,EAAE,CAAC;IAElF,YACmB,WAAwB,EACxB,UAAsB,EACtB,MAAiB;QAFjB,gBAAW,GAAX,WAAW,CAAa;QACxB,eAAU,GAAV,UAAU,CAAY;QACtB,WAAM,GAAN,MAAM,CAAW;QAElC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,gBAAc,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAKO,KAAK,CAAC,cAAc,CAAC,SAA4B,IAAI;QAC3D,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;IAKO,WAAW,CAAC,MAAc,EAAE,QAAgB;QAClD,OAAO,GAAG,MAAM,IAAI,QAAQ,EAAE,CAAC;IACjC,CAAC;IAMD,KAAK,CAAC,YAAY,CAAC,SAA4B,IAAI;QACjD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CA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/core';
3
+ import { Repository } from 'typeorm';
4
+ import { KiraClient } from '../clients/kira.client';
5
+ import { KiraPaymentLink } from '../entities/kira-payment-link.entity';
6
+ import { KiraConfig } from '../types/kira.config.type';
7
+ import { KiraCreatePaymentLinkRequest } from '../types/kira-api.types';
8
+ import { KiraApiService } from './kira-api.service';
9
+ export declare class KiraPaymentLinkService extends TypeOrmCrudService<KiraPaymentLink> {
10
+ repo: Repository<KiraPaymentLink>;
11
+ private readonly kiraApiService;
12
+ private readonly kiraClient;
13
+ private readonly logger;
14
+ constructor(repo: Repository<KiraPaymentLink>, kiraApiService: KiraApiService, kiraClient: KiraClient, logger: AppLogger);
15
+ createPaymentLink(config: KiraConfig | null, request: KiraCreatePaymentLinkRequest, correlationId?: string): Promise<KiraPaymentLink>;
16
+ }
17
+ //# sourceMappingURL=kira-payment-link.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kira-payment-link.service.d.ts","sourceRoot":"","sources":["../../src/services/kira-payment-link.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAe,UAAU,EAAE,MAAM,SAAS,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AASpD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAML,4BAA4B,EAE7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,qBACa,sBAAuB,SAAQ,kBAAkB,CAAC,eAAe,CAAC;IAGpE,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC;IACxC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAHhB,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,EACvB,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,SAAS;IAY9B,iBAAiB,CACrB,MAAM,EAAE,UAAU,GAAG,IAAI,EACzB,OAAO,EAAE,4BAA4B,EACrC,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,eAAe,CAAC;CAsE5B"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var KiraPaymentLinkService_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.KiraPaymentLinkService = void 0;
17
+ const crud_typeorm_1 = require("@dataui/crud-typeorm");
18
+ const common_1 = require("@nestjs/common");
19
+ const typeorm_1 = require("@nestjs/typeorm");
20
+ const core_1 = require("@venturialstd/core");
21
+ const typeorm_2 = require("typeorm");
22
+ const kira_client_1 = require("../clients/kira.client");
23
+ const kira_constant_1 = require("../constants/kira.constant");
24
+ const kira_payment_constant_1 = require("../constants/kira-payment.constant");
25
+ const kira_payment_link_entity_1 = require("../entities/kira-payment-link.entity");
26
+ const kira_api_service_1 = require("./kira-api.service");
27
+ let KiraPaymentLinkService = KiraPaymentLinkService_1 = class KiraPaymentLinkService extends crud_typeorm_1.TypeOrmCrudService {
28
+ repo;
29
+ kiraApiService;
30
+ kiraClient;
31
+ logger;
32
+ constructor(repo, kiraApiService, kiraClient, logger) {
33
+ super(repo);
34
+ this.repo = repo;
35
+ this.kiraApiService = kiraApiService;
36
+ this.kiraClient = kiraClient;
37
+ this.logger = logger;
38
+ this.logger.setContext(KiraPaymentLinkService_1.name);
39
+ }
40
+ async createPaymentLink(config, request, correlationId) {
41
+ try {
42
+ const credentials = await this.kiraClient.getCredentials(config);
43
+ const clientId = credentials.clientId;
44
+ const requestBody = {
45
+ ...request,
46
+ client_uuid: clientId,
47
+ };
48
+ const response = await this.kiraApiService.makeApiCall(kira_constant_1.KiraApiOperationType.CREATE_PAYMENT_LINK, '/v1/payment-link', 'POST', requestBody, config, correlationId);
49
+ this.logger.log(`Payment link created via API: ${response.txn_uuid || response.payment_link}`);
50
+ const paymentData = {
51
+ first_name: request.first_name,
52
+ middle_name: request.middle_name,
53
+ last_name: request.last_name,
54
+ country_code: request.country_code,
55
+ phone: request.phone,
56
+ email: request.email,
57
+ address: request.address,
58
+ reference: request.reference,
59
+ amount: request.amount,
60
+ payin: request.payin,
61
+ fixed_amount: request.fixed_amount,
62
+ max_amount: request.max_amount,
63
+ recipient_type: request.recipient_type,
64
+ acct_type: request.acct_type,
65
+ acct_info: request.acct_info,
66
+ payment_link: response.payment_link,
67
+ txn_uuid: response.txn_uuid,
68
+ status: (response.status || kira_payment_constant_1.KiraStatus.INIT),
69
+ };
70
+ const payment = this.repo.create(paymentData);
71
+ const savedPayment = await this.repo.save(payment);
72
+ this.logger.log(`Payment link saved to database: ${savedPayment.id} (${savedPayment.txn_uuid})`);
73
+ return savedPayment;
74
+ }
75
+ catch (error) {
76
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
77
+ this.logger.error(`Failed to create payment link: ${errorMessage}`, {
78
+ error: error instanceof Error ? error.stack : String(error),
79
+ request: request,
80
+ });
81
+ throw error;
82
+ }
83
+ }
84
+ };
85
+ exports.KiraPaymentLinkService = KiraPaymentLinkService;
86
+ exports.KiraPaymentLinkService = KiraPaymentLinkService = KiraPaymentLinkService_1 = __decorate([
87
+ (0, common_1.Injectable)(),
88
+ __param(0, (0, typeorm_1.InjectRepository)(kira_payment_link_entity_1.KiraPaymentLink)),
89
+ __metadata("design:paramtypes", [typeorm_2.Repository,
90
+ kira_api_service_1.KiraApiService,
91
+ kira_client_1.KiraClient,
92
+ core_1.AppLogger])
93
+ ], KiraPaymentLinkService);
94
+ //# sourceMappingURL=kira-payment-link.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kira-payment-link.service.js","sourceRoot":"","sources":["../../src/services/kira-payment-link.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAA0D;AAC1D,2CAA4C;AAC5C,6CAAmD;AACnD,6CAA+C;AAC/C,qCAAkD;AAElD,wDAAoD;AACpD,8DAAkE;AAClE,8EAM4C;AAC5C,mFAAuE;AAWvE,yDAAoD;AAG7C,IAAM,sBAAsB,8BAA5B,MAAM,sBAAuB,SAAQ,iCAAmC;IAGpE;IACU;IACA;IACA;IALnB,YAES,IAAiC,EACvB,cAA8B,EAC9B,UAAsB,EACtB,MAAiB;QAElC,KAAK,CAAC,IAAI,CAAC,CAAC;QALL,SAAI,GAAJ,IAAI,CAA6B;QACvB,mBAAc,GAAd,cAAc,CAAgB;QAC9B,eAAU,GAAV,UAAU,CAAY;QACtB,WAAM,GAAN,MAAM,CAAW;QAGlC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,wBAAsB,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAQD,KAAK,CAAC,iBAAiB,CACrB,MAAyB,EACzB,OAAqC,EACrC,aAAsB;QAEtB,IAAI,CAAC;YAEH,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC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AC,WAAW,CAAC,CAAC;YAC9C,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEnD,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,mCAAmC,YAAY,CAAC,EAAE,KAAK,YAAY,CAAC,QAAQ,GAAG,CAChF,CAAC;YAEF,OAAO,YAAY,CAAC;QACtB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YAC9E,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,YAAY,EAAE,EAAE;gBAClE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC3D,OAAO,EAAE,OAAO;aACjB,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF,CAAA;AA5FY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,0CAAe,CAAC,CAAA;qCACrB,oBAAU;QACU,iCAAc;QAClB,wBAAU;QACd,gBAAS;GANzB,sBAAsB,CA4FlC"}
@@ -0,0 +1,3 @@
1
+ import { Settings } from '@venturialstd/core';
2
+ export declare const SETTINGS: Omit<Settings, 'id' | 'createdAt' | 'updatedAt'>[];
3
+ //# sourceMappingURL=kira.settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kira.settings.d.ts","sourceRoot":"","sources":["../../src/settings/kira.settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,oBAAoB,CAAC;AAE7D,eAAO,MAAM,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,CAAC,EAiDtE,CAAC"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SETTINGS = void 0;
4
+ const core_1 = require("@venturialstd/core");
5
+ exports.SETTINGS = [
6
+ {
7
+ scope: 'GLOBAL',
8
+ module: 'KIRA',
9
+ section: 'GENERAL',
10
+ key: 'API_KEY',
11
+ label: 'Kira API Key',
12
+ description: 'API key for authenticating requests to Kira API (x-api-key header)',
13
+ type: core_1.SETTINGS_TYPE.SECRET,
14
+ value: '',
15
+ options: null,
16
+ sortOrder: 1,
17
+ },
18
+ {
19
+ scope: 'GLOBAL',
20
+ module: 'KIRA',
21
+ section: 'GENERAL',
22
+ key: 'CLIENT_ID',
23
+ label: 'Kira Client ID',
24
+ description: 'Client ID for Kira authentication',
25
+ type: core_1.SETTINGS_TYPE.SECRET,
26
+ value: '',
27
+ options: null,
28
+ sortOrder: 2,
29
+ },
30
+ {
31
+ scope: 'GLOBAL',
32
+ module: 'KIRA',
33
+ section: 'GENERAL',
34
+ key: 'PASSWORD',
35
+ label: 'Kira Password',
36
+ description: 'Password for Kira authentication',
37
+ type: core_1.SETTINGS_TYPE.SECRET,
38
+ value: '',
39
+ options: null,
40
+ sortOrder: 3,
41
+ },
42
+ {
43
+ scope: 'GLOBAL',
44
+ module: 'KIRA',
45
+ section: 'GENERAL',
46
+ key: 'BASE_URL',
47
+ label: 'Kira API Base URL',
48
+ description: 'Base URL for Kira API (defaults to https://api.balampay.com/sandbox)',
49
+ type: core_1.SETTINGS_TYPE.TEXT,
50
+ value: 'https://api.balampay.com/sandbox',
51
+ options: null,
52
+ sortOrder: 4,
53
+ },
54
+ ];
55
+ //# sourceMappingURL=kira.settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kira.settings.js","sourceRoot":"","sources":["../../src/settings/kira.settings.ts"],"names":[],"mappings":";;;AAAA,6CAA6D;AAEhD,QAAA,QAAQ,GAAuD;IAC1E;QACE,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,SAAS;QAClB,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,oEAAoE;QACjF,IAAI,EAAE,oBAAa,CAAC,MAAM;QAC1B,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,CAAC;KACb;IACD;QACE,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,SAAS;QAClB,GAAG,EAAE,WAAW;QAChB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,mCAAmC;QAChD,IAAI,EAAE,oBAAa,CAAC,MAAM;QAC1B,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,CAAC;KACb;IACD;QACE,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,SAAS;QAClB,GAAG,EAAE,UAAU;QACf,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,kCAAkC;QAC/C,IAAI,EAAE,oBAAa,CAAC,MAAM;QAC1B,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,CAAC;KACb;IACD;QACE,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,SAAS;QAClB,GAAG,EAAE,UAAU;QACf,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE,sEAAsE;QACnF,IAAI,EAAE,oBAAa,CAAC,IAAI;QACxB,KAAK,EAAE,kCAAkC;QACzC,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,CAAC;KACb;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './kira.config.type';
2
+ export * from './kira-api.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./kira.config.type"), exports);
18
+ __exportStar(require("./kira-api.types"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,mDAAiC"}
@@ -0,0 +1,82 @@
1
+ export interface KiraAuthRequest {
2
+ client_id: string;
3
+ password: string;
4
+ }
5
+ export interface KiraAuthResponse {
6
+ data?: {
7
+ access_token: string;
8
+ expires_in?: number;
9
+ token_type?: string;
10
+ };
11
+ access_token?: string;
12
+ expires_in?: number;
13
+ token_type?: string;
14
+ }
15
+ export interface KiraAcctInfoUS {
16
+ acct_type: 'USD';
17
+ account_number: string;
18
+ routing_number: string;
19
+ type: 'checking' | 'savings';
20
+ city: string;
21
+ state: string;
22
+ zipcode: string;
23
+ doc_type: 'DNI' | 'PASSPORT';
24
+ doc_number: string;
25
+ doc_country_code: 'US';
26
+ }
27
+ export interface KiraAcctInfoSV {
28
+ acct_type: 'SVUSD';
29
+ account_number: string;
30
+ doc_type: 'DNI' | 'PASSPORT';
31
+ doc_number: string;
32
+ doc_country_code: 'SV';
33
+ }
34
+ export interface KiraAcctInfoGT {
35
+ acct_type: 'GTQ';
36
+ account_number: string;
37
+ doc_type: 'PASSPORT';
38
+ doc_number: string;
39
+ bank_name: string;
40
+ doc_country_code: 'GT';
41
+ }
42
+ export interface KiraAcctInfoMX {
43
+ acct_type: 'SPEI';
44
+ clabe: string;
45
+ doc_type: 'PASSPORT' | 'RFC' | 'INE' | 'CURP';
46
+ doc_number: string;
47
+ doc_country_code: 'MX';
48
+ }
49
+ export interface KiraAcctInfoWALLET {
50
+ acct_type: 'WALLET';
51
+ address: string;
52
+ token: string;
53
+ network: 'SOLANA' | 'POLYGON';
54
+ doc_type: string;
55
+ doc_number: string;
56
+ doc_country_code: string;
57
+ }
58
+ export interface KiraCreatePaymentLinkRequest {
59
+ first_name: string;
60
+ middle_name?: string;
61
+ last_name: string;
62
+ country_code: 'MX' | 'US' | 'SV' | 'GT';
63
+ phone: string;
64
+ email: string;
65
+ address: string;
66
+ reference: string;
67
+ amount: number;
68
+ payin: 'card' | 'cash';
69
+ fixed_amount: boolean;
70
+ max_amount: number;
71
+ recipient_type: 'business' | 'person';
72
+ acct_type: 'US' | 'SV' | 'GT' | 'MX' | 'WALLET';
73
+ acct_info: KiraAcctInfoUS | KiraAcctInfoSV | KiraAcctInfoGT | KiraAcctInfoMX | KiraAcctInfoWALLET;
74
+ client_uuid?: string;
75
+ }
76
+ export interface KiraCreatePaymentLinkResponse {
77
+ payment_link: string;
78
+ txn_uuid: string;
79
+ status: string;
80
+ [key: string]: unknown;
81
+ }
82
+ //# sourceMappingURL=kira-api.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kira-api.types.d.ts","sourceRoot":"","sources":["../../src/types/kira-api.types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED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MappingURL=kira-api.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kira-api.types.js","sourceRoot":"","sources":["../../src/types/kira-api.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ export interface KiraAuthCredentials {
2
+ apiKey: string;
3
+ clientId: string;
4
+ password: string;
5
+ }
6
+ export interface KiraConfig {
7
+ auth: KiraAuthCredentials;
8
+ baseUrl?: string;
9
+ }
10
+ //# sourceMappingURL=kira.config.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kira.config.type.d.ts","sourceRoot":"","sources":["../../src/types/kira.config.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=kira.config.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kira.config.type.js","sourceRoot":"","sources":["../../src/types/kira.config.type.ts"],"names":[],"mappings":""}