@Test void startConsent() { when(consentMapper.accountAccess(any(), any())).thenReturn(getAisAccountAccess(IBAN_DE)); when(cmsPsuAisClient.putAccountAccessInConsent(any(), any(), any())).thenReturn(ResponseEntity.ok().build()); when(consentMapper.toTo(any())).thenReturn(getAisConsentTO()); when(consentRestClient.startSCA(any(), any())).thenReturn(ResponseEntity.ok(getSCAConsentResponseTO())); redirectConsentService.startConsent(getConsentWorkflow(AisConsentRequestType.DEDICATED_ACCOUNTS, IBAN_DE), getAisConsentTO(), Collections.singletonList(getAccountDetails())); verify(consentMapper, times(1)).toTo(getCmsAisAccountConsent(AisConsentRequestType.DEDICATED_ACCOUNTS, IBAN_DE)); }
@Override public void startConsent(final ConsentWorkflow workflow, AisConsentTO aisConsent, List<AccountDetailsTO> listOfAccounts) { AisAccountAccess accountAccess = consentMapper.accountAccess(aisConsent.getAccess(), listOfAccounts); CmsAisConsentAccessRequest accountAccessRequest = new CmsAisConsentAccessRequest(accountAccess, aisConsent.getValidUntil(), aisConsent.getFrequencyPerDay(), false, aisConsent.isRecurringIndicator()); cmsPsuAisClient.putAccountAccessInConsent(workflow.consentId(), accountAccessRequest, DEFAULT_SERVICE_INSTANCE_ID); AisConsentTO consent = consentMapper.toTo(workflow.getConsentResponse().getAccountConsent()); consent.setAccess(aisConsent.getAccess()); workflow.getAuthResponse().setConsent(consent); authInterceptor.setAccessToken(workflow.bearerToken().getAccess_token()); SCAConsentResponseTO sca = consentRestClient.startSCA(workflow.consentId(), consent).getBody(); sca.setBearerToken(workflow.bearerToken()); workflow.storeSCAResponse(sca); }
RedirectConsentServiceImpl implements RedirectConsentService { @Override public void startConsent(final ConsentWorkflow workflow, AisConsentTO aisConsent, List<AccountDetailsTO> listOfAccounts) { AisAccountAccess accountAccess = consentMapper.accountAccess(aisConsent.getAccess(), listOfAccounts); CmsAisConsentAccessRequest accountAccessRequest = new CmsAisConsentAccessRequest(accountAccess, aisConsent.getValidUntil(), aisConsent.getFrequencyPerDay(), false, aisConsent.isRecurringIndicator()); cmsPsuAisClient.putAccountAccessInConsent(workflow.consentId(), accountAccessRequest, DEFAULT_SERVICE_INSTANCE_ID); AisConsentTO consent = consentMapper.toTo(workflow.getConsentResponse().getAccountConsent()); consent.setAccess(aisConsent.getAccess()); workflow.getAuthResponse().setConsent(consent); authInterceptor.setAccessToken(workflow.bearerToken().getAccess_token()); SCAConsentResponseTO sca = consentRestClient.startSCA(workflow.consentId(), consent).getBody(); sca.setBearerToken(workflow.bearerToken()); workflow.storeSCAResponse(sca); } }
RedirectConsentServiceImpl implements RedirectConsentService { @Override public void startConsent(final ConsentWorkflow workflow, AisConsentTO aisConsent, List<AccountDetailsTO> listOfAccounts) { AisAccountAccess accountAccess = consentMapper.accountAccess(aisConsent.getAccess(), listOfAccounts); CmsAisConsentAccessRequest accountAccessRequest = new CmsAisConsentAccessRequest(accountAccess, aisConsent.getValidUntil(), aisConsent.getFrequencyPerDay(), false, aisConsent.isRecurringIndicator()); cmsPsuAisClient.putAccountAccessInConsent(workflow.consentId(), accountAccessRequest, DEFAULT_SERVICE_INSTANCE_ID); AisConsentTO consent = consentMapper.toTo(workflow.getConsentResponse().getAccountConsent()); consent.setAccess(aisConsent.getAccess()); workflow.getAuthResponse().setConsent(consent); authInterceptor.setAccessToken(workflow.bearerToken().getAccess_token()); SCAConsentResponseTO sca = consentRestClient.startSCA(workflow.consentId(), consent).getBody(); sca.setBearerToken(workflow.bearerToken()); workflow.storeSCAResponse(sca); }  }
RedirectConsentServiceImpl implements RedirectConsentService { @Override public void startConsent(final ConsentWorkflow workflow, AisConsentTO aisConsent, List<AccountDetailsTO> listOfAccounts) { AisAccountAccess accountAccess = consentMapper.accountAccess(aisConsent.getAccess(), listOfAccounts); CmsAisConsentAccessRequest accountAccessRequest = new CmsAisConsentAccessRequest(accountAccess, aisConsent.getValidUntil(), aisConsent.getFrequencyPerDay(), false, aisConsent.isRecurringIndicator()); cmsPsuAisClient.putAccountAccessInConsent(workflow.consentId(), accountAccessRequest, DEFAULT_SERVICE_INSTANCE_ID); AisConsentTO consent = consentMapper.toTo(workflow.getConsentResponse().getAccountConsent()); consent.setAccess(aisConsent.getAccess()); workflow.getAuthResponse().setConsent(consent); authInterceptor.setAccessToken(workflow.bearerToken().getAccess_token()); SCAConsentResponseTO sca = consentRestClient.startSCA(workflow.consentId(), consent).getBody(); sca.setBearerToken(workflow.bearerToken()); workflow.storeSCAResponse(sca); }  @Override void selectScaMethod(String scaMethodId, final ConsentWorkflow workflow); @Override void updateAccessByConsentType(ConsentWorkflow workflow, List<AccountDetailsTO> listOfAccounts); @Override void updateScaStatusConsentStatusConsentData(String psuId, ConsentWorkflow workflow); @Override void startConsent(final ConsentWorkflow workflow, AisConsentTO aisConsent, List<AccountDetailsTO> listOfAccounts); @Override ConsentWorkflow identifyConsent(String encryptedConsentId, String authorizationId, boolean strict, String consentCookieString, BearerTokenTO bearerToken); }
RedirectConsentServiceImpl implements RedirectConsentService { @Override public void startConsent(final ConsentWorkflow workflow, AisConsentTO aisConsent, List<AccountDetailsTO> listOfAccounts) { AisAccountAccess accountAccess = consentMapper.accountAccess(aisConsent.getAccess(), listOfAccounts); CmsAisConsentAccessRequest accountAccessRequest = new CmsAisConsentAccessRequest(accountAccess, aisConsent.getValidUntil(), aisConsent.getFrequencyPerDay(), false, aisConsent.isRecurringIndicator()); cmsPsuAisClient.putAccountAccessInConsent(workflow.consentId(), accountAccessRequest, DEFAULT_SERVICE_INSTANCE_ID); AisConsentTO consent = consentMapper.toTo(workflow.getConsentResponse().getAccountConsent()); consent.setAccess(aisConsent.getAccess()); workflow.getAuthResponse().setConsent(consent); authInterceptor.setAccessToken(workflow.bearerToken().getAccess_token()); SCAConsentResponseTO sca = consentRestClient.startSCA(workflow.consentId(), consent).getBody(); sca.setBearerToken(workflow.bearerToken()); workflow.storeSCAResponse(sca); }  @Override void selectScaMethod(String scaMethodId, final ConsentWorkflow workflow); @Override void updateAccessByConsentType(ConsentWorkflow workflow, List<AccountDetailsTO> listOfAccounts); @Override void updateScaStatusConsentStatusConsentData(String psuId, ConsentWorkflow workflow); @Override void startConsent(final ConsentWorkflow workflow, AisConsentTO aisConsent, List<AccountDetailsTO> listOfAccounts); @Override ConsentWorkflow identifyConsent(String encryptedConsentId, String authorizationId, boolean strict, String consentCookieString, BearerTokenTO bearerToken);  }