Hello, I think this is a pretty serious bug which breaks the device printer. I am very open to receiving some kind of bug bounty.
Steps to repro:
- Create an order in the Register app and leave it Open. Note it's ID.
- Delete the order in the Orders app.
- In code, using the order ID you just deleted, call:
val deletedOrder = orderConenctor.getOrder(deletedOrderID)
val job = StaticBillPrintJob.Builder().order(deletedOrder).build()
PrintJobsConnector(context).print(printer, job)
Result:
- An error is thrown by the Printers app. The print does not complete. The job is given a state of PrintJobsContract.STATE_ERROR. And crucially: all future prints fail until the print queue is cleared in the Printers app. Even rebooting does not fix the issue because a reboot causes the print queue to recreate itself and it tries again.
Desired behavior:
- Sending a deleted Order to the print job builder doesn't break the printer.
- Possibly an exception is thrown instead.
Edit:
I have attached relevant logcat which I should have done to begin with. Looks like it specifically falls over when it tries to a print payments which don't exist on the deleted orders I try to print:
W/SeikoMini: onHandleIntent(PrinterIntentService.java:401)[IntentService[PrinterIntentService]]: print failed, printer: Printer{uuid=2RGKEXS4YFB9W, type=SEIKO_MINI_USB, name=Mini, mac=null, ip=null, category=RECEIPT} java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.clover.sdk.v3.order.Order.getPayments()' on a null object reference at com.clover.common2.printer.SignatureHelperV3.getPaymentFromOrder(SignatureHelperV3.java:385)