taxtank-core 0.23.3 → 0.23.6
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/bundles/taxtank-core.umd.js +140 -14
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/collection-dictionary.js +2 -2
- package/esm2015/lib/collections/property/property-sale/property-sale.collection.js +16 -0
- package/esm2015/lib/collections/property/property.collection.js +13 -1
- package/esm2015/lib/forms/report/my-tax/index.js +2 -1
- package/esm2015/lib/forms/report/my-tax/my-tax-cgt.form.js +25 -0
- package/esm2015/lib/models/property/property-sale/property-sale.js +10 -1
- package/esm2015/lib/models/property/property.js +13 -1
- package/esm2015/lib/models/report/my-tax/index.js +3 -1
- package/esm2015/lib/models/report/my-tax/my-tax-cgt/cgt-exemption-and-rollover-code.enum.js +9 -0
- package/esm2015/lib/models/report/my-tax/my-tax-cgt/my-tax-cgt.js +26 -0
- package/esm2015/lib/services/http/bank/bank-connection/bank-connection.service.js +3 -1
- package/esm2015/public-api.js +2 -1
- package/fesm2015/taxtank-core.js +116 -12
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/collection-dictionary.d.ts +1 -1
- package/lib/collections/property/property-sale/property-sale.collection.d.ts +10 -0
- package/lib/collections/property/property.collection.d.ts +8 -0
- package/lib/forms/report/my-tax/index.d.ts +1 -0
- package/lib/forms/report/my-tax/my-tax-cgt.form.d.ts +5 -0
- package/lib/models/property/property-sale/property-sale.d.ts +5 -0
- package/lib/models/property/property.d.ts +10 -0
- package/lib/models/report/my-tax/index.d.ts +2 -0
- package/lib/models/report/my-tax/my-tax-cgt/cgt-exemption-and-rollover-code.enum.d.ts +7 -0
- package/lib/models/report/my-tax/my-tax-cgt/my-tax-cgt.d.ts +23 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -4479,9 +4479,13 @@
|
|
|
4479
4479
|
if (items === void 0) { items = []; }
|
|
4480
4480
|
return new this.collectionConstructor(items);
|
|
4481
4481
|
};
|
|
4482
|
-
CollectionDictionary.prototype
|
|
4483
|
-
|
|
4484
|
-
|
|
4482
|
+
Object.defineProperty(CollectionDictionary.prototype, "length", {
|
|
4483
|
+
get: function () {
|
|
4484
|
+
return this.keys.length;
|
|
4485
|
+
},
|
|
4486
|
+
enumerable: false,
|
|
4487
|
+
configurable: true
|
|
4488
|
+
});
|
|
4485
4489
|
/**
|
|
4486
4490
|
* @Todo find a better solution to get list of the sorted keys
|
|
4487
4491
|
* Get array of the "keys" by provided order
|
|
@@ -4931,6 +4935,13 @@
|
|
|
4931
4935
|
Property.prototype.isOneYearExemptionApplicable = function (sale) {
|
|
4932
4936
|
return sale.grossCGT > 0 && this.getOwnershipDuration(sale, 'years') > 0;
|
|
4933
4937
|
};
|
|
4938
|
+
/**
|
|
4939
|
+
* CGT is not applicable for properties acquired before 20.09.1985 (tax didn't exist before this date).
|
|
4940
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form ("Capital gains or losses" section)
|
|
4941
|
+
*/
|
|
4942
|
+
Property.prototype.isCGTApplicable = function () {
|
|
4943
|
+
return this.contractDate >= Property.preCGTAssetDate;
|
|
4944
|
+
};
|
|
4934
4945
|
/**
|
|
4935
4946
|
* ownership duration from purchase till sale
|
|
4936
4947
|
*/
|
|
@@ -4948,6 +4959,11 @@
|
|
|
4948
4959
|
};
|
|
4949
4960
|
return Property;
|
|
4950
4961
|
}(Property$1));
|
|
4962
|
+
/**
|
|
4963
|
+
* Property acquired before 20 September 1985 will generally be treated as pre-Capital Gains Tax (CGT) assets.
|
|
4964
|
+
* Any assets acquired before this day are CGT exempt (because the tax didn't exist before this date).
|
|
4965
|
+
*/
|
|
4966
|
+
Property.preCGTAssetDate = new Date(1985, 9, 20);
|
|
4951
4967
|
__decorate([
|
|
4952
4968
|
classTransformer.Type(function () { return Date; })
|
|
4953
4969
|
], Property.prototype, "contractDate", void 0);
|
|
@@ -5398,6 +5414,17 @@
|
|
|
5398
5414
|
return BankAccountCollection;
|
|
5399
5415
|
}(Collection));
|
|
5400
5416
|
|
|
5417
|
+
/**
|
|
5418
|
+
* any event happened in the app, which needs to be handled somehow (distributed to other part of the app)
|
|
5419
|
+
*/
|
|
5420
|
+
var AppEvent = /** @class */ (function () {
|
|
5421
|
+
function AppEvent(type, payload) {
|
|
5422
|
+
this.type = type;
|
|
5423
|
+
this.payload = payload;
|
|
5424
|
+
}
|
|
5425
|
+
return AppEvent;
|
|
5426
|
+
}());
|
|
5427
|
+
|
|
5401
5428
|
/**
|
|
5402
5429
|
* BankConnection means user account at specific bank (usually each user has only one at the same bank)
|
|
5403
5430
|
* service handles BankConnection management
|
|
@@ -5433,6 +5460,7 @@
|
|
|
5433
5460
|
_this.cacheSubject.next(cloneDeep__default["default"](_this.cache));
|
|
5434
5461
|
}
|
|
5435
5462
|
}
|
|
5463
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BANK_CONNECTION_ADDED, null));
|
|
5436
5464
|
return classTransformer.plainToClass(BankConnection, connection);
|
|
5437
5465
|
}));
|
|
5438
5466
|
};
|
|
@@ -6649,6 +6677,12 @@
|
|
|
6649
6677
|
PropertyCollection.prototype.getSharedProperties = function () {
|
|
6650
6678
|
return new PropertyCollection(this.items.filter(function (property) { return !property.isOwn(); }));
|
|
6651
6679
|
};
|
|
6680
|
+
/**
|
|
6681
|
+
* Properties that are taxed and will be included in reports (Tax summary, My tax report, e.t.c.)
|
|
6682
|
+
*/
|
|
6683
|
+
PropertyCollection.prototype.getTaxInclusive = function () {
|
|
6684
|
+
return this.create(this.items.filter(function (property) { return property.category.isTaxInclusive; }));
|
|
6685
|
+
};
|
|
6652
6686
|
PropertyCollection.prototype.getUnsold = function () {
|
|
6653
6687
|
return this.create(this.items.filter(function (property) { return !property.isSold(); }));
|
|
6654
6688
|
};
|
|
@@ -6693,6 +6727,12 @@
|
|
|
6693
6727
|
enumerable: false,
|
|
6694
6728
|
configurable: true
|
|
6695
6729
|
});
|
|
6730
|
+
/**
|
|
6731
|
+
* list of properties
|
|
6732
|
+
*/
|
|
6733
|
+
PropertyCollection.prototype.getCGTApplicable = function () {
|
|
6734
|
+
return this.create(this.items.filter(function (property) { return property.isCGTApplicable(); }));
|
|
6735
|
+
};
|
|
6696
6736
|
PropertyCollection.prototype.getOwnerOccupiedProperties = function () {
|
|
6697
6737
|
return new PropertyCollection(this.items.filter(function (property) { return property.category.isOwnerOccupied(); }));
|
|
6698
6738
|
};
|
|
@@ -6752,6 +6792,30 @@
|
|
|
6752
6792
|
return PropertyCollection;
|
|
6753
6793
|
}(Collection));
|
|
6754
6794
|
|
|
6795
|
+
var PropertySaleCollection = /** @class */ (function (_super) {
|
|
6796
|
+
__extends(PropertySaleCollection, _super);
|
|
6797
|
+
function PropertySaleCollection() {
|
|
6798
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
6799
|
+
}
|
|
6800
|
+
Object.defineProperty(PropertySaleCollection.prototype, "grossCGT", {
|
|
6801
|
+
get: function () {
|
|
6802
|
+
return this.create(this.items.filter(function (propertySale) { return propertySale.grossCGT > 0; })).sumBy('grossCGT');
|
|
6803
|
+
},
|
|
6804
|
+
enumerable: false,
|
|
6805
|
+
configurable: true
|
|
6806
|
+
});
|
|
6807
|
+
/**
|
|
6808
|
+
* Property sales are CGT applicable unless it has "Principle place of residence" exemption type
|
|
6809
|
+
*/
|
|
6810
|
+
PropertySaleCollection.prototype.getCGTApplicable = function () {
|
|
6811
|
+
return this.create(this.items.filter(function (propertySale) { return propertySale.isCGTApplicable(); }));
|
|
6812
|
+
};
|
|
6813
|
+
PropertySaleCollection.prototype.getByPropertyShareIds = function (ids) {
|
|
6814
|
+
return this.filterBy('share.id', ids);
|
|
6815
|
+
};
|
|
6816
|
+
return PropertySaleCollection;
|
|
6817
|
+
}(Collection));
|
|
6818
|
+
|
|
6755
6819
|
/**
|
|
6756
6820
|
* Enum with symbols based on depreciation LVP asset type
|
|
6757
6821
|
*/
|
|
@@ -8982,17 +9046,6 @@
|
|
|
8982
9046
|
classTransformer.Type(function () { return User; })
|
|
8983
9047
|
], EmployeeInvite.prototype, "employee", void 0);
|
|
8984
9048
|
|
|
8985
|
-
/**
|
|
8986
|
-
* any event happened in the app, which needs to be handled somehow (distributed to other part of the app)
|
|
8987
|
-
*/
|
|
8988
|
-
var AppEvent = /** @class */ (function () {
|
|
8989
|
-
function AppEvent(type, payload) {
|
|
8990
|
-
this.type = type;
|
|
8991
|
-
this.payload = payload;
|
|
8992
|
-
}
|
|
8993
|
-
return AppEvent;
|
|
8994
|
-
}());
|
|
8995
|
-
|
|
8996
9049
|
exports.ExportFormatEnum = void 0;
|
|
8997
9050
|
(function (ExportFormatEnum) {
|
|
8998
9051
|
ExportFormatEnum["PDF"] = "PDF";
|
|
@@ -9603,6 +9656,14 @@
|
|
|
9603
9656
|
enumerable: false,
|
|
9604
9657
|
configurable: true
|
|
9605
9658
|
});
|
|
9659
|
+
/**
|
|
9660
|
+
* CGT is not applicable for sales with "Principle place of residence" exemption type.
|
|
9661
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form ("Capital gains or losses" section)
|
|
9662
|
+
*/
|
|
9663
|
+
PropertySale.prototype.isCGTApplicable = function () {
|
|
9664
|
+
var _a;
|
|
9665
|
+
return ((_a = this.taxExemption) === null || _a === void 0 ? void 0 : _a.id) !== exports.TaxExemptionEnum.PPR;
|
|
9666
|
+
};
|
|
9606
9667
|
return PropertySale;
|
|
9607
9668
|
}(PropertySale$1));
|
|
9608
9669
|
__decorate([
|
|
@@ -9673,6 +9734,43 @@
|
|
|
9673
9734
|
return MyTaxBusinessOrLosses;
|
|
9674
9735
|
}());
|
|
9675
9736
|
|
|
9737
|
+
;
|
|
9738
|
+
/**
|
|
9739
|
+
* Report related to Property sales CGT details.
|
|
9740
|
+
* All fields are about current year, except netCapitalLoss
|
|
9741
|
+
*
|
|
9742
|
+
*/
|
|
9743
|
+
var MyTaxCgt = /** @class */ (function () {
|
|
9744
|
+
function MyTaxCgt() {
|
|
9745
|
+
}
|
|
9746
|
+
MyTaxCgt.createFrom = function (propertySales, properties, clientCapitalLoss) {
|
|
9747
|
+
return classTransformer.plainToClass(MyTaxCgt, {
|
|
9748
|
+
hasCapitalGain: !!propertySales.grossCGT,
|
|
9749
|
+
hasExemption: this.isCGTApplicable(propertySales, properties),
|
|
9750
|
+
netCapitalGain: propertySales.sumBy('netCGT'),
|
|
9751
|
+
grossCapitalGain: propertySales.grossCGT,
|
|
9752
|
+
netCapitalLoss: clientCapitalLoss
|
|
9753
|
+
});
|
|
9754
|
+
};
|
|
9755
|
+
/**
|
|
9756
|
+
* Exemption is applicable for PPR sales and properties acquired before Property.preCGTAssetDate
|
|
9757
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form ("Capital gains or losses" section)
|
|
9758
|
+
*/
|
|
9759
|
+
MyTaxCgt.isCGTApplicable = function (sales, properties) {
|
|
9760
|
+
return !sales.getCGTApplicable().length || !properties.getCGTApplicable().length;
|
|
9761
|
+
};
|
|
9762
|
+
return MyTaxCgt;
|
|
9763
|
+
}());
|
|
9764
|
+
|
|
9765
|
+
/**
|
|
9766
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form ("Capital gains or losses" section)
|
|
9767
|
+
*/
|
|
9768
|
+
exports.CgtExemptionAndRolloverCodeEnum = void 0;
|
|
9769
|
+
(function (CgtExemptionAndRolloverCodeEnum) {
|
|
9770
|
+
CgtExemptionAndRolloverCodeEnum[CgtExemptionAndRolloverCodeEnum["MAIN_RESIDENT_EXEMPTION_I"] = 0] = "MAIN_RESIDENT_EXEMPTION_I";
|
|
9771
|
+
CgtExemptionAndRolloverCodeEnum[CgtExemptionAndRolloverCodeEnum["PRE_CGT_ASSET_J"] = 1] = "PRE_CGT_ASSET_J";
|
|
9772
|
+
})(exports.CgtExemptionAndRolloverCodeEnum || (exports.CgtExemptionAndRolloverCodeEnum = {}));
|
|
9773
|
+
|
|
9676
9774
|
/**
|
|
9677
9775
|
* Const with the categories for my-tax 'Deductions' report.
|
|
9678
9776
|
* Grouped by ChartAccountsHeadingListEnum / ChartAccountsListEnum based on rules from documentation
|
|
@@ -16230,6 +16328,31 @@
|
|
|
16230
16328
|
return MyTaxBusinessOrLossesForm;
|
|
16231
16329
|
}(AbstractForm));
|
|
16232
16330
|
|
|
16331
|
+
var MyTaxCgtForm = /** @class */ (function (_super) {
|
|
16332
|
+
__extends(MyTaxCgtForm, _super);
|
|
16333
|
+
function MyTaxCgtForm(gainsOrLosses) {
|
|
16334
|
+
var _this = _super.call(this, {
|
|
16335
|
+
hasCapitalGain: new forms.FormControl(gainsOrLosses.hasCapitalGain),
|
|
16336
|
+
hasExemption: new forms.FormControl(gainsOrLosses.hasExemption),
|
|
16337
|
+
exemptionType: new forms.FormControl(null, conditionalValidator(function () { return _this.get('hasExemption').value; }, forms.Validators.required)),
|
|
16338
|
+
netCapitalGain: new forms.FormControl({
|
|
16339
|
+
value: gainsOrLosses.netCapitalGain,
|
|
16340
|
+
disabled: true
|
|
16341
|
+
}),
|
|
16342
|
+
grossCapitalGain: new forms.FormControl({
|
|
16343
|
+
value: gainsOrLosses.grossCapitalGain,
|
|
16344
|
+
disabled: true
|
|
16345
|
+
}),
|
|
16346
|
+
netCapitalLoss: new forms.FormControl({
|
|
16347
|
+
value: gainsOrLosses.netCapitalLoss,
|
|
16348
|
+
disabled: true
|
|
16349
|
+
})
|
|
16350
|
+
}) || this;
|
|
16351
|
+
return _this;
|
|
16352
|
+
}
|
|
16353
|
+
return MyTaxCgtForm;
|
|
16354
|
+
}(AbstractForm));
|
|
16355
|
+
|
|
16233
16356
|
var MyTaxDeductionsForm = /** @class */ (function (_super) {
|
|
16234
16357
|
__extends(MyTaxDeductionsForm, _super);
|
|
16235
16358
|
function MyTaxDeductionsForm(deductions) {
|
|
@@ -16805,6 +16928,8 @@
|
|
|
16805
16928
|
exports.MyAccountHistory = MyAccountHistory;
|
|
16806
16929
|
exports.MyTaxBusinessOrLosses = MyTaxBusinessOrLosses;
|
|
16807
16930
|
exports.MyTaxBusinessOrLossesForm = MyTaxBusinessOrLossesForm;
|
|
16931
|
+
exports.MyTaxCgt = MyTaxCgt;
|
|
16932
|
+
exports.MyTaxCgtForm = MyTaxCgtForm;
|
|
16808
16933
|
exports.MyTaxDeductions = MyTaxDeductions;
|
|
16809
16934
|
exports.MyTaxDeductionsForm = MyTaxDeductionsForm;
|
|
16810
16935
|
exports.MyTaxDividends = MyTaxDividends;
|
|
@@ -16858,6 +16983,7 @@
|
|
|
16858
16983
|
exports.PropertyReportItemTransaction = PropertyReportItemTransaction;
|
|
16859
16984
|
exports.PropertyReportItemTransactionCollection = PropertyReportItemTransactionCollection;
|
|
16860
16985
|
exports.PropertySale = PropertySale;
|
|
16986
|
+
exports.PropertySaleCollection = PropertySaleCollection;
|
|
16861
16987
|
exports.PropertySaleService = PropertySaleService;
|
|
16862
16988
|
exports.PropertySaleTaxExemptionMetadata = PropertySaleTaxExemptionMetadata;
|
|
16863
16989
|
exports.PropertyService = PropertyService;
|