taxtank-core 2.0.109 → 2.0.111

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.
@@ -32,12 +32,12 @@ import moment$1 from 'moment/moment';
32
32
  import { EventSourcePolyfill } from 'event-source-polyfill/src/eventsource.min.js';
33
33
  import clone from 'lodash/clone';
34
34
  import merge from 'lodash/merge';
35
+ import remove from 'lodash/remove';
35
36
  import mixpanel from 'mixpanel-browser';
36
37
  import { JwtHelperService } from '@auth0/angular-jwt';
37
38
  import * as i4 from '@angular/router';
38
39
  import { NavigationEnd } from '@angular/router';
39
40
  import _ from 'lodash';
40
- import remove from 'lodash/remove';
41
41
  import pick from 'lodash/pick';
42
42
  import { checkAdBlock } from 'adblock-checker';
43
43
  import { jsPDF } from 'jspdf';
@@ -755,10 +755,6 @@ class BasiqToken extends AbstractModel {
755
755
  }
756
756
 
757
757
  class BasiqUser extends AbstractModel {
758
- constructor() {
759
- super(...arguments);
760
- this.name = 'Profile1';
761
- }
762
758
  /**
763
759
  * reminder to sign basiq consent after x days before the expiration
764
760
  */
@@ -12595,6 +12591,9 @@ let RestService$1 = class RestService extends DataService {
12595
12591
  hasInCache(id) {
12596
12592
  return !!this.getCache()?.findBy('id', id);
12597
12593
  }
12594
+ fromCache(id) {
12595
+ return this.getCache()?.findBy('id', id);
12596
+ }
12598
12597
  getArray() {
12599
12598
  return this.get().pipe(map((collection) => collection.toArray()));
12600
12599
  }
@@ -13055,6 +13054,12 @@ class BankConnectionService extends RestService$1 {
13055
13054
  break;
13056
13055
  }
13057
13056
  }
13057
+ //
13058
+ const connection = this.fromCache(result.id);
13059
+ if (connection.isReconnecting()) {
13060
+ remove(this.cache.items, { id: result.id, status: BankConnectionStatusEnum.RECONNECTING });
13061
+ this.setCache(this.cache.items, true);
13062
+ }
13058
13063
  return result;
13059
13064
  }), catchError((error) => {
13060
13065
  // Show error when user provided wrong login data
@@ -13071,6 +13076,13 @@ class BankConnectionService extends RestService$1 {
13071
13076
  return throwError(error);
13072
13077
  }));
13073
13078
  }
13079
+ /**
13080
+ * remove basiq connection to create a new one (because basiq has no update option),
13081
+ * used for upgrade to openBanking and manage shared bank accounts flow
13082
+ */
13083
+ deleteBasiq(connection) {
13084
+ return this.put(connection, `${this.apiUrl}/${connection.id}/remove-basiq`);
13085
+ }
13074
13086
  activate(bankConnection) {
13075
13087
  return this.put(bankConnection, `${this.apiUrl}/${bankConnection.id}/activate`);
13076
13088
  }
