Poynt services crashing after sale

After I send a sale off to the Payment Fragment, I get all the way to the Receipt option. Once I tap a Receipt option, the Poynt Services stops. Here is the stack trace:

02-12 16:12:25.648 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: android.os.DeadObjectException
02-12 16:12:25.649 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at android.os.BinderProxy.transact(Native Method)
02-12 16:12:25.650 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at co.poynt.os.services.v1.IPoyntSecondScreenService$Stub$Proxy.displayWelcome(IPoyntSecondScreenService.java:290)
02-12 16:12:25.650 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at com.opt_inmedia.cybercouponsrewards.MainActivity.ShowSecondScreenWelcome(MainActivity.java:539)
02-12 16:12:25.651 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at com.opt_inmedia.cybercouponsrewards.MainActivity.ClearRegister(MainActivity.java:1595)
02-12 16:12:25.652 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at com.opt_inmedia.cybercouponsrewards.MainActivity.onActivityResult(MainActivity.java:435)
02-12 16:12:25.652 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at android.app.Activity.dispatchActivityResult(Activity.java:5423)
02-12 16:12:25.653 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at android.app.ActivityThread.deliverResults(ActivityThread.java:3347)
02-12 16:12:25.653 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at android.app.ActivityThread.handleSendResult(ActivityThread.java:3394)
02-12 16:12:25.654 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at android.app.ActivityThread.access$1300(ActivityThread.java:135)
02-12 16:12:25.654 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
02-12 16:12:25.655 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
02-12 16:12:25.655 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at android.os.Looper.loop(Looper.java:136)
02-12 16:12:25.657 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5001)
02-12 16:12:25.658 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at java.lang.reflect.Method.invokeNative(Native Method)
02-12 16:12:25.658 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at java.lang.reflect.Method.invoke(Method.java:515)
02-12 16:12:25.659 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
02-12 16:12:25.659 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
02-12 16:12:25.660 12358-12358/com.opt_inmedia.cybercouponsrewards W/System.err: at dalvik.system.NativeStart.main(Native Method)

I can post my code too if that helps. This code has been working for quite a while. Has something changed that I’m not aware of?

Hi Carl,

Posting the code would help. From the stack trace it appears that you are losing the connection for the second screen service. Are you unbinding in onPause and not rebinding in onResume by any chance?

Hi Dennis,

Here the code that calls the Payment Fragment, I will look into the SecondScreen Service as well:

public void ChargeSale()
{
    if (c_OrderItems.size() < 1)
    {
        Toast.makeText(this, "No Items To Charge", Toast.LENGTH_LONG).show();
        return;
    }

    Payment l_payment = new Payment();
    Order l_order = new Order();
    OrderAmounts l_orderAmounts = new OrderAmounts();
    OrderStatuses l_orderStatuses = new OrderStatuses();
    UUID l_referenceId = UUID.randomUUID();
    Calendar l_calNow = Calendar.getInstance();
    long l_customerID = 1;
    List<Discount> l_Discounts = new ArrayList<Discount>();
    List<Transaction> l_Transactions = new ArrayList<Transaction>();
    List<Link> l_Links = new ArrayList<Link>();

    Transaction trans;

    l_orderAmounts.setCurrency("USD");
    l_orderAmounts.setSubTotal(c_OrderAdapter.c_totalPrice.longValue());

    l_payment.setReferenceId(l_referenceId.toString());
    l_order.set_id(UUID.randomUUID().getMostSignificantBits());
    l_order.setId(UUID.randomUUID());
    l_order.setContext(c_clientContext);
    l_order.setCreatedAt(l_calNow);
    l_order.setUpdatedAt(l_calNow);
    l_order.setItems(c_OrderItems);
    l_order.setAmounts(l_orderAmounts);
    l_order.setParentId(l_referenceId);
    l_order.setCustomerUserId(l_customerID);
    l_order.setStatuses(l_orderStatuses);
    l_order.setNotes("CyberCoupons Rewards");
    l_order.setDiscounts(l_Discounts);
    l_order.setTransactions(l_Transactions);
    l_order.setLinks(l_Links);
    l_payment.setOrder(l_order);
    l_order.setOrderNumber("1");
    l_payment.setAmount(c_totalPrice.longValue());
    l_payment.setCurrency("USD");
    // start Payment activity for result
    try
    {
        Intent collectPaymentIntent = new Intent(Intents.ACTION_COLLECT_PAYMENT);
        collectPaymentIntent.putExtra(Intents.INTENT_EXTRAS_PAYMENT, l_payment);
        startActivityForResult(collectPaymentIntent, COLLECT_PAYMENT_REQUEST);
    }
    catch (ActivityNotFoundException ex)
    {
        String l_strError = ex.getMessage();
        ex.printStackTrace();
    }
}

