use of uk.gov.pay.connector.gateway.model.request.CardAuthorisationGatewayRequest in project pay-connector by alphagov.
the class EpdqPaymentProviderTest method shouldCheckAuthorisationStatusSuccessfully.
@Test
public void shouldCheckAuthorisationStatusSuccessfully() throws Exception {
setUpAndCheckThatEpdqIsUp();
var request = new CardAuthorisationGatewayRequest(chargeEntity, authCardDetailsFixture().build());
GatewayResponse<BaseAuthoriseResponse> response = paymentProvider.authorise(request);
assertThat(response.isSuccessful(), is(true));
assertThat(response.getBaseResponse().get().authoriseStatus(), is(BaseAuthoriseResponse.AuthoriseStatus.AUTHORISED));
Gateway3DSAuthorisationResponse queryResponse = paymentProvider.authorise3dsResponse(buildQueryRequest(chargeEntity, Auth3dsResult.Auth3dsResultOutcome.AUTHORISED.name()));
assertThat(queryResponse.isSuccessful(), is(true));
assertThat(response.getBaseResponse().get().authoriseStatus(), is(BaseAuthoriseResponse.AuthoriseStatus.AUTHORISED));
}
use of uk.gov.pay.connector.gateway.model.request.CardAuthorisationGatewayRequest 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));
}
use of uk.gov.pay.connector.gateway.model.request.CardAuthorisationGatewayRequest in project pay-connector by alphagov.
the class EpdqPaymentProviderTest method shouldQueryPaymentStatusSuccessfully.
@Test
public void shouldQueryPaymentStatusSuccessfully() throws Exception {
setUpAndCheckThatEpdqIsUp();
var request = new CardAuthorisationGatewayRequest(chargeEntity, authCardDetailsFixture().build());
GatewayResponse<BaseAuthoriseResponse> response = paymentProvider.authorise(request);
assertThat(response.isSuccessful(), is(true));
ChargeQueryGatewayRequest chargeQueryGatewayRequest = ChargeQueryGatewayRequest.valueOf(Charge.from(chargeEntity), chargeEntity.getGatewayAccount(), chargeEntity.getGatewayAccountCredentialsEntity());
ChargeQueryResponse chargeQueryResponse = paymentProvider.queryPaymentStatus(chargeQueryGatewayRequest);
assertThat(chargeQueryResponse.getMappedStatus(), is(Optional.of(ChargeStatus.AUTHORISATION_SUCCESS)));
assertThat(chargeQueryResponse.foundCharge(), is(true));
}
use of uk.gov.pay.connector.gateway.model.request.CardAuthorisationGatewayRequest in project pay-connector by alphagov.
the class EpdqPaymentProviderTest method shouldCaptureSuccessfully.
@Test
public void shouldCaptureSuccessfully() throws Exception {
setUpAndCheckThatEpdqIsUp();
var request = new CardAuthorisationGatewayRequest(chargeEntity, authCardDetailsFixture().build());
GatewayResponse<BaseAuthoriseResponse> response = paymentProvider.authorise(request);
assertThat(response.isSuccessful(), is(true));
String transactionId = response.getBaseResponse().get().getTransactionId();
assertThat(transactionId, is(not(nullValue())));
CaptureGatewayRequest captureRequest = buildCaptureRequest(chargeEntity, transactionId);
CaptureResponse captureResponse = paymentProvider.capture(captureRequest);
assertThat(captureResponse.isSuccessful(), is(true));
assertThat(captureResponse.state(), Is.is(CaptureResponse.ChargeState.PENDING));
}
use of uk.gov.pay.connector.gateway.model.request.CardAuthorisationGatewayRequest 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));
}
Aggregations