@@ -13236,17 +13248,6 @@ class BasiqService extends RestService$1 {
13236
13248
  listenEvents() {
13237
13249
  this.listenNotifications();
13238
13250
  }
13239
- /**
13240
- * remove basiq connection to create a new one (because basiq has no update option),
13241
- * used for upgrade to openBanking and manage shared bank accounts flow
13242
- */
13243
- deleteBasiq(connection) {
13244
- return this.http.put(`${this.environment.apiV2}/bank-connections/${connection.id}/remove-basiq`, {})
13245
- .pipe(map((connection) => connection
13246
- // @TODO Alex token should be inside this service
13247
- // this.redirectToBasiqConsent(token.value, connection.bank.externalId, true);
13248
- ));
13249
- }
13250
13251
  /**
13251
13252
  * listen to notifications to update basiq accounts list
13252
13253
  */
@@ -13294,9 +13295,6 @@ class BasiqUserService extends RestService$1 {
13294
13295
  post(basiqUser = new BasiqUser()) {
13295
13296
  return super.post(basiqUser);
13296
13297
  }
13297
- getWithToken(basiqUserId) {
13298
- return this.findBy('id', basiqUserId).pipe(concatMap(user => this.basiqTokenService.getOne(user.id).pipe(map(token => ({ user, token: token.value })))));
13299
- }
13300
13298
  retrieveJob(jobId, basiqUserId) {
13301
13299
  return this.basiqTokenService.getOne(basiqUserId).pipe(concatMap(token => {
13302
13300
  const headers = new HttpHeaders({ Authorization: 'Bearer ' + token.value });
@@ -13309,31 +13307,25 @@ class BasiqUserService extends RestService$1 {
13309
13307
  */
13310
13308
  redirectToBasiqConsent(bankId, basiqUserId) {
13311
13309
  const user$ = basiqUserId ? this.findBy('id', basiqUserId) : this.post();
13312
- return user$.pipe(filter(user => !!user), concatMap(user => this.basiqTokenService.getOne(user.id).pipe(map(token => ({ user, token: token.value })))), map(({ user, token }) => {
13310
+ return user$.pipe(filter(user => !!user), concatMap(user => this.basiqTokenService.getOne(user.id).pipe(map(token => ({ user, token: token })))), map(({ user, token }) => {
13313
13311
  const url = new URL(BasiqUserService.basiqConsentUrl);
13314
- url.searchParams.set('token', token);
13312
+ url.searchParams.set('token', token.value);
13315
13313
  url.searchParams.set('institutionId', bankId);
13316
- url.searchParams.set('state', user.id);
13314
+ // @TODO TT-4883 vik state not coming from basiq
13315
+ localStorage.setItem('basiqUserId', user.id);
13316
+ // url.searchParams.set('state', user.id);
13317
13317
  if (user.consentId) {
13318
13318
  url.searchParams.set('action', 'connect');
13319
13319
  }
13320
13320
  window.location.replace(url.toString());
13321
13321
  }));
13322
13322
  }
13323
- /**
13324
- * Open basiq consent ui to allow user to manage basiq access to his bank data
13325
- */
13326
- redirectToBasiqRevoke(basiqUserId) {
13327
- return this.basiqTokenService.getOne(basiqUserId).pipe(map(token => {
13328
- window.location.replace(`${BasiqUserService.basiqConsentUrl}?token=${token.value}&action=manage`);
13329
- }));
13330
- }
13331
13323
  /**
13332
13324
  * redirect to basiq extend consent date to prolong it
13333
13325
  */
13334
13326
  extendConsent(basiqUserId) {
13335
13327
  return this.basiqTokenService.getOne(basiqUserId).pipe(map(token => {
13336
- window.location.replace(`${BasiqUserService.basiqConsentUrl}?token=${token}&action=extend`);
13328
+ window.location.replace(`${BasiqUserService.basiqConsentUrl}?token=${token.value}&action=extend`);
13337
13329
  }));
13338
13330
  }
13339
13331
  /**
@@ -13341,7 +13333,7 @@ class BasiqUserService extends RestService$1 {
13341
13333
  */
13342
13334
  reauthoriseConnection(connection) {
13343
13335
  return this.basiqTokenService.getOne(connection.basiqUser.id).pipe(map(token => {
13344
- let url = `${BasiqUserService.basiqConsentUrl}?token=${token}&action=reauthorise`;
13336
+ let url = `${BasiqUserService.basiqConsentUrl}?token=${token.value}&action=reauthorise`;
13345
13337
  if (connection.isExpiring()) {
13346
13338
  url += `&connectionId=${connection.externalId}`;
13347
13339
  }
@@ -22030,6 +22022,7 @@ const ENDPOINTS = {
22030
22022
  BASIQ_TOKENS_GET: new Endpoint('GET', '\\/basiq-users\\/tokens'),
22031
22023
  BASIQ_TOKEN_GET: new Endpoint('GET', '\\/basiq-users/\\d+\\/tokens'),
22032
22024
  BASIQ_DELETE: new Endpoint('PUT', '\\/bank-connections/\\d+\\/remove-basiq'),
22025
+ BASIQ_CONSENT_REVOKE: new Endpoint('PUT', '\\/basiq-users\\/\\consents\\/revoke'),
22033
22026
  BASIQ_USERS_GET: new Endpoint('GET', '\\/basiq-users'),
22034
22027
  BASIQ_USERS_POST: new Endpoint('POST', '\\/basiq-users'),
22035
22028
  BASIQ_USERS_PUT: new Endpoint('PUT', '\\/basiq-users\\/\\d+'),