taxtank-core 0.21.3 → 0.21.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.
@@ -3378,6 +3378,12 @@
3378
3378
  BankAccount.prototype.isPropertyTank = function () {
3379
3379
  return this.tankType === exports.TankTypeEnum.PROPERTY;
3380
3380
  };
3381
+ /**
3382
+ * check if bank account related to sole tank
3383
+ */
3384
+ BankAccount.prototype.isSoleTank = function () {
3385
+ return this.tankType === exports.TankTypeEnum.SOLE;
3386
+ };
3381
3387
  /**
3382
3388
  * Get Bank account property by id
3383
3389
  * @param id Id of property
@@ -3612,15 +3618,17 @@
3612
3618
  var connection = classTransformer.plainToClass(BankConnection, bankConnectionBase);
3613
3619
  // We use this endpoint for create and reconnect bank connections because of basiq logic.
3614
3620
  // So we try to replace bank connection in cache for reconnection case.
3615
- if (bankConnection.id) {
3616
- var tempCache = cloneDeep__default["default"](_this.cache);
3617
- replace(tempCache, connection);
3618
- _this.cache = cloneDeep__default["default"](tempCache);
3619
- _this.cacheSubject.next(tempCache);
3620
- }
3621
- else {
3622
- _this.cache.push(connection);
3623
- _this.cacheSubject.next(cloneDeep__default["default"](_this.cache));
3621
+ if (_this.cache) {
3622
+ if (bankConnection.id) {
3623
+ var tempCache = cloneDeep__default["default"](_this.cache);
3624
+ replace(tempCache, connection);
3625
+ _this.cache = tempCache;
3626
+ _this.cacheSubject.next(_this.cache);
3627
+ }
3628
+ else {
3629
+ _this.cache.push(connection);
3630
+ _this.cacheSubject.next(cloneDeep__default["default"](_this.cache));
3631
+ }
3624
3632
  }
3625
3633
  return classTransformer.plainToClass(BankConnection, connection);
3626
3634
  }));
@@ -3705,12 +3713,11 @@
3705
3713
  */
3706
3714
  BasiqService.prototype.updateConnection = function (data, userId, connection) {
3707
3715
  var _this = this;
3708
- // Send login data to basiq API to create a basiq job
3716
+ // Send login data and connection id to basiq API to create a basiq job
3709
3717
  return this.http.post(BasiqService.basiqApiUrl + "/users/" + userId + "/connections", Object.assign(data, { id: connection.externalId }))
3710
- .pipe(
3711
- // Create bank connection based on basiq job
3712
- operators.mergeMap(function (response) {
3713
- return _this.bankConnectionService.add(classTransformer.plainToClass(BankConnection, Object.assign({ id: connection.id, basiqJob: { externalId: response.id } })));
3718
+ .pipe(operators.mergeMap(function (response) {
3719
+ // Create bank connection based on basiq job
3720
+ return _this.bankConnectionService.add(classTransformer.plainToClass(BankConnection, { id: connection.id, basiqJob: { externalId: response.id } }));
3714
3721
  }), operators.catchError(function (error) {
3715
3722
  // Show error when user provided wrong login data
3716
3723
  if (error.status === 401) {
@@ -4538,9 +4545,9 @@
4538
4545
  });
4539
4546
  DepreciationCollection.prototype.getClaimAmountByYear = function (year) {
4540
4547
  if (year === void 0) { year = +localStorage.getItem('financialYear'); }
4541
- return this.amount - this.items.reduce(function (sum, depreciation) {
4548
+ return +Math.round(this.amount - this.items.reduce(function (sum, depreciation) {
4542
4549
  return sum + depreciation.getCloseBalanceByYear(year);
4543
- }, 0);
4550
+ }, 0)).toFixed(2);
4544
4551
  };
4545
4552
  DepreciationCollection.prototype.getCloseBalanceByYear = function (year) {
4546
4553
  if (year === void 0) { year = +localStorage.getItem('financialYear'); }
@@ -11543,6 +11550,13 @@
11543
11550
  return response.map(function (item) { return classTransformer.plainToClass(ChartAccounts, item); });
11544
11551
  }))
11545
11552
  .subscribe(function (chartAccounts) {
11553
+ // Sort personal chart accounts by name (TT-1950)
11554
+ chartAccounts.sort(function (a, b) {
11555
+ if (a.isPersonal() && b.isPersonal()) {
11556
+ return a.name > b.name ? 1 : -1;
11557
+ }
11558
+ return 0;
11559
+ });
11546
11560
  _this._chartAccounts = chartAccounts;
11547
11561
  _this.chartAccountsSubject.next(_this._chartAccounts);
11548
11562
  });