@tomei/finance 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/config.ts CHANGED
@@ -1,178 +1,178 @@
1
- const config = {
2
- development: {
3
- environment: 'development',
4
- commonApiUrl: process.env.COMMON_API_URL,
5
- accountingSystem: {
6
- quickbooks: {
7
- packageName: process.env.PACKAGE_NAME,
8
- accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
9
- API_Url: process.env.API_URL,
10
- },
11
- xero: {
12
- packageName: process.env.PACKAGE_NAME,
13
- accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
14
- API_Url: process.env.API_URL,
15
- },
16
- },
17
- systemConfig: {
18
- EZC: {
19
- accountingSystem: 'quickbooks',
20
- companyName: process.env.COMPANY_NAME,
21
- API_Key: process.env.QUICKBOOK_API_KEY,
22
- API_Secret: process.env.QUICKBOOK_API_SECRET,
23
- redirectUrl: process.env.EZCASH_REDIRECT_URL,
24
- },
25
- EZG: {
26
- accountingSystem: 'xero',
27
- companyName: process.env.COMPANY_NAME,
28
- API_Key: process.env.QUICKBOOK_API_KEY,
29
- API_Secret: process.env.QUICKBOOK_API_SECRET,
30
- redirectUrl: process.env.EZGOLD_REDIRECT_URL,
31
- },
32
- },
33
- },
34
- test: {
35
- commonApiUrl: process.env.COMMON_API_URL,
36
- environment: 'test',
37
- accountingSystem: {
38
- quickbooks: {
39
- packageName: process.env.PACKAGE_NAME,
40
- accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
41
- API_Url: process.env.API_URL,
42
- },
43
- xero: {
44
- packageName: process.env.PACKAGE_NAME,
45
- accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
46
- API_Url: process.env.API_URL,
47
- },
48
- },
49
- systemConfig: {
50
- EZC: {
51
- accountingSystem: 'quickbooks',
52
- companyName: process.env.COMPANY_NAME,
53
- API_Key: process.env.QUICKBOOK_API_KEY,
54
- API_Secret: process.env.QUICKBOOK_API_SECRET,
55
- redirectUrl: process.env.EZCASH_REDIRECT_URL,
56
- },
57
- EZG: {
58
- accountingSystem: 'xero',
59
- companyName: process.env.COMPANY_NAME,
60
- API_Key: process.env.QUICKBOOK_API_KEY,
61
- API_Secret: process.env.QUICKBOOK_API_SECRET,
62
- redirectUrl: process.env.EZGOLD_REDIRECT_URL,
63
- },
64
- },
65
- },
66
- staging: {
67
- commonApiUrl: process.env.COMMON_API_URL,
68
- environment: 'staging',
69
- accountingSystem: {
70
- quickbooks: {
71
- packageName: process.env.PACKAGE_NAME,
72
- accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
73
- API_Url: process.env.API_URL,
74
- },
75
- xero: {
76
- packageName: process.env.PACKAGE_NAME,
77
- accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
78
- API_Url: process.env.API_URL,
79
- },
80
- },
81
- systemConfig: {
82
- EZC: {
83
- accountingSystem: 'quickbooks',
84
- companyName: process.env.COMPANY_NAME,
85
- API_Key: process.env.QUICKBOOK_API_KEY,
86
- API_Secret: process.env.QUICKBOOK_API_SECRET,
87
- redirectUrl: process.env.EZCASH_REDIRECT_URL,
88
- },
89
- EZG: {
90
- accountingSystem: 'xero',
91
- companyName: process.env.COMPANY_NAME,
92
- API_Key: process.env.QUICKBOOK_API_KEY,
93
- API_Secret: process.env.QUICKBOOK_API_SECRET,
94
- redirectUrl: process.env.EZGOLD_REDIRECT_URL,
95
- },
96
- },
97
- },
98
- production: {
99
- commonApiUrl: process.env.COMMON_API_URL,
100
- environment: 'production',
101
- accountingSystem: {
102
- quickbooks: {
103
- packageName: process.env.PACKAGE_NAME,
104
- accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
105
- API_Url: process.env.API_URL,
106
- },
107
- xero: {
108
- packageName: process.env.PACKAGE_NAME,
109
- accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
110
- API_Url: process.env.API_URL,
111
- },
112
- },
113
- systemConfig: {
114
- EZC: {
115
- accountingSystem: 'quickbooks',
116
- companyName: process.env.COMPANY_NAME,
117
- API_Key: process.env.QUICKBOOK_API_KEY,
118
- API_Secret: process.env.QUICKBOOK_API_SECRET,
119
- redirectUrl: process.env.EZCASH_REDIRECT_URL,
120
- },
121
- EZG: {
122
- accountingSystem: 'xero',
123
- companyName: process.env.COMPANY_NAME,
124
- API_Key: process.env.QUICKBOOK_API_KEY,
125
- API_Secret: process.env.QUICKBOOK_API_SECRET,
126
- redirectUrl: process.env.EZGOLD_REDIRECT_URL,
127
- },
128
- },
129
- },
130
- };
131
-
132
- type Config = {
133
- commonApiUrl: string;
134
- environment: string;
135
- accountingSystem: {
136
- quickbooks: {
137
- packageName: string;
138
- accountSystemClass: string;
139
- API_Url: string;
140
- };
141
- xero: {
142
- packageName: string;
143
- accountSystemClass: string;
144
- API_Url: string;
145
- };
146
- };
147
- systemConfig: {
148
- EZC: {
149
- accountingSystem: string;
150
- companyName: string;
151
- API_Key: string;
152
- API_Secret: string;
153
- redirectUrl: string;
154
- };
155
- EZG: {
156
- accountingSystem: string;
157
- companyName: string;
158
- API_Key: string;
159
- API_Secret: string;
160
- redirectUrl: string;
161
- };
162
- };
163
- };
164
-
165
- export const getConfig = (): Config => {
166
- switch (process.env.NODE_ENV) {
167
- case 'development':
168
- return config['development'];
169
- case 'test':
170
- return config['test'];
171
- case 'staging':
172
- return config['staging'];
173
- case 'production':
174
- return config['production'];
175
- default:
176
- break;
177
- }
178
- };
1
+ const config = {
2
+ development: {
3
+ environment: 'development',
4
+ commonApiUrl: process.env.COMMON_API_URL,
5
+ accountingSystem: {
6
+ quickbooks: {
7
+ packageName: process.env.PACKAGE_NAME,
8
+ accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
9
+ API_Url: process.env.API_URL,
10
+ },
11
+ xero: {
12
+ packageName: process.env.PACKAGE_NAME,
13
+ accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
14
+ API_Url: process.env.API_URL,
15
+ },
16
+ },
17
+ systemConfig: {
18
+ EZC: {
19
+ accountingSystem: 'quickbooks',
20
+ companyName: process.env.COMPANY_NAME,
21
+ API_Key: process.env.QUICKBOOK_API_KEY,
22
+ API_Secret: process.env.QUICKBOOK_API_SECRET,
23
+ redirectUrl: process.env.EZCASH_REDIRECT_URL,
24
+ },
25
+ EZG: {
26
+ accountingSystem: 'xero',
27
+ companyName: process.env.COMPANY_NAME,
28
+ API_Key: process.env.QUICKBOOK_API_KEY,
29
+ API_Secret: process.env.QUICKBOOK_API_SECRET,
30
+ redirectUrl: process.env.EZGOLD_REDIRECT_URL,
31
+ },
32
+ },
33
+ },
34
+ test: {
35
+ commonApiUrl: process.env.COMMON_API_URL,
36
+ environment: 'test',
37
+ accountingSystem: {
38
+ quickbooks: {
39
+ packageName: process.env.PACKAGE_NAME,
40
+ accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
41
+ API_Url: process.env.API_URL,
42
+ },
43
+ xero: {
44
+ packageName: process.env.PACKAGE_NAME,
45
+ accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
46
+ API_Url: process.env.API_URL,
47
+ },
48
+ },
49
+ systemConfig: {
50
+ EZC: {
51
+ accountingSystem: 'quickbooks',
52
+ companyName: process.env.COMPANY_NAME,
53
+ API_Key: process.env.QUICKBOOK_API_KEY,
54
+ API_Secret: process.env.QUICKBOOK_API_SECRET,
55
+ redirectUrl: process.env.EZCASH_REDIRECT_URL,
56
+ },
57
+ EZG: {
58
+ accountingSystem: 'xero',
59
+ companyName: process.env.COMPANY_NAME,
60
+ API_Key: process.env.QUICKBOOK_API_KEY,
61
+ API_Secret: process.env.QUICKBOOK_API_SECRET,
62
+ redirectUrl: process.env.EZGOLD_REDIRECT_URL,
63
+ },
64
+ },
65
+ },
66
+ staging: {
67
+ commonApiUrl: process.env.COMMON_API_URL,
68
+ environment: 'staging',
69
+ accountingSystem: {
70
+ quickbooks: {
71
+ packageName: process.env.PACKAGE_NAME,
72
+ accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
73
+ API_Url: process.env.API_URL,
74
+ },
75
+ xero: {
76
+ packageName: process.env.PACKAGE_NAME,
77
+ accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
78
+ API_Url: process.env.API_URL,
79
+ },
80
+ },
81
+ systemConfig: {
82
+ EZC: {
83
+ accountingSystem: 'quickbooks',
84
+ companyName: process.env.COMPANY_NAME,
85
+ API_Key: process.env.QUICKBOOK_API_KEY,
86
+ API_Secret: process.env.QUICKBOOK_API_SECRET,
87
+ redirectUrl: process.env.EZCASH_REDIRECT_URL,
88
+ },
89
+ EZG: {
90
+ accountingSystem: 'xero',
91
+ companyName: process.env.COMPANY_NAME,
92
+ API_Key: process.env.QUICKBOOK_API_KEY,
93
+ API_Secret: process.env.QUICKBOOK_API_SECRET,
94
+ redirectUrl: process.env.EZGOLD_REDIRECT_URL,
95
+ },
96
+ },
97
+ },
98
+ production: {
99
+ commonApiUrl: process.env.COMMON_API_URL,
100
+ environment: 'production',
101
+ accountingSystem: {
102
+ quickbooks: {
103
+ packageName: process.env.PACKAGE_NAME,
104
+ accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
105
+ API_Url: process.env.API_URL,
106
+ },
107
+ xero: {
108
+ packageName: process.env.PACKAGE_NAME,
109
+ accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS,
110
+ API_Url: process.env.API_URL,
111
+ },
112
+ },
113
+ systemConfig: {
114
+ EZC: {
115
+ accountingSystem: 'quickbooks',
116
+ companyName: process.env.COMPANY_NAME,
117
+ API_Key: process.env.QUICKBOOK_API_KEY,
118
+ API_Secret: process.env.QUICKBOOK_API_SECRET,
119
+ redirectUrl: process.env.EZCASH_REDIRECT_URL,
120
+ },
121
+ EZG: {
122
+ accountingSystem: 'xero',
123
+ companyName: process.env.COMPANY_NAME,
124
+ API_Key: process.env.QUICKBOOK_API_KEY,
125
+ API_Secret: process.env.QUICKBOOK_API_SECRET,
126
+ redirectUrl: process.env.EZGOLD_REDIRECT_URL,
127
+ },
128
+ },
129
+ },
130
+ };
131
+
132
+ type Config = {
133
+ commonApiUrl: string;
134
+ environment: string;
135
+ accountingSystem: {
136
+ quickbooks: {
137
+ packageName: string;
138
+ accountSystemClass: string;
139
+ API_Url: string;
140
+ };
141
+ xero: {
142
+ packageName: string;
143
+ accountSystemClass: string;
144
+ API_Url: string;
145
+ };
146
+ };
147
+ systemConfig: {
148
+ EZC: {
149
+ accountingSystem: string;
150
+ companyName: string;
151
+ API_Key: string;
152
+ API_Secret: string;
153
+ redirectUrl: string;
154
+ };
155
+ EZG: {
156
+ accountingSystem: string;
157
+ companyName: string;
158
+ API_Key: string;
159
+ API_Secret: string;
160
+ redirectUrl: string;
161
+ };
162
+ };
163
+ };
164
+
165
+ export const getConfig = (): Config => {
166
+ switch (process.env.NODE_ENV) {
167
+ case 'development':
168
+ return config['development'];
169
+ case 'test':
170
+ return config['test'];
171
+ case 'staging':
172
+ return config['staging'];
173
+ case 'production':
174
+ return config['production'];
175
+ default:
176
+ break;
177
+ }
178
+ };
@@ -1,53 +1,53 @@
1
- import { ApiProperty } from '@nestjs/swagger';
2
- import { Column, DataType, Model, Table } from 'sequelize-typescript';
3
-
4
- @Table({ tableName: 'finance_Customer', createdAt: false, updatedAt: false })
5
- export class FinanceCustomerModel extends Model {
6
- @ApiProperty({ type: String, description: 'CustomerId' })
7
- @Column({
8
- primaryKey: true,
9
- allowNull: false,
10
- type: DataType.STRING(30),
11
- })
12
- CustomerId: string;
13
-
14
- @ApiProperty({
15
- type: String,
16
- description: 'System Code eg. "EZC", "CRM"',
17
- })
18
- @Column({
19
- allowNull: false,
20
- type: DataType.STRING(30),
21
- })
22
- SystemCode: string;
23
-
24
- @ApiProperty({
25
- type: String,
26
- description: 'Account System Code eg. "EZC", "CRM"',
27
- })
28
- @Column({
29
- allowNull: false,
30
- type: DataType.STRING(30),
31
- })
32
- AccSystemCode: string;
33
-
34
- @ApiProperty({
35
- type: String,
36
- description: 'Account Customer Id in Api',
37
- })
38
- @Column({
39
- allowNull: false,
40
- type: DataType.STRING(30),
41
- })
42
- AccSystemCustomerId: string;
43
-
44
- @ApiProperty({
45
- type: String,
46
- description: 'Custoemr Ref Id',
47
- })
48
- @Column({
49
- allowNull: false,
50
- type: DataType.STRING(30),
51
- })
52
- CustomerRefId: string;
53
- }
1
+ import { ApiProperty } from '@nestjs/swagger';
2
+ import { Column, DataType, Model, Table } from 'sequelize-typescript';
3
+
4
+ @Table({ tableName: 'finance_Customer', createdAt: false, updatedAt: false })
5
+ export class FinanceCustomerModel extends Model {
6
+ @ApiProperty({ type: String, description: 'CustomerId' })
7
+ @Column({
8
+ primaryKey: true,
9
+ allowNull: false,
10
+ type: DataType.STRING(30),
11
+ })
12
+ CustomerId: string;
13
+
14
+ @ApiProperty({
15
+ type: String,
16
+ description: 'System Code eg. "EZC", "CRM"',
17
+ })
18
+ @Column({
19
+ allowNull: false,
20
+ type: DataType.STRING(30),
21
+ })
22
+ SystemCode: string;
23
+
24
+ @ApiProperty({
25
+ type: String,
26
+ description: 'Account System Code eg. "EZC", "CRM"',
27
+ })
28
+ @Column({
29
+ allowNull: false,
30
+ type: DataType.STRING(30),
31
+ })
32
+ AccSystemCode: string;
33
+
34
+ @ApiProperty({
35
+ type: String,
36
+ description: 'Account Customer Id in Api',
37
+ })
38
+ @Column({
39
+ allowNull: false,
40
+ type: DataType.STRING(30),
41
+ })
42
+ AccSystemCustomerId: string;
43
+
44
+ @ApiProperty({
45
+ type: String,
46
+ description: 'Custoemr Ref Id',
47
+ })
48
+ @Column({
49
+ allowNull: false,
50
+ type: DataType.STRING(30),
51
+ })
52
+ CustomerRefId: string;
53
+ }
@@ -1,20 +1,20 @@
1
- import { InjectModel } from '@nestjs/sequelize';
2
- import { FinanceCustomerModel } from './entities/customer.entity';
3
- import { IFinanceCustomerAttr } from './interfaces/finance-customer-attr.interface';
4
- import { IFinanceCustomerRepository } from './interfaces/finance-customer.repository.interface';
5
-
6
- export class FinanceCustomerRepository
7
- implements IFinanceCustomerRepository<FinanceCustomerModel>
8
- {
9
- constructor(
10
- @InjectModel(FinanceCustomerModel)
11
- private readonly customerModel: typeof FinanceCustomerModel,
12
- ) {}
13
-
14
- create(
15
- data: IFinanceCustomerAttr | any,
16
- options?: any,
17
- ): Promise<FinanceCustomerModel> | any {
18
- return this.customerModel.create(data, options);
19
- }
20
- }
1
+ import { InjectModel } from '@nestjs/sequelize';
2
+ import { FinanceCustomerModel } from './entities/customer.entity';
3
+ import { IFinanceCustomerAttr } from './interfaces/finance-customer-attr.interface';
4
+ import { IFinanceCustomerRepository } from './interfaces/finance-customer.repository.interface';
5
+
6
+ export class FinanceCustomerRepository
7
+ implements IFinanceCustomerRepository<FinanceCustomerModel>
8
+ {
9
+ constructor(
10
+ @InjectModel(FinanceCustomerModel)
11
+ private readonly customerModel: typeof FinanceCustomerModel,
12
+ ) {}
13
+
14
+ create(
15
+ data: IFinanceCustomerAttr | any,
16
+ options?: any,
17
+ ): Promise<FinanceCustomerModel> | any {
18
+ return this.customerModel.create(data, options);
19
+ }
20
+ }
@@ -1,15 +1,15 @@
1
- import { IFinanceCustomerRepository } from './interfaces/finance-customer.repository.interface';
2
- import { IFinanceCustomerAttr } from './interfaces/finance-customer-attr.interface';
3
- import { FinanceCustomerModel } from './entities/customer.entity';
4
- import { ICustomerRepository } from './interfaces/customer.repository.interface';
5
- import { FinanceCustomerRepository } from './finance-customer.repository';
6
- import { Customer } from './customer';
7
-
8
- export {
9
- IFinanceCustomerRepository,
10
- IFinanceCustomerAttr,
11
- FinanceCustomerModel,
12
- ICustomerRepository,
13
- FinanceCustomerRepository,
14
- Customer,
15
- };
1
+ import { IFinanceCustomerRepository } from './interfaces/finance-customer.repository.interface';
2
+ import { IFinanceCustomerAttr } from './interfaces/finance-customer-attr.interface';
3
+ import { FinanceCustomerModel } from './entities/customer.entity';
4
+ import { ICustomerRepository } from './interfaces/customer.repository.interface';
5
+ import { FinanceCustomerRepository } from './finance-customer.repository';
6
+ import { Customer } from './customer';
7
+
8
+ export {
9
+ IFinanceCustomerRepository,
10
+ IFinanceCustomerAttr,
11
+ FinanceCustomerModel,
12
+ ICustomerRepository,
13
+ FinanceCustomerRepository,
14
+ Customer,
15
+ };
@@ -1,3 +1,3 @@
1
- export interface ICustomerRepository<T> {
2
- findOne?(options: any): Promise<T>;
3
- }
1
+ export interface ICustomerRepository<T> {
2
+ findOne?(options: any): Promise<T>;
3
+ }
@@ -1,4 +1,4 @@
1
- export interface IFinanceCustomerAttr {
2
- CustomerId: string;
3
- AccSystemId: string;
4
- }
1
+ export interface IFinanceCustomerAttr {
2
+ CustomerId: string;
3
+ AccSystemId: string;
4
+ }
@@ -1,3 +1,3 @@
1
- export interface IFinanceCustomerRepository<T> {
2
- create?(data: T | any, options?: any): Promise<T> | any;
3
- }
1
+ export interface IFinanceCustomerRepository<T> {
2
+ create?(data: T | any, options?: any): Promise<T> | any;
3
+ }
@@ -0,0 +1,7 @@
1
+ export interface IAccountSystemEntity {
2
+ AccSystemCode: string;
3
+ PostedToAccSystemYN: string;
4
+ AccSystemRefId: string;
5
+ PostedById: string;
6
+ PostedDateTime: Date;
7
+ }
@@ -1,3 +1,3 @@
1
- import { IAccountSystem } from '../interfaces/account-system.interface';
2
-
3
- export { IAccountSystem };
1
+ import { IAccountSystem } from '../interfaces/account-system.interface';
2
+
3
+ export { IAccountSystem };