use of org.estatio.module.asset.dom.Property in project estatio by estatio.
the class NumeratorCollectionRepository_Test method setup.
@Before
public void setup() {
seller = new PartyForTesting();
buyer = new PartyForTesting();
paymentMethod = PaymentMethod.BANK_TRANSFER;
lease = new Lease() {
@Override
public Property getProperty() {
return null;
}
};
invoiceStatus = InvoiceStatus.APPROVED;
dueDate = new LocalDate(2013, 4, 1);
invoiceRepository = new InvoiceRepository() {
@Override
protected <T> T firstMatch(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderInteraction.FinderMethod.FIRST_MATCH);
return null;
}
@Override
protected List<Invoice> allInstances() {
finderInteraction = new FinderInteraction(null, FinderInteraction.FinderMethod.ALL_INSTANCES);
return null;
}
@Override
protected <T> List<T> allMatches(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderInteraction.FinderMethod.ALL_MATCHES);
return null;
}
};
invoiceForLeaseRepository = new InvoiceForLeaseRepository() {
};
estatioNumeratorRepository = new NumeratorForCollectionRepository();
}
use of org.estatio.module.asset.dom.Property in project estatio by estatio.
the class LeaseRepository_Test method setup.
@Before
public void setup() {
asset = new FixedAssetForTesting();
property = new Property();
leaseRepository = new LeaseRepository() {
@Override
protected <T> T uniqueMatch(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderMethod.UNIQUE_MATCH);
return (T) new Lease();
}
@Override
protected List<Lease> allInstances() {
finderInteraction = new FinderInteraction(null, FinderMethod.ALL_INSTANCES);
return null;
}
@Override
protected <T> List<T> allMatches(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderMethod.ALL_MATCHES);
return null;
}
};
leaseRepository.clockService = new ClockService();
}
use of org.estatio.module.asset.dom.Property in project estatio by estatio.
the class InvoiceMenu method newInvoiceForLease.
@ActionLayout(contributed = Contributed.AS_NEITHER)
@Action(semantics = SemanticsOf.NON_IDEMPOTENT)
@MemberOrder(sequence = "1")
public Invoice newInvoiceForLease(final Lease lease, final LocalDate dueDate, @Parameter(optionality = Optionality.OPTIONAL) final PaymentMethod paymentMethod, final Currency currency) {
final Property propertyIfAny = lease.getProperty();
final Party seller = lease.getPrimaryParty();
final Party buyer = lease.getSecondaryParty();
final ApplicationTenancy propertySellerTenancy = estatioApplicationTenancyRepositoryForLease.findOrCreateTenancyFor(propertyIfAny, seller);
return invoiceForLeaseRepository.newInvoice(propertySellerTenancy, seller, buyer, paymentMethod == null ? lease.defaultPaymentMethod() : paymentMethod, currency, dueDate, lease, null);
}
use of org.estatio.module.asset.dom.Property in project estatio by estatio.
the class IncomingInvoiceItemRepository_Test method upsert_works.
@Test
public void upsert_works() throws Exception {
// given
IncomingInvoiceItemRepository incomingInvoiceItemRepository = new IncomingInvoiceItemRepository() {
@Override
public IncomingInvoiceItem findByInvoiceAndChargeAndSequence(final IncomingInvoice invoice, final Charge charge, final BigInteger sequence) {
return invoiceItem;
}
};
BigInteger sequence = new BigInteger("1");
String description = "";
Tax tax = new Tax();
LocalDate dueDate = new LocalDate(2017, 1, 1);
LocalDate startDate = new LocalDate(2017, 1, 2);
LocalDate endDate = new LocalDate(2017, 1, 3);
Property property = new Property();
Project project = new Project();
BudgetItem budgetItem = new BudgetItem();
IncomingInvoiceType type = IncomingInvoiceType.CORPORATE_EXPENSES;
invoiceItem.setInvoice(mockInvoice);
assertThat(invoiceItem.getInvoice()).isEqualTo(mockInvoice);
assertThat(invoiceItem.getIncomingInvoiceType()).isNull();
assertThat(invoiceItem.getCharge()).isNull();
assertThat(invoiceItem.getSequence()).isNull();
assertThat(invoiceItem.getDescription()).isNull();
assertThat(invoiceItem.getNetAmount()).isNull();
assertThat(invoiceItem.getVatAmount()).isNull();
assertThat(invoiceItem.getGrossAmount()).isNull();
assertThat(invoiceItem.getTax()).isNull();
assertThat(invoiceItem.getDueDate()).isNull();
assertThat(invoiceItem.getStartDate()).isNull();
assertThat(invoiceItem.getEndDate()).isNull();
assertThat(invoiceItem.getFixedAsset()).isNull();
assertThat(invoiceItem.getProject()).isNull();
// when
incomingInvoiceItemRepository.upsert(sequence, mockInvoice, type, mockCharge, description, BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN, tax, dueDate, startDate, endDate, property, project, budgetItem);
// then
// should not updated
assertThat(invoiceItem.getInvoice()).isEqualTo(mockInvoice);
// should not updated
assertThat(invoiceItem.getCharge()).isNull();
// should not be updated
assertThat(invoiceItem.getIncomingInvoiceType()).isNull();
assertThat(invoiceItem.getSequence()).isEqualTo(sequence);
assertThat(invoiceItem.getDescription()).isEqualTo(description);
assertThat(invoiceItem.getNetAmount()).isEqualTo(BigDecimal.ZERO);
assertThat(invoiceItem.getVatAmount()).isEqualTo(BigDecimal.ONE);
assertThat(invoiceItem.getGrossAmount()).isEqualTo(BigDecimal.TEN);
assertThat(invoiceItem.getTax()).isEqualTo(tax);
assertThat(invoiceItem.getDueDate()).isEqualTo(dueDate);
assertThat(invoiceItem.getStartDate()).isEqualTo(startDate);
assertThat(invoiceItem.getEndDate()).isEqualTo(endDate);
assertThat(invoiceItem.getFixedAsset()).isEqualTo(property);
assertThat(invoiceItem.getProject()).isEqualTo(project);
}
use of org.estatio.module.asset.dom.Property in project estatio by estatio.
the class DebtorBankAccountService_Test method unique_Debtor_Account_To_Pay_works_when_bankaccounts_and_one_for_property.
@Test
public void unique_Debtor_Account_To_Pay_works_when_bankaccounts_and_one_for_property() throws Exception {
// given
DebtorBankAccountService service = new DebtorBankAccountService();
service.bankAccountRepository = mockBankAccountRepository;
service.fixedAssetFinancialAccountRepository = mockFixedAssetFinancialAccountRepository;
BankAccount bankAccount = new BankAccount();
BankAccount bankAccountForProperty = new BankAccount();
FixedAssetFinancialAccount fixedAssetFinancialAccount = new FixedAssetFinancialAccount();
fixedAssetFinancialAccount.setFinancialAccount(bankAccountForProperty);
List<BankAccount> bankAccounts = new ArrayList<>();
bankAccounts.add(bankAccount);
bankAccounts.add(bankAccountForProperty);
IncomingInvoice invoice = new IncomingInvoice();
Party debtor = new Organisation();
invoice.setBuyer(debtor);
Property property = new Property();
invoice.setProperty(property);
// expect
context.checking(new Expectations() {
{
oneOf(mockBankAccountRepository).findBankAccountsByOwner(debtor);
will(returnValue(bankAccounts));
oneOf(mockFixedAssetFinancialAccountRepository).findByFixedAsset(property);
will(returnValue(Arrays.asList(fixedAssetFinancialAccount)));
}
});
// when, then
assertThat(service.uniqueDebtorAccountToPay(invoice)).isEqualTo(bankAccountForProperty);
}
Aggregations