Search in sources :

Example 31 with BankAccount

use of org.estatio.module.financial.dom.BankAccount in project estatio by estatio.

the class InvoiceAttributesVM method getSellerBankAccountBankName.

@Programmatic
public String getSellerBankAccountBankName() {
    FinancialAccount financialAccount = invoice.getSellerBankAccount();
    if (!(financialAccount instanceof BankAccount)) {
        return null;
    }
    final BankAccount bankAccount = (BankAccount) financialAccount;
    Party bank = bankAccount.getBank();
    if (bank == null) {
        return null;
    }
    return bank.getName();
}
Also used : Party(org.estatio.module.party.dom.Party) FinancialAccount(org.estatio.module.financial.dom.FinancialAccount) BankAccount(org.estatio.module.financial.dom.BankAccount) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 32 with BankAccount

use of org.estatio.module.financial.dom.BankAccount in project estatio by estatio.

the class InvoiceAttributesVM method getSellerBankAccountIban.

@Programmatic
public String getSellerBankAccountIban() {
    FinancialAccount financialAccount = invoice.getSellerBankAccount();
    if (!(financialAccount instanceof BankAccount)) {
        return null;
    }
    final BankAccount bankAccount = (BankAccount) financialAccount;
    return bankAccount.getIban();
}
Also used : FinancialAccount(org.estatio.module.financial.dom.FinancialAccount) BankAccount(org.estatio.module.financial.dom.BankAccount) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 33 with BankAccount

use of org.estatio.module.financial.dom.BankAccount in project estatio by estatio.

the class SellerBankAccountCreator_createBankAccount method act.

public SellerBankAccountCreator act(final String ibanNumber) {
    bankAccountRepository.newBankAccount(sellerBankAccountCreator.getSeller(), ibanNumber, null);
    // not exactly sure why, but this lookup is required (instead of setting bankaccount right away) in order that jaxb viewmodel is recreated correctly (otherwise we get an empty bank account).
    final BankAccount bankAccount = bankAccountRepository.findBankAccountByReference(sellerBankAccountCreator.getSeller(), ibanNumber);
    sellerBankAccountCreator.setBankAccount(bankAccount);
    return sellerBankAccountCreator;
}
Also used : BankAccount(org.estatio.module.financial.dom.BankAccount)

Example 34 with BankAccount

use of org.estatio.module.financial.dom.BankAccount in project estatio by estatio.

the class CreditTransfer method asXml.

@Programmatic
public CreditTransferTransactionInformation10 asXml() {
    CreditTransferTransactionInformation10 cdtTrfTxInf = new CreditTransferTransactionInformation10();
    PaymentIdentification1 pmtId = new PaymentIdentification1();
    cdtTrfTxInf.setPmtId(pmtId);
    pmtId.setEndToEndId(getEndToEndId());
    AmountType3Choice amt = new AmountType3Choice();
    cdtTrfTxInf.setAmt(amt);
    ActiveOrHistoricCurrencyAndAmount instdAmt = new ActiveOrHistoricCurrencyAndAmount();
    amt.setInstdAmt(instdAmt);
    instdAmt.setCcy(getCurrency().getReference().trim());
    instdAmt.setValue(getAmount());
    BankAccount creditorBankAccount = this.getSellerBankAccount();
    cdtTrfTxInf.setCdtrAgt(PaymentBatch.agentFor(creditorBankAccount));
    cdtTrfTxInf.setCdtrAcct(PaymentBatch.cashAccountFor(creditorBankAccount));
    PartyIdentification32 cdtr = new PartyIdentification32();
    cdtTrfTxInf.setCdtr(cdtr);
    cdtr.setNm(getSeller().getName());
    PostalAddress6 pstlAdr = new PostalAddress6();
    cdtr.setPstlAdr(pstlAdr);
    pstlAdr.setCtry(PaymentBatch.ctryFor(getSeller()));
    RemittanceInformation5 rmtInf = new RemittanceInformation5();
    cdtTrfTxInf.setRmtInf(rmtInf);
    List<String> ustrdList = rmtInf.getUstrds();
    ustrdList.add(getRemittanceInformation());
    return cdtTrfTxInf;
}
Also used : AmountType3Choice(iso.std.iso._20022.tech.xsd.pain_001_001.AmountType3Choice) ActiveOrHistoricCurrencyAndAmount(iso.std.iso._20022.tech.xsd.pain_001_001.ActiveOrHistoricCurrencyAndAmount) RemittanceInformation5(iso.std.iso._20022.tech.xsd.pain_001_001.RemittanceInformation5) PaymentIdentification1(iso.std.iso._20022.tech.xsd.pain_001_001.PaymentIdentification1) CreditTransferTransactionInformation10(iso.std.iso._20022.tech.xsd.pain_001_001.CreditTransferTransactionInformation10) BankAccount(org.estatio.module.financial.dom.BankAccount) PostalAddress6(iso.std.iso._20022.tech.xsd.pain_001_001.PostalAddress6) PartyIdentification32(iso.std.iso._20022.tech.xsd.pain_001_001.PartyIdentification32) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 35 with BankAccount

