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,752 +0,0 @@
1
- import {UntypedFormControl, Validators} from "@angular/forms";
2
- import {oClient} from '../objects/oClient';
3
- import {oContract} from '../objects/oContract';
4
-
5
- export enum eReferenceStatusRav {
6
- "Disponible" = "Disponible",
7
- "Active" = "Activo con credito vigente",
8
- "ActiveEnded" = "Activo sin credito vigente",
9
- "Registered" = "Registrado",
10
- "NonRegistered" = "No registrado",
11
- "NonVerified" = "No verificado",
12
- "Rejected" = "Rechazado",
13
- "Pending" = "Pendiente"
14
- }
15
-
16
- export enum eAccountDynamicStatus {
17
- "OK" = "Con cuenta activa",
18
- "NOK" = "Sin cuenta activa",
19
- }
20
-
21
- //
22
- // export enum eAccountDynamicRegister {
23
- // "Active" = "Activo", // Ok
24
- // "NonAuthorized" = "No autorizado",
25
- // "Authorized" = "Autorizado", // Non ref
26
- // "Accepted" = "Aceptado", // Non ref
27
- // "Rejected" = "Rechazado", // Non ref
28
- // "Pending" = "Pendiente", // Non ref
29
- // "NotFound" = "No registrado"
30
- // }
31
-
32
- export enum eClientDynamicStatus {
33
- "Active" = "Active",
34
- "Pending" = "Pending",
35
- "Accepted" = "Accepted",
36
- "Rejected" = "Rejected",
37
- "approved" = "Aprobado",
38
- }
39
-
40
- export const cClientDynamicStatus = {
41
- Active: {
42
- value: "Active",
43
- viewValue: "Activo"
44
- },
45
- Pending: {
46
- value: "Pending",
47
- viewValue: "Pendiente"
48
- },
49
- Accepted: {
50
- value: "Accepted",
51
- viewValue: "Pre autorizado"
52
- },
53
- Rejected: {
54
- value: "Rejected",
55
- viewValue: "Rechazado"
56
- },
57
- Idle: {
58
- value: "Idle",
59
- viewValue: ""
60
- },
61
- }
62
-
63
- export enum eContractSteps {
64
- "idle" = "idle",
65
- "general" = "General",
66
- "address" = "Address",
67
- "device" = "Device",
68
- "financial" = "Financial",
69
- "app" = "App",
70
- }
71
-
72
- export type partialIDCData = Pick<IDCClient, "pii" | "client_type">
73
-
74
- export interface IDCCharge {
75
- barcode_url: string;
76
- currency: string;
77
- expires_at: number;
78
- object: string;
79
- quantity: number;
80
- reference: string;
81
- service_name: string;
82
- store_name: string;
83
- type: string;
84
- unit_price: number;
85
- }
86
-
87
- export interface IDCGeneratedReference {
88
- account: number;
89
- active: number;
90
- amount: number;
91
- channel: string;
92
- charge: IDCCharge;
93
- company: number;
94
- config?: any;
95
- id: string;
96
- operation: number;
97
- }
98
-
99
- export const cIDCDataPii: IDCDataPii = {
100
- icc: "",
101
- rfc: "",
102
- sex: "",
103
- city: "",
104
- curp: "",
105
- days: "",
106
- imei: "",
107
- name: "",
108
- step: "",
109
- term: "",
110
- brand: "",
111
- email: "",
112
- model: "",
113
- phone: "",
114
- score: "",
115
- state: "",
116
- amount: "",
117
- colony: "",
118
- period: "",
119
- street: "",
120
- ticket: "",
121
- num_ext: "",
122
- num_int: "",
123
- zipcode: "",
124
- evidence: "",
125
- financed: "",
126
- house_is: "",
127
- lastname: "",
128
- type_job: "",
129
- birthdate: "",
130
- birthstate: "",
131
- dicio_data: "",
132
- dicio_step: "",
133
- secondname: "",
134
- nationality: "",
135
- seller_name: "",
136
- down_payment: "",
137
- municipality: "",
138
- score_no_hit: "",
139
- study_degree: "",
140
- branch_office: "",
141
- identity_data: "",
142
- interest_rate: "",
143
- score_interno: "",
144
- marital_status: "",
145
- monthly_income: "",
146
- motherlastname: "",
147
- score_rcc_fico: "",
148
- identity_selfie: "",
149
- amount_by_period: "",
150
- identity_id_back: "",
151
- proof_of_address: "",
152
- identity_id_front: "",
153
- economic_dependents: "",
154
- identity_id_request: "",
155
- identity_verification: "",
156
- is_address_ine_currently_live: "",
157
- fotografia_del_cliente_con_el_equipo: "",
158
- estado: "",
159
- gender: ""
160
- }
161
-
162
- /**
163
- * Base customer for create customer with DynamiCore provider
164
- * */
165
- export const cIDCCustomer: partialIDCData = {
166
- pii: cIDCDataPii,
167
- client_type: 662
168
- }
169
-
170
- export interface IDCDataPii {
171
- icc: string,
172
- rfc: string,
173
- city: string,
174
- curp: string,
175
- sex: string,
176
- days: string,
177
- step: string,
178
- ticket: string,
179
- evidence: string,
180
- proof_of_address: string,
181
- score_interno: string,
182
- imei: string,
183
- name: string,
184
- term: string,
185
- brand: string,
186
- email: string,
187
- model: string,
188
- phone: string,
189
- score: any,
190
- state: string,
191
- amount: string,
192
- colony: string,
193
- estado: any,
194
- gender: string,
195
- period: string,
196
- street: string,
197
- num_ext: string,
198
- num_int: string,
199
- zipcode: string,
200
- financed: string,
201
- house_is: string,
202
- lastname: string,
203
- type_job: string,
204
- birthdate: string,
205
- birthstate: string,
206
- dicio_data: string,
207
- dicio_step: any,
208
- secondname: string,
209
- nationality: string,
210
- seller_name: string,
211
- down_payment: string,
212
- municipality: string,
213
- score_no_hit: string,
214
- study_degree: string,
215
- branch_office: string,
216
- identity_data: any,
217
- interest_rate: string,
218
- marital_status: string,
219
- monthly_income: string,
220
- motherlastname: string,
221
- score_rcc_fico: string,
222
- identity_selfie: any,
223
- amount_by_period: string,
224
- identity_id_back: any,
225
- identity_id_front: any,
226
- economic_dependents: string,
227
- identity_id_request: any,
228
- identity_verification: any,
229
- is_address_ine_currently_live: string,
230
- fotografia_del_cliente_con_el_equipo?: string
231
- }
232
-
233
- export interface IDCAccountProps {
234
- clabe: string | number,
235
- pagaqui: string | number,
236
- start_date: string,
237
- expected_disbursed: number,
238
- reference_pagaaqui: string,
239
- principal_disbursed: number,
240
- amount_commission_opening: number,
241
- seller_name?: string
242
- }
243
-
244
- export interface IDCAccountConfig {
245
- contract: string,
246
- credit_type: string,
247
- periodicity: string,
248
- installments: number,
249
- interest_base: string,
250
- interest_rate: number,
251
- interest_arrears: number,
252
- commission_opening: number,
253
- financed_amount?: number
254
- }
255
-
256
- export interface IDCAccount {
257
- id: number,
258
- group: number,
259
- company: number,
260
- client: number,
261
- created_at: string,
262
- currency: string | number,
263
- status: string,
264
- properties: IDCAccountProps,
265
- product: number,
266
- enabled: string | number,
267
- config: IDCAccountConfig,
268
- amount: number,
269
- type: string,
270
- identifier: string,
271
- start_at: string,
272
- el: any,
273
- client_id: string | number
274
- }
275
-
276
- export interface IDCTxnRowExtras {
277
- reference: string,
278
- transaction: string
279
- }
280
-
281
- export interface IDCTxnRow {
282
- id: string,
283
- created_at: string,
284
- seq: number,
285
- created: string,
286
- last4: string,
287
- response: any,
288
- transaction_id: string,
289
- contrapart: string,
290
- reference: string,
291
- external_reference: any,
292
- extras: IDCTxnRowExtras,
293
- name: string,
294
- debit: number,
295
- credit: number,
296
- amount: number
297
- }
298
-
299
- export interface IDCTxnHeader {
300
- name: string,
301
- type: string,
302
- label?: string,
303
- money?: string,
304
- format?: string
305
- }
306
-
307
- export interface IDCTxn {
308
- rows: IDCTxnRow[],
309
- headers: IDCTxnHeader[]
310
- }
311
-
312
- export interface IDCMntryCycle {
313
- date: string,
314
- late: number,
315
- paid: number,
316
- past: string | boolean,
317
- cycle: string | number,
318
- amount: number,
319
- detail: any,
320
- status: string
321
- }
322
-
323
- export interface IDCMntryPymtAllPaidTotal {
324
- amount: string,
325
- cycles: string
326
- }
327
-
328
- export interface IDCMntryPymtAll {
329
- late: number,
330
- total: number,
331
- va_cp: number,
332
- actual: number,
333
- cycles: IDCMntryCycle[],
334
- vencido: number,
335
- paid_total: IDCMntryPymtAllPaidTotal,
336
- total_amount: number
337
- }
338
-
339
- export interface IDCMntryPymtDue {
340
- total: number,
341
- cycles: IDCMntryCycle[],
342
- new_cycle: IDCMntryCycle,
343
- old_cycle: IDCMntryCycle,
344
- total_amount: number
345
- }
346
-
347
- export interface IDCMntryPymtOpen extends IDCMntryPymtDue {
348
- }
349
-
350
- export interface IDCMntryPymtPaid {
351
- total: number,
352
- cycles: IDCMntryCycle[] | any[],
353
- new_cycle: any,
354
- old_cycle: any,
355
- total_amount: number
356
- }
357
-
358
- export interface IDCMntryPymtDueTax {
359
- expected: number;
360
- }
361
-
362
- export interface IDCMntryPymtPymt {
363
- paid: number,
364
- expected: number
365
- }
366
-
367
- export interface IDCMntryPymtCal {
368
- due: IDCMntryPymtDue,
369
- date: string,
370
- past: string,
371
- cycle: number,
372
- balance: number,
373
- due_tax: IDCMntryPymtDueTax,
374
- payment: IDCMntryPymtPymt,
375
- interest: IDCMntryPymtPymt,
376
- principal: IDCMntryPymtPymt,
377
- payment_tax: IDCMntryPymtPymt,
378
- interest_tax: IDCMntryPymtPymt,
379
- final_balance: number,
380
- payment_total: IDCMntryPymtPymt,
381
- principal_tax: IDCMntryPymtPymt
382
- }
383
-
384
- export interface IDCMntryPymt {
385
- all: IDCMntryPymtAll,
386
- due: IDCMntryPymtDue,
387
- open: IDCMntryPymtOpen,
388
- paid: IDCMntryPymtPaid,
389
- payment_calendar: IDCMntryPymtCal[]
390
- }
391
-
392
- export interface IDCClient {
393
- id: number,
394
- company: number,
395
- status: string,
396
- external_id: string,
397
- pii: IDCDataPii,
398
- client_type: number,
399
- created_at: string,
400
- pd: number,
401
- username: string,
402
- group: number
403
- }
404
-
405
- export interface IDCMsg {
406
- code: number,
407
- total: number,
408
- data: IDCClient[] | IDCAccount[] | IDCTxn[] | IDCTxn | IDCMntryPymt | IDCCredit[] | IDCTransaction[],
409
- transaction?: string
410
- }
411
-
412
- export interface IDynamiCore {
413
- status: string,
414
- message: IDCMsg
415
- }
416
-
417
- /**
418
- * Interfaces for request (base)
419
- * */
420
- export interface IDCClientObjFilter {
421
- name: string,
422
- filter: string[] | number[],
423
- type: string,
424
- sort: string
425
- }
426
-
427
- export interface IDCClientQuery {
428
- filters: IDCClientObjFilter[];
429
- }
430
-
431
- export interface IDCClientPiiFilter {
432
- limit: number,
433
- page: number,
434
- query: IDCClientQuery
435
- }
436
-
437
- /**
438
- * DynamiCore Reference Interface
439
- * */
440
-
441
- export interface IDCRefCustInfo {
442
- name: string,
443
- email: string,
444
- phone: string | number
445
- }
446
-
447
- export interface IDCOxxoRefItem {
448
- name: string,
449
- unit_price: number,
450
- quantity: number
451
- }
452
-
453
- export interface IDCOxxoRefPymtMth {
454
- type: string;
455
- }
456
-
457
- export interface IDCOxxoRef {
458
- account: number,
459
- operation: number,
460
- customer_info: IDCRefCustInfo,
461
- items: IDCOxxoRefItem,
462
- payment_method: IDCOxxoRefPymtMth
463
- }
464
-
465
- /**
466
- * DynamiCore Reference
467
- * */
468
- export interface IDCRefCustInfo {
469
- name: string,
470
- email: string,
471
- phone: string | number
472
- }
473
-
474
- export interface IDCRefItems {
475
- name: string,
476
- unit_price: number,
477
- quantity: number
478
- }
479
-
480
- export interface IDCRefPymtMethod {
481
- type: string;
482
- }
483
-
484
- export interface IDCNewReference {
485
- id: string,
486
- data: IDCReference,
487
- date?: number
488
- }
489
-
490
- export interface IDCReference {
491
- account: number,
492
- operation: number,
493
- customer_info: IDCRefCustInfo,
494
- items: IDCRefItems,
495
- payment_method: IDCRefPymtMethod
496
- }
497
-
498
- /**
499
- * Interfaces to Credits
500
- * */
501
- export interface IDCCreditProperties {
502
- start_date: string;
503
- principal_disbursed: number;
504
- expected_disbursed: number;
505
- amount_commission_opening: number;
506
- }
507
-
508
- export interface IDCCreditConfig {
509
- contract: string;
510
- credit_type: string;
511
- interest_rate: number;
512
- installments: number;
513
- periodicity: string;
514
- interest_base: string;
515
- commission_opening: number;
516
- financed_amount: number;
517
- interest_arrears: number;
518
- }
519
-
520
- export interface IDCCredit {
521
- id: number;
522
- group: number;
523
- company: number;
524
- client: number;
525
- created_at: string;
526
- currency: string;
527
- status: string;
528
- properties: IDCCreditProperties;
529
- product: number;
530
- enabled: string;
531
- config: IDCCreditConfig;
532
- amount: number;
533
- type: string;
534
- identifier: null | string;
535
- start_at: null | string;
536
- }
537
-
538
- /**
539
- * Payments
540
- * */
541
- export interface IDCPayment {
542
- operation: number;
543
- account: string;
544
- date: string;
545
- amount: number;
546
- external_id?: string;
547
- dst_account: string;
548
- extras?: object;
549
- reference: string;
550
- }
551
-
552
- export const cIDCPayment: IDCPayment = {
553
- operation: 98,
554
- account: "",
555
- date: "",
556
- amount: 0,
557
- dst_account: "",
558
- reference: ""
559
- }
560
-
561
- /**
562
- * Transactions
563
- * */
564
- export interface IDCTransaction {
565
- data: [number, { transaction: string }];
566
- }
567
-
568
- export const cIDCCharge: IDCCharge = {
569
- barcode_url: "",
570
- currency: "",
571
- expires_at: 0,
572
- object: "",
573
- quantity: 0,
574
- reference: "",
575
- service_name: "",
576
- store_name: "",
577
- type: "",
578
- unit_price: 0
579
- }
580
-
581
- export const cIDCGeneratedReference: IDCGeneratedReference = {
582
- account: 0,
583
- active: 0,
584
- amount: 0,
585
- channel: "",
586
- charge: cIDCCharge,
587
- company: 0,
588
- id: "",
589
- operation: 0
590
- }
591
-
592
- /**
593
- * Common Factory Dynamic
594
- * */
595
- export class FactoryDynamiCore {
596
-
597
- public static CreateReferenceBody(
598
- client: oClient,
599
- contract: oContract,
600
- dateTime?: number
601
- ): IDCNewReference | null {
602
-
603
- const customerInfo: IDCRefCustInfo = {
604
- name: client.name,
605
- email: client.email,
606
- phone: client.phone,
607
- }
608
-
609
- const customerItems: IDCRefItems = {
610
- name: "Referencia Oxxo",
611
- unit_price: contract.financial.weeklyPayment,
612
- quantity: 1
613
- }
614
-
615
- const paymentMethod: IDCRefPymtMethod = {
616
- type: "oxxo_cash"
617
- }
618
-
619
- if (!client.dynamic_account) return null
620
-
621
- const body: IDCNewReference = {
622
- id: client.id,
623
- data: {
624
- account: Number(client.dynamic_account),
625
- operation: 98,
626
- customer_info: customerInfo,
627
- items: customerItems,
628
- payment_method: paymentMethod
629
- }
630
- }
631
-
632
- if (dateTime != undefined) body.date = dateTime
633
-
634
- return body
635
- }
636
-
637
- public static CreateEmptyCustomer(): partialIDCData {
638
- return cIDCCustomer
639
- }
640
-
641
- public static CreateCustomerFromOClient(client: oClient, contract: oContract): partialIDCData {
642
- const o: partialIDCData = cIDCCustomer
643
-
644
- o.pii.email = client.email
645
- o.pii.name = client.name
646
- o.pii.curp = client.curp
647
- o.pii.phone = client.phone
648
- o.pii.amount = String(contract.financial.total)
649
- o.pii.financed = String(contract.financial.financed)
650
- o.pii.amount_by_period = String(contract.financial.weeklyPayment)
651
-
652
- o.pii.zipcode = contract.address.zip
653
- o.pii.street = contract.address.street
654
- o.pii.city = contract.address.city
655
- o.pii.state = contract.address.state
656
- o.pii.colony = contract.address.neighbor
657
- o.pii.num_ext = contract.address.ext
658
-
659
- return o
660
- }
661
-
662
- public static CreateDynamicCredit(
663
- client: oClient,
664
- contract: oContract,
665
- clientDynamic: IDCClient,
666
- ): Partial<IDCCredit> | null {
667
- const properties: IDCCreditProperties = {
668
- start_date: "",
669
- principal_disbursed: 0,
670
- expected_disbursed: 0,
671
- amount_commission_opening: 0
672
- }
673
-
674
- const config: IDCCreditConfig = {
675
- contract: `FP-${client.name}`,
676
- credit_type: "Arrendamiento",
677
- interest_rate: 528,
678
- installments: 0,
679
- periodicity: "WEEK",
680
- interest_base: "ACT/ACT",
681
- commission_opening: 40,
682
- financed_amount: contract.financial.financed,
683
- interest_arrears: 0
684
- }
685
-
686
- if (!client.dynamic_account) return null
687
-
688
- return {
689
- id: Number(client.dynamic_account),
690
- group: clientDynamic.group,
691
- company: clientDynamic.company,
692
- client: clientDynamic.id,
693
- created_at: "",
694
- currency: "484",
695
- status: "pending",
696
- properties: properties,
697
- product: 1756,
698
- enabled: "1",
699
- config: config,
700
- amount: 0,
701
- type: "liabilities",
702
- identifier: null,
703
- start_at: null
704
- }
705
- }
706
-
707
- public static CreatePayment(
708
- contract: oContract,
709
- clientDynamic: IDCAccount,
710
- ): IDCPayment {
711
- return {
712
- account: String(clientDynamic.id),
713
- amount: contract.financial.weeklyPayment,
714
- date: "",
715
- dst_account: String(clientDynamic.id),
716
- external_id: "",
717
- extras: {},
718
- operation: 98,
719
- reference: ""
720
- }
721
- }
722
-
723
- public static getNextDateTime(): string {
724
- const now = new Date();
725
- const nextDateTime = new Date(now.getTime() + 1000); // Add 1 second as an example
726
-
727
- const year = nextDateTime.getFullYear();
728
- const month = String(nextDateTime.getMonth() + 1).padStart(2, '0');
729
- const day = String(nextDateTime.getDate()).padStart(2, '0');
730
- const hours = String(nextDateTime.getHours()).padStart(2, '0');
731
- const minutes = String(nextDateTime.getMinutes()).padStart(2, '0');
732
- const seconds = String(nextDateTime.getSeconds()).padStart(2, '0');
733
-
734
- return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
735
- }
736
-
737
- public static getIsoDate(): string {
738
- const now = new Date();
739
- return now.toISOString();
740
- }
741
-
742
- public static FormPayment(
743
- contract: oContract,
744
- account: IDCAccount) {
745
-
746
- let data = FactoryDynamiCore.CreatePayment(contract, account)
747
-
748
- return {
749
- amount: new UntypedFormControl(data.amount, [Validators.required, Validators.min(0)]),
750
- }
751
- }
752
- }