ravcredit-lib 0.0.31 → 0.0.33

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