use of org.estatio.module.capex.dom.invoice.IncomingInvoice in project estatio by estatio.
the class EstatioAppHomePage_verifyBankAccounts method act.
@Action(semantics = SemanticsOf.IDEMPOTENT, restrictTo = RestrictTo.PROTOTYPING)
@ActionLayout(position = ActionLayout.Position.PANEL)
public EstatioAppHomePage act(final List<IncomingInvoice> invoices, @Nullable final String comment) {
for (IncomingInvoice invoice : invoices) {
final BankAccount bankAccount = invoice.getBankAccount();
factoryService.mixin(BankAccount_verify.class, bankAccount).act(comment);
factoryService.mixin(IncomingInvoice_checkApprovalState.class, invoice).act();
}
return homePage;
}
use of org.estatio.module.capex.dom.invoice.IncomingInvoice in project estatio by estatio.
the class IncomingInvoice_approve method act.
@Action(domainEvent = ActionDomainEvent.class, semantics = SemanticsOf.IDEMPOTENT)
@ActionLayout(cssClassFa = "fa-thumbs-o-up")
public Object act(final String role, @Nullable final Person personToAssignNextTo, @Nullable final String comment, final boolean goToNext) {
final IncomingInvoice next = nextAfterPendingIfRequested(goToNext);
trigger(personToAssignNextTo, comment, null);
return objectToReturn(next);
}
use of org.estatio.module.capex.dom.invoice.IncomingInvoice in project estatio by estatio.
the class BankAccount_attachInvoiceAsIbanProof method choices0Act.
public List<Document> choices0Act() {
final List<Document> documents = Lists.newArrayList();
final List<IncomingInvoice> invoices = incomingInvoiceRepository.findByBankAccount(bankAccount);
for (IncomingInvoice invoice : invoices) {
final List<Document> attachedDocuments = lookupAttachedPdfService.lookupIncomingInvoicePdfsFrom(invoice);
documents.addAll(attachedDocuments);
}
final List<Document> documentsCurrentlyAttachedAsIbanProof = paperclipRepository.findByAttachedToAndRoleName(bankAccount, ROLE_NAME_FOR_IBAN_PROOF).stream().map(Paperclip::getDocument).filter(Document.class::isInstance).map(Document.class::cast).collect(Collectors.toList());
documents.removeAll(documentsCurrentlyAttachedAsIbanProof);
return documents;
}
use of org.estatio.module.capex.dom.invoice.IncomingInvoice in project estatio by estatio.
the class IncomingInvoiceMenu_Test method filterOrFindByGrossAmount_find_works.
@Test
public void filterOrFindByGrossAmount_find_works() {
IncomingInvoiceMenu.IncomingInvoiceFinder builder;
// given
builder = new IncomingInvoiceMenu.IncomingInvoiceFinder(mockInvoiceRepository, mockIncomingInvoiceRepository, mockPartyRepository);
IncomingInvoice invoice1 = new IncomingInvoice();
IncomingInvoice invoice2 = new IncomingInvoice();
IncomingInvoice invoice3 = new IncomingInvoice();
invoice1.setGrossAmount(new BigDecimal("9.50"));
invoice2.setGrossAmount(new BigDecimal("10.50"));
invoice3.setGrossAmount(new BigDecimal("10.51"));
final BigDecimal amountSearchedFor = new BigDecimal("10.00");
// expect
context.checking(new Expectations() {
{
oneOf(mockIncomingInvoiceRepository).listAll();
will(returnValue(Arrays.asList(invoice1, invoice2, invoice3)));
}
});
// when
builder.filterOrFindByGrossAmount(amountSearchedFor);
// then
Assertions.assertThat(builder.getResult().size()).isEqualTo(2);
Assertions.assertThat(builder.getResult()).contains(invoice1);
Assertions.assertThat(builder.getResult()).contains(invoice2);
}
use of org.estatio.module.capex.dom.invoice.IncomingInvoice in project estatio by estatio.
the class CreditTransferExportService_Test method getApprovalStateTransitionSummary_works.
@Test
public void getApprovalStateTransitionSummary_works() throws Exception {
// given
CreditTransferExportService service = new CreditTransferExportService();
IncomingInvoice invoice = new IncomingInvoice();
invoice.stateTransitionRepository = mockStateTransitionRepo;
IncomingInvoiceApprovalStateTransition transition1 = new IncomingInvoiceApprovalStateTransition();
transition1.setCompletedBy("some manager");
transition1.setCompletedOn(LocalDateTime.parse("2017-01-01"));
transition1.setToState(IncomingInvoiceApprovalState.APPROVED);
// expect
context.checking(new Expectations() {
{
oneOf(mockStateTransitionRepo).findByDomainObject(invoice);
will(returnValue(Arrays.asList(transition1)));
}
});
// when
String result = service.getApprovalStateTransitionSummary(invoice);
// then
Assertions.assertThat(result).isEqualTo("some manager on 01-Jan-2017 00:00 \r\n");
}
Aggregations