Search in sources :

Example 1 with BankPaymentBatch

use of com.axelor.apps.bankpayment.db.BankPaymentBatch in project axelor-open-suite by axelor.

the class BankPaymentBatchController method actionBankStatement.

public void actionBankStatement(ActionRequest request, ActionResponse response) {
    try {
        BankPaymentBatch bankPaymentBatch = request.getContext().asType(BankPaymentBatch.class);
        bankPaymentBatch = Beans.get(BankPaymentBatchRepository.class).find(bankPaymentBatch.getId());
        Batch batch = Beans.get(BatchBankStatement.class).bankStatement(bankPaymentBatch);
        if (batch != null)
            response.setFlash(batch.getComments());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    } finally {
        response.setReload(true);
    }
}
Also used : BatchBankStatement(com.axelor.apps.bankpayment.service.batch.BatchBankStatement) Batch(com.axelor.apps.base.db.Batch) BankPaymentBatch(com.axelor.apps.bankpayment.db.BankPaymentBatch) BankPaymentBatch(com.axelor.apps.bankpayment.db.BankPaymentBatch)

Example 2 with BankPaymentBatch

use of com.axelor.apps.bankpayment.db.BankPaymentBatch in project axelor-open-suite by axelor.

the class BankPaymentBatchBankRepository method copy.

@Override
public BankPaymentBatch copy(BankPaymentBatch entity, boolean deep) {
    BankPaymentBatch copy = super.copy(entity, deep);
    copy.clearBatchList();
    return copy;
}
Also used : BankPaymentBatch(com.axelor.apps.bankpayment.db.BankPaymentBatch)

Example 3 with BankPaymentBatch

use of com.axelor.apps.bankpayment.db.BankPaymentBatch in project axelor-open-suite by axelor.

the class BankPaymentBatchService method run.

@Override
public Batch run(Model batchModel) throws AxelorException {
    Batch batch;
    BankPaymentBatch bankPaymentBatch = (BankPaymentBatch) batchModel;
    switch(bankPaymentBatch.getActionSelect()) {
        case BankPaymentBatchRepository.ACTION_EBICS_CERTIFICATE:
            batch = ebicsCertificate(bankPaymentBatch);
            break;
        case BankPaymentBatchRepository.ACTION_BANK_STATEMENT:
            batch = bankStatement(bankPaymentBatch);
            break;
        default:
            throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.BASE_BATCH_1), bankPaymentBatch.getActionSelect(), bankPaymentBatch.getCode());
    }
    return batch;
}
Also used : AxelorException(com.axelor.exception.AxelorException) Batch(com.axelor.apps.base.db.Batch) BankPaymentBatch(com.axelor.apps.bankpayment.db.BankPaymentBatch) BankPaymentBatch(com.axelor.apps.bankpayment.db.BankPaymentBatch)

Example 4 with BankPaymentBatch

use of com.axelor.apps.bankpayment.db.BankPaymentBatch in project axelor-open-suite by axelor.

the class BankPaymentBatchController method actionEbicsCertificate.

public void actionEbicsCertificate(ActionRequest request, ActionResponse response) {
    BankPaymentBatch bankPaymentBatch = request.getContext().asType(BankPaymentBatch.class);
    bankPaymentBatch = Beans.get(BankPaymentBatchRepository.class).find(bankPaymentBatch.getId());
    Batch batch = Beans.get(BatchEbicsCertificate.class).ebicsCertificate(bankPaymentBatch);
    if (batch != null) {
        response.setFlash(batch.getComments());
    }
    response.setReload(true);
}
Also used : Batch(com.axelor.apps.base.db.Batch) BankPaymentBatch(com.axelor.apps.bankpayment.db.BankPaymentBatch) BankPaymentBatch(com.axelor.apps.bankpayment.db.BankPaymentBatch) BatchEbicsCertificate(com.axelor.apps.bankpayment.service.batch.BatchEbicsCertificate)

Example 5 with BankPaymentBatch

use of com.axelor.apps.bankpayment.db.BankPaymentBatch in project axelor-open-suite by axelor.

the class BatchBankStatement method process.

@Override
protected void process() {
    BankPaymentBatch bankPaymentBatch = batch.getBankPaymentBatch();
    Collection<EbicsPartner> ebicsPartners = bankPaymentBatch.getEbicsPartnerSet();
    // on the batch.
    if (ebicsPartners == null || ebicsPartners.isEmpty()) {
        ebicsPartners = getAllActiveEbicsPartners();
    }
    for (EbicsPartner ebicsPartner : ebicsPartners) {
        try {
            List<BankStatement> bankStatementList = ebicsPartnerService.getBankStatements(ebicsPartnerRepository.find(ebicsPartner.getId()), bankPaymentBatch.getBankStatementFileFormatSet());
            bankStatementCount += bankStatementList.size();
            for (BankStatement bankStatement : bankStatementList) {
                try {
                    bankStatementService.runImport(bankStatement, false);
                } catch (AxelorException e) {
                    processError(e, e.getCategory(), ebicsPartner);
                } finally {
                    JPA.clear();
                }
            }
            incrementDone();
        } catch (AxelorException e) {
            processError(e, e.getCategory(), ebicsPartner);
        } catch (Exception e) {
            processError(e, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, ebicsPartner);
        }
    }
}
Also used : AxelorException(com.axelor.exception.AxelorException) BankStatement(com.axelor.apps.bankpayment.db.BankStatement) BankPaymentBatch(com.axelor.apps.bankpayment.db.BankPaymentBatch) EbicsPartner(com.axelor.apps.bankpayment.db.EbicsPartner) AxelorException(com.axelor.exception.AxelorException)

Aggregations

BankPaymentBatch (com.axelor.apps.bankpayment.db.BankPaymentBatch)5 Batch (com.axelor.apps.base.db.Batch)3 AxelorException (com.axelor.exception.AxelorException)2 BankStatement (com.axelor.apps.bankpayment.db.BankStatement)1 EbicsPartner (com.axelor.apps.bankpayment.db.EbicsPartner)1 BatchBankStatement (com.axelor.apps.bankpayment.service.batch.BatchBankStatement)1 BatchEbicsCertificate (com.axelor.apps.bankpayment.service.batch.BatchEbicsCertificate)1