DefaultWorldpayDirectResponseService implements WorldpayDirectResponseService { @Override public Boolean is3DSecureLegacyFlow(final DirectResponseData directResponseData) { return isAuthenticationRequired(directResponseData) && directResponseData.getIssuerURL() != null && directResponseData.getPaRequest() != null; }  @Override Boolean isAuthorised(final DirectResponseData directResponseData); @Override Boolean isCancelled(final DirectResponseData directResponseData); @Override Boolean is3DSecureLegacyFlow(final DirectResponseData directResponseData); @Override Boolean is3DSecureFlexFlow(final DirectResponseData directResponseData);  }
@Test public void is3DSecureLegacyFlowReturnsTrueWhenDirectResponseDataIsLegacyFlow() { when(directResponseDataMock.getTransactionStatus()).thenReturn(TransactionStatus.AUTHENTICATION_REQUIRED); when(directResponseDataMock.getIssuerURL()).thenReturn(ISSUER_URL); when(directResponseDataMock.getPaRequest()).thenReturn(PA_REQUEST); final Boolean result = testObj.is3DSecureLegacyFlow(directResponseDataMock); assertThat(result).isTrue(); }
@Test public void is3DSecureLegacyFlowReturnsFalseWhenDirectResponseDataIsLFlexFlow() { when(directResponseDataMock.getTransactionStatus()).thenReturn(TransactionStatus.AUTHENTICATION_REQUIRED); when(directResponseDataMock.getIssuerURL()).thenReturn(ISSUER_URL); when(directResponseDataMock.getIssuerPayload()).thenReturn(ISSUER_PAYLOAD); when(directResponseDataMock.getTransactionId3DS()).thenReturn(TRANSACTION_ID_3DS); when(directResponseDataMock.getMajor3DSVersion()).thenReturn(THREEDS_VERSION); final Boolean result = testObj.is3DSecureLegacyFlow(directResponseDataMock); assertThat(result).isFalse(); }