Search in sources :

Example 1 with AddressEmo

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);
}
Also used : AddressEmo(eu.ggnet.dwoss.redtape.ee.emo.AddressEmo)

Example 2 with AddressEmo

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);
}
Also used : AddressEmo(eu.ggnet.dwoss.redtape.ee.emo.AddressEmo)

Example 3 with AddressEmo

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();
}
Also used : AddressEmo(eu.ggnet.dwoss.redtape.ee.emo.AddressEmo) DocumentEao(eu.ggnet.dwoss.redtape.ee.eao.DocumentEao) Test(org.junit.Test)

Example 4 with AddressEmo

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();
}
Also used : AddressEmo(eu.ggnet.dwoss.redtape.ee.emo.AddressEmo) Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) DocumentHistory(eu.ggnet.dwoss.redtape.ee.entity.DocumentHistory) DossierEao(eu.ggnet.dwoss.redtape.ee.eao.DossierEao) Document(eu.ggnet.dwoss.redtape.ee.entity.Document) Test(org.junit.Test)

Example 5 with AddressEmo

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();
}
Also used : AddressEmo(eu.ggnet.dwoss.redtape.ee.emo.AddressEmo) Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) DocumentHistory(eu.ggnet.dwoss.redtape.ee.entity.DocumentHistory) DossierEao(eu.ggnet.dwoss.redtape.ee.eao.DossierEao) Document(eu.ggnet.dwoss.redtape.ee.entity.Document) Test(org.junit.Test)

Aggregations

AddressEmo (eu.ggnet.dwoss.redtape.ee.emo.AddressEmo)9 Test (org.junit.Test)4 DossierEao (eu.ggnet.dwoss.redtape.ee.eao.DossierEao)3 Document (eu.ggnet.dwoss.redtape.ee.entity.Document)3 DocumentHistory (eu.ggnet.dwoss.redtape.ee.entity.DocumentHistory)3 Dossier (eu.ggnet.dwoss.redtape.ee.entity.Dossier)3 AddressServiceBean (eu.ggnet.dwoss.customer.ee.AddressServiceBean)1 CustomerServiceBean (eu.ggnet.dwoss.customer.ee.CustomerServiceBean)1 CustomerMetaData (eu.ggnet.dwoss.customer.opi.CustomerMetaData)1 Mandator (eu.ggnet.dwoss.mandator.api.value.Mandator)1 SpecialSystemCustomers (eu.ggnet.dwoss.mandator.api.value.SpecialSystemCustomers)1 RedTapes (eu.ggnet.dwoss.redtape.ee.assist.RedTapes)1 DocumentEao (eu.ggnet.dwoss.redtape.ee.eao.DocumentEao)1 Address (eu.ggnet.dwoss.redtape.ee.entity.Address)1 Directive (eu.ggnet.dwoss.redtape.ee.entity.Document.Directive)1 DossierFormater (eu.ggnet.dwoss.redtape.ee.format.DossierFormater)1 CustomerDocument (eu.ggnet.dwoss.redtapext.ee.state.CustomerDocument)1 eu.ggnet.dwoss.rules (eu.ggnet.dwoss.rules)1 CustomerFlag (eu.ggnet.dwoss.rules.CustomerFlag)1 BLOCK (eu.ggnet.dwoss.rules.DocumentType.BLOCK)1