public void deleteTicket(TicketInfo ticket) throws BasicException { try { ServerLoader loader = new ServerLoader(); ServerLoader.Response r; r = loader.write("TicketsAPI", "delete", "id", ticket.getId()); if (!r.getStatus().equals(ServerLoader.Response.STATUS_OK)) { throw new BasicException("Bad server response"); } } catch (Exception e) { e.printStackTrace(); throw new BasicException(e); } }
/** Save or edit ticket */ public final void saveTicket( final TicketInfo ticket, final String locationId, final String cashId) throws BasicException { if (CallQueue.isOffline()) { // Don't try to send and wait for recovery CallQueue.queueTicketSave(ticket); return; } try { ServerLoader loader = new ServerLoader(); ServerLoader.Response r; r = loader.write( "TicketsAPI", "save", "ticket", ticket.toJSON().toString(), "cashId", cashId); if (!r.getStatus().equals(ServerLoader.Response.STATUS_OK)) { throw new BasicException("Bad server response"); } } catch (Exception e) { // Unable to save, queue it logger.log(Level.WARNING, "Unable to save ticket: " + e.getMessage()); CallQueue.queueTicketSave(ticket); throw new BasicException(e); } }