ravcredit-lib 0.0.19 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/fesm2022/ravcredit-lib.mjs +2127 -0
  2. package/fesm2022/ravcredit-lib.mjs.map +1 -0
  3. package/index.d.ts +1734 -0
  4. package/package.json +25 -14
  5. package/ng-package.json +0 -7
  6. package/src/index.d.ts +0 -45
  7. package/src/lib/ravcredit-lib.component.spec.ts +0 -23
  8. package/src/lib/ravcredit-lib.component.ts +0 -16
  9. package/src/lib/ravcredit-lib.service.spec.ts +0 -16
  10. package/src/lib/ravcredit-lib.service.ts +0 -9
  11. package/src/lib/v1/const/constants.ts +0 -35
  12. package/src/lib/v1/idb/idb.service.spec.ts +0 -16
  13. package/src/lib/v1/idb/indexed-db.service.ts +0 -396
  14. package/src/lib/v1/objects/oAddress.ts +0 -19
  15. package/src/lib/v1/objects/oBusiness.ts +0 -112
  16. package/src/lib/v1/objects/oClient.ts +0 -46
  17. package/src/lib/v1/objects/oConekta.ts +0 -408
  18. package/src/lib/v1/objects/oContract.ts +0 -31
  19. package/src/lib/v1/objects/oContractAll.ts +0 -38
  20. package/src/lib/v1/objects/oCustomer.ts +0 -36
  21. package/src/lib/v1/objects/oDevice.ts +0 -5
  22. package/src/lib/v1/objects/oFinancial.ts +0 -32
  23. package/src/lib/v1/objects/oGlobal.ts +0 -192
  24. package/src/lib/v1/objects/oLogIn.ts +0 -43
  25. package/src/lib/v1/objects/oNewPayment.ts +0 -18
  26. package/src/lib/v1/objects/oNotification.ts +0 -34
  27. package/src/lib/v1/objects/oPassport.ts +0 -65
  28. package/src/lib/v1/objects/oUser.ts +0 -35
  29. package/src/lib/v1/objects/oVerification.ts +0 -100
  30. package/src/lib/v1/util/UtilBusiness.ts +0 -186
  31. package/src/lib/v1/util/UtilClient.ts +0 -295
  32. package/src/lib/v1/util/UtilConekta.ts +0 -97
  33. package/src/lib/v1/util/UtilContract.ts +0 -432
  34. package/src/lib/v1/util/UtilDashboard.ts +0 -19
  35. package/src/lib/v1/util/UtilDynamiCore.ts +0 -752
  36. package/src/lib/v1/util/UtilNotification.ts +0 -46
  37. package/src/lib/v1/util/UtilPassport.ts +0 -32
  38. package/src/lib/v1/util/UtilPayment.ts +0 -22
  39. package/src/lib/v1/util/UtilTime.ts +0 -179
  40. package/src/lib/v1/util/UtilsHttp.ts +0 -25
  41. package/src/lib/v2/const/constants.ts +0 -37
  42. package/src/lib/v2/messaging/messaging.ts +0 -10
  43. package/src/lib/v2/objects/oAsset.ts +0 -48
  44. package/src/lib/v2/objects/oAws.ts +0 -8
  45. package/src/lib/v2/objects/oCatalog.ts +0 -6
  46. package/src/lib/v2/objects/oClient.ts +0 -37
  47. package/src/lib/v2/objects/oCompany.ts +0 -10
  48. package/src/lib/v2/objects/oContract.ts +0 -10
  49. package/src/lib/v2/objects/oMediaDto.ts +0 -10
  50. package/src/lib/v2/objects/oScoreDto.ts +0 -40
  51. package/src/public-api.ts +0 -45
  52. package/tsconfig.lib.json +0 -15
  53. package/tsconfig.lib.prod.json +0 -11
  54. package/tsconfig.spec.json +0 -15
