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