I moved each of the unbindservice calls from the Activity’s onPause method to the Activity’s onDestroy method and each of the bindservice calls from the Activity’s onResume method to the Activity’s onCreate method.

The stack trace errors went away. After i click OK on the “Poynt services has stopped” error, I get these errors in LogCat:

02-15 08:30:47.665 17211-17211/com.opt_inmedia.cybercouponsrewards D/CyberCoupons: IPoyntSecondScreenService has unexpectedly disconnected
02-15 08:30:47.666 17211-17211/com.opt_inmedia.cybercouponsrewards D/CyberCoupons: PoyntBusinessService has unexpectedly disconnected
02-15 08:30:47.704 17211-17211/com.opt_inmedia.cybercouponsrewards E/TransactionTestActivity: PoyntSessionService has unexpectedly disconnected
02-15 08:30:47.704 17211-17211/com.opt_inmedia.cybercouponsrewards E/TransactionTestActivity: PoyntSessionService has unexpectedly disconnected
02-15 08:30:48.429 17211-17211/com.opt_inmedia.cybercouponsrewards E/TransactionTestActivity: PoyntSessionService is now connected
02-15 08:30:48.431 17211-17211/com.opt_inmedia.cybercouponsrewards D/CyberCoupons: PoyntBusinessService is now connected

onDestroy is not getting called and unbindservice isn’t called anywhere else in my code.

I tried an Invoice cashed out by No Receipt, that worked fine.
I tried an Invoice cashed out by Email Receipt, that worked fine.
I tried an Invoice cashed out by Print Receipt and got this exception:

Caused by: java.lang.NullPointerException
at co.poynt.os.printing.PoyntReceiptBuilder.addCombinedOrderTransactionDetails(PoyntReceiptBuilder.java:334)
at co.poynt.os.printing.PoyntReceiptBuilder.build(PoyntReceiptBuilder.java:660)
at co.poynt.services.payments.fragments.PaymentFragment$PrintReceiptTask.doInBackground(PaymentFragment.java:4397)
at co.poynt.services.payments.fragments.PaymentFragment$PrintReceiptTask.doInBackground(PaymentFragment.java:4358)
at android.os.AsyncTask$2.call(AsyncTask.java:288)

The printer seems fine, has paper. I did reboot it on Friday, I will try that again.

I also noticed that I am not setting all elements in the OrderItem object that is passed to the Payment Fragment.

Here are the elements I AM setting:

Name
UnitPrice
Quantity
Discount
Tax

Carl, is there something wrong with the code above?

I’m guessing so. I haven’t changed it in quite a while and it is based on the demo code I got from Poynt.
Even the bindservices were originally loaded from the onResume event.

I did try running the same thing on Poynt’s Register app and it did fine.

Can you give me the last 4 digits of your terminal serial number?

For the null pointer exception when printing receipt, can you sent the net total and try again?

The last for digits are 0716

are you still getting the exception when you set netTotal?

Now it runs without crashing but also doesn’t print.

Thanks

The Register app doesn’t print now either. Must be a printer issue. I will look into it.

Paper jam, all is good now. Thanks again Dennis!