Hi
I am creating order from my application using below function:-
Order order = orderConnector.createOrder(new Order());
I want to ask below things.
How to get all orders which is open ? Can we get order state?
Hi
I am creating order from my application using below function:-
Order order = orderConnector.createOrder(new Order());
I want to ask below things.
How to get all orders which is open ? Can we get order state?
You can use the OrderContract in the clover-android-sdk:
Use the contract with ContentProvider#query
The query should have the following params:
uri: OrdersContract.Summaries.contentUriWithAccount(...)
projection: null (or the specific columns you want)
selection: OrdersContract.Summaries.PAYMENT_STATE + " = ?"
selectionArgs: { "OPEN" }
sortOrder: OrderContract.Summaries.CREATED + " DESC"
You will get back a Cursor that you may iterate over and read the results. Our OrderPaidActivity example in clover-android-sdk has an example query using the OrderContract in it.
You should also read about content provider if you aren't familiar with it here: https://developer.android.com/guide/topics/providers/content-provider-basics
Thanks Jacob. Very good to know. Do we have documentation on this?
We need to improve documentation on our clover-android-sdk, especially regarding contracts.
Looking at the main javadoc front page located here https://clover.github.io/clover-android-sdk/ you will notice the following statement: "Searching for and displaying large amounts of data is best done through a content provider" followed by a link to the OrderContract javadocs which are quite minimal unfortunately.
I believe OrderConnector can retrieve a list of orders only by id. I think you will have to use the REST API to filter by state - https://docs.clover.com/clover-platform/reference#ordergetorders-2.
Android apps running on Clover devices should avoid using the REST API, it's almost never necessary. Using the REST API from android apps is much slower and requires an active network connection but our goal is for nearly all functionality on our devices to work offline as well as online. Nearly all the data and functionality needed should be available in the clover-android-sdk.
2 People are following this question.