taxtank-core 0.32.72 → 0.32.73
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/esm2022/lib/db/Models/transaction/transaction-base.mjs +4 -1
- package/esm2022/lib/forms/transaction/transaction.form.mjs +1 -3
- package/esm2022/lib/models/transaction/allocation-rule-transaction.mjs +18 -17
- package/esm2022/lib/models/transaction/allocation-rule.mjs +5 -2
- package/esm2022/lib/models/transaction/transaction.mjs +10 -1
- package/esm2022/lib/services/http/bank/bank-connection/bank-connection.service.mjs +2 -2
- package/esm2022/lib/services/http/chat/message.service.mjs +2 -2
- package/esm2022/lib/services/http/firm/client-invite/client-invite.service.mjs +2 -2
- package/esm2022/lib/services/http/firm/client-movement/client-movement.service.mjs +2 -2
- package/esm2022/lib/services/http/subscription/service-payment-method/service-payment-method.service.mjs +2 -2
- package/esm2022/lib/services/http/subscription/service-subscription/subscription.service.mjs +2 -2
- package/fesm2022/taxtank-core.mjs +189 -174
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/lib/db/Models/transaction/transaction-base.d.ts +1 -0
- package/lib/models/transaction/allocation-rule-transaction.d.ts +1 -1
- package/lib/models/transaction/transaction.d.ts +1 -0
- package/lib/services/http/bank/bank-connection/bank-connection.service.d.ts +1 -0
- package/lib/services/http/chat/message.service.d.ts +1 -0
- package/lib/services/http/firm/client-invite/client-invite.service.d.ts +1 -0
- package/lib/services/http/firm/client-movement/client-movement.service.d.ts +1 -0
- package/lib/services/http/subscription/service-payment-method/service-payment-method.service.d.ts +1 -0
- package/lib/services/http/subscription/service-subscription/subscription.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -21,7 +21,6 @@ import differenceBy from 'lodash/differenceBy';
|
|
|
21
21
|
import uniq from 'lodash/uniq';
|
|
22
22
|
import moment from 'moment';
|
|
23
23
|
import { DateRange } from 'moment-range';
|
|
24
|
-
import merge from 'lodash/merge';
|
|
25
24
|
import ceil from 'lodash/ceil';
|
|
26
25
|
import range from 'lodash/range';
|
|
27
26
|
import { Validators, UntypedFormGroup, UntypedFormControl, UntypedFormArray, FormControl, FormArray, FormGroup } from '@angular/forms';
|
|
@@ -32,6 +31,7 @@ import { EventSourcePolyfill } from 'event-source-polyfill/src/eventsource.min.j
|
|
|
32
31
|
import { JwtHelperService } from '@auth0/angular-jwt';
|
|
33
32
|
import * as mixpanel from 'mixpanel-browser';
|
|
34
33
|
import clone from 'lodash/clone';
|
|
34
|
+
import merge from 'lodash/merge';
|
|
35
35
|
import { isArray } from 'rxjs/internal-compatibility';
|
|
36
36
|
import * as i4 from '@angular/router';
|
|
37
37
|
import { NavigationEnd } from '@angular/router';
|
|
@@ -443,6 +443,9 @@ var TankTypeEnum;
|
|
|
443
443
|
})(TankTypeEnum || (TankTypeEnum = {}));
|
|
444
444
|
|
|
445
445
|
class TransactionBase extends ObservableModel {
|
|
446
|
+
get gstCoefficient() {
|
|
447
|
+
return this.isGST ? ChartAccounts.GSTCoefficient : 1;
|
|
448
|
+
}
|
|
446
449
|
get claimRatio() {
|
|
447
450
|
return this.sharedClaimPercent / 100;
|
|
448
451
|
}
|
|
@@ -3750,11 +3753,11 @@ class IncomeSourceChartData {
|
|
|
3750
3753
|
}
|
|
3751
3754
|
}
|
|
3752
3755
|
|
|
3753
|
-
var
|
|
3754
|
-
(function (
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
})(
|
|
3756
|
+
var TransactionSourceEnum;
|
|
3757
|
+
(function (TransactionSourceEnum) {
|
|
3758
|
+
TransactionSourceEnum[TransactionSourceEnum["CASH"] = 1] = "CASH";
|
|
3759
|
+
TransactionSourceEnum[TransactionSourceEnum["BANK_TRANSACTION"] = 2] = "BANK_TRANSACTION";
|
|
3760
|
+
})(TransactionSourceEnum || (TransactionSourceEnum = {}));
|
|
3758
3761
|
|
|
3759
3762
|
class AllocationRuleTransaction extends AllocationRuleTransaction$1 {
|
|
3760
3763
|
constructor() {
|
|
@@ -3788,8 +3791,10 @@ class AllocationRuleTransaction extends AllocationRuleTransaction$1 {
|
|
|
3788
3791
|
/**
|
|
3789
3792
|
* Create Transaction instance based on passed bank transaction and rule transaction
|
|
3790
3793
|
*/
|
|
3791
|
-
toTransaction(bankTransaction) {
|
|
3792
|
-
const transaction =
|
|
3794
|
+
toTransaction(bankTransaction = null) {
|
|
3795
|
+
const transaction = bankTransaction ? bankTransaction.toTransaction(this.isGST) : plainToClass(Transaction, {});
|
|
3796
|
+
Object.assign(transaction, {
|
|
3797
|
+
isGST: this.isGST,
|
|
3793
3798
|
tax: this.tax,
|
|
3794
3799
|
claimPercent: this.claimPercent,
|
|
3795
3800
|
chartAccounts: this.chartAccounts,
|
|
@@ -3797,22 +3802,22 @@ class AllocationRuleTransaction extends AllocationRuleTransaction$1 {
|
|
|
3797
3802
|
loan: this.loan,
|
|
3798
3803
|
incomeSource: this.incomeSource,
|
|
3799
3804
|
metaFields: this.metaFields,
|
|
3800
|
-
transactions: [],
|
|
3801
3805
|
business: this.business,
|
|
3806
|
+
source: TransactionSourceEnum.BANK_TRANSACTION,
|
|
3802
3807
|
operation: TransactionOperationEnum.ALLOCATE,
|
|
3808
|
+
transactions: [],
|
|
3803
3809
|
});
|
|
3804
|
-
|
|
3810
|
+
// split allocation
|
|
3811
|
+
if (this.amountPercent) {
|
|
3812
|
+
transaction.amount = bankTransaction.amount * this.amountPercentCoefficient / this.gstCoefficient;
|
|
3813
|
+
}
|
|
3805
3814
|
// child transactions inherit most of the fields from parent transaction
|
|
3806
|
-
this.childTransactions.forEach((
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
type: childTransaction.chartAccounts.isExpense() ? TransactionTypeEnum.DEBIT : TransactionTypeEnum.CREDIT,
|
|
3812
|
-
transactions: [],
|
|
3813
|
-
}));
|
|
3815
|
+
this.childTransactions.forEach((childRuleTransaction) => {
|
|
3816
|
+
const childTransaction = childRuleTransaction.toTransaction();
|
|
3817
|
+
childTransaction.amount = childRuleTransaction.amount;
|
|
3818
|
+
childTransaction.setParent(transaction);
|
|
3819
|
+
transaction.transactions.push(childTransaction);
|
|
3814
3820
|
});
|
|
3815
|
-
transaction.allocations = [TransactionAllocation.create(transaction.amountWithGst, bankTransaction)];
|
|
3816
3821
|
return transaction;
|
|
3817
3822
|
}
|
|
3818
3823
|
}
|
|
@@ -3854,138 +3859,11 @@ __decorate([
|
|
|
3854
3859
|
Type(() => Number)
|
|
3855
3860
|
], AllocationRuleTransaction.prototype, "tax", void 0);
|
|
3856
3861
|
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
this.autoAllocate = false;
|
|
3863
|
-
}
|
|
3864
|
-
get typeLabel() {
|
|
3865
|
-
switch (this.type) {
|
|
3866
|
-
case AllocationRuleTypeEnum.EXPENSE:
|
|
3867
|
-
return 'expense';
|
|
3868
|
-
case AllocationRuleTypeEnum.INCOME:
|
|
3869
|
-
return 'income';
|
|
3870
|
-
default:
|
|
3871
|
-
return 'transfer';
|
|
3872
|
-
}
|
|
3873
|
-
}
|
|
3874
|
-
isIncome() {
|
|
3875
|
-
return this.type === AllocationRuleTypeEnum.INCOME;
|
|
3876
|
-
}
|
|
3877
|
-
isExpense() {
|
|
3878
|
-
return this.type === AllocationRuleTypeEnum.EXPENSE;
|
|
3879
|
-
}
|
|
3880
|
-
isTransfer() {
|
|
3881
|
-
return this.type === AllocationRuleTypeEnum.TRANSFER;
|
|
3882
|
-
}
|
|
3883
|
-
isPropertyTank() {
|
|
3884
|
-
return this.transaction.tankType === TankTypeEnum.PROPERTY;
|
|
3885
|
-
}
|
|
3886
|
-
isWorkTank() {
|
|
3887
|
-
return this.transaction.tankType === TankTypeEnum.WORK;
|
|
3888
|
-
}
|
|
3889
|
-
isSoleTank() {
|
|
3890
|
-
return this.transaction.tankType === TankTypeEnum.SOLE;
|
|
3891
|
-
}
|
|
3892
|
-
isPropertyIncome() {
|
|
3893
|
-
return this.isIncome() && this.isPropertyTank();
|
|
3894
|
-
}
|
|
3895
|
-
isWorkIncome() {
|
|
3896
|
-
return this.isIncome() && this.isWorkTank();
|
|
3897
|
-
}
|
|
3898
|
-
isSoleIncome() {
|
|
3899
|
-
return this.isIncome() && this.isSoleTank();
|
|
3900
|
-
}
|
|
3901
|
-
/**
|
|
3902
|
-
* @TODO Alex: move to collection
|
|
3903
|
-
*/
|
|
3904
|
-
matchBankTransaction(bankTransaction) {
|
|
3905
|
-
return this.conditionOperator === AllocationRuleConditionOperatorEnum.AND ? this.checkAnd(bankTransaction) : this.checkOr(bankTransaction);
|
|
3906
|
-
}
|
|
3907
|
-
createTransaction(bankTransaction) {
|
|
3908
|
-
if (this.isTransfer()) {
|
|
3909
|
-
const transaction = bankTransaction.toTransaction();
|
|
3910
|
-
transaction.operation = TransactionOperationEnum.TRANSFER;
|
|
3911
|
-
transaction.chartAccounts = plainToClass(ChartAccounts, { id: ChartAccountsListEnum.TRANSFER });
|
|
3912
|
-
return transaction;
|
|
3913
|
-
}
|
|
3914
|
-
return this.transaction.toTransaction(bankTransaction);
|
|
3915
|
-
}
|
|
3916
|
-
/**
|
|
3917
|
-
* Rule is matched when all conditions matched
|
|
3918
|
-
*/
|
|
3919
|
-
checkAnd(bankTransaction) {
|
|
3920
|
-
for (const condition of this.conditions) {
|
|
3921
|
-
if (!condition.matchBankTransaction(bankTransaction)) {
|
|
3922
|
-
return false;
|
|
3923
|
-
}
|
|
3924
|
-
}
|
|
3925
|
-
return true;
|
|
3926
|
-
}
|
|
3927
|
-
/**
|
|
3928
|
-
* Rule is matched when at least one condition matched
|
|
3929
|
-
*/
|
|
3930
|
-
checkOr(bankTransaction) {
|
|
3931
|
-
for (const condition of this.conditions) {
|
|
3932
|
-
if (condition.matchBankTransaction(bankTransaction)) {
|
|
3933
|
-
return true;
|
|
3934
|
-
}
|
|
3935
|
-
}
|
|
3936
|
-
return false;
|
|
3937
|
-
}
|
|
3938
|
-
/**
|
|
3939
|
-
* Create allocation rule based on bank transaction (just prefill rule fields with bank transaction values)
|
|
3940
|
-
*/
|
|
3941
|
-
static fromBankTransaction(bankTransaction) {
|
|
3942
|
-
return plainToClass(AllocationRule, {
|
|
3943
|
-
type: bankTransaction.isDebit() ? AllocationRuleTypeEnum.EXPENSE : AllocationRuleTypeEnum.INCOME,
|
|
3944
|
-
bankAccount: bankTransaction.bankAccount,
|
|
3945
|
-
conditionOperator: AllocationRuleConditionOperatorEnum.AND,
|
|
3946
|
-
conditions: [
|
|
3947
|
-
plainToClass(AllocationRuleCondition, {
|
|
3948
|
-
field: AllocationRuleConditionFieldEnum.AMOUNT,
|
|
3949
|
-
comparisonOperator: AllocationRuleConditionComparisonOperatorEnum.EQUALS,
|
|
3950
|
-
value: bankTransaction.amount
|
|
3951
|
-
}),
|
|
3952
|
-
plainToClass(AllocationRuleCondition, {
|
|
3953
|
-
field: AllocationRuleConditionFieldEnum.DESCRIPTION,
|
|
3954
|
-
comparisonOperator: AllocationRuleConditionComparisonOperatorEnum.EQUALS,
|
|
3955
|
-
value: bankTransaction.description
|
|
3956
|
-
})
|
|
3957
|
-
]
|
|
3958
|
-
});
|
|
3959
|
-
}
|
|
3960
|
-
}
|
|
3961
|
-
__decorate([
|
|
3962
|
-
Type(() => BankAccount),
|
|
3963
|
-
Transform(({ value }) => ({ id: value.id }), { toPlainOnly: true })
|
|
3964
|
-
], AllocationRule.prototype, "bankAccount", void 0);
|
|
3965
|
-
__decorate([
|
|
3966
|
-
Type(() => AllocationRuleCondition)
|
|
3967
|
-
], AllocationRule.prototype, "conditions", void 0);
|
|
3968
|
-
__decorate([
|
|
3969
|
-
Type(() => AllocationRuleTransaction)
|
|
3970
|
-
], AllocationRule.prototype, "transaction", void 0);
|
|
3971
|
-
__decorate([
|
|
3972
|
-
Type(() => BankAccount)
|
|
3973
|
-
], AllocationRule.prototype, "transferBankAccount", void 0);
|
|
3974
|
-
|
|
3975
|
-
/**
|
|
3976
|
-
* Enum with income amount types (Net or Gross)
|
|
3977
|
-
*/
|
|
3978
|
-
var IncomeAmountTypeEnum;
|
|
3979
|
-
(function (IncomeAmountTypeEnum) {
|
|
3980
|
-
IncomeAmountTypeEnum[IncomeAmountTypeEnum["NET"] = 0] = "NET";
|
|
3981
|
-
IncomeAmountTypeEnum[IncomeAmountTypeEnum["GROSS"] = 1] = "GROSS";
|
|
3982
|
-
})(IncomeAmountTypeEnum || (IncomeAmountTypeEnum = {}));
|
|
3983
|
-
|
|
3984
|
-
var TransactionSourceEnum;
|
|
3985
|
-
(function (TransactionSourceEnum) {
|
|
3986
|
-
TransactionSourceEnum[TransactionSourceEnum["CASH"] = 1] = "CASH";
|
|
3987
|
-
TransactionSourceEnum[TransactionSourceEnum["BANK_TRANSACTION"] = 2] = "BANK_TRANSACTION";
|
|
3988
|
-
})(TransactionSourceEnum || (TransactionSourceEnum = {}));
|
|
3862
|
+
var TransactionTypeEnum;
|
|
3863
|
+
(function (TransactionTypeEnum) {
|
|
3864
|
+
TransactionTypeEnum[TransactionTypeEnum["DEBIT"] = 1] = "DEBIT";
|
|
3865
|
+
TransactionTypeEnum[TransactionTypeEnum["CREDIT"] = 2] = "CREDIT";
|
|
3866
|
+
})(TransactionTypeEnum || (TransactionTypeEnum = {}));
|
|
3989
3867
|
|
|
3990
3868
|
var TaxExemptionEnum;
|
|
3991
3869
|
(function (TaxExemptionEnum) {
|
|
@@ -6264,22 +6142,6 @@ __decorate([
|
|
|
6264
6142
|
Type(() => ChartAccountsMetaField)
|
|
6265
6143
|
], TransactionMetaField.prototype, "chartAccountsMetaField", void 0);
|
|
6266
6144
|
|
|
6267
|
-
class TransactionAllocation extends TransactionAllocation$1 {
|
|
6268
|
-
/**
|
|
6269
|
-
* Create a new instance of transaction allocation
|
|
6270
|
-
* transaction could be empty since we can POST allocation inside a new transaction
|
|
6271
|
-
*/
|
|
6272
|
-
static create(amount, bankTransaction, transaction) {
|
|
6273
|
-
return plainToClass(TransactionAllocation, { amount, transaction, bankTransaction });
|
|
6274
|
-
}
|
|
6275
|
-
}
|
|
6276
|
-
__decorate([
|
|
6277
|
-
Type(() => BankTransaction)
|
|
6278
|
-
], TransactionAllocation.prototype, "bankTransaction", void 0);
|
|
6279
|
-
__decorate([
|
|
6280
|
-
Type(() => Transaction)
|
|
6281
|
-
], TransactionAllocation.prototype, "transaction", void 0);
|
|
6282
|
-
|
|
6283
6145
|
// @TODO Alex: refactor: move here allocations methods, netAmount = amount, grossAmount calculation, remove unused methods, etc.
|
|
6284
6146
|
class Transaction extends Transaction$1 {
|
|
6285
6147
|
constructor() {
|
|
@@ -6464,6 +6326,15 @@ class Transaction extends Transaction$1 {
|
|
|
6464
6326
|
ignoreSign() {
|
|
6465
6327
|
return !(this.chartAccounts?.id in ChartAccountsKeepSign);
|
|
6466
6328
|
}
|
|
6329
|
+
setParent(transaction) {
|
|
6330
|
+
this.description = this.chartAccounts.name;
|
|
6331
|
+
this.date = transaction.date;
|
|
6332
|
+
this.claimPercent = transaction.claimPercent;
|
|
6333
|
+
this.property = transaction.property;
|
|
6334
|
+
this.loan = transaction.loan;
|
|
6335
|
+
this.incomeSource = transaction.incomeSource;
|
|
6336
|
+
this.business = transaction.business;
|
|
6337
|
+
}
|
|
6467
6338
|
}
|
|
6468
6339
|
__decorate([
|
|
6469
6340
|
Type(() => Transaction)
|
|
@@ -6499,6 +6370,151 @@ __decorate([
|
|
|
6499
6370
|
Transform(({ value }) => +value)
|
|
6500
6371
|
], Transaction.prototype, "tax", void 0);
|
|
6501
6372
|
|
|
6373
|
+
class TransactionAllocation extends TransactionAllocation$1 {
|
|
6374
|
+
/**
|
|
6375
|
+
* Create a new instance of transaction allocation
|
|
6376
|
+
* transaction could be empty since we can POST allocation inside a new transaction
|
|
6377
|
+
*/
|
|
6378
|
+
static create(amount, bankTransaction, transaction) {
|
|
6379
|
+
return plainToClass(TransactionAllocation, { amount, transaction, bankTransaction });
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
__decorate([
|
|
6383
|
+
Type(() => BankTransaction)
|
|
6384
|
+
], TransactionAllocation.prototype, "bankTransaction", void 0);
|
|
6385
|
+
__decorate([
|
|
6386
|
+
Type(() => Transaction)
|
|
6387
|
+
], TransactionAllocation.prototype, "transaction", void 0);
|
|
6388
|
+
|
|
6389
|
+
class AllocationRule extends AllocationRule$1 {
|
|
6390
|
+
constructor() {
|
|
6391
|
+
super(...arguments);
|
|
6392
|
+
this.type = AllocationRuleTypeEnum.EXPENSE;
|
|
6393
|
+
this.conditionOperator = AllocationRuleConditionOperatorEnum.OR;
|
|
6394
|
+
this.autoAllocate = false;
|
|
6395
|
+
}
|
|
6396
|
+
get typeLabel() {
|
|
6397
|
+
switch (this.type) {
|
|
6398
|
+
case AllocationRuleTypeEnum.EXPENSE:
|
|
6399
|
+
return 'expense';
|
|
6400
|
+
case AllocationRuleTypeEnum.INCOME:
|
|
6401
|
+
return 'income';
|
|
6402
|
+
default:
|
|
6403
|
+
return 'transfer';
|
|
6404
|
+
}
|
|
6405
|
+
}
|
|
6406
|
+
isIncome() {
|
|
6407
|
+
return this.type === AllocationRuleTypeEnum.INCOME;
|
|
6408
|
+
}
|
|
6409
|
+
isExpense() {
|
|
6410
|
+
return this.type === AllocationRuleTypeEnum.EXPENSE;
|
|
6411
|
+
}
|
|
6412
|
+
isTransfer() {
|
|
6413
|
+
return this.type === AllocationRuleTypeEnum.TRANSFER;
|
|
6414
|
+
}
|
|
6415
|
+
isPropertyTank() {
|
|
6416
|
+
return this.transaction.tankType === TankTypeEnum.PROPERTY;
|
|
6417
|
+
}
|
|
6418
|
+
isWorkTank() {
|
|
6419
|
+
return this.transaction.tankType === TankTypeEnum.WORK;
|
|
6420
|
+
}
|
|
6421
|
+
isSoleTank() {
|
|
6422
|
+
return this.transaction.tankType === TankTypeEnum.SOLE;
|
|
6423
|
+
}
|
|
6424
|
+
isPropertyIncome() {
|
|
6425
|
+
return this.isIncome() && this.isPropertyTank();
|
|
6426
|
+
}
|
|
6427
|
+
isWorkIncome() {
|
|
6428
|
+
return this.isIncome() && this.isWorkTank();
|
|
6429
|
+
}
|
|
6430
|
+
isSoleIncome() {
|
|
6431
|
+
return this.isIncome() && this.isSoleTank();
|
|
6432
|
+
}
|
|
6433
|
+
/**
|
|
6434
|
+
* @TODO Alex: move to collection
|
|
6435
|
+
*/
|
|
6436
|
+
matchBankTransaction(bankTransaction) {
|
|
6437
|
+
return this.conditionOperator === AllocationRuleConditionOperatorEnum.AND ? this.checkAnd(bankTransaction) : this.checkOr(bankTransaction);
|
|
6438
|
+
}
|
|
6439
|
+
createTransaction(bankTransaction) {
|
|
6440
|
+
if (this.isTransfer()) {
|
|
6441
|
+
const transaction = bankTransaction.toTransaction();
|
|
6442
|
+
transaction.operation = TransactionOperationEnum.TRANSFER;
|
|
6443
|
+
transaction.chartAccounts = plainToClass(ChartAccounts, { id: ChartAccountsListEnum.TRANSFER });
|
|
6444
|
+
return transaction;
|
|
6445
|
+
}
|
|
6446
|
+
const transaction = this.transaction.toTransaction(bankTransaction);
|
|
6447
|
+
transaction.allocations = [TransactionAllocation.create(transaction.amountWithGst, bankTransaction)];
|
|
6448
|
+
return transaction;
|
|
6449
|
+
}
|
|
6450
|
+
/**
|
|
6451
|
+
* Rule is matched when all conditions matched
|
|
6452
|
+
*/
|
|
6453
|
+
checkAnd(bankTransaction) {
|
|
6454
|
+
for (const condition of this.conditions) {
|
|
6455
|
+
if (!condition.matchBankTransaction(bankTransaction)) {
|
|
6456
|
+
return false;
|
|
6457
|
+
}
|
|
6458
|
+
}
|
|
6459
|
+
return true;
|
|
6460
|
+
}
|
|
6461
|
+
/**
|
|
6462
|
+
* Rule is matched when at least one condition matched
|
|
6463
|
+
*/
|
|
6464
|
+
checkOr(bankTransaction) {
|
|
6465
|
+
for (const condition of this.conditions) {
|
|
6466
|
+
if (condition.matchBankTransaction(bankTransaction)) {
|
|
6467
|
+
return true;
|
|
6468
|
+
}
|
|
6469
|
+
}
|
|
6470
|
+
return false;
|
|
6471
|
+
}
|
|
6472
|
+
/**
|
|
6473
|
+
* Create allocation rule based on bank transaction (just prefill rule fields with bank transaction values)
|
|
6474
|
+
*/
|
|
6475
|
+
static fromBankTransaction(bankTransaction) {
|
|
6476
|
+
return plainToClass(AllocationRule, {
|
|
6477
|
+
type: bankTransaction.isDebit() ? AllocationRuleTypeEnum.EXPENSE : AllocationRuleTypeEnum.INCOME,
|
|
6478
|
+
bankAccount: bankTransaction.bankAccount,
|
|
6479
|
+
conditionOperator: AllocationRuleConditionOperatorEnum.AND,
|
|
6480
|
+
conditions: [
|
|
6481
|
+
plainToClass(AllocationRuleCondition, {
|
|
6482
|
+
field: AllocationRuleConditionFieldEnum.AMOUNT,
|
|
6483
|
+
comparisonOperator: AllocationRuleConditionComparisonOperatorEnum.EQUALS,
|
|
6484
|
+
value: bankTransaction.amount
|
|
6485
|
+
}),
|
|
6486
|
+
plainToClass(AllocationRuleCondition, {
|
|
6487
|
+
field: AllocationRuleConditionFieldEnum.DESCRIPTION,
|
|
6488
|
+
comparisonOperator: AllocationRuleConditionComparisonOperatorEnum.EQUALS,
|
|
6489
|
+
value: bankTransaction.description
|
|
6490
|
+
})
|
|
6491
|
+
]
|
|
6492
|
+
});
|
|
6493
|
+
}
|
|
6494
|
+
}
|
|
6495
|
+
__decorate([
|
|
6496
|
+
Type(() => BankAccount),
|
|
6497
|
+
Transform(({ value }) => ({ id: value.id }), { toPlainOnly: true })
|
|
6498
|
+
], AllocationRule.prototype, "bankAccount", void 0);
|
|
6499
|
+
__decorate([
|
|
6500
|
+
Type(() => AllocationRuleCondition)
|
|
6501
|
+
], AllocationRule.prototype, "conditions", void 0);
|
|
6502
|
+
__decorate([
|
|
6503
|
+
Type(() => AllocationRuleTransaction)
|
|
6504
|
+
], AllocationRule.prototype, "transaction", void 0);
|
|
6505
|
+
__decorate([
|
|
6506
|
+
Type(() => BankAccount)
|
|
6507
|
+
], AllocationRule.prototype, "transferBankAccount", void 0);
|
|
6508
|
+
|
|
6509
|
+
/**
|
|
6510
|
+
* Enum with income amount types (Net or Gross)
|
|
6511
|
+
*/
|
|
6512
|
+
var IncomeAmountTypeEnum;
|
|
6513
|
+
(function (IncomeAmountTypeEnum) {
|
|
6514
|
+
IncomeAmountTypeEnum[IncomeAmountTypeEnum["NET"] = 0] = "NET";
|
|
6515
|
+
IncomeAmountTypeEnum[IncomeAmountTypeEnum["GROSS"] = 1] = "GROSS";
|
|
6516
|
+
})(IncomeAmountTypeEnum || (IncomeAmountTypeEnum = {}));
|
|
6517
|
+
|
|
6502
6518
|
var TransactionCategoryEnum;
|
|
6503
6519
|
(function (TransactionCategoryEnum) {
|
|
6504
6520
|
TransactionCategoryEnum[TransactionCategoryEnum["PROPERTY"] = 0] = "PROPERTY";
|
|
@@ -11175,7 +11191,6 @@ var BankConnectionMessagesEnum;
|
|
|
11175
11191
|
* service handles BankConnection management
|
|
11176
11192
|
*/
|
|
11177
11193
|
class BankConnectionService extends RestService$1 {
|
|
11178
|
-
// mercureTopic = 'bankConnections';
|
|
11179
11194
|
constructor(environment) {
|
|
11180
11195
|
super(environment);
|
|
11181
11196
|
this.environment = environment;
|
|
@@ -11183,6 +11198,7 @@ class BankConnectionService extends RestService$1 {
|
|
|
11183
11198
|
this.collectionClass = Collection;
|
|
11184
11199
|
this.endpointUri = 'bank-connections';
|
|
11185
11200
|
this.disabledMethods = ['postBatch', 'putBatch', 'delete', 'deleteBatch'];
|
|
11201
|
+
this.mercureTopic = 'bankConnections';
|
|
11186
11202
|
this.listenEvents();
|
|
11187
11203
|
}
|
|
11188
11204
|
listenEvents() {
|
|
@@ -11740,7 +11756,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
11740
11756
|
* Service for work with messages
|
|
11741
11757
|
*/
|
|
11742
11758
|
class MessageService extends RestService$1 {
|
|
11743
|
-
// mercureTopic = 'messages';
|
|
11744
11759
|
constructor(environment) {
|
|
11745
11760
|
super(environment);
|
|
11746
11761
|
this.environment = environment;
|
|
@@ -11748,6 +11763,7 @@ class MessageService extends RestService$1 {
|
|
|
11748
11763
|
this.collectionClass = MessageCollection;
|
|
11749
11764
|
this.endpointUri = 'messages';
|
|
11750
11765
|
this.disabledMethods = ['postBatch', 'putBatch'];
|
|
11766
|
+
this.mercureTopic = 'messages';
|
|
11751
11767
|
this.listenEvents();
|
|
11752
11768
|
}
|
|
11753
11769
|
listenEvents() {
|
|
@@ -12196,13 +12212,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
12196
12212
|
}] });
|
|
12197
12213
|
|
|
12198
12214
|
class ClientInviteService extends RestService$1 {
|
|
12199
|
-
// mercureTopic = 'clientInvites';
|
|
12200
12215
|
constructor(environment) {
|
|
12201
12216
|
super(environment);
|
|
12202
12217
|
this.environment = environment;
|
|
12203
12218
|
this.endpointUri = 'clients/invites';
|
|
12204
12219
|
this.collectionClass = ClientInviteCollection;
|
|
12205
12220
|
this.modelClass = ClientInvite;
|
|
12221
|
+
this.mercureTopic = 'clientInvites';
|
|
12206
12222
|
this.listenEvents();
|
|
12207
12223
|
}
|
|
12208
12224
|
listenEvents() {
|
|
@@ -12303,7 +12319,6 @@ var ClientInviteMessages;
|
|
|
12303
12319
|
})(ClientInviteMessages || (ClientInviteMessages = {}));
|
|
12304
12320
|
|
|
12305
12321
|
class ClientMovementService extends RestService$1 {
|
|
12306
|
-
// mercureTopic = 'clientMovements';
|
|
12307
12322
|
constructor(environment) {
|
|
12308
12323
|
super(environment);
|
|
12309
12324
|
this.environment = environment;
|
|
@@ -12311,6 +12326,7 @@ class ClientMovementService extends RestService$1 {
|
|
|
12311
12326
|
this.collectionClass = ClientMovementCollection;
|
|
12312
12327
|
this.modelClass = ClientMovement;
|
|
12313
12328
|
this.disabledMethods = ['postBatch', 'delete', 'deleteBatch'];
|
|
12329
|
+
this.mercureTopic = 'clientMovements';
|
|
12314
12330
|
this.listenEvents();
|
|
12315
12331
|
}
|
|
12316
12332
|
listenEvents() {
|
|
@@ -14039,13 +14055,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
14039
14055
|
}] });
|
|
14040
14056
|
|
|
14041
14057
|
class ServicePaymentMethodService extends RestService$1 {
|
|
14042
|
-
// mercureTopic = 'servicePaymentMethods';
|
|
14043
14058
|
constructor(environment) {
|
|
14044
14059
|
super(environment);
|
|
14045
14060
|
this.environment = environment;
|
|
14046
14061
|
this.endpointUri = 'service-payment-methods';
|
|
14047
14062
|
this.collectionClass = Collection;
|
|
14048
14063
|
this.modelClass = ServicePaymentMethod;
|
|
14064
|
+
this.mercureTopic = 'servicePaymentMethods';
|
|
14049
14065
|
this.listenEvents();
|
|
14050
14066
|
}
|
|
14051
14067
|
listenEvents() {
|
|
@@ -14111,7 +14127,6 @@ var SubscriptionMessagesEnum;
|
|
|
14111
14127
|
* @TODO Alex refactor
|
|
14112
14128
|
*/
|
|
14113
14129
|
class SubscriptionService extends RestService$1 {
|
|
14114
|
-
// mercureTopic = 'serviceSubscriptions';
|
|
14115
14130
|
constructor(http, environment) {
|
|
14116
14131
|
super(environment);
|
|
14117
14132
|
this.http = http;
|
|
@@ -14120,6 +14135,7 @@ class SubscriptionService extends RestService$1 {
|
|
|
14120
14135
|
this.modelClass = ServiceSubscription;
|
|
14121
14136
|
this.collectionClass = ServiceSubscriptionCollection;
|
|
14122
14137
|
this.disabledMethods = ['putBatch', 'delete', 'deleteBatch'];
|
|
14138
|
+
this.mercureTopic = 'serviceSubscriptions';
|
|
14123
14139
|
this.listenEvents();
|
|
14124
14140
|
}
|
|
14125
14141
|
listenEvents() {
|
|
@@ -23193,7 +23209,6 @@ class TransactionForm extends TransactionBaseForm {
|
|
|
23193
23209
|
date: transaction.date,
|
|
23194
23210
|
claimPercent: (transaction.claimPercent * childTransaction.chartAccounts?.taxablePercent) / 100,
|
|
23195
23211
|
source: TransactionSourceEnum.BANK_TRANSACTION,
|
|
23196
|
-
type: childTransaction.chartAccounts?.isExpense() ? TransactionTypeEnum.DEBIT : TransactionTypeEnum.CREDIT,
|
|
23197
23212
|
incomeSource: transaction.incomeSource,
|
|
23198
23213
|
property: transaction.property
|
|
23199
23214
|
}, this.model.transactions.find((transaction) => transaction.id === childTransaction['id']) || {}, childTransaction));
|