Search in sources :

Example 21 with PactVerifyProvider

use of au.com.dius.pact.provider.PactVerifyProvider in project pay-connector by alphagov.

the class QueueMessageContractTest method verifyStatusCorrectedToCapturedToMatchGatewayStatusEvent.

@PactVerifyProvider("a status corrected to captured event")
public String verifyStatusCorrectedToCapturedToMatchGatewayStatusEvent() throws JsonProcessingException {
    ChargeEntity chargeEntity = aValidChargeEntity().withStatus(ChargeStatus.CAPTURED).withFee(Fee.of(null, 42L)).build();
    ChargeEventEntity chargeEventEntity = aValidChargeEventEntity().withCharge(chargeEntity).withGatewayEventDate(ZonedDateTime.now()).build();
    StatusCorrectedToCapturedToMatchGatewayStatus event = new StatusCorrectedToCapturedToMatchGatewayStatus(chargeEventEntity.getChargeEntity().getServiceId(), chargeEventEntity.getChargeEntity().getGatewayAccount().isLive(), resourceId, CaptureConfirmedEventDetails.from(chargeEventEntity), ZonedDateTime.now());
    return event.toJsonString();
}
Also used : ChargeEntityFixture.aValidChargeEntity(uk.gov.pay.connector.charge.model.domain.ChargeEntityFixture.aValidChargeEntity) ChargeEntity(uk.gov.pay.connector.charge.model.domain.ChargeEntity) ChargeEventEntity(uk.gov.pay.connector.chargeevent.model.domain.ChargeEventEntity) ChargeEventEntityFixture.aValidChargeEventEntity(uk.gov.pay.connector.pact.ChargeEventEntityFixture.aValidChargeEventEntity) StatusCorrectedToCapturedToMatchGatewayStatus(uk.gov.pay.connector.events.model.charge.StatusCorrectedToCapturedToMatchGatewayStatus) PactVerifyProvider(au.com.dius.pact.provider.PactVerifyProvider)

Example 22 with PactVerifyProvider

use of au.com.dius.pact.provider.PactVerifyProvider in project customer-service by wenqiglantz.

the class CustomerEventsPublishPactVerificationTest method publishCustomerWasCreated.

@PactVerifyProvider("valid CustomerWasCreated from provider")
public String publishCustomerWasCreated() throws Exception {
    CustomerInfo customerInfo = CustomerInfo.builder().customerId("595eed0c-eff5-4278-90ad-b952f18dbee8").firstName("test").lastName("last").build();
    CustomerWasCreated event = CustomerWasCreated.builder().customerId("595eed0c-eff5-4278-90ad-b952f18dbee8").firstName("test").lastName("last").status(CustomerStatus.CREATED).build();
    context.checking(new Expectations() {

        {
            oneOf(customerService).saveCustomer(customerInfo);
        }
    });
    customerService.saveCustomer(customerInfo);
    String eventString = objectMapper.writeValueAsString(event);
    return eventString;
}
Also used : Expectations(org.jmock.Expectations) CustomerWasCreated(com.github.wenqiglantz.service.customerservice.data.event.CustomerWasCreated) CustomerInfo(com.github.wenqiglantz.service.customerservice.data.CustomerInfo) PactVerifyProvider(au.com.dius.pact.provider.PactVerifyProvider)

Aggregations

PactVerifyProvider (au.com.dius.pact.provider.PactVerifyProvider)22 ChargeEntity (uk.gov.pay.connector.charge.model.domain.ChargeEntity)12 ChargeEntityFixture.aValidChargeEntity (uk.gov.pay.connector.charge.model.domain.ChargeEntityFixture.aValidChargeEntity)12 ChargeEventEntity (uk.gov.pay.connector.chargeevent.model.domain.ChargeEventEntity)5 ChargeEventEntityFixture.aValidChargeEventEntity (uk.gov.pay.connector.pact.ChargeEventEntityFixture.aValidChargeEventEntity)5 StripePayout (uk.gov.pay.connector.gateway.stripe.json.StripePayout)4 Expectations (org.jmock.Expectations)3 Charge (uk.gov.pay.connector.charge.model.domain.Charge)3 RefundHistory (uk.gov.pay.connector.refund.model.domain.RefundHistory)3 CustomerInfo (com.github.wenqiglantz.service.customerservice.data.CustomerInfo)2 ExternalMetadata (uk.gov.service.payments.commons.model.charge.ExternalMetadata)2 Category (com.ecommerceapp.inventory.model.Category)1 Product (com.ecommerceapp.inventory.model.Product)1 Order (com.ecommerceapp.shop.model.Order)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 CustomerWasCreated (com.github.wenqiglantz.service.customerservice.data.event.CustomerWasCreated)1 CustomerWasDeleted (com.github.wenqiglantz.service.customerservice.data.event.CustomerWasDeleted)1 CustomerWasUpdated (com.github.wenqiglantz.service.customerservice.data.event.CustomerWasUpdated)1 DisputeCreatedEventDetails (uk.gov.pay.connector.events.eventdetails.dispute.DisputeCreatedEventDetails)1 CancelledByUser (uk.gov.pay.connector.events.model.charge.CancelledByUser)1