Search in sources :

Example 11 with BankOrder

use of com.axelor.apps.bankpayment.db.BankOrder 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);
    }
}
Also used : Context(com.axelor.rpc.Context) EbicsUser(com.axelor.apps.bankpayment.db.EbicsUser) BankOrderService(com.axelor.apps.bankpayment.service.bankorder.BankOrderService) BankOrder(com.axelor.apps.bankpayment.db.BankOrder) AxelorException(com.axelor.exception.AxelorException)

Example 12 with BankOrder

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

the class BankOrderController method setStatusCorrect.

public void setStatusCorrect(ActionRequest request, ActionResponse response) {
    BankOrder bankOrder = request.getContext().asType(BankOrder.class);
    bankOrder = Beans.get(BankOrderRepository.class).find(bankOrder.getId());
    Beans.get(BankOrderService.class).setStatusToDraft(bankOrder);
    response.setReload(true);
}
Also used : BankOrderService(com.axelor.apps.bankpayment.service.bankorder.BankOrderService) BankOrder(com.axelor.apps.bankpayment.db.BankOrder)

Example 13 with BankOrder

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

the class BankOrderController method fillBankDetails.

public void fillBankDetails(ActionRequest request, ActionResponse response) {
    BankOrder bankOrder = request.getContext().asType(BankOrder.class);
    BankDetails bankDetails = Beans.get(BankOrderService.class).getDefaultBankDetails(bankOrder);
    response.setValue("senderBankDetails", bankDetails);
}
Also used : BankDetails(com.axelor.apps.base.db.BankDetails) BankOrderService(com.axelor.apps.bankpayment.service.bankorder.BankOrderService) BankOrder(com.axelor.apps.bankpayment.db.BankOrder)

Example 14 with BankOrder

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

the class BankOrderController method resetReceivers.

public void resetReceivers(ActionRequest request, ActionResponse response) {
    try {
        BankOrder bankOrder = request.getContext().asType(BankOrder.class);
        Beans.get(BankOrderService.class).resetReceivers(bankOrder);
        response.setValue("bankOrderLineList", bankOrder.getBankOrderLineList());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : BankOrderService(com.axelor.apps.bankpayment.service.bankorder.BankOrderService) BankOrder(com.axelor.apps.bankpayment.db.BankOrder) AxelorException(com.axelor.exception.AxelorException)

Example 15 with BankOrder

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

the class BankOrderLineController method computeCompanyCurrencyAmount.

public void computeCompanyCurrencyAmount(ActionRequest request, ActionResponse response) {
    BankOrderLine bankOrderLine = request.getContext().asType(BankOrderLine.class);
    BankOrder bankOrder = request.getContext().getParent().asType(BankOrder.class);
    try {
        response.setValue("companyCurrencyAmount", Beans.get(BankOrderLineService.class).computeCompanyCurrencyAmount(bankOrder, bankOrderLine));
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : BankOrderLine(com.axelor.apps.bankpayment.db.BankOrderLine) BankOrder(com.axelor.apps.bankpayment.db.BankOrder)

Aggregations

BankOrder (com.axelor.apps.bankpayment.db.BankOrder)33 AxelorException (com.axelor.exception.AxelorException)16 Transactional (com.google.inject.persist.Transactional)11 BankOrderService (com.axelor.apps.bankpayment.service.bankorder.BankOrderService)10 BankOrderLine (com.axelor.apps.bankpayment.db.BankOrderLine)8 PaymentMode (com.axelor.apps.account.db.PaymentMode)6 BankDetails (com.axelor.apps.base.db.BankDetails)6 LocalDate (java.time.LocalDate)6 Company (com.axelor.apps.base.db.Company)4 Currency (com.axelor.apps.base.db.Currency)4 InvoicePayment (com.axelor.apps.account.db.InvoicePayment)3 EbicsUser (com.axelor.apps.bankpayment.db.EbicsUser)3 Partner (com.axelor.apps.base.db.Partner)3 BigDecimal (java.math.BigDecimal)3 ArrayList (java.util.ArrayList)3 AccountingBatch (com.axelor.apps.account.db.AccountingBatch)2 PaymentScheduleLine (com.axelor.apps.account.db.PaymentScheduleLine)2 BankOrderRepository (com.axelor.apps.bankpayment.db.repo.BankOrderRepository)2 BankOrderLineService (com.axelor.apps.bankpayment.service.bankorder.BankOrderLineService)2 BankOrderMergeService (com.axelor.apps.bankpayment.service.bankorder.BankOrderMergeService)2