Search in sources :

Example 1 with AuthorisationSummary

use of uk.gov.pay.api.model.AuthorisationSummary in project pay-publicapi by alphagov.

the class GetPaymentIT method getPaymentWithNoAuthorisationSummaryThroughConnector.

@Test
public void getPaymentWithNoAuthorisationSummaryThroughConnector() {
    AuthorisationSummary authorisationSummary = new AuthorisationSummary(new ThreeDSecure(true));
    connectorMockClient.respondWithChargeFound(CHARGE_TOKEN_ID, GATEWAY_ACCOUNT_ID, getConnectorCharge().build());
    ValidatableResponse response = getPaymentResponse(CHARGE_ID);
    assertCommonPaymentFields(response);
    assertConnectorOnlyPaymentFields(response);
    response.body("authorisation_summary", is(nullValue()));
}
Also used : AuthorisationSummary(uk.gov.pay.api.model.AuthorisationSummary) ValidatableResponse(io.restassured.response.ValidatableResponse) ThreeDSecure(uk.gov.pay.api.model.ThreeDSecure) Test(org.junit.Test)

Example 2 with AuthorisationSummary

use of uk.gov.pay.api.model.AuthorisationSummary in project pay-publicapi by alphagov.

the class TransactionsResourceIT method shouldReturnAListOfTransactions.

@Test
public void shouldReturnAListOfTransactions() {
    Address billingAddress = new Address("line1", null, "AB1 CD2", "London", "GB");
    CardDetails cardDetails = new CardDetails(null, null, "J. Doe", null, billingAddress, "", null);
    PaymentNavigationLinksFixture fixture = new PaymentNavigationLinksFixture();
    fixture.withSelfLink("https://ledger/v1/transaction?account_id=1&reference=reference&page=1&display_size=500");
    fixture.withFirstLink("https://ledger/v1/transaction?account_id=1&reference=reference&page=1&display_size=500");
    fixture.withLastLink("https://ledger/v1/transaction?account_id=1&reference=reference&page=1&display_size=500");
    String transactions = aPaginatedTransactionSearchResult().withCount(2).withPage(1).withTotal(2).withLinks(fixture).withPayments(aSuccessfulSearchPayment().withInProgressState("created").withReference("reference").withReturnUrl(DEFAULT_RETURN_URL).withCardDetails(cardDetails).withNumberOfResults(2).withEmail("j.doe@example.org").withAuthorisationSummary(new AuthorisationSummary(new ThreeDSecure(true))).getResults()).build();
    ledgerMockClient.respondOk_whenSearchCharges(transactions);
    searchTransactions(ImmutableMap.of("reference", "reference")).statusCode(200).contentType(JSON).body("results[0].created_date", is(DEFAULT_CREATED_DATE)).body("results[0].reference", is("reference")).body("results[0].email", is("j.doe@example.org")).body("results[0].return_url", is(DEFAULT_RETURN_URL)).body("results[0].description", is("description-0")).body("results[0].state.status", is("created")).body("results[0].amount", is(DEFAULT_AMOUNT)).body("results[0].payment_provider", is("worldpay")).body("results[0].payment_id", is("0")).body("results[0].language", is("en")).body("results[0].delayed_capture", is(false)).body("results[0]._links.self.method", is("GET")).body("results[0]._links.self.href", is(paymentLocationFor(configuration.getBaseUrl(), "0"))).body("results[0]._links.events.href", is(paymentEventsLocationFor("0"))).body("results[0]._links.events.method", is("GET")).body("results[0]._links.cancel.href", is(paymentCancelLocationFor("0"))).body("results[0]._links.cancel.method", is("POST")).body("results[0]._links.refunds.href", is(paymentRefundsLocationFor("0"))).body("results[0]._links.refunds.method", is("GET")).body("results[0].card_details.cardholder_name", is("J. Doe")).body("results[0].card_details.expiry_date", is(nullValue())).body("results[0].card_details.last_digits_card_number", is(nullValue())).body("results[0].card_details.first_digits_card_number", is(nullValue())).body("results[0].card_details.billing_address.line1", is("line1")).body("results[0].card_details.billing_address.line2", is(nullValue())).body("results[0].card_details.billing_address.postcode", is("AB1 CD2")).body("results[0].card_details.billing_address.country", is("GB")).body("results[0].card_details.card_brand", is(emptyString())).body("results[0].authorisation_summary", is(notNullValue())).body("results[0].authorisation_summary.three_d_secure", is(notNullValue())).body("results[0].authorisation_summary.three_d_secure.required", is(true)).body("results[0].authorisation_mode", is("web")).body("_links.self.href", is(expectedChargesLocationFor("?reference=reference&display_size=500&page=1"))).body("_links.first_page.href", is(expectedChargesLocationFor("?reference=reference&display_size=500&page=1"))).body("_links.last_page.href", is(expectedChargesLocationFor("?reference=reference&display_size=500&page=1")));
}
Also used : AuthorisationSummary(uk.gov.pay.api.model.AuthorisationSummary) Address(uk.gov.pay.api.model.Address) ThreeDSecure(uk.gov.pay.api.model.ThreeDSecure) PaymentNavigationLinksFixture(uk.gov.pay.api.it.fixtures.PaymentNavigationLinksFixture) Matchers.emptyString(org.hamcrest.Matchers.emptyString) CardDetails(uk.gov.pay.api.model.CardDetails) Test(org.junit.Test)