use of org.estatio.module.financial.dom.BankAccount in project estatio by estatio.

the class BankAccountVerificationStateSubscriber method attachDocumentAsPossibleIbanProofIfNone.

private void attachDocumentAsPossibleIbanProofIfNone(final IncomingInvoice incomingInvoice) {
    final BankAccount bankAccount = incomingInvoice.getBankAccount();
    if (bankAccount == null) {
        return;
    }
    // if already have some proof, then no need to attach any other
    final Optional<Document> currentProofIfAny = lookupAttachedPdfService.lookupIbanProofPdfFrom(bankAccount);
    if (currentProofIfAny.isPresent()) {
        return;
    }
    // else, attach this invoice as possible iban proof.
    final Optional<Document> documentIfAny = lookupAttachedPdfService.lookupIncomingInvoicePdfFrom(incomingInvoice);
    if (documentIfAny.isPresent()) {
        final Document document = documentIfAny.get();
        paperclipRepository.attach(document, BankAccount_attachPdfAsIbanProof.ROLE_NAME_FOR_IBAN_PROOF, bankAccount);
    }
}
Also used : BankAccount(org.estatio.module.financial.dom.BankAccount) Document(org.incode.module.document.dom.impl.docs.Document)

Aggregations

BankAccount (org.estatio.module.financial.dom.BankAccount)37 IncomingInvoice (org.estatio.module.capex.dom.invoice.IncomingInvoice)14 Test (org.junit.Test)13 Party (org.estatio.module.party.dom.Party)12 Programmatic (org.apache.isis.applib.annotation.Programmatic)11 Expectations (org.jmock.Expectations)9 Organisation (org.estatio.module.party.dom.Organisation)7 ArrayList (java.util.ArrayList)5 Action (org.apache.isis.applib.annotation.Action)4 Property (org.estatio.module.asset.dom.Property)4 BankAccountVerificationStateTransition (org.estatio.module.capex.dom.bankaccount.verification.BankAccountVerificationStateTransition)4 FinancialAccount (org.estatio.module.financial.dom.FinancialAccount)4 BigDecimal (java.math.BigDecimal)3 List (java.util.List)3 IncomingInvoiceApprovalStateTransition (org.estatio.module.capex.dom.invoice.approval.IncomingInvoiceApprovalStateTransition)3 Inject (javax.inject.Inject)2 ActionLayout (org.apache.isis.applib.annotation.ActionLayout)2 Blob (org.apache.isis.applib.value.Blob)2 FixedAssetFinancialAccount (org.estatio.module.assetfinancial.dom.FixedAssetFinancialAccount)2 BankMandate (org.estatio.module.bankmandate.dom.BankMandate)2