public void verificarTransaccion() throws Exception { if (subCuenta.getCodigoCuenta().getTipoCuenta().equals("DEUDORA")) { if (haber != null) { if (subCuenta.getSaldoSubCuenta().compareTo(haber) < 0) { throw new Exception( "El Saldo de" + subCuenta.getNombreSubcuenta() + "es insuficiente para la Transacción"); } } } else { if (debe != null) { if (subCuenta.getSaldoSubCuenta().compareTo(debe) < 0) { throw new Exception( "El Saldo de" + subCuenta.getNombreSubcuenta() + "es insuficiente para la Transacción"); } } } }
public void ajustarSaldoCuenta() { if (subCuenta.getCodigoCuenta().getTipoCuenta().equals("DEUDORA")) { if (haber != null) { subCuenta.restarASaldo(haber); subCuenta.getCodigoCuenta().restarASaldo(haber); } if (debe != null) { subCuenta.sumarASaldo(debe); subCuenta.getCodigoCuenta().sumarASaldo(debe); } } else { if (haber != null) { subCuenta.sumarASaldo(haber); subCuenta.getCodigoCuenta().sumarASaldo(haber); } if (debe != null) { subCuenta.restarASaldo(debe); subCuenta.getCodigoCuenta().restarASaldo(debe); } } }