taxtank-core 0.28.67 → 0.28.68
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 +129 -134
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/models/bank/bank-login-data.js +1 -1
- package/esm2015/lib/models/bank/basiq/basiq-connection-data.interface.js +2 -0
- package/esm2015/lib/models/bank/basiq/basiq-job-response.js +1 -1
- package/esm2015/lib/models/bank/basiq/index.js +2 -1
- package/esm2015/lib/models/event/app-event-type.enum.js +60 -59
- package/esm2015/lib/services/http/bank/bank-connection/bank-connection.service.js +25 -5
- package/esm2015/lib/services/http/bank/basiq/basiq.service.js +47 -72
- package/fesm2015/taxtank-core.js +126 -130
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/models/bank/bank-login-data.d.ts +4 -0
- package/lib/models/bank/basiq/basiq-connection-data.interface.d.ts +8 -0
- package/lib/models/bank/basiq/basiq-job-response.d.ts +1 -0
- package/lib/models/bank/basiq/index.d.ts +1 -0
- package/lib/models/event/app-event-type.enum.d.ts +59 -58
- package/lib/services/http/bank/bank-connection/bank-connection.service.d.ts +3 -0
- package/lib/services/http/bank/basiq/basiq.service.d.ts +16 -21
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs/operators'), require('rxjs'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/get'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('lodash/last'), require('lodash/uniqBy'), require('lodash/concat'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs/operators', 'rxjs', 'class-transformer', '@auth0/angular-jwt', 'lodash/get', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'lodash/last', 'lodash/uniqBy', 'lodash/concat', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs.operators, global.rxjs, global.classTransformer, global.angularJwt, global.get, global.flatten, global.hasIn, global.first, global.last, global.uniqBy, global.concat, global.
|
|
5
|
-
})(this, (function (exports, i0, i1$1, i1, operators, rxjs, classTransformer, angularJwt, get, flatten, hasIn, first, last, uniqBy, concat,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs/operators'), require('rxjs'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/get'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('lodash/last'), require('lodash/uniqBy'), require('lodash/concat'), require('moment'), require('moment-range'), require('lodash/cloneDeep'), require('rxjs/internal/observable/throwError'), require('event-source-polyfill/src/eventsource.min.js'), require('lodash/compact'), require('lodash/differenceBy'), require('@angular/forms'), require('lodash/merge'), require('lodash/isEqual'), require('lodash/fromPairs'), require('lodash'), require('@angular/router'), require('lodash/clone'), require('html2pdf.js'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs/operators', 'rxjs', 'class-transformer', '@auth0/angular-jwt', 'lodash/get', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'lodash/last', 'lodash/uniqBy', 'lodash/concat', 'moment', 'moment-range', 'lodash/cloneDeep', 'rxjs/internal/observable/throwError', 'event-source-polyfill/src/eventsource.min.js', 'lodash/compact', 'lodash/differenceBy', '@angular/forms', 'lodash/merge', 'lodash/isEqual', 'lodash/fromPairs', 'lodash', '@angular/router', 'lodash/clone', 'html2pdf.js', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs.operators, global.rxjs, global.classTransformer, global.angularJwt, global.get, global.flatten, global.hasIn, global.first, global.last, global.uniqBy, global.concat, global.moment$1, global.momentRange, global.cloneDeep$1, global.rxjs["internal/observable/throwError"], global.eventsource_min_js, global.compact, global.differenceBy, global.ng.forms, global.merge, global.isEqual, global.fromPairs, global._, global.ng.router, global.clone, global.html2pdf, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
|
|
5
|
+
})(this, (function (exports, i0, i1$1, i1, operators, rxjs, classTransformer, angularJwt, get, flatten, hasIn, first, last, uniqBy, concat, moment$1, momentRange, cloneDeep$1, throwError, eventsource_min_js, compact, differenceBy, forms, merge, isEqual, fromPairs, _, i1$2, clone, html2pdf, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -567,64 +567,65 @@
|
|
|
567
567
|
AppEventTypeEnum[AppEventTypeEnum["BASIQ_CONSENT_UPDATED"] = 7] = "BASIQ_CONSENT_UPDATED";
|
|
568
568
|
AppEventTypeEnum[AppEventTypeEnum["BASIQ_CONNECTION_UPDATED"] = 8] = "BASIQ_CONNECTION_UPDATED";
|
|
569
569
|
AppEventTypeEnum[AppEventTypeEnum["BASIQ_JOB_CREATED"] = 9] = "BASIQ_JOB_CREATED";
|
|
570
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
571
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
572
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
573
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
574
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
575
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
576
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
577
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
578
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
579
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
580
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
581
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
582
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
583
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
584
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
585
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
586
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
587
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
588
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
589
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
590
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
591
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
592
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
593
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
594
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
595
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
596
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
597
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
598
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
599
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
600
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
601
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
602
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
603
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
604
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
605
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
606
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
607
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
608
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
609
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
610
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
611
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
612
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
613
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
614
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
615
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
616
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
617
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
618
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
619
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
620
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
621
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
622
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
623
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
624
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
625
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
626
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
627
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
570
|
+
AppEventTypeEnum[AppEventTypeEnum["BASIQ_LOGIN_SUCCESS"] = 10] = "BASIQ_LOGIN_SUCCESS";
|
|
571
|
+
AppEventTypeEnum[AppEventTypeEnum["BASIQ_LOGIN_FAILED"] = 11] = "BASIQ_LOGIN_FAILED";
|
|
572
|
+
AppEventTypeEnum[AppEventTypeEnum["CLIENT_INVITE_ACCEPTED"] = 12] = "CLIENT_INVITE_ACCEPTED";
|
|
573
|
+
AppEventTypeEnum[AppEventTypeEnum["CLIENT_OPEN_CHAT"] = 13] = "CLIENT_OPEN_CHAT";
|
|
574
|
+
AppEventTypeEnum[AppEventTypeEnum["CLIENT_TRANSFER_TO_OTHER_EMPLOYEE"] = 14] = "CLIENT_TRANSFER_TO_OTHER_EMPLOYEE";
|
|
575
|
+
AppEventTypeEnum[AppEventTypeEnum["CURRENT_USER_GET_FAILED"] = 15] = "CURRENT_USER_GET_FAILED";
|
|
576
|
+
AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_DELETED"] = 16] = "DEPRECIATION_DELETED";
|
|
577
|
+
AppEventTypeEnum[AppEventTypeEnum["DEPRECIATIONS_CREATED"] = 17] = "DEPRECIATIONS_CREATED";
|
|
578
|
+
AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_UPDATED_WITH_RECEIPT"] = 18] = "DEPRECIATION_UPDATED_WITH_RECEIPT";
|
|
579
|
+
AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT"] = 19] = "DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT";
|
|
580
|
+
AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_RECEIPT_CREATED"] = 20] = "DEPRECIATION_RECEIPT_CREATED";
|
|
581
|
+
AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_RECEIPT_DELETED"] = 21] = "DEPRECIATION_RECEIPT_DELETED";
|
|
582
|
+
AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_CREATED"] = 22] = "INCOME_SOURCES_CREATED";
|
|
583
|
+
AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_UPDATED"] = 23] = "INCOME_SOURCES_UPDATED";
|
|
584
|
+
AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_CREATED"] = 24] = "INCOME_SOURCES_FORECASTS_CREATED";
|
|
585
|
+
AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_UPDATED"] = 25] = "INCOME_SOURCES_FORECASTS_UPDATED";
|
|
586
|
+
AppEventTypeEnum[AppEventTypeEnum["LOAN_UPDATED"] = 26] = "LOAN_UPDATED";
|
|
587
|
+
AppEventTypeEnum[AppEventTypeEnum["LOAN_PAYOUT_UPDATED"] = 27] = "LOAN_PAYOUT_UPDATED";
|
|
588
|
+
AppEventTypeEnum[AppEventTypeEnum["MESSAGE_CREATED"] = 28] = "MESSAGE_CREATED";
|
|
589
|
+
AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_CREATED"] = 29] = "MESSAGE_FILE_CREATED";
|
|
590
|
+
AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_DELETED"] = 30] = "MESSAGE_FILE_DELETED";
|
|
591
|
+
AppEventTypeEnum[AppEventTypeEnum["NOTIFICATION_ADDED"] = 31] = "NOTIFICATION_ADDED";
|
|
592
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DEPRECIATION_CALCULATION_UPDATED"] = 32] = "PROPERTY_DEPRECIATION_CALCULATION_UPDATED";
|
|
593
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED"] = 33] = "PROPERTY_UPDATED";
|
|
594
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED_WITH_DOCUMENT"] = 34] = "PROPERTY_UPDATED_WITH_DOCUMENT";
|
|
595
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DOCUMENT_ADDED"] = 35] = "PROPERTY_DOCUMENT_ADDED";
|
|
596
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_CREATED"] = 36] = "PROPERTY_MOVEMENT_CREATED";
|
|
597
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_UPDATED"] = 37] = "PROPERTY_MOVEMENT_UPDATED";
|
|
598
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_DELETED"] = 38] = "PROPERTY_MOVEMENT_DELETED";
|
|
599
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SHARE_UPDATED"] = 39] = "PROPERTY_SHARE_UPDATED";
|
|
600
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_ADDED"] = 40] = "PROPERTY_SALE_ADDED";
|
|
601
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_DELETED"] = 41] = "PROPERTY_SALE_DELETED";
|
|
602
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 42] = "PROPERTY_SUBSCRIPTION_ADDED";
|
|
603
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 43] = "PROPERTY_SUBSCRIPTION_DELETED";
|
|
604
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 44] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
|
|
605
|
+
AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 45] = "SERVICE_SUBSCRIPTION_UPDATED";
|
|
606
|
+
AppEventTypeEnum[AppEventTypeEnum["SOLE_BUSINESS_CREATED"] = 46] = "SOLE_BUSINESS_CREATED";
|
|
607
|
+
AppEventTypeEnum[AppEventTypeEnum["SOLE_DEPRECIATION_METHOD_UPDATED"] = 47] = "SOLE_DEPRECIATION_METHOD_UPDATED";
|
|
608
|
+
AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_CREATED"] = 48] = "SOLE_DETAILS_CREATED";
|
|
609
|
+
AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_UPDATED"] = 49] = "SOLE_DETAILS_UPDATED";
|
|
610
|
+
AppEventTypeEnum[AppEventTypeEnum["SOLE_INVOICE_PUBLISHED"] = 50] = "SOLE_INVOICE_PUBLISHED";
|
|
611
|
+
AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 51] = "TAX_REVIEW_UPDATED";
|
|
612
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 52] = "TRANSACTION_CREATED";
|
|
613
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 53] = "TRANSACTION_DELETED";
|
|
614
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 54] = "TRANSACTION_UPDATED";
|
|
615
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_RECEIPT"] = 55] = "TRANSACTION_UPDATED_WITH_RECEIPT";
|
|
616
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_DELETED_RECEIPT"] = 56] = "TRANSACTION_UPDATED_WITH_DELETED_RECEIPT";
|
|
617
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_CREATED"] = 57] = "TRANSACTION_RECEIPT_CREATED";
|
|
618
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_DELETED"] = 58] = "TRANSACTION_RECEIPT_DELETED";
|
|
619
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 59] = "TRANSACTIONS_CREATED";
|
|
620
|
+
AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 60] = "USER_UPDATED";
|
|
621
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 61] = "VEHICLE_CLAIM_UPDATED";
|
|
622
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 62] = "VEHICLE_CLAIM_CREATED";
|
|
623
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 63] = "VEHICLE_CLAIM_DETAILS_UPDATED";
|
|
624
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 64] = "VEHICLE_CLAIM_DETAILS_CREATED";
|
|
625
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 65] = "VEHICLE_LOGBOOK_CREATED";
|
|
626
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 66] = "VEHICLE_LOGBOOK_UPDATED";
|
|
627
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 67] = "VEHICLE_LOGBOOK_DELETED";
|
|
628
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 68] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
|
|
628
629
|
})(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
|
|
629
630
|
|
|
630
631
|
var EventDispatcherService = /** @class */ (function () {
|
|
@@ -6783,8 +6784,18 @@
|
|
|
6783
6784
|
_this.cacheSubject.next(cloneDeep__default["default"](_this.cache));
|
|
6784
6785
|
}
|
|
6785
6786
|
}
|
|
6786
|
-
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BANK_CONNECTION_ADDED,
|
|
6787
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BANK_CONNECTION_ADDED, connection));
|
|
6787
6788
|
return classTransformer.plainToClass(BankConnection, connection);
|
|
6789
|
+
}), operators.catchError(function (error) {
|
|
6790
|
+
// Show error when user provided wrong login data
|
|
6791
|
+
if (error.status === 401) {
|
|
6792
|
+
_this.toastService.error('Invalid credentials');
|
|
6793
|
+
}
|
|
6794
|
+
// Show error when user provided another login (not login he used before)
|
|
6795
|
+
if (error.status === 400) {
|
|
6796
|
+
_this.toastService.error('Please enter the login you used before');
|
|
6797
|
+
}
|
|
6798
|
+
return throwError.throwError(error);
|
|
6788
6799
|
}));
|
|
6789
6800
|
};
|
|
6790
6801
|
BankConnectionService.prototype.listenToAddedBankAccounts = function () {
|
|
@@ -6809,10 +6820,19 @@
|
|
|
6809
6820
|
}
|
|
6810
6821
|
});
|
|
6811
6822
|
};
|
|
6823
|
+
/**
|
|
6824
|
+
* Create/reconnect bank connection when user successfully logged in to basiq
|
|
6825
|
+
*/
|
|
6812
6826
|
BankConnectionService.prototype.listenBasiqLogin = function () {
|
|
6813
6827
|
var _this = this;
|
|
6814
|
-
this.eventDispatcherService.on(exports.AppEventTypeEnum.
|
|
6815
|
-
_this.
|
|
6828
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.BASIQ_LOGIN_SUCCESS).subscribe(function (data) {
|
|
6829
|
+
_this.add(classTransformer.plainToClass(BankConnection, { id: data.connectionId, basiqJob: { externalId: data.jobId } }))
|
|
6830
|
+
.subscribe(function () { },
|
|
6831
|
+
// When user already has some bank accounts in handling connection and trying to login with different credentials, backend can not save this connection.
|
|
6832
|
+
// So we should handle this case as failed login
|
|
6833
|
+
function () {
|
|
6834
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_LOGIN_FAILED, null));
|
|
6835
|
+
});
|
|
6816
6836
|
});
|
|
6817
6837
|
};
|
|
6818
6838
|
return BankConnectionService;
|
|
@@ -6836,7 +6856,9 @@
|
|
|
6836
6856
|
*/
|
|
6837
6857
|
var BasiqService = /** @class */ (function (_super) {
|
|
6838
6858
|
__extends(BasiqService, _super);
|
|
6839
|
-
function BasiqService(http, eventDispatcherService, environment, toastService,
|
|
6859
|
+
function BasiqService(http, eventDispatcherService, environment, toastService,
|
|
6860
|
+
// this inject required to init bank connection service and listen basiq login event
|
|
6861
|
+
bankConnectionService) {
|
|
6840
6862
|
var _this = _super.call(this, http, eventDispatcherService, environment, toastService) || this;
|
|
6841
6863
|
_this.http = http;
|
|
6842
6864
|
_this.eventDispatcherService = eventDispatcherService;
|
|
@@ -6852,58 +6874,25 @@
|
|
|
6852
6874
|
*/
|
|
6853
6875
|
BasiqService.prototype.listenEvents = function () {
|
|
6854
6876
|
this.listenNotifications();
|
|
6855
|
-
this.
|
|
6877
|
+
this.listenJobCreated();
|
|
6856
6878
|
};
|
|
6857
6879
|
/**
|
|
6858
|
-
*
|
|
6859
|
-
*
|
|
6860
|
-
*
|
|
6861
|
-
* we interact with basiq service.
|
|
6880
|
+
* Start basiq login process.
|
|
6881
|
+
* Create a basiq job, which contain credentials verifying status.
|
|
6882
|
+
* We can not see login result immediately, because it may take some time (average 10-20 sec)
|
|
6862
6883
|
*/
|
|
6863
|
-
BasiqService.prototype.
|
|
6884
|
+
BasiqService.prototype.login = function (loginData, userId) {
|
|
6864
6885
|
var _this = this;
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
}
|
|
6876
|
-
return throwError.throwError(error);
|
|
6877
|
-
}));
|
|
6878
|
-
};
|
|
6879
|
-
/**
|
|
6880
|
-
* Update disconnected bank connection
|
|
6881
|
-
* Here we have nested requests because we need to get a job id before we create a bank connection.
|
|
6882
|
-
* There is no way to use event dispatcher because we expect some errors from bank-connections API, but in components
|
|
6883
|
-
* we interact with basiq service.
|
|
6884
|
-
*/
|
|
6885
|
-
BasiqService.prototype.updateConnection = function (data, userId, connection) {
|
|
6886
|
-
var _this = this;
|
|
6887
|
-
// Send login data and connection id to basiq API to create a basiq job
|
|
6888
|
-
return this.http.post(BasiqService.basiqApiUrl + "/users/" + userId + "/connections", Object.assign(data, { id: connection.externalId }))
|
|
6889
|
-
.pipe(operators.mergeMap(function (response) {
|
|
6890
|
-
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_JOB_CREATED, response.id));
|
|
6891
|
-
// Create bank connection based on basiq job
|
|
6892
|
-
return _this.bankConnectionService.add(classTransformer.plainToClass(BankConnection, {
|
|
6893
|
-
id: connection.id,
|
|
6894
|
-
basiqJob: { externalId: response.id }
|
|
6895
|
-
}));
|
|
6896
|
-
}), operators.catchError(function (error) {
|
|
6897
|
-
// Show error when user provided wrong login data
|
|
6898
|
-
if (error.status === 401) {
|
|
6899
|
-
_this.toastService.error('Invalid credentials');
|
|
6900
|
-
}
|
|
6901
|
-
// Show error when user provided another login (not login he used before)
|
|
6902
|
-
if (error.status === 400) {
|
|
6903
|
-
_this.toastService.error('Please enter the login you used before');
|
|
6904
|
-
}
|
|
6905
|
-
return throwError.throwError(error);
|
|
6906
|
-
}));
|
|
6886
|
+
this.http.post(BasiqService.basiqApiUrl + "/users/" + userId + "/connections", loginData)
|
|
6887
|
+
.subscribe(function (response) {
|
|
6888
|
+
// we need jobId to check credentials verifying statis from Basiq API
|
|
6889
|
+
// we need connectionId to know if we are creating a new connection or reconnecting existing invalid connection
|
|
6890
|
+
var data = {
|
|
6891
|
+
jobId: response.id,
|
|
6892
|
+
connectionId: loginData.id
|
|
6893
|
+
};
|
|
6894
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_JOB_CREATED, data));
|
|
6895
|
+
});
|
|
6907
6896
|
};
|
|
6908
6897
|
BasiqService.prototype.getByConnection = function (connection) {
|
|
6909
6898
|
return this.get().pipe(operators.map(function (bankAccounts) {
|
|
@@ -6916,32 +6905,38 @@
|
|
|
6916
6905
|
}));
|
|
6917
6906
|
};
|
|
6918
6907
|
/**
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6908
|
+
* Get status of credentials verifying. Expected statuses: 'in-progress', 'failed' or 'success'
|
|
6909
|
+
* We send this request by interval until basiq return success or failed.
|
|
6910
|
+
*
|
|
6911
|
+
* Because of Basiq login may take a long time (10-20sec) we have to check job status until it seccess or failed.
|
|
6912
|
+
*
|
|
6913
|
+
* @TODO Alex (TT-2431): check logic and try to remove subscribe, use pipes instead
|
|
6914
|
+
* @TODO Alex (TT-2431): implement some limit and handle (message or something) if basiq stuck
|
|
6915
|
+
* @TODO Alex (TT-2431): check logic and handle case when user cancelled loading
|
|
6916
|
+
*/
|
|
6917
|
+
BasiqService.prototype.checkLoginStatus = function (data) {
|
|
6926
6918
|
var _this = this;
|
|
6927
|
-
this.http.get(BasiqService.basiqApiUrl + "/jobs/" + jobId)
|
|
6919
|
+
this.http.get(BasiqService.basiqApiUrl + "/jobs/" + data.jobId)
|
|
6928
6920
|
.pipe(
|
|
6929
|
-
// unsubscribe after each request to avoid wrong requests (example: user cancelled too long login and login to another bank, then we will send 2 different requests)
|
|
6930
|
-
operators.take(1),
|
|
6931
6921
|
// get verify-credentials step from basiq job
|
|
6932
|
-
operators.map(function (response) { return classTransformer.plainToClass(BasiqJobResponse, response)
|
|
6922
|
+
operators.map(function (response) { return classTransformer.plainToClass(BasiqJobResponse, response); }),
|
|
6933
6923
|
// check credentials status again if not finished
|
|
6934
|
-
operators.filter(function (
|
|
6935
|
-
if (!
|
|
6924
|
+
operators.filter(function (response) {
|
|
6925
|
+
if (!response.getVerifyCredentialsStep().isInProgress()) {
|
|
6936
6926
|
return true;
|
|
6937
6927
|
}
|
|
6938
6928
|
setTimeout(function () {
|
|
6939
|
-
_this.
|
|
6929
|
+
_this.checkLoginStatus(data);
|
|
6940
6930
|
}, BasiqService.bankCredintialsCheckInterval);
|
|
6941
6931
|
return false;
|
|
6942
6932
|
}))
|
|
6943
|
-
.subscribe(function (
|
|
6944
|
-
|
|
6933
|
+
.subscribe(function (response) {
|
|
6934
|
+
if (response.getVerifyCredentialsStep().isSuccess()) {
|
|
6935
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_LOGIN_SUCCESS, data));
|
|
6936
|
+
}
|
|
6937
|
+
else {
|
|
6938
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_LOGIN_FAILED, null));
|
|
6939
|
+
}
|
|
6945
6940
|
});
|
|
6946
6941
|
};
|
|
6947
6942
|
/**
|
|
@@ -6956,12 +6951,12 @@
|
|
|
6956
6951
|
});
|
|
6957
6952
|
};
|
|
6958
6953
|
/**
|
|
6959
|
-
*
|
|
6954
|
+
* Start check job credential status when it created
|
|
6960
6955
|
*/
|
|
6961
|
-
BasiqService.prototype.
|
|
6956
|
+
BasiqService.prototype.listenJobCreated = function () {
|
|
6962
6957
|
var _this = this;
|
|
6963
|
-
this.eventDispatcherService.on(exports.AppEventTypeEnum.BASIQ_JOB_CREATED).subscribe(function (
|
|
6964
|
-
_this.
|
|
6958
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.BASIQ_JOB_CREATED).subscribe(function (data) {
|
|
6959
|
+
_this.checkLoginStatus(data);
|
|
6965
6960
|
});
|
|
6966
6961
|
};
|
|
6967
6962
|
return BasiqService;
|