@Action( value = "savePayment", results = { @Result( name = "success", location = "spPayment", type = "redirectAction", params = {"model.id", "${id}"}), @Result(name = "input", type = "tiles", location = "/payment.tiles") }) public String save() { if (payment != null && payment.hashCode() != paymentHash) { if (doctorID != null && doctorID.equals("")) { addFieldError("doctorID", Messages.getString("DoctorSessionAction.CheckDoctor")); return INPUT; } if (!payment.getPaymentMethod().equals(PaymentMethod.MONEY_BACK) && payment.getValue() <= 0) { addFieldError("value", Messages.getString("PaymentAction.WrongValue")); return INPUT; } if (Messages.getCustomer("customer").trim().equals(Customer.degfim.toString().trim()) && getDoctors() != null) { if (!payment.getPaymentMethod().equals(PaymentMethod.MONEY_BACK)) { if (payment.getValue() > checkVal()) { addFieldError("value", "Мөнгөн дүн " + checkVal() + " -аас дээш байж болохгүй"); return INPUT; } } else { if (payment.getValue() > getDoctorSessionValue()) { addFieldError( "value", "Мөнгөн дүн " + getDoctorSessionValue() + " -аас дээш байж болохгүй"); return INPUT; } } } if (numberService.findAll().size() == 0) numberService.saveOrUpdate(new PaymentNumberCounter()); PaymentMethod method = payment.getPaymentMethod(); List<Patient> patientList = patientService.searchById(id); payment.setPatient(patientList.get(0)); if (method.equals(PaymentMethod.MONEY_BACK) && payment.getValue() > 0) { payment.setValue(payment.getValue() * (-1)); } if (doctorID != null) payment.setDoctor(doctorService.get(Long.parseLong(doctorID))); payment.setPaymentNumber(numberService.getNextPaymentNumber(method)); payment.setId(null); paymentService.saveOrUpdate(payment); ssm.logInfo(payment); return SUCCESS; } return INPUT; }
public PaymentMethod[] getPaymentMethodsForUser() { return PaymentMethod.valuesForUserRole(); }
public PaymentMethod[] getPaymentMethods() { return PaymentMethod.valuesWithoutAll(); }