question

mkonnekt avatar image
mkonnekt asked dansl answered

Receipt Print issue , Some time it works and some time it shows exceptions

I dont understand the behaviour of receipt printer .for some order it prints and some times it shows Null Pointer exception . Please help me to resolve this issue .

Why mac=null, ip=null these values are Null ?

print failed, printer: Printer{uuid=YRG4G36VKHW3G, type=SEIKOMINIUSB, name=Mini, mac=null, ip=null, category=RECEIPT} java.lang.NullPointerException at com.clover.engine.services.ReceiptPrinterPlugins.ReceiptGenerator.createReceiptView(ReceiptGenerator.java:2060) at com.clover.engine.services.ReceiptPrinterPlugins.ReceiptGenerator.createReceiptView(ReceiptGenerator.java:1608) at com.clover.engine.services.ReceiptPrinterPlugins.seiko.SeikoMini.printReceipt(SeikoMini.java:75) at com.clover.engine.services.PrinterIntentService.onHandleIntent(PrinterIntentService.java:325) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.os.HandlerThread.run(HandlerThread.java:61)

also let me know these things :-

  1. for receipt printer , employee must be mapped with any order ?
  2. for receipt printer , payment id is required or order id ?
5 comments
10 |2000

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

Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

Please ignore the mac=null, etc debugging statements. It's not relevant. Your print is failing at the point of generating the receipt content, not talking to the printer.

Without knowing what version of com.clover.engine you are running, I can't tell you specifically what's wrong. To answer your 1, and 2, I need to know what type of receipt you are printing and what code you are using to do so. Please Provide a pastebin link to your code.

0 Likes 0 ·
mkonnekt avatar image mkonnekt commented ·

Hi Jeff ,

Thanks for the response .

we are trying it on sandbox , please look at this link this code we are using to get all the active printers and call pring Job .

http://pastebin.com/iTHHP2in

we are using this sdk :- Clover SDK is : compile 'com.clover.sdk:clover-android-sdk:86'

let us know if what we are doing wrong ?

0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

What I really need is the version of the app com.clover.engine to match up the exception to to the code. Without knowing that, I suspect the problem is that you are asking to print a payment receipt but not specifying either a payment ID or a payment object in the print job.

0 Likes 0 ·
mkonnekt avatar image mkonnekt commented ·

This is on Sandbox and we are using Clove version 2.0-1856, Launcher - 1.0-1174

0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

Ah shoot. Line wrap got me I read line 206 and it was 2060. That makes more sense.

0 Likes 0 ·
Jeffrey Blattman avatar image
Jeffrey Blattman answered

Yes, the problem is you are using a payment print job, but not adding the payment. You need to call .paymentId() or .payment() on the builder.

10 |2000

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

dansl avatar image
dansl answered
Hey, we had this issue recently too. We found that for some reason the Order Object didn't have an "employee" assigned to it, so we just grabbed the Owners employee ID and added it to the Order Object before we tried to print it. Let me know if this helps.
10 |2000

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