Source:
<code>void should_retry_without_exemption_flag_when_authorising_with_exemption_flag_results_in_soft_decline() throws Exception { gatewayAccountEntity.setRequires3ds(true); gatewayAccountEntity.setIntegrationVersion3ds(1); gatewayAccountEntity.setWorldpay3dsFlexCredentialsEntity(aWorldpay3dsFlexCredentialsEntity().withExemptionEngine(true).build()); chargeEntityFixture.withGatewayAccountEntity(gatewayAccountEntity); chargeEntityFixture.withStatus(ChargeStatus.AUTHORISATION_READY); ChargeEntity chargeEntity = chargeEntityFixture.build(); var cardAuthRequest = new CardAuthorisationGatewayRequest(chargeEntity, anAuthCardDetails().build()); var firstResponse = getGatewayResponse(WORLDPAY_EXEMPTION_REQUEST_SOFT_DECLINE_RESPONSE); var secondResponse = getGatewayResponse(WORLDPAY_AUTHORISATION_SUCCESS_RESPONSE); when(worldpayAuthoriseHandler.authorise(cardAuthRequest)).thenReturn(firstResponse); when(worldpayAuthoriseHandler.authorise(cardAuthRequest, true)).thenReturn(secondResponse); GatewayResponse<WorldpayOrderStatusResponse> response = worldpayPaymentProvider.authorise(cardAuthRequest); assertTrue(response.getBaseResponse().isPresent()); assertEquals(secondResponse.getBaseResponse().get(), response.getBaseResponse().get()); <START> verify(worldpayAuthoriseHandler).authorise(cardAuthRequest); verify(worldpayAuthoriseHandler).authorise(cardAuthRequest, true); <END> ArgumentCaptor<LoggingEvent> loggingEventArgumentCaptor = ArgumentCaptor.forClass(LoggingEvent.class); verify(mockAppender, times(1)).doAppend(loggingEventArgumentCaptor.capture()); String log = loggingEventArgumentCaptor.getAllValues().get(0).getMessage(); assertTrue(log.contains(format("Authorisation with billing address and with 3DS data and without device data " + "collection result and with exemption for %s", chargeEntity.getExternalId()))); assertTrue(log.contains("Worldpay authorisation response (orderCode: transaction-id, lastEvent: REFUSED, " + "result: REJECTED, reason: HIGH_RISK)")); assertTrue(log.contains("AUTHORISATION READY -> AUTHORISATION READY")); }</code><technical_language>need verify if stubbing</technical_language>

Target:
void should_retry_without_exemption_flag_when_authorising_with_exemption_flag_results_in_soft_decline() throws Exception { gatewayAccountEntity.setRequires3ds(true); gatewayAccountEntity.setIntegrationVersion3ds(1); gatewayAccountEntity.setWorldpay3dsFlexCredentialsEntity(aWorldpay3dsFlexCredentialsEntity().withExemptionEngine(true).build()); chargeEntityFixture.withGatewayAccountEntity(gatewayAccountEntity); chargeEntityFixture.withStatus(ChargeStatus.AUTHORISATION_READY); ChargeEntity chargeEntity = chargeEntityFixture.build(); var cardAuthRequest = new CardAuthorisationGatewayRequest(chargeEntity, anAuthCardDetails().build()); var firstResponse = getGatewayResponse(WORLDPAY_EXEMPTION_REQUEST_SOFT_DECLINE_RESPONSE); var secondResponse = getGatewayResponse(WORLDPAY_AUTHORISATION_SUCCESS_RESPONSE); when(worldpayAuthoriseHandler.authorise(cardAuthRequest)).thenReturn(firstResponse); when(worldpayAuthoriseHandler.authorise(cardAuthRequest, true)).thenReturn(secondResponse); GatewayResponse<WorldpayOrderStatusResponse> response = worldpayPaymentProvider.authorise(cardAuthRequest); assertTrue(response.getBaseResponse().isPresent()); assertEquals(secondResponse.getBaseResponse().get(), response.getBaseResponse().get()); ArgumentCaptor<LoggingEvent> loggingEventArgumentCaptor = ArgumentCaptor.forClass(LoggingEvent.class); verify(mockAppender, times(1)).doAppend(loggingEventArgumentCaptor.capture()); String log = loggingEventArgumentCaptor.getAllValues().get(0).getMessage(); assertTrue(log.contains(format("Authorisation with billing address and with 3DS data and without device data " + "collection result and with exemption for %s", chargeEntity.getExternalId()))); assertTrue(log.contains("Worldpay authorisation response (orderCode: transaction-id, lastEvent: REFUSED, " + "result: REJECTED, reason: HIGH_RISK)")); assertTrue(log.contains("AUTHORISATION READY -> AUTHORISATION READY")); }