ravcredit-lib 0.0.2 → 0.0.4

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 (44) hide show
  1. package/esm2022/lib/v1/objects/oAddress.mjs +10 -0
  2. package/esm2022/lib/v1/objects/oBusiness.mjs +2 -0
  3. package/esm2022/lib/v1/objects/oClient.mjs +2 -0
  4. package/esm2022/lib/v1/objects/oConekta.mjs +85 -0
  5. package/esm2022/lib/v1/objects/oContract.mjs +2 -0
  6. package/esm2022/lib/v1/objects/oContractAll.mjs +2 -0
  7. package/esm2022/lib/v1/objects/oCustomer.mjs +18 -0
  8. package/esm2022/lib/v1/objects/oDevice.mjs +2 -0
  9. package/esm2022/lib/v1/objects/oFinancial.mjs +2 -0
  10. package/esm2022/lib/v1/objects/oGlobal.mjs +86 -0
  11. package/esm2022/lib/v1/objects/oLogIn.mjs +17 -0
  12. package/esm2022/lib/v1/objects/oNewPayment.mjs +2 -0
  13. package/esm2022/lib/v1/objects/oNotification.mjs +17 -0
  14. package/esm2022/lib/v1/objects/oPassport.mjs +7 -0
  15. package/esm2022/lib/v1/objects/oUser.mjs +2 -0
  16. package/esm2022/lib/v1/util/UtilBusiness.mjs +171 -0
  17. package/esm2022/lib/v1/util/UtilClient.mjs +221 -0
  18. package/esm2022/lib/v1/util/UtilContract.mjs +331 -0
  19. package/esm2022/lib/v1/util/UtilDynamiCore.mjs +292 -0
  20. package/esm2022/public-api.mjs +20 -2
  21. package/fesm2022/ravcredit-lib.mjs +1243 -1
  22. package/fesm2022/ravcredit-lib.mjs.map +1 -1
  23. package/lib/v1/objects/oAddress.d.ts +10 -0
  24. package/lib/v1/objects/oBusiness.d.ts +101 -0
  25. package/lib/{oClient.d.ts → v1/objects/oClient.d.ts} +0 -1
  26. package/lib/v1/objects/oConekta.d.ts +305 -0
  27. package/lib/v1/objects/oContract.d.ts +23 -0
  28. package/lib/v1/objects/oContractAll.d.ts +21 -0
  29. package/lib/v1/objects/oCustomer.d.ts +17 -0
  30. package/lib/v1/objects/oDevice.d.ts +5 -0
  31. package/lib/v1/objects/oFinancial.d.ts +30 -0
  32. package/lib/v1/objects/oGlobal.d.ts +149 -0
  33. package/lib/v1/objects/oLogIn.d.ts +30 -0
  34. package/lib/v1/objects/oNewPayment.d.ts +11 -0
  35. package/lib/v1/objects/oNotification.d.ts +25 -0
  36. package/lib/v1/objects/oPassport.d.ts +55 -0
  37. package/lib/v1/objects/oUser.d.ts +25 -0
  38. package/lib/v1/util/UtilBusiness.d.ts +52 -0
  39. package/lib/v1/util/UtilClient.d.ts +34 -0
  40. package/lib/v1/util/UtilContract.d.ts +70 -0
  41. package/lib/v1/util/UtilDynamiCore.d.ts +453 -0
  42. package/package.json +1 -1
  43. package/public-api.d.ts +19 -1
  44. package/esm2022/lib/oClient.mjs +0 -2
@@ -1,5 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, Component } from '@angular/core';
3
+ import { UntypedFormControl, Validators, UntypedFormArray } from '@angular/forms';
3
4
 
