question

ramya avatar image
ramya asked ramya commented

Some times all line items not getting from Order using Clover Android SDK. Please check once

Hi,


We are using Clover Android SDK to get all line items from Order. So that we sent all line items to StaticOrderPrintJob for printing.

But some merchants orders not printing all line items , some items are missing.


ArrayList<String> itemIdList=new ArrayList<String>();

itemIdList.clear();

for(int j=0;j<order.getLineItems().size();j++) {

if (!order.getLineItems().get(j).getName().equalsIgnoreCase("Convenience Fee") && !order.getLineItems().get(j).getName().equalsIgnoreCase("Delivery Fee")) {

itemIdList.add(order.getLineItems().get(j).getId());

}

}

PrintJob pj = new StaticOrderPrintJob.Builder().markPrinted(true).itemIds(itemIdList).order(order).build();

PrintJobsConnector pjc = new PrintJobsConnector(getBaseContext());


We are providing merchant, order and item information with private post

Can we know reason?

Thank you.


OrdersClover Android SDK
10 |2000

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

1 Answer

Jeffrey Blattman avatar image
Jeffrey Blattman answered ramya commented

This is a common problem. Just because you submitted an order to the server doesn't mean that device has synced your changes; the device doesn't go online to get an order ever time it is used by an application. When you submit a change via a REST API, a notification is sent to the device and the device then syncs any changes. There are many, expected reasons why that notification and the subsequent syncing can be delayed.

You'll need to be able to recognize that the order on the device has your changes. One way you might do that is by sending the order ID + modified time in the notification. Then the app that receives the notification on the device has to inspect the modified time, and potentially wait for the on-device order to come up to date. You could do this by adding an order listener, and waiting, with some reasonable timeout where you give up, for the order's modified time to be >= the modified time sent in the notification.

You can think of the order's modified time as an "order version". You need to wait for the version of the order on the device to be equal or greater than the version that has your updates.


6 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.

ramya avatar image ramya commented ·

Is there any possibility to know sync status of Order by Device Id using API?

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ ramya commented ·

No, please follow Jeff's advice.

0 Likes 0 ·
ramya avatar image ramya David Marginian ♦♦ commented ·

Ok, We will work on it

Can we know how much time out we should give,

how much time order will sync approximately?

0 Likes 0 ·
Show more comments

Welcome to the
Clover Developer Community