Search in sources :

Example 6 with Property

use of org.estatio.dom.asset.Property in project estatio by estatio.

the class Api method putBankAccount.

@ActionSemantics(Of.IDEMPOTENT)
public void putBankAccount(// start generic fields
@Named("reference") final String reference, @Named("name") @Optional final String name, @Named("ownerReference") final String ownerReference, @Named("bankAccountType") @Optional final String bankAccountType, @Named("propertyReference") @Optional final String propertyReference, @Named("iban") @Optional final String iban, @Named("countryCode") @Optional final String countryCode, @Named("nationalCheckCode") @Optional final String nationalCheckCode, @Named("nationalBankCode") @Optional final String nationalBankCode, @Named("branchCode") @Optional final String branchCode, @Named("accountNumber") @Optional final String accountNumber, @Named("externalReference") @Optional final String externalReference) {
    if (IBANValidator.valid(iban)) {
        BankAccount bankAccount = (BankAccount) financialAccounts.findAccountByReference(reference);
        final Party owner = parties.findPartyByReference(ownerReference);
        if (owner == null)
            return;
        if (bankAccount == null) {
            bankAccount = bankAccounts.newBankAccount(owner, reference, name == null ? reference : name);
        }
        bankAccount.setIban(iban);
        bankAccount.verifyIban();
        if (propertyReference != null) {
            final Property property = properties.findPropertyByReferenceElseNull(propertyReference);
            if (property == null) {
                throw new IllegalArgumentException(propertyReference.concat(" not found"));
            }
            fixedAssetFinancialAccounts.findOrCreate(property, bankAccount);
        }
    }
}
Also used : BankAccount(org.estatio.dom.financial.bankaccount.BankAccount) Property(org.estatio.dom.asset.Property)

Aggregations

Property (org.estatio.dom.asset.Property)6 ApplicationException (org.apache.isis.applib.ApplicationException)1 BankAccount (org.estatio.dom.financial.bankaccount.BankAccount)1 Country (org.estatio.dom.geography.Country)1 ApplicationTenancy (org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)1