taxtank-core 0.16.5 → 0.16.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 +59 -1
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/services/http/bank/basiq/basiq.service.js +59 -3
- package/fesm2015/taxtank-core.js +57 -1
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/services/http/bank/basiq/basiq.service.d.ts +19 -1
- package/package.json +1 -1
|
@@ -10462,6 +10462,14 @@
|
|
|
10462
10462
|
}]
|
|
10463
10463
|
}] });
|
|
10464
10464
|
|
|
10465
|
+
/**
|
|
10466
|
+
* Basiq consent UI initial URL. Replace USER_ID and TOKEN by user data + handle action parameter
|
|
10467
|
+
*/
|
|
10468
|
+
var BASIQ_CONSENT_URL = 'https://consent.basiq.io/home?userId=USER_ID&token=TOKEN&action=connect';
|
|
10469
|
+
/**
|
|
10470
|
+
* Event message name we listen to handle basiq UI result
|
|
10471
|
+
*/
|
|
10472
|
+
var FINISH_BASIQ_EVENT = 'finish-basiq';
|
|
10465
10473
|
/**
|
|
10466
10474
|
* basiq is a middleman between bank and user
|
|
10467
10475
|
* service is responsible for fetching bank related information
|
|
@@ -10481,6 +10489,7 @@
|
|
|
10481
10489
|
BasiqService.prototype.listenEvents = function () {
|
|
10482
10490
|
this.listenToBankConnectionAdded();
|
|
10483
10491
|
this.listenNotifications();
|
|
10492
|
+
this.listenBasiqConcentUpdated();
|
|
10484
10493
|
};
|
|
10485
10494
|
/**
|
|
10486
10495
|
* Update user's basiq consents data on backend
|
|
@@ -10489,7 +10498,6 @@
|
|
|
10489
10498
|
var _this = this;
|
|
10490
10499
|
return this.http.put(this.environment.apiV2 + "/basiq/consents", {}).pipe(operators.map(function (isConfirmed) {
|
|
10491
10500
|
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_CONSENT_UPDATED, isConfirmed));
|
|
10492
|
-
return isConfirmed;
|
|
10493
10501
|
}));
|
|
10494
10502
|
};
|
|
10495
10503
|
/**
|
|
@@ -10516,6 +10524,9 @@
|
|
|
10516
10524
|
}
|
|
10517
10525
|
return this.tokenSubject.asObservable();
|
|
10518
10526
|
};
|
|
10527
|
+
/**
|
|
10528
|
+
* Get list of user's bank conections
|
|
10529
|
+
*/
|
|
10519
10530
|
BasiqService.prototype.getConnections = function () {
|
|
10520
10531
|
return this.get().pipe(operators.map(function (bankAccounts) {
|
|
10521
10532
|
// get all connections
|
|
@@ -10526,6 +10537,41 @@
|
|
|
10526
10537
|
return __spreadArray([], __read(new Map(connections.map(function (connection) { return [connection.id, connection]; })).values()));
|
|
10527
10538
|
}));
|
|
10528
10539
|
};
|
|
10540
|
+
/**
|
|
10541
|
+
* Listen response from basiq UI to handle result.
|
|
10542
|
+
* @param isBasiqConsentExist flag from User.ClientDetails - true if user confirmed basiq consent
|
|
10543
|
+
* @param callback function we run after basiq UI work is finished
|
|
10544
|
+
*/
|
|
10545
|
+
BasiqService.prototype.listenBasiqResponse = function (isBasiqConsentExist, callback) {
|
|
10546
|
+
var _this = this;
|
|
10547
|
+
window.addEventListener('message', function (message) {
|
|
10548
|
+
if (message.data !== FINISH_BASIQ_EVENT) {
|
|
10549
|
+
return;
|
|
10550
|
+
}
|
|
10551
|
+
// update user's basiq consent confirmation status for the first basiq ui run
|
|
10552
|
+
if (isBasiqConsentExist) {
|
|
10553
|
+
_this.updateConnections().pipe(operators.take(1)).subscribe();
|
|
10554
|
+
}
|
|
10555
|
+
else {
|
|
10556
|
+
_this.confirmConsents().pipe(operators.take(1)).subscribe();
|
|
10557
|
+
}
|
|
10558
|
+
callback();
|
|
10559
|
+
});
|
|
10560
|
+
};
|
|
10561
|
+
/**
|
|
10562
|
+
* Get URL with filled params to run basiq UI iframe
|
|
10563
|
+
*/
|
|
10564
|
+
BasiqService.prototype.generateBasiqConsentUrl = function (user) {
|
|
10565
|
+
return this.getToken().pipe(operators.map(function (token) {
|
|
10566
|
+
var url = BASIQ_CONSENT_URL;
|
|
10567
|
+
url = url.replace('USER_ID', user.basiqId);
|
|
10568
|
+
url = url.replace('TOKEN', token.value);
|
|
10569
|
+
if (!user.clientDetails.basiqConsentExist) {
|
|
10570
|
+
url = url.split('&action')[0];
|
|
10571
|
+
}
|
|
10572
|
+
return url;
|
|
10573
|
+
}));
|
|
10574
|
+
};
|
|
10529
10575
|
/**
|
|
10530
10576
|
* Listen to EventDispatcherService event related to added Bank connection
|
|
10531
10577
|
*/
|
|
@@ -10550,6 +10596,18 @@
|
|
|
10550
10596
|
}
|
|
10551
10597
|
});
|
|
10552
10598
|
};
|
|
10599
|
+
/**
|
|
10600
|
+
* Update user's basiq connections when user confirmed basiq consent
|
|
10601
|
+
*/
|
|
10602
|
+
BasiqService.prototype.listenBasiqConcentUpdated = function () {
|
|
10603
|
+
var _this = this;
|
|
10604
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.BASIQ_CONSENT_UPDATED).subscribe(function (isConfirmed) {
|
|
10605
|
+
if (!isConfirmed) {
|
|
10606
|
+
return;
|
|
10607
|
+
}
|
|
10608
|
+
_this.updateConnections().pipe(operators.take(1)).subscribe();
|
|
10609
|
+
});
|
|
10610
|
+
};
|
|
10553
10611
|
return BasiqService;
|
|
10554
10612
|
}(RestService));
|
|
10555
10613
|
BasiqService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|