@tomei/finance 0.4.25 → 0.5.0
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.d.ts +35 -35
- package/dist/account/account.js +231 -231
- package/dist/account/account.repository.d.ts +5 -5
- package/dist/account/account.repository.js +11 -11
- package/dist/account/interfaces/account-attr.interface.d.ts +29 -29
- package/dist/account/interfaces/account-attr.interface.js +2 -2
- package/dist/account/interfaces/account.repository.interface.d.ts +3 -0
- package/dist/account/interfaces/account.repository.interface.js +3 -0
- package/dist/account/interfaces/account.repository.interface.js.map +1 -0
- package/dist/account-system-entity/account-system-entity.d.ts +11 -11
- package/dist/account-system-entity/account-system-entity.js +66 -66
- package/dist/account-system-entity/post-history.repository.d.ts +5 -5
- package/dist/account-system-entity/post-history.repository.js +11 -11
- package/dist/config.d.ts +1888 -1888
- package/dist/config.js +331 -331
- package/dist/customer/customer.d.ts +41 -41
- package/dist/customer/customer.js +214 -214
- package/dist/customer/finance-customer.repository.d.ts +5 -5
- package/dist/customer/finance-customer.repository.js +25 -25
- package/dist/customer/interfaces/customer.repository.interface.d.ts +3 -3
- package/dist/customer/interfaces/customer.repository.interface.js +2 -2
- package/dist/customer/interfaces/finance-customer-attr.interface.d.ts +10 -10
- package/dist/customer/interfaces/finance-customer-attr.interface.js +2 -2
- package/dist/customer/interfaces/finance-customer.repository.interface.d.ts +3 -3
- package/dist/customer/interfaces/finance-customer.repository.interface.js +2 -2
- package/dist/database.d.ts +4 -4
- package/dist/database.js +14 -14
- package/dist/document/document-item.d.ts +38 -38
- package/dist/document/document-item.js +83 -83
- package/dist/document/document-item.repository.d.ts +5 -5
- package/dist/document/document-item.repository.js +11 -11
- package/dist/document/document.d.ts +76 -76
- package/dist/document/document.js +566 -566
- package/dist/document/document.repository.d.ts +5 -5
- package/dist/document/document.repository.js +11 -11
- package/dist/document/interfaces/document-attr.interface.d.ts +27 -27
- package/dist/document/interfaces/document-attr.interface.js +6 -6
- package/dist/document/interfaces/document-item-attr.interface.d.ts +22 -22
- package/dist/document/interfaces/document-item-attr.interface.js +6 -6
- package/dist/document/interfaces/document-item.repository.interface.d.ts +3 -3
- package/dist/document/interfaces/document-item.repository.interface.js +2 -2
- package/dist/document/interfaces/document.repository.interface.d.ts +3 -0
- package/dist/document/interfaces/document.repository.interface.js +3 -0
- package/dist/document/interfaces/document.repository.interface.js.map +1 -0
- package/dist/enum/doc-type.enum.d.ts +8 -8
- package/dist/enum/doc-type.enum.js +12 -12
- package/dist/enum/document-status.enum.d.ts +6 -6
- package/dist/enum/document-status.enum.js +10 -10
- package/dist/enum/index.d.ts +8 -8
- package/dist/enum/index.js +17 -17
- package/dist/enum/payment-method.enum.d.ts +3 -3
- package/dist/enum/payment-method.enum.js +7 -7
- package/dist/enum/payment-status.enum.d.ts +4 -4
- package/dist/enum/payment-status.enum.js +8 -8
- package/dist/enum/payment-type.enum.d.ts +4 -4
- package/dist/enum/payment-type.enum.js +8 -8
- package/dist/enum/quick-book-client-scopes.enum.d.ts +13 -13
- package/dist/enum/quick-book-client-scopes.enum.js +18 -18
- package/dist/enum/transaction-type.enum.d.ts +4 -4
- package/dist/enum/transaction-type.enum.js +8 -8
- package/dist/finance-company/finance-company.d.ts +57 -57
- package/dist/finance-company/finance-company.js +1192 -1192
- package/dist/finance-company/finance-company.repository.d.ts +5 -5
- package/dist/finance-company/finance-company.repository.js +11 -11
- package/dist/helpers/typeof.d.ts +1 -1
- package/dist/helpers/typeof.js +26 -26
- package/dist/index.d.ts +17 -16
- package/dist/index.js +32 -30
- package/dist/index.js.map +1 -1
- package/dist/interfaces/account-system.interface.d.ts +13 -13
- package/dist/interfaces/account-system.interface.js +2 -2
- package/dist/interfaces/index.d.ts +2 -2
- package/dist/interfaces/index.js +2 -2
- package/dist/journal-entry/interfaces/journal-entry-attr.interface.d.ts +11 -11
- package/dist/journal-entry/interfaces/journal-entry-attr.interface.js +2 -2
- package/dist/journal-entry/interfaces/journal-entry.repository.interface.d.ts +10 -0
- package/dist/journal-entry/interfaces/journal-entry.repository.interface.js +3 -0
- package/dist/journal-entry/interfaces/journal-entry.repository.interface.js.map +1 -0
- package/dist/journal-entry/journal-entry.d.ts +39 -39
- package/dist/journal-entry/journal-entry.js +215 -215
- package/dist/journal-entry/journal-entry.repository.d.ts +5 -5
- package/dist/journal-entry/journal-entry.repository.js +11 -11
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts +17 -17
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.js +2 -2
- package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.d.ts +5 -5
- package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.js +2 -2
- package/dist/ledger-transaction/ledger-transaction.d.ts +48 -48
- package/dist/ledger-transaction/ledger-transaction.js +155 -155
- package/dist/ledger-transaction/ledger-transaction.repository.d.ts +5 -5
- package/dist/ledger-transaction/ledger-transaction.repository.js +11 -11
- package/dist/models/account.entity.d.ts +30 -30
- package/dist/models/account.entity.js +232 -232
- package/dist/models/customer.entity.d.ts +13 -13
- package/dist/models/customer.entity.js +109 -109
- package/dist/models/document-item.entity.d.ts +27 -27
- package/dist/models/document-item.entity.js +172 -172
- package/dist/models/document.entity.d.ts +36 -36
- package/dist/models/document.entity.js +242 -242
- package/dist/models/finance-company.entity.d.ts +9 -9
- package/dist/models/finance-company.entity.js +44 -44
- package/dist/models/journal-entry.entity.d.ts +16 -16
- package/dist/models/journal-entry.entity.js +127 -127
- package/dist/models/ledger-transaction.entity.d.ts +24 -24
- package/dist/models/ledger-transaction.entity.js +172 -172
- package/dist/models/payment-item.entity.d.ts +12 -12
- package/dist/models/payment-item.entity.js +75 -75
- package/dist/models/payment-method-type.entity.d.ts +13 -13
- package/dist/models/payment-method-type.entity.js +85 -85
- package/dist/models/payment-method.entity.d.ts +10 -10
- package/dist/models/payment-method.entity.js +62 -62
- package/dist/models/payment-paid-with.entity.d.ts +24 -24
- package/dist/models/payment-paid-with.entity.js +158 -158
- package/dist/models/payment.entity.d.ts +27 -27
- package/dist/models/payment.entity.js +188 -188
- package/dist/models/post-history.entity.d.ts +11 -11
- package/dist/models/post-history.entity.js +63 -63
- package/dist/payment/interfaces/payment-attr.interface.d.ts +22 -22
- package/dist/payment/interfaces/payment-attr.interface.js +6 -6
- package/dist/payment/interfaces/payment-item-attr.interface.d.ts +7 -0
- package/dist/payment/interfaces/payment-item-attr.interface.js +7 -0
- package/dist/payment/interfaces/payment-item-attr.interface.js.map +1 -0
- package/dist/payment/interfaces/payment-item.repository.interface.d.ts +3 -0
- package/dist/payment/interfaces/payment-item.repository.interface.js +3 -0
- package/dist/payment/interfaces/payment-item.repository.interface.js.map +1 -0
- package/dist/payment/interfaces/payment-params.interface.d.ts +7 -7
- package/dist/payment/interfaces/payment-params.interface.js +2 -2
- package/dist/payment/interfaces/payment.repository.interface.d.ts +3 -0
- package/dist/payment/interfaces/payment.repository.interface.js +3 -0
- package/dist/payment/interfaces/payment.repository.interface.js.map +1 -0
- package/dist/payment/payment-item.repository.d.ts +17 -0
- package/dist/payment/payment-item.repository.js +51 -0
- package/dist/payment/payment-item.repository.js.map +1 -0
- package/dist/payment/payment.d.ts +51 -51
- package/dist/payment/payment.js +179 -179
- package/dist/payment/payment.repository.d.ts +5 -5
- package/dist/payment/payment.repository.js +11 -11
- package/dist/payment-item/interfaces/payment-item-attr.interface.d.ts +10 -10
- package/dist/payment-item/interfaces/payment-item-attr.interface.js +6 -6
- package/dist/payment-item/payment-item.d.ts +23 -23
- package/dist/payment-item/payment-item.js +115 -97
- package/dist/payment-item/payment-item.js.map +1 -1
- package/dist/payment-item/payment-item.repository.d.ts +5 -5
- package/dist/payment-item/payment-item.repository.js +11 -11
- package/dist/payment-method/interfaces/payment-method-attr.interface.d.ts +5 -5
- package/dist/payment-method/interfaces/payment-method-attr.interface.js +2 -2
- package/dist/payment-method/payment-method.d.ts +18 -18
- package/dist/payment-method/payment-method.js +98 -98
- package/dist/payment-method/payment-method.repository.d.ts +5 -5
- package/dist/payment-method/payment-method.repository.js +11 -11
- package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.d.ts +8 -8
- package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.js +2 -2
- package/dist/payment-method-type/payment-method-type.d.ts +16 -16
- package/dist/payment-method-type/payment-method-type.js +70 -70
- package/dist/payment-method-type/payment-method-type.repository.d.ts +5 -5
- package/dist/payment-method-type/payment-method-type.repository.js +11 -11
- package/dist/payment-paid-with/interfaces/payment-paid-with.interface.d.ts +19 -19
- package/dist/payment-paid-with/interfaces/payment-paid-with.interface.js +6 -6
- package/dist/payment-paid-with/payment-paid-with.d.ts +31 -31
- package/dist/payment-paid-with/payment-paid-with.js +52 -52
- package/dist/payment-paid-with/payment-paid-with.repository.d.ts +5 -5
- package/dist/payment-paid-with/payment-paid-with.repository.js +11 -11
- package/dist/test-document.d.ts +3 -0
- package/dist/test-document.js +19 -0
- package/dist/test-document.js.map +1 -0
- package/dist/test.d.ts +1 -1
- package/dist/test.js +7 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/payment-item/payment-item.ts +22 -1
- package/src/test-document.ts +25 -0
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { ObjectBase } from '@tomei/general';
|
|
2
|
-
import Payment from '../payment/payment';
|
|
3
|
-
export default class PaymentItem extends ObjectBase {
|
|
4
|
-
private _PaymentId;
|
|
5
|
-
private _PayForObjectId;
|
|
6
|
-
private _PayForObjectType;
|
|
7
|
-
Currency: string;
|
|
8
|
-
Amount: number;
|
|
9
|
-
Name: string;
|
|
10
|
-
Description: string;
|
|
11
|
-
Remarks: string;
|
|
12
|
-
get PaymentId(): string;
|
|
13
|
-
private set PaymentId(value);
|
|
14
|
-
get PayForObjectId(): string;
|
|
15
|
-
private set PayForObjectId(value);
|
|
16
|
-
get PayForObjectType(): string;
|
|
17
|
-
private set PayForObjectType(value);
|
|
18
|
-
get ObjectId(): string;
|
|
19
|
-
get ObjectName(): string;
|
|
20
|
-
get TableName(): string;
|
|
21
|
-
constructor(payment: Payment, objectBeingPaidFor: ObjectBase);
|
|
22
|
-
paid(dbTransaction: any): Promise<void>;
|
|
23
|
-
}
|
|
1
|
+
import { ObjectBase } from '@tomei/general';
|
|
2
|
+
import Payment from '../payment/payment';
|
|
3
|
+
export default class PaymentItem extends ObjectBase {
|
|
4
|
+
private _PaymentId;
|
|
5
|
+
private _PayForObjectId;
|
|
6
|
+
private _PayForObjectType;
|
|
7
|
+
Currency: string;
|
|
8
|
+
Amount: number;
|
|
9
|
+
Name: string;
|
|
10
|
+
Description: string;
|
|
11
|
+
Remarks: string;
|
|
12
|
+
get PaymentId(): string;
|
|
13
|
+
private set PaymentId(value);
|
|
14
|
+
get PayForObjectId(): string;
|
|
15
|
+
private set PayForObjectId(value);
|
|
16
|
+
get PayForObjectType(): string;
|
|
17
|
+
private set PayForObjectType(value);
|
|
18
|
+
get ObjectId(): string;
|
|
19
|
+
get ObjectName(): string;
|
|
20
|
+
get TableName(): string;
|
|
21
|
+
constructor(payment: Payment, objectBeingPaidFor: ObjectBase);
|
|
22
|
+
paid(dbTransaction: any): Promise<void>;
|
|
23
|
+
}
|
|
@@ -1,102 +1,120 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const general_1 = require("@tomei/general");
|
|
13
|
-
const typeof_1 = require("../helpers/typeof");
|
|
14
|
-
const sequelize_1 = require("sequelize");
|
|
15
|
-
const __1 = require("../");
|
|
16
|
-
const decorators_1 = require("@nestjs/common/decorators");
|
|
17
|
-
class PaymentItem extends general_1.ObjectBase {
|
|
18
|
-
get PaymentId() {
|
|
19
|
-
return this._PaymentId;
|
|
20
|
-
}
|
|
21
|
-
set PaymentId(id) {
|
|
22
|
-
this._PaymentId = id;
|
|
23
|
-
}
|
|
24
|
-
get PayForObjectId() {
|
|
25
|
-
return this._PayForObjectId;
|
|
26
|
-
}
|
|
27
|
-
set PayForObjectId(id) {
|
|
28
|
-
this._PayForObjectId = id;
|
|
29
|
-
}
|
|
30
|
-
get PayForObjectType() {
|
|
31
|
-
return this._PayForObjectType;
|
|
32
|
-
}
|
|
33
|
-
set PayForObjectType(type) {
|
|
34
|
-
this._PayForObjectType = type;
|
|
35
|
-
}
|
|
36
|
-
get ObjectId() {
|
|
37
|
-
return '';
|
|
38
|
-
}
|
|
39
|
-
get ObjectName() {
|
|
40
|
-
return '';
|
|
41
|
-
}
|
|
42
|
-
get TableName() {
|
|
43
|
-
return 'finance_PaymentItem';
|
|
44
|
-
}
|
|
45
|
-
constructor(payment, objectBeingPaidFor) {
|
|
46
|
-
super();
|
|
47
|
-
this._PaymentId = '';
|
|
48
|
-
this._PayForObjectId = '';
|
|
49
|
-
this._PayForObjectType = '';
|
|
50
|
-
this.Currency = 'MYR';
|
|
51
|
-
this.Amount = 0;
|
|
52
|
-
this.Name = '';
|
|
53
|
-
this.Description = '';
|
|
54
|
-
this.Remarks = '';
|
|
55
|
-
this.PaymentId = payment.PaymentId;
|
|
56
|
-
this.PayForObjectId = objectBeingPaidFor.ObjectId;
|
|
57
|
-
this.PayForObjectType = (0, typeof_1.type)(objectBeingPaidFor);
|
|
58
|
-
}
|
|
59
|
-
paid(dbTransaction) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const sequelize = __1.FinanceDb.getConnection();
|
|
62
|
-
if (this.PayForObjectType === 'Document') {
|
|
63
|
-
const selectQuery = `SELECT Amount FROM finance_Document WHERE DocNo = '${this.PayForObjectId}'`;
|
|
64
|
-
const invoice = yield sequelize.query(selectQuery, {
|
|
65
|
-
type: sequelize_1.QueryTypes.SELECT,
|
|
66
|
-
raw: true,
|
|
67
|
-
transaction: dbTransaction,
|
|
68
|
-
});
|
|
69
|
-
let paidStatus = '';
|
|
70
|
-
if (invoice[0].Amount > this.Amount) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const general_1 = require("@tomei/general");
|
|
13
|
+
const typeof_1 = require("../helpers/typeof");
|
|
14
|
+
const sequelize_1 = require("sequelize");
|
|
15
|
+
const __1 = require("../");
|
|
16
|
+
const decorators_1 = require("@nestjs/common/decorators");
|
|
17
|
+
class PaymentItem extends general_1.ObjectBase {
|
|
18
|
+
get PaymentId() {
|
|
19
|
+
return this._PaymentId;
|
|
20
|
+
}
|
|
21
|
+
set PaymentId(id) {
|
|
22
|
+
this._PaymentId = id;
|
|
23
|
+
}
|
|
24
|
+
get PayForObjectId() {
|
|
25
|
+
return this._PayForObjectId;
|
|
26
|
+
}
|
|
27
|
+
set PayForObjectId(id) {
|
|
28
|
+
this._PayForObjectId = id;
|
|
29
|
+
}
|
|
30
|
+
get PayForObjectType() {
|
|
31
|
+
return this._PayForObjectType;
|
|
32
|
+
}
|
|
33
|
+
set PayForObjectType(type) {
|
|
34
|
+
this._PayForObjectType = type;
|
|
35
|
+
}
|
|
36
|
+
get ObjectId() {
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
get ObjectName() {
|
|
40
|
+
return '';
|
|
41
|
+
}
|
|
42
|
+
get TableName() {
|
|
43
|
+
return 'finance_PaymentItem';
|
|
44
|
+
}
|
|
45
|
+
constructor(payment, objectBeingPaidFor) {
|
|
46
|
+
super();
|
|
47
|
+
this._PaymentId = '';
|
|
48
|
+
this._PayForObjectId = '';
|
|
49
|
+
this._PayForObjectType = '';
|
|
50
|
+
this.Currency = 'MYR';
|
|
51
|
+
this.Amount = 0;
|
|
52
|
+
this.Name = '';
|
|
53
|
+
this.Description = '';
|
|
54
|
+
this.Remarks = '';
|
|
55
|
+
this.PaymentId = payment.PaymentId;
|
|
56
|
+
this.PayForObjectId = objectBeingPaidFor.ObjectId;
|
|
57
|
+
this.PayForObjectType = (0, typeof_1.type)(objectBeingPaidFor);
|
|
58
|
+
}
|
|
59
|
+
paid(dbTransaction) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const sequelize = __1.FinanceDb.getConnection();
|
|
62
|
+
if (this.PayForObjectType === 'Document') {
|
|
63
|
+
const selectQuery = `SELECT Amount FROM finance_Document WHERE DocNo = '${this.PayForObjectId}'`;
|
|
64
|
+
const invoice = yield sequelize.query(selectQuery, {
|
|
65
|
+
type: sequelize_1.QueryTypes.SELECT,
|
|
66
|
+
raw: true,
|
|
67
|
+
transaction: dbTransaction,
|
|
68
|
+
});
|
|
69
|
+
let paidStatus = '';
|
|
70
|
+
if (invoice[0].Amount > this.Amount) {
|
|
71
|
+
const selectPaymentItem = `SELECT * FROM finance_PaymentItem WHERE PayForObjectId = '${this.PayForObjectId}' AND PayForObjectType = 'Document'`;
|
|
72
|
+
const documentPaymentItems = yield sequelize.query(selectPaymentItem, {
|
|
73
|
+
type: sequelize_1.QueryTypes.SELECT,
|
|
74
|
+
raw: true,
|
|
75
|
+
transaction: dbTransaction,
|
|
76
|
+
});
|
|
77
|
+
let amountPreviouslyPaid = 0;
|
|
78
|
+
documentPaymentItems.forEach((paymentItem) => {
|
|
79
|
+
const amount = typeof paymentItem.Amount === 'string'
|
|
80
|
+
? parseFloat(paymentItem.Amount).toFixed(2)
|
|
81
|
+
: paymentItem.Amount;
|
|
82
|
+
amountPreviouslyPaid += amount;
|
|
83
|
+
});
|
|
84
|
+
if (invoice[0].Amount === amountPreviouslyPaid) {
|
|
85
|
+
paidStatus = 'Paid';
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
paidStatus = 'Partial Paid';
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else if (invoice[0].Amount === this.Amount) {
|
|
92
|
+
paidStatus = 'Paid';
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
throw new Error('Payment Item amount cannot be greater than its PayForObject amount.');
|
|
96
|
+
}
|
|
79
97
|
const updateQuery = `
|
|
80
98
|
UPDATE finance_Document
|
|
81
99
|
SET Status = '${paidStatus}'
|
|
82
100
|
WHERE DocNo = '${this.PayForObjectId}'
|
|
83
|
-
`;
|
|
84
|
-
yield sequelize.query(updateQuery, {
|
|
85
|
-
type: sequelize_1.QueryTypes.UPDATE,
|
|
86
|
-
raw: true,
|
|
87
|
-
transaction: dbTransaction,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
else if (this.PayForObjectType === 'LoanSchedule' ||
|
|
91
|
-
this.PayForObjectType === 'SimpleLoans' ||
|
|
92
|
-
this.PayForObjectType === 'Loans') {
|
|
93
|
-
(0, decorators_1.Next)();
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
throw new Error('Unknown type');
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.default = PaymentItem;
|
|
101
|
+
`;
|
|
102
|
+
yield sequelize.query(updateQuery, {
|
|
103
|
+
type: sequelize_1.QueryTypes.UPDATE,
|
|
104
|
+
raw: true,
|
|
105
|
+
transaction: dbTransaction,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
else if (this.PayForObjectType === 'LoanSchedule' ||
|
|
109
|
+
this.PayForObjectType === 'SimpleLoans' ||
|
|
110
|
+
this.PayForObjectType === 'Loans') {
|
|
111
|
+
(0, decorators_1.Next)();
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
throw new Error('Unknown type');
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.default = PaymentItem;
|
|
102
120
|
//# sourceMappingURL=payment-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-item.js","sourceRoot":"","sources":["../../src/payment-item/payment-item.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4CAA4C;AAE5C,8CAAyC;AACzC,yCAAuC;AACvC,2BAAgC;AAChC,0DAAiD;AAEjD,MAAqB,WAAY,SAAQ,oBAAU;IAUjD,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,IAAY,SAAS,CAAC,EAAU;QAC9B,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACvB,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,IAAY,cAAc,CAAC,EAAU;QACnC,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;IAC5B,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CA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AI,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,oBAAoB,EAAE;wBAC9C,UAAU,GAAG,MAAM,CAAC;qBACrB;yBAAM;wBACL,UAAU,GAAG,cAAc,CAAC;qBAC7B;iBACF;qBAAM,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;oBAC5C,UAAU,GAAG,MAAM,CAAC;iBACrB;qBAAM;oBACL,MAAM,IAAI,KAAK,CACb,qEAAqE,CACtE,CAAC;iBACH;gBAED,MAAM,WAAW,GAAG;;wBAEF,UAAU;yBACT,IAAI,CAAC,cAAc;OACrC,CAAC;gBAEF,MAAM,SAAS,CAAC,KAAK,CAAC,WAAW,EAAE;oBACjC,IAAI,EAAE,sBAAU,CAAC,MAAM;oBACvB,GAAG,EAAE,IAAI;oBACT,WAAW,EAAE,aAAa;iBAC3B,CAAC,CAAC;aACJ;iBAAM,IACL,IAAI,CAAC,gBAAgB,KAAK,cAAc;gBACxC,IAAI,CAAC,gBAAgB,KAAK,aAAa;gBACvC,IAAI,CAAC,gBAAgB,KAAK,OAAO,EACjC;gBACA,IAAA,iBAAI,GAAE,CAAC;aACR;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;aACjC;QACH,CAAC;KAAA;CACF;AArHD,8BAqHC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
|
|
2
|
-
import PaymentItemModel from '../models/payment-item.entity';
|
|
3
|
-
export declare class PaymentItemRepository extends RepositoryBase<PaymentItemModel> implements IRepositoryBase<PaymentItemModel> {
|
|
4
|
-
constructor();
|
|
5
|
-
}
|
|
1
|
+
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
|
|
2
|
+
import PaymentItemModel from '../models/payment-item.entity';
|
|
3
|
+
export declare class PaymentItemRepository extends RepositoryBase<PaymentItemModel> implements IRepositoryBase<PaymentItemModel> {
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PaymentItemRepository = void 0;
|
|
4
|
-
const general_1 = require("@tomei/general");
|
|
5
|
-
const payment_item_entity_1 = require("../models/payment-item.entity");
|
|
6
|
-
class PaymentItemRepository extends general_1.RepositoryBase {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(payment_item_entity_1.default);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.PaymentItemRepository = PaymentItemRepository;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentItemRepository = void 0;
|
|
4
|
+
const general_1 = require("@tomei/general");
|
|
5
|
+
const payment_item_entity_1 = require("../models/payment-item.entity");
|
|
6
|
+
class PaymentItemRepository extends general_1.RepositoryBase {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(payment_item_entity_1.default);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.PaymentItemRepository = PaymentItemRepository;
|
|
12
12
|
//# sourceMappingURL=payment-item.repository.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export interface IPaymentMethodAttr {
|
|
2
|
-
MethodId: string;
|
|
3
|
-
Name: string;
|
|
4
|
-
CompanyId: string;
|
|
5
|
-
}
|
|
1
|
+
export interface IPaymentMethodAttr {
|
|
2
|
+
MethodId: string;
|
|
3
|
+
Name: string;
|
|
4
|
+
CompanyId: string;
|
|
5
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=payment-method-attr.interface.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { ObjectBase } from '@tomei/general';
|
|
2
|
-
import PaymentMethodType from '../payment-method-type/payment-method-type';
|
|
3
|
-
import { IPaymentMethodTypeAttr } from '../payment-method-type/interfaces/payment-method-type-attr.interface';
|
|
4
|
-
export default class PaymentMethod extends ObjectBase {
|
|
5
|
-
MethodId: string;
|
|
6
|
-
Name: string;
|
|
7
|
-
CompanyId: string;
|
|
8
|
-
private static _RepositoryBase;
|
|
9
|
-
private static _PaymentMethodTypeRepository;
|
|
10
|
-
private _DbTransaction;
|
|
11
|
-
private _PaymentMethodTypes;
|
|
12
|
-
constructor(dbTransaction?: any, methodId?: string);
|
|
13
|
-
get ObjectId(): string;
|
|
14
|
-
get ObjectName(): string;
|
|
15
|
-
get TableName(): string;
|
|
16
|
-
get PaymentMethodTypes(): Promise<PaymentMethodType[]>;
|
|
17
|
-
newPaymentMethodType(payload: IPaymentMethodTypeAttr): Promise<any>;
|
|
18
|
-
}
|
|
1
|
+
import { ObjectBase } from '@tomei/general';
|
|
2
|
+
import PaymentMethodType from '../payment-method-type/payment-method-type';
|
|
3
|
+
import { IPaymentMethodTypeAttr } from '../payment-method-type/interfaces/payment-method-type-attr.interface';
|
|
4
|
+
export default class PaymentMethod extends ObjectBase {
|
|
5
|
+
MethodId: string;
|
|
6
|
+
Name: string;
|
|
7
|
+
CompanyId: string;
|
|
8
|
+
private static _RepositoryBase;
|
|
9
|
+
private static _PaymentMethodTypeRepository;
|
|
10
|
+
private _DbTransaction;
|
|
11
|
+
private _PaymentMethodTypes;
|
|
12
|
+
constructor(dbTransaction?: any, methodId?: string);
|
|
13
|
+
get ObjectId(): string;
|
|
14
|
+
get ObjectName(): string;
|
|
15
|
+
get TableName(): string;
|
|
16
|
+
get PaymentMethodTypes(): Promise<PaymentMethodType[]>;
|
|
17
|
+
newPaymentMethodType(payload: IPaymentMethodTypeAttr): Promise<any>;
|
|
18
|
+
}
|
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const general_1 = require("@tomei/general");
|
|
13
|
-
const payment_method_repository_1 = require("./payment-method.repository");
|
|
14
|
-
const payment_method_type_1 = require("../payment-method-type/payment-method-type");
|
|
15
|
-
const payment_method_type_repository_1 = require("../payment-method-type/payment-method-type.repository");
|
|
16
|
-
class PaymentMethod extends general_1.ObjectBase {
|
|
17
|
-
constructor(dbTransaction, methodId) {
|
|
18
|
-
super();
|
|
19
|
-
this.MethodId = 'New';
|
|
20
|
-
this.Name = '';
|
|
21
|
-
this.CompanyId = '';
|
|
22
|
-
this._PaymentMethodTypes = [];
|
|
23
|
-
if (dbTransaction) {
|
|
24
|
-
this._DbTransaction = dbTransaction;
|
|
25
|
-
}
|
|
26
|
-
if (methodId) {
|
|
27
|
-
this.MethodId = methodId;
|
|
28
|
-
PaymentMethod._RepositoryBase
|
|
29
|
-
.findOne({
|
|
30
|
-
where: {
|
|
31
|
-
MethodId: methodId,
|
|
32
|
-
},
|
|
33
|
-
transaction: dbTransaction,
|
|
34
|
-
})
|
|
35
|
-
.then((methodData) => {
|
|
36
|
-
if (methodData) {
|
|
37
|
-
this.Name = methodData.Name;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
throw new general_1.RecordNotFoundError('No record found.');
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
.catch((err) => {
|
|
44
|
-
console.log('Payment method constructor err: ', err);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
get ObjectId() {
|
|
49
|
-
return this.MethodId;
|
|
50
|
-
}
|
|
51
|
-
get ObjectName() {
|
|
52
|
-
return this.Name;
|
|
53
|
-
}
|
|
54
|
-
get TableName() {
|
|
55
|
-
return 'finance_PaymentMethod';
|
|
56
|
-
}
|
|
57
|
-
get PaymentMethodTypes() {
|
|
58
|
-
return new Promise((resolve, reject) => {
|
|
59
|
-
if (this.MethodId !== 'New') {
|
|
60
|
-
PaymentMethod._PaymentMethodTypeRepository
|
|
61
|
-
.findAll({
|
|
62
|
-
where: {
|
|
63
|
-
MethodId: this.MethodId,
|
|
64
|
-
},
|
|
65
|
-
transaction: this._DbTransaction,
|
|
66
|
-
})
|
|
67
|
-
.then((paymentMethodTypes) => {
|
|
68
|
-
const paymentMethodTypeObjects = paymentMethodTypes.map((paymentMethodTypeData) => new payment_method_type_1.default(this._DbTransaction, paymentMethodTypeData.MethodTypeId));
|
|
69
|
-
return Promise.all(paymentMethodTypeObjects);
|
|
70
|
-
})
|
|
71
|
-
.then((paymentMethodTypeObjects) => {
|
|
72
|
-
this._PaymentMethodTypes = paymentMethodTypeObjects;
|
|
73
|
-
resolve(this._PaymentMethodTypes);
|
|
74
|
-
})
|
|
75
|
-
.catch((err) => {
|
|
76
|
-
reject(err);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
resolve(this._PaymentMethodTypes);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
newPaymentMethodType(payload) {
|
|
85
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
try {
|
|
87
|
-
const newPaymentMethodType = yield PaymentMethod._PaymentMethodTypeRepository.create(payload);
|
|
88
|
-
this._PaymentMethodTypes.push(newPaymentMethodType);
|
|
89
|
-
}
|
|
90
|
-
catch (err) {
|
|
91
|
-
throw err;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
exports.default = PaymentMethod;
|
|
97
|
-
PaymentMethod._RepositoryBase = new payment_method_repository_1.PaymentMethodRepository();
|
|
98
|
-
PaymentMethod._PaymentMethodTypeRepository = new payment_method_type_repository_1.PaymentMethodTypeRepository();
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const general_1 = require("@tomei/general");
|
|
13
|
+
const payment_method_repository_1 = require("./payment-method.repository");
|
|
14
|
+
const payment_method_type_1 = require("../payment-method-type/payment-method-type");
|
|
15
|
+
const payment_method_type_repository_1 = require("../payment-method-type/payment-method-type.repository");
|
|
16
|
+
class PaymentMethod extends general_1.ObjectBase {
|
|
17
|
+
constructor(dbTransaction, methodId) {
|
|
18
|
+
super();
|
|
19
|
+
this.MethodId = 'New';
|
|
20
|
+
this.Name = '';
|
|
21
|
+
this.CompanyId = '';
|
|
22
|
+
this._PaymentMethodTypes = [];
|
|
23
|
+
if (dbTransaction) {
|
|
24
|
+
this._DbTransaction = dbTransaction;
|
|
25
|
+
}
|
|
26
|
+
if (methodId) {
|
|
27
|
+
this.MethodId = methodId;
|
|
28
|
+
PaymentMethod._RepositoryBase
|
|
29
|
+
.findOne({
|
|
30
|
+
where: {
|
|
31
|
+
MethodId: methodId,
|
|
32
|
+
},
|
|
33
|
+
transaction: dbTransaction,
|
|
34
|
+
})
|
|
35
|
+
.then((methodData) => {
|
|
36
|
+
if (methodData) {
|
|
37
|
+
this.Name = methodData.Name;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
throw new general_1.RecordNotFoundError('No record found.');
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
.catch((err) => {
|
|
44
|
+
console.log('Payment method constructor err: ', err);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
get ObjectId() {
|
|
49
|
+
return this.MethodId;
|
|
50
|
+
}
|
|
51
|
+
get ObjectName() {
|
|
52
|
+
return this.Name;
|
|
53
|
+
}
|
|
54
|
+
get TableName() {
|
|
55
|
+
return 'finance_PaymentMethod';
|
|
56
|
+
}
|
|
57
|
+
get PaymentMethodTypes() {
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
59
|
+
if (this.MethodId !== 'New') {
|
|
60
|
+
PaymentMethod._PaymentMethodTypeRepository
|
|
61
|
+
.findAll({
|
|
62
|
+
where: {
|
|
63
|
+
MethodId: this.MethodId,
|
|
64
|
+
},
|
|
65
|
+
transaction: this._DbTransaction,
|
|
66
|
+
})
|
|
67
|
+
.then((paymentMethodTypes) => {
|
|
68
|
+
const paymentMethodTypeObjects = paymentMethodTypes.map((paymentMethodTypeData) => new payment_method_type_1.default(this._DbTransaction, paymentMethodTypeData.MethodTypeId));
|
|
69
|
+
return Promise.all(paymentMethodTypeObjects);
|
|
70
|
+
})
|
|
71
|
+
.then((paymentMethodTypeObjects) => {
|
|
72
|
+
this._PaymentMethodTypes = paymentMethodTypeObjects;
|
|
73
|
+
resolve(this._PaymentMethodTypes);
|
|
74
|
+
})
|
|
75
|
+
.catch((err) => {
|
|
76
|
+
reject(err);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
resolve(this._PaymentMethodTypes);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
newPaymentMethodType(payload) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
try {
|
|
87
|
+
const newPaymentMethodType = yield PaymentMethod._PaymentMethodTypeRepository.create(payload);
|
|
88
|
+
this._PaymentMethodTypes.push(newPaymentMethodType);
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
throw err;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.default = PaymentMethod;
|
|
97
|
+
PaymentMethod._RepositoryBase = new payment_method_repository_1.PaymentMethodRepository();
|
|
98
|
+
PaymentMethod._PaymentMethodTypeRepository = new payment_method_type_repository_1.PaymentMethodTypeRepository();
|
|
99
99
|
//# sourceMappingURL=payment-method.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
|
|
2
|
-
import PaymentMethodModel from '../models/payment-method.entity';
|
|
3
|
-
export declare class PaymentMethodRepository extends RepositoryBase<PaymentMethodModel> implements IRepositoryBase<PaymentMethodModel> {
|
|
4
|
-
constructor();
|
|
5
|
-
}
|
|
1
|
+
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
|
|
2
|
+
import PaymentMethodModel from '../models/payment-method.entity';
|
|
3
|
+
export declare class PaymentMethodRepository extends RepositoryBase<PaymentMethodModel> implements IRepositoryBase<PaymentMethodModel> {
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PaymentMethodRepository = void 0;
|
|
4
|
-
const general_1 = require("@tomei/general");
|
|
5
|
-
const payment_method_entity_1 = require("../models/payment-method.entity");
|
|
6
|
-
class PaymentMethodRepository extends general_1.RepositoryBase {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(payment_method_entity_1.default);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.PaymentMethodRepository = PaymentMethodRepository;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentMethodRepository = void 0;
|
|
4
|
+
const general_1 = require("@tomei/general");
|
|
5
|
+
const payment_method_entity_1 = require("../models/payment-method.entity");
|
|
6
|
+
class PaymentMethodRepository extends general_1.RepositoryBase {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(payment_method_entity_1.default);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.PaymentMethodRepository = PaymentMethodRepository;
|
|
12
12
|
//# sourceMappingURL=payment-method.repository.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export interface IPaymentMethodTypeAttr {
|
|
2
|
-
MethodTypeId: string;
|
|
3
|
-
MethodId: string;
|
|
4
|
-
Name: string;
|
|
5
|
-
AccountNo: string;
|
|
6
|
-
ProcessingFeeRate: number;
|
|
7
|
-
ProcessingFeeAccountNo: string;
|
|
8
|
-
}
|
|
1
|
+
export interface IPaymentMethodTypeAttr {
|
|
2
|
+
MethodTypeId: string;
|
|
3
|
+
MethodId: string;
|
|
4
|
+
Name: string;
|
|
5
|
+
AccountNo: string;
|
|
6
|
+
ProcessingFeeRate: number;
|
|
7
|
+
ProcessingFeeAccountNo: string;
|
|
8
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=payment-method-type-attr.interface.js.map
|