use of com.axelor.apps.bankpayment.service.bankorder.BankOrderService in project axelor-open-suite by axelor.
the class BankOrderManagementRepository method save.
@Override
public BankOrder save(BankOrder entity) {
try {
BankOrderService bankOrderService = Beans.get(BankOrderService.class);
bankOrderService.generateSequence(entity);
bankOrderService.setSequenceOnBankOrderLines(entity);
if (entity.getStatusSelect() == BankOrderRepository.STATUS_DRAFT) {
bankOrderService.updateTotalAmounts(entity);
}
return super.save(entity);
} catch (Exception e) {
TraceBackService.traceExceptionFromSaveMethod(e);
throw new PersistenceException(e.getMessage(), e);
}
}
use of com.axelor.apps.bankpayment.service.bankorder.BankOrderService in project axelor-open-suite by axelor.
the class BankOrderController method validate.
public void validate(ActionRequest request, ActionResponse response) throws AxelorException {
Context context = request.getContext();
BankOrderService bankOrderService = Beans.get(BankOrderService.class);
BankOrder bankOrder = context.asType(BankOrder.class);
bankOrder = Beans.get(BankOrderRepository.class).find(bankOrder.getId());
try {
EbicsUser ebicsUser = bankOrder.getSignatoryEbicsUser();
if (ebicsUser == null) {
response.setError(I18n.get(IExceptionMessage.EBICS_MISSING_NAME));
} else {
if (ebicsUser.getEbicsPartner().getEbicsTypeSelect() == EbicsPartnerRepository.EBICS_TYPE_TS) {
bankOrderService.validate(bankOrder);
} else {
if (context.get("password") == null) {
response.setError(I18n.get(IExceptionMessage.EBICS_WRONG_PASSWORD));
}
if (context.get("password") != null) {
String password = (String) context.get("password");
if (ebicsUser.getPassword() == null || !ebicsUser.getPassword().equals(password)) {
response.setValue("password", "");
response.setError(I18n.get(IExceptionMessage.EBICS_WRONG_PASSWORD));
} else {
bankOrderService.validate(bankOrder);
}
}
response.setReload(true);
}
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations