taxtank-core 0.21.4 → 0.21.5

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.
@@ -3618,15 +3618,17 @@
3618
3618
  var connection = classTransformer.plainToClass(BankConnection, bankConnectionBase);
3619
3619
  // We use this endpoint for create and reconnect bank connections because of basiq logic.
3620
3620
  // So we try to replace bank connection in cache for reconnection case.
3621
- if (bankConnection.id) {
3622
- var tempCache = cloneDeep__default["default"](_this.cache);
3623
- replace(tempCache, connection);
3624
- _this.cache = cloneDeep__default["default"](tempCache);
3625
- _this.cacheSubject.next(tempCache);
3626
- }
3627
- else {
3628
- _this.cache.push(connection);
3629
- _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
+ }
3630
3632
  }
3631
3633
  return classTransformer.plainToClass(BankConnection, connection);
3632
3634
  }));
@@ -3711,12 +3713,11 @@
3711
3713
  */
3712
3714
  BasiqService.prototype.updateConnection = function (data, userId, connection) {
3713
3715
  var _this = this;
3714
- // 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
3715
3717
  return this.http.post(BasiqService.basiqApiUrl + "/users/" + userId + "/connections", Object.assign(data, { id: connection.externalId }))
3716
- .pipe(
3717
- // Create bank connection based on basiq job
3718
- operators.mergeMap(function (response) {
3719
- 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 } }));
3720
3721
  }), operators.catchError(function (error) {
3721
3722
  // Show error when user provided wrong login data
3722
3723
  if (error.status === 401) {
@@ -11549,6 +11550,13 @@
11549
11550
  return response.map(function (item) { return classTransformer.plainToClass(ChartAccounts, item); });
11550
11551
  }))
11551
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
+ });
11552
11560
  _this._chartAccounts = chartAccounts;
11553
11561
  _this.chartAccountsSubject.next(_this._chartAccounts);
11554
11562
  });