Search in sources :

Example 21 with InvoiceForLease

use of org.estatio.module.lease.dom.invoicing.InvoiceForLease in project estatio by estatio.

the class InvoiceForLeaseDtoFactory_Test method happy_case.

@Test
public void happy_case() throws Exception {
    // given
    invoice = new InvoiceForLease();
    invoice.setInvoiceDate(new LocalDate(2016, 1, 1));
    invoice.setPaymentMethod(org.estatio.module.invoice.dom.PaymentMethod.DIRECT_DEBIT);
    invoice.getItems().add(newItem(invoice, "1.01", "2.02", "3.03"));
    invoice.getItems().add(newItem(invoice, "10.10", "20.20", "30.30"));
    invoice.getItems().add(newItem(invoice, "100.00", "200.00", "300.00"));
    // when
    final InvoiceDto invoiceDto = invoiceForLeaseDtoFactory.newDto(invoice);
    // then
    assertThat(invoiceDto.getNetAmount()).isEqualTo(new BigDecimal("111.11"));
    assertThat(invoiceDto.getGrossAmount()).isEqualTo(new BigDecimal("222.22"));
    assertThat(invoiceDto.getVatAmount()).isEqualTo(new BigDecimal("333.33"));
    assertThat(invoiceDto.getInvoiceDate().toString()).isEqualTo("2016-01-01T00:00:00.000Z");
    assertThat(invoiceDto.getPaymentMethod()).isEqualTo(PaymentMethod.DIRECT_DEBIT);
}
Also used : InvoiceForLease(org.estatio.module.lease.dom.invoicing.InvoiceForLease) InvoiceDto(org.estatio.canonical.invoice.v1.InvoiceDto) LocalDate(org.joda.time.LocalDate) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 22 with InvoiceForLease

use of org.estatio.module.lease.dom.invoicing.InvoiceForLease in project estatio by estatio.

the class InvoiceItemForLeaseDtoFactory_Test method setUp.

@Before
public void setUp() throws Exception {
    // given
    ChargeGroup chargeGroup = new ChargeGroup();
    chargeGroup.setReference("CG");
    Charge charge = new Charge();
    charge.setReference("CH");
    charge.setExternalReference("CHE");
    charge.setGroup(chargeGroup);
    Tax tax = new Tax();
    Unit unit = new Unit();
    unit.setReference("UN");
    Brand brand = new Brand();
    brand.setName("BRAND");
    Occupancy occupancy = new Occupancy();
    occupancy.setEndDate(new LocalDate(2013, 12, 31));
    occupancy.setUnit(unit);
    occupancy.setBrand(brand);
    Lease lease = new Lease();
    lease.getOccupancies().add(occupancy);
    InvoiceForLease invoice = new InvoiceForLease();
    invoice.setLease(lease);
    invoiceItem = new InvoiceItemForLease();
    invoiceItem.setInvoice(invoice);
    invoiceItem.setCharge(charge);
    invoiceItem.setTax(tax);
}
Also used : Brand(org.estatio.module.lease.dom.occupancy.tags.Brand) Lease(org.estatio.module.lease.dom.Lease) InvoiceForLease(org.estatio.module.lease.dom.invoicing.InvoiceForLease) InvoiceItemForLease(org.estatio.module.lease.dom.invoicing.InvoiceItemForLease) InvoiceForLease(org.estatio.module.lease.dom.invoicing.InvoiceForLease) ChargeGroup(org.estatio.module.charge.dom.ChargeGroup) Occupancy(org.estatio.module.lease.dom.occupancy.Occupancy) Charge(org.estatio.module.charge.dom.Charge) InvoiceItemForLease(org.estatio.module.lease.dom.invoicing.InvoiceItemForLease) Tax(org.estatio.module.tax.dom.Tax) Unit(org.estatio.module.asset.dom.Unit) LocalDate(org.joda.time.LocalDate) Before(org.junit.Before)

Aggregations

InvoiceForLease (org.estatio.module.lease.dom.invoicing.InvoiceForLease)22 InvoiceItemForLease (org.estatio.module.lease.dom.invoicing.InvoiceItemForLease)8 LocalDate (org.joda.time.LocalDate)8 Lease (org.estatio.module.lease.dom.Lease)7 Property (org.estatio.module.asset.dom.Property)6 Test (org.junit.Test)6 Property_calculateInvoices (org.estatio.module.lease.contributions.Property_calculateInvoices)4 Programmatic (org.apache.isis.applib.annotation.Programmatic)3 Unit (org.estatio.module.asset.dom.Unit)3 Invoice (org.estatio.module.invoice.dom.Invoice)3 Occupancy (org.estatio.module.lease.dom.occupancy.Occupancy)3 Brand (org.estatio.module.lease.dom.occupancy.tags.Brand)3 Before (org.junit.Before)3 Action (org.apache.isis.applib.annotation.Action)2 InvoiceDto (org.estatio.canonical.invoice.v1.InvoiceDto)2 FixedAsset (org.estatio.module.asset.dom.FixedAsset)2 Charge (org.estatio.module.charge.dom.Charge)2 ChargeGroup (org.estatio.module.charge.dom.ChargeGroup)2 LeaseTerm (org.estatio.module.lease.dom.LeaseTerm)2 Tax (org.estatio.module.tax.dom.Tax)2