Search in sources :

Example 1 with AuthCardDetails

use of uk.gov.pay.connector.gateway.model.AuthCardDetails in project pay-connector by alphagov.

the class EpdqPaymentProviderTest method shouldAuthoriseWith3dsOnAndNoAddressInRequestSuccessfully.

@Test
public void shouldAuthoriseWith3dsOnAndNoAddressInRequestSuccessfully() throws Exception {
    setUpFor3dsAndCheckThatEpdqIsUp();
    AuthCardDetails authCardDetails = authCardDetailsFixture().withCardNo(VISA_CARD_NUMBER_RECOGNISED_AS_REQUIRING_3DS1_BY_EPDQ).withAddress(null).build();
    var request = new CardAuthorisationGatewayRequest(chargeEntity, authCardDetails);
    GatewayResponse<BaseAuthoriseResponse> response = paymentProvider.authorise(request);
    assertThat(response.isSuccessful(), is(true));
    assertThat(response.getBaseResponse().get().authoriseStatus(), is(REQUIRES_3DS));
}
Also used : BaseAuthoriseResponse(uk.gov.pay.connector.gateway.model.response.BaseAuthoriseResponse) AuthCardDetails(uk.gov.pay.connector.gateway.model.AuthCardDetails) CardAuthorisationGatewayRequest(uk.gov.pay.connector.gateway.model.request.CardAuthorisationGatewayRequest) Test(org.junit.Test)

Example 2 with AuthCardDetails

use of uk.gov.pay.connector.gateway.model.AuthCardDetails in project pay-connector by alphagov.

the class EpdqPaymentProviderTest method shouldAuthoriseSuccessfullyWhenCardholderNameContainsRightSingleQuotationMark.

@Test
public void shouldAuthoriseSuccessfullyWhenCardholderNameContainsRightSingleQuotationMark() throws Exception {
    setUpAndCheckThatEpdqIsUp();
    // That’s a U+2019 RIGHT SINGLE QUOTATION MARK, not a U+0027 APOSTROPHE
    String cardholderName = "John O’Connor";
    AuthCardDetails authCardDetails = authCardDetailsFixture().withCardHolder(cardholderName).build();
    var request = new CardAuthorisationGatewayRequest(chargeEntity, authCardDetails);
    GatewayResponse<BaseAuthoriseResponse> response = paymentProvider.authorise(request);
    assertThat(response.isSuccessful(), is(true));
}
Also used : BaseAuthoriseResponse(uk.gov.pay.connector.gateway.model.response.BaseAuthoriseResponse) AuthCardDetails(uk.gov.pay.connector.gateway.model.AuthCardDetails) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) CardAuthorisationGatewayRequest(uk.gov.pay.connector.gateway.model.request.CardAuthorisationGatewayRequest) Test(org.junit.Test)

Example 3 with AuthCardDetails

use of uk.gov.pay.connector.gateway.model.AuthCardDetails in project pay-connector by alphagov.

the class EpdqPaymentProviderTest method shouldAuthoriseSuccessfullyWithNoAddressInRequest.

@Test
public void shouldAuthoriseSuccessfullyWithNoAddressInRequest() throws Exception {
    setUpAndCheckThatEpdqIsUp();
    AuthCardDetails authCardDetails = authCardDetailsFixture().withAddress(null).build();
    var request = new CardAuthorisationGatewayRequest(chargeEntity, authCardDetails);
    GatewayResponse<BaseAuthoriseResponse> response = paymentProvider.authorise(request);
    assertThat(response.isSuccessful(), is(true));
}
Also used : BaseAuthoriseResponse(uk.gov.pay.connector.gateway.model.response.BaseAuthoriseResponse) AuthCardDetails(uk.gov.pay.connector.gateway.model.AuthCardDetails) CardAuthorisationGatewayRequest(uk.gov.pay.connector.gateway.model.request.CardAuthorisationGatewayRequest) Test(org.junit.Test)

Example 4 with AuthCardDetails

use of uk.gov.pay.connector.gateway.model.AuthCardDetails in project pay-connector by alphagov.

the class SmartpayPaymentProviderTest method shouldSendSuccessfullyAnOrderForMerchantWithNoAddressInRequest.