Example 3 with AuthorisationSummary

use of uk.gov.pay.api.model.AuthorisationSummary in project pay-publicapi by alphagov.

the class GetPaymentIT method getPaymentWithAuthorisationSummaryThroughLedger.

@Test
public void getPaymentWithAuthorisationSummaryThroughLedger() {
    AuthorisationSummary authorisationSummary = new AuthorisationSummary(new ThreeDSecure(true));
    ledgerMockClient.respondWithTransaction(CHARGE_ID, getLedgerTransaction().withAuthorisationSummary(authorisationSummary).build());
    ValidatableResponse response = getPaymentResponse(CHARGE_ID, LEDGER_ONLY_STRATEGY);
    assertCommonPaymentFields(response);
    assertPaymentWithAuthorisationSummary(response);
}
Also used : AuthorisationSummary(uk.gov.pay.api.model.AuthorisationSummary) ValidatableResponse(io.restassured.response.ValidatableResponse) ThreeDSecure(uk.gov.pay.api.model.ThreeDSecure) Test(org.junit.Test)

Example 4 with AuthorisationSummary

use of uk.gov.pay.api.model.AuthorisationSummary in project pay-publicapi by alphagov.

the class GetPaymentIT method getPaymentWithAuthorisationSummaryThroughConnector.

@Test
public void getPaymentWithAuthorisationSummaryThroughConnector() {
    AuthorisationSummary authorisationSummary = new AuthorisationSummary(new ThreeDSecure(true));
    connectorMockClient.respondWithChargeFound(CHARGE_TOKEN_ID, GATEWAY_ACCOUNT_ID, getConnectorCharge().withAuthorisationSummary(authorisationSummary).build());
    ValidatableResponse response = getPaymentResponse(CHARGE_ID);
    assertCommonPaymentFields(response);
    assertConnectorOnlyPaymentFields(response);
    assertPaymentWithAuthorisationSummary(response);
}
Also used : AuthorisationSummary(uk.gov.pay.api.model.AuthorisationSummary) ValidatableResponse(io.restassured.response.ValidatableResponse) ThreeDSecure(uk.gov.pay.api.model.ThreeDSecure) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 AuthorisationSummary (uk.gov.pay.api.model.AuthorisationSummary)4 ThreeDSecure (uk.gov.pay.api.model.ThreeDSecure)4 ValidatableResponse (io.restassured.response.ValidatableResponse)3 Matchers.emptyString (org.hamcrest.Matchers.emptyString)1 PaymentNavigationLinksFixture (uk.gov.pay.api.it.fixtures.PaymentNavigationLinksFixture)1 Address (uk.gov.pay.api.model.Address)1 CardDetails (uk.gov.pay.api.model.CardDetails)1