4
5
  class RavcreditLibService {
5
6
  constructor() { }
@@ -30,6 +31,1247 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
30
31
  ` }]
31
32
  }] });
32
33
 
34
+ const cAddress = {
35
+ street: "",
36
+ city: "",
37
+ neighbor: "",
38
+ zip: "",
39
+ ext: "",
40
+ int: "",
41
+ state: ""
42
+ };
43
+
44
+ var eConektaRes;
45
+ (function (eConektaRes) {
46
+ eConektaRes["CUSTOMER_CREATED"] = "customer.created";
47
+ eConektaRes["ORDER_PENDING_PAYMENT"] = "order.pending_payment";
48
+ eConektaRes["ORDER_CREATED"] = "order.created";
49
+ eConektaRes["CHARGE_CREATED"] = "charge.created";
50
+ eConektaRes["ORDER_PAID"] = "order.paid";
51
+ eConektaRes["CHARGE_PAID"] = "charge.paid";
52
+ })(eConektaRes || (eConektaRes = {}));
53
+ var eConektaOrderStatus;
54
+ (function (eConektaOrderStatus) {
55
+ eConektaOrderStatus["expired"] = "expired";
56
+ eConektaOrderStatus["paid"] = "paid";
57
+ eConektaOrderStatus["pending_payment"] = "pending_payment";
58
+ })(eConektaOrderStatus || (eConektaOrderStatus = {}));
59
+ /******************************************************* New reference constant */
60
+ const cOxxorecurrentSourcesData = {
61
+ id: "",
62
+ object: "",
63
+ type: "",
64
+ provider: "",
65
+ reference: "",
66
+ barcode: "",
67
+ barcode_url: "",
68
+ expires_at: 0,
69
+ created_at: 0,
70
+ parent_id: ""
71
+ };
72
+ const cOxxoRecurrentSources = {
73
+ object: "",
74
+ has_more: false,
75
+ total: 0,
76
+ data: []
77
+ };
78
+ const cConektaRecurrent = {
79
+ livemode: false,
80
+ name: "",
81
+ email: "",
82
+ phone: "",
83
+ id: "",
84
+ object: "",
85
+ created_at: 0,
86
+ corporate: false,
87
+ custom_id: "",
88
+ payment_sources: cOxxoRecurrentSources
89
+ };
90
+ //
91
+ // {
92
+ // data: {
93
+ // object: {
94
+ // id: '66bf1b25e341ed00158a169a',
95
+ // livemode: false,
96
+ // created_at: 1723800357,
97
+ // currency: 'MXN',
98
+ // payment_method: [Object],
99
+ // object: 'charge',
100
+ // description: 'Payment from order',
101
+ // status: 'paid',
102
+ // amount: 28125,
103
+ // paid_at: 1723800396,
104
+ // fee: 1273,
105
+ // customer_id: '',
106
+ // order_id: 'ord_2wTWbvyFgywHDvTZg'
107
+ // },
108
+ // previous_attributes: { status: 'pending_payment' }
109
+ // },
110
+ // livemode: false,
111
+ // webhook_status: 'pending',
112
+ // webhook_logs: [
113
+ // {
114
+ // id: 'webhl_2wTWcRE8ThHpvG1QQ',
115
+ // url: 'https://b1b6-2806-230-2610-b3ed-dcbe-6d32-758f-17c6.ngrok-free.app/api/v1/webhook',
116
+ // failed_attempts: 0,
117
+ // last_http_response_status: -1,
118
+ // response_data: null,
119
+ // object: 'webhook_log',
120
+ // last_attempted_at: 0
121
+ // }
122
+ // ],
123
+ // id: '66bf1b4c2973ff0001dff653',
124
+ // object: 'event',
125
+ // type: 'charge.paid',
126
+ // created_at: 1723800396
127
+ // }
128
+
129
+ //
130
+ // export interface iCustomerInfo = Pick<iCustomer, email | id | name | phone> {
131
+ //
132
+ // customer_id:string
133
+ // }
134
+ // {
135
+ // livemode: false,
136
+ // name: Vicente Mendoza,
137
+ // email: vicente.mendoza@conekta.com,
138
+ // phone: 5566982093,
139
+ // id: cus_2wHtqBNsSggaYdfXu,
140
+ // object: customer,
141
+ // created_at: 1721258796,
142
+ // corporate: false,
143
+ // custom_reference:
144
+ // }
145
+
146
+ const cClient = {
147
+ id: "",
148
+ name: "",
149
+ username: "",
150
+ email: "",
151
+ phone: "",
152
+ curp: "",
153
+ contract_temporary: "",
154
+ conekta_id: "",
155
+ userReferences: [],
156
+ status: ""
157
+ };
158
+ const cUserReference = {
159
+ name: "",
160
+ phone: "",
161
+ relationship: ""
162
+ };
163
+ const cClientConekta = {
164
+ conekta: cConektaRecurrent,
165
+ ravcredit: cClient
166
+ };
167
+ const cClientContract = {
168
+ client: cClient,
169
+ contract: cContract,
170
+ };
171
+ class FactoryClient {
172
+ static CreateClientToConektaObj(data) {
173
+ const o = {};
174
+ if (data.name && data.name.length > 0)
175
+ o.name = data.name;
176
+ if (data.username && data.name.length > 0)
177
+ o.username = data.username;
178
+ if (data.email && data.email.length > 0)
179
+ o.email = data.email;
180
+ if (data.phone && data.phone.length > 0)
181
+ o.phone = String(data.phone);
182
+ if (data.curp && data.curp.length > 0)
183
+ o.curp = data.curp;
184
+ if (data.userReferences && data.userReferences.length > 0)
185
+ o.userReferences = data.userReferences;
186
+ if (data.contract)
187
+ o.contract = data.contract;
188
+ if (data.createdAt)
189
+ o.createdAt = data.createdAt;
190
+ if (data.lastLogin)
191
+ o.lastLogin = data.lastLogin;
192
+ if (data.conekta_id)
193
+ o.conekta_id = data.conekta_id;
194
+ return o;
195
+ }
196
+ static CreateClientFromFormObj(data, client) {
197
+ const o = {
198
+ id: "",
199
+ name: data["client"][0].name,
200
+ username: data["auth"][0].username,
201
+ password: data["auth"][0].password,
202
+ email: data["client"][0].email,
203
+ phone: String(data["client"][0].phone),
204
+ curp: data["client"][0].curp,
205
+ userReferences: data["client"][0].userReferences,
206
+ status: eClientStatus.ACTIVE
207
+ };
208
+ if (client != undefined) {
209
+ if (client.dynamic_id)
210
+ o.dynamic_id = client.dynamic_id;
211
+ if (client.dynamic_account)
212
+ o.dynamic_account = client.dynamic_account;
213
+ if (client.conekta_id)
214
+ o.conekta_id = client.conekta_id;
215
+ }
216
+ return o;
217
+ }
218
+ static CreateClientConektaObj(data, finalDate) {
219
+ const sources = {
220
+ type: "oxxo_recurrent",
221
+ expires_at: finalDate
222
+ };
223
+ return {
224
+ name: data.name,
225
+ email: data.email,
226
+ phone: data.phone,
227
+ contract: data.contract_temporary,
228
+ client_id: data.id,
229
+ payment_sources: [sources]
230
+ };
231
+ }
232
+ static MapperConektaClient(client, conekta) {
233
+ const o = client;
234
+ o.name = conekta.name;
235
+ o.email = conekta.email;
236
+ o.phone = conekta.phone;
237
+ o.conekta_id = conekta.id;
238
+ return {
239
+ client: o,
240
+ contract: cContract
241
+ };
242
+ }
243
+ static MapperTypeContCli_Client(_client) {
244
+ const client = {
245
+ id: _client.id,
246
+ name: _client.name,
247
+ username: _client.username,
248
+ email: _client.email,
249
+ phone: _client.phone,
250
+ curp: _client.curp,
251
+ userReferences: _client.userReferences,
252
+ status: _client.status,
253
+ contract: _client.contract,
254
+ reference: _client.reference,
255
+ references: _client.references,
256
+ conekta_id: _client.conekta_id,
257
+ dynamic_account: _client.dynamic_account,
258
+ token: _client.token,
259
+ contract_temporary: _client.contract_temporary,
260
+ lastLogin: _client.lastLogin,
261
+ dynamic_id: _client.dynamic_id,
262
+ createdAt: _client.createdAt,
263
+ payments: _client.payments,
264
+ password: _client.password,
265
+ contractUrl: _client.contractUrl,
266
+ dynamic_ref: _client.dynamic_ref,
267
+ exists: _client.exists,
268
+ passport_id: _client.passport_id,
269
+ };
270
+ return client;
271
+ }
272
+ static MapperDynamicClient(dynamic, client, contract, clientDyn, account) {
273
+ // const o: tyClientContract = cTyClientContract
274
+ /* Client ------------------------------------------------------ */
275
+ client.username = `${dynamic.pii.name} ${dynamic.pii.motherlastname} ${dynamic.pii.lastname}`;
276
+ client.phone = dynamic.pii.phone;
277
+ client.dynamic_id = dynamic.id;
278
+ client.curp = dynamic.pii.curp;
279
+ client.email = dynamic.pii.email;
280
+ if (account)
281
+ client.dynamic_account = account.id;
282
+ /* Auth ---------------------------------------------------------- */
283
+ /* Device -------------------------------------------------------- */
284
+ contract.device.IMEI = clientDyn.pii.imei;
285
+ contract.device.device = clientDyn.pii.model;
286
+ /* Contract ------------------------------------------------------ */
287
+ contract.by = clientDyn.pii.seller_name;
288
+ if (clientDyn.pii.fotografia_del_cliente_con_el_equipo != undefined) {
289
+ const oPhoto = clientDyn.pii.fotografia_del_cliente_con_el_equipo;
290
+ if (oPhoto != "") {
291
+ const _photo = JSON.parse(oPhoto);
292
+ if (_photo)
293
+ contract.photo = _photo[0].url;
294
+ }
295
+ }
296
+ contract.address.state = dynamic.pii.state;
297
+ contract.address.city = dynamic.pii.city;
298
+ contract.address.street = dynamic.pii.street;
299
+ contract.address.ext = dynamic.pii.num_ext;
300
+ contract.address.zip = dynamic.pii.zipcode;
301
+ contract.address.neighbor = dynamic.pii.colony;
302
+ /* Financial ------------------------------------------------------ */
303
+ contract.dynamicAccount = Number(account?.id);
304
+ if (account?.config.installments) {
305
+ contract.financial.deadlines = {
306
+ weeks: account.config.installments,
307
+ interest: 0
308
+ };
309
+ }
310
+ if (account?.properties.expected_disbursed)
311
+ contract.financial.total = account?.properties.expected_disbursed;
312
+ if (account?.properties.principal_disbursed)
313
+ contract.financial.financed = account?.properties.principal_disbursed;
314
+ if (account?.properties.amount_commission_opening) {
315
+ contract.financial.initial = account?.properties.amount_commission_opening;
316
+ contract.financial.amount_commission_opening = account?.properties.amount_commission_opening;
317
+ }
318
+ contract.financial.interest_rate = Number(clientDyn.pii.interest_rate);
319
+ contract.financial.interest_arrears = account?.config.interest_arrears;
320
+ contract.financial.commission_opening = account?.config.commission_opening;
321
+ contract.financial.credit_type = account?.config.credit_type;
322
+ contract.financial.principal_disbursed = account?.properties.principal_disbursed;
323
+ contract.financial.expected_disbursed = account?.properties.expected_disbursed;
324
+ contract.financial.weeklyPayment = Number(clientDyn.pii.amount_by_period);
325
+ return {
326
+ client: client,
327
+ contract: contract,
328
+ };
329
+ }
330
+ static MapperFinancialContract(contract, account) {
331
+ contract.dynamicAccount = Number(account.id);
332
+ if (account.config.installments) {
333
+ contract.financial.deadlines = {
334
+ weeks: account.config.installments,
335
+ interest: 0
336
+ };
337
+ }
338
+ const total = account.config.financed_amount != undefined ? account.config.financed_amount : 0;
339
+ if (total > 0)
340
+ contract.financial.total = total;
341
+ // if (account.properties.expected_disbursed)
342
+ const expected_disbursed = account.properties.expected_disbursed != undefined ? account.properties.expected_disbursed : 0;
343
+ if (expected_disbursed > 0)
344
+ contract.financial.total = expected_disbursed;
345
+ contract.financial.expected_disbursed = expected_disbursed;
346
+ contract.financial.interest_rate = account.config.interest_rate;
347
+ contract.financial.interest_arrears = account.config.interest_arrears;
348
+ // if (account.properties.principal_disbursed)
349
+ if (account.properties.principal_disbursed > 0)
350
+ contract.financial.financed = account.properties.principal_disbursed;
351
+ contract.financial.principal_disbursed = account.properties.principal_disbursed;
352
+ const amount_commission_opening = account.properties.amount_commission_opening != undefined ? account.properties.amount_commission_opening : 0;
353
+ if (amount_commission_opening > 0)
354
+ contract.financial.initial = amount_commission_opening;
355
+ contract.financial.amount_commission_opening = amount_commission_opening;
356
+ contract.financial.interest_arrears = account.config.interest_arrears;
357
+ contract.financial.commission_opening = account.config.commission_opening;
358
+ contract.financial.credit_type = account.config.credit_type;
359
+ contract.financial.clabe = String(account.properties.clabe);
360
+ return contract.financial;
361
+ }
362
+ }
363
+
364
+ const cSchedule = {
365
+ day: "",
366
+ open: 0,
367
+ close: 0,
368
+ };
369
+ const cEmptyDay = {
370
+ close: 0, open: 0, day: ""
371
+ };
372
+ const week = [
373
+ "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"
374
+ ];
375
+ const cDefinedSchedule = [
376
+ { close: 0, open: 0, day: "monday" },
377
+ { close: 0, open: 0, day: "tuesday" },
378
+ { close: 0, open: 0, day: "wednesday" },
379
+ { close: 0, open: 0, day: "thursday" },
380
+ { close: 0, open: 0, day: "friday" },
381
+ { close: 0, open: 0, day: "saturday" },
382
+ { close: 0, open: 0, day: "sunday" },
383
+ ];
384
+ const cBusinessInfo = {
385
+ version: "v2024",
386
+ name: "",
387
+ address: cAddress,
388
+ phones: [],
389
+ email: "",
390
+ };
391
+ const cBusinessDeadlines = {
392
+ weeks: 0,
393
+ interest: 0
394
+ };
395
+ const cBusinessConfig = {
396
+ version: "",
397
+ apiVersion: "",
398
+ adminVersion: "",
399
+ mobileVersion: "",
400
+ mobileVersionPrev: "",
401
+ deadlines: [],
402
+ downloadsClient: false,
403
+ passportPaymentReference: false,
404
+ conektaPaymentReference: false,
405
+ conektaPaymentLink: false,
406
+ dynamicPaymentReference: false,
407
+ apkUrl: "https://firebasestorage.googleapis.com/v0/b/ravcredit-2b079.appspot.com/o/mobile-app%2Fapp-release.apk?alt=media&token=ae05f332-a39a-46ad-8a64-312ae1487496"
408
+ };
409
+ class FactoryBusiness {
410
+ static FormBusinessInfo(info) {
411
+ let data = cBusinessInfo;
412
+ if (info)
413
+ data = info;
414
+ if (!info?.address)
415
+ data.address = cAddress;
416
+ return {
417
+ name: new UntypedFormControl(data.name, Validators.required),
418
+ email: new UntypedFormControl(data.email, [Validators.required, Validators.email]),
419
+ desc: new UntypedFormControl(data.desc, [Validators.required, Validators.email]),
420
+ street: new UntypedFormControl(data.address.street, Validators.required),
421
+ neighbor: new UntypedFormControl(data.address.neighbor, Validators.required),
422
+ cp: new UntypedFormControl(data.address.zip, Validators.required),
423
+ ext: new UntypedFormControl(data.address.ext, Validators.required),
424
+ int: new UntypedFormControl(data.address.int),
425
+ city: new UntypedFormControl(data.address.city, Validators.required),
426
+ state: new UntypedFormControl(data.address.state, Validators.required),
427
+ phones: new UntypedFormControl(data.phones),
428
+ mondayOpen: new UntypedFormControl(data.schedule?.monday.open),
429
+ mondayClose: new UntypedFormControl(data.schedule?.monday.close),
430
+ tuesdayOpen: new UntypedFormControl(data.schedule?.tuesday.open),
431
+ tuesdayClose: new UntypedFormControl(data.schedule?.tuesday.close),
432
+ wednesdayOpen: new UntypedFormControl(data.schedule?.wednesday.open),
433
+ wednesdayClose: new UntypedFormControl(data.schedule?.wednesday.close),
434
+ thursdayOpen: new UntypedFormControl(data.schedule?.thursday.open),
435
+ thursdayClose: new UntypedFormControl(data.schedule?.thursday.close),
436
+ fridayOpen: new UntypedFormControl(data.schedule?.friday.open),
437
+ fridayClose: new UntypedFormControl(data.schedule?.friday.close),
438
+ saturdayOpen: new UntypedFormControl(data.schedule?.saturday.open),
439
+ saturdayClose: new UntypedFormControl(data.schedule?.saturday.close),
440
+ sundayOpen: new UntypedFormControl(data.schedule?.sunday.open),
441
+ sundayClose: new UntypedFormControl(data.schedule?.sunday.close),
442
+ };
443
+ }
444
+ static CreateBusinessInfoObj(data) {
445
+ const address = cAddress;
446
+ const schedule = {
447
+ monday: {},
448
+ tuesday: {},
449
+ wednesday: {},
450
+ thursday: {},
451
+ friday: {},
452
+ saturday: {},
453
+ sunday: {}
454
+ };
455
+ if (data.street)
456
+ address.street = data.street;
457
+ if (data.state)
458
+ address.state = data.state;
459
+ if (data.neighbor)
460
+ address.neighbor = data.neighbor;
461
+ if (data.city)
462
+ address.city = data.city;
463
+ if (data.ext)
464
+ address.ext = data.ext;
465
+ if (data.int)
466
+ address.int = data.int;
467
+ if (data.cp)
468
+ address.zip = data.cp;
469
+ if (data.mondayOpen)
470
+ schedule.monday.open = data.mondayOpen;
471
+ if (data.mondayClose)
472
+ schedule.monday.close = data.mondayClose;
473
+ if (data.tuesdayOpen)
474
+ schedule.tuesday.open = data.tuesdayOpen;
475
+ if (data.tuesdayClose)
476
+ schedule.tuesday.close = data.tuesdayClose;
477
+ if (data.wednesdayOpen)
478
+ schedule.wednesday.open = data.wednesdayOpen;
479
+ if (data.wednesdayClose)
480
+ schedule.wednesday.close = data.wednesdayClose;
481
+ if (data.thursdayOpen)
482
+ schedule.thursday.open = data.thursdayOpen;
483
+ if (data.thursdayClose)
484
+ schedule.thursday.close = data.thursdayClose;
485
+ if (data.fridayOpen)
486
+ schedule.friday.open = data.fridayOpen;
487
+ if (data.fridayClose)
488
+ schedule.friday.close = data.fridayClose;
489
+ if (data.saturdayOpen)
490
+ schedule.saturday.open = data.saturdayOpen;
491
+ if (data.saturdayClose)
492
+ schedule.saturday.close = data.saturdayClose;
493
+ if (data.sundayOpen)
494
+ schedule.sunday.open = data.sundayOpen;
495
+ if (data.sundayClose)
496
+ schedule.sunday.close = data.sundayClose;
497
+ const info = {
498
+ version: "v2024",
499
+ name: data.name ? data.name : "",
500
+ address: address,
501
+ phones: data.phones ? data.phones : [],
502
+ email: data.email ? data.email : "",
503
+ schedule: schedule,
504
+ desc: data.desc ? data.desc : ""
505
+ };
506
+ return info;
507
+ }
508
+ static FormDeadlineConfig(data) {
509
+ // if (!data) data = cBusinessDeadlines
510
+ return {
511
+ weeks: new UntypedFormControl(data.weeks),
512
+ interest: new UntypedFormControl(data.interest),
513
+ };
514
+ }
515
+ static FormBusinessConfig(config) {
516
+ let data = cBusinessConfig;
517
+ if (config)
518
+ data = config;
519
+ return {
520
+ downloadsClient: new UntypedFormControl(data.downloadsClient),
521
+ passportPaymentReference: new UntypedFormControl(data.passportPaymentReference),
522
+ conektaPaymentReference: new UntypedFormControl(data.conektaPaymentReference),
523
+ conektaPaymentLink: new UntypedFormControl(data.conektaPaymentLink),
524
+ dynamicPaymentReference: new UntypedFormControl(data.dynamicPaymentReference),
525
+ deadlines: new UntypedFormArray([])
526
+ };
527
+ }
528
+ static testBusiness(message) {
529
+ return `Message ${message}`;
530
+ }
531
+ }
532
+
533
+ var eProvider;
534
+ (function (eProvider) {
535
+ eProvider["none"] = "";
536
+ eProvider["Conekta"] = "Conekta";
537
+ eProvider["Passport"] = "Passport";
538
+ eProvider["DynamiCore"] = "DynamiCore";
539
+ })(eProvider || (eProvider = {}));
540
+ // export type ProgressTaskStatus = TaskState | "uploading" | "idle" | "generating" | "unauthorized"
541
+ const cDevice = {
542
+ device: "",
543
+ IMEI: ""
544
+ };
545
+ const cFinancial = {
546
+ total: 0,
547
+ initial: 0,
548
+ deadlines: cBusinessDeadlines,
549
+ initDate: 0,
550
+ weeklyPayment: 0,
551
+ pendingOf: [],
552
+ progress: [],
553
+ interest: 0,
554
+ provider: eProvider.DynamiCore,
555
+ financed: 0,
556
+ nextPayment: 0,
557
+ amount_commission_opening: 0,
558
+ principal_disbursed: 0,
559
+ expected_disbursed: 0, // ---------
560
+ credit_type: 'Arrendamiento',
561
+ interest_rate: 0,
562
+ commission_opening: 0,
563
+ interest_arrears: 0,
564
+ };
565
+ const cContract = {
566
+ id: "",
567
+ client: "",
568
+ address: cAddress,
569
+ device: cDevice,
570
+ financial: cFinancial,
571
+ by: "",
572
+ active: true
573
+ };
574
+ class FactoryContract {
575
+ static FormClient(client) {
576
+ let data = cClient;
577
+ if (client)
578
+ data = client;
579
+ return {
580
+ name: new UntypedFormControl(data.name, [Validators.required, Validators.minLength(10)]),
581
+ email: new UntypedFormControl(data.username, [Validators.required, Validators.email]),
582
+ phone: new UntypedFormControl(data.phone, [Validators.required, Validators.min(10)]),
583
+ curp: new UntypedFormControl(data.curp, [Validators.required, Validators.minLength(16)]),
584
+ userReferences: new UntypedFormArray([])
585
+ };
586
+ }
587
+ static CreateUserReferenceFormObj(user) {
588
+ let data = cUserReference;
589
+ if (user.name != "")
590
+ data = user;
591
+ return {
592
+ name: new UntypedFormControl(data.name, [Validators.required, Validators.minLength(10)]),
593
+ phone: new UntypedFormControl(data.phone, [Validators.required]),
594
+ relationship: new UntypedFormControl(data.relationship, [Validators.required]),
595
+ };
596
+ }
597
+ static FormAddress(address) {
598
+ let data = cAddress;
599
+ if (address)
600
+ data = address;
601
+ return {
602
+ street: new UntypedFormControl(data.street, Validators.required),
603
+ neighbor: new UntypedFormControl(data.neighbor, Validators.required),
604
+ cp: new UntypedFormControl(data.zip, Validators.required),
605
+ ext: new UntypedFormControl(data.ext, Validators.required),
606
+ int: new UntypedFormControl(data.int),
607
+ city: new UntypedFormControl(data.city, Validators.required),
608
+ state: new UntypedFormControl(data.state, Validators.required),
609
+ };
610
+ }
611
+ static FormDevice(device) {
612
+ let data = cDevice;
613
+ if (device)
614
+ data = device;
615
+ return {
616
+ model: new UntypedFormControl(data.device, Validators.required),
617
+ IMEI: new UntypedFormControl(data.IMEI, Validators.required),
618
+ ID: new UntypedFormControl(data.id),
619
+ };
620
+ }
621
+ static FormFinancial(financial) {
622
+ let data = cFinancial;
623
+ if (financial)
624
+ data = financial;
625
+ data.credit_type = "Arrendamiento";
626
+ // data.deadlines.weeks = cBusinessDeadlines
627
+ return {
628
+ total: new UntypedFormControl(data.total, [Validators.required, Validators.min(1)]),
629
+ initial: new UntypedFormControl(data.initial, [Validators.required]),
630
+ financed: new UntypedFormControl(data.financed, Validators.min(1)),
631
+ weeklyPayment: new UntypedFormControl(data.weeklyPayment, [Validators.required, Validators.min(1)]),
632
+ deadlines: new UntypedFormControl(data.deadlines, [Validators.required]),
633
+ initDate: new UntypedFormControl(data.initDate),
634
+ provider: new UntypedFormControl(data.provider),
635
+ credit_type: new UntypedFormControl(data.credit_type ? data.credit_type : 0),
636
+ interest_rate: new UntypedFormControl(data.interest_rate ? data.interest_rate : 0), // interes credit dynamic
637
+ commission_opening: new UntypedFormControl(data.commission_opening ? data.commission_opening : 0),
638
+ interest_arrears: new UntypedFormControl(data.interest_arrears ? data.interest_arrears : 0), // intereses moratorios dynamic
639
+ amount_commission_opening: new UntypedFormControl(data.amount_commission_opening), // comision por apertura dynamic
640
+ principal_disbursed: new UntypedFormControl(data.principal_disbursed),
641
+ expected_disbursed: new UntypedFormControl(data.expected_disbursed)
642
+ };
643
+ }
644
+ static CreateContractFromFormObj(data, finalPay) {
645
+ const date = new Date();
646
+ const device = {
647
+ device: data["device"][0].model,
648
+ id: data["device"][0].ID,
649
+ IMEI: data["device"][0].IMEI
650
+ };
651
+ const address = {
652
+ street: data["address"][0].street,
653
+ city: data["address"][0].city,
654
+ neighbor: data["address"][0].neighbor,
655
+ zip: data["address"][0].cp,
656
+ ext: data["address"][0].ext,
657
+ int: data["address"][0].int,
658
+ state: data["address"][0].state
659
+ };
660
+ const financial = {
661
+ total: Number(data["financial"][0].total),
662
+ initial: data["financial"][0].initial,
663
+ deadlines: data["financial"][0].deadlines,
664
+ progress: [],
665
+ pendingOf: [],
666
+ weeklyPayment: data["financial"][0].weeklyPayment,
667
+ interest: data["financial"][0].interest_rate,
668
+ finalDate: date.getTime() + (data["financial"][0].deadlines.weeks * (604800 * 1000)),
669
+ initDate: date.getDate(),
670
+ dayCut: date.getDate(),
671
+ provider: data["financial"][0].provider,
672
+ finalPayment: finalPay,
673
+ financed: data["financial"][0].financed,
674
+ nextPayment: data["financial"][0].nextPayment
675
+ };
676
+ if (data["financial"][0].provider == eProvider.DynamiCore) {
677
+ financial.initial = data["financial"][0].amount_commission_opening ? Number(data["financial"][0].amount_commission_opening) : 0;
678
+ financial.expected_disbursed = data["financial"][0].expected_disbursed ? Number(data["financial"][0].expected_disbursed) : 0;
679
+ financial.principal_disbursed = data["financial"][0].principal_disbursed ? Number(data["financial"][0].principal_disbursed) : 0;
680
+ financial.interest_arrears = data["financial"][0].interest_rate ? Number(data["financial"][0].interest_rate) : 0;
681
+ financial.commission_opening = data["financial"][0].commission_opening ? Number(data["financial"][0].commission_opening) : 0;
682
+ financial.credit_type = data["financial"][0].credit_type ? data["financial"][0].credit_type : "";
683
+ financial.clabe = data["financial"][0].clabe ? data["financial"][0].clabe : "";
684
+ }
685
+ if (data["financial"][0].amount_commission_opening != undefined) {
686
+ if (Number(data["financial"][0].amount_commission_opening) > 0)
687
+ financial.initial = Number(data["financial"][0].amount_commission_opening);
688
+ else
689
+ financial.initial = Number(data["financial"][0].initial);
690
+ }
691
+ if (Number(data["financial"][0].amount_commission_opening) > 0)
692
+ financial.amount_commission_opening = Number(data["financial"][0].amount_commission_opening);
693
+ else
694
+ financial.amount_commission_opening = financial.initial;
695
+ if (financial.nextPayment == undefined)
696
+ financial.nextPayment = 0;
697
+ const contract = {
698
+ id: "",
699
+ client: "",
700
+ address: address,
701
+ device: device,
702
+ financial: financial,
703
+ by: "",
704
+ active: true,
705
+ lastPayment: date.getTime(),
706
+ createdAt: date.getTime()
707
+ };
708
+ return contract;
709
+ }
710
+ static CreateContractToConektaObj(data, monthlyPay, finalPay) {
711
+ const o = {};
712
+ const device = {
713
+ device: data.device.device,
714
+ id: data.device.id,
715
+ IMEI: data.device.IMEI
716
+ };
717
+ const address = {
718
+ street: data.address.street,
719
+ city: data.address.city,
720
+ neighbor: data.address.neighbor,
721
+ zip: data.address.zip,
722
+ ext: data.address.ext,
723
+ int: data.address.int,
724
+ state: data.address.state
725
+ };
726
+ const financial = {
727
+ total: data.financial.total,
728
+ initial: data.financial.initial,
729
+ deadlines: data.financial.deadlines,
730
+ progress: data.financial.progress,
731
+ pendingOf: data.financial.pendingOf,
732
+ weeklyPayment: data.financial.weeklyPayment,
733
+ interest: data.financial.interest,
734
+ finalDate: data.financial.finalDate,
735
+ initDate: data.financial.initDate,
736
+ dayCut: data.financial.dayCut,
737
+ provider: data.financial.provider,
738
+ finalPayment: data.financial.finalPayment,
739
+ financed: data.financial.financed,
740
+ nextPayment: data.financial.nextPayment
741
+ };
742
+ const contract = {
743
+ id: "",
744
+ client: "",
745
+ address: address,
746
+ device: device,
747
+ financial: financial,
748
+ by: "",
749
+ active: true
750
+ };
751
+ return contract;
752
+ }
753
+ static CreateAuthForm(username, curp) {
754
+ const password = this.createPassword(curp);
755
+ return {
756
+ username: new UntypedFormControl(username, Validators.required),
757
+ password: new UntypedFormControl(password, Validators.required),
758
+ };
759
+ }
760
+ static createPassword(curp) {
761
+ const _curp = curp.split("");
762
+ let password = "";
763
+ const limit = 7;
764
+ if (_curp.length < 16)
765
+ return "";
766
+ password += _curp[0].toLowerCase();
767
+ for (let i = 1; i <= limit; i++)
768
+ password += _curp[i].toUpperCase();
769
+ password += `*`;
770
+ return password;
771
+ }
772
+ static MapperTypeContCli_Contract(_contract) {
773
+ const contract = {
774
+ id: _contract.contract,
775
+ client: _contract.client,
776
+ address: _contract.address,
777
+ device: _contract.device,
778
+ financial: _contract.financial,
779
+ by: _contract.by,
780
+ active: _contract.active,
781
+ lastPayment: _contract.lastPayment,
782
+ createdAt: _contract.createdAt,
783
+ dynamicAccount: _contract.dynamicAccount,
784
+ };
785
+ return contract;
786
+ }
787
+ static MapperSyncContractDynamic(base, account) {
788
+ let nContract = base;
789
+ let _financial = base.financial;
790
+ let _device = base.device;
791
+ const financial = {
792
+ total: _financial.total,
793
+ initial: account.properties.amount_commission_opening ? account.properties.amount_commission_opening : _financial.initial,
794
+ deadlines: _financial.deadlines,
795
+ progress: _financial.progress ? _financial.progress : [],
796
+ pendingOf: _financial.pendingOf ? _financial.pendingOf : [],
797
+ weeklyPayment: _financial.weeklyPayment,
798
+ interest: _financial.interest,
799
+ finalDate: _financial.finalDate,
800
+ initDate: _financial.initDate,
801
+ dayCut: _financial.dayCut,
802
+ provider: _financial.provider,
803
+ finalPayment: _financial.finalPayment,
804
+ financed: _financial.financed,
805
+ nextPayment: _financial.nextPayment ? _financial.nextPayment : 0,
806
+ amount_commission_opening: account.properties.amount_commission_opening,
807
+ expected_disbursed: account.properties.expected_disbursed ?
808
+ Number(account.properties.expected_disbursed) :
809
+ Number(_financial.expected_disbursed),
810
+ principal_disbursed: account.properties.principal_disbursed ?
811
+ account.properties.principal_disbursed :
812
+ _financial.principal_disbursed,
813
+ commission_opening: account.config.commission_opening ?
814
+ Number(account.config.commission_opening) :
815
+ Number(_financial.commission_opening),
816
+ credit_type: account.config.credit_type ? account.config.credit_type : _financial.credit_type,
817
+ clabe: String(account.properties.clabe ? account.properties.clabe : _financial.clabe)
818
+ };
819
+ const interestArrears = account.config.interest_arrears;
820
+ const prevInterestArrears = _financial.interest_arrears;
821
+ if (interestArrears != undefined) {
822
+ financial.interest_arrears = interestArrears;
823
+ }
824
+ else if (prevInterestArrears != undefined) {
825
+ financial.interest_arrears = prevInterestArrears;
826
+ }
827
+ else {
828
+ financial.interest_arrears = 0;
829
+ }
830
+ const interest = account.config.interest_rate;
831
+ const prevInterest = _financial.interest;
832
+ if (interest != undefined) {
833
+ financial.interest = interest;
834
+ }
835
+ else if (prevInterest != undefined) {
836
+ financial.interest = prevInterest;
837
+ }
838
+ else {
839
+ financial.interest = 0;
840
+ }
841
+ if (account.properties.amount_commission_opening != undefined) {
842
+ if (Number(account.properties.amount_commission_opening) > 0) {
843
+ financial.initial = Number(account.properties.amount_commission_opening);
844
+ financial.amount_commission_opening = Number(account.properties.amount_commission_opening);
845
+ }
846
+ else {
847
+ financial.initial = Number(_financial.initial);
848
+ financial.amount_commission_opening = financial.initial;
849
+ }
850
+ }
851
+ const seller = account.properties.seller_name;
852
+ nContract.by = seller != null ? seller : "";
853
+ nContract.device.id = _device.id ? _device.id : "";
854
+ nContract.financial = financial;
855
+ return nContract;
856
+ }
857
+ }
858
+
859
+ var eRoles;
860
+ (function (eRoles) {
861
+ eRoles["Administrator"] = "Administrator";
862
+ eRoles["Seller"] = "Seller";
863
+ eRoles["Consultant"] = "Consultant";
864
+ })(eRoles || (eRoles = {}));
865
+ var eProcessStatus;
866
+ (function (eProcessStatus) {
867
+ eProcessStatus["IDLE"] = "IDLE";
868
+ eProcessStatus["ERROR"] = "ERROR";
869
+ eProcessStatus["CANCELED"] = "CANCELED";
870
+ eProcessStatus["COMPLETE"] = "COMPLETE";
871
+ eProcessStatus["PROCESSING"] = "PROCESSING";
872
+ eProcessStatus["WAITING"] = "WAITING";
873
+ })(eProcessStatus || (eProcessStatus = {}));
874
+ var eLoginStatus;
875
+ (function (eLoginStatus) {
876
+ eLoginStatus["IDLE"] = "IDLE";
877
+ eLoginStatus["ERROR"] = "ERROR";
878
+ eLoginStatus["AUTHORIZED"] = "AUTHORIZED";
879
+ eLoginStatus["CHECKING"] = "CHECKING";
880
+ eLoginStatus["NOAUTHORIZED"] = "NOAUTHORIZED";
881
+ eLoginStatus["NOTFOUND"] = "NOTFOUND";
882
+ eLoginStatus["ERRORPASSWORD"] = "ERRORPASSWORD";
883
+ })(eLoginStatus || (eLoginStatus = {}));
884
+ var eClientStatus;
885
+ (function (eClientStatus) {
886
+ eClientStatus["ACTIVE"] = "active";
887
+ eClientStatus["COMPLETED"] = "completed";
888
+ eClientStatus["PAUSED"] = "paused";
889
+ eClientStatus["CANCELED"] = "canceled";
890
+ eClientStatus["LATE"] = "late";
891
+ })(eClientStatus || (eClientStatus = {}));
892
+ const cSingleOptionClientStatus = {
893
+ viewValue: "",
894
+ value: ""
895
+ };
896
+ const cOptionsClientStatus = [
897
+ {
898
+ value: eClientStatus.ACTIVE,
899
+ viewValue: "Activar"
900
+ }, {
901
+ value: eClientStatus.COMPLETED,
902
+ viewValue: "Completar"
903
+ }, {
904
+ value: eClientStatus.PAUSED,
905
+ viewValue: "Pausar"
906
+ }, {
907
+ value: eClientStatus.LATE,
908
+ viewValue: "Marcar con atraso"
909
+ }, {
910
+ value: eClientStatus.CANCELED,
911
+ viewValue: "Cancelar"
912
+ }
913
+ ];
914
+ const eRolesSelect = [
915
+ {
916
+ value: eRoles.Administrator,
917
+ viewValue: eRoles.Administrator
918
+ },
919
+ {
920
+ value: eRoles.Consultant,
921
+ viewValue: eRoles.Consultant
922
+ },
923
+ {
924
+ value: eRoles.Seller,
925
+ viewValue: eRoles.Seller
926
+ },
927
+ ];
928
+ const cPaymentDalay = {
929
+ today: 0,
930
+ nextPayment: 0,
931
+ daysDelay: 0,
932
+ late: false,
933
+ };
934
+ const snackBarConfigAction = {
935
+ horizontalPosition: "start"
936
+ };
937
+ const snackBarConfigNoAction = {
938
+ duration: 4000,
939
+ horizontalPosition: "start"
940
+ };
941
+ const cTyClientContract = { ...cClient, ...cContract };
942
+
943
+ var eAuthActions;
944
+ (function (eAuthActions) {
945
+ eAuthActions["delete"] = "delete";
946
+ eAuthActions["auth"] = "auth";
947
+ })(eAuthActions || (eAuthActions = {}));
948
+ var eAuthType;
949
+ (function (eAuthType) {
950
+ eAuthType["auth"] = "auth";
951
+ eAuthType["login"] = "login";
952
+ eAuthType["idle"] = "";
953
+ })(eAuthType || (eAuthType = {}));
954
+ const cAuthConfig = {
955
+ title: "",
956
+ desc: "",
957
+ data: true,
958
+ };
959
+
960
+ const cTopic = "RavCreditClients";
961
+ var eNotificationType;
962
+ (function (eNotificationType) {
963
+ eNotificationType["GLOBAL"] = "global";
964
+ eNotificationType["USER"] = "user";
965
+ eNotificationType["PAYMENT"] = "payment";
966
+ })(eNotificationType || (eNotificationType = {}));
967
+ const cNotification = {
968
+ notification: {
969
+ title: "",
970
+ body: ""
971
+ },
972
+ data: {
973
+ route: ""
974
+ }
975
+ };
976
+
977
+ var ePassportTypes;
978
+ (function (ePassportTypes) {
979
+ ePassportTypes["CREATE"] = "create_references";
980
+ ePassportTypes["SEND"] = "send_references";
981
+ })(ePassportTypes || (ePassportTypes = {}));
982
+ /** ******************************** */
983
+
984
+ var eReferenceStatusRav;
985
+ (function (eReferenceStatusRav) {
986
+ eReferenceStatusRav["Disponible"] = "Disponible";
987
+ eReferenceStatusRav["Active"] = "Activo con credito vigente";
988
+ eReferenceStatusRav["ActiveEnded"] = "Activo sin credito vigente";
989
+ eReferenceStatusRav["Registered"] = "Registrado";
990
+ eReferenceStatusRav["NonRegistered"] = "No registrado";
991
+ eReferenceStatusRav["NonVerified"] = "No verificado";
992
+ eReferenceStatusRav["Rejected"] = "Rechazado";
993
+ eReferenceStatusRav["Pending"] = "Pendiente";
994
+ })(eReferenceStatusRav || (eReferenceStatusRav = {}));
995
+ var eAccountDynamicStatus;
996
+ (function (eAccountDynamicStatus) {
997
+ eAccountDynamicStatus["OK"] = "Con cuenta activa";
998
+ eAccountDynamicStatus["NOK"] = "Sin cuenta activa";
999
+ })(eAccountDynamicStatus || (eAccountDynamicStatus = {}));
1000
+ //
1001
+ // export enum eAccountDynamicRegister {
1002
+ // "Active" = "Activo", // Ok
1003
+ // "NonAuthorized" = "No autorizado",
1004
+ // "Authorized" = "Autorizado", // Non ref
1005
+ // "Accepted" = "Aceptado", // Non ref
1006
+ // "Rejected" = "Rechazado", // Non ref
1007
+ // "Pending" = "Pendiente", // Non ref
1008
+ // "NotFound" = "No registrado"
1009
+ // }
1010
+ var eClientDynamicStatus;
1011
+ (function (eClientDynamicStatus) {
1012
+ eClientDynamicStatus["Active"] = "Active";
1013
+ eClientDynamicStatus["Pending"] = "Pending";
1014
+ eClientDynamicStatus["Accepted"] = "Accepted";
1015
+ eClientDynamicStatus["Rejected"] = "Rejected";
1016
+ eClientDynamicStatus["approved"] = "Aprobado";
1017
+ })(eClientDynamicStatus || (eClientDynamicStatus = {}));
1018
+ const cClientDynamicStatus = {
1019
+ Active: {
1020
+ value: "Active",
1021
+ viewValue: "Activo"
1022
+ },
1023
+ Pending: {
1024
+ value: "Pending",
1025
+ viewValue: "Pendiente"
1026
+ },
1027
+ Accepted: {
1028
+ value: "Accepted",
1029
+ viewValue: "Pre autorizado"
1030
+ },
1031
+ Rejected: {
1032
+ value: "Rejected",
1033
+ viewValue: "Rechazado"
1034
+ },
1035
+ Idle: {
1036
+ value: "Idle",
1037
+ viewValue: ""
1038
+ },
1039
+ };
1040
+ var eContractSteps;
1041
+ (function (eContractSteps) {
1042
+ eContractSteps["idle"] = "idle";
1043
+ eContractSteps["general"] = "General";
1044
+ eContractSteps["address"] = "Address";
1045
+ eContractSteps["device"] = "Device";
1046
+ eContractSteps["financial"] = "Financial";
1047
+ eContractSteps["app"] = "App";
1048
+ })(eContractSteps || (eContractSteps = {}));
1049
+ const cIDCDataPii = {
1050
+ icc: "",
1051
+ rfc: "",
1052
+ sex: "",
1053
+ city: "",
1054
+ curp: "",
1055
+ days: "",
1056
+ imei: "",
1057
+ name: "",
1058
+ step: "",
1059
+ term: "",
1060
+ brand: "",
1061
+ email: "",
1062
+ model: "",
1063
+ phone: "",
1064
+ score: "",
1065
+ state: "",
1066
+ amount: "",
1067
+ colony: "",
1068
+ period: "",
1069
+ street: "",
1070
+ ticket: "",
1071
+ num_ext: "",
1072
+ num_int: "",
1073
+ zipcode: "",
1074
+ evidence: "",
1075
+ financed: "",
1076
+ house_is: "",
1077
+ lastname: "",
1078
+ type_job: "",
1079
+ birthdate: "",
1080
+ birthstate: "",
1081
+ dicio_data: "",
1082
+ dicio_step: "",
1083
+ secondname: "",
1084
+ nationality: "",
1085
+ seller_name: "",
1086
+ down_payment: "",
1087
+ municipality: "",
1088
+ score_no_hit: "",
1089
+ study_degree: "",
1090
+ branch_office: "",
1091
+ identity_data: "",
1092
+ interest_rate: "",
1093
+ score_interno: "",
1094
+ marital_status: "",
1095
+ monthly_income: "",
1096
+ motherlastname: "",
1097
+ score_rcc_fico: "",
1098
+ identity_selfie: "",
1099
+ amount_by_period: "",
1100
+ identity_id_back: "",
1101
+ proof_of_address: "",
1102
+ identity_id_front: "",
1103
+ economic_dependents: "",
1104
+ identity_id_request: "",
1105
+ identity_verification: "",
1106
+ is_address_ine_currently_live: "",
1107
+ fotografia_del_cliente_con_el_equipo: "",
1108
+ estado: "",
1109
+ gender: ""
1110
+ };
1111
+ /**
1112
+ * Base customer for create customer with DynamiCore provider
1113
+ * */
1114
+ const cIDCCustomer = {
1115
+ pii: cIDCDataPii,
1116
+ client_type: 662
1117
+ };
1118
+ const cIDCPayment = {
1119
+ operation: 98,
1120
+ account: "",
1121
+ date: "",
1122
+ amount: 0,
1123
+ dst_account: "",
1124
+ reference: ""
1125
+ };
1126
+ const cIDCCharge = {
1127
+ barcode_url: "",
1128
+ currency: "",
1129
+ expires_at: 0,
1130
+ object: "",
1131
+ quantity: 0,
1132
+ reference: "",
1133
+ service_name: "",
1134
+ store_name: "",
1135
+ type: "",
1136
+ unit_price: 0
1137
+ };
1138
+ const cIDCGeneratedReference = {
1139
+ account: 0,
1140
+ active: 0,
1141
+ amount: 0,
1142
+ channel: "",
1143
+ charge: cIDCCharge,
1144
+ company: 0,
1145
+ id: "",
1146
+ operation: 0
1147
+ };
1148
+ /**
1149
+ * Common Factory Dynamic
1150
+ * */
1151
+ class FactoryDynamiCore {
1152
+ static CreateReferenceBody(client, contract, dateTime) {
1153
+ const customerInfo = {
1154
+ name: client.name,
1155
+ email: client.email,
1156
+ phone: client.phone,
1157
+ };
1158
+ const customerItems = {
1159
+ name: "Referencia Oxxo",
1160
+ unit_price: contract.financial.weeklyPayment,
1161
+ quantity: 1
1162
+ };
1163
+ const paymentMethod = {
1164
+ type: "oxxo_cash"
1165
+ };
1166
+ if (!client.dynamic_account)
1167
+ return null;
1168
+ const body = {
1169
+ id: client.id,
1170
+ data: {
1171
+ account: Number(client.dynamic_account),
1172
+ operation: 98,
1173
+ customer_info: customerInfo,
1174
+ items: customerItems,
1175
+ payment_method: paymentMethod
1176
+ }
1177
+ };
1178
+ if (dateTime != undefined)
1179
+ body.date = dateTime;
1180
+ return body;
1181
+ }
1182
+ static CreateEmptyCustomer() {
1183
+ return cIDCCustomer;
1184
+ }
1185
+ static CreateCustomerFromOClient(client, contract) {
1186
+ const o = cIDCCustomer;
1187
+ o.pii.email = client.email;
1188
+ o.pii.name = client.name;
1189
+ o.pii.curp = client.curp;
1190
+ o.pii.phone = client.phone;
1191
+ o.pii.amount = String(contract.financial.total);
1192
+ o.pii.financed = String(contract.financial.financed);
1193
+ o.pii.amount_by_period = String(contract.financial.weeklyPayment);
1194
+ o.pii.zipcode = contract.address.zip;
1195
+ o.pii.street = contract.address.street;
1196
+ o.pii.city = contract.address.city;
1197
+ o.pii.state = contract.address.state;
1198
+ o.pii.colony = contract.address.neighbor;
1199
+ o.pii.num_ext = contract.address.ext;
1200
+ return o;
1201
+ }
1202
+ static CreateDynamicCredit(client, contract, clientDynamic) {
1203
+ const properties = {
1204
+ start_date: "",
1205
+ principal_disbursed: 0,
1206
+ expected_disbursed: 0,
1207
+ amount_commission_opening: 0
1208
+ };
1209
+ const config = {
1210
+ contract: `FP-${client.name}`,
1211
+ credit_type: "Arrendamiento",
1212
+ interest_rate: 528,
1213
+ installments: 0,
1214
+ periodicity: "WEEK",
1215
+ interest_base: "ACT/ACT",
1216
+ commission_opening: 40,
1217
+ financed_amount: contract.financial.financed,
1218
+ interest_arrears: 0
1219
+ };
1220
+ if (!client.dynamic_account)
1221
+ return null;
1222
+ return {
1223
+ id: Number(client.dynamic_account),
1224
+ group: clientDynamic.group,
1225
+ company: clientDynamic.company,
1226
+ client: clientDynamic.id,
1227
+ created_at: "",
1228
+ currency: "484",
1229
+ status: "pending",
1230
+ properties: properties,
1231
+ product: 1756,
1232
+ enabled: "1",
1233
+ config: config,
1234
+ amount: 0,
1235
+ type: "liabilities",
1236
+ identifier: null,
1237
+ start_at: null
1238
+ };
1239
+ }
1240
+ static CreatePayment(contract, clientDynamic) {
1241
+ return {
1242
+ account: String(clientDynamic.id),
1243
+ amount: contract.financial.weeklyPayment,
1244
+ date: "",
1245
+ dst_account: String(clientDynamic.id),
1246
+ external_id: "",
1247
+ extras: {},
1248
+ operation: 98,
1249
+ reference: ""
1250
+ };
1251
+ }
1252
+ static getNextDateTime() {
1253
+ const now = new Date();
1254
+ const nextDateTime = new Date(now.getTime() + 1000); // Add 1 second as an example
1255
+ const year = nextDateTime.getFullYear();
1256
+ const month = String(nextDateTime.getMonth() + 1).padStart(2, '0');
1257
+ const day = String(nextDateTime.getDate()).padStart(2, '0');
1258
+ const hours = String(nextDateTime.getHours()).padStart(2, '0');
1259
+ const minutes = String(nextDateTime.getMinutes()).padStart(2, '0');
1260
+ const seconds = String(nextDateTime.getSeconds()).padStart(2, '0');
1261
+ return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
1262
+ }
1263
+ static getIsoDate() {
1264
+ const now = new Date();
1265
+ return now.toISOString();
1266
+ }
1267
+ static FormPayment(contract, account) {
1268
+ let data = FactoryDynamiCore.CreatePayment(contract, account);
1269
+ return {
1270
+ amount: new UntypedFormControl(data.amount, [Validators.required, Validators.min(0)]),
1271
+ };
1272
+ }
1273
+ }
1274
+
33
1275
  /*
34
1276
  * Public API Surface of ravcredit-lib
35
1277
  */
@@ -38,5 +1280,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
38
1280
  * Generated bundle index. Do not edit.
39
1281
  */
40
1282
 
41
- export { RavcreditLibComponent, RavcreditLibService };
1283
+ export { FactoryBusiness, FactoryClient, FactoryContract, FactoryDynamiCore, RavcreditLibComponent, RavcreditLibService, cAddress, cAuthConfig, cBusinessConfig, cBusinessDeadlines, cBusinessInfo, cClient, cClientConekta, cClientContract, cClientDynamicStatus, cConektaRecurrent, cContract, cDefinedSchedule, cDevice, cEmptyDay, cFinancial, cIDCCharge, cIDCCustomer, cIDCDataPii, cIDCGeneratedReference, cIDCPayment, cNotification, cOptionsClientStatus, cOxxoRecurrentSources, cOxxorecurrentSourcesData, cPaymentDalay, cSchedule, cSingleOptionClientStatus, cTopic, cTyClientContract, cUserReference, eAccountDynamicStatus, eAuthActions, eAuthType, eClientDynamicStatus, eClientStatus, eConektaOrderStatus, eConektaRes, eContractSteps, eLoginStatus, eNotificationType, ePassportTypes, eProcessStatus, eProvider, eReferenceStatusRav, eRoles, eRolesSelect, snackBarConfigAction, snackBarConfigNoAction, week };
42
1284
  //# sourceMappingURL=ravcredit-lib.mjs.map