use of uk.gov.pay.ledger.payout.state.PayoutState in project pay-ledger by alphagov.
the class PayoutEntityFactory method create.
public PayoutEntity create(EventDigest eventDigest) {
PayoutState digestPayoutState = eventDigest.getMostRecentSalientEventType().map(PayoutState::fromEventType).orElse(PayoutState.UNDEFINED);
String payoutDetails = convertToPayoutDetails(eventDigest.getEventAggregate());
PayoutEntity entity = objectMapper.convertValue(eventDigest.getEventAggregate(), PayoutEntity.class);
entity.setState(digestPayoutState);
entity.setCreatedDate(eventDigest.getEventCreatedDate());
entity.setGatewayPayoutId(eventDigest.getResourceExternalId());
entity.setServiceId(eventDigest.getServiceId());
entity.setLive(eventDigest.isLive());
entity.setEventCount(eventDigest.getEventCount());
entity.setPayoutDetails(payoutDetails);
return entity;
}
Aggregations