question

kellyhelmreich avatar image
kellyhelmreich asked kellyhelmreich commented

How does a custom tender update a receipt and not print twice?

We are a custom tender attempting to edit the end of the receipts with information about the discount we provided. We are following this example, which has been very helpful. However, using PrintJob only allows for our update to appear if we print the receipt ourselves every time. How would we update the receipt that only prints when the cashier selects "Print Customer Receipt" after the transaction?

--

I am now following this example exactly and cannot get it working with my custom tender orders even though the order I am trying to print has been paid for. I had this same issue with the first example that I was following (I used many different implementations of PrintJob in attempts to fix it - none of them worked for me).

I keep getting this NPE:

    06-02 10:53:16.609 W/Seiko   ( 3083): java.lang.NullPointerException
06-02 10:53:16.609 W/Seiko   ( 3083):   at com.clover.common2.printer.SignatureHelperV3.getPaymentFromOrder(SignatureHelperV3.java:280)
06-02 10:53:16.609 W/Seiko   ( 3083):   at com.clover.common2.printer.SignatureHelperV3.<init>(SignatureHelperV3.java:67)
06-02 10:53:16.609 W/Seiko   ( 3083):   at com.clover.engine.services.PrinterIntentService.onHandleIntent(PrinterIntentService.java:302)
06-02 10:53:16.609 W/Seiko   ( 3083):   at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
06-02 10:53:16.609 W/Seiko   ( 3083):   at android.os.Handler.dispatchMessage(Handler.java:99)
06-02 10:53:16.609 W/Seiko   ( 3083):   at android.os.Looper.loop(Looper.java:137)
06-02 10:53:16.609 W/Seiko   ( 3083):   at android.os.HandlerThread.run(HandlerThread.java:60)

Any idea why?

3 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 ·

I don't know what type of print job you are using. Could you elaborate? The receipt registration mechanism applies to all non-kitchen (order) receipts. Please ensure your provider is returning in a timely manner (2 seconds).

0 Likes 0 ·
kellyhelmreich avatar image kellyhelmreich commented ·

@jeff - see my edits above and let me know if this doesn't help clarify. Thanks.

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

That example is out of date. Please do not use any of the non-Static* print job classes they are deprecated and will be removed from the SDK in the next release. The trace indicates you are attempting to print a payment receipt for an order that has no payments.

0 Likes 0 ·

1 Answer

kellyhelmreich avatar image
kellyhelmreich answered

The problem turned out to be with the ReceiptRegistrationProvider authority. It needed an exact location, and in my code it only took it to a folder (no ".receipt" at the end). This caused an error in registering the uri. Hence the NPE.

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