@@ -5,6 +5,8 @@ import { ConsentAuthorizeResponse } from '../../api/models/consent-authorize-res
55import { AisService } from '../../common/services/ais.service' ;
66import { SettingsService } from '../../common/services/settings.service' ;
77import { ShareDataService } from '../../common/services/share-data.service' ;
8+ import { PSUAISProvidesAccessToOnlineBankingAccountFunctionalityService } from '../../api/services/psuaisprovides-access-to-online-banking-account-functionality.service' ;
9+ import { AuthService } from '../../common/services/auth.service' ;
810
911@Component ( {
1012 selector : 'app-result-page' ,
@@ -14,15 +16,16 @@ import { ShareDataService } from '../../common/services/share-data.service';
1416export class ResultPageComponent implements OnInit , OnDestroy {
1517 public authResponse : ConsentAuthorizeResponse ;
1618 public scaStatus : string ;
17- public ref : string ;
19+ public aisDoneRequest : PSUAISProvidesAccessToOnlineBankingAccountFunctionalityService . AisDoneUsingGETParams ;
1820 public devPortalLink : string ;
1921
2022 constructor (
2123 private router : Router ,
2224 private route : ActivatedRoute ,
2325 private aisService : AisService ,
2426 private settingService : SettingsService ,
25- private shareService : ShareDataService
27+ private shareService : ShareDataService ,
28+ private authService : AuthService
2629 ) { }
2730
2831 public ngOnInit ( ) : void {
@@ -38,9 +41,12 @@ export class ResultPageComponent implements OnInit, OnDestroy {
3841 oauth2 = false ;
3942 }
4043
41- this . ref =
42- `/oba-proxy/ais/${ params . encryptedConsentId } /authorisation/${ params . authorisationId } ` +
43- `/done?oauth2=${ oauth2 } ` ;
44+ this . aisDoneRequest = {
45+ encryptedConsentId : params . encryptedConsentId ,
46+ authorisationId : params . authorisationId ,
47+ oauth2 : oauth2 ,
48+ authConfirmationCode : null ,
49+ } ;
4450 } ) ;
4551
4652 // get consent data from shared service
@@ -50,14 +56,29 @@ export class ResultPageComponent implements OnInit, OnDestroy {
5056 this . authResponse = authResponse ;
5157 this . scaStatus = this . authResponse . scaStatus ;
5258 if ( authResponse . authConfirmationCode ) {
53- this . ref =
54- this . ref +
55- `&authConfirmationCode=${ authResponse . authConfirmationCode } ` ;
59+ this . aisDoneRequest . authConfirmationCode =
60+ authResponse . authConfirmationCode ;
5661 }
5762 } ) ;
5863 }
5964 } ) ;
6065 }
6166
67+ redirectToDevPortal ( ) {
68+ if ( this . devPortalLink ) {
69+ this . authService . clearSession ( ) ;
70+ window . location . href = this . devPortalLink ;
71+ }
72+ }
73+
74+ redirectToTpp ( ) {
75+ this . aisService . aisDone ( this . aisDoneRequest ) . subscribe ( ( resp ) => {
76+ if ( resp . redirectUrl ) {
77+ this . authService . clearSession ( ) ;
78+ window . location . href = resp . redirectUrl ;
79+ }
80+ } ) ;
81+ }
82+
6283 ngOnDestroy ( ) : void { }
6384}
0 commit comments