@tomei/finance 0.6.88 → 0.6.90

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 (112) hide show
  1. package/.commitlintrc.json +22 -22
  2. package/.eslintrc.js +72 -72
  3. package/.gitlab-ci.yml +16 -16
  4. package/.husky/commit-msg +4 -4
  5. package/.husky/pre-commit +4 -4
  6. package/.prettierrc +4 -4
  7. package/CONTRIBUTING.md +30 -30
  8. package/LICENSE +21 -21
  9. package/README.md +13 -13
  10. package/configs/config.js +348 -348
  11. package/dist/customer/customer.js +7 -1
  12. package/dist/customer/customer.js.map +1 -1
  13. package/dist/document/document.d.ts +1 -0
  14. package/dist/document/document.js +14 -0
  15. package/dist/document/document.js.map +1 -1
  16. package/dist/finance-company/finance-company.d.ts +1 -1
  17. package/dist/finance-company/finance-company.js +42 -9
  18. package/dist/finance-company/finance-company.js.map +1 -1
  19. package/dist/interfaces/account-system.interface.d.ts +15 -10
  20. package/dist/payment-item/payment-item.js +4 -4
  21. package/dist/tsconfig.tsbuildinfo +1 -1
  22. package/invoice-template/assets/css/style.css.map +12 -12
  23. package/invoice-template/assets/css/style.min.css +1 -1
  24. package/invoice-template/assets/img/arrow_bg.svg +11 -11
  25. package/invoice-template/assets/img/coffy_shop_img.svg +18 -18
  26. package/invoice-template/assets/img/logo_accent.svg +3 -3
  27. package/invoice-template/assets/img/logo_white.svg +4 -4
  28. package/invoice-template/assets/img/sign.svg +12 -12
  29. package/invoice-template/assets/img/tomei-logo.svg +9 -9
  30. package/invoice-template/assets/js/html2canvas.min.js +10379 -10379
  31. package/invoice-template/assets/js/jquery.min.js +1 -1
  32. package/invoice-template/assets/sass/common/_color_variable.scss +12 -12
  33. package/invoice-template/assets/sass/common/_typography.scss +178 -178
  34. package/invoice-template/assets/sass/style.scss +12 -12
  35. package/migrations/finance-account-migration.js +97 -97
  36. package/migrations/finance-company-migration.js +29 -29
  37. package/migrations/finance-customer-migration.js +51 -51
  38. package/migrations/finance-document-item-migration.js +111 -111
  39. package/migrations/finance-document-migration.js +122 -122
  40. package/migrations/finance-journal-entry-migration.js +59 -59
  41. package/migrations/finance-ledger-transaction-migration.js +89 -89
  42. package/migrations/finance-payment-item-migration.js +52 -52
  43. package/migrations/finance-payment-method-migration.js +31 -31
  44. package/migrations/finance-payment-method-type-migration.js +55 -55
  45. package/migrations/finance-payment-migration.js +96 -96
  46. package/migrations/finance-post-history-migration.js +45 -45
  47. package/migrations/finance-tax-migration.js +52 -52
  48. package/migrations/refactor-finance-document-migration.js +71 -71
  49. package/nest-cli.json +19 -19
  50. package/package.json +82 -82
  51. package/sonar-project.properties +12 -12
  52. package/src/account/account.repository.ts +11 -11
  53. package/src/account/account.ts +278 -278
  54. package/src/account/interfaces/account-attr.interface.ts +31 -31
  55. package/src/account-system-entity/account-system-entity.ts +66 -66
  56. package/src/account-system-entity/post-history.repository.ts +11 -11
  57. package/src/config.ts +382 -382
  58. package/src/customer/customer.ts +309 -305
  59. package/src/customer/finance-customer.repository.ts +13 -13
  60. package/src/customer/interfaces/customer.repository.interface.ts +3 -3
  61. package/src/customer/interfaces/finance-customer-attr.interface.ts +10 -10
  62. package/src/customer/interfaces/finance-customer.repository.interface.ts +4 -4
  63. package/src/database.ts +48 -48
  64. package/src/document/document-item.repository.ts +11 -11
  65. package/src/document/document.repository.ts +11 -11
  66. package/src/document/document.ts +15 -0
  67. package/src/document/interfaces/document-attr.interface.ts +28 -28
  68. package/src/document/interfaces/document-item-attr.interface.ts +22 -22
  69. package/src/document/interfaces/document-item.repository.interface.ts +4 -4
  70. package/src/enum/collect-payment-type.ts +3 -3
  71. package/src/enum/doc-type.enum.ts +8 -8
  72. package/src/enum/index.ts +19 -19
  73. package/src/enum/payment-method.enum.ts +3 -3
  74. package/src/enum/payment-type.enum.ts +4 -4
  75. package/src/enum/quick-book-client-scopes.enum.ts +14 -14
  76. package/src/finance-company/finance-company.repository.ts +11 -11
  77. package/src/finance-company/finance-company.ts +2331 -2289
  78. package/src/helpers/login-user.ts +38 -38
  79. package/src/helpers/typeof.ts +35 -35
  80. package/src/index.ts +32 -32
  81. package/src/interfaces/account-system.interface.ts +30 -23
  82. package/src/interfaces/index.ts +3 -3
  83. package/src/models/account.entity.ts +206 -206
  84. package/src/models/customer.entity.ts +93 -93
  85. package/src/models/document-item.entity.ts +143 -143
  86. package/src/models/document.entity.ts +211 -211
  87. package/src/models/finance-company.entity.ts +69 -69
  88. package/src/models/journal-entry.entity.ts +110 -110
  89. package/src/models/ledger-transaction.entity.ts +148 -148
  90. package/src/models/payment-item.entity.ts +60 -60
  91. package/src/models/payment-method-type.entity.ts +70 -70
  92. package/src/models/payment-method.entity.ts +51 -51
  93. package/src/models/payment.entity.ts +165 -165
  94. package/src/models/post-history.entity.ts +41 -41
  95. package/src/models/tax.entity.ts +75 -75
  96. package/src/payment/interfaces/payment-attr.interface.ts +23 -23
  97. package/src/payment/interfaces/payment-params.interface.ts +8 -8
  98. package/src/payment/payment.repository.ts +11 -11
  99. package/src/payment/payment.ts +236 -236
  100. package/src/payment-item/interfaces/payment-item-attr.interface.ts +10 -10
  101. package/src/payment-item/payment-item.repository.ts +11 -11
  102. package/src/payment-item/payment-item.ts +134 -134
  103. package/src/payment-method/payment-method.repository.ts +11 -11
  104. package/src/payment-method-type/payment-method-type.repository.ts +11 -11
  105. package/src/tax/interfaces/tax-attr.interface.ts +10 -10
  106. package/src/tax/tax.repository.ts +11 -11
  107. package/src/tax/tax.ts +69 -69
  108. package/src/test-document.ts +25 -25
  109. package/src/test.ts +3 -3
  110. package/tsconfig.build.json +4 -4
  111. package/tsconfig.json +22 -22
  112. package/tslint.json +18 -18
