use of uk.gov.pay.connector.gateway.worldpay.WorldpayOrderStatusResponse in project pay-connector by alphagov.
the class WorldpayPaymentProviderTest method shouldBeAbleToSendAuthorisationRequestForMerchant.
@Test
public void shouldBeAbleToSendAuthorisationRequestForMerchant() {
WorldpayPaymentProvider paymentProvider = getValidWorldpayPaymentProvider();
AuthCardDetails authCardDetails = anAuthCardDetails().build();
CardAuthorisationGatewayRequest request = getCardAuthorisationRequest(authCardDetails);
GatewayResponse<WorldpayOrderStatusResponse> response = paymentProvider.authorise(request);
assertTrue(response.getBaseResponse().isPresent());
}
use of uk.gov.pay.connector.gateway.worldpay.WorldpayOrderStatusResponse in project pay-connector by alphagov.
the class WorldpayPaymentProviderTest method submitAuthRequestWithExemptionEngineFlag.
@Test
public void submitAuthRequestWithExemptionEngineFlag() {
validGatewayAccount.setRequires3ds(true);
validGatewayAccount.setIntegrationVersion3ds(2);
validGatewayAccount.setWorldpay3dsFlexCredentialsEntity(aWorldpay3dsFlexCredentialsEntity().withExemptionEngine(true).build());
WorldpayPaymentProvider paymentProvider = getValidWorldpayPaymentProvider();
// card holder of "EE.HONOURED_ISSUER_HONOURED.AUTHORISED" elicits an authorised response, see https://developer.worldpay.com/docs/wpg/scaexemptionservices/exemptionengine#testing-exemption-engine
var authCardDetails = anAuthCardDetails().withCardHolder("EE.HONOURED_ISSUER_HONOURED.AUTHORISED").withWorldpay3dsFlexDdcResult(UUID.randomUUID().toString()).build();
CardAuthorisationGatewayRequest request = getCardAuthorisationRequest(authCardDetails);
GatewayResponse<WorldpayOrderStatusResponse> response = paymentProvider.authorise(request);
assertTrue(response.getBaseResponse().isPresent());
assertTrue(response.getBaseResponse().get().getLastEvent().isPresent());
assertEquals(response.getBaseResponse().get().getLastEvent().get(), "AUTHORISED");
assertTrue(response.getBaseResponse().get().getExemptionResponseResult().isPresent());
assertEquals(response.getBaseResponse().get().getExemptionResponseResult().get(), "HONOURED");
assertEquals(response.getBaseResponse().get().getExemptionResponseReason(), "ISSUER_HONOURED");
}
use of uk.gov.pay.connector.gateway.worldpay.WorldpayOrderStatusResponse in project pay-connector by alphagov.
the class WorldpayPaymentProviderTest method submitAuthForSoftDecline.
@Test
public void submitAuthForSoftDecline() {
validGatewayAccount.setRequires3ds(true);
validGatewayAccount.setIntegrationVersion3ds(2);
validGatewayAccount.setWorldpay3dsFlexCredentialsEntity(aWorldpay3dsFlexCredentialsEntity().withExemptionEngine(true).build());
WorldpayPaymentProvider paymentProvider = getValidWorldpayPaymentProvider();
// card holder of "EE.REJECTED_ISSUER_REJECTED.SOFT_DECLINED" elicits a soft decline response, see https://developer.worldpay.com/docs/wpg/scaexemptionservices/exemptionengine#testing-exemption-engine
var authCardDetails = anAuthCardDetails().withCardHolder("EE.REJECTED_ISSUER_REJECTED.SOFT_DECLINED").withWorldpay3dsFlexDdcResult(UUID.randomUUID().toString()).build();
CardAuthorisationGatewayRequest request = getCardAuthorisationRequest(authCardDetails);
GatewayResponse<WorldpayOrderStatusResponse> response = paymentProvider.authorise(request);
assertTrue(response.getBaseResponse().isPresent());
assertTrue(response.getBaseResponse().get().getLastEvent().isPresent());
assertEquals(response.getBaseResponse().get().getLastEvent().get(), "AUTHORISED");
}
use of uk.gov.pay.connector.gateway.worldpay.WorldpayOrderStatusResponse in project pay-connector by alphagov.
the class WorldpayPaymentProviderTest method submit3DS2FlexAuthRequest_requiresChallenge.
@Test
public void submit3DS2FlexAuthRequest_requiresChallenge() {
WorldpayPaymentProvider paymentProvider = getValidWorldpayPaymentProvider();
AuthCardDetails authCardDetails = anAuthCardDetails().withCardHolder(MAGIC_CARDHOLDER_NAME_FOR_3DS_FLEX_CHALLENGE_REQUIRED_RESPONSE).withWorldpay3dsFlexDdcResult(UUID.randomUUID().toString()).build();
CardAuthorisationGatewayRequest request = getCardAuthorisationRequest(authCardDetails);
GatewayResponse<WorldpayOrderStatusResponse> response = paymentProvider.authorise(request);
assertTrue(response.getBaseResponse().isPresent());
response.getBaseResponse().ifPresent(res -> {
assertThat(res.getGatewayParamsFor3ds().isPresent(), is(true));
assertThat(res.getGatewayParamsFor3ds().get().toAuth3dsRequiredEntity().getWorldpayChallengeAcsUrl(), is(notNullValue()));
assertThat(res.getGatewayParamsFor3ds().get().toAuth3dsRequiredEntity().getWorldpayChallengeTransactionId(), is(notNullValue()));
assertThat(res.getGatewayParamsFor3ds().get().toAuth3dsRequiredEntity().getWorldpayChallengePayload(), is(notNullValue()));
assertThat(res.getGatewayParamsFor3ds().get().toAuth3dsRequiredEntity().getThreeDsVersion(), is(notNullValue()));
});
}
use of uk.gov.pay.connector.gateway.worldpay.WorldpayOrderStatusResponse in project pay-connector by alphagov.
the class WorldpayPaymentProviderTest method submit3DS2FlexAuthRequest.
@Test
public void submit3DS2FlexAuthRequest() {
WorldpayPaymentProvider paymentProvider = getValidWorldpayPaymentProvider();
var authCardDetails = anAuthCardDetails().withWorldpay3dsFlexDdcResult(UUID.randomUUID().toString()).build();
CardAuthorisationGatewayRequest request = getCardAuthorisationRequest(authCardDetails);
GatewayResponse<WorldpayOrderStatusResponse> response = paymentProvider.authorise(request);
assertTrue(response.getBaseResponse().isPresent());
}
Aggregations