use of uk.gov.service.payments.commons.testing.pact.consumers.Pacts in project pay-publicapi by alphagov.
the class GetPaymentServiceLedgerTest method testGetPaymentWithSettledDate.
@Test
@PactVerification({ "ledger" })
@Pacts(pacts = { "publicapi-ledger-get-payment-with-settled-date" })
public void testGetPaymentWithSettledDate() {
Account account = new Account(ACCOUNT_ID, TokenPaymentType.CARD, tokenLink);
PaymentWithAllLinks paymentResponse = getPaymentService.getPayment(account, "ch_123abc456settlement");
CardPayment payment = (CardPayment) paymentResponse.getPayment();
assertThat(payment.getSettlementSummary().isPresent(), is(true));
assertThat(payment.getSettlementSummary().get().getSettledDate(), is("2020-09-19"));
}
use of uk.gov.service.payments.commons.testing.pact.consumers.Pacts in project pay-publicapi by alphagov.
the class GetPaymentServiceLedgerTest method providerIdIsAvailableWhenPaymentIsSubmitted_Ledger.
@Test
@PactVerification({ "ledger" })
@Pacts(pacts = { "publicapi-ledger-get-payment-with-gateway-transaction-id" })
public void providerIdIsAvailableWhenPaymentIsSubmitted_Ledger() {
Account account = new Account(ACCOUNT_ID, TokenPaymentType.CARD, tokenLink);
PaymentWithAllLinks paymentResponse = getPaymentService.getPayment(account, CHARGE_ID_NON_EXISTENT_IN_CONNECTOR);
CardPayment payment = (CardPayment) paymentResponse.getPayment();
assertThat(payment.getProviderId(), is("gateway-tx-123456"));
}
use of uk.gov.service.payments.commons.testing.pact.consumers.Pacts in project pay-publicapi by alphagov.
the class GetPaymentServiceLedgerTest method testGetPaymentWithFeeAndNetAmountFromLedger.
@Test
@PactVerification({ "ledger" })
@Pacts(pacts = { "publicapi-ledger-get-payment-with-fee-and-net-amount" })
public void testGetPaymentWithFeeAndNetAmountFromLedger() {
Account account = new Account(ACCOUNT_ID, TokenPaymentType.CARD, tokenLink);
PaymentWithAllLinks paymentResponse = getPaymentService.getPayment(account, CHARGE_ID_NON_EXISTENT_IN_CONNECTOR);
CardPayment payment = (CardPayment) paymentResponse.getPayment();
assertThat(payment.getPaymentId(), is(CHARGE_ID_NON_EXISTENT_IN_CONNECTOR));
assertThat(payment.getPaymentProvider(), is("sandbox"));
assertThat(payment.getAmount(), is(100L));
assertThat(payment.getFee().get(), is(5L));
assertThat(payment.getNetAmount().get(), is(95L));
}
use of uk.gov.service.payments.commons.testing.pact.consumers.Pacts in project pay-publicapi by alphagov.
the class GetPaymentServiceLedgerTest method testGetPaymentWithAuthorisationSummaryFromLedger.
@Test
@PactVerification({ "ledger" })
@Pacts(pacts = { "publicapi-ledger-get-payment-with-authorisation-summary" })
public void testGetPaymentWithAuthorisationSummaryFromLedger() {
Account account = new Account(ACCOUNT_ID, TokenPaymentType.CARD, tokenLink);
PaymentWithAllLinks paymentResponse = getPaymentService.getPayment(account, CHARGE_ID_NON_EXISTENT_IN_CONNECTOR);
CardPayment payment = (CardPayment) paymentResponse.getPayment();
assertThat(payment.getAuthorisationSummary().getThreeDSecure().isRequired(), is(true));
}
use of uk.gov.service.payments.commons.testing.pact.consumers.Pacts in project pay-publicapi by alphagov.
the class GetPaymentServiceLedgerTest method testGetPaymentWithMetadataFromLedger.
@Test
@PactVerification({ "ledger" })
@Pacts(pacts = { "publicapi-ledger-get-payment-with-metadata" })
public void testGetPaymentWithMetadataFromLedger() {
Account account = new Account(ACCOUNT_ID, TokenPaymentType.CARD, tokenLink);
PaymentWithAllLinks paymentResponse = getPaymentService.getPayment(account, CHARGE_ID_NON_EXISTENT_IN_CONNECTOR);
CardPayment payment = (CardPayment) paymentResponse.getPayment();
assertThat(payment.getMetadata(), is(notNullValue()));
assertThat(payment.getMetadata().getMetadata().isEmpty(), is(false));
}
Aggregations