ravcredit-lib 0.0.11 → 0.0.13

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 (61) hide show
  1. package/fesm2022/ravcredit-lib.mjs +2088 -0
  2. package/fesm2022/ravcredit-lib.mjs.map +1 -0
  3. package/index.d.ts +1654 -0
  4. package/package.json +25 -13
  5. package/ng-package.json +0 -7
  6. package/src/lib/ravcredit-lib.component.spec.ts +0 -23
  7. package/src/lib/ravcredit-lib.component.ts +0 -16
  8. package/src/lib/ravcredit-lib.service.spec.ts +0 -16
  9. package/src/lib/ravcredit-lib.service.ts +0 -9
  10. package/src/lib/v1/const/constants.ts +0 -35
  11. package/src/lib/v1/dto/AddressDto.ts +0 -27
  12. package/src/lib/v1/dto/BusinessDeadlineDto.ts +0 -9
  13. package/src/lib/v1/dto/ConektaDto.ts +0 -386
  14. package/src/lib/v1/dto/ContractDto.ts +0 -46
  15. package/src/lib/v1/dto/CustomerDto.ts +0 -47
  16. package/src/lib/v1/dto/DeviceDto.ts +0 -13
  17. package/src/lib/v1/dto/DynamiCoreDto.ts +0 -1017
  18. package/src/lib/v1/dto/FinancialDto.ts +0 -156
  19. package/src/lib/v1/dto/PassportDto.ts +0 -143
  20. package/src/lib/v1/dto/PayLinkResDto.ts +0 -144
  21. package/src/lib/v1/dto/PayOrderResAlternaDto.ts +0 -348
  22. package/src/lib/v1/dto/PayOrderResOxxoDto.ts +0 -254
  23. package/src/lib/v1/dto/PaymentLinkDto.ts +0 -161
  24. package/src/lib/v1/dto/ScheduleDto.ts +0 -17
  25. package/src/lib/v1/dto/UserDto.ts +0 -27
  26. package/src/lib/v1/dto/WeekScheduleDTO.ts +0 -46
  27. package/src/lib/v1/idb/idb.service.spec.ts +0 -16
  28. package/src/lib/v1/idb/indexed-db.service.ts +0 -396
  29. package/src/lib/v1/objects/oAddress.ts +0 -19
  30. package/src/lib/v1/objects/oBusiness.ts +0 -112
  31. package/src/lib/v1/objects/oClient.ts +0 -46
  32. package/src/lib/v1/objects/oConekta.ts +0 -408
  33. package/src/lib/v1/objects/oContract.ts +0 -30
  34. package/src/lib/v1/objects/oContractAll.ts +0 -38
  35. package/src/lib/v1/objects/oCustomer.ts +0 -36
  36. package/src/lib/v1/objects/oDevice.ts +0 -5
  37. package/src/lib/v1/objects/oFinancial.ts +0 -32
  38. package/src/lib/v1/objects/oGlobal.ts +0 -186
  39. package/src/lib/v1/objects/oLogIn.ts +0 -43
  40. package/src/lib/v1/objects/oNewPayment.ts +0 -18
  41. package/src/lib/v1/objects/oNotification.ts +0 -34
  42. package/src/lib/v1/objects/oPassport.ts +0 -65
  43. package/src/lib/v1/objects/oUser.ts +0 -35
  44. package/src/lib/v1/objects/oVerification.ts +0 -48
  45. package/src/lib/v1/util/UtilBusiness.ts +0 -186
  46. package/src/lib/v1/util/UtilClient.ts +0 -285
  47. package/src/lib/v1/util/UtilConekta.ts +0 -97
  48. package/src/lib/v1/util/UtilContract.ts +0 -386
  49. package/src/lib/v1/util/UtilDashboard.ts +0 -19
  50. package/src/lib/v1/util/UtilDynamiCore.ts +0 -752
  51. package/src/lib/v1/util/UtilNotification.ts +0 -46
  52. package/src/lib/v1/util/UtilPassport.ts +0 -32
  53. package/src/lib/v1/util/UtilPayment.ts +0 -22
  54. package/src/lib/v1/util/UtilTime.ts +0 -181
  55. package/src/lib/v1/util/UtilsHttp.ts +0 -11
  56. package/src/lib/v2/const/constants.ts +0 -38
  57. package/src/lib/v2/messaging/messaging.ts +0 -10
  58. package/src/public-api.ts +0 -37
  59. package/tsconfig.lib.json +0 -15
  60. package/tsconfig.lib.prod.json +0 -11
  61. package/tsconfig.spec.json +0 -15
