We are using the following code in our android application to print payment receipts via clover devices for the other payment methods like as cash etc (except for Card) by using the following code:
Tender tender = new Tender();
tender.setLabel("PAYMENT_METHOD");
tender.setLabelKey("PAYMENT_METHOD");
Payment mPayment = new Payment();
mPayment.setId("TRANSACTION_ID");
mPayment.setAmount(1000);
mPayment.setTender(tender);
StaticPaymentPrintJob.Builder builder = new StaticPaymentPrintJob.Builder();
builder.flag(PrintJob.FLAG_CUSTOMER);
PrintJob printJob = builder.payment(mPayment).build();
printJob.print(mApplicationContext, getCloverAccount(mApplicationContext));
The code was working fine earlier and receipt was printed as expected but now it is throwing following error and printing is failed every time.
06-30 07:02:22.738 23923-26736/? W/Bayleaf: onHandleIntent(PrinterIntentService.java:401)[IntentService[PrinterIntentService]]: print failed, printer: Printer{uuid=HDK03SRCMEMG0, type=BAYLEAF_USB, name=Flex, mac=null, ip=null, category=RECEIPT}
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.clover.sdk.v3.base.Reference.getId()' on a null object reference
at com.clover.engine.services.ReceiptPrinterPlugins.PaymentTransaction.getOrderId(PaymentTransaction.java:61)
at com.clover.engine.services.ReceiptPrinterPlugins.ReceiptData.getOrder(ReceiptData.java:580)
at com.clover.engine.services.ReceiptPrinterPlugins.DefaultReceiptData.getOrder(DefaultReceiptData.java:3)
at com.clover.engine.services.ReceiptPrinterPlugins.DefaultReceiptViewElements.addTaxesAndFeesBreakdownContainer(DefaultReceiptViewElements.java:462)
at com.clover.engine.services.ReceiptPrinterPlugins.DefaultReceiptViewElements.generateAmountServiceAndTipView(DefaultReceiptViewElements.java:364)
at com.clover.engine.services.ReceiptPrinterPlugins.DefaultReceiptViewElements.generateView(DefaultReceiptViewElements.java:88)
at com.clover.engine.services.ReceiptPrinterPlugins.ReceiptGenerator.createPaymentView(ReceiptGenerator.java:198)
at com.clover.engine.services.ReceiptPrinterPlugins.ReceiptGenerator.createPaymentView(ReceiptGenerator.java:172)
at com.clover.engine.services.ReceiptPrinterPlugins.bayleaf.Bayleaf.printReceipt(Bayleaf.java:252)
at com.clover.engine.services.PrinterIntentService.onHandleIntent(PrinterIntentService.java:318)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:102)
What could be the reason for this null pointer exception, We have also tried to update to the latest version of clover android SDK (248.4) but the error is still not fixed. Please suggest to us immediately. It is very urgent.
Thanks