question

wsadiq avatar image
wsadiq asked Jacob Abrams answered

getting customer since date

I am trying to get either the creation or update date for customers on Clover using the SDK. All I have is a v1 customer object. It seems like v3 customer has a getCustomerSince method but there is no method to convert a v1 customer to a v3 customer. In the debugger I can see that the v1 customer has the customer since data, but how do I get it?

Please help.

Thanks,

Waqar

Customers
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

Jacob Abrams avatar image
Jacob Abrams answered

Unfortunately we haven't implemented a v3 android API for customers yet, I think it's on the todo list. Until then here is a very hacky way that will get the data you want out of a com.clover.sdk.v1.customer.Customer instance. Definitely recommend you put a try catch around this:

      Parcel hack = Parcel.obtain();
      customer.writeToParcel(hack, 0);
      hack.setDataPosition(0);
      String customerString = hack.readString();
      hack.recycle();
      JSONObject customerJson = new JSONObject(customerString);
      long since = customerJson.getLong("customerSince");
      System.out.println("since="+new Date(since));
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