@@ -1,295 +0,0 @@
1
- import {oClient, oUserReference} from '../objects/oClient';
2
- import {cConektaRecurrent, iConektaRecurrent, iConektaSources} from '../objects/oConekta';
3
- import {oContract} from '../objects/oContract';
4
- import {cContract} from './UtilContract';
5
- import {eClientStatus, tyClientContract} from '../objects/oGlobal';
6
- import {IDCAccount, IDCClient} from './UtilDynamiCore';
7
- import {oFinancial} from '../objects/oFinancial';
8
-
9
- export const cClient: oClient = {
10
- id: "",
11
- name: "",
12
- username: "",
13
- email: "",
14
- phone: "",
15
- curp: "",
16
- contract_temporary: "",
17
- conekta_id: "",
18
- userReferences: [],
19
- status: ""
20
- }
21
-
22
- export interface oClientConekta {
23
- ravcredit: oClient;
24
- conekta: iConektaRecurrent;
25
- }
26
-
27
- export const cUserReference: oUserReference = {
28
- name: "",
29
- phone: "",
30
- relationship: ""
31
- }
32
-
33
- export const cClientConekta: oClientConekta = {
34
- conekta: cConektaRecurrent,
35
- ravcredit: cClient
36
- }
37
-
38
- export interface iClientContract {
39
- client: oClient;
40
- contract: oContract;
41
- }
42
-
43
- export const cClientContract: iClientContract = {
44
- client: cClient,
45
- contract: cContract,
46
- }
47
-
48
- export class FactoryClient {
49
-
50
- public static CreateClientToConektaObj(data: oClient) {
51
- const o: any = {}
52
- if (data.name && data.name.length > 0) o.name = data.name;
53
- if (data.username && data.name.length > 0) o.username = data.username;
54
- if (data.email && data.email.length > 0) o.email = data.email;
55
- if (data.phone && data.phone.length > 0) o.phone = String(data.phone);
56
- if (data.curp && data.curp.length > 0) o.curp = data.curp;
57
- if (data.userReferences && data.userReferences.length > 0) o.userReferences = data.userReferences;
58
- if (data.contract) o.contract = data.contract;
59
- if (data.createdAt) o.createdAt = data.createdAt;
60
- if (data.lastLogin) o.lastLogin = data.lastLogin;
61
- if (data.conekta_id) o.conekta_id = data.conekta_id;
62
-
63
- return o
64
- }
65
-
66
- public static CreateClientFromFormObj(data: any, client?: oClient): oClient {
67
- const o: oClient = {
68
- id: "",
69
- name: data["client"][0].name,
70
- username: data["auth"][0].username,
71
- password: data["auth"][0].password,
72
- email: data["client"][0].email,
73
- phone: String(data["client"][0].phone),
74
- curp: data["client"][0].curp,
75
- userReferences: data["client"][0].userReferences,
76
- status: eClientStatus.ACTIVE
77
- }
78
-
79
- if (client != undefined) {
80
- if (client.dynamic_id) o.dynamic_id = client.dynamic_id;
81
- if (client.dynamic_account) o.dynamic_account = client.dynamic_account;
82
- if (client.conekta_id) o.conekta_id = client.conekta_id;
83
- }
84
-
85
- return o
86
- }
87
-
88
- public static CreateClientConektaObj(data: oClient, finalDate: number) {
89
- const sources: iConektaSources = {
90
- type: "oxxo_recurrent",
91
- expires_at: finalDate
92
- }
93
- return {
94
- name: data.name,
95
- email: data.email,
96
- phone: data.phone,
97
- contract: data.contract_temporary,
98
- client_id: data.id,
99
- payment_sources: [sources]
100
- }
101
- }
102
-
103
- public static MapperConektaClient(
104
- client: oClient,
105
- conekta: iConektaRecurrent,
106
- ): iClientContract {
107
- const o: oClient = client
108
-
109
- o.name = conekta.name
110
- o.email = conekta.email
111
- o.phone = conekta.phone
112
- o.conekta_id = conekta.id
113
-
114
- return {
115
- client: o,
116
- contract: cContract
117
- }
118
- }
119
-
120
- public static MapperTypeContCli_Client(_client: tyClientContract): oClient {
121
- const client: oClient = {
122
- id: _client.id,
123
- name: _client.name,
124
- username: _client.username,
125
- email: _client.email,
126
- phone: _client.phone,
127
- curp: _client.curp,
128
- userReferences: _client.userReferences,
129
- status: _client.status,
130
- contract: _client.contract,
131
- reference: _client.reference,
132
- references: _client.references,
133
- conekta_id: _client.conekta_id,
134
- dynamic_account: _client.dynamic_account,
135
- token: _client.token,
136
- contract_temporary: _client.contract_temporary,
137
- lastLogin: _client.lastLogin,
138
- dynamic_id: _client.dynamic_id,
139
- createdAt: _client.createdAt,
140
- payments: _client.payments,
141
- password: _client.password,
142
- contractUrl: _client.contractUrl,
143
- dynamic_ref: _client.dynamic_ref,
144
- exists: _client.exists,
145
- passport_id: _client.passport_id,
146
- }
147
-
148
- return client
149
- }
150
-
151
- public static MapperDynamicClient(
152
- dynamic: IDCClient,
153
- client: oClient,
154
- contract: oContract,
155
- clientDyn?: IDCClient,
156
- account?: IDCAccount,
157
- ): iClientContract {
158
- // const o: tyClientContract = cTyClientContract
159
-
160
- /* Client ------------------------------------------------------ */
161
- client.username = `${dynamic.pii.name} ${dynamic.pii.motherlastname} ${dynamic.pii.lastname}`
162
- client.phone = dynamic.pii.phone as string
163
- client.dynamic_id = dynamic.id
164
- client.curp = dynamic.pii.curp
165
- client.email = dynamic.pii.email
166
-
167
- if (account)
168
- client.dynamic_account = account.id
169
-
170
- /* Auth ---------------------------------------------------------- */
171
-
172
-
173
- /* Device -------------------------------------------------------- */
174
- contract.device.IMEI = clientDyn!.pii.imei
175
- contract.device.device = clientDyn!.pii.model
176
-
177
- /* Contract ------------------------------------------------------ */
178
- contract.by = clientDyn!.pii.seller_name
179
-
180
- if (clientDyn!.pii.fotografia_del_cliente_con_el_equipo != undefined) {
181
- const oPhoto = clientDyn!.pii.fotografia_del_cliente_con_el_equipo!
182
- if (oPhoto != "") {
183
- const _photo = JSON.parse(oPhoto)
184
- if (_photo)
185
- contract.photo = _photo[0].url
186
- }
187
- }
188
-
189
- contract.address.state = dynamic.pii.state
190
- contract.address.city = dynamic.pii.city
191
- contract.address.street = dynamic.pii.street
192
- contract.address.ext = dynamic.pii.num_ext as string
193
- contract.address.zip = dynamic.pii.zipcode as string
194
- contract.address.neighbor = dynamic.pii.colony
195
-
196
- /* Financial ------------------------------------------------------ */
197
- contract.dynamicAccount = Number(account?.id)
198
-
199
- if (account?.config.installments) {
200
- contract.financial.deadlines = {
201
- weeks: account.config.installments,
202
- interest: 0
203
- }
204
- }
205
-
206
- if (account?.properties.expected_disbursed)
207
- contract.financial.total = account?.properties.expected_disbursed
208
-
209
- if (account?.properties.principal_disbursed)
210
- contract.financial.financed = account?.properties.principal_disbursed
211
-
212
- if (account?.properties.amount_commission_opening) {
213
- contract.financial.initial = account?.properties.amount_commission_opening
214
- contract.financial.amount_commission_opening = account?.properties.amount_commission_opening
215
- }
216
-
217
- contract.financial.interest_rate = Number(clientDyn!.pii.interest_rate)
218
- contract.financial.interest_arrears = account?.config.interest_arrears
219
- contract.financial.commission_opening = account?.config.commission_opening
220
- contract.financial.credit_type = account?.config.credit_type
221
-
222
- contract.financial.principal_disbursed = account?.properties.principal_disbursed
223
- contract.financial.expected_disbursed = account?.properties.expected_disbursed
224
-
225
- contract.financial.weeklyPayment = Number(clientDyn!.pii.amount_by_period)
226
-
227
- return {
228
- client: client,
229
- contract: contract,
230
- }
231
- }
232
-
233
- public static MapperFinancialContract(
234
- contract: oContract,
235
- account: IDCAccount,
236
- ): oFinancial {
237
-
238
- contract.dynamicAccount = Number(account.id)
239
-
240
- if (account.config.installments) {
241
- contract.financial.deadlines = {
242
- weeks: account.config.installments,
243
- interest: 0
244
- }
245
- }
246
-
247
- const total =
248
- account.config.financed_amount != undefined ? account.config.financed_amount : 0
249
-
250
- if (total > 0)
251
- contract.financial.total = total
252
-
253
- // if (account.properties.expected_disbursed)
254
- const expected_disbursed =
255
- account.properties.expected_disbursed != undefined ? account.properties.expected_disbursed : 0
256
-
257
- if (expected_disbursed > 0) contract.financial.total = expected_disbursed
258
- contract.financial.expected_disbursed = expected_disbursed
259
-
260
- contract.financial.interest_rate = account.config.interest_rate
261
- contract.financial.interest_arrears = account.config.interest_arrears
262
-
263
- // if (account.properties.principal_disbursed)
264
- if (account.properties.principal_disbursed > 0)
265
- contract.financial.financed = account.properties.principal_disbursed
266
-
267
- contract.financial.principal_disbursed = account.properties.principal_disbursed
268
-
269
- const amount_commission_opening =
270
- account.properties.amount_commission_opening != undefined ? account.properties.amount_commission_opening : 0
271
-
272
- if (amount_commission_opening > 0)
273
- contract.financial.initial = amount_commission_opening
274
-
275
- contract.financial.amount_commission_opening = amount_commission_opening
276
-
277
- contract.financial.interest_arrears = account.config.interest_arrears
278
- contract.financial.commission_opening = account.config.commission_opening
279
- contract.financial.credit_type = account.config.credit_type
280
-
281
- contract.financial.clabe = String(account.properties.clabe!)
282
-
283
- return contract.financial
284
- }
285
- }
286
-
287
- export enum eIdentityTypes {
288
- SELFIE = 'SELFIE',
289
- IDENTITY_FRONT = 'IDENTITY_FRONT',
290
- IDENTITY_BACK = 'IDENTITY_BACK',
291
- PASSPORT_FRONT = 'PASSPORT_FRONT',
292
- PASSPORT_BACK = 'PASSPORT_BACK',
293
- SERVICE='SERVICE',
294
- WITH_DEVICE='WITH_DEVICE',
295
- }
@@ -1,97 +0,0 @@
1
- import {oContract} from '../objects/oContract';
2
- import {oClient} from '../objects/oClient';
3
- import {
4
- oConektaNewOrder, oConektaNewOrderAntifraudInfo,
5
- oConektaNewOrderCharge,
6
- oConektaNewOrderCustomerInfo, oConektaNewOrderLineItem,
7
- oConektaNewOrderPymMethod, oConektaOrderCreate
8
- } from '../objects/oConekta';
9
-
10
- export enum ePaymentType {
11
- OXXO = "OXXO",
12
- ALTERNA = "ALTERNA",
13
- OXXO_RECURRENT = 'oxxo_recurrent'
14
- }
15
-
16
- export class FactoryConekta {
17
- public static createOrder(
18
- client: oClient,
19
- contract: oContract,
20
- dateTime?: number
21
- ): oConektaNewOrder {
22
-
23
- if (client.conekta_id == undefined) return {
24
- data: {
25
- charges: [],
26
- currency: "",
27
- customer_info: {customer_id: ""},
28
- line_items: []
29
- },
30
- id: ""
31
- }
32
-
33
- const customer_info: oConektaNewOrderCustomerInfo = {
34
- customer_id: client.conekta_id
35
- }
36
- const week = ((3600 * 24) * 30) * 1000
37
- let next = new Date().getTime() + week
38
- next = Math.floor(next / 1000)
39
-
40
- const method: oConektaNewOrderPymMethod = {
41
- type: "cash",
42
- expires_at: next,
43
- }
44
- const charge: oConektaNewOrderCharge = {
45
- amount: contract.financial.weeklyPayment * 100,
46
- payment_method: method
47
- }
48
- const charges = [charge]
49
-
50
- const antifraud_info: oConektaNewOrderAntifraudInfo = {
51
- newKey: "Key"
52
- }
53
-
54
- const lineItem: oConektaNewOrderLineItem = {
55
- antifraud_info: antifraud_info,
56
- name: `Referencia credito ${client.name}`,
57
- quantity: 1,
58
- unit_price: contract.financial.weeklyPayment * 100,
59
- }
60
-
61
- const lineItems: oConektaNewOrderLineItem[] = [lineItem]
62
-
63
- const orderData: oConektaOrderCreate = {
64
- customer_info: customer_info,
65
- charges: charges,
66
- currency: "MXN",
67
- line_items: lineItems
68
- }
69
-
70
- const order: oConektaNewOrder = {
71
- data: orderData,
72
- id: client.id
73
- }
74
-
75
- if (dateTime != undefined) order.date = dateTime
76
-
77
- return order
78
- }
79
- }
80
-
81
- // '
82
- // {
83
- // "customer_info": {
84
- // "name": "DevTest",
85
- // "email": "test@femsa.com",
86
- // "phone": "5522997233"
87
- // },
88
- // "currency": "MXN",
89
- // "line_items": [
90
- // {
91
- // "name": "Box of Cohiba S1s",
92
- // "quantity": 1,
93
- // "unit_price": 20000
94
- // }
95
- // ]
96
- // }
97
- // '