ravcredit-lib 0.0.18 → 0.0.20

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