ravcredit-lib 0.0.19 → 0.0.21

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 (54) hide show
  1. package/fesm2022/ravcredit-lib.mjs +2127 -0
  2. package/fesm2022/ravcredit-lib.mjs.map +1 -0
  3. package/index.d.ts +1734 -0
  4. package/package.json +25 -14
  5. package/ng-package.json +0 -7
  6. package/src/index.d.ts +0 -45
  7. package/src/lib/ravcredit-lib.component.spec.ts +0 -23
  8. package/src/lib/ravcredit-lib.component.ts +0 -16
  9. package/src/lib/ravcredit-lib.service.spec.ts +0 -16
  10. package/src/lib/ravcredit-lib.service.ts +0 -9
  11. package/src/lib/v1/const/constants.ts +0 -35
  12. package/src/lib/v1/idb/idb.service.spec.ts +0 -16
  13. package/src/lib/v1/idb/indexed-db.service.ts +0 -396
  14. package/src/lib/v1/objects/oAddress.ts +0 -19
  15. package/src/lib/v1/objects/oBusiness.ts +0 -112
  16. package/src/lib/v1/objects/oClient.ts +0 -46
  17. package/src/lib/v1/objects/oConekta.ts +0 -408
  18. package/src/lib/v1/objects/oContract.ts +0 -31
  19. package/src/lib/v1/objects/oContractAll.ts +0 -38
  20. package/src/lib/v1/objects/oCustomer.ts +0 -36
  21. package/src/lib/v1/objects/oDevice.ts +0 -5
  22. package/src/lib/v1/objects/oFinancial.ts +0 -32
  23. package/src/lib/v1/objects/oGlobal.ts +0 -192
  24. package/src/lib/v1/objects/oLogIn.ts +0 -43
  25. package/src/lib/v1/objects/oNewPayment.ts +0 -18
  26. package/src/lib/v1/objects/oNotification.ts +0 -34
  27. package/src/lib/v1/objects/oPassport.ts +0 -65
  28. package/src/lib/v1/objects/oUser.ts +0 -35
  29. package/src/lib/v1/objects/oVerification.ts +0 -100
  30. package/src/lib/v1/util/UtilBusiness.ts +0 -186
  31. package/src/lib/v1/util/UtilClient.ts +0 -295
  32. package/src/lib/v1/util/UtilConekta.ts +0 -97
  33. package/src/lib/v1/util/UtilContract.ts +0 -432
  34. package/src/lib/v1/util/UtilDashboard.ts +0 -19
  35. package/src/lib/v1/util/UtilDynamiCore.ts +0 -752
  36. package/src/lib/v1/util/UtilNotification.ts +0 -46
  37. package/src/lib/v1/util/UtilPassport.ts +0 -32
  38. package/src/lib/v1/util/UtilPayment.ts +0 -22
  39. package/src/lib/v1/util/UtilTime.ts +0 -179
  40. package/src/lib/v1/util/UtilsHttp.ts +0 -25
  41. package/src/lib/v2/const/constants.ts +0 -37
  42. package/src/lib/v2/messaging/messaging.ts +0 -10
  43. package/src/lib/v2/objects/oAsset.ts +0 -48
  44. package/src/lib/v2/objects/oAws.ts +0 -8
  45. package/src/lib/v2/objects/oCatalog.ts +0 -6
  46. package/src/lib/v2/objects/oClient.ts +0 -37
  47. package/src/lib/v2/objects/oCompany.ts +0 -10
  48. package/src/lib/v2/objects/oContract.ts +0 -10
  49. package/src/lib/v2/objects/oMediaDto.ts +0 -10
  50. package/src/lib/v2/objects/oScoreDto.ts +0 -40
  51. package/src/public-api.ts +0 -45
  52. package/tsconfig.lib.json +0 -15
  53. package/tsconfig.lib.prod.json +0 -11
  54. package/tsconfig.spec.json +0 -15
