ravcredit-lib 0.0.66 → 0.0.69

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.
@@ -1,5 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, Component, runInInjectionContext, inject } from '@angular/core';
3
+ import { cScore, eClientStatus, cContract, cBusinessInfo, cAddress, cDaySchedule, cBusinessConfig, cIDCCustomer, cClient, cUserReference, cDevice, cFinancial, eProvider, eOrderType, cNotification, dbName, dbVersion, keyUserID, dbAuthStore, dbClientsStore, keyPathId, dbContractsStore, dbConektaClientsStore, dbConektaReferencesStore, dbPassportReferencesStore, dbDynamicReferencesStore, dbBusinessInfo, dbBusinessConfig, dbNotificationsStore, dateFormat, expiredPayment, timeFormat, dateCompleteFormat, ePassportTypes } from 'ravcredit-core';
3
4
  import { UntypedFormControl, Validators, UntypedFormArray } from '@angular/forms';
4
5
  import { add, getDate, format } from 'date-fns';
5
6
  import { es } from 'date-fns/locale/es';
@@ -7,10 +8,10 @@ import { openDB } from 'idb';
7
8
 
8
9
  class RavcreditLibService {
9
10
  constructor() { }
10
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RavcreditLibService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
11
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RavcreditLibService, providedIn: 'root' });
11
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: RavcreditLibService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
12
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: RavcreditLibService, providedIn: 'root' });
12
13
  }
13
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RavcreditLibService, decorators: [{
14
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: RavcreditLibService, decorators: [{
14
15
  type: Injectable,
15
16
  args: [{
16
17
  providedIn: 'root'
@@ -18,14 +19,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImpor
18
19
  }], ctorParameters: () => [] });
19
20
 
20
21
  class RavcreditLibComponent {
21
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RavcreditLibComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
22
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.4", type: RavcreditLibComponent, isStandalone: true, selector: "lib-ravcredit-lib", ngImport: i0, template: `
22
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: RavcreditLibComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
23
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: RavcreditLibComponent, isStandalone: true, selector: "lib-ravcredit-lib", ngImport: i0, template: `
23
24
  <p>
24
25
  ravcredit-lib works!
25
26
  </p>
26
27
  `, isInline: true, styles: [""] });
27
28
  }
28
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RavcreditLibComponent, decorators: [{
29
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: RavcreditLibComponent, decorators: [{
29
30
  type: Component,
30
31
  args: [{ selector: 'lib-ravcredit-lib', standalone: true, imports: [], template: `
31
32
  <p>
@@ -34,391 +35,202 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImpor
34
35
  ` }]
35
36
  }] });
36
37
 
