question

skodama avatar image
skodama asked skodama answered

StaticPaymentPrintJob Keeps Printing Receipt

I'm printing a payment receipt from my app using the following:

new StaticPaymentPrintJob.Builder().payment(payment).build().print(context, account);

The payment receipt is printed successfully, but somehow the printer error is shown in the device and it keeps printing the same payment receipt until I delete the print job manually.

The printer queue only shows "Failed" in the reason section, and I see the following error shown in the Logcat.

onHandleIntent(PrinterIntentService.java:406)[IntentService[PrinterIntentService]]: print failed, printer: Printer{uuid=J76W2AB58HPAG, type=BAYLEAF_USB, name=Flex, mac=null, ip=null, category=RECEIPT}
    java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
        at com.clover.engine.services.ReceiptPrinterPlugins.ReceiptData.getLineItems(ReceiptData.java:663)
        at com.clover.engine.services.ReceiptPrinterPlugins.ReceiptData.calculateSummaries(ReceiptData.java:641)
        at com.clover.engine.services.ReceiptPrinterPlugins.ReceiptData.getTaxSummaries(ReceiptData.java:612)
        at com.clover.engine.services.ReceiptPrinterPlugins.DefaultReceiptViewElements.addTaxesAndFeesBreakdownContainer(DefaultReceiptViewElements.java:500)
        at com.clover.engine.services.ReceiptPrinterPlugins.DefaultReceiptViewElements.generateAmountServiceAndTipView(DefaultReceiptViewElements.java:358)
        at com.clover.engine.services.ReceiptPrinterPlugins.DefaultReceiptViewElements.generateView(DefaultReceiptViewElements.java:93)
        at com.clover.engine.services.ReceiptPrinterPlugins.ReceiptGenerator.createPaymentView(ReceiptGenerator.java:196)
        at com.clover.engine.services.ReceiptPrinterPlugins.ReceiptGenerator.createPaymentView(ReceiptGenerator.java:169)
        at com.clover.engine.services.ReceiptPrinterPlugins.bayleaf.Bayleaf.printReceipt(Bayleaf.java:264)
        at com.clover.engine.services.PrinterIntentService.onHandleIntent(PrinterIntentService.java:317)
        at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.os.HandlerThread.run(HandlerThread.java:65)

The order being printed does not have any items. Should I add something in order to avoid this error?

The device being used is the Flex gen2 devkit device.

semi-integrationsClover Flex
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

skodama avatar image
skodama answered

I figured out the problem.

So, basically I needed to have at least one item in the order to be able to print it without printer error.

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community