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);
}
}
}
Aggregations