37
- //
38
- // export interface iCustomerInfo = Pick<iCustomer, email | id | name | phone> {
39
- //
40
- // customer_id:string
41
- // }
42
- // {
43
- // livemode: false,
44
- // name: Vicente Mendoza,
45
- // email: vicente.mendoza@conekta.com,
46
- // phone: 5566982093,
47
- // id: cus_2wHtqBNsSggaYdfXu,
48
- // object: customer,
49
- // created_at: 1721258796,
50
- // corporate: false,
51
- // custom_reference:
52
- // }
53
-
54
- var eDestinationType;
55
- (function (eDestinationType) {
56
- eDestinationType["auth"] = "auth";
57
- eDestinationType["login"] = "login";
58
- eDestinationType["idle"] = "";
59
- })(eDestinationType || (eDestinationType = {}));
60
-
61
- const cTopic = "RavCreditClients";
62
- const cNotification = {
63
- notification: {
64
- title: "",
65
- body: ""
66
- },
67
- data: {
68
- route: ""
69
- }
70
- };
71
-
72
- /** ******************************** */
73
-
74
- // export enum oGenVerificationProvider {
75
- // pending, approved, expired
76
- // }
77
- //
78
- // export interface oVerificationLookup {
79
- // carrier: any[]
80
- // }
81
- //
82
- // export interface oVerificationSenCodeAttempt {
83
- // attempt_sid: any[],
84
- // channel: any[],
85
- // time: any[]
86
- // }
87
- //
88
- // export interface oGenVerification {
89
- // Sid: string
90
- // ServiceSid: string,
91
- // AccountSid: string,
92
- // To: string,
93
- // Channel: any,
94
- // Status: oGenVerificationProvider,
95
- // Valid: boolean,
96
- // Lookup: oVerificationLookup,
97
- // SendCodeAttempts: oVerificationSenCodeAttempt[],
98
- // DateCreated: string,
99
- // DateUpdated: string,
100
- // Url: string
101
- // }
102
- //
103
- // export interface oVerification {
104
- // Sid : string,
105
- // ServiceSid : string,
106
- // AccountSid : string,
107
- // To : string,
108
- // Channel : any,
109
- // Status : oGenVerificationProvider,
110
- // Valid : boolean,
111
- // DateCreated : string,
112
- // DateUpdated : string
113
- // }
114
-
115
- var eClientStatus;
116
- (function (eClientStatus) {
117
- eClientStatus["ACTIVE"] = "active";
118
- eClientStatus["COMPLETED"] = "completed";
119
- eClientStatus["PAUSED"] = "paused";
120
- eClientStatus["CANCELED"] = "canceled";
121
- eClientStatus["LATE"] = "late";
122
- })(eClientStatus || (eClientStatus = {}));
123
- var eIdentityTypes;
124
- (function (eIdentityTypes) {
125
- eIdentityTypes["SELFIE"] = "SELFIE";
126
- eIdentityTypes["IDENTITY_FRONT"] = "IDENTITY_FRONT";
127
- eIdentityTypes["IDENTITY_BACK"] = "IDENTITY_BACK";
128
- eIdentityTypes["PASSPORT_FRONT"] = "PASSPORT_FRONT";
129
- eIdentityTypes["PASSPORT_BACK"] = "PASSPORT_BACK";
130
- eIdentityTypes["SERVICE"] = "SERVICE";
131
- eIdentityTypes["WITH_DEVICE"] = "WITH_DEVICE";
132
- eIdentityTypes["NONE"] = "NONE";
133
- })(eIdentityTypes || (eIdentityTypes = {}));
134
-
135
- var eRoles;
136
- (function (eRoles) {
137
- eRoles["Administrator"] = "Administrator";
138
- eRoles["Seller"] = "Seller";
139
- eRoles["Consultant"] = "Consultant";
140
- eRoles["Client"] = "Client";
141
- eRoles["User"] = "User";
142
- })(eRoles || (eRoles = {}));
143
-
144
- var HttpStatus;
145
- (function (HttpStatus) {
146
- HttpStatus[HttpStatus["CONTINUE"] = 100] = "CONTINUE";
147
- HttpStatus[HttpStatus["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
148
- HttpStatus[HttpStatus["PROCESSING"] = 102] = "PROCESSING";
149
- HttpStatus[HttpStatus["EARLYHINTS"] = 103] = "EARLYHINTS";
150
- HttpStatus[HttpStatus["OK"] = 200] = "OK";
151
- HttpStatus[HttpStatus["CREATED"] = 201] = "CREATED";
152
- HttpStatus[HttpStatus["ACCEPTED"] = 202] = "ACCEPTED";
153
- HttpStatus[HttpStatus["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
154
- HttpStatus[HttpStatus["NO_CONTENT"] = 204] = "NO_CONTENT";
155
- HttpStatus[HttpStatus["RESET_CONTENT"] = 205] = "RESET_CONTENT";
156
- HttpStatus[HttpStatus["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
157
- HttpStatus[HttpStatus["AMBIGUOUS"] = 300] = "AMBIGUOUS";
158
- HttpStatus[HttpStatus["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
159
- HttpStatus[HttpStatus["FOUND"] = 302] = "FOUND";
160
- HttpStatus[HttpStatus["SEE_OTHER"] = 303] = "SEE_OTHER";
161
- HttpStatus[HttpStatus["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
162
- HttpStatus[HttpStatus["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
163
- HttpStatus[HttpStatus["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
164
- HttpStatus[HttpStatus["BAD_REQUEST"] = 400] = "BAD_REQUEST";
165
- HttpStatus[HttpStatus["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
166
- HttpStatus[HttpStatus["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
167
- HttpStatus[HttpStatus["FORBIDDEN"] = 403] = "FORBIDDEN";
168
- HttpStatus[HttpStatus["NOT_FOUND"] = 404] = "NOT_FOUND";
169
- HttpStatus[HttpStatus["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
170
- HttpStatus[HttpStatus["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
171
- HttpStatus[HttpStatus["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
172
- HttpStatus[HttpStatus["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
173
- HttpStatus[HttpStatus["CONFLICT"] = 409] = "CONFLICT";
174
- HttpStatus[HttpStatus["GONE"] = 410] = "GONE";
175
- HttpStatus[HttpStatus["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
176
- HttpStatus[HttpStatus["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
177
- HttpStatus[HttpStatus["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
178
- HttpStatus[HttpStatus["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
179
- HttpStatus[HttpStatus["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
180
- HttpStatus[HttpStatus["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
181
- HttpStatus[HttpStatus["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
182
- HttpStatus[HttpStatus["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
183
- HttpStatus[HttpStatus["MISDIRECTED"] = 421] = "MISDIRECTED";
184
- HttpStatus[HttpStatus["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
185
- HttpStatus[HttpStatus["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
186
- HttpStatus[HttpStatus["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
187
- HttpStatus[HttpStatus["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
188
- HttpStatus[HttpStatus["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
189
- HttpStatus[HttpStatus["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
190
- HttpStatus[HttpStatus["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
191
- HttpStatus[HttpStatus["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
192
- HttpStatus[HttpStatus["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
193
- HttpStatus[HttpStatus["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
194
- })(HttpStatus || (HttpStatus = {}));
195
-
196
- const cSingleOptionClientStatus = {
197
- viewValue: "",
198
- value: ""
199
- };
200
- const cOptionsClientStatus = [
201
- {
202
- value: eClientStatus.ACTIVE,
203
- viewValue: "Activar"
204
- }, {
205
- value: eClientStatus.COMPLETED,
206
- viewValue: "Completar"
207
- }, {
208
- value: eClientStatus.PAUSED,
209
- viewValue: "Pausar"
210
- }, {
211
- value: eClientStatus.LATE,
212
- viewValue: "Marcar con atraso"
213
- }, {
214
- value: eClientStatus.CANCELED,
215
- viewValue: "Cancelar"
216
- }
217
- ];
218
- const eRolesSelect = [
219
- {
220
- value: eRoles.Administrator,
221
- viewValue: eRoles.Administrator
222
- },
223
- {
224
- value: eRoles.Consultant,
225
- viewValue: eRoles.Consultant
226
- },
227
- {
228
- value: eRoles.Seller,
229
- viewValue: eRoles.Seller
230
- },
231
- ];
232
- const cPaymentDelay = {
233
- today: 0,
234
- nextPayment: 0,
235
- daysDelay: 0,
236
- late: false,
237
- };
238
- const snackBarConfigAction = {
239
- horizontalPosition: "start"
240
- };
241
- const snackBarConfigNoAction = {
242
- duration: 4000,
243
- horizontalPosition: "start"
244
- };
245
- const snackBarConfigNoActionLong = {
246
- duration: 8000,
247
- horizontalPosition: "start"
248
- };
249
- const cAddress = {
250
- street: "",
251
- city: "",
252
- neighbor: "",
253
- zip: "",
254
- ext: "",
255
- int: "",
256
- state: ""
257
- };
258
- const cOxxoRecurrentSourcesData = {
259
- id: "",
260
- object: "",
261
- type: "",
262
- provider: "",
263
- reference: "",
264
- barcode: "",
265
- barcode_url: "",
266
- expires_at: 0,
267
- created_at: 0,
268
- parent_id: ""
269
- };
270
- const cOxxoRecurrentSources = {
271
- object: "",
272
- has_more: false,
273
- total: 0,
274
- data: []
275
- };
276
- const cConektaRecurrent = {
277
- livemode: false,
278
- name: "",
279
- email: "",
280
- phone: "",
281
- id: "",
282
- object: "",
283
- created_at: 0,
284
- corporate: false,
285
- custom_id: "",
286
- payment_sources: cOxxoRecurrentSources
287
- };
288
- const cAuthConfig = {
289
- title: "",
290
- desc: "",
291
- data: true,
292
- };
293
- const cDaySchedule = {
294
- open: 0,
295
- close: 0
296
- };
297
- const cResponse = {
298
- path: '',
299
- statusCode: HttpStatus.CONTINUE,
300
- epochTime: new Date().getTime(),
301
- data: null,
302
- };
303
- const cClientBase = {
304
- id: "",
305
- name: "",
306
- username: "",
307
- email: "",
308
- phone: "",
309
- curp: "",
310
- contract_temporary: "",
311
- conekta_id: "",
312
- userReferences: [],
313
- status: ""
314
- };
315
- const cScoreAddress = {
316
- CP: "",
317
- ciudad: "",
318
- estado: "",
319
- domicilio: "",
320
- coloniaPoblacion: "",
321
- delegacionMunicipio: ""
322
- };
323
- const cScoreHit = {
324
- valor: ""
325
- };
326
- const cScoreGeneral = {
327
- nombres: "",
328
- apellidoMaterno: "",
329
- apellidoPaterno: "",
330
- fechaNacimiento: ""
331
- };
332
- const cScore = {
333
- domicilio: cScoreAddress,
334
- scoreNoHit: cScoreHit,
335
- folioConsulta: "",
336
- datosGenerales: cScoreGeneral
337
- };
338
- const cMediaIdentity = {
339
- active: false, metadata: null, name: eIdentityTypes.NONE, uploaded: 0, url: ''
340
- };
341
- const cClient = {
342
- score: cScore,
343
- mediaAddress: cMediaIdentity,
344
- id: "",
345
- name: "",
346
- username: "",
347
- email: "",
348
- phone: "",
349
- curp: "",
350
- contract_temporary: "",
351
- conekta_id: "",
352
- userReferences: [],
353
- status: ""
354
- };
355
- const cUserReference = {
356
- name: "",
357
- phone: "",
358
- relationship: ""
359
- };
360
- const cClientConekta = {
361
- conekta: cConektaRecurrent,
362
- ravcredit: cClient
363
- };
364
- const cResponseErrorData = {
365
- epochTime: new Date().getTime(), statusCode: 202,
366
- data: []
367
- };
368
- const emailContact = "contact@ravcredit.com";
369
- const cResponseError = {
370
- path: "",
371
- statusCode: 400,
372
- epochTime: new Date().getTime(),
373
- data: cResponseErrorData
374
- };
375
- const cTyClientContract = { ...cClient, ...cContract };
38
+ class FactoryClient {
39
+ static CreateClientToConektaObj(data) {
40
+ const o = {};
41
+ if (data.name && data.name.length > 0)
42
+ o.name = data.name;
43
+ if (data.username && data.name.length > 0)
44
+ o.username = data.username;
45
+ if (data.email && data.email.length > 0)
46
+ o.email = data.email;
47
+ if (data.phone && data.phone.length > 0)
48
+ o.phone = String(data.phone);
49
+ if (data.curp && data.curp.length > 0)
50
+ o.curp = data.curp;
51
+ if (data.userReferences && data.userReferences.length > 0)
52
+ o.userReferences = data.userReferences;
53
+ if (data.contract)
54
+ o.contract = data.contract;
55
+ if (data.createdAt)
56
+ o.createdAt = data.createdAt;
57
+ if (data.lastLogin)
58
+ o.lastLogin = data.lastLogin;
59
+ if (data.conekta_id)
60
+ o.conekta_id = data.conekta_id;
61
+ return o;
62
+ }
63
+ static CreateClientFromFormObj(data, client) {
64
+ const o = {
65
+ id: "",
66
+ name: data["client"][0].name,
67
+ username: data["auth"][0].username,
68
+ password: data["auth"][0].password,
69
+ email: data["client"][0].email,
70
+ phone: String(data["client"][0].phone),
71
+ curp: data["client"][0].curp,
72
+ userReferences: data["client"][0].userReferences,
73
+ status: eClientStatus.ACTIVE,
74
+ score: cScore,
75
+ };
76
+ if (client != undefined) {
77
+ if (client.dynamic_id)
78
+ o.dynamic_id = client.dynamic_id;
79
+ if (client.dynamic_account)
80
+ o.dynamic_account = client.dynamic_account;
81
+ if (client.conekta_id)
82
+ o.conekta_id = client.conekta_id;
83
+ }
84
+ return o;
85
+ }
86
+ static CreateClientConektaObj(data, finalDate) {
87
+ const sources = {
88
+ type: "oxxo_recurrent",
89
+ expires_at: finalDate
90
+ };
91
+ return {
92
+ name: data.name,
93
+ email: data.email,
94
+ phone: data.phone,
95
+ contract: data.contract_temporary,
96
+ client_id: data.id,
97
+ payment_sources: [sources]
98
+ };
99
+ }
100
+ static MapperConektaClient(client, conekta) {
101
+ const o = client;
102
+ o.name = conekta.name;
103
+ o.email = conekta.email;
104
+ o.phone = conekta.phone;
105
+ o.conekta_id = conekta.id;
106
+ return {
107
+ client: o,
108
+ contract: cContract
109
+ };
110
+ }
111
+ static MapperTypeContCli_Client(_client) {
112
+ const client = {
113
+ score: cScore,
114
+ id: _client.id,
115
+ name: _client.name,
116
+ username: _client.username,
117
+ email: _client.email,
118
+ phone: _client.phone,
119
+ curp: _client.curp,
120
+ userReferences: _client.userReferences,
121
+ status: _client.status,
122
+ contract: _client.contract,
123
+ reference: _client.reference,
124
+ references: _client.references,
125
+ conekta_id: _client.conekta_id,
126
+ dynamic_account: _client.dynamic_account,
127
+ token: _client.token,
128
+ contract_temporary: _client.contract_temporary,
129
+ lastLogin: _client.lastLogin,
130
+ dynamic_id: _client.dynamic_id,
131
+ createdAt: _client.createdAt,
132
+ payments: _client.payments,
133
+ password: _client.password,
134
+ contractUrl: _client.contractUrl,
135
+ dynamic_ref: _client.dynamic_ref,
136
+ exists: _client.exists,
137
+ passport_id: _client.passport_id
138
+ };
139
+ return client;
140
+ }
141
+ static MapperDynamicClient(dynamic, client, contract, clientDyn, account) {
142
+ // constant o: tyClientContract = cTyClientContract
143
+ /* Client ------------------------------------------------------ */
144
+ client.username = `${dynamic.pii.name} ${dynamic.pii.motherlastname} ${dynamic.pii.lastname}`;
145
+ client.phone = dynamic.pii.phone;
146
+ client.dynamic_id = dynamic.id;
147
+ client.curp = dynamic.pii.curp;
148
+ client.email = dynamic.pii.email;
149
+ if (account)
150
+ client.dynamic_account = account.id;
151
+ /* Auth ---------------------------------------------------------- */
152
+ /* Device -------------------------------------------------------- */
153
+ contract.device.IMEI = clientDyn.pii.imei;
154
+ contract.device.device = clientDyn.pii.model;
155
+ /* Contract ------------------------------------------------------ */
156
+ contract.by = clientDyn.pii.seller_name;
157
+ if (clientDyn.pii.fotografia_del_cliente_con_el_equipo != undefined) {
158
+ const oPhoto = clientDyn.pii.fotografia_del_cliente_con_el_equipo;
159
+ if (oPhoto != "") {
160
+ const _photo = JSON.parse(oPhoto);
161
+ if (_photo)
162
+ contract.photo = _photo[0].url;
163
+ }
164
+ }
165
+ contract.address.state = dynamic.pii.state;
166
+ contract.address.city = dynamic.pii.city;
167
+ contract.address.street = dynamic.pii.street;
168
+ contract.address.ext = dynamic.pii.num_ext;
169
+ contract.address.zip = dynamic.pii.zipcode;
170
+ contract.address.neighbor = dynamic.pii.colony;
171
+ /* Financial ------------------------------------------------------ */
172
+ contract.dynamicAccount = Number(account?.id);
173
+ if (account?.config.installments) {
174
+ contract.financial.deadlines = {
175
+ weeks: account.config.installments,
176
+ interest: 0
177
+ };
178
+ }
179
+ if (account?.properties.expected_disbursed)
180
+ contract.financial.total = account?.properties.expected_disbursed;
181
+ if (account?.properties.principal_disbursed)
182
+ contract.financial.financed = account?.properties.principal_disbursed;
183
+ if (account?.properties.amount_commission_opening) {
184
+ contract.financial.initial = account?.properties.amount_commission_opening;
185
+ contract.financial.amount_commission_opening = account?.properties.amount_commission_opening;
186
+ }
187
+ contract.financial.interest_rate = Number(clientDyn.pii.interest_rate);
188
+ contract.financial.interest_arrears = account?.config.interest_arrears;
189
+ contract.financial.commission_opening = account?.config.commission_opening;
190
+ contract.financial.credit_type = account?.config.credit_type;
191
+ contract.financial.principal_disbursed = account?.properties.principal_disbursed;
192
+ contract.financial.expected_disbursed = account?.properties.expected_disbursed;
193
+ contract.financial.weeklyPayment = Number(clientDyn.pii.amount_by_period);
194
+ return {
195
+ client: client,
196
+ contract: contract,
197
+ };
198
+ }
199
+ static MapperFinancialContract(contract, account) {
200
+ contract.dynamicAccount = Number(account.id);
201
+ if (account.config.installments) {
202
+ contract.financial.deadlines = {
203
+ weeks: account.config.installments,
204
+ interest: 0
205
+ };
206
+ }
207
+ const total = account.config.financed_amount != undefined ? account.config.financed_amount : 0;
208
+ if (total > 0)
209
+ contract.financial.total = total;
210
+ // if (account.properties.expected_disbursed)
211
+ const expected_disbursed = account.properties.expected_disbursed != undefined ? account.properties.expected_disbursed : 0;
212
+ if (expected_disbursed > 0)
213
+ contract.financial.total = expected_disbursed;
214
+ contract.financial.expected_disbursed = expected_disbursed;
215
+ contract.financial.interest_rate = account.config.interest_rate;
216
+ contract.financial.interest_arrears = account.config.interest_arrears;
217
+ // if (account.properties.principal_disbursed)
218
+ if (account.properties.principal_disbursed > 0)
219
+ contract.financial.financed = account.properties.principal_disbursed;
220
+ contract.financial.principal_disbursed = account.properties.principal_disbursed;
221
+ const amount_commission_opening = account.properties.amount_commission_opening != undefined ? account.properties.amount_commission_opening : 0;
222
+ if (amount_commission_opening > 0)
223
+ contract.financial.initial = amount_commission_opening;
224
+ contract.financial.amount_commission_opening = amount_commission_opening;
225
+ contract.financial.interest_arrears = account.config.interest_arrears;
226
+ contract.financial.commission_opening = account.config.commission_opening;
227
+ contract.financial.credit_type = account.config.credit_type;
228
+ contract.financial.clabe = String(account.properties.clabe);
229
+ return contract.financial;
230
+ }
231
+ static CheckEmail = (email) => email.includes("@") && email.endsWith(".com");
232
+ }
376
233
 
377
- const cSchedule = {
378
- day: "",
379
- open: 0,
380
- close: 0,
381
- };
382
- const cEmptyDay = {
383
- close: 0, open: 0, day: ""
384
- };
385
- const week = [
386
- "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"
387
- ];
388
- const cDefinedSchedule = [
389
- { close: 0, open: 0, day: "monday" },
390
- { close: 0, open: 0, day: "tuesday" },
391
- { close: 0, open: 0, day: "wednesday" },
392
- { close: 0, open: 0, day: "thursday" },
393
- { close: 0, open: 0, day: "friday" },
394
- { close: 0, open: 0, day: "saturday" },
395
- { close: 0, open: 0, day: "sunday" },
396
- ];
397
- const cBusinessInfo = {
398
- version: "v2024",
399
- name: "",
400
- address: cAddress,
401
- phones: [],
402
- email: "",
403
- };
404
- const cBusinessDeadlines = {
405
- weeks: 0,
406
- interest: 0
407
- };
408
- const cBusinessConfig = {
409
- version: "",
410
- apiVersion: "",
411
- adminVersion: "",
412
- mobileVersion: "",
413
- mobileVersionPrev: "",
414
- deadlines: [],
415
- downloadsClient: false,
416
- passportPaymentReference: false,
417
- conektaPaymentReference: false,
418
- conektaPaymentLink: false,
419
- dynamicPaymentReference: false,
420
- 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"
421
- };
422
234
  class FactoryBusiness {
423
235
  static FormBusinessInfo(info) {
424
236
  let data = cBusinessInfo;
@@ -543,81 +355,167 @@ class FactoryBusiness {
543
355
  }
544
356
  }
545
357
 
546
- var eProvider;
547
- (function (eProvider) {
548
- eProvider["none"] = "";
549
- eProvider["Conekta"] = "Conekta";
550
- eProvider["Passport"] = "Passport";
551
- eProvider["DynamiCore"] = "DynamiCore";
552
- })(eProvider || (eProvider = {}));
553
- // export type ProgressTaskStatus = TaskState | "uploading" | "idle" | "generating" | "unauthorized"
554
- const cDevice = {
555
- device: "",
556
- IMEI: ""
557
- };
558
- const cFinancial = {
559
- total: 0,
560
- initial: 0,
561
- deadlines: cBusinessDeadlines,
562
- initDate: 0,
563
- weeklyPayment: 0,
564
- pendingOf: [],
565
- progress: [],
566
- interest: 0,
567
- provider: eProvider.DynamiCore,
568
- financed: 0,
569
- nextPayment: 0,
570
- amount_commission_opening: 0,
571
- principal_disbursed: 0,
572
- expected_disbursed: 0, // ---------
573
- credit_type: 'Arrendamiento',
574
- interest_rate: 0,
575
- commission_opening: 0,
576
- interest_arrears: 0,
577
- };
578
- const cContract = {
579
- id: "",
580
- client: "",
581
- address: cAddress,
582
- device: cDevice,
583
- financial: cFinancial,
584
- by: "",
585
- active: true
586
- };
587
- class FactoryContract {
588
- static FormClient(client) {
589
- let data = cClient;
590
- if (client)
591
- data = client;
592
- return {
593
- name: new UntypedFormControl(data.name, [Validators.required, Validators.minLength(10)]),
594
- email: new UntypedFormControl(data.username, [Validators.required, Validators.email]),
595
- phone: new UntypedFormControl(data.phone, [Validators.required, Validators.min(10)]),
596
- curp: new UntypedFormControl(data.curp, [Validators.required, Validators.minLength(16)]),
597
- userReferences: new UntypedFormArray([])
358
+ /**
359
+ * Common Factory Dynamic
360
+ * */
361
+ class FactoryDynamiCore {
362
+ static CreateReferenceBody(client, contract, dateTime) {
363
+ const customerInfo = {
364
+ name: client.name,
365
+ email: client.email,
366
+ phone: client.phone,
598
367
  };
599
- }
600
- static CreateUserReferenceFormObj(user) {
601
- let data = cUserReference;
602
- if (user.name != "")
603
- data = user;
604
- return {
605
- name: new UntypedFormControl(data.name, [Validators.required, Validators.minLength(10)]),
606
- phone: new UntypedFormControl(data.phone, [Validators.required]),
607
- relationship: new UntypedFormControl(data.relationship, [Validators.required]),
368
+ const customerItems = {
369
+ name: "Referencia Oxxo",
370
+ unit_price: contract.financial.weeklyPayment,
371
+ quantity: 1
608
372
  };
609
- }
610
- static FormAddress(address) {
611
- let data = cAddress;
612
- if (address)
613
- data = address;
614
- return {
615
- street: new UntypedFormControl(data.street, Validators.required),
616
- neighbor: new UntypedFormControl(data.neighbor, Validators.required),
617
- cp: new UntypedFormControl(data.zip, Validators.required),
618
- ext: new UntypedFormControl(data.ext, Validators.required),
619
- int: new UntypedFormControl(data.int),
620
- city: new UntypedFormControl(data.city, Validators.required),
373
+ const paymentMethod = {
374
+ type: "oxxo_cash"
375
+ };
376
+ if (!client.dynamic_account)
377
+ return null;
378
+ const body = {
379
+ id: client.id,
380
+ data: {
381
+ account: Number(client.dynamic_account),
382
+ operation: 98,
383
+ customer_info: customerInfo,
384
+ items: customerItems,
385
+ payment_method: paymentMethod
386
+ }
387
+ };
388
+ if (dateTime != undefined)
389
+ body.date = dateTime;
390
+ return body;
391
+ }
392
+ static CreateEmptyCustomer() {
393
+ return cIDCCustomer;
394
+ }
395
+ static CreateCustomerFromOClient(client, contract) {
396
+ const o = cIDCCustomer;
397
+ o.pii.email = client.email;
398
+ o.pii.name = client.name;
399
+ o.pii.curp = client.curp;
400
+ o.pii.phone = client.phone;
401
+ o.pii.amount = String(contract.financial.total);
402
+ o.pii.financed = String(contract.financial.financed);
403
+ o.pii.amount_by_period = String(contract.financial.weeklyPayment);
404
+ o.pii.zipcode = contract.address.zip;
405
+ o.pii.street = contract.address.street;
406
+ o.pii.city = contract.address.city;
407
+ o.pii.state = contract.address.state;
408
+ o.pii.colony = contract.address.neighbor;
409
+ o.pii.num_ext = contract.address.ext;
410
+ return o;
411
+ }
412
+ static CreateDynamicCredit(client, contract, clientDynamic) {
413
+ const properties = {
414
+ start_date: "",
415
+ principal_disbursed: 0,
416
+ expected_disbursed: 0,
417
+ amount_commission_opening: 0
418
+ };
419
+ const config = {
420
+ contract: `FP-${client.name}`,
421
+ credit_type: "Arrendamiento",
422
+ interest_rate: 528,
423
+ installments: 0,
424
+ periodicity: "WEEK",
425
+ interest_base: "ACT/ACT",
426
+ commission_opening: 40,
427
+ financed_amount: contract.financial.financed,
428
+ interest_arrears: 0
429
+ };
430
+ if (!client.dynamic_account)
431
+ return null;
432
+ return {
433
+ id: Number(client.dynamic_account),
434
+ group: clientDynamic.group,
435
+ company: clientDynamic.company,
436
+ client: clientDynamic.id,
437
+ created_at: "",
438
+ currency: "484",
439
+ status: "pending",
440
+ properties: properties,
441
+ product: 1756,
442
+ enabled: "1",
443
+ config: config,
444
+ amount: 0,
445
+ type: "liabilities",
446
+ identifier: null,
447
+ start_at: null
448
+ };
449
+ }
450
+ static CreatePayment(contract, clientDynamic) {
451
+ return {
452
+ account: String(clientDynamic.id),
453
+ amount: contract.financial.weeklyPayment,
454
+ date: "",
455
+ dst_account: String(clientDynamic.id),
456
+ external_id: "",
457
+ extras: {},
458
+ operation: 98,
459
+ reference: ""
460
+ };
461
+ }
462
+ static getNextDateTime() {
463
+ const now = new Date();
464
+ const nextDateTime = new Date(now.getTime() + 1000); // Add 1 second as an example
465
+ const year = nextDateTime.getFullYear();
466
+ const month = String(nextDateTime.getMonth() + 1).padStart(2, '0');
467
+ const day = String(nextDateTime.getDate()).padStart(2, '0');
468
+ const hours = String(nextDateTime.getHours()).padStart(2, '0');
469
+ const minutes = String(nextDateTime.getMinutes()).padStart(2, '0');
470
+ const seconds = String(nextDateTime.getSeconds()).padStart(2, '0');
471
+ return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
472
+ }
473
+ static getIsoDate() {
474
+ const now = new Date();
475
+ return now.toISOString();
476
+ }
477
+ static FormPayment(contract, account) {
478
+ let data = FactoryDynamiCore.CreatePayment(contract, account);
479
+ return {
480
+ amount: new UntypedFormControl(data.amount, [Validators.required, Validators.min(0)]),
481
+ };
482
+ }
483
+ }
484
+
485
+ class FactoryContract {
486
+ static FormClient(client) {
487
+ let data = cClient;
488
+ if (client)
489
+ data = client;
490
+ return {
491
+ name: new UntypedFormControl(data.name, [Validators.required, Validators.minLength(10)]),
492
+ email: new UntypedFormControl(data.username, [Validators.required, Validators.email]),
493
+ phone: new UntypedFormControl(data.phone, [Validators.required, Validators.min(10)]),
494
+ curp: new UntypedFormControl(data.curp, [Validators.required, Validators.minLength(16)]),
495
+ userReferences: new UntypedFormArray([])
496
+ };
497
+ }
498
+ static CreateUserReferenceFormObj(user) {
499
+ let data = cUserReference;
500
+ if (user.name != "")
501
+ data = user;
502
+ return {
503
+ name: new UntypedFormControl(data.name, [Validators.required, Validators.minLength(10)]),
504
+ phone: new UntypedFormControl(data.phone, [Validators.required]),
505
+ relationship: new UntypedFormControl(data.relationship, [Validators.required]),
506
+ };
507
+ }
508
+ static FormAddress(address) {
509
+ let data = cAddress;
510
+ if (address)
511
+ data = address;
512
+ return {
513
+ street: new UntypedFormControl(data.street, Validators.required),
514
+ neighbor: new UntypedFormControl(data.neighbor, Validators.required),
515
+ cp: new UntypedFormControl(data.zip, Validators.required),
516
+ ext: new UntypedFormControl(data.ext, Validators.required),
517
+ int: new UntypedFormControl(data.int),
518
+ city: new UntypedFormControl(data.city, Validators.required),
621
519
  state: new UntypedFormControl(data.state, Validators.required),
622
520
  };
623
521
  }
@@ -750,720 +648,168 @@ class FactoryContract {
750
648
  brand: brand,
751
649
  price: 0,
752
650
  model: "",
753
- imageUrl: [],
754
- paymentOption: [],
755
- catalog: catalog,
756
- offers: [],
757
- score: score,
758
- IMEI: ""
759
- };
760
- const device = {
761
- device: data.device.device,
762
- id: data.device.id,
763
- IMEI: data.device.IMEI
764
- };
765
- const address = {
766
- street: data.address.street,
767
- city: data.address.city,
768
- neighbor: data.address.neighbor,
769
- zip: data.address.zip,
770
- ext: data.address.ext,
771
- int: data.address.int,
772
- state: data.address.state
773
- };
774
- const financial = {
775
- total: data.financial.total,
776
- initial: data.financial.initial,
777
- deadlines: data.financial.deadlines,
778
- progress: data.financial.progress,
779
- pendingOf: data.financial.pendingOf,
780
- weeklyPayment: data.financial.weeklyPayment,
781
- interest: data.financial.interest,
782
- finalDate: data.financial.finalDate,
783
- initDate: data.financial.initDate,
784
- dayCut: data.financial.dayCut,
785
- provider: data.financial.provider,
786
- finalPayment: data.financial.finalPayment,
787
- financed: data.financial.financed,
788
- nextPayment: data.financial.nextPayment
789
- };
790
- const contract = {
791
- id: "",
792
- client: "",
793
- address: address,
794
- device: device,
795
- financial: financial,
796
- by: "",
797
- active: true
798
- };
799
- return contract;
800
- }
801
- static CreateAuthForm(username, curp) {
802
- const password = this.createPassword(curp);
803
- return {
804
- username: new UntypedFormControl(username, Validators.required),
805
- password: new UntypedFormControl(password, Validators.required),
806
- };
807
- }
808
- static createPassword(curp) {
809
- const _curp = curp.split("");
810
- let password = "";
811
- const limit = 7;
812
- if (_curp.length < 16)
813
- return "";
814
- password += _curp[0].toLowerCase();
815
- for (let i = 1; i <= limit; i++)
816
- password += _curp[i].toUpperCase();
817
- password += `*`;
818
- return password;
819
- }
820
- static MapperTypeContCli_Contract(_contract) {
821
- const contract = {
822
- id: _contract.contract,
823
- client: _contract.client,
824
- address: _contract.address,
825
- device: _contract.device,
826
- financial: _contract.financial,
827
- by: _contract.by,
828
- active: _contract.active,
829
- lastPayment: _contract.lastPayment,
830
- createdAt: _contract.createdAt,
831
- dynamicAccount: _contract.dynamicAccount,
832
- };
833
- return contract;
834
- }
835
- static MapperSyncContractDynamic(base, account) {
836
- let nContract = base;
837
- let _financial = base.financial;
838
- let _device = base.device;
839
- const financial = {
840
- total: _financial.total,
841
- initial: account.properties.amount_commission_opening ? account.properties.amount_commission_opening : _financial.initial,
842
- deadlines: _financial.deadlines,
843
- progress: _financial.progress ? _financial.progress : [],
844
- pendingOf: _financial.pendingOf ? _financial.pendingOf : [],
845
- weeklyPayment: _financial.weeklyPayment,
846
- interest: _financial.interest,
847
- finalDate: _financial.finalDate,
848
- initDate: _financial.initDate,
849
- dayCut: _financial.dayCut,
850
- provider: _financial.provider,
851
- finalPayment: _financial.finalPayment,
852
- financed: _financial.financed,
853
- nextPayment: _financial.nextPayment ? _financial.nextPayment : 0,
854
- amount_commission_opening: account.properties.amount_commission_opening,
855
- expected_disbursed: account.properties.expected_disbursed ?
856
- Number(account.properties.expected_disbursed) :
857
- Number(_financial.expected_disbursed),
858
- principal_disbursed: account.properties.principal_disbursed ?
859
- account.properties.principal_disbursed :
860
- _financial.principal_disbursed,
861
- commission_opening: account.config.commission_opening ?
862
- Number(account.config.commission_opening) :
863
- Number(_financial.commission_opening),
864
- credit_type: account.config.credit_type ? account.config.credit_type : _financial.credit_type,
865
- clabe: String(account.properties.clabe ? account.properties.clabe : _financial.clabe)
866
- };
867
- const interestArrears = account.config.interest_arrears;
868
- const prevInterestArrears = _financial.interest_arrears;
869
- if (interestArrears != undefined) {
870
- financial.interest_arrears = interestArrears;
871
- }
872
- else if (prevInterestArrears != undefined) {
873
- financial.interest_arrears = prevInterestArrears;
874
- }
875
- else {
876
- financial.interest_arrears = 0;
877
- }
878
- const interest = account.config.interest_rate;
879
- const prevInterest = _financial.interest;
880
- if (interest != undefined) {
881
- financial.interest = interest;
882
- }
883
- else if (prevInterest != undefined) {
884
- financial.interest = prevInterest;
885
- }
886
- else {
887
- financial.interest = 0;
888
- }
889
- if (account.properties.amount_commission_opening != undefined) {
890
- if (Number(account.properties.amount_commission_opening) > 0) {
891
- financial.initial = Number(account.properties.amount_commission_opening);
892
- financial.amount_commission_opening = Number(account.properties.amount_commission_opening);
893
- }
894
- else {
895
- financial.initial = Number(_financial.initial);
896
- financial.amount_commission_opening = financial.initial;
897
- }
898
- }
899
- const seller = account.properties.seller_name;
900
- nContract.by = seller != null ? seller : "";
901
- nContract.device.id = _device.id ? _device.id : "";
902
- nContract.financial = financial;
903
- return nContract;
904
- }
905
- }
906
- var eContractStatus;
907
- (function (eContractStatus) {
908
- eContractStatus["APPROVED"] = "APPROVED";
909
- eContractStatus["DENIED"] = "DENIED";
910
- eContractStatus["CANCELED"] = "CANCELED";
911
- eContractStatus["PENDING"] = "PENDING";
912
- eContractStatus["CHECKING"] = "CHECKING";
913
- })(eContractStatus || (eContractStatus = {}));
914
-
915
- const cClientContract = {
916
- client: cClient,
917
- contract: cContract,
918
- };
919
- class FactoryClient {
920
- static CreateClientToConektaObj(data) {
921
- const o = {};
922
- if (data.name && data.name.length > 0)
923
- o.name = data.name;
924
- if (data.username && data.name.length > 0)
925
- o.username = data.username;
926
- if (data.email && data.email.length > 0)
927
- o.email = data.email;
928
- if (data.phone && data.phone.length > 0)
929
- o.phone = String(data.phone);
930
- if (data.curp && data.curp.length > 0)
931
- o.curp = data.curp;
932
- if (data.userReferences && data.userReferences.length > 0)
933
- o.userReferences = data.userReferences;
934
- if (data.contract)
935
- o.contract = data.contract;
936
- if (data.createdAt)
937
- o.createdAt = data.createdAt;
938
- if (data.lastLogin)
939
- o.lastLogin = data.lastLogin;
940
- if (data.conekta_id)
941
- o.conekta_id = data.conekta_id;
942
- return o;
943
- }
944
- static CreateClientFromFormObj(data, client) {
945
- const o = {
946
- id: "",
947
- name: data["client"][0].name,
948
- username: data["auth"][0].username,
949
- password: data["auth"][0].password,
950
- email: data["client"][0].email,
951
- phone: String(data["client"][0].phone),
952
- curp: data["client"][0].curp,
953
- userReferences: data["client"][0].userReferences,
954
- status: eClientStatus.ACTIVE,
955
- score: cScore,
956
- };
957
- if (client != undefined) {
958
- if (client.dynamic_id)
959
- o.dynamic_id = client.dynamic_id;
960
- if (client.dynamic_account)
961
- o.dynamic_account = client.dynamic_account;
962
- if (client.conekta_id)
963
- o.conekta_id = client.conekta_id;
964
- }
965
- return o;
966
- }
967
- static CreateClientConektaObj(data, finalDate) {
968
- const sources = {
969
- type: "oxxo_recurrent",
970
- expires_at: finalDate
971
- };
972
- return {
973
- name: data.name,
974
- email: data.email,
975
- phone: data.phone,
976
- contract: data.contract_temporary,
977
- client_id: data.id,
978
- payment_sources: [sources]
979
- };
980
- }
981
- static MapperConektaClient(client, conekta) {
982
- const o = client;
983
- o.name = conekta.name;
984
- o.email = conekta.email;
985
- o.phone = conekta.phone;
986
- o.conekta_id = conekta.id;
987
- return {
988
- client: o,
989
- contract: cContract
990
- };
991
- }
992
- static MapperTypeContCli_Client(_client) {
993
- const client = {
994
- score: cScore,
995
- id: _client.id,
996
- name: _client.name,
997
- username: _client.username,
998
- email: _client.email,
999
- phone: _client.phone,
1000
- curp: _client.curp,
1001
- userReferences: _client.userReferences,
1002
- status: _client.status,
1003
- contract: _client.contract,
1004
- reference: _client.reference,
1005
- references: _client.references,
1006
- conekta_id: _client.conekta_id,
1007
- dynamic_account: _client.dynamic_account,
1008
- token: _client.token,
1009
- contract_temporary: _client.contract_temporary,
1010
- lastLogin: _client.lastLogin,
1011
- dynamic_id: _client.dynamic_id,
1012
- createdAt: _client.createdAt,
1013
- payments: _client.payments,
1014
- password: _client.password,
1015
- contractUrl: _client.contractUrl,
1016
- dynamic_ref: _client.dynamic_ref,
1017
- exists: _client.exists,
1018
- passport_id: _client.passport_id
1019
- };
1020
- return client;
1021
- }
1022
- static MapperDynamicClient(dynamic, client, contract, clientDyn, account) {
1023
- // constant o: tyClientContract = cTyClientContract
1024
- /* Client ------------------------------------------------------ */
1025
- client.username = `${dynamic.pii.name} ${dynamic.pii.motherlastname} ${dynamic.pii.lastname}`;
1026
- client.phone = dynamic.pii.phone;
1027
- client.dynamic_id = dynamic.id;
1028
- client.curp = dynamic.pii.curp;
1029
- client.email = dynamic.pii.email;
1030
- if (account)
1031
- client.dynamic_account = account.id;
1032
- /* Auth ---------------------------------------------------------- */
1033
- /* Device -------------------------------------------------------- */
1034
- contract.device.IMEI = clientDyn.pii.imei;
1035
- contract.device.device = clientDyn.pii.model;
1036
- /* Contract ------------------------------------------------------ */
1037
- contract.by = clientDyn.pii.seller_name;
1038
- if (clientDyn.pii.fotografia_del_cliente_con_el_equipo != undefined) {
1039
- const oPhoto = clientDyn.pii.fotografia_del_cliente_con_el_equipo;
1040
- if (oPhoto != "") {
1041
- const _photo = JSON.parse(oPhoto);
1042
- if (_photo)
1043
- contract.photo = _photo[0].url;
1044
- }
1045
- }
1046
- contract.address.state = dynamic.pii.state;
1047
- contract.address.city = dynamic.pii.city;
1048
- contract.address.street = dynamic.pii.street;
1049
- contract.address.ext = dynamic.pii.num_ext;
1050
- contract.address.zip = dynamic.pii.zipcode;
1051
- contract.address.neighbor = dynamic.pii.colony;
1052
- /* Financial ------------------------------------------------------ */
1053
- contract.dynamicAccount = Number(account?.id);
1054
- if (account?.config.installments) {
1055
- contract.financial.deadlines = {
1056
- weeks: account.config.installments,
1057
- interest: 0
1058
- };
1059
- }
1060
- if (account?.properties.expected_disbursed)
1061
- contract.financial.total = account?.properties.expected_disbursed;
1062
- if (account?.properties.principal_disbursed)
1063
- contract.financial.financed = account?.properties.principal_disbursed;
1064
- if (account?.properties.amount_commission_opening) {
1065
- contract.financial.initial = account?.properties.amount_commission_opening;
1066
- contract.financial.amount_commission_opening = account?.properties.amount_commission_opening;
1067
- }
1068
- contract.financial.interest_rate = Number(clientDyn.pii.interest_rate);
1069
- contract.financial.interest_arrears = account?.config.interest_arrears;
1070
- contract.financial.commission_opening = account?.config.commission_opening;
1071
- contract.financial.credit_type = account?.config.credit_type;
1072
- contract.financial.principal_disbursed = account?.properties.principal_disbursed;
1073
- contract.financial.expected_disbursed = account?.properties.expected_disbursed;
1074
- contract.financial.weeklyPayment = Number(clientDyn.pii.amount_by_period);
1075
- return {
1076
- client: client,
1077
- contract: contract,
1078
- };
1079
- }
1080
- static MapperFinancialContract(contract, account) {
1081
- contract.dynamicAccount = Number(account.id);
1082
- if (account.config.installments) {
1083
- contract.financial.deadlines = {
1084
- weeks: account.config.installments,
1085
- interest: 0
1086
- };
1087
- }
1088
- const total = account.config.financed_amount != undefined ? account.config.financed_amount : 0;
1089
- if (total > 0)
1090
- contract.financial.total = total;
1091
- // if (account.properties.expected_disbursed)
1092
- const expected_disbursed = account.properties.expected_disbursed != undefined ? account.properties.expected_disbursed : 0;
1093
- if (expected_disbursed > 0)
1094
- contract.financial.total = expected_disbursed;
1095
- contract.financial.expected_disbursed = expected_disbursed;
1096
- contract.financial.interest_rate = account.config.interest_rate;
1097
- contract.financial.interest_arrears = account.config.interest_arrears;
1098
- // if (account.properties.principal_disbursed)
1099
- if (account.properties.principal_disbursed > 0)
1100
- contract.financial.financed = account.properties.principal_disbursed;
1101
- contract.financial.principal_disbursed = account.properties.principal_disbursed;
1102
- const amount_commission_opening = account.properties.amount_commission_opening != undefined ? account.properties.amount_commission_opening : 0;
1103
- if (amount_commission_opening > 0)
1104
- contract.financial.initial = amount_commission_opening;
1105
- contract.financial.amount_commission_opening = amount_commission_opening;
1106
- contract.financial.interest_arrears = account.config.interest_arrears;
1107
- contract.financial.commission_opening = account.config.commission_opening;
1108
- contract.financial.credit_type = account.config.credit_type;
1109
- contract.financial.clabe = String(account.properties.clabe);
1110
- return contract.financial;
1111
- }
1112
- static CheckEmail = (email) => email.includes("@") && email.endsWith(".com");
1113
- }
1114
-
1115
- class UtilsHttp {
1116
- static CreateHeadersRavcreditApi(token) {
1117
- return {
1118
- 'Content-Type': 'application/json',
1119
- 'Accept': 'application/json',
1120
- 'Access-Control-Allow-Headers': 'Content-Type',
1121
- 'Authorization': `Bearer ${token}`
1122
- };
1123
- }
1124
- static CreateSimpleHeadersApi() {
1125
- return {
1126
- 'Content-Type': 'application/json',
1127
- 'Accept': 'application/json',
1128
- 'Access-Control-Allow-Headers': 'Content-Type',
1129
- };
1130
- }
1131
- static CreateAwsHeadersApi() {
1132
- return {
1133
- 'Content-Type': 'application/json'
1134
- };
1135
- }
1136
- }
1137
-
1138
- var eReferenceStatusRav;
1139
- (function (eReferenceStatusRav) {
1140
- eReferenceStatusRav["Disponible"] = "Disponible";
1141
- eReferenceStatusRav["Active"] = "Activo con credito vigente";
1142
- eReferenceStatusRav["ActiveEnded"] = "Activo sin credito vigente";
1143
- eReferenceStatusRav["Registered"] = "Registrado";
1144
- eReferenceStatusRav["NonRegistered"] = "No registrado";
1145
- eReferenceStatusRav["NonVerified"] = "No verificado";
1146
- eReferenceStatusRav["Rejected"] = "Rechazado";
1147
- eReferenceStatusRav["Pending"] = "Pendiente";
1148
- })(eReferenceStatusRav || (eReferenceStatusRav = {}));
1149
- var eAccountDynamicStatus;
1150
- (function (eAccountDynamicStatus) {
1151
- eAccountDynamicStatus["OK"] = "Con cuenta activa";
1152
- eAccountDynamicStatus["NOK"] = "Sin cuenta activa";
1153
- })(eAccountDynamicStatus || (eAccountDynamicStatus = {}));
1154
- //
1155
- // export enum eAccountDynamicRegister {
1156
- // "Active" = "Activo", // Ok
1157
- // "NonAuthorized" = "No autorizado",
1158
- // "Authorized" = "Autorizado", // Non ref
1159
- // "Accepted" = "Aceptado", // Non ref
1160
- // "Rejected" = "Rechazado", // Non ref
1161
- // "Pending" = "Pendiente", // Non ref
1162
- // "NotFound" = "No registrado"
1163
- // }
1164
- var eClientDynamicStatus;
1165
- (function (eClientDynamicStatus) {
1166
- eClientDynamicStatus["Active"] = "Active";
1167
- eClientDynamicStatus["Pending"] = "Pending";
1168
- eClientDynamicStatus["Accepted"] = "Accepted";
1169
- eClientDynamicStatus["Rejected"] = "Rejected";
1170
- eClientDynamicStatus["approved"] = "Aprobado";
1171
- })(eClientDynamicStatus || (eClientDynamicStatus = {}));
1172
- const cClientDynamicStatus = {
1173
- Active: {
1174
- value: "Active",
1175
- viewValue: "Activo"
1176
- },
1177
- Pending: {
1178
- value: "Pending",
1179
- viewValue: "Pendiente"
1180
- },
1181
- Accepted: {
1182
- value: "Accepted",
1183
- viewValue: "Pre autorizado"
1184
- },
1185
- Rejected: {
1186
- value: "Rejected",
1187
- viewValue: "Rechazado"
1188
- },
1189
- Idle: {
1190
- value: "Idle",
1191
- viewValue: ""
1192
- },
1193
- };
1194
- var eContractSteps;
1195
- (function (eContractSteps) {
1196
- eContractSteps["idle"] = "idle";
1197
- eContractSteps["general"] = "General";
1198
- eContractSteps["address"] = "Address";
1199
- eContractSteps["device"] = "Device";
1200
- eContractSteps["financial"] = "Financial";
1201
- eContractSteps["app"] = "App";
1202
- })(eContractSteps || (eContractSteps = {}));
1203
- const cIDCDataPii = {
1204
- icc: "",
1205
- rfc: "",
1206
- sex: "",
1207
- city: "",
1208
- curp: "",
1209
- days: "",
1210
- imei: "",
1211
- name: "",
1212
- step: "",
1213
- term: "",
1214
- brand: "",
1215
- email: "",
1216
- model: "",
1217
- phone: "",
1218
- score: "",
1219
- state: "",
1220
- amount: "",
1221
- colony: "",
1222
- period: "",
1223
- street: "",
1224
- ticket: "",
1225
- num_ext: "",
1226
- num_int: "",
1227
- zipcode: "",
1228
- evidence: "",
1229
- financed: "",
1230
- house_is: "",
1231
- lastname: "",
1232
- type_job: "",
1233
- birthdate: "",
1234
- birthstate: "",
1235
- dicio_data: "",
1236
- dicio_step: "",
1237
- secondname: "",
1238
- nationality: "",
1239
- seller_name: "",
1240
- down_payment: "",
1241
- municipality: "",
1242
- score_no_hit: "",
1243
- study_degree: "",
1244
- branch_office: "",
1245
- identity_data: "",
1246
- interest_rate: "",
1247
- score_interno: "",
1248
- marital_status: "",
1249
- monthly_income: "",
1250
- motherlastname: "",
1251
- score_rcc_fico: "",
1252
- identity_selfie: "",
1253
- amount_by_period: "",
1254
- identity_id_back: "",
1255
- proof_of_address: "",
1256
- identity_id_front: "",
1257
- economic_dependents: "",
1258
- identity_id_request: "",
1259
- identity_verification: "",
1260
- is_address_ine_currently_live: "",
1261
- fotografia_del_cliente_con_el_equipo: "",
1262
- estado: "",
1263
- gender: ""
1264
- };
1265
- /**
1266
- * Base customer for create customer with DynamiCore provider
1267
- * */
1268
- const cIDCCustomer = {
1269
- pii: cIDCDataPii,
1270
- client_type: 662
1271
- };
1272
- const cIDCPayment = {
1273
- operation: 98,
1274
- account: "",
1275
- date: "",
1276
- amount: 0,
1277
- dst_account: "",
1278
- reference: ""
1279
- };
1280
- const cIDCCharge = {
1281
- barcode_url: "",
1282
- currency: "",
1283
- expires_at: 0,
1284
- object: "",
1285
- quantity: 0,
1286
- reference: "",
1287
- service_name: "",
1288
- store_name: "",
1289
- type: "",
1290
- unit_price: 0
1291
- };
1292
- const cIDCGeneratedReference = {
1293
- account: 0,
1294
- active: 0,
1295
- amount: 0,
1296
- channel: "",
1297
- charge: cIDCCharge,
1298
- company: 0,
1299
- id: "",
1300
- operation: 0
1301
- };
1302
- /**
1303
- * Common Factory Dynamic
1304
- * */
1305
- class FactoryDynamiCore {
1306
- static CreateReferenceBody(client, contract, dateTime) {
1307
- const customerInfo = {
1308
- name: client.name,
1309
- email: client.email,
1310
- phone: client.phone,
1311
- };
1312
- const customerItems = {
1313
- name: "Referencia Oxxo",
1314
- unit_price: contract.financial.weeklyPayment,
1315
- quantity: 1
1316
- };
1317
- const paymentMethod = {
1318
- type: "oxxo_cash"
651
+ imageUrl: [],
652
+ paymentOption: [],
653
+ catalog: catalog,
654
+ offers: [],
655
+ score: score,
656
+ IMEI: ""
1319
657
  };
1320
- if (!client.dynamic_account)
1321
- return null;
1322
- const body = {
1323
- id: client.id,
1324
- data: {
1325
- account: Number(client.dynamic_account),
1326
- operation: 98,
1327
- customer_info: customerInfo,
1328
- items: customerItems,
1329
- payment_method: paymentMethod
1330
- }
658
+ const device = {
659
+ device: data.device.device,
660
+ id: data.device.id,
661
+ IMEI: data.device.IMEI
1331
662
  };
1332
- if (dateTime != undefined)
1333
- body.date = dateTime;
1334
- return body;
1335
- }
1336
- static CreateEmptyCustomer() {
1337
- return cIDCCustomer;
1338
- }
1339
- static CreateCustomerFromOClient(client, contract) {
1340
- const o = cIDCCustomer;
1341
- o.pii.email = client.email;
1342
- o.pii.name = client.name;
1343
- o.pii.curp = client.curp;
1344
- o.pii.phone = client.phone;
1345
- o.pii.amount = String(contract.financial.total);
1346
- o.pii.financed = String(contract.financial.financed);
1347
- o.pii.amount_by_period = String(contract.financial.weeklyPayment);
1348
- o.pii.zipcode = contract.address.zip;
1349
- o.pii.street = contract.address.street;
1350
- o.pii.city = contract.address.city;
1351
- o.pii.state = contract.address.state;
1352
- o.pii.colony = contract.address.neighbor;
1353
- o.pii.num_ext = contract.address.ext;
1354
- return o;
1355
- }
1356
- static CreateDynamicCredit(client, contract, clientDynamic) {
1357
- const properties = {
1358
- start_date: "",
1359
- principal_disbursed: 0,
1360
- expected_disbursed: 0,
1361
- amount_commission_opening: 0
663
+ const address = {
664
+ street: data.address.street,
665
+ city: data.address.city,
666
+ neighbor: data.address.neighbor,
667
+ zip: data.address.zip,
668
+ ext: data.address.ext,
669
+ int: data.address.int,
670
+ state: data.address.state
1362
671
  };
1363
- const config = {
1364
- contract: `FP-${client.name}`,
1365
- credit_type: "Arrendamiento",
1366
- interest_rate: 528,
1367
- installments: 0,
1368
- periodicity: "WEEK",
1369
- interest_base: "ACT/ACT",
1370
- commission_opening: 40,
1371
- financed_amount: contract.financial.financed,
1372
- interest_arrears: 0
672
+ const financial = {
673
+ total: data.financial.total,
674
+ initial: data.financial.initial,
675
+ deadlines: data.financial.deadlines,
676
+ progress: data.financial.progress,
677
+ pendingOf: data.financial.pendingOf,
678
+ weeklyPayment: data.financial.weeklyPayment,
679
+ interest: data.financial.interest,
680
+ finalDate: data.financial.finalDate,
681
+ initDate: data.financial.initDate,
682
+ dayCut: data.financial.dayCut,
683
+ provider: data.financial.provider,
684
+ finalPayment: data.financial.finalPayment,
685
+ financed: data.financial.financed,
686
+ nextPayment: data.financial.nextPayment
1373
687
  };
1374
- if (!client.dynamic_account)
1375
- return null;
1376
- return {
1377
- id: Number(client.dynamic_account),
1378
- group: clientDynamic.group,
1379
- company: clientDynamic.company,
1380
- client: clientDynamic.id,
1381
- created_at: "",
1382
- currency: "484",
1383
- status: "pending",
1384
- properties: properties,
1385
- product: 1756,
1386
- enabled: "1",
1387
- config: config,
1388
- amount: 0,
1389
- type: "liabilities",
1390
- identifier: null,
1391
- start_at: null
688
+ const contract = {
689
+ id: "",
690
+ client: "",
691
+ address: address,
692
+ device: device,
693
+ financial: financial,
694
+ by: "",
695
+ active: true
1392
696
  };
697
+ return contract;
1393
698
  }
1394
- static CreatePayment(contract, clientDynamic) {
699
+ static CreateAuthForm(username, curp) {
700
+ const password = this.createPassword(curp);
1395
701
  return {
1396
- account: String(clientDynamic.id),
1397
- amount: contract.financial.weeklyPayment,
1398
- date: "",
1399
- dst_account: String(clientDynamic.id),
1400
- external_id: "",
1401
- extras: {},
1402
- operation: 98,
1403
- reference: ""
702
+ username: new UntypedFormControl(username, Validators.required),
703
+ password: new UntypedFormControl(password, Validators.required),
1404
704
  };
1405
705
  }
1406
- static getNextDateTime() {
1407
- const now = new Date();
1408
- const nextDateTime = new Date(now.getTime() + 1000); // Add 1 second as an example
1409
- const year = nextDateTime.getFullYear();
1410
- const month = String(nextDateTime.getMonth() + 1).padStart(2, '0');
1411
- const day = String(nextDateTime.getDate()).padStart(2, '0');
1412
- const hours = String(nextDateTime.getHours()).padStart(2, '0');
1413
- const minutes = String(nextDateTime.getMinutes()).padStart(2, '0');
1414
- const seconds = String(nextDateTime.getSeconds()).padStart(2, '0');
1415
- return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
706
+ static createPassword(curp) {
707
+ const _curp = curp.split("");
708
+ let password = "";
709
+ const limit = 7;
710
+ if (_curp.length < 16)
711
+ return "";
712
+ password += _curp[0].toLowerCase();
713
+ for (let i = 1; i <= limit; i++)
714
+ password += _curp[i].toUpperCase();
715
+ password += `*`;
716
+ return password;
1416
717
  }
1417
- static getIsoDate() {
1418
- const now = new Date();
1419
- return now.toISOString();
718
+ static MapperTypeContCli_Contract(_contract) {
719
+ const contract = {
720
+ id: _contract.contract,
721
+ client: _contract.client,
722
+ address: _contract.address,
723
+ device: _contract.device,
724
+ financial: _contract.financial,
725
+ by: _contract.by,
726
+ active: _contract.active,
727
+ lastPayment: _contract.lastPayment,
728
+ createdAt: _contract.createdAt,
729
+ dynamicAccount: _contract.dynamicAccount,
730
+ };
731
+ return contract;
1420
732
  }
1421
- static FormPayment(contract, account) {
1422
- let data = FactoryDynamiCore.CreatePayment(contract, account);
1423
- return {
1424
- amount: new UntypedFormControl(data.amount, [Validators.required, Validators.min(0)]),
733
+ static MapperSyncContractDynamic(base, account) {
734
+ let nContract = base;
735
+ let _financial = base.financial;
736
+ let _device = base.device;
737
+ const financial = {
738
+ total: _financial.total,
739
+ initial: account.properties.amount_commission_opening ? account.properties.amount_commission_opening : _financial.initial,
740
+ deadlines: _financial.deadlines,
741
+ progress: _financial.progress ? _financial.progress : [],
742
+ pendingOf: _financial.pendingOf ? _financial.pendingOf : [],
743
+ weeklyPayment: _financial.weeklyPayment,
744
+ interest: _financial.interest,
745
+ finalDate: _financial.finalDate,
746
+ initDate: _financial.initDate,
747
+ dayCut: _financial.dayCut,
748
+ provider: _financial.provider,
749
+ finalPayment: _financial.finalPayment,
750
+ financed: _financial.financed,
751
+ nextPayment: _financial.nextPayment ? _financial.nextPayment : 0,
752
+ amount_commission_opening: account.properties.amount_commission_opening,
753
+ expected_disbursed: account.properties.expected_disbursed ?
754
+ Number(account.properties.expected_disbursed) :
755
+ Number(_financial.expected_disbursed),
756
+ principal_disbursed: account.properties.principal_disbursed ?
757
+ account.properties.principal_disbursed :
758
+ _financial.principal_disbursed,
759
+ commission_opening: account.config.commission_opening ?
760
+ Number(account.config.commission_opening) :
761
+ Number(_financial.commission_opening),
762
+ credit_type: account.config.credit_type ? account.config.credit_type : _financial.credit_type,
763
+ clabe: String(account.properties.clabe ? account.properties.clabe : _financial.clabe)
1425
764
  };
765
+ const interestArrears = account.config.interest_arrears;
766
+ const prevInterestArrears = _financial.interest_arrears;
767
+ if (interestArrears != undefined) {
768
+ financial.interest_arrears = interestArrears;
769
+ }
770
+ else if (prevInterestArrears != undefined) {
771
+ financial.interest_arrears = prevInterestArrears;
772
+ }
773
+ else {
774
+ financial.interest_arrears = 0;
775
+ }
776
+ const interest = account.config.interest_rate;
777
+ const prevInterest = _financial.interest;
778
+ if (interest != undefined) {
779
+ financial.interest = interest;
780
+ }
781
+ else if (prevInterest != undefined) {
782
+ financial.interest = prevInterest;
783
+ }
784
+ else {
785
+ financial.interest = 0;
786
+ }
787
+ if (account.properties.amount_commission_opening != undefined) {
788
+ if (Number(account.properties.amount_commission_opening) > 0) {
789
+ financial.initial = Number(account.properties.amount_commission_opening);
790
+ financial.amount_commission_opening = Number(account.properties.amount_commission_opening);
791
+ }
792
+ else {
793
+ financial.initial = Number(_financial.initial);
794
+ financial.amount_commission_opening = financial.initial;
795
+ }
796
+ }
797
+ const seller = account.properties.seller_name;
798
+ nContract.by = seller != null ? seller : "";
799
+ nContract.device.id = _device.id ? _device.id : "";
800
+ nContract.financial = financial;
801
+ return nContract;
1426
802
  }
1427
803
  }
804
+ var eContractStatus;
805
+ (function (eContractStatus) {
806
+ eContractStatus["APPROVED"] = "APPROVED";
807
+ eContractStatus["DENIED"] = "DENIED";
808
+ eContractStatus["CANCELED"] = "CANCELED";
809
+ eContractStatus["PENDING"] = "PENDING";
810
+ eContractStatus["CHECKING"] = "CHECKING";
811
+ })(eContractStatus || (eContractStatus = {}));
1428
812
 
1429
- var eProcessStatus;
1430
- (function (eProcessStatus) {
1431
- eProcessStatus["IDLE"] = "IDLE";
1432
- eProcessStatus["ERROR"] = "ERROR";
1433
- eProcessStatus["CANCELED"] = "CANCELED";
1434
- eProcessStatus["COMPLETE"] = "COMPLETE";
1435
- eProcessStatus["PROCESSING"] = "PROCESSING";
1436
- eProcessStatus["WAITING"] = "WAITING";
1437
- })(eProcessStatus || (eProcessStatus = {}));
1438
- var eRequestVerb;
1439
- (function (eRequestVerb) {
1440
- eRequestVerb["POST"] = "POST";
1441
- eRequestVerb["GET"] = "GET";
1442
- eRequestVerb["PATCH"] = "PATCH";
1443
- eRequestVerb["DELETE"] = "DELETE";
1444
- })(eRequestVerb || (eRequestVerb = {}));
1445
- var eGCActions;
1446
- (function (eGCActions) {
1447
- eGCActions["Create"] = "Create";
1448
- eGCActions["Update"] = "Update";
1449
- eGCActions["Remove"] = "Remove";
1450
- eGCActions["LoginTime"] = "UpdateLogIn";
1451
- })(eGCActions || (eGCActions = {}));
1452
- var eOrderType;
1453
- (function (eOrderType) {
1454
- eOrderType["DYNAMIC_REFERENCE"] = "DYNAMIC_REFERENCE";
1455
- eOrderType["DYNAMIC_SPEI"] = "DYNAMIC_SPEI";
1456
- eOrderType["FEMSA_REFERENCE"] = "FEMSA_REFERENCE";
1457
- eOrderType["CONEKTA_SPEI"] = "CONEKTA_SPEI";
1458
- eOrderType["PASSPORT_REFERENCE"] = "PASSPORT_REFERENCE";
1459
- })(eOrderType || (eOrderType = {}));
1460
-
1461
- var ePaymentType;
1462
- (function (ePaymentType) {
1463
- ePaymentType["OXXO"] = "OXXO";
1464
- ePaymentType["ALTERNA"] = "ALTERNA";
1465
- ePaymentType["OXXO_RECURRENT"] = "oxxo_recurrent";
1466
- })(ePaymentType || (ePaymentType = {}));
1467
813
  class FactoryConekta {
1468
814
  static createOrder(client, contract, dateTime) {
1469
815
  if (client.conekta_id == undefined)
@@ -1638,43 +984,6 @@ class FactoryNotification {
1638
984
  }
1639
985
  }
1640
986
 
1641
- const keyUserID = "rc_uid";
1642
- const dbVersion = 1;
1643
- const dbName = "RavCreditDB";
1644
- const keyPathId = "id";
1645
- const dbAuthStore = "authStore";
1646
- const dbUsersStore = "usersStore";
1647
- const dbContractsStore = "contractsStore";
1648
- const dbClientsStore = "clientsStore";
1649
- const dbBusinessInfo = "businessInfo";
1650
- const dbBusinessConfig = "businessConfig";
1651
- const dbConektaClientsStore = "conektaClientsStore";
1652
- const dbConektaReferencesStore = "conektaReferencesStore";
1653
- const dbConektaSpeiStore = "conektaSpeiStore";
1654
- const dbPassportReferencesStore = "passportReferencesStore";
1655
- const dbDynamicReferencesStore = "dynamicReferencesStore";
1656
- const dbDynamicAccountStore = "dynamicAccountStore";
1657
- const dbNotificationsStore = "notificationsStore";
1658
- const dbPaymentsStore = "paymentsStore";
1659
- const dbIndexAuth = "iAuth";
1660
- const dbIndexUsers = "iUsers";
1661
- const dbIndexContracts = "iContracts";
1662
- const dbIndexClients = "iClients";
1663
- const dbIndexBusiness = "iBusiness";
1664
- const dbIndexConektaClients = "iConecktaClients";
1665
- const dbIndexConektaClientsRef = "iConecktaClientsRef";
1666
- const dbIndexPassportClientsRef = "iPassportClientsRef";
1667
- const dbIndexNotification = "iNotification";
1668
- const dbIndexPayments = "iNotification";
1669
- const dateFormat = "EEEE, dd MMM yyyy";
1670
- const dateFormatSimple = "EEEEEE, dd MMM yyyy";
1671
- const dateCompleteFormat = "EEEE, dd MMM yyyy hh:mm aaaa";
1672
- const timeFormat = "hh:mm aaaa";
1673
- const TIME_FORMAT_TABLE = "iii, dd MMM yyyy";
1674
- const timeFormatTable = "iii, dd MMM yyyy";
1675
- const expiredPayment = "expiredPayment";
1676
- const ROLES_KEY = 'roles';
1677
-
1678
987
  class IndexedDbService {
1679
988
  indexDbStatus = false;
1680
989
  iDb;
@@ -1995,10 +1304,10 @@ class IndexedDbService {
1995
1304
  }
1996
1305
  }
1997
1306
  }
1998
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: IndexedDbService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1999
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: IndexedDbService, providedIn: 'root' });
1307
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: IndexedDbService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1308
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: IndexedDbService, providedIn: 'root' });
2000
1309
  }
2001
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: IndexedDbService, decorators: [{
1310
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: IndexedDbService, decorators: [{
2002
1311
  type: Injectable,
2003
1312
  args: [{
2004
1313
  providedIn: 'root'
@@ -2155,30 +1464,6 @@ class UtilTime {
2155
1464
  }
2156
1465
  }
2157
1466
 
2158
- const cContractMetrics = {
2159
- total: 0,
2160
- activated: 0,
2161
- paused: 0,
2162
- completed: 0,
2163
- canceled: 0,
2164
- late: 0,
2165
- conektaCount: 0,
2166
- dynamicCount: 0,
2167
- passportCount: 0,
2168
- rateTotal: 0,
2169
- rateActive: 0,
2170
- ratePaused: 0,
2171
- rateComplete: 0,
2172
- rateCanceled: 0,
2173
- rateLate: 0
2174
- };
2175
-
2176
- var ePassportTypes;
2177
- (function (ePassportTypes) {
2178
- ePassportTypes["CREATE"] = "create_references";
2179
- ePassportTypes["SEND"] = "send_references";
2180
- })(ePassportTypes || (ePassportTypes = {}));
2181
-
2182
1467
  class FactoryPassport {
2183
1468
  static CreatePassportReference(client, contract, dateTime) {
2184
1469
  const o = {
@@ -2232,163 +1517,6 @@ class UtilGeneral {
2232
1517
  }
2233
1518
  }
2234
1519
 
2235
- const ErrorMessages = {
2236
- NotFound: "Recurso no encontrado",
2237
- Unauthorized: "Request without(or not valid) token",
2238
- RandomError: "Something goes wrong, try again -> ",
2239
- RandomErrorFirestore: "Something goes wrong in firestore",
2240
- CreateUser: "Error: Something goes wrong",
2241
- CreateFoundedUser: "Error: User already exists try with another username",
2242
- FindAllNotFound: "Not users found",
2243
- UserFindOne: "User with given ID not found",
2244
- UserFindOneError: "Error getting user by ID",
2245
- UserUpdate: "Error updating user by ID",
2246
- DeleteUser: "Error deleting user",
2247
- UsernameNotFound: "User with given username not found",
2248
- IncorrectPassword: "Incorrect or not valid password",
2249
- LastLogIn: "Last LogIn date not updated",
2250
- authError: "Username or password incorrect",
2251
- tokenRequired: "Token required",
2252
- ClientDefined: "This user already registered: Update user's contracts instead",
2253
- ClientsNotFound: "List of clients is empty",
2254
- ClientNotFound: "Client with given ID, not found",
2255
- ClientNotUpdated: "Client with given ID, not updated",
2256
- DeleteClient: "Error deleting client",
2257
- UsernameClientNotFound: "Client with given username not found",
2258
- ContractsAllEmpty: "Contract list empty",
2259
- ContractNotFound: "Contract not found",
2260
- ContractUpdateError: "Something goes wrong updating contract, try again",
2261
- ContractDeleteError: "Something goes wrong deleting contract, try again",
2262
- cNotUserFound: "Usuario no encontrado",
2263
- cIncorrectPassword: "Contraseña incorrecta",
2264
- dbUsernameNotFound: "User with given username not found",
2265
- dbIncorrectPassword: "Incorrect or not valid password",
2266
- dbUsernameClientNotFound: "Client with given username not found",
2267
- };
2268
-
2269
- var RouteData;
2270
- (function (RouteData) {
2271
- RouteData[RouteData["CLIENT"] = 0] = "CLIENT";
2272
- RouteData[RouteData["CONTRACT"] = 1] = "CONTRACT";
2273
- RouteData[RouteData["REFERENCE"] = 2] = "REFERENCE";
2274
- RouteData[RouteData["ID"] = 3] = "ID";
2275
- RouteData[RouteData["EXTERNAL_ID"] = 4] = "EXTERNAL_ID";
2276
- RouteData[RouteData["PAYMENT_DYNAMIC"] = 5] = "PAYMENT_DYNAMIC";
2277
- RouteData[RouteData["PAYMENT_CONEKTA"] = 6] = "PAYMENT_CONEKTA";
2278
- })(RouteData || (RouteData = {}));
2279
- var eEmailType;
2280
- (function (eEmailType) {
2281
- eEmailType["register"] = "register";
2282
- eEmailType["update"] = "update";
2283
- })(eEmailType || (eEmailType = {}));
2284
-
2285
- var AmortizationStatus;
2286
- (function (AmortizationStatus) {
2287
- AmortizationStatus["PENDING"] = "PENDING";
2288
- AmortizationStatus["PAID"] = "PAID";
2289
- AmortizationStatus["PARTIALLY_PAID"] = "PARTIALLY_PAID";
2290
- AmortizationStatus["OVERDUE"] = "OVERDUE";
2291
- })(AmortizationStatus || (AmortizationStatus = {}));
2292
-
2293
- var eAssetPeriod;
2294
- (function (eAssetPeriod) {
2295
- eAssetPeriod["MONTH"] = "MONTH";
2296
- eAssetPeriod["WEEK"] = "WEEK";
2297
- })(eAssetPeriod || (eAssetPeriod = {}));
2298
-
2299
- var eLoginStatus;
2300
- (function (eLoginStatus) {
2301
- eLoginStatus["IDLE"] = "IDLE";
2302
- eLoginStatus["ERROR"] = "ERROR";
2303
- eLoginStatus["AUTHORIZED"] = "AUTHORIZED";
2304
- eLoginStatus["CHECKING"] = "CHECKING";
2305
- eLoginStatus["NOAUTHORIZED"] = "NOAUTHORIZED";
2306
- eLoginStatus["NOTFOUND"] = "NOTFOUND";
2307
- eLoginStatus["ERRORPASSWORD"] = "ERRORPASSWORD";
2308
- eLoginStatus["USERNOTFOUND"] = "USERNOTFOUND";
2309
- })(eLoginStatus || (eLoginStatus = {}));
2310
- var eAuthActions;
2311
- (function (eAuthActions) {
2312
- eAuthActions["delete"] = "delete";
2313
- eAuthActions["auth"] = "auth";
2314
- })(eAuthActions || (eAuthActions = {}));
2315
- var eAuthType2;
2316
- (function (eAuthType2) {
2317
- eAuthType2["auth"] = "auth";
2318
- eAuthType2["login"] = "login";
2319
- eAuthType2["idle"] = "";
2320
- })(eAuthType2 || (eAuthType2 = {}));
2321
- var eAuthType;
2322
- (function (eAuthType) {
2323
- eAuthType["USER"] = "USER";
2324
- eAuthType["ADMIN"] = "ADMIN";
2325
- eAuthType["SELLER"] = "SELLER";
2326
- eAuthType["CLIENT"] = "CLIENT";
2327
- eAuthType["CONSULTANT"] = "CONSULTANT";
2328
- eAuthType["FUNCTION"] = "FUNCTION";
2329
- })(eAuthType || (eAuthType = {}));
2330
-
2331
- var eConektaRes;
2332
- (function (eConektaRes) {
2333
- eConektaRes["CUSTOMER_CREATED"] = "customer.created";
2334
- eConektaRes["ORDER_PENDING_PAYMENT"] = "order.pending_payment";
2335
- eConektaRes["ORDER_CREATED"] = "order.created";
2336
- eConektaRes["CHARGE_CREATED"] = "charge.created";
2337
- eConektaRes["ORDER_PAID"] = "order.paid";
2338
- eConektaRes["CHARGE_PAID"] = "charge.paid";
2339
- })(eConektaRes || (eConektaRes = {}));
2340
- var eConektaOrderStatus;
2341
- (function (eConektaOrderStatus) {
2342
- eConektaOrderStatus["expired"] = "expired";
2343
- eConektaOrderStatus["paid"] = "paid";
2344
- eConektaOrderStatus["pending_payment"] = "pending_payment";
2345
- })(eConektaOrderStatus || (eConektaOrderStatus = {}));
2346
- // export enum eConektaOrderType {
2347
- // REFERENCE = "REFERENCE",
2348
- // SPEI = "SPEI",
2349
- // }
2350
-
2351
- var EnumDynamicClientStatus;
2352
- (function (EnumDynamicClientStatus) {
2353
- EnumDynamicClientStatus["ACCEPTED"] = "Accepted";
2354
- EnumDynamicClientStatus["PENDING"] = "Pending";
2355
- EnumDynamicClientStatus["REJECTED"] = "Rejected";
2356
- EnumDynamicClientStatus["ACTIVE"] = "Active";
2357
- EnumDynamicClientStatus["INACTIVE"] = "Inactive";
2358
- EnumDynamicClientStatus["CANCELED"] = "Cancelled";
2359
- })(EnumDynamicClientStatus || (EnumDynamicClientStatus = {}));
2360
-
2361
- var eNotificationType;
2362
- (function (eNotificationType) {
2363
- eNotificationType["GLOBAL"] = "global";
2364
- eNotificationType["USER"] = "user";
2365
- eNotificationType["PAYMENT"] = "payment";
2366
- })(eNotificationType || (eNotificationType = {}));
2367
-
2368
- var eVerificationStep;
2369
- (function (eVerificationStep) {
2370
- eVerificationStep["IDLE"] = "IDLE";
2371
- eVerificationStep["ERROR"] = "ERROR";
2372
- eVerificationStep["COMPLETED"] = "COMPLETED";
2373
- eVerificationStep["IN_PROGRESS"] = "IN_PROGRESS";
2374
- eVerificationStep["INVALID"] = "INVALID";
2375
- eVerificationStep["SUSPENDED"] = "SUSPENDED";
2376
- eVerificationStep["CANCELLED"] = "CANCELLED";
2377
- })(eVerificationStep || (eVerificationStep = {}));
2378
- var eVerificationStatus;
2379
- (function (eVerificationStatus) {
2380
- eVerificationStatus["APPROVED"] = "approved";
2381
- eVerificationStatus["CANCELLED"] = "cancelled";
2382
- })(eVerificationStatus || (eVerificationStatus = {}));
2383
- var eVerificationChannel;
2384
- (function (eVerificationChannel) {
2385
- eVerificationChannel["SMS"] = "sms";
2386
- eVerificationChannel["WHATSAPP"] = "whatsapp";
2387
- eVerificationChannel["CALL"] = "call";
2388
- eVerificationChannel["EMAIL"] = "email";
2389
- eVerificationChannel["SNA"] = "sna";
2390
- })(eVerificationChannel || (eVerificationChannel = {}));
2391
-
2392
1520
  /*
2393
1521
  * Public API Surface of ravcredit-lib
2394
1522
  */
@@ -2397,5 +1525,5 @@ var eVerificationChannel;
2397
1525
  * Generated bundle index. Do not edit.
2398
1526
  */
2399
1527
 
2400
- export { AmortizationStatus, EnumDynamicClientStatus, ErrorMessages, FactoryBusiness, FactoryClient, FactoryConekta, FactoryContract, FactoryDynamiCore, FactoryNotification, FactoryPassport, FactoryPayment, IndexedDbService, ROLES_KEY, ROUTE_GLOBAL_REFERENCE2, ROUTE_NOTIFICATIONS, RavcreditLibComponent, RavcreditLibService, RouteData, TIME_FORMAT_TABLE, UtilGeneral, UtilTime, UtilsHttp, cAddress, cAuthConfig, cBusinessConfig, cBusinessDeadlines, cBusinessInfo, cClient, cClientBase, cClientConekta, cClientContract, cClientDynamicStatus, cConektaRecurrent, cContract, cContractMetrics, cDaySchedule, cDefinedSchedule, cDevice, cEmptyDay, cFinancial, cIDCCharge, cIDCCustomer, cIDCDataPii, cIDCGeneratedReference, cIDCPayment, cMediaIdentity, cNotification, cOptionsClientStatus, cOxxoRecurrentSources, cOxxoRecurrentSourcesData, cPaymentDelay, cResponse, cResponseError, cResponseErrorData, cSchedule, cScore, cScoreAddress, cScoreGeneral, cScoreHit, cSingleOptionClientStatus, cTopic, cTyClientContract, cUserReference, dateCompleteFormat, dateFormat, dateFormatSimple, dbAuthStore, dbBusinessConfig, dbBusinessInfo, dbClientsStore, dbConektaClientsStore, dbConektaReferencesStore, dbConektaSpeiStore, dbContractsStore, dbDynamicAccountStore, dbDynamicReferencesStore, dbIndexAuth, dbIndexBusiness, dbIndexClients, dbIndexConektaClients, dbIndexConektaClientsRef, dbIndexContracts, dbIndexNotification, dbIndexPassportClientsRef, dbIndexPayments, dbIndexUsers, dbName, dbNotificationsStore, dbPassportReferencesStore, dbPaymentsStore, dbUsersStore, dbVersion, eAccountDynamicStatus, eAssetPeriod, eAuthActions, eAuthType, eAuthType2, eClientDynamicStatus, eClientStatus, eConektaOrderStatus, eConektaRes, eContractStatus, eContractSteps, eDestinationType, eEmailType, eGCActions, eIdentityTypes, eLoginStatus, eNotificationType, eOrderType, ePassportTypes, ePaymentType, eProcessStatus, eProvider, eReferenceStatusRav, eRequestVerb, eRoles, eRolesSelect, eVerificationChannel, eVerificationStatus, eVerificationStep, emailContact, expiredPayment, keyPathId, keyUserID, ravCreditFunctions, snackBarConfigAction, snackBarConfigNoAction, snackBarConfigNoActionLong, timeFormat, timeFormatTable, week };
1528
+ export { FactoryBusiness, FactoryClient, FactoryConekta, FactoryContract, FactoryDynamiCore, FactoryNotification, FactoryPassport, FactoryPayment, IndexedDbService, ROUTE_GLOBAL_REFERENCE2, ROUTE_NOTIFICATIONS, RavcreditLibComponent, RavcreditLibService, UtilGeneral, UtilTime, eContractStatus, ravCreditFunctions };
2401
1529
  //# sourceMappingURL=ravcredit-lib.mjs.map