@traxionpay/cbsmiddleware 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 (203) hide show
  1. package/.prettierrc +4 -0
  2. package/Dockerfile +26 -0
  3. package/README.md +109 -0
  4. package/dist/app.module.d.ts +3 -0
  5. package/dist/app.module.d.ts.map +1 -0
  6. package/dist/app.module.js +44 -0
  7. package/dist/app.module.js.map +1 -0
  8. package/dist/auth/apikey.guard.d.ts +9 -0
  9. package/dist/auth/apikey.guard.d.ts.map +1 -0
  10. package/dist/auth/apikey.guard.js +86 -0
  11. package/dist/auth/apikey.guard.js.map +1 -0
  12. package/dist/auth/auth.controller.d.ts +10 -0
  13. package/dist/auth/auth.controller.d.ts.map +1 -0
  14. package/dist/auth/auth.controller.js +65 -0
  15. package/dist/auth/auth.controller.js.map +1 -0
  16. package/dist/auth/auth.interface.d.ts +8 -0
  17. package/dist/auth/auth.interface.d.ts.map +1 -0
  18. package/dist/auth/auth.interface.js +3 -0
  19. package/dist/auth/auth.interface.js.map +1 -0
  20. package/dist/auth/auth.module.d.ts +6 -0
  21. package/dist/auth/auth.module.d.ts.map +1 -0
  22. package/dist/auth/auth.module.js +81 -0
  23. package/dist/auth/auth.module.js.map +1 -0
  24. package/dist/auth/constant.d.ts +2 -0
  25. package/dist/auth/constant.d.ts.map +1 -0
  26. package/dist/auth/constant.js +5 -0
  27. package/dist/auth/constant.js.map +1 -0
  28. package/dist/auth/jwt-constant.d.ts +8 -0
  29. package/dist/auth/jwt-constant.d.ts.map +1 -0
  30. package/dist/auth/jwt-constant.js +60 -0
  31. package/dist/auth/jwt-constant.js.map +1 -0
  32. package/dist/auth/jwt-guard.d.ts +5 -0
  33. package/dist/auth/jwt-guard.d.ts.map +1 -0
  34. package/dist/auth/jwt-guard.js +18 -0
  35. package/dist/auth/jwt-guard.js.map +1 -0
  36. package/dist/auth/jwt-strategy.d.ts +16 -0
  37. package/dist/auth/jwt-strategy.d.ts.map +1 -0
  38. package/dist/auth/jwt-strategy.js +59 -0
  39. package/dist/auth/jwt-strategy.js.map +1 -0
  40. package/dist/auth/services/auth.service.d.ts +14 -0
  41. package/dist/auth/services/auth.service.d.ts.map +1 -0
  42. package/dist/auth/services/auth.service.js +56 -0
  43. package/dist/auth/services/auth.service.js.map +1 -0
  44. package/dist/auth/services/encryption.service.d.ts +11 -0
  45. package/dist/auth/services/encryption.service.d.ts.map +1 -0
  46. package/dist/auth/services/encryption.service.js +49 -0
  47. package/dist/auth/services/encryption.service.js.map +1 -0
  48. package/dist/auth.config.d.ts +29 -0
  49. package/dist/auth.config.d.ts.map +1 -0
  50. package/dist/auth.config.js +71 -0
  51. package/dist/auth.config.js.map +1 -0
  52. package/dist/banking/banking.controller.d.ts +18 -0
  53. package/dist/banking/banking.controller.d.ts.map +1 -0
  54. package/dist/banking/banking.controller.js +146 -0
  55. package/dist/banking/banking.controller.js.map +1 -0
  56. package/dist/banking/banking.module.d.ts +6 -0
  57. package/dist/banking/banking.module.d.ts.map +1 -0
  58. package/dist/banking/banking.module.js +90 -0
  59. package/dist/banking/banking.module.js.map +1 -0
  60. package/dist/banking/dto/account-transfer.dto.d.ts +17 -0
  61. package/dist/banking/dto/account-transfer.dto.d.ts.map +1 -0
  62. package/dist/banking/dto/account-transfer.dto.js +101 -0
  63. package/dist/banking/dto/account-transfer.dto.js.map +1 -0
  64. package/dist/banking/dto/account.dto.d.ts +19 -0
  65. package/dist/banking/dto/account.dto.d.ts.map +1 -0
  66. package/dist/banking/dto/account.dto.js +104 -0
  67. package/dist/banking/dto/account.dto.js.map +1 -0
  68. package/dist/banking/dto/fetch-bank-balance.dto.d.ts +12 -0
  69. package/dist/banking/dto/fetch-bank-balance.dto.d.ts.map +1 -0
  70. package/dist/banking/dto/fetch-bank-balance.dto.js +71 -0
  71. package/dist/banking/dto/fetch-bank-balance.dto.js.map +1 -0
  72. package/dist/banking/dto/transaction-history.dto.d.ts +15 -0
  73. package/dist/banking/dto/transaction-history.dto.d.ts.map +1 -0
  74. package/dist/banking/dto/transaction-history.dto.js +89 -0
  75. package/dist/banking/dto/transaction-history.dto.js.map +1 -0
  76. package/dist/banking/factory/bank-strategy.factory.d.ts +9 -0
  77. package/dist/banking/factory/bank-strategy.factory.d.ts.map +1 -0
  78. package/dist/banking/factory/bank-strategy.factory.js +48 -0
  79. package/dist/banking/factory/bank-strategy.factory.js.map +1 -0
  80. package/dist/banking/interfaces/bank-config.interface.d.ts +22 -0
  81. package/dist/banking/interfaces/bank-config.interface.d.ts.map +1 -0
  82. package/dist/banking/interfaces/bank-config.interface.js +3 -0
  83. package/dist/banking/interfaces/bank-config.interface.js.map +1 -0
  84. package/dist/banking/interfaces/bank-service.interface.d.ts +19 -0
  85. package/dist/banking/interfaces/bank-service.interface.d.ts.map +1 -0
  86. package/dist/banking/interfaces/bank-service.interface.js +3 -0
  87. package/dist/banking/interfaces/bank-service.interface.js.map +1 -0
  88. package/dist/banking/services/ASPAC.service.d.ts +25 -0
  89. package/dist/banking/services/ASPAC.service.d.ts.map +1 -0
  90. package/dist/banking/services/ASPAC.service.js +498 -0
  91. package/dist/banking/services/ASPAC.service.js.map +1 -0
  92. package/dist/banking/services/BankGateway.service.d.ts +18 -0
  93. package/dist/banking/services/BankGateway.service.d.ts.map +1 -0
  94. package/dist/banking/services/BankGateway.service.js +71 -0
  95. package/dist/banking/services/BankGateway.service.js.map +1 -0
  96. package/dist/banking/services/MBWIN.service.d.ts +25 -0
  97. package/dist/banking/services/MBWIN.service.d.ts.map +1 -0
  98. package/dist/banking/services/MBWIN.service.js +655 -0
  99. package/dist/banking/services/MBWIN.service.js.map +1 -0
  100. package/dist/banking/services/WelcomeBank.service.d.ts +29 -0
  101. package/dist/banking/services/WelcomeBank.service.d.ts.map +1 -0
  102. package/dist/banking/services/WelcomeBank.service.js +840 -0
  103. package/dist/banking/services/WelcomeBank.service.js.map +1 -0
  104. package/dist/banking/services/sms.service.d.ts +10 -0
  105. package/dist/banking/services/sms.service.d.ts.map +1 -0
  106. package/dist/banking/services/sms.service.js +97 -0
  107. package/dist/banking/services/sms.service.js.map +1 -0
  108. package/dist/banking/tokens/bank-service.tokens.d.ts +5 -0
  109. package/dist/banking/tokens/bank-service.tokens.d.ts.map +1 -0
  110. package/dist/banking/tokens/bank-service.tokens.js +8 -0
  111. package/dist/banking/tokens/bank-service.tokens.js.map +1 -0
  112. package/dist/banking/types.d.ts +10 -0
  113. package/dist/banking/types.d.ts.map +1 -0
  114. package/dist/banking/types.js +3 -0
  115. package/dist/banking/types.js.map +1 -0
  116. package/dist/decorators/response_message.decorator.d.ts +2 -0
  117. package/dist/decorators/response_message.decorator.d.ts.map +1 -0
  118. package/dist/decorators/response_message.decorator.js +7 -0
  119. package/dist/decorators/response_message.decorator.js.map +1 -0
  120. package/dist/helpers/axios-error.helper.d.ts +6 -0
  121. package/dist/helpers/axios-error.helper.d.ts.map +1 -0
  122. package/dist/helpers/axios-error.helper.js +78 -0
  123. package/dist/helpers/axios-error.helper.js.map +1 -0
  124. package/dist/helpers/response-format.helper.d.ts +4 -0
  125. package/dist/helpers/response-format.helper.d.ts.map +1 -0
  126. package/dist/helpers/response-format.helper.js +15 -0
  127. package/dist/helpers/response-format.helper.js.map +1 -0
  128. package/dist/index.d.ts +10 -0
  129. package/dist/index.d.ts.map +1 -0
  130. package/dist/index.js +26 -0
  131. package/dist/index.js.map +1 -0
  132. package/dist/interceptors/response.interceptor.d.ts +16 -0
  133. package/dist/interceptors/response.interceptor.d.ts.map +1 -0
  134. package/dist/interceptors/response.interceptor.js +80 -0
  135. package/dist/interceptors/response.interceptor.js.map +1 -0
  136. package/dist/logger/logger-interceptor.d.ts +14 -0
  137. package/dist/logger/logger-interceptor.d.ts.map +1 -0
  138. package/dist/logger/logger-interceptor.js +60 -0
  139. package/dist/logger/logger-interceptor.js.map +1 -0
  140. package/dist/logger/logger-option.d.ts +6 -0
  141. package/dist/logger/logger-option.d.ts.map +1 -0
  142. package/dist/logger/logger-option.js +103 -0
  143. package/dist/logger/logger-option.js.map +1 -0
  144. package/dist/logger/logger.config.d.ts +3 -0
  145. package/dist/logger/logger.config.d.ts.map +1 -0
  146. package/dist/logger/logger.config.js +31 -0
  147. package/dist/logger/logger.config.js.map +1 -0
  148. package/dist/logger/logger.module.d.ts +3 -0
  149. package/dist/logger/logger.module.d.ts.map +1 -0
  150. package/dist/logger/logger.module.js +76 -0
  151. package/dist/logger/logger.module.js.map +1 -0
  152. package/dist/main.d.ts +2 -0
  153. package/dist/main.d.ts.map +1 -0
  154. package/dist/main.js +13 -0
  155. package/dist/main.js.map +1 -0
  156. package/dist/tsconfig.build.tsbuildinfo +1 -0
  157. package/docker-compose.yml +14 -0
  158. package/ecosystem.config.js +35 -0
  159. package/eslint.config.mjs +34 -0
  160. package/nest-cli.json +8 -0
  161. package/package.json +102 -0
  162. package/src/app.module.ts +33 -0
  163. package/src/auth/apikey.guard.ts +42 -0
  164. package/src/auth/auth.controller.ts +41 -0
  165. package/src/auth/auth.interface.ts +7 -0
  166. package/src/auth/auth.module.ts +125 -0
  167. package/src/auth/constant.ts +1 -0
  168. package/src/auth/jwt-constant.ts +31 -0
  169. package/src/auth/jwt-guard.ts +5 -0
  170. package/src/auth/jwt-strategy.ts +43 -0
  171. package/src/auth/services/auth.service.ts +33 -0
  172. package/src/auth/services/encryption.service.ts +35 -0
  173. package/src/auth.config.ts +42 -0
  174. package/src/banking/banking.controller.ts +142 -0
  175. package/src/banking/banking.module.ts +142 -0
  176. package/src/banking/dto/account-transfer.dto.ts +66 -0
  177. package/src/banking/dto/account.dto.ts +70 -0
  178. package/src/banking/dto/fetch-bank-balance.dto.ts +46 -0
  179. package/src/banking/dto/transaction-history.dto.ts +58 -0
  180. package/src/banking/factory/bank-strategy.factory.ts +25 -0
  181. package/src/banking/interfaces/bank-config.interface.ts +25 -0
  182. package/src/banking/interfaces/bank-service.interface.ts +164 -0
  183. package/src/banking/services/ASPAC.service.ts +574 -0
  184. package/src/banking/services/BankGateway.service.ts +64 -0
  185. package/src/banking/services/MBWIN.service.ts +779 -0
  186. package/src/banking/services/WelcomeBank.service.ts +990 -0
  187. package/src/banking/services/sms.service.ts +50 -0
  188. package/src/banking/tokens/bank-service.tokens.ts +4 -0
  189. package/src/banking/types.ts +10 -0
  190. package/src/decorators/response_message.decorator.ts +4 -0
  191. package/src/helpers/axios-error.helper.ts +63 -0
  192. package/src/helpers/response-format.helper.ts +15 -0
  193. package/src/index.ts +15 -0
  194. package/src/interceptors/response.interceptor.ts +53 -0
  195. package/src/logger/logger-interceptor.ts +55 -0
  196. package/src/logger/logger-option.ts +119 -0
  197. package/src/logger/logger.config.ts +31 -0
  198. package/src/logger/logger.module.ts +31 -0
  199. package/src/main.ts +10 -0
  200. package/src/types/pino-daily-rotate-file.d.ts +31 -0
  201. package/tsconfig.build.json +11 -0
  202. package/tsconfig.build.tsbuildinfo +1 -0
  203. package/tsconfig.json +22 -0
