@tomei/finance 0.3.28 → 0.3.30
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/dist/config.js +197 -1
- package/dist/config.js.map +1 -1
- package/dist/finance-company/finance-company.d.ts +5 -0
- package/dist/finance-company/finance-company.js +60 -18
- package/dist/finance-company/finance-company.js.map +1 -1
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts +2 -1
- package/dist/ledger-transaction/ledger-transaction.d.ts +2 -2
- package/dist/ledger-transaction/ledger-transaction.js +38 -14
- package/dist/ledger-transaction/ledger-transaction.js.map +1 -1
- package/dist/models/payment-method.entity.d.ts +3 -0
- package/dist/models/payment-method.entity.js +18 -1
- package/dist/models/payment-method.entity.js.map +1 -1
- package/dist/payment-method/interfaces/payment-method-attr.interface.d.ts +1 -0
- package/dist/payment-method/payment-method.d.ts +2 -2
- package/dist/payment-method/payment-method.js +16 -6
- package/dist/payment-method/payment-method.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/migrations/finance-payment-method-migration.js +10 -0
- package/package.json +1 -1
- package/src/config.ts +197 -1
- package/src/finance-company/finance-company.ts +1156 -1081
- package/src/ledger-transaction/interfaces/ledger-transaction-attr.interface.ts +3 -1
- package/src/ledger-transaction/ledger-transaction.ts +32 -28
- package/src/models/payment-method.entity.ts +25 -2
- package/src/payment-method/interfaces/payment-method-attr.interface.ts +1 -0
- package/src/payment-method/payment-method.ts +13 -6
|
@@ -4,43 +4,44 @@ import { TransactionTypeOptions } from '../enum/transaction-type.enum';
|
|
|
4
4
|
import { LedgerTransactionRepository } from './ledger-transaction.repository';
|
|
5
5
|
|
|
6
6
|
export default class LedgerTransaction {
|
|
7
|
-
TransactionId
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
TransactionId = 'New';
|
|
8
|
+
TransactionType = TransactionTypeOptions.DEBIT;
|
|
9
|
+
JournalEntryId = '';
|
|
10
|
+
AccountNo = '';
|
|
11
|
+
Date = new Date();
|
|
12
|
+
Name = '';
|
|
13
|
+
Description = '';
|
|
14
|
+
Currency = 'MYR';
|
|
15
|
+
DebitAmount = 0;
|
|
16
|
+
CreditAmount = 0;
|
|
17
|
+
RelatedObjectId = '';
|
|
18
|
+
RelatedObjectType = '';
|
|
18
19
|
|
|
19
|
-
TransactionType: string;
|
|
20
20
|
private _DbTransaction: any;
|
|
21
21
|
|
|
22
22
|
private static _LedgerTransactionRepository =
|
|
23
23
|
new LedgerTransactionRepository();
|
|
24
24
|
|
|
25
25
|
constructor(dbTransaction?: any, transactionId?: string) {
|
|
26
|
-
if(dbTransaction){
|
|
26
|
+
if (dbTransaction) {
|
|
27
27
|
this._DbTransaction = dbTransaction;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
init(params?: ILedgerTransactionAttr) {
|
|
32
|
-
this.TransactionId = params.TransactionId;
|
|
33
|
-
this.TransactionType = params.TransactionType;
|
|
34
|
-
this.JournalEntryId = params.JournalEntryId;
|
|
35
|
-
this.AccountNo = params.AccountNo;
|
|
36
|
-
this.Date = params.Date;
|
|
37
|
-
this.Name = params.Name;
|
|
38
|
-
this.Description = params.Description;
|
|
39
|
-
this.Currency = params.Currency;
|
|
40
|
-
this.DebitAmount = params.DebitAmount;
|
|
41
|
-
this.CreditAmount = params.CreditAmount;
|
|
42
|
-
this.RelatedObjectId = params.RelatedObjectId;
|
|
43
|
-
|
|
32
|
+
if (params.TransactionId) this.TransactionId = params.TransactionId;
|
|
33
|
+
if (params.TransactionType) this.TransactionType = params.TransactionType;
|
|
34
|
+
if (params.JournalEntryId) this.JournalEntryId = params.JournalEntryId;
|
|
35
|
+
if (params.AccountNo) this.AccountNo = params.AccountNo;
|
|
36
|
+
if (params.Date) this.Date = params.Date;
|
|
37
|
+
if (params.Name) this.Name = params.Name;
|
|
38
|
+
if (params.Description) this.Description = params.Description;
|
|
39
|
+
if (params.Currency) this.Currency = params.Currency;
|
|
40
|
+
if (params.DebitAmount) this.DebitAmount = params.DebitAmount;
|
|
41
|
+
if (params.CreditAmount) this.CreditAmount = params.CreditAmount;
|
|
42
|
+
if (params.RelatedObjectId) this.RelatedObjectId = params.RelatedObjectId;
|
|
43
|
+
if (params.RelatedObjectType)
|
|
44
|
+
this.RelatedObjectType = params.RelatedObjectType;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
getData() {
|
|
@@ -61,7 +62,10 @@ export default class LedgerTransaction {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
async create() {
|
|
64
|
-
return await
|
|
65
|
+
return await LedgerTransaction._LedgerTransactionRepository.create(
|
|
66
|
+
this.getData,
|
|
67
|
+
{ transaction: this._DbTransaction },
|
|
68
|
+
);
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
async newLedgerTransaction(
|
|
@@ -85,9 +89,9 @@ export default class LedgerTransaction {
|
|
|
85
89
|
});
|
|
86
90
|
|
|
87
91
|
if (transactionType === TransactionTypeOptions.DEBIT) {
|
|
88
|
-
this.TransactionType =
|
|
92
|
+
this.TransactionType = TransactionTypeOptions.DEBIT;
|
|
89
93
|
} else if (transactionType === TransactionTypeOptions.CREDIT) {
|
|
90
|
-
this.TransactionType =
|
|
94
|
+
this.TransactionType = TransactionTypeOptions.CREDIT;
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
if (journalEntryId) {
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ForeignKey,
|
|
4
|
+
BelongsTo,
|
|
5
|
+
Column,
|
|
6
|
+
DataType,
|
|
7
|
+
HasMany,
|
|
8
|
+
Model,
|
|
9
|
+
Table,
|
|
10
|
+
} from 'sequelize-typescript';
|
|
3
11
|
import PaymentMethodTypeModel from './payment-method-type.entity';
|
|
12
|
+
import FinanceCompanyModel from './finance-company.entity';
|
|
4
13
|
|
|
5
14
|
@Table({
|
|
6
15
|
tableName: 'finance_PaymentMethod',
|
|
@@ -16,13 +25,27 @@ export default class PaymentMethodModel extends Model {
|
|
|
16
25
|
})
|
|
17
26
|
MethodId: string;
|
|
18
27
|
|
|
19
|
-
@ApiProperty({ example: '
|
|
28
|
+
@ApiProperty({ example: 'cash' })
|
|
20
29
|
@Column({
|
|
21
30
|
allowNull: false,
|
|
22
31
|
type: DataType.STRING(100),
|
|
23
32
|
})
|
|
24
33
|
Name: string;
|
|
25
34
|
|
|
35
|
+
@ApiProperty({
|
|
36
|
+
example: 'EZC',
|
|
37
|
+
description: 'CompanyId',
|
|
38
|
+
})
|
|
39
|
+
@ForeignKey(() => FinanceCompanyModel)
|
|
40
|
+
@Column({
|
|
41
|
+
allowNull: false,
|
|
42
|
+
type: DataType.STRING(30),
|
|
43
|
+
})
|
|
44
|
+
CompanyId: string;
|
|
45
|
+
|
|
26
46
|
@HasMany(() => PaymentMethodTypeModel)
|
|
27
47
|
PaymentMethodType: PaymentMethodTypeModel[];
|
|
48
|
+
|
|
49
|
+
@BelongsTo(() => FinanceCompanyModel)
|
|
50
|
+
FinanceCompany: FinanceCompanyModel;
|
|
28
51
|
}
|
|
@@ -5,8 +5,8 @@ import { PaymentMethodTypeRepository } from '../payment-method-type/payment-meth
|
|
|
5
5
|
|
|
6
6
|
export default class PaymentMethod extends ObjectBase {
|
|
7
7
|
MethodId = 'New';
|
|
8
|
-
CompanyId = '';
|
|
9
8
|
Name = '';
|
|
9
|
+
CompanyId = '';
|
|
10
10
|
|
|
11
11
|
private static _RepositoryBase = new PaymentMethodRepository();
|
|
12
12
|
private static _PaymentMethodTypeRepository =
|
|
@@ -87,10 +87,17 @@ export default class PaymentMethod extends ObjectBase {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
async newPaymentMethodType(
|
|
91
|
+
paymentMethodTypePayload,
|
|
92
|
+
): Promise<PaymentMethodType[]> {
|
|
93
|
+
const paymentMethodType = new PaymentMethodType();
|
|
94
|
+
await PaymentMethod._PaymentMethodTypeRepository.create({
|
|
95
|
+
...paymentMethodTypePayload,
|
|
96
|
+
AccountNo: paymentMethodType.AccountNo,
|
|
97
|
+
ProcessingFeeRate: paymentMethodType.ProcessingFeeRate,
|
|
98
|
+
ProcessingFeeAccountNo: paymentMethodType.ProcessingFeeAccountNo,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return await this.PaymentMethodTypes;
|
|
95
102
|
}
|
|
96
103
|
}
|