Search in sources :

Example 1 with Bill

use of org.collectiveone.modules.assignations.Bill in project CollectiveOneWebapp by CollectiveOne.

the class TokenTransferService method getTransfersPending.

@Transactional
public List<TransferDto> getTransfersPending(UUID initiativeId) {
    Initiative initiative = initiativeRepository.findById(initiativeId);
    List<TransferDto> transfersPending = new ArrayList<TransferDto>();
    List<Assignation> assignations = assignationService.getOpenAssignations(initiativeId);
    for (Assignation assignation : assignations) {
        for (Bill bill : assignation.getBills()) {
            TransferDto dto = new TransferDto();
            dto.setAssetId(bill.getTokenType().getId().toString());
            dto.setAssetName(bill.getTokenType().getName());
            dto.setSenderId(initiative.getId().toString());
            dto.setSenderName(initiative.getMeta().getName());
            dto.setValue(bill.getValue());
            transfersPending.add(dto);
        }
    }
    return transfersPending;
}
Also used : ArrayList(java.util.ArrayList) Bill(org.collectiveone.modules.assignations.Bill) TransferDto(org.collectiveone.modules.tokens.dto.TransferDto) Assignation(org.collectiveone.modules.assignations.Assignation) Initiative(org.collectiveone.modules.initiatives.Initiative) Transactional(javax.transaction.Transactional)

Aggregations

ArrayList (java.util.ArrayList)1 Transactional (javax.transaction.Transactional)1 Assignation (org.collectiveone.modules.assignations.Assignation)1 Bill (org.collectiveone.modules.assignations.Bill)1 Initiative (org.collectiveone.modules.initiatives.Initiative)1 TransferDto (org.collectiveone.modules.tokens.dto.TransferDto)1