@@ -1,432 +0,0 @@
1
- import {UntypedFormArray, UntypedFormControl, Validators} from "@angular/forms";
2
- import {cClient, cUserReference} from "./UtilClient";
3
- // import {TaskState} from "firebase/storage";
4
- import {cBusinessDeadlines} from "./UtilBusiness";
5
- import {IDCAccount} from "./UtilDynamiCore";
6
- import {oDevice} from '../objects/oDevice';
7
- import {oFinancial} from '../objects/oFinancial';
8
- import {cAddress, oAddress} from '../objects/oAddress';
9
- import {oContract} from '../objects/oContract';
10
- import {oClient, oUserReference} from '../objects/oClient';
11
- import {tyClientContract} from '../objects/oGlobal';
12
- import {oAsset, oAssetBrand, oAssetCategory} from '../../v2/objects/oAsset';
13
- import {oCatalog} from '../../v2/objects/oCatalog';
14
- import {oScoreReference} from '../../v2/objects/oScoreDto';
15
- // import {oScore, oScoreReference} from '../../v2/objects/oClient';
16
-
17
- export enum eProvider {
18
- none = "",
19
- Conekta = "Conekta",
20
- Passport = "Passport",
21
- DynamiCore = "DynamiCore",
22
- }
23
-
24
- // export type ProgressTaskStatus = TaskState | "uploading" | "idle" | "generating" | "unauthorized"
25
-
26
- export const cDevice: oDevice = {
27
- device: "",
28
- IMEI: ""
29
- }
30
-
31
- export const cFinancial: oFinancial = {
32
- total: 0,
33
- initial: 0,
34
- deadlines: cBusinessDeadlines,
35
- initDate: 0,
36
- weeklyPayment: 0,
37
- pendingOf: [],
38
- progress: [],
39
- interest: 0,
40
- provider: eProvider.DynamiCore,
41
- financed: 0,
42
- nextPayment: 0,
43
- amount_commission_opening: 0,
44
- principal_disbursed: 0,
45
- expected_disbursed: 0, // ---------
46
- credit_type: 'Arrendamiento',
47
- interest_rate: 0,
48
- commission_opening: 0,
49
- interest_arrears: 0,
50
- }
51
-
52
- export const cContract: oContract = {
53
- id: "",
54
- client: "",
55
- address: cAddress,
56
- device: cDevice,
57
- financial: cFinancial,
58
- by: "",
59
- active: true
60
- }
61
-
62
- export class FactoryContract {
63
-
64
- public static FormClient(client?: oClient) {
65
- let data = cClient
66
-
67
- if (client) data = client
68
-
69
- return {
70
- name: new UntypedFormControl(data.name, [Validators.required, Validators.minLength(10)]),
71
- email: new UntypedFormControl(data.username, [Validators.required, Validators.email]),
72
- phone: new UntypedFormControl(data.phone, [Validators.required, Validators.min(10)]),
73
- curp: new UntypedFormControl(data.curp, [Validators.required, Validators.minLength(16)]),
74
- userReferences: new UntypedFormArray([])
75
- }
76
- }
77
-
78
- public static CreateUserReferenceFormObj(user: oUserReference) {
79
- let data = cUserReference
80
-
81
- if (user.name != "") data = user
82
-
83
- return {
84
- name: new UntypedFormControl(data.name, [Validators.required, Validators.minLength(10)]),
85
- phone: new UntypedFormControl(data.phone, [Validators.required]),
86
- relationship: new UntypedFormControl(data.relationship, [Validators.required]),
87
- }
88
- }
89
-
90
- public static FormAddress(address?: oAddress) {
91
- let data = cAddress
92
-
93
- if (address) data = address
94
-
95
- return {
96
- street: new UntypedFormControl(data.street, Validators.required),
97
- neighbor: new UntypedFormControl(data.neighbor, Validators.required),
98
- cp: new UntypedFormControl(data.zip, Validators.required),
99
- ext: new UntypedFormControl(data.ext, Validators.required),
100
- int: new UntypedFormControl(data.int),
101
- city: new UntypedFormControl(data.city, Validators.required),
102
- state: new UntypedFormControl(data.state, Validators.required),
103
- }
104
- }
105
-
106
- public static FormDevice(device?: oDevice) {
107
- let data = cDevice
108
-
109
- if (device) data = device
110
-
111
- return {
112
- model: new UntypedFormControl(data.device, Validators.required),
113
- IMEI: new UntypedFormControl(data.IMEI, Validators.required),
114
- ID: new UntypedFormControl(data.id),
115
- }
116
- }
117
-
118
- public static FormFinancial(financial?: oFinancial) {
119
- let data = cFinancial
120
-
121
- if (financial) data = financial
122
-
123
- data.credit_type = "Arrendamiento"
124
- // data.deadlines.weeks = cBusinessDeadlines
125
-
126
- return {
127
- total: new UntypedFormControl(data.total, [Validators.required, Validators.min(1)]),
128
- initial: new UntypedFormControl(data.initial, [Validators.required]),
129
- financed: new UntypedFormControl(data.financed, Validators.min(1)),
130
- weeklyPayment: new UntypedFormControl(data.weeklyPayment, [Validators.required, Validators.min(1)]),
131
- deadlines: new UntypedFormControl(data.deadlines, [Validators.required]),
132
- initDate: new UntypedFormControl(data.initDate),
133
- provider: new UntypedFormControl(data.provider),
134
-
135
- credit_type: new UntypedFormControl(data.credit_type ? data.credit_type : 0),
136
- interest_rate: new UntypedFormControl(data.interest_rate ? data.interest_rate : 0), // interes credit dynamic
137
- commission_opening: new UntypedFormControl(data.commission_opening ? data.commission_opening : 0),
138
- interest_arrears: new UntypedFormControl(data.interest_arrears ? data.interest_arrears : 0), // intereses moratorios dynamic
139
-
140
- amount_commission_opening: new UntypedFormControl(data.amount_commission_opening), // comision por apertura dynamic
141
- principal_disbursed: new UntypedFormControl(data.principal_disbursed),
142
- expected_disbursed: new UntypedFormControl(data.expected_disbursed)
143
- }
144
- }
145
-
146
- public static CreateContractFromFormObj(data: any, finalPay: number) {
147
- const date = new Date()
148
-
149
- const device: oDevice = {
150
- device: data["device"][0].model,
151
- id: data["device"][0].ID,
152
- IMEI: data["device"][0].IMEI
153
- }
154
- const address: oAddress = {
155
- street: data["address"][0].street,
156
- city: data["address"][0].city,
157
- neighbor: data["address"][0].neighbor,
158
- zip: data["address"][0].cp,
159
- ext: data["address"][0].ext,
160
- int: data["address"][0].int,
161
- state: data["address"][0].state
162
- }
163
-
164
- const financial: oFinancial = {
165
- total: Number(data["financial"][0].total),
166
- initial: data["financial"][0].initial,
167
- deadlines: data["financial"][0].deadlines,
168
- progress: [],
169
- pendingOf: [],
170
- weeklyPayment: data["financial"][0].weeklyPayment,
171
- interest: data["financial"][0].interest_rate,
172
- finalDate: date.getTime() + (data["financial"][0].deadlines.weeks * (604800 * 1000)),
173
- initDate: date.getDate(),
174
- dayCut: date.getDate(),
175
- provider: data["financial"][0].provider,
176
- finalPayment: finalPay,
177
- financed: data["financial"][0].financed,
178
- nextPayment: data["financial"][0].nextPayment
179
- }
180
- if (data["financial"][0].provider == eProvider.DynamiCore) {
181
- financial.initial = data["financial"][0].amount_commission_opening ? Number(data["financial"][0].amount_commission_opening) : 0
182
- financial.expected_disbursed = data["financial"][0].expected_disbursed ? Number(data["financial"][0].expected_disbursed) : 0
183
- financial.principal_disbursed = data["financial"][0].principal_disbursed ? Number(data["financial"][0].principal_disbursed) : 0
184
- financial.interest_arrears = data["financial"][0].interest_rate ? Number(data["financial"][0].interest_rate) : 0
185
- financial.commission_opening = data["financial"][0].commission_opening ? Number(data["financial"][0].commission_opening) : 0
186
- financial.credit_type = data["financial"][0].credit_type ? data["financial"][0].credit_type : ""
187
- financial.clabe = data["financial"][0].clabe ? data["financial"][0].clabe : ""
188
- }
189
-
190
- if (data["financial"][0].amount_commission_opening != undefined) {
191
- if (Number(data["financial"][0].amount_commission_opening) > 0)
192
- financial.initial = Number(data["financial"][0].amount_commission_opening)
193
- else
194
- financial.initial = Number(data["financial"][0].initial)
195
- }
196
-
197
- if (Number(data["financial"][0].amount_commission_opening) > 0)
198
- financial.amount_commission_opening = Number(data["financial"][0].amount_commission_opening)
199
- else
200
- financial.amount_commission_opening = financial.initial
201
-
202
- if (financial.nextPayment == undefined) financial.nextPayment = 0
203
-
204
- const contract: oContract = {
205
- id: "",
206
- client: "",
207
- address: address,
208
- device: device,
209
- financial: financial,
210
- by: "",
211
- active: true,
212
- lastPayment: date.getTime(),
213
- createdAt: date.getTime()
214
- }
215
- return contract
216
- }
217
-
218
- public static CreateContractToConektaObj(data: oContract, monthlyPay: number, finalPay: number) {
219
- const o: any = {}
220
- const score: oScoreReference = {
221
- name: "",
222
- score: 0
223
- }
224
- const catalog: oCatalog = {
225
- name: "",
226
- description: "",
227
- id: "",
228
- createdAt: 0
229
- }
230
- const brand : oAssetBrand = {
231
- name: "",
232
- id: "",
233
- description: ""
234
- }
235
- const category : oAssetCategory = {
236
- name: "",
237
- id: "",
238
- createAt: 0
239
- }
240
- const deviceV2: oAsset = {
241
- name: "",
242
- id: "",
243
- createAt: new Date().getTime(),
244
- category: category,
245
- brand: brand,
246
- price: 0,
247
- model: "",
248
- imageUrl: [],
249
- paymentOption: [],
250
- catalog: catalog,
251
- offers: [],
252
- score: score,
253
- IMEI: ""
254
- }
255
-
256
- const device: oDevice = {
257
- device: data.device.device,
258
- id: data.device.id,
259
- IMEI: data.device.IMEI
260
- }
261
- const address: oAddress = {
262
- street: data.address.street,
263
- city: data.address.city,
264
- neighbor: data.address.neighbor,
265
- zip: data.address.zip,
266
- ext: data.address.ext,
267
- int: data.address.int,
268
- state: data.address.state
269
- }
270
- const financial: oFinancial = {
271
- total: data.financial.total,
272
- initial: data.financial.initial,
273
- deadlines: data.financial.deadlines,
274
- progress: data.financial.progress,
275
- pendingOf: data.financial.pendingOf,
276
- weeklyPayment: data.financial.weeklyPayment,
277
- interest: data.financial.interest,
278
- finalDate: data.financial.finalDate,
279
- initDate: data.financial.initDate,
280
- dayCut: data.financial.dayCut,
281
- provider: data.financial.provider,
282
- finalPayment: data.financial.finalPayment,
283
- financed: data.financial.financed,
284
- nextPayment: data.financial.nextPayment
285
- }
286
- const contract: oContract = {
287
- id: "",
288
- client: "",
289
- address: address,
290
- device: device,
291
- financial: financial,
292
- by: "",
293
- active: true
294
- }
295
- return contract
296
- }
297
-
298
- public static CreateAuthForm(username: string, curp: string) {
299
- const password: string = this.createPassword(curp)
300
- return {
301
- username: new UntypedFormControl(username, Validators.required),
302
- password: new UntypedFormControl(password, Validators.required),
303
- }
304
- }
305
-
306
- public static createPassword(curp: string): string {
307
- const _curp = curp.split("")
308
- let password = ""
309
- const limit = 7
310
-
311
- if (_curp.length < 16) return ""
312
-
313
- password += _curp[0].toLowerCase()
314
-
315
- for (let i = 1; i <= limit; i++)
316
- password += _curp[i].toUpperCase()
317
-
318
- password += `*`
319
- return password
320
- }
321
-
322
- public static MapperTypeContCli_Contract(_contract: tyClientContract): oContract {
323
- const contract: oContract = {
324
- id: _contract.contract!,
325
- client: _contract.client,
326
- address: _contract.address,
327
- device: _contract.device,
328
- financial: _contract.financial,
329
- by: _contract.by,
330
- active: _contract.active,
331
- lastPayment: _contract.lastPayment,
332
- createdAt: _contract.createdAt,
333
- dynamicAccount: _contract.dynamicAccount,
334
- }
335
-
336
- return contract
337
- }
338
-
339
- public static MapperSyncContractDynamic(base: oContract, account: IDCAccount): oContract {
340
- let nContract = base
341
- let _financial = base.financial
342
- let _device = base.device
343
-
344
-
345
- const financial: oFinancial = {
346
- total: _financial.total,
347
- initial: account.properties.amount_commission_opening ? account.properties.amount_commission_opening : _financial.initial,
348
- deadlines: _financial.deadlines,
349
- progress: _financial.progress ? _financial.progress : [],
350
- pendingOf: _financial.pendingOf ? _financial.pendingOf : [],
351
- weeklyPayment: _financial.weeklyPayment,
352
- interest: _financial.interest,
353
- finalDate: _financial.finalDate,
354
- initDate: _financial.initDate,
355
- dayCut: _financial.dayCut,
356
- provider: _financial.provider,
357
- finalPayment: _financial.finalPayment,
358
- financed: _financial.financed,
359
- nextPayment: _financial.nextPayment ? _financial.nextPayment : 0,
360
-
361
- amount_commission_opening:
362
- account.properties.amount_commission_opening,
363
-
364
- expected_disbursed:
365
- account.properties.expected_disbursed ?
366
- Number(account.properties.expected_disbursed) :
367
- Number(_financial.expected_disbursed),
368
-
369
- principal_disbursed:
370
- account.properties.principal_disbursed ?
371
- account.properties.principal_disbursed :
372
- _financial.principal_disbursed,
373
-
374
- commission_opening:
375
- account.config.commission_opening ?
376
- Number(account.config.commission_opening) :
377
- Number(_financial.commission_opening),
378
-
379
- credit_type:
380
- account.config.credit_type ? account.config.credit_type : _financial.credit_type,
381
-
382
- clabe:
383
- String(account.properties.clabe ? account.properties.clabe : _financial.clabe)
384
- }
385
-
386
- const interestArrears = account.config.interest_arrears
387
- const prevInterestArrears = _financial.interest_arrears
388
- if (interestArrears != undefined) {
389
- financial.interest_arrears = interestArrears
390
- } else if (prevInterestArrears != undefined) {
391
- financial.interest_arrears = prevInterestArrears
392
- } else {
393
- financial.interest_arrears = 0
394
- }
395
-
396
- const interest = account.config.interest_rate
397
- const prevInterest = _financial.interest
398
- if (interest != undefined) {
399
- financial.interest = interest
400
- } else if (prevInterest != undefined) {
401
- financial.interest = prevInterest
402
- } else {
403
- financial.interest = 0
404
- }
405
-
406
- if (account.properties.amount_commission_opening != undefined) {
407
- if (Number(account.properties.amount_commission_opening) > 0) {
408
- financial.initial = Number(account.properties.amount_commission_opening)
409
- financial.amount_commission_opening = Number(account.properties.amount_commission_opening)
410
- } else {
411
- financial.initial = Number(_financial.initial)
412
- financial.amount_commission_opening = financial.initial
413
- }
414
- }
415
-
416
- const seller: string | undefined = account.properties.seller_name
417
- nContract.by = seller != null ? seller : ""
418
-
419
- nContract.device.id = _device.id ? _device.id : ""
420
-
421
- nContract.financial = financial
422
- return nContract
423
- }
424
- }
425
-
426
- export enum eContractStatus {
427
- APPROVED = 'APPROVED',
428
- DENIED = 'DENIED',
429
- CANCELED = 'CANCELED',
430
- PENDING = 'PENDING',
431
- CHECKING = 'CHECKING',
432
- }
@@ -1,19 +0,0 @@
1
- import {oContractMetrics} from '../objects/oGlobal';
2
-
3
- export const cContractMetrics: oContractMetrics = {
4
- total: 0,
5
- activated: 0,
6
- paused: 0,
7
- completed: 0,
8
- canceled: 0,
9
- late: 0,
10
- conektaCount: 0,
11
- dynamicCount: 0,
12
- passportCount: 0,
13
- rateTotal: 0,
14
- rateActive: 0,
15
- ratePaused: 0,
16
- rateComplete: 0,
17
- rateCanceled: 0,
18
- rateLate: 0
19
- }