@Test void selectMethod() throws NoSuchFieldException { FieldSetter.setField(controller, controller.getClass().getDeclaredField("middlewareAuth"), new ObaMiddlewareAuthentication(null, new BearerTokenTO(TOKEN, null, 999, null, getAccessTokenTO()))); when(responseUtils.consentCookie(any())).thenReturn(COOKIE); when(paymentService.selectScaForPayment(anyString(), anyString(), anyString(), anyString(), anyBoolean(), anyString(), any())).thenReturn(getPaymentWorkflow(SCAMETHODSELECTED)); ResponseEntity<PaymentAuthorizeResponse> result = controller.selectMethod(ENCRYPTED_ID, AUTH_ID, METHOD_ID, COOKIE); assertEquals(ResponseEntity.ok(getPaymentAuthorizeResponse(true, true, SCAMETHODSELECTED)), result); }
@Override public ResponseEntity<PaymentAuthorizeResponse> selectMethod(String encryptedPaymentId, String authorisationId, String scaMethodId, String consentAndaccessTokenCookieString) { PaymentWorkflow workflow; try { String consentCookie = responseUtils.consentCookie(consentAndaccessTokenCookieString); workflow = paymentService.selectScaForPayment(encryptedPaymentId, authorisationId, scaMethodId, consentCookie, false, AuthUtils.psuId(middlewareAuth), middlewareAuth.getBearerToken()); responseUtils.setCookies(response, workflow.getConsentReference(), workflow.bearerToken().getAccess_token(), workflow.bearerToken().getAccessTokenObject()); } catch (PaymentAuthorizeException p) { return p.getError(); } return ResponseEntity.ok(workflow.getAuthResponse()); }
PISController implements PISApi { @Override public ResponseEntity<PaymentAuthorizeResponse> selectMethod(String encryptedPaymentId, String authorisationId, String scaMethodId, String consentAndaccessTokenCookieString) { PaymentWorkflow workflow; try { String consentCookie = responseUtils.consentCookie(consentAndaccessTokenCookieString); workflow = paymentService.selectScaForPayment(encryptedPaymentId, authorisationId, scaMethodId, consentCookie, false, AuthUtils.psuId(middlewareAuth), middlewareAuth.getBearerToken()); responseUtils.setCookies(response, workflow.getConsentReference(), workflow.bearerToken().getAccess_token(), workflow.bearerToken().getAccessTokenObject()); } catch (PaymentAuthorizeException p) { return p.getError(); } return ResponseEntity.ok(workflow.getAuthResponse()); } }
PISController implements PISApi { @Override public ResponseEntity<PaymentAuthorizeResponse> selectMethod(String encryptedPaymentId, String authorisationId, String scaMethodId, String consentAndaccessTokenCookieString) { PaymentWorkflow workflow; try { String consentCookie = responseUtils.consentCookie(consentAndaccessTokenCookieString); workflow = paymentService.selectScaForPayment(encryptedPaymentId, authorisationId, scaMethodId, consentCookie, false, AuthUtils.psuId(middlewareAuth), middlewareAuth.getBearerToken()); responseUtils.setCookies(response, workflow.getConsentReference(), workflow.bearerToken().getAccess_token(), workflow.bearerToken().getAccessTokenObject()); } catch (PaymentAuthorizeException p) { return p.getError(); } return ResponseEntity.ok(workflow.getAuthResponse()); }  }
PISController implements PISApi { @Override public ResponseEntity<PaymentAuthorizeResponse> selectMethod(String encryptedPaymentId, String authorisationId, String scaMethodId, String consentAndaccessTokenCookieString) { PaymentWorkflow workflow; try { String consentCookie = responseUtils.consentCookie(consentAndaccessTokenCookieString); workflow = paymentService.selectScaForPayment(encryptedPaymentId, authorisationId, scaMethodId, consentCookie, false, AuthUtils.psuId(middlewareAuth), middlewareAuth.getBearerToken()); responseUtils.setCookies(response, workflow.getConsentReference(), workflow.bearerToken().getAccess_token(), workflow.bearerToken().getAccessTokenObject()); } catch (PaymentAuthorizeException p) { return p.getError(); } return ResponseEntity.ok(workflow.getAuthResponse()); }  @Override ResponseEntity<AuthorizeResponse> pisAuth(String redirectId, String encryptedPaymentId, String token); @Override @ApiOperation(value = "Identifies the user by login an pin. Return sca methods information") ResponseEntity<PaymentAuthorizeResponse> login(String encryptedPaymentId, String authorisationId, String login, String pin, String consentCookieString); @Override ResponseEntity<PaymentAuthorizeResponse> initiatePayment(
        String encryptedPaymentId, String authorisationId, String consentAndaccessTokenCookieString); @Override ResponseEntity<PaymentAuthorizeResponse> selectMethod(String encryptedPaymentId, String authorisationId,
                                                                 String scaMethodId, String consentAndaccessTokenCookieString); @Override ResponseEntity<PaymentAuthorizeResponse> authrizedPayment(
        String encryptedPaymentId,
        String authorisationId,
        String consentAndaccessTokenCookieString, String authCode); @Override ResponseEntity<PaymentAuthorizeResponse> failPaymentAuthorisation(String encryptedPaymentId, String authorisationId, String cookieString); @Override ResponseEntity<PaymentAuthorizeResponse> pisDone(String encryptedPaymentId, String authorisationId,
                                                            String consentAndAccessTokenCookieString, boolean isOauth2Integrated, String authConfirmationCode); }
PISController implements PISApi { @Override public ResponseEntity<PaymentAuthorizeResponse> selectMethod(String encryptedPaymentId, String authorisationId, String scaMethodId, String consentAndaccessTokenCookieString) { PaymentWorkflow workflow; try { String consentCookie = responseUtils.consentCookie(consentAndaccessTokenCookieString); workflow = paymentService.selectScaForPayment(encryptedPaymentId, authorisationId, scaMethodId, consentCookie, false, AuthUtils.psuId(middlewareAuth), middlewareAuth.getBearerToken()); responseUtils.setCookies(response, workflow.getConsentReference(), workflow.bearerToken().getAccess_token(), workflow.bearerToken().getAccessTokenObject()); } catch (PaymentAuthorizeException p) { return p.getError(); } return ResponseEntity.ok(workflow.getAuthResponse()); }  @Override ResponseEntity<AuthorizeResponse> pisAuth(String redirectId, String encryptedPaymentId, String token); @Override @ApiOperation(value = "Identifies the user by login an pin. Return sca methods information") ResponseEntity<PaymentAuthorizeResponse> login(String encryptedPaymentId, String authorisationId, String login, String pin, String consentCookieString); @Override ResponseEntity<PaymentAuthorizeResponse> initiatePayment(
        String encryptedPaymentId, String authorisationId, String consentAndaccessTokenCookieString); @Override ResponseEntity<PaymentAuthorizeResponse> selectMethod(String encryptedPaymentId, String authorisationId,
                                                                 String scaMethodId, String consentAndaccessTokenCookieString); @Override ResponseEntity<PaymentAuthorizeResponse> authrizedPayment(
        String encryptedPaymentId,
        String authorisationId,
        String consentAndaccessTokenCookieString, String authCode); @Override ResponseEntity<PaymentAuthorizeResponse> failPaymentAuthorisation(String encryptedPaymentId, String authorisationId, String cookieString); @Override ResponseEntity<PaymentAuthorizeResponse> pisDone(String encryptedPaymentId, String authorisationId,
                                                            String consentAndAccessTokenCookieString, boolean isOauth2Integrated, String authConfirmationCode);  }