@tomei/finance 0.3.85 → 0.3.86
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/account/account.js +3 -1
- package/dist/account/account.js.map +1 -1
- package/dist/finance-company/finance-company.js +6 -2
- package/dist/finance-company/finance-company.js.map +1 -1
- package/dist/ledger-transaction/ledger-transaction.js +4 -4
- package/dist/ledger-transaction/ledger-transaction.js.map +1 -1
- package/dist/payment/payment.d.ts +1 -0
- package/dist/payment/payment.js +43 -27
- package/dist/payment/payment.js.map +1 -1
- package/dist/payment-method-type/payment-method-type.d.ts +1 -0
- package/dist/payment-method-type/payment-method-type.js +34 -18
- package/dist/payment-method-type/payment-method-type.js.map +1 -1
- package/dist/payment-paid-with/payment-paid-with.d.ts +2 -1
- package/dist/payment-paid-with/payment-paid-with.js +4 -1
- package/dist/payment-paid-with/payment-paid-with.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/account/account.ts +3 -1
- package/src/finance-company/finance-company.ts +1519 -1510
- package/src/ledger-transaction/ledger-transaction.ts +4 -4
- package/src/payment/payment.ts +39 -47
- package/src/payment-method-type/payment-method-type.ts +32 -21
- package/src/payment-paid-with/payment-paid-with.ts +9 -1
|
@@ -85,10 +85,10 @@ export default class LedgerTransaction {
|
|
|
85
85
|
Currency: this.Currency,
|
|
86
86
|
DebitAmount: this.DebitAmount,
|
|
87
87
|
CreditAmount: this.CreditAmount,
|
|
88
|
-
RelatedObjectId: this.RelatedObjectId,
|
|
89
|
-
RelatedObjectType: this.RelatedObjectType,
|
|
90
|
-
RelatedDocNo: this.RelatedDocNo,
|
|
91
|
-
RelatedPaymentId: this.RelatedPaymentId,
|
|
88
|
+
RelatedObjectId: this.RelatedObjectId || undefined,
|
|
89
|
+
RelatedObjectType: this.RelatedObjectType || undefined,
|
|
90
|
+
RelatedDocNo: this.RelatedDocNo || undefined,
|
|
91
|
+
RelatedPaymentId: this.RelatedPaymentId || undefined,
|
|
92
92
|
},
|
|
93
93
|
{ transaction: dbTransaction },
|
|
94
94
|
);
|
package/src/payment/payment.ts
CHANGED
|
@@ -65,59 +65,47 @@ export default class Payment extends AccountSystemEntity {
|
|
|
65
65
|
this._DbTransaction = dbTransaction;
|
|
66
66
|
}
|
|
67
67
|
if (paymentId) {
|
|
68
|
-
this.
|
|
68
|
+
this.PaymentId = paymentId;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static async initPayment(
|
|
73
|
+
dbTransaction: any,
|
|
74
|
+
paymentId: string,
|
|
75
|
+
): Promise<Payment> {
|
|
76
|
+
try {
|
|
77
|
+
const paymentData = await this._RepositoryBase.findOne({
|
|
69
78
|
where: {
|
|
70
79
|
PaymentId: paymentId,
|
|
71
80
|
},
|
|
72
81
|
transaction: dbTransaction,
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
console.log('Payment Class constructor err: ', err);
|
|
98
|
-
});
|
|
82
|
+
});
|
|
83
|
+
if (paymentData) {
|
|
84
|
+
const payment = new Payment(dbTransaction, paymentId);
|
|
85
|
+
payment.PaymentType = paymentData.PaymentType;
|
|
86
|
+
payment.PaymentDate = paymentData.PaymentDate;
|
|
87
|
+
payment.Description = paymentData.Description;
|
|
88
|
+
payment.Currency = paymentData.Currency;
|
|
89
|
+
payment.Amount = paymentData.Amount;
|
|
90
|
+
payment.Status = paymentData.Status;
|
|
91
|
+
payment.ReceivedBy = paymentData.ReceivedBy;
|
|
92
|
+
payment.UpdatedAt = paymentData.UpdatedAt;
|
|
93
|
+
payment.UpdatedBy = paymentData.UpdatedBy;
|
|
94
|
+
payment.Remarks = paymentData.Remarks;
|
|
95
|
+
payment.AccSystemRefId = paymentData.AccSystemRefId;
|
|
96
|
+
payment.PostedToAccSystemYN = paymentData.PostedToAccSystemYN;
|
|
97
|
+
payment.PostedById = paymentData.PostedById;
|
|
98
|
+
payment.PostedDateTime = paymentData.PostedDateTime;
|
|
99
|
+
return payment;
|
|
100
|
+
} else {
|
|
101
|
+
const notFoundError = new RecordNotFoundError('No Record Found.');
|
|
102
|
+
throw notFoundError;
|
|
103
|
+
}
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.log('Payment Class constructor err: ', error);
|
|
99
106
|
}
|
|
100
107
|
}
|
|
101
108
|
|
|
102
|
-
// public get PaymentItems() {
|
|
103
|
-
// if (this._PaymentItems === null) {
|
|
104
|
-
// this._PaymentItems = new Array<PaymentItemModel>();
|
|
105
|
-
// if (this.PaymentId !== 'New') {
|
|
106
|
-
// this.paymentItemRepository
|
|
107
|
-
// .findAll({
|
|
108
|
-
// where: {
|
|
109
|
-
// PaymentId: this.PaymentId,
|
|
110
|
-
// },
|
|
111
|
-
// })
|
|
112
|
-
// .then((allPaymentItems) => {
|
|
113
|
-
// this._PaymentItems = allPaymentItems;
|
|
114
|
-
// });
|
|
115
|
-
// }
|
|
116
|
-
// }
|
|
117
|
-
|
|
118
|
-
// return this._PaymentItems;
|
|
119
|
-
// }
|
|
120
|
-
|
|
121
109
|
get PaymentItems(): Promise<PaymentItem[]> {
|
|
122
110
|
return new Promise((resolve, reject) => {
|
|
123
111
|
if (this.PaymentId !== 'New') {
|
|
@@ -196,7 +184,11 @@ export default class Payment extends AccountSystemEntity {
|
|
|
196
184
|
}
|
|
197
185
|
|
|
198
186
|
newPaymentPaidWith(paymentMethodTypeId: string) {
|
|
199
|
-
const paymentPaidWith = new PaymentPaidWith(
|
|
187
|
+
const paymentPaidWith = new PaymentPaidWith(
|
|
188
|
+
this,
|
|
189
|
+
paymentMethodTypeId,
|
|
190
|
+
this._DbTransaction,
|
|
191
|
+
);
|
|
200
192
|
this._PaymentPaidWith.push(paymentPaidWith);
|
|
201
193
|
return paymentPaidWith;
|
|
202
194
|
}
|
|
@@ -20,27 +20,38 @@ export default class PaymentMethodType extends ObjectBase {
|
|
|
20
20
|
}
|
|
21
21
|
if (methodTypeId) {
|
|
22
22
|
this.MethodTypeId = methodTypeId;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static async initMethodType(
|
|
27
|
+
dbTransaction: any,
|
|
28
|
+
methodTypeId: string,
|
|
29
|
+
): Promise<PaymentMethodType> {
|
|
30
|
+
try {
|
|
31
|
+
const paymentMethodTypeData = await this._RepositoryBase.findOne({
|
|
32
|
+
where: {
|
|
33
|
+
MethodTypeId: methodTypeId,
|
|
34
|
+
},
|
|
35
|
+
transaction: dbTransaction,
|
|
36
|
+
});
|
|
37
|
+
if (paymentMethodTypeData) {
|
|
38
|
+
const paymentMethodType = new PaymentMethodType(
|
|
39
|
+
dbTransaction,
|
|
40
|
+
methodTypeId,
|
|
41
|
+
);
|
|
42
|
+
paymentMethodType.Name = paymentMethodTypeData.Name;
|
|
43
|
+
paymentMethodType.AccountNo = paymentMethodTypeData.AccountNo;
|
|
44
|
+
paymentMethodType.ProcessingFeeRate =
|
|
45
|
+
paymentMethodTypeData.ProcessingFeeRate;
|
|
46
|
+
paymentMethodType.ProcessingFeeAccountNo =
|
|
47
|
+
paymentMethodTypeData.ProcessingFeeAccountNo;
|
|
48
|
+
return paymentMethodType;
|
|
49
|
+
} else {
|
|
50
|
+
const notFoundError = new RecordNotFoundError('No Record Found.');
|
|
51
|
+
throw notFoundError;
|
|
52
|
+
}
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.log('Payment method type constructor err: ', error);
|
|
44
55
|
}
|
|
45
56
|
}
|
|
46
57
|
|
|
@@ -22,6 +22,7 @@ export default class PaymentPaidWith extends ObjectBase {
|
|
|
22
22
|
PaymentMediaId = '';
|
|
23
23
|
|
|
24
24
|
private static _RepositoryBase = new PaymentPaidWithRepository();
|
|
25
|
+
private _DbTransaction: any;
|
|
25
26
|
|
|
26
27
|
public get PaymentId() {
|
|
27
28
|
return this._PaymentId;
|
|
@@ -52,9 +53,16 @@ export default class PaymentPaidWith extends ObjectBase {
|
|
|
52
53
|
return 'finance_PaymentPaidWith';
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
constructor(
|
|
56
|
+
constructor(
|
|
57
|
+
payment: Payment,
|
|
58
|
+
paymentMethodTypeId: string,
|
|
59
|
+
dbTransaction?: any,
|
|
60
|
+
) {
|
|
56
61
|
super();
|
|
57
62
|
this.PaymentId = payment.PaymentId;
|
|
58
63
|
this.MethodTypeId = paymentMethodTypeId;
|
|
64
|
+
if (dbTransaction) {
|
|
65
|
+
this._DbTransaction = dbTransaction;
|
|
66
|
+
}
|
|
59
67
|
}
|
|
60
68
|
}
|