@@ -0,0 +1,990 @@
1
+ import { Inject, Injectable, HttpException, HttpStatus } from '@nestjs/common';
2
+ import { BankService } from '../interfaces/bank-service.interface';
3
+ import axios from 'axios';
4
+ import { AxiosErrorHelper } from '../../helpers/axios-error.helper';
5
+ import { BankingConfig } from '../interfaces/bank-config.interface';
6
+ import { BANKING_CONFIG } from '../tokens/bank-service.tokens';
7
+ import * as https from 'https';
8
+ import * as speakeasy from 'speakeasy';
9
+ import * as CryptoJS from 'crypto-js';
10
+ import { Logger } from 'nestjs-pino';
11
+ import { AccountDto, ValidateOtp } from '../dto/account.dto';
12
+ import { TransactionHistoryDto } from '../dto/transaction-history.dto'
13
+ import { AccountTransferDto } from '../dto/account-transfer.dto'
14
+ import { FetchBankBalanceDto } from '../dto/fetch-bank-balance.dto';
15
+
16
+
17
+ @Injectable()
18
+ export class WelcomeBankService implements BankService {
19
+
20
+ private readonly secretKey = '5HZ3HAX4MVCGFH3EWYP3U62QRDR6R3TD';
21
+
22
+ constructor(
23
+ @Inject(BANKING_CONFIG)
24
+ private readonly config: BankingConfig,
25
+ private readonly logger: Logger
26
+ ) {
27
+ }
28
+
29
+ generateTOTP(serverTimestamp: string | number): string {
30
+ const timeInSeconds = typeof serverTimestamp === 'string'
31
+ ? Math.floor(Date.parse(serverTimestamp) / 1000)
32
+ : serverTimestamp;
33
+ return speakeasy.totp({
34
+ secret: this.secretKey,
35
+ encoding: 'base32',
36
+ step: 30,
37
+ algorithm: 'sha1',
38
+ digits: 6,
39
+ time: timeInSeconds,
40
+ });
41
+ }
42
+
43
+ encryptPayloadWithOTP(payload: any, otp: string): string {
44
+ const stringified = JSON.stringify(payload);
45
+ const encrypted = CryptoJS.AES.encrypt(stringified, otp).toString();
46
+ return encrypted;
47
+ }
48
+
49
+ private decryptPayloadWithOTP(encryptedPayload: string, otp: string): any {
50
+
51
+ const decrypted = CryptoJS.AES.decrypt(encryptedPayload, otp);
52
+ const plaintext = decrypted.toString(CryptoJS.enc.Utf8);
53
+
54
+ try {
55
+ return JSON.parse(plaintext);
56
+ } catch (err) {
57
+ this.logger.error("Failed to JSON.parse decrypted payload", err);
58
+
59
+ throw new Error("Decryption or JSON parsing failed");
60
+ }
61
+ }
62
+
63
+ async generateToken(): Promise<any> {
64
+
65
+ this.logger.log("Generating WelcomeBank Token");
66
+
67
+ try {
68
+ const headers = {
69
+ 'Content-Type': 'application/json',
70
+ 'X-API-KEY': `${this.config.WELCOMEBANK_API_KEY}`,
71
+ 'X-API-VERSION': `${this.config.WELCOMEBANK_VERSION_KEY}`
72
+ };
73
+
74
+ const httpsAgent = new https.Agent({
75
+ rejectUnauthorized: false,
76
+ });
77
+
78
+ const response = await axios.get(
79
+ `${this.config.WELCOMEBANK_URL}:${this.config.WELCOMEBANK_PORT}/api/token/generate`,
80
+ {
81
+ headers: headers,
82
+ httpsAgent,
83
+ }
84
+ );
85
+
86
+ this.logger.log({ responseData: response }, 'Welcome Bank Token generated successfully');
87
+
88
+ return {
89
+ success: true,
90
+ ...response.data,
91
+ };
92
+
93
+ } catch (error) {
94
+ AxiosErrorHelper.handleAxiosError(error);
95
+ }
96
+ }
97
+
98
+ async refreshToken(refreshToken: string): Promise<any> {
99
+
100
+ if (!refreshToken) {
101
+ throw new HttpException({
102
+ statusCode: HttpStatus.BAD_REQUEST,
103
+ code: 400020206,
104
+ message: 'Bank token should not be empty.',
105
+ data: { refreshToken }
106
+ }, HttpStatus.BAD_REQUEST);
107
+ }
108
+
109
+
110
+ this.logger.log("Welcome Bank refresh token");
111
+
112
+ try {
113
+ const headers = {
114
+ 'Content-Type': 'application/json',
115
+ };
116
+
117
+ const payload = {
118
+ "refreshToken": refreshToken
119
+ }
120
+ const httpsAgent = new https.Agent({
121
+ rejectUnauthorized: false,
122
+ });
123
+
124
+ const response = await axios.post(
125
+ `${this.config.WELCOMEBANK_URL}:${this.config.WELCOMEBANK_PORT}/api/token/refresh`,
126
+ payload,
127
+ {
128
+ headers: headers,
129
+ httpsAgent,
130
+ }
131
+ );
132
+
133
+ this.logger.log({ responseData: response }, 'Welcome Bank Refresh Token Successful');
134
+
135
+ return {
136
+ success: true,
137
+ ...response.data,
138
+ };
139
+
140
+ } catch (error) {
141
+ AxiosErrorHelper.handleAxiosError(error);
142
+ }
143
+ }
144
+
145
+ async linkAccount(accountDto: AccountDto) {
146
+
147
+ const { token, account, branch, accountType, mobile } = accountDto;
148
+
149
+ if (!token) {
150
+ throw new HttpException({
151
+ statusCode: HttpStatus.UNAUTHORIZED,
152
+ code: 401020302,
153
+ message: 'Bank token should not be empty.',
154
+ data: { accountDto }
155
+ }, HttpStatus.UNAUTHORIZED);
156
+ }
157
+
158
+ if (!account) {
159
+ throw new HttpException({
160
+ statusCode: HttpStatus.BAD_REQUEST,
161
+ code: 400020304,
162
+ message: 'Bank account number should not be empty.',
163
+ data: { accountDto }
164
+ }, HttpStatus.BAD_REQUEST);
165
+ }
166
+
167
+ if (!accountType) {
168
+ throw new HttpException({
169
+ statusCode: HttpStatus.BAD_REQUEST,
170
+ code: 4400020306,
171
+ message: 'Bank account type should not be empty.',
172
+ data: { accountDto }
173
+ }, HttpStatus.BAD_REQUEST);
174
+ }
175
+
176
+ if (!mobile) {
177
+ throw new HttpException({
178
+ statusCode: HttpStatus.BAD_REQUEST,
179
+ code: 4000203009,
180
+ message: 'Mobile Number should not be empty.',
181
+ data: { accountDto }
182
+ }, HttpStatus.BAD_REQUEST);
183
+ }
184
+
185
+ this.logger.log("Welcome Bank Link Account");
186
+
187
+ const isoTimestamp = new Date().toISOString();
188
+ const timeInSeconds = Math.floor(Date.parse(isoTimestamp) / 1000);
189
+ const totp = this.generateTOTP(timeInSeconds);
190
+ const totpPrevious = this.generateTOTP(timeInSeconds - 30);
191
+
192
+ this.logger.log(`TOTP GENERATED FOR WELCOMEBANK LINK ACCOUNT: ${totp}, For Time stamp: ${isoTimestamp}`);
193
+ this.logger.log(`TOTP GENERATED FOR PREVIOUS TIME: ${totpPrevious}`);
194
+
195
+ try {
196
+ const headers = {
197
+ 'Authorization': `Bearer ${token}`,
198
+ 'Content-Type': 'application/json',
199
+ 'X-SERVER-TIMESTAMP': `${isoTimestamp}`
200
+ };
201
+
202
+ const httpsAgent = new https.Agent({
203
+ rejectUnauthorized: false,
204
+ });
205
+
206
+ let response;
207
+
208
+ if (String(this.config.WELCOMBANK_ENABLEENCRYPTION).toLowerCase() === 'true') {
209
+ let payload;
210
+ payload = {
211
+ "acc": account,
212
+ "br": branch,
213
+ "accType": accountType,
214
+ "mobile": mobile
215
+ }
216
+ payload = this.encryptPayloadWithOTP(payload, totp);
217
+ const encodedPayload = encodeURIComponent(payload);
218
+
219
+ response = await axios.get(
220
+ `${this.config.WELCOMEBANK_URL}:${this.config.WELCOMEBANK_PORT}/api/linkaccount?data=${encodedPayload}`,
221
+ {
222
+ headers: headers,
223
+ httpsAgent
224
+ }
225
+ );
226
+ }
227
+
228
+ else {
229
+ response = await axios.get(
230
+ `${this.config.WELCOMEBANK_URL}:${this.config.WELCOMEBANK_PORT}/api/linkaccount?acc=${account}&br=${branch}&accType=${accountType}&mobile=${mobile}`,
231
+ {
232
+ headers: headers,
233
+ httpsAgent
234
+ }
235
+ );
236
+ }
237
+ let responseData = response.data;
238
+
239
+ this.logger.log({ responseData: response }, 'Welcome Bank Link Account Successful');
240
+
241
+ if (String(this.config.WELCOMBANK_ENABLEENCRYPTION).toLowerCase() === 'true') {
242
+
243
+ const encryptedResponsePayload = responseData.data;
244
+
245
+ if (!encryptedResponsePayload) {
246
+ throw new Error("Encrypted response expected but not found");
247
+ }
248
+
249
+ let decryptedResponse;
250
+ try {
251
+ decryptedResponse = this.decryptPayloadWithOTP(encryptedResponsePayload, totp);
252
+ } catch (error) {
253
+ this.logger.warn("Decryption with current OTP failed, trying with previous OTP");
254
+ }
255
+
256
+ if (!decryptedResponse) {
257
+ decryptedResponse = this.decryptPayloadWithOTP(encryptedResponsePayload, totpPrevious);
258
+ }
259
+
260
+ return {
261
+ success: true,
262
+ data: decryptedResponse,
263
+ };
264
+
265
+ } else {
266
+
267
+ return {
268
+ success: true,
269
+ ...responseData,
270
+ };
271
+ }
272
+ }
273
+ catch (error) {
274
+ AxiosErrorHelper.handleAxiosError(error);
275
+ }
276
+ }
277
+
278
+
279
+ async validateOtp(validateOtp: ValidateOtp): Promise<any> {
280
+
281
+ const { token, account, branch, accountType, otp } = validateOtp;
282
+
283
+ if (!token) {
284
+ throw new HttpException({
285
+ statusCode: HttpStatus.UNAUTHORIZED,
286
+ code: 401020402,
287
+ message: 'Bank token should not be empty.',
288
+ data: { validateOtp }
289
+ }, HttpStatus.UNAUTHORIZED);
290
+ }
291
+
292
+ if (!account) {
293
+ throw new HttpException({
294
+ statusCode: HttpStatus.BAD_REQUEST,
295
+ code: 400020404,
296
+ message: 'Bank account number should not be empty.',
297
+ data: { validateOtp }
298
+ }, HttpStatus.BAD_REQUEST);
299
+ }
300
+
301
+ if (!accountType) {
302
+ throw new HttpException({
303
+ statusCode: HttpStatus.BAD_REQUEST,
304
+ code: 400020406,
305
+ message: 'Bank account type should not be empty.',
306
+ data: { validateOtp }
307
+ }, HttpStatus.BAD_REQUEST);
308
+ }
309
+
310
+ if (!otp) {
311
+ throw new HttpException({
312
+ statusCode: HttpStatus.BAD_REQUEST,
313
+ code: 400020408,
314
+ message: 'Mobile Number should not be empty.',
315
+ data: { validateOtp }
316
+ }, HttpStatus.BAD_REQUEST);
317
+ }
318
+
319
+ this.logger.log("Welcome Bank Validate OTP");
320
+
321
+ const isoTimestamp = new Date().toISOString();
322
+ const timeInSeconds = Math.floor(Date.parse(isoTimestamp) / 1000);
323
+ const totp = this.generateTOTP(timeInSeconds);
324
+ const totpPrevious = this.generateTOTP(timeInSeconds - 30);
325
+
326
+ this.logger.log(`TOTP GENERATED FOR WELCOME BANK VALIDATE OTP: ${totp}, For Time stamp: ${isoTimestamp}`);
327
+ this.logger.log(`TOTP GENERATED FOR PREVIOUS TIME: ${totpPrevious}`);
328
+
329
+ try {
330
+ const headers = {
331
+ 'Authorization': `Bearer ${token}`,
332
+ 'Content-Type': 'application/json',
333
+ 'X-SERVER-TIMESTAMP': `${isoTimestamp}`
334
+ };
335
+
336
+ let payload;
337
+
338
+ payload = {
339
+ "acc": account,
340
+ "br": branch,
341
+ "accType": accountType,
342
+ "otp": otp
343
+ }
344
+
345
+ if (String(this.config.WELCOMBANK_ENABLEENCRYPTION).toLowerCase() === 'true') {
346
+ payload = {data: this.encryptPayloadWithOTP(payload, totp)};
347
+ }
348
+
349
+ const httpsAgent = new https.Agent({
350
+ rejectUnauthorized: false,
351
+ });
352
+
353
+ const response = await axios.post(
354
+ `${this.config.WELCOMEBANK_URL}:${this.config.WELCOMEBANK_PORT}/api/validateotp`,
355
+ payload,
356
+ {
357
+ headers: headers,
358
+ httpsAgent
359
+ }
360
+ );
361
+
362
+ let responseData = response.data;
363
+ this.logger.log({ responseData: response }, 'Welcome Bank Validate OTP Successful');
364
+
365
+ if (String(this.config.WELCOMBANK_ENABLEENCRYPTION).toLowerCase() === 'true') {
366
+
367
+ const encryptedResponsePayload = responseData.data;
368
+
369
+ if (!encryptedResponsePayload) {
370
+ throw new Error("Encrypted response expected but not found");
371
+ }
372
+
373
+ let decryptedResponse;
374
+ try {
375
+ decryptedResponse = this.decryptPayloadWithOTP(encryptedResponsePayload, totp);
376
+ } catch (error) {
377
+ this.logger.warn("Decryption with current OTP failed, trying with previous OTP");
378
+ }
379
+
380
+ if (!decryptedResponse) {
381
+ decryptedResponse = this.decryptPayloadWithOTP(encryptedResponsePayload, totpPrevious);
382
+ }
383
+
384
+ return {
385
+ success: true,
386
+ data: decryptedResponse,
387
+ };
388
+
389
+ } else {
390
+
391
+ return {
392
+ success: true,
393
+ ...responseData,
394
+ };
395
+ }
396
+ }
397
+ catch (error) {
398
+ AxiosErrorHelper.handleAxiosError(error);
399
+ }
400
+ }
401
+
402
+ async processBalanceTransaction(fetchBalanceDto: FetchBankBalanceDto): Promise<any> {
403
+
404
+ const { token, permissionKey, account, branch, accountType } = fetchBalanceDto;
405
+
406
+ if (!token) {
407
+ throw new HttpException({
408
+ statusCode: HttpStatus.UNAUTHORIZED,
409
+ code: 401020502,
410
+ message: 'Bank token should not be empty.',
411
+ data: { fetchBalanceDto }
412
+ }, HttpStatus.UNAUTHORIZED);
413
+ }
414
+
415
+ if (!permissionKey) {
416
+ throw new HttpException({
417
+ statusCode: HttpStatus.UNAUTHORIZED,
418
+ code: 403020504,
419
+ message: 'Bank permission key should not be empty.',
420
+ data: { fetchBalanceDto }
421
+ }, HttpStatus.UNAUTHORIZED);
422
+ }
423
+
424
+ if (!account) {
425
+ throw new HttpException({
426
+ statusCode: HttpStatus.BAD_REQUEST,
427
+ code: 400020506,
428
+ message: 'Bank account number should not be empty.',
429
+ data: { fetchBalanceDto }
430
+ }, HttpStatus.BAD_REQUEST);
431
+ }
432
+
433
+ if (!accountType) {
434
+ throw new HttpException({
435
+ statusCode: HttpStatus.BAD_REQUEST,
436
+ code: 400020508,
437
+ message: 'Bank account type should not be empty.',
438
+ data: { fetchBalanceDto }
439
+ }, HttpStatus.BAD_REQUEST);
440
+ }
441
+
442
+ this.logger.log("Welcome Bank Balance Inquiry");
443
+
444
+ const isoTimestamp = new Date().toISOString();
445
+ const timeInSeconds = Math.floor(Date.parse(isoTimestamp) / 1000);
446
+ const totp = this.generateTOTP(timeInSeconds);
447
+ const totpPrevious = this.generateTOTP(timeInSeconds - 30);
448
+ this.logger.log(`TOTP GENERATED FOR WELCOME BANK BALANCE INQUIRY: ${totp}, For Time stamp: ${isoTimestamp}`);
449
+ this.logger.log(`TOTP GENERATED FOR PREVIOUS TIME: ${totpPrevious}`);
450
+
451
+ try {
452
+ const headers = {
453
+ 'Authorization': `Bearer ${token}`,
454
+ 'Content-Type': 'application/json',
455
+ 'X-SERVER-TIMESTAMP': `${new Date().toISOString()}`
456
+ };
457
+
458
+ let payload;
459
+
460
+ payload = {
461
+ "acc": account,
462
+ "br": branch,
463
+ "accType": accountType,
464
+ "permissionKey": permissionKey,
465
+ }
466
+
467
+ if (String(this.config.WELCOMBANK_ENABLEENCRYPTION).toLowerCase() === 'true') {
468
+ payload = {data: this.encryptPayloadWithOTP(payload, totp)};
469
+ }
470
+
471
+ const httpsAgent = new https.Agent({
472
+ rejectUnauthorized: false,
473
+ });
474
+
475
+ const response = await axios.post(
476
+ `${this.config.WELCOMEBANK_URL}:${this.config.WELCOMEBANK_PORT}/api/balanceinquiry`,
477
+ payload,
478
+ {
479
+ headers: headers,
480
+ httpsAgent
481
+ }
482
+ );
483
+
484
+ let responseData = response.data;
485
+
486
+ this.logger.log({ responseData: response }, 'Welcome Bank Balance Inquiry Successful');
487
+
488
+ if (String(this.config.WELCOMBANK_ENABLEENCRYPTION).toLowerCase() === 'true') {
489
+
490
+ const encryptedResponsePayload = responseData.data;
491
+
492
+ if (!encryptedResponsePayload) {
493
+ throw new Error("Encrypted response expected but not found");
494
+ }
495
+
496
+ let decryptedResponse;
497
+ try {
498
+ decryptedResponse = this.decryptPayloadWithOTP(encryptedResponsePayload, totp);
499
+ } catch (error) {
500
+ this.logger.warn("Decryption with current OTP failed, trying with previous OTP");
501
+ }
502
+
503
+ if (!decryptedResponse) {
504
+ decryptedResponse = this.decryptPayloadWithOTP(encryptedResponsePayload, totpPrevious);
505
+ }
506
+ return {
507
+ success: true,
508
+ data: decryptedResponse,
509
+ };
510
+
511
+ } else {
512
+
513
+ return {
514
+ success: true,
515
+ ...responseData,
516
+ };
517
+ }
518
+ }
519
+ catch (error) {
520
+ AxiosErrorHelper.handleAxiosError(error);
521
+ }
522
+ }
523
+
524
+ async accountCashIn(accountTransferDto: AccountTransferDto): Promise<any> {
525
+
526
+ const { token, permissionKey, sourceAccount, sourceBranch, sourceAccountType, destinationAccount, destinationBranch, destinationAccountType, amount } = accountTransferDto;
527
+
528
+ if (!token) {
529
+ throw new HttpException({
530
+ statusCode: HttpStatus.UNAUTHORIZED,
531
+ code: 401020602,
532
+ message: 'Bank token should not be empty.',
533
+ data: { accountTransferDto }
534
+ }, HttpStatus.UNAUTHORIZED);
535
+ }
536
+
537
+ if (!permissionKey) {
538
+ throw new HttpException({
539
+ statusCode: HttpStatus.FORBIDDEN,
540
+ code: 403020604,
541
+ message: 'Bank permission key should not be empty.',
542
+ data: { accountTransferDto }
543
+ }, HttpStatus.FORBIDDEN);
544
+ }
545
+
546
+ if (!sourceAccount) {
547
+ throw new HttpException({
548
+ statusCode: HttpStatus.BAD_REQUEST,
549
+ code: 400020606,
550
+ message: 'Bank source account number should not be empty.',
551
+ data: { accountTransferDto }
552
+ }, HttpStatus.BAD_REQUEST);
553
+ }
554
+
555
+ if (!sourceAccountType) {
556
+ throw new HttpException({
557
+ statusCode: HttpStatus.BAD_REQUEST,
558
+ code: 400020608,
559
+ message: 'Bank source account type should not be empty.',
560
+ data: { accountTransferDto }
561
+ }, HttpStatus.BAD_REQUEST);
562
+ }
563
+
564
+ if (!destinationAccount) {
565
+ throw new HttpException({
566
+ statusCode: HttpStatus.BAD_REQUEST,
567
+ code: 400020610,
568
+ message: 'Bank destination account number should not be empty.',
569
+ data: { accountTransferDto }
570
+ }, HttpStatus.BAD_REQUEST);
571
+ }
572
+
573
+ if (!destinationAccountType) {
574
+ throw new HttpException({
575
+ statusCode: HttpStatus.BAD_REQUEST,
576
+ code: 400020612,
577
+ message: 'Bank destination account type should not be empty.',
578
+ data: { accountTransferDto }
579
+ }, HttpStatus.BAD_REQUEST);
580
+ }
581
+
582
+ if (!amount) {
583
+ throw new HttpException({
584
+ statusCode: HttpStatus.BAD_REQUEST,
585
+ code: 400020613,
586
+ message: 'Amount should not be empty.',
587
+ data: { accountTransferDto }
588
+ }, HttpStatus.BAD_REQUEST);
589
+ }
590
+
591
+ this.logger.log("Welcome Bank cash in");
592
+
593
+ const isoTimestamp = new Date().toISOString();
594
+ const timeInSeconds = Math.floor(Date.parse(isoTimestamp) / 1000);
595
+ const totp = this.generateTOTP(timeInSeconds);
596
+ const totpPrevious = this.generateTOTP(timeInSeconds - 30);
597
+
598
+ this.logger.log(`TOTP GENERATED FOR WELCOME BANK CASH IN: ${totp}, For Time stamp: ${isoTimestamp}`);
599
+ this.logger.log(`TOTP GENERATED FOR PREVIOUS TIME: ${totpPrevious}`);
600
+
601
+ try {
602
+ const headers = {
603
+ 'Authorization': `Bearer ${token}`,
604
+ 'Content-Type': 'application/json',
605
+ 'X-SERVER-TIMESTAMP': `${new Date().toISOString()}`
606
+ };
607
+
608
+ let payload;
609
+
610
+ payload = {
611
+ "permissionKey": permissionKey,
612
+ "sourceAcc": sourceAccount,
613
+ "sourceBr": sourceBranch,
614
+ "sourceAccType": sourceAccountType,
615
+ "destAcc": destinationAccount,
616
+ "destBr": destinationBranch,
617
+ "destAccType": destinationAccountType,
618
+ "trnAmt": amount
619
+ }
620
+
621
+ if (String(this.config.WELCOMBANK_ENABLEENCRYPTION).toLowerCase() === 'true') {
622
+ payload = {data: this.encryptPayloadWithOTP(payload, totp)};
623
+ }
624
+
625
+ const httpsAgent = new https.Agent({
626
+ rejectUnauthorized: false,
627
+ });
628
+
629
+ const response = await axios.post(
630
+ `${this.config.WELCOMEBANK_URL}:${this.config.WELCOMEBANK_PORT}/api/cashin`,
631
+ payload,
632
+ {
633
+ headers: headers,
634
+ httpsAgent
635
+ }
636
+ );
637
+
638
+ let responseData = response.data;
639
+ this.logger.log({ responseData: response }, 'Welcome Bank Cash In Successful');
640
+
641
+ if (String(this.config.WELCOMBANK_ENABLEENCRYPTION).toLowerCase() === 'true') {
642
+
643
+ const encryptedResponsePayload = responseData.data;
644
+
645
+ if (!encryptedResponsePayload) {
646
+ throw new Error("Encrypted response expected but not found");
647
+ }
648
+
649
+ let decryptedResponse;
650
+ try {
651
+ decryptedResponse = this.decryptPayloadWithOTP(encryptedResponsePayload, totp);
652
+ } catch (error) {
653
+ this.logger.warn("Decryption with current OTP failed, trying with previous OTP");
654
+ }
655
+
656
+ if (!decryptedResponse) {
657
+ decryptedResponse = this.decryptPayloadWithOTP(encryptedResponsePayload, totpPrevious);
658
+ }
659
+
660
+ return {
661
+ success: true,
662
+ data: decryptedResponse,
663
+ };
664
+
665
+ } else {
666
+
667
+ return {
668
+ success: true,
669
+ ...responseData,
670
+ };
671
+ }
672
+ }
673
+ catch (error) {
674
+ AxiosErrorHelper.handleAxiosError(error);
675
+ }
676
+ }
677
+
678
+ async accountDeposit(accountTransferDto: AccountTransferDto): Promise<any> {
679
+
680
+ const { token, permissionKey, sourceAccount, sourceBranch, sourceAccountType, destinationAccount, destinationBranch, destinationAccountType, amount } = accountTransferDto;
681
+
682
+ if (!token) {
683
+ throw new HttpException({
684
+ statusCode: HttpStatus.UNAUTHORIZED,
685
+ code: 401020702,
686
+ message: 'Bank token should not be empty.',
687
+ data: { accountTransferDto }
688
+ }, HttpStatus.UNAUTHORIZED);
689
+ }
690
+
691
+ if (!permissionKey) {
692
+ throw new HttpException({
693
+ statusCode: HttpStatus.FORBIDDEN,
694
+ code: 403020704,
695
+ message: 'Bank permission key should not be empty.',
696
+ data: { accountTransferDto }
697
+ }, HttpStatus.FORBIDDEN);
698
+ }
699
+
700
+ if (!sourceAccount) {
701
+ throw new HttpException({
702
+ statusCode: HttpStatus.BAD_REQUEST,
703
+ code: 400020706,
704
+ message: 'Bank source account number should not be empty.',
705
+ data: { accountTransferDto }
706
+ }, HttpStatus.BAD_REQUEST);
707
+ }
708
+
709
+ if (!sourceAccountType) {
710
+ throw new HttpException({
711
+ statusCode: HttpStatus.BAD_REQUEST,
712
+ code: 400020708,
713
+ message: 'Bank source account type should not be empty.',
714
+ data: { accountTransferDto }
715
+ }, HttpStatus.BAD_REQUEST);
716
+ }
717
+
718
+ if (!destinationAccount) {
719
+ throw new HttpException({
720
+ statusCode: HttpStatus.BAD_REQUEST,
721
+ code: 400020710,
722
+ message: 'Bank destination account number should not be empty.',
723
+ data: { accountTransferDto }
724
+ }, HttpStatus.BAD_REQUEST);
725
+ }
726
+
727
+ if (!destinationAccountType) {
728
+ throw new HttpException({
729
+ statusCode: HttpStatus.BAD_REQUEST,
730
+ code: 400020712,
731
+ message: 'Bank destination account type should not be empty.',
732
+ data: { accountTransferDto }
733
+ }, HttpStatus.BAD_REQUEST);
734
+ }
735
+
736
+ if (!amount) {
737
+ throw new HttpException({
738
+ statusCode: HttpStatus.BAD_REQUEST,
739
+ code: 400020713,
740
+ message: 'Amount should not be empty.',
741
+ data: { accountTransferDto }
742
+ }, HttpStatus.BAD_REQUEST);
743
+ }
744
+
745
+ this.logger.log("Welcome Bank deposit");
746
+
747
+ const isoTimestamp = new Date().toISOString();
748
+ const timeInSeconds = Math.floor(Date.parse(isoTimestamp) / 1000);
749
+ const totp = this.generateTOTP(timeInSeconds);
750
+ const totpPrevious = this.generateTOTP(timeInSeconds - 30);
751
+
752
+ this.logger.log(`TOTP GENERATED FOR WELCOME BANK DEPOSIT: ${totp}, For Time stamp: ${isoTimestamp}`);
753
+ this.logger.log(`TOTP GENERATED FOR PREVIOUS TIME: ${totpPrevious}`);
754
+
755
+ try {
756
+ const headers = {
757
+ 'Authorization': `Bearer ${token}`,
758
+ 'Content-Type': 'application/json',
759
+ 'X-SERVER-TIMESTAMP': `${new Date().toISOString()}`
760
+ };
761
+
762
+
763
+ let payload;
764
+ payload = {
765
+ "permissionKey": permissionKey,
766
+ "sourceAcc": sourceAccount,
767
+ "sourceBr": sourceBranch,
768
+ "sourceAccType": sourceAccountType,
769
+ "destAcc": destinationAccount,
770
+ "destBr": destinationBranch,
771
+ "destAccType": destinationAccountType,
772
+ "trnAmt": amount
773
+ }
774
+
775
+
776
+ if (String(this.config.WELCOMBANK_ENABLEENCRYPTION).toLowerCase() === 'true') {
777
+ payload = {data: this.encryptPayloadWithOTP(payload, totp)};
778
+ }
779
+
780
+ const httpsAgent = new https.Agent({
781
+ rejectUnauthorized: false,
782
+ });
783
+
784
+ const response = await axios.post(
785
+ `${this.config.WELCOMEBANK_URL}:${this.config.WELCOMEBANK_PORT}/api/customerdeposit`,
786
+ payload,
787
+ {
788
+ headers: headers,
789
+ httpsAgent
790
+ }
791
+ );
792
+
793
+ let responseData = response.data;
794
+ this.logger.log({ responseData: response.data }, 'Welcom Bank Deposit Successful');
795
+
796
+ if (String(this.config.WELCOMBANK_ENABLEENCRYPTION).toLowerCase() === 'true') {
797
+
798
+ const encryptedResponsePayload = responseData.data;
799
+
800
+ if (!encryptedResponsePayload) {
801
+ throw new Error("Encrypted response expected but not found");
802
+ }
803
+
804
+ let decryptedResponse;
805
+ try {
806
+ decryptedResponse = this.decryptPayloadWithOTP(encryptedResponsePayload, totp);
807
+ } catch (error) {
808
+ this.logger.warn("Decryption with current OTP failed, trying with previous OTP");
809
+ }
810
+
811
+ if (!decryptedResponse) {
812
+ decryptedResponse = this.decryptPayloadWithOTP(encryptedResponsePayload, totpPrevious);
813
+ }
814
+
815
+ return {
816
+ success: true,
817
+ data: decryptedResponse,
818
+ };
819
+
820
+ } else {
821
+
822
+ return {
823
+ success: true,
824
+ ...responseData,
825
+ };
826
+ }
827
+ }
828
+ catch (error) {
829
+ AxiosErrorHelper.handleAxiosError(error);
830
+ }
831
+ }
832
+
833
+ async getTransactionHistory(transactionHistoryDto: TransactionHistoryDto) {
834
+
835
+ const { token, permissionKey, account, branch, accountType, dateFrom, dateTo, page } = transactionHistoryDto;
836
+
837
+ if (!token) {
838
+ throw new HttpException({
839
+ statusCode: HttpStatus.UNAUTHORIZED,
840
+ code: 401020802,
841
+ message: 'Bank token should not be empty.',
842
+ data: { transactionHistoryDto }
843
+ }, HttpStatus.UNAUTHORIZED);
844
+ }
845
+
846
+ if (!permissionKey) {
847
+ throw new HttpException({
848
+ statusCode: HttpStatus.FORBIDDEN,
849
+ code: 403020804,
850
+ message: 'Bank permission key should not be empty.',
851
+ data: { transactionHistoryDto }
852
+ }, HttpStatus.FORBIDDEN);
853
+ }
854
+
855
+ if (!account) {
856
+ throw new HttpException({
857
+ statusCode: HttpStatus.BAD_REQUEST,
858
+ code: 400020806,
859
+ message: 'Bank account number should not be empty.',
860
+ data: { transactionHistoryDto }
861
+ }, HttpStatus.BAD_REQUEST);
862
+ }
863
+
864
+ if (!accountType) {
865
+ throw new HttpException({
866
+ statusCode: HttpStatus.BAD_REQUEST,
867
+ code: 400020808,
868
+ message: 'Bank account type should not be empty.',
869
+ data: { transactionHistoryDto }
870
+ }, HttpStatus.BAD_REQUEST);
871
+ }
872
+
873
+ if (!dateFrom) {
874
+ throw new HttpException({
875
+ statusCode: HttpStatus.BAD_REQUEST,
876
+ code: 400020810,
877
+ message: 'Date From should not be empty.',
878
+ data: { transactionHistoryDto }
879
+ }, HttpStatus.BAD_REQUEST);
880
+ }
881
+
882
+ if (!dateTo) {
883
+ throw new HttpException({
884
+ statusCode: HttpStatus.BAD_REQUEST,
885
+ code: 400020812,
886
+ message: 'Date From should not be empty.',
887
+ data: { transactionHistoryDto }
888
+ }, HttpStatus.BAD_REQUEST);
889
+ }
890
+
891
+ this.logger.log("Welcome Bank transaction history");
892
+
893
+ const isoTimestamp = new Date().toISOString();
894
+ const timeInSeconds = Math.floor(Date.parse(isoTimestamp) / 1000);
895
+ const totp = this.generateTOTP(timeInSeconds);
896
+ const totpPrevious = this.generateTOTP(timeInSeconds - 30);
897
+
898
+ this.logger.log(`TOTP GENERATED FOR WELCOME BANK VALIDATE OTP: ${totp}, For Time stamp: ${isoTimestamp}`);
899
+ this.logger.log(`TOTP GENERATED FOR PREVIOUS TIME: ${totpPrevious}`);
900
+
901
+ try {
902
+ const headers = {
903
+ 'Authorization': `Bearer ${token}`,
904
+ 'Content-Type': 'application/json',
905
+ 'X-SERVER-TIMESTAMP': `${new Date().toISOString()}`
906
+ };
907
+
908
+ let payload;
909
+ payload = {
910
+ "acc": account,
911
+ "br": branch,
912
+ "accType": accountType,
913
+ "permissionKey": permissionKey,
914
+ "dateFrom": dateFrom,
915
+ "dateTo": dateTo,
916
+ "pageNo": page
917
+ }
918
+
919
+ if (String(this.config.WELCOMBANK_ENABLEENCRYPTION).toLowerCase() === 'true') {
920
+ payload = {data: this.encryptPayloadWithOTP(payload, totp)};
921
+ }
922
+
923
+ const httpsAgent = new https.Agent({
924
+ rejectUnauthorized: false,
925
+ });
926
+
927
+ const response = await axios.post(
928
+ `${this.config.WELCOMEBANK_URL}:${this.config.WELCOMEBANK_PORT}/api/transhistory`,
929
+ payload,
930
+ {
931
+ headers: headers,
932
+ httpsAgent
933
+ }
934
+ );
935
+ let responseData = response.data;
936
+ this.logger.log({ responseData: response.data }, 'Welcome Bank Transaction History Successful');
937
+
938
+ if (String(this.config.WELCOMBANK_ENABLEENCRYPTION).toLowerCase() === 'true') {
939
+
940
+ const encryptedResponsePayload = responseData.data;
941
+
942
+ if (!encryptedResponsePayload) {
943
+ throw new Error("Encrypted response expected but not found");
944
+ }
945
+
946
+ let decryptedResponse;
947
+ try {
948
+ decryptedResponse = this.decryptPayloadWithOTP(encryptedResponsePayload, totp);
949
+ } catch (error) {
950
+ this.logger.warn("Decryption with current OTP failed, trying with previous OTP");
951
+ }
952
+
953
+ if (!decryptedResponse) {
954
+ decryptedResponse = this.decryptPayloadWithOTP(encryptedResponsePayload, totpPrevious);
955
+ }
956
+
957
+ return {
958
+ success: true,
959
+ data: decryptedResponse,
960
+ };
961
+
962
+ } else {
963
+
964
+ return {
965
+ success: true,
966
+ ...responseData,
967
+ };
968
+ }
969
+ }
970
+ catch (error) {
971
+ AxiosErrorHelper.handleAxiosError(error);
972
+ }
973
+ }
974
+
975
+ async findAccountDetailsRaw(token: string, userid: number) {
976
+ return "Sorry Service Currently Unavaible";
977
+ }
978
+
979
+ async accountTransfer(token: string, useridFrom: string, useridTo: string, amount: number) {
980
+ return "Sorry Service Currently Unavaible";
981
+ }
982
+
983
+ generateOtp(mobile: string, acc: string, bankid: string): string {
984
+ return "Sorry Service Currently Unavaible";
985
+ }
986
+
987
+ generateRandomOtp(length: number): string {
988
+ return "Sorry Service Currently Unavaible";
989
+ }
990
+ }