@Test
public void shouldSendSuccessfullyAnOrderForMerchantWithNoAddressInRequest() throws Exception {
    PaymentProvider paymentProvider = getSmartpayPaymentProvider();
    AuthCardDetails authCardDetails = AuthCardDetailsFixture.anAuthCardDetails().withCardNo(VALID_SMARTPAY_CARD_NUMBER).withAddress(null).build();
    CardAuthorisationGatewayRequest request = new CardAuthorisationGatewayRequest(chargeEntity, authCardDetails);
    GatewayResponse response = paymentProvider.authorise(request);
    assertTrue(response.isSuccessful());
}
Also used : GatewayResponse(uk.gov.pay.connector.gateway.model.response.GatewayResponse) PaymentProvider(uk.gov.pay.connector.gateway.PaymentProvider) SmartpayPaymentProvider(uk.gov.pay.connector.gateway.smartpay.SmartpayPaymentProvider) AuthCardDetails(uk.gov.pay.connector.gateway.model.AuthCardDetails) CardAuthorisationGatewayRequest(uk.gov.pay.connector.gateway.model.request.CardAuthorisationGatewayRequest) Test(org.junit.Test)

Example 5 with AuthCardDetails

use of uk.gov.pay.connector.gateway.model.AuthCardDetails in project pay-connector by alphagov.

the class SmartpayPaymentProviderTest method shouldSendSuccessfullyAnOrderForMerchantWithUsAddressInRequest.

@Test
public void shouldSendSuccessfullyAnOrderForMerchantWithUsAddressInRequest() throws Exception {
    PaymentProvider paymentProvider = getSmartpayPaymentProvider();
    Address usAddress = new Address();
    usAddress.setLine1("125 Kingsway");
    usAddress.setLine2("Aviation House");
    usAddress.setPostcode("90210");
    usAddress.setCity("Washington D.C.");
    usAddress.setCountry("US");
    AuthCardDetails authCardDetails = AuthCardDetailsFixture.anAuthCardDetails().withCardNo(VALID_SMARTPAY_CARD_NUMBER).withAddress(usAddress).build();
    CardAuthorisationGatewayRequest request = new CardAuthorisationGatewayRequest(chargeEntity, authCardDetails);
    GatewayResponse response = paymentProvider.authorise(request);
    assertTrue(response.isSuccessful());
}
Also used : GatewayResponse(uk.gov.pay.connector.gateway.model.response.GatewayResponse) PaymentProvider(uk.gov.pay.connector.gateway.PaymentProvider) SmartpayPaymentProvider(uk.gov.pay.connector.gateway.smartpay.SmartpayPaymentProvider) Address(uk.gov.pay.connector.common.model.domain.Address) AuthCardDetails(uk.gov.pay.connector.gateway.model.AuthCardDetails) CardAuthorisationGatewayRequest(uk.gov.pay.connector.gateway.model.request.CardAuthorisationGatewayRequest) Test(org.junit.Test)

Aggregations

AuthCardDetails (uk.gov.pay.connector.gateway.model.AuthCardDetails)163 Test (org.junit.Test)124 ConstraintViolation (javax.validation.ConstraintViolation)52 Address (uk.gov.pay.connector.common.model.domain.Address)49 CardAuthorisationGatewayRequest (uk.gov.pay.connector.gateway.model.request.CardAuthorisationGatewayRequest)33 Test (org.junit.jupiter.api.Test)31 GatewayOrder (uk.gov.pay.connector.gateway.GatewayOrder)19 ChargeEntity (uk.gov.pay.connector.charge.model.domain.ChargeEntity)16 EpdqAuthorisationResponse (uk.gov.pay.connector.gateway.epdq.model.response.EpdqAuthorisationResponse)14 AuthCardDetailsFixture.anAuthCardDetails (uk.gov.pay.connector.model.domain.AuthCardDetailsFixture.anAuthCardDetails)14 AuthorisationResponse (uk.gov.pay.connector.paymentprocessor.api.AuthorisationResponse)14 GatewayResponse (uk.gov.pay.connector.gateway.model.response.GatewayResponse)12 WorldpayPaymentProvider (uk.gov.pay.connector.gateway.worldpay.WorldpayPaymentProvider)11 ChargeEntityFixture.aValidChargeEntity (uk.gov.pay.connector.charge.model.domain.ChargeEntityFixture.aValidChargeEntity)10 WorldpayOrderStatusResponse (uk.gov.pay.connector.gateway.worldpay.WorldpayOrderStatusResponse)10 Mockito.anyString (org.mockito.Mockito.anyString)8 BaseAuthoriseResponse (uk.gov.pay.connector.gateway.model.response.BaseAuthoriseResponse)8 GatewayAccountEntity (uk.gov.pay.connector.gatewayaccount.model.GatewayAccountEntity)7 PaymentProvider (uk.gov.pay.connector.gateway.PaymentProvider)6 Before (org.junit.Before)4