use of org.estatio.canonical.bankmandate.v1.BankMandateDto in project estatio by estatio.
the class BankMandateDtoFactory method newDto.
@Programmatic
public BankMandateDto newDto(final BankMandate bankMandate) {
final BankMandateDto dto = new BankMandateDto();
dto.setSelf(mappingHelper.oidDtoFor(bankMandate));
dto.setReference(fixup(bankMandate.getReference()));
dto.setScheme(toDto(bankMandate.getScheme()));
dto.setSequenceType(toDto2(bankMandate.getSequenceType()));
dto.setSignatureDate(asXMLGregorianCalendar(bankMandate.getSignatureDate()));
dto.setBankAccount(mappingHelper.oidDtoFor(bankMandate.getBankAccount()));
// not currently in the estatio dom, so hard-coded for now
dto.setStatus(Status.OPEN);
return dto;
}
use of org.estatio.canonical.bankmandate.v1.BankMandateDto in project estatio by estatio.
the class PartyBankAccountsAndMandatesDtoFactory method newDto.
@Programmatic
public BankAccountsAndMandatesDto newDto(final Party party) {
final BankAccountsAndMandatesDto dto = new BankAccountsAndMandatesDto();
final List<FinancialAccount> financialAccountList = financialAccountRepository.findAccountsByTypeOwner(FinancialAccountType.BANK_ACCOUNT, party);
final List<BankAccountDto> bankAccountDtos = financialAccountList.stream().map(x -> bankAccountDtoFactory.newDto((BankAccount) x)).collect(Collectors.toList());
dto.setBankAccounts(bankAccountDtos);
final AgreementType bankMandateAt = agreementTypeRepository.find(BankMandateAgreementTypeEnum.MANDATE);
final AgreementRoleType debtorOfMandate = agreementRoleTypeRepository.findByAgreementTypeAndTitle(bankMandateAt, BankMandateAgreementRoleTypeEnum.DEBTOR.getTitle());
final List<AgreementRole> agreementRoles = agreementRoleRepository.findByPartyAndType(party, debtorOfMandate);
final List<BankMandateDto> mandateDtos = agreementRoles.stream().map(x -> x.getAgreement()).map(x -> bankMandateDtoFactory.newDto((BankMandate) x)).collect(Collectors.toList());
dto.setBankMandates(mandateDtos);
return dto;
}
Aggregations