@things-factory/accounting 10.1.134 → 10.1.136
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-client/route.d.ts +1 -1
- package/dist-client/route.js +0 -12
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/index.d.ts +0 -1
- package/dist-server/index.js +0 -1
- package/dist-server/index.js.map +1 -1
- package/dist-server/service/account/account-history.d.ts +13 -6
- package/dist-server/service/account/account-history.js +44 -17
- package/dist-server/service/account/account-history.js.map +1 -1
- package/dist-server/service/account/account-mutation.js +2 -2
- package/dist-server/service/account/account-mutation.js.map +1 -1
- package/dist-server/service/account/account-query.d.ts +2 -0
- package/dist-server/service/account/account-query.js +12 -1
- package/dist-server/service/account/account-query.js.map +1 -1
- package/dist-server/service/account/account-type.d.ts +16 -0
- package/dist-server/service/account/account-type.js +71 -13
- package/dist-server/service/account/account-type.js.map +1 -1
- package/dist-server/service/account/account.d.ts +9 -3
- package/dist-server/service/account/account.js +34 -8
- package/dist-server/service/account/account.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category-mutation.js +2 -2
- package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category-query.d.ts +1 -0
- package/dist-server/service/accounting-category/accounting-category-query.js +10 -0
- package/dist-server/service/accounting-category/accounting-category-query.js.map +1 -1
- package/dist-server/service/accounting-document/accounting-document-mutation.js +12 -3
- package/dist-server/service/accounting-document/accounting-document-mutation.js.map +1 -1
- package/dist-server/service/accounting-document/accounting-document-query.js +2 -0
- package/dist-server/service/accounting-document/accounting-document-query.js.map +1 -1
- package/dist-server/service/bank-account/bank-account-history.d.ts +11 -14
- package/dist-server/service/bank-account/bank-account-history.js +46 -59
- package/dist-server/service/bank-account/bank-account-history.js.map +1 -1
- package/dist-server/service/bank-account/bank-account-mutation.d.ts +1 -2
- package/dist-server/service/bank-account/bank-account-mutation.js +25 -69
- package/dist-server/service/bank-account/bank-account-mutation.js.map +1 -1
- package/dist-server/service/bank-account/bank-account-query.js +3 -1
- package/dist-server/service/bank-account/bank-account-query.js.map +1 -1
- package/dist-server/service/bank-account/bank-account-service.d.ts +5 -0
- package/dist-server/service/bank-account/bank-account-service.js +21 -0
- package/dist-server/service/bank-account/bank-account-service.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-type.d.ts +13 -19
- package/dist-server/service/bank-account/bank-account-type.js +45 -69
- package/dist-server/service/bank-account/bank-account-type.js.map +1 -1
- package/dist-server/service/bank-account/bank-account.d.ts +14 -17
- package/dist-server/service/bank-account/bank-account.js +45 -57
- package/dist-server/service/bank-account/bank-account.js.map +1 -1
- package/dist-server/service/bank-statement/bank-statement-query.d.ts +14 -0
- package/dist-server/service/bank-statement/bank-statement-query.js +92 -0
- package/dist-server/service/bank-statement/bank-statement-query.js.map +1 -0
- package/dist-server/service/bank-statement/bank-statement.d.ts +26 -0
- package/dist-server/service/bank-statement/bank-statement.js +109 -0
- package/dist-server/service/bank-statement/bank-statement.js.map +1 -0
- package/dist-server/service/bank-statement/index.d.ts +5 -0
- package/dist-server/service/bank-statement/index.js +9 -0
- package/dist-server/service/bank-statement/index.js.map +1 -0
- package/dist-server/service/cash-flow-type.d.ts +5 -0
- package/dist-server/service/cash-flow-type.js +15 -0
- package/dist-server/service/cash-flow-type.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.js +10 -1
- package/dist-server/service/financial-institution/financial-institution-mutation.js.map +1 -1
- package/dist-server/service/financial-institution/financial-institution-query.js +14 -6
- package/dist-server/service/financial-institution/financial-institution-query.js.map +1 -1
- package/dist-server/service/financial-institution/index.d.ts +1 -1
- package/dist-server/service/financial-statement/financial-statement-history.d.ts +11 -9
- package/dist-server/service/financial-statement/financial-statement-history.js +47 -36
- package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-line.d.ts +24 -0
- package/dist-server/service/financial-statement/financial-statement-line.js +108 -0
- package/dist-server/service/financial-statement/financial-statement-line.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-mutation.d.ts +1 -8
- package/dist-server/service/financial-statement/financial-statement-mutation.js +10 -135
- package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-query.d.ts +14 -7
- package/dist-server/service/financial-statement/financial-statement-query.js +87 -31
- package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-service.d.ts +33 -0
- package/dist-server/service/financial-statement/financial-statement-service.js +44 -0
- package/dist-server/service/financial-statement/financial-statement-service.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement.d.ts +19 -11
- package/dist-server/service/financial-statement/financial-statement.js +73 -65
- package/dist-server/service/financial-statement/financial-statement.js.map +1 -1
- package/dist-server/service/financial-statement/index.d.ts +5 -4
- package/dist-server/service/financial-statement/index.js +3 -3
- package/dist-server/service/financial-statement/index.js.map +1 -1
- package/dist-server/service/index.d.ts +15 -3
- package/dist-server/service/index.js +30 -13
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/payment/index.d.ts +1 -0
- package/dist-server/service/payment/index.js +1 -0
- package/dist-server/service/payment/index.js.map +1 -1
- package/dist-server/service/payment/payment-history.d.ts +9 -16
- package/dist-server/service/payment/payment-history.js +36 -70
- package/dist-server/service/payment/payment-history.js.map +1 -1
- package/dist-server/service/payment/payment-mutation.d.ts +0 -1
- package/dist-server/service/payment/payment-mutation.js +14 -79
- package/dist-server/service/payment/payment-mutation.js.map +1 -1
- package/dist-server/service/payment/payment-query.d.ts +3 -0
- package/dist-server/service/payment/payment-query.js +30 -1
- package/dist-server/service/payment/payment-query.js.map +1 -1
- package/dist-server/service/payment/payment-service.d.ts +16 -0
- package/dist-server/service/payment/payment-service.js +140 -0
- package/dist-server/service/payment/payment-service.js.map +1 -0
- package/dist-server/service/payment/payment-targets.d.ts +31 -0
- package/dist-server/service/payment/payment-targets.js +19 -0
- package/dist-server/service/payment/payment-targets.js.map +1 -0
- package/dist-server/service/payment/payment-type.d.ts +13 -17
- package/dist-server/service/payment/payment-type.js +35 -51
- package/dist-server/service/payment/payment-type.js.map +1 -1
- package/dist-server/service/payment/payment.d.ts +23 -22
- package/dist-server/service/payment/payment.js +66 -94
- package/dist-server/service/payment/payment.js.map +1 -1
- package/dist-server/service/payment/transfer-target.d.ts +1 -0
- package/dist-server/service/payment/transfer-target.js +43 -0
- package/dist-server/service/payment/transfer-target.js.map +1 -0
- package/dist-server/service/recurring-cash-item/index.d.ts +6 -0
- package/dist-server/service/recurring-cash-item/index.js +10 -0
- package/dist-server/service/recurring-cash-item/index.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.d.ts +7 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.js +63 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-query.d.ts +15 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-query.js +101 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-query.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-service.d.ts +23 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-service.js +91 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-service.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-type.d.ts +23 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-type.js +85 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-type.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item.d.ts +35 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item.js +142 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-schedule.d.ts +36 -0
- package/dist-server/service/recurring-cash-item/recurring-schedule.js +41 -0
- package/dist-server/service/recurring-cash-item/recurring-schedule.js.map +1 -0
- package/dist-server/service/transaction/transaction-history.d.ts +42 -15
- package/dist-server/service/transaction/transaction-history.js +160 -54
- package/dist-server/service/transaction/transaction-history.js.map +1 -1
- package/dist-server/service/transaction/transaction-mutation.d.ts +0 -1
- package/dist-server/service/transaction/transaction-mutation.js +13 -78
- package/dist-server/service/transaction/transaction-mutation.js.map +1 -1
- package/dist-server/service/transaction/transaction-period.d.ts +16 -0
- package/dist-server/service/transaction/transaction-period.js +49 -0
- package/dist-server/service/transaction/transaction-period.js.map +1 -0
- package/dist-server/service/transaction/transaction-query.d.ts +12 -0
- package/dist-server/service/transaction/transaction-query.js +84 -2
- package/dist-server/service/transaction/transaction-query.js.map +1 -1
- package/dist-server/service/transaction/transaction-service.d.ts +30 -0
- package/dist-server/service/transaction/transaction-service.js +130 -0
- package/dist-server/service/transaction/transaction-service.js.map +1 -0
- package/dist-server/service/transaction/transaction-type.d.ts +39 -7
- package/dist-server/service/transaction/transaction-type.js +145 -23
- package/dist-server/service/transaction/transaction-type.js.map +1 -1
- package/dist-server/service/transaction/transaction.d.ts +58 -31
- package/dist-server/service/transaction/transaction.js +216 -102
- package/dist-server/service/transaction/transaction.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -3
- package/things-factory.config.js +0 -4
- package/translations/en.json +34 -2
- package/translations/ja.json +0 -1
- package/translations/ko.json +34 -2
- package/translations/ms.json +0 -1
- package/translations/zh.json +0 -1
- package/dist-client/pages/account/account-importer.d.ts +0 -22
- package/dist-client/pages/account/account-importer.js +0 -99
- package/dist-client/pages/account/account-importer.js.map +0 -1
- package/dist-client/pages/account/account-list-page.d.ts +0 -57
- package/dist-client/pages/account/account-list-page.js +0 -306
- package/dist-client/pages/account/account-list-page.js.map +0 -1
- package/dist-client/pages/bank-account/bank-account-importer.d.ts +0 -23
- package/dist-client/pages/bank-account/bank-account-importer.js +0 -92
- package/dist-client/pages/bank-account/bank-account-importer.js.map +0 -1
- package/dist-client/pages/bank-account/bank-account-list-page.d.ts +0 -60
- package/dist-client/pages/bank-account/bank-account-list-page.js +0 -317
- package/dist-client/pages/bank-account/bank-account-list-page.js.map +0 -1
- package/dist-client/pages/financial-statement/financial-statement-importer.d.ts +0 -22
- package/dist-client/pages/financial-statement/financial-statement-importer.js +0 -99
- package/dist-client/pages/financial-statement/financial-statement-importer.js.map +0 -1
- package/dist-client/pages/financial-statement/financial-statement-list-page.d.ts +0 -57
- package/dist-client/pages/financial-statement/financial-statement-list-page.js +0 -280
- package/dist-client/pages/financial-statement/financial-statement-list-page.js.map +0 -1
- package/dist-client/pages/income-statement/income-statement-importer.d.ts +0 -22
- package/dist-client/pages/income-statement/income-statement-importer.js +0 -99
- package/dist-client/pages/income-statement/income-statement-importer.js.map +0 -1
- package/dist-client/pages/income-statement/income-statement-list-page.d.ts +0 -57
- package/dist-client/pages/income-statement/income-statement-list-page.js +0 -280
- package/dist-client/pages/income-statement/income-statement-list-page.js.map +0 -1
- package/dist-client/pages/payment/payment-importer.d.ts +0 -23
- package/dist-client/pages/payment/payment-importer.js +0 -92
- package/dist-client/pages/payment/payment-importer.js.map +0 -1
- package/dist-client/pages/payment/payment-list-page.d.ts +0 -60
- package/dist-client/pages/payment/payment-list-page.js +0 -317
- package/dist-client/pages/payment/payment-list-page.js.map +0 -1
- package/dist-client/pages/transaction/transaction-importer.d.ts +0 -22
- package/dist-client/pages/transaction/transaction-importer.js +0 -99
- package/dist-client/pages/transaction/transaction-importer.js.map +0 -1
- package/dist-client/pages/transaction/transaction-list-page.d.ts +0 -57
- package/dist-client/pages/transaction/transaction-list-page.js +0 -280
- package/dist-client/pages/transaction/transaction-list-page.js.map +0 -1
- package/dist-server/controllers/index.d.ts +0 -1
- package/dist-server/controllers/index.js +0 -5
- package/dist-server/controllers/index.js.map +0 -1
- package/dist-server/controllers/summary-statements.d.ts +0 -4
- package/dist-server/controllers/summary-statements.js +0 -149
- package/dist-server/controllers/summary-statements.js.map +0 -1
- package/dist-server/migrations/1725201567284-seed-country-codes.d.ts +0 -5
- package/dist-server/migrations/1725201567284-seed-country-codes.js +0 -255
- package/dist-server/migrations/1725201567284-seed-country-codes.js.map +0 -1
- package/dist-server/service/financial-statement/financial-statement-line-item.d.ts +0 -19
- package/dist-server/service/financial-statement/financial-statement-line-item.js +0 -95
- package/dist-server/service/financial-statement/financial-statement-line-item.js.map +0 -1
- package/dist-server/service/financial-statement/financial-statement-type.d.ts +0 -20
- package/dist-server/service/financial-statement/financial-statement-type.js +0 -77
- package/dist-server/service/financial-statement/financial-statement-type.js.map +0 -1
- package/dist-server/service/income-statement/event-subscriber.d.ts +0 -7
- package/dist-server/service/income-statement/event-subscriber.js +0 -21
- package/dist-server/service/income-statement/event-subscriber.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-history.d.ts +0 -28
- package/dist-server/service/income-statement/income-statement-history.js +0 -146
- package/dist-server/service/income-statement/income-statement-history.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-line-item.d.ts +0 -19
- package/dist-server/service/income-statement/income-statement-line-item.js +0 -97
- package/dist-server/service/income-statement/income-statement-line-item.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-mutation.d.ts +0 -10
- package/dist-server/service/income-statement/income-statement-mutation.js +0 -159
- package/dist-server/service/income-statement/income-statement-mutation.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-query.d.ts +0 -11
- package/dist-server/service/income-statement/income-statement-query.js +0 -81
- package/dist-server/service/income-statement/income-statement-query.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-type.d.ts +0 -20
- package/dist-server/service/income-statement/income-statement-type.js +0 -77
- package/dist-server/service/income-statement/income-statement-type.js.map +0 -1
- package/dist-server/service/income-statement/income-statement.d.ts +0 -28
- package/dist-server/service/income-statement/income-statement.js +0 -137
- package/dist-server/service/income-statement/income-statement.js.map +0 -1
- package/dist-server/service/income-statement/index.d.ts +0 -8
- package/dist-server/service/income-statement/index.js +0 -13
- package/dist-server/service/income-statement/index.js.map +0 -1
|
@@ -9,106 +9,90 @@ let NewPayment = class NewPayment {
|
|
|
9
9
|
};
|
|
10
10
|
exports.NewPayment = NewPayment;
|
|
11
11
|
tslib_1.__decorate([
|
|
12
|
-
(0, type_graphql_1.Field)(type => shell_1.ObjectRef),
|
|
12
|
+
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { description: 'The transaction a part of which this is' }),
|
|
13
13
|
tslib_1.__metadata("design:type", shell_1.ObjectRef)
|
|
14
14
|
], NewPayment.prototype, "transaction", void 0);
|
|
15
15
|
tslib_1.__decorate([
|
|
16
|
-
(0, type_graphql_1.Field)({
|
|
16
|
+
(0, type_graphql_1.Field)({ description: 'The kind of what was paid, as registered' }),
|
|
17
17
|
tslib_1.__metadata("design:type", String)
|
|
18
|
-
], NewPayment.prototype, "
|
|
18
|
+
], NewPayment.prototype, "targetType", void 0);
|
|
19
19
|
tslib_1.__decorate([
|
|
20
|
-
(0, type_graphql_1.Field)({
|
|
20
|
+
(0, type_graphql_1.Field)({ description: 'The id of what was paid' }),
|
|
21
|
+
tslib_1.__metadata("design:type", String)
|
|
22
|
+
], NewPayment.prototype, "targetId", void 0);
|
|
23
|
+
tslib_1.__decorate([
|
|
24
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { description: 'The part of the transaction put on the target' }),
|
|
21
25
|
tslib_1.__metadata("design:type", Number)
|
|
22
26
|
], NewPayment.prototype, "amount", void 0);
|
|
23
27
|
tslib_1.__decorate([
|
|
24
|
-
(0, type_graphql_1.Field)({ nullable:
|
|
25
|
-
tslib_1.__metadata("design:type", Date)
|
|
26
|
-
], NewPayment.prototype, "paidAt", void 0);
|
|
27
|
-
tslib_1.__decorate([
|
|
28
|
-
(0, type_graphql_1.Field)(type => payment_1.PaymentDirection),
|
|
28
|
+
(0, type_graphql_1.Field)(type => payment_1.PaymentMethod, { nullable: true, description: 'Who made the link - a person when not given' }),
|
|
29
29
|
tslib_1.__metadata("design:type", String)
|
|
30
|
-
], NewPayment.prototype, "
|
|
30
|
+
], NewPayment.prototype, "method", void 0);
|
|
31
31
|
tslib_1.__decorate([
|
|
32
|
-
(0, type_graphql_1.Field)(
|
|
32
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Why a rule made the link' }),
|
|
33
33
|
tslib_1.__metadata("design:type", String)
|
|
34
|
-
], NewPayment.prototype, "
|
|
35
|
-
tslib_1.__decorate([
|
|
36
|
-
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true, description: 'Source bank account for the payment' }),
|
|
37
|
-
tslib_1.__metadata("design:type", shell_1.ObjectRef)
|
|
38
|
-
], NewPayment.prototype, "sourceBankAccount", void 0);
|
|
39
|
-
tslib_1.__decorate([
|
|
40
|
-
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true, description: 'Destination bank account for the payment' }),
|
|
41
|
-
tslib_1.__metadata("design:type", shell_1.ObjectRef)
|
|
42
|
-
], NewPayment.prototype, "destinationBankAccount", void 0);
|
|
34
|
+
], NewPayment.prototype, "basis", void 0);
|
|
43
35
|
tslib_1.__decorate([
|
|
44
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
36
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Notes' }),
|
|
45
37
|
tslib_1.__metadata("design:type", String)
|
|
46
|
-
], NewPayment.prototype, "
|
|
38
|
+
], NewPayment.prototype, "notes", void 0);
|
|
47
39
|
exports.NewPayment = NewPayment = tslib_1.__decorate([
|
|
48
|
-
(0, type_graphql_1.InputType)()
|
|
40
|
+
(0, type_graphql_1.InputType)({ description: 'A new part of a transaction put on what it paid' })
|
|
49
41
|
], NewPayment);
|
|
50
42
|
let PaymentPatch = class PaymentPatch {
|
|
51
43
|
};
|
|
52
44
|
exports.PaymentPatch = PaymentPatch;
|
|
53
45
|
tslib_1.__decorate([
|
|
54
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
46
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The payment to change or delete' }),
|
|
55
47
|
tslib_1.__metadata("design:type", String)
|
|
56
48
|
], PaymentPatch.prototype, "id", void 0);
|
|
57
49
|
tslib_1.__decorate([
|
|
58
|
-
(0, type_graphql_1.Field)(type => shell_1.ObjectRef),
|
|
50
|
+
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true, description: 'The transaction a part of which this is' }),
|
|
59
51
|
tslib_1.__metadata("design:type", shell_1.ObjectRef)
|
|
60
52
|
], PaymentPatch.prototype, "transaction", void 0);
|
|
61
53
|
tslib_1.__decorate([
|
|
62
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
54
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The kind of what was paid, as registered' }),
|
|
63
55
|
tslib_1.__metadata("design:type", String)
|
|
64
|
-
], PaymentPatch.prototype, "
|
|
56
|
+
], PaymentPatch.prototype, "targetType", void 0);
|
|
65
57
|
tslib_1.__decorate([
|
|
66
|
-
(0, type_graphql_1.Field)({ nullable:
|
|
58
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The id of what was paid' }),
|
|
59
|
+
tslib_1.__metadata("design:type", String)
|
|
60
|
+
], PaymentPatch.prototype, "targetId", void 0);
|
|
61
|
+
tslib_1.__decorate([
|
|
62
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'The part of the transaction put on the target' }),
|
|
67
63
|
tslib_1.__metadata("design:type", Number)
|
|
68
64
|
], PaymentPatch.prototype, "amount", void 0);
|
|
69
65
|
tslib_1.__decorate([
|
|
70
|
-
(0, type_graphql_1.Field)({ nullable:
|
|
71
|
-
tslib_1.__metadata("design:type", Date)
|
|
72
|
-
], PaymentPatch.prototype, "paidAt", void 0);
|
|
73
|
-
tslib_1.__decorate([
|
|
74
|
-
(0, type_graphql_1.Field)(type => payment_1.PaymentDirection),
|
|
66
|
+
(0, type_graphql_1.Field)(type => payment_1.PaymentMethod, { nullable: true, description: 'Who made the link' }),
|
|
75
67
|
tslib_1.__metadata("design:type", String)
|
|
76
|
-
], PaymentPatch.prototype, "
|
|
68
|
+
], PaymentPatch.prototype, "method", void 0);
|
|
77
69
|
tslib_1.__decorate([
|
|
78
|
-
(0, type_graphql_1.Field)(
|
|
70
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Why a rule made the link' }),
|
|
79
71
|
tslib_1.__metadata("design:type", String)
|
|
80
|
-
], PaymentPatch.prototype, "
|
|
81
|
-
tslib_1.__decorate([
|
|
82
|
-
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true, description: 'Source bank account for the payment' }),
|
|
83
|
-
tslib_1.__metadata("design:type", shell_1.ObjectRef)
|
|
84
|
-
], PaymentPatch.prototype, "sourceBankAccount", void 0);
|
|
85
|
-
tslib_1.__decorate([
|
|
86
|
-
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true, description: 'Destination bank account for the payment' }),
|
|
87
|
-
tslib_1.__metadata("design:type", shell_1.ObjectRef)
|
|
88
|
-
], PaymentPatch.prototype, "destinationBankAccount", void 0);
|
|
72
|
+
], PaymentPatch.prototype, "basis", void 0);
|
|
89
73
|
tslib_1.__decorate([
|
|
90
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
74
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Notes' }),
|
|
91
75
|
tslib_1.__metadata("design:type", String)
|
|
92
|
-
], PaymentPatch.prototype, "
|
|
76
|
+
], PaymentPatch.prototype, "notes", void 0);
|
|
93
77
|
tslib_1.__decorate([
|
|
94
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
78
|
+
(0, type_graphql_1.Field)({ nullable: true, description: '+ adds, M changes, - deletes' }),
|
|
95
79
|
tslib_1.__metadata("design:type", String)
|
|
96
80
|
], PaymentPatch.prototype, "cuFlag", void 0);
|
|
97
81
|
exports.PaymentPatch = PaymentPatch = tslib_1.__decorate([
|
|
98
|
-
(0, type_graphql_1.InputType)()
|
|
82
|
+
(0, type_graphql_1.InputType)({ description: 'A change to a payment, or a grid row: cuFlag + adds, M changes, - deletes' })
|
|
99
83
|
], PaymentPatch);
|
|
100
84
|
let PaymentList = class PaymentList {
|
|
101
85
|
};
|
|
102
86
|
exports.PaymentList = PaymentList;
|
|
103
87
|
tslib_1.__decorate([
|
|
104
|
-
(0, type_graphql_1.Field)(type => [payment_1.Payment]),
|
|
88
|
+
(0, type_graphql_1.Field)(type => [payment_1.Payment], { description: 'The payments on this page' }),
|
|
105
89
|
tslib_1.__metadata("design:type", Array)
|
|
106
90
|
], PaymentList.prototype, "items", void 0);
|
|
107
91
|
tslib_1.__decorate([
|
|
108
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
92
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'How many there are in all' }),
|
|
109
93
|
tslib_1.__metadata("design:type", Number)
|
|
110
94
|
], PaymentList.prototype, "total", void 0);
|
|
111
95
|
exports.PaymentList = PaymentList = tslib_1.__decorate([
|
|
112
|
-
(0, type_graphql_1.ObjectType)()
|
|
96
|
+
(0, type_graphql_1.ObjectType)({ description: 'A page of payments' })
|
|
113
97
|
], PaymentList);
|
|
114
98
|
//# sourceMappingURL=payment-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-type.js","sourceRoot":"","sources":["../../../server/service/payment/payment-type.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"payment-type.js","sourceRoot":"","sources":["../../../server/service/payment/payment-type.ts"],"names":[],"mappings":";;;;AAAA,+CAA2E;AAE3E,iDAAiD;AAEjD,uCAAkD;AAG3C,IAAM,UAAU,GAAhB,MAAM,UAAU;CAqBtB,CAAA;AArBY,gCAAU;AAErB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,EAAE,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;sCACxE,iBAAS;+CAAA;AAGtB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,E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jD;AAGjB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC;;4CACxF;AAGf;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,uBAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;;4CAC7D;AAGtB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,0BAA0B,EAAE,CAAC;;2CACrD;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;;2CAClC;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;;4CACxD;uBA1BJ,YAAY;IADxB,IAAA,wBAAS,EAAC,EAAE,WAAW,EAAE,2EAA2E,EAAE,CAAC;GAC3F,YAAY,CA2BxB;AAGM,IAAM,WAAW,GAAjB,MAAM,WAAW;CAMvB,CAAA;AANY,kCAAW;AAEtB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,iBAAO,CAAC,EAAE,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;;0CACvD;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;;0CACpD;sBALF,WAAW;IADvB,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;GACrC,WAAW,CAMvB","sourcesContent":["import { ObjectType, Field, Float, InputType, Int, ID } from 'type-graphql'\n\nimport { ObjectRef } from '@things-factory/shell'\n\nimport { Payment, PaymentMethod } from './payment'\n\n@InputType({ description: 'A new part of a transaction put on what it paid' })\nexport class NewPayment {\n @Field(type => ObjectRef, { description: 'The transaction a part of which this is' })\n transaction: ObjectRef\n\n @Field({ description: 'The kind of what was paid, as registered' })\n targetType: string\n\n @Field({ description: 'The id of what was paid' })\n targetId: string\n\n @Field(type => Float, { description: 'The part of the transaction put on the target' })\n amount: number\n\n @Field(type => PaymentMethod, { nullable: true, description: 'Who made the link - a person when not given' })\n method?: PaymentMethod\n\n @Field({ nullable: true, description: 'Why a rule made the link' })\n basis?: string\n\n @Field({ nullable: true, description: 'Notes' })\n notes?: string\n}\n\n@InputType({ description: 'A change to a payment, or a grid row: cuFlag + adds, M changes, - deletes' })\nexport class PaymentPatch {\n @Field(type => ID, { nullable: true, description: 'The payment to change or delete' })\n id?: string\n\n @Field(type => ObjectRef, { nullable: true, description: 'The transaction a part of which this is' })\n transaction?: ObjectRef\n\n @Field({ nullable: true, description: 'The kind of what was paid, as registered' })\n targetType?: string\n\n @Field({ nullable: true, description: 'The id of what was paid' })\n targetId?: string\n\n @Field(type => Float, { nullable: true, description: 'The part of the transaction put on the target' })\n amount?: number\n\n @Field(type => PaymentMethod, { nullable: true, description: 'Who made the link' })\n method?: PaymentMethod\n\n @Field({ nullable: true, description: 'Why a rule made the link' })\n basis?: string\n\n @Field({ nullable: true, description: 'Notes' })\n notes?: string\n\n @Field({ nullable: true, description: '+ adds, M changes, - deletes' })\n cuFlag?: string\n}\n\n@ObjectType({ description: 'A page of payments' })\nexport class PaymentList {\n @Field(type => [Payment], { description: 'The payments on this page' })\n items: Payment[]\n\n @Field(type => Int, { description: 'How many there are in all' })\n total: number\n}\n"]}
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
import { Domain } from '@things-factory/shell';
|
|
2
2
|
import { User } from '@things-factory/auth-base';
|
|
3
3
|
import { Transaction } from '../transaction/transaction';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export declare enum PaymentPurpose {
|
|
5
|
+
SETTLEMENT = "SETTLEMENT",
|
|
6
|
+
EVIDENCE = "EVIDENCE",
|
|
7
|
+
TRANSFER = "TRANSFER"
|
|
8
8
|
}
|
|
9
|
-
export declare enum
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
CreditCard = "CreditCard",// 신용카드
|
|
13
|
-
DebitCard = "DebitCard"
|
|
9
|
+
export declare enum PaymentMethod {
|
|
10
|
+
RULE = "RULE",
|
|
11
|
+
PERSON = "PERSON"
|
|
14
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* What a transaction paid: a part of it, put on one target - a contract round, a tax invoice, a VAT period, the other
|
|
15
|
+
* line of a transfer between our own accounts. One transaction may pay several targets, and one target be paid by
|
|
16
|
+
* several transactions.
|
|
17
|
+
*
|
|
18
|
+
* The kinds of target are registered by the apps that own them (§`registerPaymentTarget`), each with its purpose.
|
|
19
|
+
* Within one purpose the payments of a transaction add up to no more than the transaction; across purposes the same
|
|
20
|
+
* money is told twice - a deposit settles a round and is evidenced by that round's tax invoice.
|
|
21
|
+
*/
|
|
15
22
|
export declare class Payment {
|
|
16
23
|
readonly id: string;
|
|
17
24
|
version?: number;
|
|
18
25
|
domain?: Domain;
|
|
19
26
|
domainId?: string;
|
|
20
27
|
transaction: Transaction;
|
|
21
|
-
transactionId
|
|
22
|
-
|
|
28
|
+
transactionId?: string;
|
|
29
|
+
targetType: string;
|
|
30
|
+
targetId: string;
|
|
23
31
|
amount: number;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
destinationBankAccountId?: string;
|
|
29
|
-
year?: number;
|
|
30
|
-
quarter?: number;
|
|
31
|
-
month?: number;
|
|
32
|
-
paidAt: Date;
|
|
33
|
-
direction: PaymentDirection;
|
|
34
|
-
note?: string;
|
|
32
|
+
purpose: PaymentPurpose;
|
|
33
|
+
method: PaymentMethod;
|
|
34
|
+
basis?: string;
|
|
35
|
+
notes?: string;
|
|
35
36
|
createdAt?: Date;
|
|
36
37
|
updatedAt?: Date;
|
|
37
38
|
deletedAt?: Date;
|
|
@@ -1,36 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Payment = exports.
|
|
3
|
+
exports.Payment = exports.PaymentMethod = exports.PaymentPurpose = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const typeorm_1 = require("typeorm");
|
|
6
6
|
const type_graphql_1 = require("type-graphql");
|
|
7
7
|
const shell_1 = require("@things-factory/shell");
|
|
8
8
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
9
|
const transaction_1 = require("../transaction/transaction");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
})(
|
|
16
|
-
(0, type_graphql_1.registerEnumType)(
|
|
17
|
-
name: '
|
|
18
|
-
description: '
|
|
10
|
+
var PaymentPurpose;
|
|
11
|
+
(function (PaymentPurpose) {
|
|
12
|
+
PaymentPurpose["SETTLEMENT"] = "SETTLEMENT";
|
|
13
|
+
PaymentPurpose["EVIDENCE"] = "EVIDENCE";
|
|
14
|
+
PaymentPurpose["TRANSFER"] = "TRANSFER";
|
|
15
|
+
})(PaymentPurpose || (exports.PaymentPurpose = PaymentPurpose = {}));
|
|
16
|
+
(0, type_graphql_1.registerEnumType)(PaymentPurpose, {
|
|
17
|
+
name: 'PaymentPurpose',
|
|
18
|
+
description: 'What a payment tells of its transaction - the business document it settled, the document that evidences it, or the matching line of a move between our own accounts'
|
|
19
19
|
});
|
|
20
|
-
var
|
|
21
|
-
(function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
name: 'PaymentType',
|
|
29
|
-
description: 'Type of the payment (e.g., Transfer, Cash, CreditCard, DebitCard)' // 결제 유형을 나타냅니다
|
|
20
|
+
var PaymentMethod;
|
|
21
|
+
(function (PaymentMethod) {
|
|
22
|
+
PaymentMethod["RULE"] = "RULE";
|
|
23
|
+
PaymentMethod["PERSON"] = "PERSON";
|
|
24
|
+
})(PaymentMethod || (exports.PaymentMethod = PaymentMethod = {}));
|
|
25
|
+
(0, type_graphql_1.registerEnumType)(PaymentMethod, {
|
|
26
|
+
name: 'PaymentMethod',
|
|
27
|
+
description: 'Who made the link - a rule of the app, or a person'
|
|
30
28
|
});
|
|
29
|
+
/**
|
|
30
|
+
* What a transaction paid: a part of it, put on one target - a contract round, a tax invoice, a VAT period, the other
|
|
31
|
+
* line of a transfer between our own accounts. One transaction may pay several targets, and one target be paid by
|
|
32
|
+
* several transactions.
|
|
33
|
+
*
|
|
34
|
+
* The kinds of target are registered by the apps that own them (§`registerPaymentTarget`), each with its purpose.
|
|
35
|
+
* Within one purpose the payments of a transaction add up to no more than the transaction; across purposes the same
|
|
36
|
+
* money is told twice - a deposit settles a round and is evidenced by that round's tax invoice.
|
|
37
|
+
*/
|
|
31
38
|
let Payment = class Payment {
|
|
32
39
|
constructor() {
|
|
33
|
-
this.version = 1;
|
|
40
|
+
this.version = 1;
|
|
34
41
|
}
|
|
35
42
|
};
|
|
36
43
|
exports.Payment = Payment;
|
|
@@ -46,111 +53,78 @@ tslib_1.__decorate([
|
|
|
46
53
|
], Payment.prototype, "version", void 0);
|
|
47
54
|
tslib_1.__decorate([
|
|
48
55
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
49
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'The domain to which this payment belongs' }),
|
|
50
|
-
tslib_1.__metadata("design:type", shell_1.Domain
|
|
51
|
-
)
|
|
56
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain to which this payment belongs' }),
|
|
57
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
52
58
|
], Payment.prototype, "domain", void 0);
|
|
53
59
|
tslib_1.__decorate([
|
|
54
60
|
(0, typeorm_1.RelationId)((payment) => payment.domain),
|
|
55
61
|
tslib_1.__metadata("design:type", String)
|
|
56
62
|
], Payment.prototype, "domainId", void 0);
|
|
57
63
|
tslib_1.__decorate([
|
|
58
|
-
(0, typeorm_1.ManyToOne)(type => transaction_1.Transaction, transaction => transaction.payments),
|
|
59
|
-
(0, type_graphql_1.Field)(type => transaction_1.Transaction, { description: 'The transaction
|
|
60
|
-
tslib_1.__metadata("design:type", transaction_1.Transaction
|
|
61
|
-
)
|
|
64
|
+
(0, typeorm_1.ManyToOne)(type => transaction_1.Transaction, transaction => transaction.payments, { nullable: false }),
|
|
65
|
+
(0, type_graphql_1.Field)(type => transaction_1.Transaction, { description: 'The transaction a part of which this is' }),
|
|
66
|
+
tslib_1.__metadata("design:type", transaction_1.Transaction)
|
|
62
67
|
], Payment.prototype, "transaction", void 0);
|
|
63
68
|
tslib_1.__decorate([
|
|
64
69
|
(0, typeorm_1.RelationId)((payment) => payment.transaction),
|
|
65
70
|
tslib_1.__metadata("design:type", String)
|
|
66
71
|
], Payment.prototype, "transactionId", void 0);
|
|
67
72
|
tslib_1.__decorate([
|
|
68
|
-
(0, typeorm_1.Column)(
|
|
69
|
-
(0, type_graphql_1.Field)({
|
|
73
|
+
(0, typeorm_1.Column)(),
|
|
74
|
+
(0, type_graphql_1.Field)({ description: 'The kind of what was paid, as registered - ContractMilestone, TaxInvoice, Transaction' }),
|
|
70
75
|
tslib_1.__metadata("design:type", String)
|
|
71
|
-
], Payment.prototype, "
|
|
76
|
+
], Payment.prototype, "targetType", void 0);
|
|
72
77
|
tslib_1.__decorate([
|
|
73
|
-
(0, typeorm_1.Column)(
|
|
74
|
-
(0, type_graphql_1.Field)({
|
|
75
|
-
tslib_1.__metadata("design:type", Number)
|
|
76
|
-
], Payment.prototype, "amount", void 0);
|
|
77
|
-
tslib_1.__decorate([
|
|
78
|
-
(0, typeorm_1.Column)({ nullable: false }),
|
|
79
|
-
(0, type_graphql_1.Field)(type => PaymentType, { description: 'Type of the payment' }),
|
|
78
|
+
(0, typeorm_1.Column)(),
|
|
79
|
+
(0, type_graphql_1.Field)({ description: 'The id of what was paid' }),
|
|
80
80
|
tslib_1.__metadata("design:type", String)
|
|
81
|
-
], Payment.prototype, "
|
|
81
|
+
], Payment.prototype, "targetId", void 0);
|
|
82
82
|
tslib_1.__decorate([
|
|
83
|
-
(0, typeorm_1.
|
|
84
|
-
(0, type_graphql_1.Field)(type =>
|
|
85
|
-
tslib_1.__metadata("design:type",
|
|
86
|
-
], Payment.prototype, "
|
|
83
|
+
(0, typeorm_1.Column)((0, shell_1.moneyColumn)()),
|
|
84
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { description: "The part of the transaction put on the target, in the transaction's currency" }),
|
|
85
|
+
tslib_1.__metadata("design:type", Number)
|
|
86
|
+
], Payment.prototype, "amount", void 0);
|
|
87
87
|
tslib_1.__decorate([
|
|
88
|
-
(0, typeorm_1.
|
|
88
|
+
(0, typeorm_1.Column)(),
|
|
89
|
+
(0, type_graphql_1.Field)(type => PaymentPurpose, {
|
|
90
|
+
description: "What the payment tells of the transaction - the target kind's purpose"
|
|
91
|
+
}),
|
|
89
92
|
tslib_1.__metadata("design:type", String)
|
|
90
|
-
], Payment.prototype, "
|
|
93
|
+
], Payment.prototype, "purpose", void 0);
|
|
91
94
|
tslib_1.__decorate([
|
|
92
|
-
(0, typeorm_1.
|
|
93
|
-
(0, type_graphql_1.Field)(type =>
|
|
94
|
-
tslib_1.__metadata("design:type", bank_account_1.BankAccount)
|
|
95
|
-
], Payment.prototype, "destinationBankAccount", void 0);
|
|
96
|
-
tslib_1.__decorate([
|
|
97
|
-
(0, typeorm_1.RelationId)((payment) => payment.destinationBankAccount),
|
|
95
|
+
(0, typeorm_1.Column)({ default: PaymentMethod.PERSON }),
|
|
96
|
+
(0, type_graphql_1.Field)(type => PaymentMethod, { description: 'Who made the link' }),
|
|
98
97
|
tslib_1.__metadata("design:type", String)
|
|
99
|
-
], Payment.prototype, "
|
|
100
|
-
tslib_1.__decorate([
|
|
101
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
102
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal year in which the payment was made' }),
|
|
103
|
-
tslib_1.__metadata("design:type", Number)
|
|
104
|
-
], Payment.prototype, "year", void 0);
|
|
105
|
-
tslib_1.__decorate([
|
|
106
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
107
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal quarter in which the payment was made' }),
|
|
108
|
-
tslib_1.__metadata("design:type", Number)
|
|
109
|
-
], Payment.prototype, "quarter", void 0);
|
|
110
|
-
tslib_1.__decorate([
|
|
111
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
112
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal month in which the payment was made' }),
|
|
113
|
-
tslib_1.__metadata("design:type", Number)
|
|
114
|
-
], Payment.prototype, "month", void 0);
|
|
115
|
-
tslib_1.__decorate([
|
|
116
|
-
(0, typeorm_1.Column)({ nullable: false }),
|
|
117
|
-
(0, type_graphql_1.Field)({ nullable: false, description: 'The date and time when the payment was made' }),
|
|
118
|
-
tslib_1.__metadata("design:type", Date // 결제가 이루어진 날짜 및 시간
|
|
119
|
-
)
|
|
120
|
-
], Payment.prototype, "paidAt", void 0);
|
|
98
|
+
], Payment.prototype, "method", void 0);
|
|
121
99
|
tslib_1.__decorate([
|
|
122
|
-
(0, typeorm_1.Column)({ nullable:
|
|
123
|
-
(0, type_graphql_1.Field)(
|
|
100
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
101
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Why a rule made the link - what matched' }),
|
|
124
102
|
tslib_1.__metadata("design:type", String)
|
|
125
|
-
], Payment.prototype, "
|
|
103
|
+
], Payment.prototype, "basis", void 0);
|
|
126
104
|
tslib_1.__decorate([
|
|
127
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
128
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
105
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
106
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Notes' }),
|
|
129
107
|
tslib_1.__metadata("design:type", String)
|
|
130
|
-
], Payment.prototype, "
|
|
108
|
+
], Payment.prototype, "notes", void 0);
|
|
131
109
|
tslib_1.__decorate([
|
|
132
110
|
(0, typeorm_1.CreateDateColumn)(),
|
|
133
111
|
(0, type_graphql_1.Field)({ nullable: true, description: 'The date and time when the payment record was created' }),
|
|
134
|
-
tslib_1.__metadata("design:type", Date
|
|
135
|
-
)
|
|
112
|
+
tslib_1.__metadata("design:type", Date)
|
|
136
113
|
], Payment.prototype, "createdAt", void 0);
|
|
137
114
|
tslib_1.__decorate([
|
|
138
115
|
(0, typeorm_1.UpdateDateColumn)(),
|
|
139
116
|
(0, type_graphql_1.Field)({ nullable: true, description: 'The date and time when the payment record was last updated' }),
|
|
140
|
-
tslib_1.__metadata("design:type", Date
|
|
141
|
-
)
|
|
117
|
+
tslib_1.__metadata("design:type", Date)
|
|
142
118
|
], Payment.prototype, "updatedAt", void 0);
|
|
143
119
|
tslib_1.__decorate([
|
|
144
120
|
(0, typeorm_1.DeleteDateColumn)(),
|
|
145
121
|
(0, type_graphql_1.Field)({ nullable: true, description: 'The date and time when the payment record was deleted' }),
|
|
146
|
-
tslib_1.__metadata("design:type", Date
|
|
147
|
-
)
|
|
122
|
+
tslib_1.__metadata("design:type", Date)
|
|
148
123
|
], Payment.prototype, "deletedAt", void 0);
|
|
149
124
|
tslib_1.__decorate([
|
|
150
125
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
151
126
|
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who created the payment record' }),
|
|
152
|
-
tslib_1.__metadata("design:type", auth_base_1.User
|
|
153
|
-
)
|
|
127
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
154
128
|
], Payment.prototype, "creator", void 0);
|
|
155
129
|
tslib_1.__decorate([
|
|
156
130
|
(0, typeorm_1.RelationId)((payment) => payment.creator),
|
|
@@ -159,8 +133,7 @@ tslib_1.__decorate([
|
|
|
159
133
|
tslib_1.__decorate([
|
|
160
134
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
161
135
|
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who last updated the payment record' }),
|
|
162
|
-
tslib_1.__metadata("design:type", auth_base_1.User
|
|
163
|
-
)
|
|
136
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
164
137
|
], Payment.prototype, "updater", void 0);
|
|
165
138
|
tslib_1.__decorate([
|
|
166
139
|
(0, typeorm_1.RelationId)((payment) => payment.updater),
|
|
@@ -168,12 +141,11 @@ tslib_1.__decorate([
|
|
|
168
141
|
], Payment.prototype, "updaterId", void 0);
|
|
169
142
|
exports.Payment = Payment = tslib_1.__decorate([
|
|
170
143
|
(0, typeorm_1.Entity)(),
|
|
171
|
-
(0, typeorm_1.Index)('ix_payment_0', (payment) => [payment.domain, payment.transaction, payment.
|
|
172
|
-
|
|
173
|
-
}),
|
|
174
|
-
(0, typeorm_1.Index)('ix_payment_1', (payment) => [payment.domain, payment.year, payment.quarter, payment.month, payment.paidAt], {
|
|
144
|
+
(0, typeorm_1.Index)('ix_payment_0', (payment) => [payment.domain, payment.transaction, payment.targetType, payment.targetId], {
|
|
145
|
+
unique: true,
|
|
175
146
|
where: '"deleted_at" IS NULL'
|
|
176
147
|
}),
|
|
177
|
-
(0,
|
|
148
|
+
(0, typeorm_1.Index)('ix_payment_1', (payment) => [payment.domain, payment.targetType, payment.targetId]),
|
|
149
|
+
(0, type_graphql_1.ObjectType)({ description: 'A part of a transaction put on what it paid' })
|
|
178
150
|
], Payment);
|
|
179
151
|
//# sourceMappingURL=payment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment.js","sourceRoot":"","sources":["../../../server/service/payment/payment.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAAsE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C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;sCAC3F,gBAAI,CAAC,0BAA0B;;wCAA3B;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;0CAChC;kBAjGP,OAAO;IAZnB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,cAAc,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE;QAClG,KAAK,EAAE,sBAAsB;KAC9B,CAAC;IACD,IAAA,eAAK,EACJ,cAAc,EACd,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,EACpG;QACE,KAAK,EAAE,sBAAsB;KAC9B,CACF;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,oDAAoD,EAAE,CAAC,CAAC,0BAA0B;GAChG,OAAO,CAkGnB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n VersionColumn,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain, moneyColumn } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Transaction } from '../transaction/transaction'\nimport { BankAccount } from '../bank-account/bank-account'\n\nexport enum PaymentDirection {\n Incoming = 'Incoming', // 수금\n Outgoing = 'Outgoing' // 지출\n}\n\nregisterEnumType(PaymentDirection, {\n name: 'PaymentDirection',\n description: 'Indicates whether the payment is incoming (received) or outgoing (paid)' // 결제 방향을 나타냅니다 (수금 또는 지출)\n})\n\nexport enum PaymentType {\n Transfer = 'Transfer', // 계좌 이체\n Cash = 'Cash', // 현금\n CreditCard = 'CreditCard', // 신용카드\n DebitCard = 'DebitCard' // 직불카드\n}\n\nregisterEnumType(PaymentType, {\n name: 'PaymentType',\n description: 'Type of the payment (e.g., Transfer, Cash, CreditCard, DebitCard)' // 결제 유형을 나타냅니다\n})\n\n@Entity()\n@Index('ix_payment_0', (payment: Payment) => [payment.domain, payment.transaction, payment.paidAt], {\n where: '\"deleted_at\" IS NULL'\n})\n@Index(\n 'ix_payment_1',\n (payment: Payment) => [payment.domain, payment.year, payment.quarter, payment.month, payment.paidAt],\n {\n where: '\"deleted_at\" IS NULL'\n }\n)\n@ObjectType({ description: 'Entity representing a Payment record in the system' }) // 시스템 내에서 결제 기록을 나타내는 엔티티\nexport class Payment {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the payment record' })\n readonly id: string // 고유 식별자 (UUID)\n\n @VersionColumn()\n @Field({ nullable: true, description: 'Version number used for optimistic locking' })\n version?: number = 1 // 낙관적 잠금을 위한 버전 관리 필드\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true, description: 'The domain to which this payment belongs' })\n domain?: Domain // 결제가 속한 도메인\n\n @RelationId((payment: Payment) => payment.domain)\n domainId?: string // 도메인의 ID\n\n @ManyToOne(type => Transaction, transaction => transaction.payments)\n @Field(type => Transaction, { description: 'The transaction associated with this payment' })\n transaction: Transaction // 결제와 연결된 트랜잭션\n\n @RelationId((payment: Payment) => payment.transaction)\n transactionId: string // 연결된 트랜잭션의 ID\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The currency used in the payment' })\n currency?: string // 결제에 사용된 통화\n\n @Column(moneyColumn({ nullable: false }))\n @Field({ nullable: false, description: 'The amount of money involved in the payment' })\n amount: number // 결제된 금액\n\n @Column({ nullable: false })\n @Field(type => PaymentType, { description: 'Type of the payment' })\n paymentType: PaymentType // 결제 유형\n\n @ManyToOne(type => BankAccount, { nullable: true })\n @Field(type => BankAccount, { nullable: true, description: 'Source bank account for the payment' })\n sourceBankAccount?: BankAccount\n\n @RelationId((payment: Payment) => payment.sourceBankAccount)\n sourceBankAccountId?: string\n\n @ManyToOne(type => BankAccount, { nullable: true })\n @Field(type => BankAccount, { nullable: true, description: 'Destination bank account for the payment' })\n destinationBankAccount?: BankAccount\n\n @RelationId((payment: Payment) => payment.destinationBankAccount)\n destinationBankAccountId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal year in which the payment was made' })\n year?: number // 결제가 발생한 회계 연도\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal quarter in which the payment was made' })\n quarter?: number // 결제가 발생한 회계 분기\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal month in which the payment was made' })\n month?: number // 결제가 발생한 회계 월\n\n @Column({ nullable: false })\n @Field({ nullable: false, description: 'The date and time when the payment was made' })\n paidAt: Date // 결제가 이루어진 날짜 및 시간\n\n @Column({ nullable: false })\n @Field(type => PaymentDirection, { description: 'Direction of the payment (Incoming or Outgoing)' })\n direction: PaymentDirection // 결제 방향 (수금 또는 지출)\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Additional notes or comments about the payment' })\n note?: string // 결제에 대한 추가 설명 또는 메모\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The date and time when the payment record was created' })\n createdAt?: Date // 결제 레코드가 생성된 날짜 및 시간\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'The date and time when the payment record was last updated' })\n updatedAt?: Date // 결제 레코드가 마지막으로 업데이트된 날짜 및 시간\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'The date and time when the payment record was deleted' })\n deletedAt?: Date // 결제 레코드가 삭제된 날짜 및 시간\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created the payment record' })\n creator?: User // 결제 레코드를 생성한 사용자\n\n @RelationId((payment: Payment) => payment.creator)\n creatorId?: string // 결제 레코드를 생성한 사용자의 ID\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated the payment record' })\n updater?: User // 결제 레코드를 마지막으로 업데이트한 사용자\n\n @RelationId((payment: Payment) => payment.updater)\n updaterId?: string // 결제 레코드를 업데이트한 사용자의 ID\n}\n"]}
|
|
1
|
+
{"version":3,"file":"payment.js","sourceRoot":"","sources":["../../../server/service/payment/payment.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAA6E;AAE7E,iDAA2D;AAC3D,yDAAgD;AAChD,4DAAwD;AAExD,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,2CAAyB,CAAA;IACzB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;AACvB,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AAED,IAAA,+BAAgB,EAAC,cAAc,EAAE;IAC/B,IAAI,EAAE,gBAAgB;IACtB,WAAW,EACT,qKAAqK;CACxK,CAAC,CAAA;AAEF,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,8BAAa,CAAA;IACb,kCAAiB,CAAA;AACnB,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAED,IAAA,+BAAgB,EAAC,aAAa,EAAE;IAC9B,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,oDAAoD;CAClE,CAAC,CAAA;AAEF;;;;;;;;GAQG;AAYI,IAAM,OAAO,GAAb,MAAM,OAAO;IAAb;QAOL,YAAO,GAAY,CAAC,CAAA;IAuEtB,CAAC;CAAA,CAAA;AA9EY,0BAAO;AAGT;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;;mCAC5D;AAInB;IAFC,IAAA,uBAAa,GAAE;IACf,IAAA,oB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E,IAAI,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;sCACtF,gBAAI;wCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;0CAChC;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;sCAC3F,gBAAI;wCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;0CAChC;kBA7EP,OAAO;IAXnB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,cAAc,EACd,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,EACjG;QACE,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,sBAAsB;KAC9B,CACF;IACA,IAAA,eAAK,EAAC,cAAc,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnG,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,6CAA6C,EAAE,CAAC;GAC9D,OAAO,CA8EnB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n VersionColumn,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Float, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain, moneyColumn } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Transaction } from '../transaction/transaction'\n\nexport enum PaymentPurpose {\n SETTLEMENT = 'SETTLEMENT',\n EVIDENCE = 'EVIDENCE',\n TRANSFER = 'TRANSFER'\n}\n\nregisterEnumType(PaymentPurpose, {\n name: 'PaymentPurpose',\n description:\n 'What a payment tells of its transaction - the business document it settled, the document that evidences it, or the matching line of a move between our own accounts'\n})\n\nexport enum PaymentMethod {\n RULE = 'RULE',\n PERSON = 'PERSON'\n}\n\nregisterEnumType(PaymentMethod, {\n name: 'PaymentMethod',\n description: 'Who made the link - a rule of the app, or a person'\n})\n\n/**\n * What a transaction paid: a part of it, put on one target - a contract round, a tax invoice, a VAT period, the other\n * line of a transfer between our own accounts. One transaction may pay several targets, and one target be paid by\n * several transactions.\n *\n * The kinds of target are registered by the apps that own them (§`registerPaymentTarget`), each with its purpose.\n * Within one purpose the payments of a transaction add up to no more than the transaction; across purposes the same\n * money is told twice - a deposit settles a round and is evidenced by that round's tax invoice.\n */\n@Entity()\n@Index(\n 'ix_payment_0',\n (payment: Payment) => [payment.domain, payment.transaction, payment.targetType, payment.targetId],\n {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n }\n)\n@Index('ix_payment_1', (payment: Payment) => [payment.domain, payment.targetType, payment.targetId])\n@ObjectType({ description: 'A part of a transaction put on what it paid' })\nexport class Payment {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the payment record' })\n readonly id: string\n\n @VersionColumn()\n @Field({ nullable: true, description: 'Version number used for optimistic locking' })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain to which this payment belongs' })\n domain?: Domain\n\n @RelationId((payment: Payment) => payment.domain)\n domainId?: string\n\n @ManyToOne(type => Transaction, transaction => transaction.payments, { nullable: false })\n @Field(type => Transaction, { description: 'The transaction a part of which this is' })\n transaction: Transaction\n\n @RelationId((payment: Payment) => payment.transaction)\n transactionId?: string\n\n @Column()\n @Field({ description: 'The kind of what was paid, as registered - ContractMilestone, TaxInvoice, Transaction' })\n targetType: string\n\n @Column()\n @Field({ description: 'The id of what was paid' })\n targetId: string\n\n @Column(moneyColumn())\n @Field(type => Float, { description: \"The part of the transaction put on the target, in the transaction's currency\" })\n amount: number\n\n @Column()\n @Field(type => PaymentPurpose, {\n description: \"What the payment tells of the transaction - the target kind's purpose\"\n })\n purpose: PaymentPurpose\n\n @Column({ default: PaymentMethod.PERSON })\n @Field(type => PaymentMethod, { description: 'Who made the link' })\n method: PaymentMethod\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true, description: 'Why a rule made the link - what matched' })\n basis?: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true, description: 'Notes' })\n notes?: string\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The date and time when the payment record was created' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'The date and time when the payment record was last updated' })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'The date and time when the payment record was deleted' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created the payment record' })\n creator?: User\n\n @RelationId((payment: Payment) => payment.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated the payment record' })\n updater?: User\n\n @RelationId((payment: Payment) => payment.updater)\n updaterId?: string\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const typeorm_1 = require("typeorm");
|
|
4
|
+
const shell_1 = require("@things-factory/shell");
|
|
5
|
+
const cash_flow_type_1 = require("../cash-flow-type");
|
|
6
|
+
const transaction_1 = require("../transaction/transaction");
|
|
7
|
+
const payment_1 = require("./payment");
|
|
8
|
+
const payment_targets_1 = require("./payment-targets");
|
|
9
|
+
/**
|
|
10
|
+
* A move between our own accounts is two bank lines: the withdrawal pays the deposit. The payment sits on the
|
|
11
|
+
* withdrawal and names the deposit; a deposit takes no more than itself from the withdrawals that name it.
|
|
12
|
+
*/
|
|
13
|
+
(0, payment_targets_1.registerPaymentTarget)('Transaction', {
|
|
14
|
+
purpose: payment_1.PaymentPurpose.TRANSFER,
|
|
15
|
+
async label(tx, domain, targetIds) {
|
|
16
|
+
const lines = await tx
|
|
17
|
+
.getRepository(transaction_1.Transaction)
|
|
18
|
+
.find({ where: { domain: { id: domain.id }, id: (0, typeorm_1.In)(targetIds) }, relations: ['bankAccount'] });
|
|
19
|
+
return new Map(lines.map(line => [line.id, [line.transactionDate, line.bankAccount?.name].filter(Boolean).join(' ')]));
|
|
20
|
+
},
|
|
21
|
+
async validate(tx, domain, { targetIds, transactionIds }) {
|
|
22
|
+
const repo = tx.getRepository(transaction_1.Transaction);
|
|
23
|
+
const deposits = await repo.find({ where: { domain: { id: domain.id }, id: (0, typeorm_1.In)(targetIds) } });
|
|
24
|
+
if (deposits.length !== new Set(targetIds).size)
|
|
25
|
+
throw new shell_1.Refusal('transfer-target-not-found', {}, 'the other line of the transfer was not found');
|
|
26
|
+
if (deposits.some(line => line.type !== cash_flow_type_1.CashFlowType.INCOME))
|
|
27
|
+
throw new shell_1.Refusal('transfer-target-not-deposit', {}, 'a withdrawal pays a deposit - the other line is not one');
|
|
28
|
+
const withdrawals = await repo.find({ where: { domain: { id: domain.id }, id: (0, typeorm_1.In)(transactionIds) } });
|
|
29
|
+
if (withdrawals.some(line => line.type !== cash_flow_type_1.CashFlowType.EXPENSE))
|
|
30
|
+
throw new shell_1.Refusal('transfer-from-not-withdrawal', {}, 'a transfer is put on its withdrawal');
|
|
31
|
+
const payments = await tx
|
|
32
|
+
.getRepository(payment_1.Payment)
|
|
33
|
+
.find({ where: { domain: { id: domain.id }, targetType: 'Transaction', targetId: (0, typeorm_1.In)(targetIds) } });
|
|
34
|
+
for (const deposit of deposits) {
|
|
35
|
+
const taken = payments
|
|
36
|
+
.filter(one => one.targetId === deposit.id)
|
|
37
|
+
.reduce((sum, one) => sum + Number(one.amount), 0);
|
|
38
|
+
if (taken > Math.abs(Number(deposit.amount)) + 0.005)
|
|
39
|
+
throw new shell_1.Refusal('transfer-over-deposit', { taken, amount: deposit.amount }, `${taken} moved into a deposit of ${deposit.amount}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=transfer-target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer-target.js","sourceRoot":"","sources":["../../../server/service/payment/transfer-target.ts"],"names":[],"mappings":";;AAAA,qCAA4B;AAE5B,iDAA+C;AAE/C,sDAAgD;AAChD,4DAAwD;AACxD,uCAAmD;AACnD,uDAAyD;AAEzD;;;GAGG;AACH,IAAA,uCAAqB,EAAC,aAAa,EAAE;IACnC,OAAO,EAAE,wBAAc,CAAC,QAAQ;IAChC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS;QAC/B,MAAM,KAAK,GAAG,MAAM,EAAE;aACnB,aAAa,CAAC,yBAAW,CAAC;aAC1B,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,IAAA,YAAE,EAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;QAChG,OAAO,IAAI,GAAG,CACZ,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CACvG,CAA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AAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAA,YAAE,EAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAA;QACrG,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,MAAM,KAAK,GAAG,QAAQ;iBACnB,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,OAAO,CAAC,EAAE,CAAC;iBAC1C,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA;YACpD,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK;gBAClD,MAAM,IAAI,eAAO,CACf,uBAAuB,EACvB,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,EACjC,GAAG,KAAK,4BAA4B,OAAO,CAAC,MAAM,EAAE,CACrD,CAAA;QACL,CAAC;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { In } from 'typeorm'\n\nimport { Refusal } from '@things-factory/shell'\n\nimport { CashFlowType } from '../cash-flow-type'\nimport { Transaction } from '../transaction/transaction'\nimport { Payment, PaymentPurpose } from './payment'\nimport { registerPaymentTarget } from './payment-targets'\n\n/**\n * A move between our own accounts is two bank lines: the withdrawal pays the deposit. The payment sits on the\n * withdrawal and names the deposit; a deposit takes no more than itself from the withdrawals that name it.\n */\nregisterPaymentTarget('Transaction', {\n purpose: PaymentPurpose.TRANSFER,\n async label(tx, domain, targetIds) {\n const lines = await tx\n .getRepository(Transaction)\n .find({ where: { domain: { id: domain.id }, id: In(targetIds) }, relations: ['bankAccount'] })\n return new Map(\n lines.map(line => [line.id, [line.transactionDate, line.bankAccount?.name].filter(Boolean).join(' ')])\n )\n },\n async validate(tx, domain, { targetIds, transactionIds }) {\n const repo = tx.getRepository(Transaction)\n const deposits = await repo.find({ where: { domain: { id: domain.id }, id: In(targetIds) } })\n if (deposits.length !== new Set(targetIds).size)\n throw new Refusal('transfer-target-not-found', {}, 'the other line of the transfer was not found')\n if (deposits.some(line => line.type !== CashFlowType.INCOME))\n throw new Refusal('transfer-target-not-deposit', {}, 'a withdrawal pays a deposit - the other line is not one')\n\n const withdrawals = await repo.find({ where: { domain: { id: domain.id }, id: In(transactionIds) } })\n if (withdrawals.some(line => line.type !== CashFlowType.EXPENSE))\n throw new Refusal('transfer-from-not-withdrawal', {}, 'a transfer is put on its withdrawal')\n\n const payments = await tx\n .getRepository(Payment)\n .find({ where: { domain: { id: domain.id }, targetType: 'Transaction', targetId: In(targetIds) } })\n for (const deposit of deposits) {\n const taken = payments\n .filter(one => one.targetId === deposit.id)\n .reduce((sum, one) => sum + Number(one.amount), 0)\n if (taken > Math.abs(Number(deposit.amount)) + 0.005)\n throw new Refusal(\n 'transfer-over-deposit',\n { taken, amount: deposit.amount },\n `${taken} moved into a deposit of ${deposit.amount}`\n )\n }\n }\n})\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RecurringCashItem } from './recurring-cash-item';
|
|
2
|
+
import { RecurringCashItemQuery } from './recurring-cash-item-query';
|
|
3
|
+
import { RecurringCashItemMutation } from './recurring-cash-item-mutation';
|
|
4
|
+
export declare const entities: (typeof RecurringCashItem)[];
|
|
5
|
+
export declare const resolvers: (typeof RecurringCashItemQuery | typeof RecurringCashItemMutation)[];
|
|
6
|
+
export declare const subscribers: any[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.subscribers = exports.resolvers = exports.entities = void 0;
|
|
4
|
+
const recurring_cash_item_1 = require("./recurring-cash-item");
|
|
5
|
+
const recurring_cash_item_query_1 = require("./recurring-cash-item-query");
|
|
6
|
+
const recurring_cash_item_mutation_1 = require("./recurring-cash-item-mutation");
|
|
7
|
+
exports.entities = [recurring_cash_item_1.RecurringCashItem];
|
|
8
|
+
exports.resolvers = [recurring_cash_item_query_1.RecurringCashItemQuery, recurring_cash_item_mutation_1.RecurringCashItemMutation];
|
|
9
|
+
exports.subscribers = [];
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/recurring-cash-item/index.ts"],"names":[],"mappings":";;;AAAA,+DAAyD;AACzD,2EAAoE;AACpE,iFAA0E;AAE7D,QAAA,QAAQ,GAAG,CAAC,uCAAiB,CAAC,CAAA;AAC9B,QAAA,SAAS,GAAG,CAAC,kDAAsB,EAAE,wDAAyB,CAAC,CAAA;AAC/D,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { RecurringCashItem } from './recurring-cash-item'\nimport { RecurringCashItemQuery } from './recurring-cash-item-query'\nimport { RecurringCashItemMutation } from './recurring-cash-item-mutation'\n\nexport const entities = [RecurringCashItem]\nexport const resolvers = [RecurringCashItemQuery, RecurringCashItemMutation]\nexport const subscribers = []\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RecurringCashItem } from './recurring-cash-item';
|
|
2
|
+
import { RecurringCashItemPatch } from './recurring-cash-item-type';
|
|
3
|
+
export declare class RecurringCashItemMutation {
|
|
4
|
+
updateMultipleRecurringCashItem(patches: RecurringCashItemPatch[], context: ResolverContext): Promise<RecurringCashItem[]>;
|
|
5
|
+
deleteRecurringCashItems(ids: string[], context: ResolverContext): Promise<boolean>;
|
|
6
|
+
generateForecasts(year: number, month: number, context: ResolverContext): Promise<number>;
|
|
7
|
+
}
|