use of eu.ggnet.dwoss.redtape.ee.emo.AddressEmo in project dwoss by gg-net.
the class DocumentEaoIT method makeAnAmountOfBlocks.
private void makeAnAmountOfBlocks(int amount, int customerId) {
Dossier dos = new Dossier(PaymentMethod.INVOICE, false, customerId);
Document doc = new Document(BLOCK, NONE, new DocumentHistory("JUnit", "A History"));
Address address = new AddressEmo(em).request("A Test Address");
doc.setInvoiceAddress(address);
doc.setShippingAddress(address);
dos.add(doc);
em.persist(dos);
doc = makeMore(doc, amount);
doc.setActive(true);
}
use of eu.ggnet.dwoss.redtape.ee.emo.AddressEmo in project dwoss by gg-net.
the class DocumentEaoIT method makeAnAmountOfDocuments.
private void makeAnAmountOfDocuments(int amountOrder, int amountInvoice, int amountCreditMemo, boolean closed) {
Dossier dos = new Dossier(PaymentMethod.ADVANCE_PAYMENT, true, 1);
Document doc = new Document(ORDER, NONE, new DocumentHistory("JUnit", "A History"));
Address address = new AddressEmo(em).request("A Test Address");
doc.setInvoiceAddress(address);
doc.setShippingAddress(address);
dos.add(doc);
em.persist(dos);
dos.setIdentifier("DW" + dos.getId());
doc = makeMore(doc, amountOrder);
doc = RedTapeHelper.transitionTo(doc, INVOICE);
doc = makeMore(doc, amountInvoice);
doc.setClosed(closed);
doc = RedTapeHelper.transitionTo(doc, CREDIT_MEMO);
doc = makeMore(doc, amountCreditMemo);
doc.setClosed(closed);
doc.setActive(true);
}
use of eu.ggnet.dwoss.redtape.ee.emo.AddressEmo in project dwoss by gg-net.
the class DocumentEaoIT method testfindInvoiceUnpaidAndfindUnBalancedAnulation.
@Test
public void testfindInvoiceUnpaidAndfindUnBalancedAnulation() throws Exception {
utx.begin();
em.joinTransaction();
Address address = new AddressEmo(em).request("A Test Address");
Document doc = RedTapeHelper.makeOrderDossier(PaymentMethod.DIRECT_DEBIT, address);
long customerId = doc.getDossier().getCustomerId();
RedTapeHelper.addUnitServiceAndComment(doc);
em.persist(doc.getDossier());
doc = RedTapeHelper.transitionTo(doc, INVOICE);
doc.setActive(true);
doc = RedTapeHelper.transitionTo(doc, ANNULATION_INVOICE);
doc.setActive(true);
doc.setDirective(BALANCE_REPAYMENT);
utx.commit();
utx.begin();
em.joinTransaction();
DocumentEao documentEao = new DocumentEao(em);
List<Document> docs = documentEao.findInvoiceUnpaid(PaymentMethod.DIRECT_DEBIT);
assertThat(docs).as("Found InvoiceUnpaid").hasSize(1);
docs = documentEao.findUnBalancedAnulation(customerId, PaymentMethod.DIRECT_DEBIT);
assertThat(docs).as("Found UnBalancedAnulation").hasSize(1);
utx.commit();
}
use of eu.ggnet.dwoss.redtape.ee.emo.AddressEmo in project dwoss by gg-net.
the class DossierEaoFindByIdIT method testFindByIds.
@Test
public void testFindByIds() throws Exception {
AddressEmo adEmo = new AddressEmo(em);
List<Long> ids = new ArrayList<>();
utx.begin();
em.joinTransaction();
Dossier dos = new Dossier();
dos.setPaymentMethod(PaymentMethod.ADVANCE_PAYMENT);
dos.setCustomerId(1);
Document doc = new Document();
doc.setType(DocumentType.ORDER);
doc.setActive(true);
doc.setDirective(Document.Directive.NONE);
doc.setHistory(new DocumentHistory("JUnit", "Automatische Erstellung eines leeren Dokuments"));
doc.setInvoiceAddress(adEmo.request("Bla Bla"));
doc.setShippingAddress(adEmo.request("Auch"));
dos.add(doc);
em.persist(dos);
ids.add(dos.getId());
dos = new Dossier();
dos.setPaymentMethod(PaymentMethod.ADVANCE_PAYMENT);
dos.setCustomerId(1);
doc = new Document();
doc.setType(DocumentType.ORDER);
doc.setActive(true);
doc.setDirective(Document.Directive.NONE);
doc.setHistory(new DocumentHistory("JUnit", "Automatische Erstellung eines leeren Dokuments"));
doc.setInvoiceAddress(adEmo.request("Bla Bla"));
doc.setShippingAddress(adEmo.request("Auch"));
dos.add(doc);
em.persist(dos);
ids.add(dos.getId());
dos = new Dossier();
dos.setPaymentMethod(PaymentMethod.ADVANCE_PAYMENT);
dos.setCustomerId(1);
doc = new Document();
doc.setType(DocumentType.ORDER);
doc.setActive(true);
doc.setDirective(Document.Directive.NONE);
doc.setHistory(new DocumentHistory("JUnit", "Automatische Erstellung eines leeren Dokuments"));
doc.setInvoiceAddress(adEmo.request("Bla Bla"));
doc.setShippingAddress(adEmo.request("Auch"));
dos.add(doc);
em.persist(dos);
ids.add(dos.getId());
utx.commit();
utx.begin();
em.joinTransaction();
List<Dossier> dossiers = new DossierEao(em).findByIds(Arrays.asList(ids.get(0), ids.get(1)));
assertFalse("Dossiers should not be empty", dossiers.isEmpty());
assertEquals(2, dossiers.size());
utx.commit();
}
use of eu.ggnet.dwoss.redtape.ee.emo.AddressEmo in project dwoss by gg-net.
the class DossierEaoFindClosedIT method testFindByClosed.
@Test
public void testFindByClosed() throws Exception {
AddressEmo adEmo = new AddressEmo(em);
utx.begin();
em.joinTransaction();
Dossier dos = new Dossier();
dos.setPaymentMethod(PaymentMethod.ADVANCE_PAYMENT);
dos.setCustomerId(1);
Document doc = new Document();
doc.setType(DocumentType.ORDER);
doc.setActive(true);
doc.setDirective(Document.Directive.NONE);
doc.setHistory(new DocumentHistory("JUnit", "Automatische Erstellung eines leeren Dokuments"));
doc.setInvoiceAddress(adEmo.request("Bla Bla"));
doc.setShippingAddress(adEmo.request("Auch"));
dos.add(doc);
em.persist(dos);
dos = new Dossier();
dos.setPaymentMethod(PaymentMethod.ADVANCE_PAYMENT);
dos.setCustomerId(1);
doc = new Document();
doc.setType(DocumentType.ORDER);
doc.setActive(true);
doc.setDirective(Document.Directive.NONE);
doc.setHistory(new DocumentHistory("JUnit", "Automatische Erstellung eines leeren Dokuments"));
doc.setInvoiceAddress(adEmo.request("Bla Bla"));
doc.setShippingAddress(adEmo.request("Auch"));
dos.add(doc);
em.persist(dos);
dos = new Dossier();
dos.setPaymentMethod(PaymentMethod.ADVANCE_PAYMENT);
dos.setCustomerId(1);
dos.setClosed(true);
doc = new Document();
doc.setType(DocumentType.ORDER);
doc.setActive(true);
doc.setDirective(Document.Directive.NONE);
doc.setHistory(new DocumentHistory("JUnit", "Automatische Erstellung eines leeren Dokuments"));
doc.setInvoiceAddress(adEmo.request("Bla Bla"));
doc.setShippingAddress(adEmo.request("Auch"));
doc.setClosed(true);
dos.add(doc);
em.persist(dos);
utx.commit();
utx.begin();
em.joinTransaction();
List<Dossier> dossiers = new DossierEao(em).findByClosed(false);
assertFalse("Dossiers should not be empty", dossiers.isEmpty());
assertEquals(2, dossiers.size());
utx.commit();
}
Aggregations