@@ -1,46 +0,0 @@
1
- import {cNotification, oNotification} from '../objects/oNotification';
2
- import {UntypedFormControl, Validators} from '@angular/forms';
3
-
4
- export const ROUTE_NOTIFICATIONS = "notifications"
5
- export const ROUTE_GLOBAL_REFERENCE2 = "/contract-reference"
6
-
7
- const prodFunction = "https://us-central1-ravcredit-2b079.cloudfunctions.net/CustomerNotification"
8
- const prodFunction2 = "https://customernotification-2imgfxveka-uc.a.run.app"
9
- const localTest = "http://127.0.0.1:5001/ravcredit-2b079/us-central1/CustomerNotification"
10
- export const ravCreditFunctions = prodFunction
11
-
12
- export class FactoryNotification {
13
-
14
- public static FormNotification(notification?: oNotification) {
15
- let data = cNotification
16
-
17
- if (notification) data = notification
18
-
19
- return {
20
- title: new UntypedFormControl(data.notification.title, [Validators.required, Validators.min(1)]),
21
- body: new UntypedFormControl(data.notification.body, [Validators.required, Validators.min(1)]),
22
- }
23
- }
24
-
25
- public static CreateGlobalNotificationObj(data: oNotification) {
26
- const o: any = {}
27
-
28
- if (data.notification) {
29
- const not: any = {}
30
- if (data.notification.body) not["body"] = data.notification.body
31
- if (data.notification.title) not["title"] = data.notification.title
32
-
33
- if (data.ids) not["ids"] = data.ids
34
-
35
- if (data.tokens) not["tokens"] = data.tokens
36
-
37
- if (data.type) not["type"] = data.type
38
-
39
- if (data.data) if (data.data.route) not["route"] = data.data.route
40
-
41
- o["data"] = not
42
- }
43
- return o
44
- }
45
-
46
- }
@@ -1,32 +0,0 @@
1
- import {oContract} from '../objects/oContract';
2
- import {oClient} from '../objects/oClient';
3
- import {ePassportTypes, iGlobalPassport} from '../objects/oPassport';
4
-
5
- export class FactoryPassport {
6
- public static CreatePassportReference(
7
- client: oClient,
8
- contract: oContract,
9
- dateTime?: number
10
- ): iGlobalPassport {
11
- const o = {
12
- passport: {
13
- type: ePassportTypes.CREATE,
14
- data: {
15
- name: client.name,
16
- email: client.email,
17
- amount: contract.financial.weeklyPayment,
18
- expirationDate: "",
19
- additional: {
20
- client: client.name,
21
- clientID: client.id,
22
- credit: client.status
23
- }
24
- }
25
- },
26
- contract: contract,
27
- date: dateTime
28
- }
29
- if (dateTime != undefined) o.date = dateTime
30
- return o
31
- }
32
- }
@@ -1,22 +0,0 @@
1
- import {oConektaRes} from '../objects/oConekta';
2
- import {IDCTxnRow} from './UtilDynamiCore';
3
- import {eProvider} from './UtilContract';
4
-
5
- export interface oPaymentGlobal {
6
- conektaPayment?: oConektaRes,
7
- dynamicPayment?: IDCTxnRow[],
8
- }
9
-
10
- export class FactoryPayment {
11
- public static CreatePayment(data: oConektaRes | IDCTxnRow[], provider: eProvider): oPaymentGlobal {
12
- const o: oPaymentGlobal = {}
13
-
14
- if (provider == eProvider.DynamiCore)
15
- o.dynamicPayment = data as IDCTxnRow[];
16
-
17
- if (provider == eProvider.Conekta)
18
- o.conektaPayment = data as oConektaRes
19
-
20
- return o
21
- }
22
- }
@@ -1,181 +0,0 @@
1
- import {add, format, getDate} from "date-fns";
2
- import {es} from 'date-fns/locale/es';
3
- import {eProvider} from './UtilContract';
4
- import {inject, Injector, runInInjectionContext} from '@angular/core';
5
- import {IDCTxnRow} from './UtilDynamiCore';
6
- import {oPaymentDates} from '../objects/oGlobal';
7
- import {oConektaOrder} from '../objects/oConekta';
8
- import {dateCompleteFormat, dateFormat, expiredPayment, timeFormat} from '../const/constants';
9
- import {IndexedDbService} from '../idb/indexed-db.service';
10
-
11
- export class UtilTime {
12
- private localeFns = es
13
-
14
- public static IsExpired(time: number): boolean {
15
- const dateInit = new Date(time)
16
- const dayInit = dateInit.getDate()
17
- const monthInit = dateInit.getMonth() + 1
18
-
19
- const dateActual = new Date()
20
- const dayActual = dateActual.getDate()
21
- const monthActual = dateActual.getMonth() + 1
22
-
23
- if (monthActual > monthInit) return true
24
-
25
- return dayActual > dayInit;
26
- }
27
-
28
- public static getDates(initial: number, weeks: number): oPaymentDates[] {
29
- const dates: oPaymentDates[] = []
30
- let prev = initial
31
- for (let i = 0; i < weeks; i++) {
32
- const date = add(prev, {weeks: 1})
33
- dates.push(
34
- {
35
- week: i + 1,
36
- date: date.getTime()
37
- }
38
- )
39
- prev = date.getTime()
40
- }
41
- return dates
42
- }
43
-
44
- public static getPreviousWeek() {
45
- const today = new Date().getTime()
46
- const week = ((3600 * 24) * 7) * 1000
47
- return today - week
48
- }
49
-
50
- public static getDayNum(date: Date | number): number {
51
- return getDate(date)
52
- }
53
-
54
- public static getDayName(date: Date | number): string {
55
- return format(date, "EEEE", {locale: es})
56
- }
57
-
58
- public static getMonthName(date: Date | number): string {
59
- return format(date, "MMMM", {locale: es}).toUpperCase();
60
- }
61
-
62
- public static getYear(date: Date | number): string {
63
- return format(date, "yyyy")
64
- }
65
-
66
- public static GetNextPayment(time: number, provider: string) {
67
- let week = 0
68
- if (provider == eProvider.Conekta) {
69
- week = (((3600 * 24) * 7))
70
- } else if (provider == eProvider.DynamiCore) {
71
- week = (((3600 * 24) * 7) * 1000)
72
- }
73
- return this.getLocalTimeFromLong(time + week, provider)
74
- }
75
-
76
- public static getLocalTimeFromLong(time: number, provider: string) {
77
- if (time <= 0) return ""
78
- let factor = this.GetFactor(provider)
79
- let dateTime = time * factor
80
- let parsedDate = format(new Date(dateTime), dateFormat, {
81
- locale: es
82
- })
83
- return parsedDate
84
- }
85
-
86
- public static DelayPaymentLast(
87
- lastPayment: number, provider: string, injector: Injector
88
- ): boolean {
89
- let factor = this.GetFactor(provider)
90
- let now = new Date().getTime()
91
- let last = 0
92
-
93
- if (provider == eProvider.Conekta)
94
- last = ((((3600 * 24) * 7)) + lastPayment) * factor
95
- else if (provider == eProvider.DynamiCore)
96
- last = ((((3600 * 24) * 7) * 1000) + lastPayment) * factor
97
-
98
- runInInjectionContext(injector, () => {
99
- const idb = inject(IndexedDbService)
100
- // const observable = inject(ObservablesService)
101
- idb.setLocalStorage(expiredPayment, String(now > last))
102
- // observable.isLate.next(now > last)
103
- })
104
- // 1751091565767
105
- // 1751557440
106
- return now > last
107
- }
108
-
109
- public static GetFactor(provider: string) {
110
- let factor = 1
111
- if (provider == eProvider.Conekta)
112
- factor = 1000
113
- return factor
114
- }
115
-
116
- public static GetEpochFromFormatedDate(date: string): number {
117
- if (date == "") return 0
118
-
119
- const _date = new Date(date)
120
- if (isNaN(_date.getTime())) return 0
121
- return _date.getTime()
122
- }
123
-
124
- public static GetTimeFromString(date: string) {
125
- return format(new Date(date), timeFormat, {
126
- locale: es
127
- })
128
- }
129
-
130
- public static GetDateFromString(date: string) {
131
- return format(new Date(date), dateCompleteFormat, {
132
- locale: es
133
- })
134
- }
135
-
136
- // Quick sort
137
- public static SortingByTime(payments: IDCTxnRow[]): IDCTxnRow[] {
138
- if (payments.length <= 1) return payments
139
-
140
- const pivot = payments[payments.length - 1]
141
- const pivotDate = new Date(pivot.created).getTime()
142
- const left: IDCTxnRow[] = []
143
- const right: IDCTxnRow[] = []
144
-
145
- for (let i = 0; i < payments.length - 1; i++) {
146
- const actualDate = new Date(payments[i].created).getTime()
147
- if (actualDate > pivotDate) left.push(payments[i])
148
- else right.push(payments[i])
149
- }
150
-
151
- return [...this.SortingByTime(left), pivot, ...this.SortingByTime(right)]
152
- }
153
-
154
- public static SortingByTimeConekta(payments: oConektaOrder []): oConektaOrder[] {
155
- if (payments.length <= 1) return payments;
156
-
157
- const pivot = payments[payments.length - 1]
158
- let pivotDate = 0;
159
- if (pivot.charges.data == undefined) return payments
160
-
161
- if (pivot.charges.data[0].paid_at != undefined) {
162
- pivotDate = pivot.charges.data[0].paid_at
163
- } else {
164
- pivot.charges.data[0].created_at
165
- }
166
-
167
- if (pivotDate <= 0) return payments;
168
-
169
- const left: oConektaOrder[] = []
170
- const right: oConektaOrder [] = []
171
-
172
- for (let i = 0; i < payments.length - 1; i++) {
173
- const actual = payments[i].charges.data[0].paid_at;
174
- if (actual <= 0) continue
175
- if (actual > pivotDate) left.push(payments[i])
176
- else right.push(payments[i])
177
- }
178
-
179
- return [...this.SortingByTimeConekta(left), pivot, ...this.SortingByTimeConekta(right)]
180
- }
181
- }
@@ -1,11 +0,0 @@
1
- export class UtilsHttp {
2
-
3
- public static CreateHeadersApi(token: string) {
4
- return {
5
- 'Content-Type': 'application/json',
6
- 'Accept': 'application/json',
7
- 'Access-Control-Allow-Headers': 'Content-Type',
8
- 'Authorization': `Bearer ${token}`
9
- }
10
- }
11
- }
@@ -1,38 +0,0 @@
1
- export const keyUserID: string = "rc_uid"
2
- export const dbVersion: number = 1
3
- export const dbName: string = "RavCreditDB"
4
- export const keyPathId: string = "id"
5
-
6
- export const dbAuthStore: string = "authStore"
7
- export const dbUsersStore: string = "usersStore"
8
- export const dbContractsStore: string = "contractsStore"
9
- export const dbClientsStore: string = "clientsStore"
10
- export const dbBusinessInfo: string = "businessInfo"
11
- export const dbBusinessConfig: string = "businessConfig"
12
- export const dbConektaClientsStore: string = "conektaClientsStore"
13
- export const dbConektaReferencesStore: string = "conektaReferencesStore"
14
- export const dbPassportReferencesStore: string = "passportReferencesStore"
15
- export const dbDynamicReferencesStore: string = "dynamicReferencesStore"
16
- export const dbDynamicAccountStore: string = "dynamicAccountStore"
17
- export const dbNotificationsStore: string = "notificationsStore"
18
- export const dbPaymentsStore: string = "paymentsStore"
19
-
20
- export const dbIndexAuth: string = "iAuth"
21
- export const dbIndexUsers: string = "iUsers"
22
- export const dbIndexContracts: string = "iContracts"
23
- export const dbIndexClients: string = "iClients"
24
- export const dbIndexBusiness: string = "iBusiness"
25
- export const dbIndexConektaClients: string = "iConecktaClients"
26
- export const dbIndexConektaClientsRef: string = "iConecktaClientsRef"
27
- export const dbIndexPassportClientsRef: string = "iPassportClientsRef"
28
- export const dbIndexNotification: string = "iNotification"
29
- export const dbIndexPayments: string = "iNotification"
30
-
31
- export const dateFormat = "EEEE, dd MMM yyyy"
32
- export const dateCompleteFormat = "EEEE, dd MMM yyyy hh:mm aaaa"
33
- export const timeFormat = "hh:mm aaaa"
34
-
35
- export const expiredPayment = "expiredPayment"
36
-
37
- export const messagingTopic = "AdminTopic"
38
-
@@ -1,10 +0,0 @@
1
- export interface oMessagingData {
2
- id: string,
3
- curp: string,
4
- type: string
5
- }
6
-
7
- export interface oMessaging {
8
- data: oMessagingData,
9
- topic: string
10
- }
package/src/public-api.ts DELETED
@@ -1,37 +0,0 @@
1
- /*
2
- * Public API Surface of ravcredit-lib
3
- */
4
-
5
- export * from './lib/ravcredit-lib.service';
6
- export * from './lib/ravcredit-lib.component';
7
- export * from './lib/v1/objects/oAddress';
8
- export * from './lib/v1/objects/oBusiness';
9
- export * from './lib/v1/objects/oClient';
10
- export * from './lib/v1/objects/oConekta';
11
- export * from './lib/v1/objects/oContract';
12
- export * from './lib/v1/objects/oContractAll';
13
- export * from './lib/v1/objects/oCustomer';
14
- export * from './lib/v1/objects/oDevice';
15
- export * from './lib/v1/objects/oFinancial';
16
- export * from './lib/v1/objects/oGlobal';
17
- export * from './lib/v1/objects/oLogIn';
18
- export * from './lib/v1/objects/oNewPayment';
19
- export * from './lib/v1/objects/oNotification';
20
- export * from './lib/v1/objects/oPassport';
21
- export * from './lib/v1/objects/oUser';
22
- export * from './lib/v1/objects/oVerification';
23
-
24
- export * from './lib/v1/util/UtilClient';
25
- export * from './lib/v1/util/UtilsHttp'
26
- export * from './lib/v1/util/UtilBusiness';
27
- export * from './lib/v1/util/UtilDynamiCore';
28
- export * from './lib/v1/util/UtilContract';
29
- export * from './lib/v1/util/UtilConekta';
30
- export * from './lib/v1/util/UtilNotification';
31
- export * from './lib/v1/util/UtilTime';
32
- export * from './lib/v1/util/UtilDashboard';
33
- export * from './lib/v1/util/UtilPassport';
34
- export * from './lib/v1/util/UtilPayment';
35
-
36
- export * from './lib/v1/idb/indexed-db.service';
37
- export * from './lib/v1/const/constants';
package/tsconfig.lib.json DELETED
@@ -1,15 +0,0 @@
1
- /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
- /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
- {
4
- "extends": "../../tsconfig.json",
5
- "compilerOptions": {
6
- "outDir": "../../out-tsc/lib",
7
- "declaration": true,
8
- "declarationMap": true,
9
- "inlineSources": true,
10
- "types": []
11
- },
12
- "exclude": [
13
- "**/*.spec.ts"
14
- ]
15
- }
@@ -1,11 +0,0 @@
1
- /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
- /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
- {
4
- "extends": "./tsconfig.lib.json",
5
- "compilerOptions": {
6
- "declarationMap": false
7
- },
8
- "angularCompilerOptions": {
9
- "compilationMode": "partial"
10
- }
11
- }
@@ -1,15 +0,0 @@
1
- /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
- /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
- {
4
- "extends": "../../tsconfig.json",
5
- "compilerOptions": {
6
- "outDir": "../../out-tsc/spec",
7
- "types": [
8
- "jasmine"
9
- ]
10
- },
11
- "include": [
12
- "**/*.spec.ts",
13
- "**/*.d.ts"
14
- ]
15
- }