@@ -1,236 +1,236 @@
1
- import { ObjectBase } from '@tomei/general';
2
- import { RecordNotFoundError } from '@tomei/general/dist/class/exceptions/record-not-found.error';
3
- import { PaymentType } from '../enum';
4
- import { IPaymentParams } from './interfaces/payment-params.interface';
5
- import { AccountSystemEntity } from '../account-system-entity/account-system-entity';
6
- import { PaymentStatus } from '../enum/payment-status.enum';
7
- import { PaymentRepository } from './payment.repository';
8
- import { PaymentItemRepository } from '../payment-item/payment-item.repository';
9
- // import PaymentItemModel from '../models/payment-item.entity';
10
- import PaymentItem from '../payment-item/payment-item';
11
- import PaymentPaidWith from '../payment-paid-with/payment-paid-with';
12
- import { PaymentPaidWithRepository } from '../payment-paid-with/payment-paid-with.repository';
13
-
14
- export default class Payment extends AccountSystemEntity {
15
- private _PaymentId = 'New';
16
- PaymentType: PaymentType;
17
- PaymentDate: Date;
18
- MethodTypeId: string;
19
- Description = '';
20
- Currency = 'MYR';
21
- Amount = 0;
22
- Status: PaymentStatus;
23
- TransactionId: string;
24
- TransactionApprovalCode: string;
25
- TransactionAccountName: string;
26
- TransactionAccountNo: string;
27
- ReceivedBy = '';
28
- IssuedBy = '';
29
- UpdatedBy = '';
30
- UpdatedAt: Date;
31
- Remarks = '';
32
- RelatedObjectId = '';
33
- RelatedObjectType = '';
34
- ReceiptDocNo = '';
35
- protected _ObjectType: 'Payment';
36
-
37
- private static _RepositoryBase = new PaymentRepository();
38
- private static _PaymentItemRepository = new PaymentItemRepository();
39
- private static _PaymentPaidWithRepository = new PaymentPaidWithRepository();
40
-
41
- private _DbTransaction: any;
42
- private _PaymentItems = [];
43
- private _PaymentPaidWith = [];
44
-
45
- paymentItemRepository: PaymentItemRepository;
46
-
47
- public get PaymentId() {
48
- return this._PaymentId;
49
- }
50
-
51
- get ObjectType() {
52
- return this._ObjectType;
53
- }
54
-
55
- public set PaymentId(id: string) {
56
- this._PaymentId = id;
57
- }
58
-
59
- /* AccountSystemEntity Implementation */
60
- get RepositoryBase() {
61
- return Payment._RepositoryBase;
62
- }
63
-
64
- /* ObjectBase Implementation */
65
- get ObjectId() {
66
- return this.PaymentId;
67
- }
68
-
69
- get ObjectName() {
70
- return this.PaymentId;
71
- }
72
-
73
- get TableName() {
74
- return 'finance_Payment';
75
- }
76
-
77
- constructor(dbTransaction?: any, paymentId?: string) {
78
- super();
79
- if (dbTransaction) {
80
- this._DbTransaction = dbTransaction;
81
- }
82
- if (paymentId) {
83
- this.PaymentId = paymentId;
84
- }
85
- }
86
-
87
- static async initPayment(
88
- dbTransaction: any,
89
- paymentId: string,
90
- ): Promise<Payment> {
91
- try {
92
- const paymentData = await this._RepositoryBase.findOne({
93
- where: {
94
- PaymentId: paymentId,
95
- },
96
- transaction: dbTransaction,
97
- });
98
- if (paymentData) {
99
- const payment = new Payment(dbTransaction, paymentId);
100
- payment.PaymentType = paymentData.PaymentType;
101
- payment.PaymentDate = paymentData.PaymentDate;
102
- payment.Description = paymentData.Description;
103
- payment.Currency = paymentData.Currency;
104
- payment.Amount = paymentData.Amount;
105
- payment.Status = paymentData.Status;
106
- payment.ReceivedBy = paymentData.ReceivedBy;
107
- payment.IssuedBy = paymentData.IssuedBy;
108
- payment.UpdatedAt = paymentData.UpdatedAt;
109
- payment.UpdatedBy = paymentData.UpdatedBy;
110
- payment.Remarks = paymentData.Remarks;
111
- payment.RelatedObjectId = paymentData.RelatedObjectId;
112
- payment.RelatedObjectType = paymentData.RelatedObjectType;
113
- payment.ReceiptDocNo = paymentData.ReceiptDocNo;
114
- payment.AccSystemRefId = paymentData.AccSystemRefId;
115
- payment.PostedToAccSystemYN = paymentData.PostedToAccSystemYN;
116
- payment.PostedById = paymentData.PostedById;
117
- payment.PostedDateTime = paymentData.PostedDateTime;
118
- return payment;
119
- } else {
120
- const notFoundError = new RecordNotFoundError(
121
- 'PaymentErrMsg',
122
- 'No Record Found.',
123
- );
124
- throw notFoundError;
125
- }
126
- } catch (error) {
127
- console.log('Payment Class constructor err: ', error);
128
- }
129
- }
130
-
131
- async getPaymentItems(dbTransaction?: any): Promise<PaymentItem[]> {
132
- try {
133
- if (this.PaymentId !== 'New') {
134
- const paymentItems = await Payment._PaymentItemRepository.findAll({
135
- where: {
136
- PaymentId: this.PaymentId,
137
- },
138
- transaction: dbTransaction || this._DbTransaction,
139
- });
140
- const paymentItemObjects = paymentItems.map((paymentItem) => {
141
- const pi = new PaymentItem(
142
- new Payment(this._DbTransaction, paymentItem.PaymentId),
143
- {
144
- ObjectId: this.ObjectId,
145
- ObjectName: this.ObjectName,
146
- TableName: this.TableName,
147
- ObjectType: this.ObjectType,
148
- } as ObjectBase,
149
- );
150
- pi.PayForObjectType = paymentItem.PayForObjectType;
151
- pi.PayForObjectId = paymentItem.PayForObjectId;
152
- pi.Currency = paymentItem.Currency;
153
- pi.Amount = paymentItem.Amount;
154
- pi.Name = paymentItem.Name;
155
- pi.Description = paymentItem.Description;
156
-
157
- return pi;
158
- });
159
-
160
- this._PaymentItems = paymentItemObjects;
161
- return this._PaymentItems;
162
- } else {
163
- return this._PaymentItems;
164
- }
165
- } catch (error) {
166
- throw error;
167
- }
168
- }
169
-
170
- async getPaymentPaidWith(dbTransaction?: any): Promise<PaymentPaidWith[]> {
171
- try {
172
- if (this.PaymentId !== 'New') {
173
- const paymentPaidWithItems =
174
- await Payment._PaymentPaidWithRepository.findAll({
175
- where: {
176
- PaymentId: this.PaymentId,
177
- },
178
- transaction: dbTransaction || this._DbTransaction,
179
- });
180
- const paymentPaidWithObjects = paymentPaidWithItems.map(
181
- (paymentPaidWithItem) => {
182
- const ppw = new PaymentPaidWith(
183
- new Payment(this._DbTransaction, paymentPaidWithItem.PaymentId),
184
- paymentPaidWithItem.MethodTypeId,
185
- );
186
-
187
- ppw.Currency = paymentPaidWithItem.Currency;
188
- ppw.Amount = paymentPaidWithItem.Amount;
189
- ppw.Status = paymentPaidWithItem.Status;
190
- ppw.TransactionId = paymentPaidWithItem.TransactionId;
191
- ppw.RefBank = paymentPaidWithItem.RefBank;
192
- ppw.RefName = paymentPaidWithItem.RefName;
193
- ppw.RefNo = paymentPaidWithItem.RefNo;
194
- ppw.RefOther1 = paymentPaidWithItem.RefOther1;
195
- ppw.RefOther2 = paymentPaidWithItem.RefOther2;
196
- ppw.RefOther3 = paymentPaidWithItem.RefOther3;
197
- ppw.RefOther4 = paymentPaidWithItem.RefOther4;
198
- ppw.RefOther5 = paymentPaidWithItem.RefOther5;
199
- ppw.Remarks = paymentPaidWithItem.Remarks;
200
- ppw.PaymentMediaId = paymentPaidWithItem.PaymentMediaId;
201
-
202
- return ppw;
203
- },
204
- );
205
-
206
- this._PaymentPaidWith = paymentPaidWithObjects;
207
- return this._PaymentPaidWith;
208
- } else {
209
- return this._PaymentPaidWith;
210
- }
211
- } catch (error) {
212
- throw error;
213
- }
214
- }
215
-
216
- newPaymentItem(objectBeingPaidFor: ObjectBase): PaymentItem {
217
- const paymentItem = new PaymentItem(this, objectBeingPaidFor);
218
- this._PaymentItems.push(paymentItem);
219
- return paymentItem;
220
- }
221
-
222
- newPaymentPaidWith(paymentMethodTypeId: string) {
223
- const paymentPaidWith = new PaymentPaidWith(
224
- this,
225
- paymentMethodTypeId,
226
- this._DbTransaction,
227
- );
228
- this._PaymentPaidWith.push(paymentPaidWith);
229
- return paymentPaidWith;
230
- }
231
-
232
- init(Params: IPaymentParams): void {
233
- if (Params.Currency) this.Currency = Params.Currency;
234
- if (Params.PaymentType) this.PaymentType = Params.PaymentType;
235
- }
236
- }
1
+ import { ObjectBase } from '@tomei/general';
2
+ import { RecordNotFoundError } from '@tomei/general/dist/class/exceptions/record-not-found.error';
3
+ import { PaymentType } from '../enum';
4
+ import { IPaymentParams } from './interfaces/payment-params.interface';
5
+ import { AccountSystemEntity } from '../account-system-entity/account-system-entity';
6
+ import { PaymentStatus } from '../enum/payment-status.enum';
7
+ import { PaymentRepository } from './payment.repository';
8
+ import { PaymentItemRepository } from '../payment-item/payment-item.repository';
9
+ // import PaymentItemModel from '../models/payment-item.entity';
10
+ import PaymentItem from '../payment-item/payment-item';
11
+ import PaymentPaidWith from '../payment-paid-with/payment-paid-with';
12
+ import { PaymentPaidWithRepository } from '../payment-paid-with/payment-paid-with.repository';
13
+
14
+ export default class Payment extends AccountSystemEntity {
15
+ private _PaymentId = 'New';
16
+ PaymentType: PaymentType;
17
+ PaymentDate: Date;
18
+ MethodTypeId: string;
19
+ Description = '';
20
+ Currency = 'MYR';
21
+ Amount = 0;
22
+ Status: PaymentStatus;
23
+ TransactionId: string;
24
+ TransactionApprovalCode: string;
25
+ TransactionAccountName: string;
26
+ TransactionAccountNo: string;
27
+ ReceivedBy = '';
28
+ IssuedBy = '';
29
+ UpdatedBy = '';
30
+ UpdatedAt: Date;
31
+ Remarks = '';
32
+ RelatedObjectId = '';
33
+ RelatedObjectType = '';
34
+ ReceiptDocNo = '';
35
+ protected _ObjectType: 'Payment';
36
+
37
+ private static _RepositoryBase = new PaymentRepository();
38
+ private static _PaymentItemRepository = new PaymentItemRepository();
39
+ private static _PaymentPaidWithRepository = new PaymentPaidWithRepository();
40
+
41
+ private _DbTransaction: any;
42
+ private _PaymentItems = [];
43
+ private _PaymentPaidWith = [];
44
+
45
+ paymentItemRepository: PaymentItemRepository;
46
+
47
+ public get PaymentId() {
48
+ return this._PaymentId;
49
+ }
50
+
51
+ get ObjectType() {
52
+ return this._ObjectType;
53
+ }
54
+
55
+ public set PaymentId(id: string) {
56
+ this._PaymentId = id;
57
+ }
58
+
59
+ /* AccountSystemEntity Implementation */
60
+ get RepositoryBase() {
61
+ return Payment._RepositoryBase;
62
+ }
63
+
64
+ /* ObjectBase Implementation */
65
+ get ObjectId() {
66
+ return this.PaymentId;
67
+ }
68
+
69
+ get ObjectName() {
70
+ return this.PaymentId;
71
+ }
72
+
73
+ get TableName() {
74
+ return 'finance_Payment';
75
+ }
76
+
77
+ constructor(dbTransaction?: any, paymentId?: string) {
78
+ super();
79
+ if (dbTransaction) {
80
+ this._DbTransaction = dbTransaction;
81
+ }
82
+ if (paymentId) {
83
+ this.PaymentId = paymentId;
84
+ }
85
+ }
86
+
87
+ static async initPayment(
88
+ dbTransaction: any,
89
+ paymentId: string,
90
+ ): Promise<Payment> {
91
+ try {
92
+ const paymentData = await this._RepositoryBase.findOne({
93
+ where: {
94
+ PaymentId: paymentId,
95
+ },
96
+ transaction: dbTransaction,
97
+ });
98
+ if (paymentData) {
99
+ const payment = new Payment(dbTransaction, paymentId);
100
+ payment.PaymentType = paymentData.PaymentType;
101
+ payment.PaymentDate = paymentData.PaymentDate;
102
+ payment.Description = paymentData.Description;
103
+ payment.Currency = paymentData.Currency;
104
+ payment.Amount = paymentData.Amount;
105
+ payment.Status = paymentData.Status;
106
+ payment.ReceivedBy = paymentData.ReceivedBy;
107
+ payment.IssuedBy = paymentData.IssuedBy;
108
+ payment.UpdatedAt = paymentData.UpdatedAt;
109
+ payment.UpdatedBy = paymentData.UpdatedBy;
110
+ payment.Remarks = paymentData.Remarks;
111
+ payment.RelatedObjectId = paymentData.RelatedObjectId;
112
+ payment.RelatedObjectType = paymentData.RelatedObjectType;
113
+ payment.ReceiptDocNo = paymentData.ReceiptDocNo;
114
+ payment.AccSystemRefId = paymentData.AccSystemRefId;
115
+ payment.PostedToAccSystemYN = paymentData.PostedToAccSystemYN;
116
+ payment.PostedById = paymentData.PostedById;
117
+ payment.PostedDateTime = paymentData.PostedDateTime;
118
+ return payment;
119
+ } else {
120
+ const notFoundError = new RecordNotFoundError(
121
+ 'PaymentErrMsg',
122
+ 'No Record Found.',
123
+ );
124
+ throw notFoundError;
125
+ }
126
+ } catch (error) {
127
+ console.log('Payment Class constructor err: ', error);
128
+ }
129
+ }
130
+
131
+ async getPaymentItems(dbTransaction?: any): Promise<PaymentItem[]> {
132
+ try {
133
+ if (this.PaymentId !== 'New') {
134
+ const paymentItems = await Payment._PaymentItemRepository.findAll({
135
+ where: {
136
+ PaymentId: this.PaymentId,
137
+ },
138
+ transaction: dbTransaction || this._DbTransaction,
139
+ });
140
+ const paymentItemObjects = paymentItems.map((paymentItem) => {
141
+ const pi = new PaymentItem(
142
+ new Payment(this._DbTransaction, paymentItem.PaymentId),
143
+ {
144
+ ObjectId: this.ObjectId,
145
+ ObjectName: this.ObjectName,
146
+ TableName: this.TableName,
147
+ ObjectType: this.ObjectType,
148
+ } as ObjectBase,
149
+ );
150
+ pi.PayForObjectType = paymentItem.PayForObjectType;
151
+ pi.PayForObjectId = paymentItem.PayForObjectId;
152
+ pi.Currency = paymentItem.Currency;
153
+ pi.Amount = paymentItem.Amount;
154
+ pi.Name = paymentItem.Name;
155
+ pi.Description = paymentItem.Description;
156
+
157
+ return pi;
158
+ });
159
+
160
+ this._PaymentItems = paymentItemObjects;
161
+ return this._PaymentItems;
162
+ } else {
163
+ return this._PaymentItems;
164
+ }
165
+ } catch (error) {
166
+ throw error;
167
+ }
168
+ }
169
+
170
+ async getPaymentPaidWith(dbTransaction?: any): Promise<PaymentPaidWith[]> {
171
+ try {
172
+ if (this.PaymentId !== 'New') {
173
+ const paymentPaidWithItems =
174
+ await Payment._PaymentPaidWithRepository.findAll({
175
+ where: {
176
+ PaymentId: this.PaymentId,
177
+ },
178
+ transaction: dbTransaction || this._DbTransaction,
179
+ });
180
+ const paymentPaidWithObjects = paymentPaidWithItems.map(
181
+ (paymentPaidWithItem) => {
182
+ const ppw = new PaymentPaidWith(
183
+ new Payment(this._DbTransaction, paymentPaidWithItem.PaymentId),
184
+ paymentPaidWithItem.MethodTypeId,
185
+ );
186
+
187
+ ppw.Currency = paymentPaidWithItem.Currency;
188
+ ppw.Amount = paymentPaidWithItem.Amount;
189
+ ppw.Status = paymentPaidWithItem.Status;
190
+ ppw.TransactionId = paymentPaidWithItem.TransactionId;
191
+ ppw.RefBank = paymentPaidWithItem.RefBank;
192
+ ppw.RefName = paymentPaidWithItem.RefName;
193
+ ppw.RefNo = paymentPaidWithItem.RefNo;
194
+ ppw.RefOther1 = paymentPaidWithItem.RefOther1;
195
+ ppw.RefOther2 = paymentPaidWithItem.RefOther2;
196
+ ppw.RefOther3 = paymentPaidWithItem.RefOther3;
197
+ ppw.RefOther4 = paymentPaidWithItem.RefOther4;
198
+ ppw.RefOther5 = paymentPaidWithItem.RefOther5;
199
+ ppw.Remarks = paymentPaidWithItem.Remarks;
200
+ ppw.PaymentMediaId = paymentPaidWithItem.PaymentMediaId;
201
+
202
+ return ppw;
203
+ },
204
+ );
205
+
206
+ this._PaymentPaidWith = paymentPaidWithObjects;
207
+ return this._PaymentPaidWith;
208
+ } else {
209
+ return this._PaymentPaidWith;
210
+ }
211
+ } catch (error) {
212
+ throw error;
213
+ }
214
+ }
215
+
216
+ newPaymentItem(objectBeingPaidFor: ObjectBase): PaymentItem {
217
+ const paymentItem = new PaymentItem(this, objectBeingPaidFor);
218
+ this._PaymentItems.push(paymentItem);
219
+ return paymentItem;
220
+ }
221
+
222
+ newPaymentPaidWith(paymentMethodTypeId: string) {
223
+ const paymentPaidWith = new PaymentPaidWith(
224
+ this,
225
+ paymentMethodTypeId,
226
+ this._DbTransaction,
227
+ );
228
+ this._PaymentPaidWith.push(paymentPaidWith);
229
+ return paymentPaidWith;
230
+ }
231
+
232
+ init(Params: IPaymentParams): void {
233
+ if (Params.Currency) this.Currency = Params.Currency;
234
+ if (Params.PaymentType) this.PaymentType = Params.PaymentType;
235
+ }
236
+ }
@@ -1,10 +1,10 @@
1
- export class IPaymentItemAttr {
2
- PaymentId: string;
3
- PayForObjectId: string;
4
- PayForObjectType: string;
5
- Currency: string;
6
- Amount: number;
7
- Name?: string;
8
- Description: string;
9
- Remarks?: string;
10
- }
1
+ export class IPaymentItemAttr {
2
+ PaymentId: string;
3
+ PayForObjectId: string;
4
+ PayForObjectType: string;
5
+ Currency: string;
6
+ Amount: number;
7
+ Name?: string;
8
+ Description: string;
9
+ Remarks?: string;
10
+ }
@@ -1,11 +1,11 @@
1
- import { RepositoryBase, IRepositoryBase } from '@tomei/general';
2
- import PaymentItemModel from '../models/payment-item.entity';
3
-
4
- export class PaymentItemRepository
5
- extends RepositoryBase<PaymentItemModel>
6
- implements IRepositoryBase<PaymentItemModel>
7
- {
8
- constructor() {
9
- super(PaymentItemModel);
10
- }
11
- }
1
+ import { RepositoryBase, IRepositoryBase } from '@tomei/general';
2
+ import PaymentItemModel from '../models/payment-item.entity';
3
+
4
+ export class PaymentItemRepository
5
+ extends RepositoryBase<PaymentItemModel>
6
+ implements IRepositoryBase<PaymentItemModel>
7
+ {
8
+ constructor() {
9
+ super(PaymentItemModel);
10
+ }
11
+ }