question

kamlakar avatar image
kamlakar asked yogesh-srivastava commented

unable to delete modifier from clover android sdk

Hi,

I am trying to delete single modifier of particular item, but it is giving me "com.clover.sdk.v1.ClientException", please tell me how to delete it. my code is..

        BaseApplicationContext.orderConnector.deleteLineItemModifications(order_Id, line_item_id, mod_ids);

order detail: Order Status = open :: Order ID =TQM935ME982GJ :: Line Item ID = PA5RDPXCZQM74 Modification ID = RPE1VJ5BHSB2Y

error: Exception 01-31 22:22:49.377 26100-26169/com.table.tablemanagement W/System.err: at com.clover.sdk.v1.ServiceConnector.throwOnFailure(ServiceConnector.java:277) 01-31 22:22:49.377 26100-26169/com.table.tablemanagement W/System.err: at com.clover.sdk.v1.ServiceConnector.execute(ServiceConnector.java:210) 01-31 22:22:49.377 26100-26169/com.table.tablemanagement W/System.err: at com.clover.sdk.v3.order.OrderConnector.deleteLineItemModifications(OrderConnector.java:343)

1 comment
10 |2000

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

yogesh-srivastava avatar image yogesh-srivastava commented ·

Hey.. I have same issue please give some solution

0 Likes 0 ·
tamer avatar image
tamer answered

could you please provide a snippet of your code from the point where you create the order, add line item, add modification, delete modification?

also log order.toString() between each call and provide that please.

you will get a ClientException if the modification id is incorrect. after calling addLineItemModification you will need to obtain the id of the line item modification that was created (not your Modifier's id).

10 |2000

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

Mark R avatar image
Mark R answered yogesh-srivastava commented

Just making sure you passed on the variables in right format.
mod_ids needs to be a array list of modifier ids and not just a modifier id as string.

so you have to do something like this

List<String> mod_ids_List = new ArrayList<String>();
//add for loop if you need it
mod_ids_List.add(mod_ids);

orderConnector.deleteLineItemModifications(order_Id, line_item_id, mod_ids_List);
3 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.

yogesh-srivastava avatar image yogesh-srivastava commented ·

@Mark I have used same code like you but i am getting client exception while deleting. I have one question, is List contain only current modifier Id or whole ids what ever we have selected for single lineitem, right now I have passed only current modifier id into list. Am I right..?

0 Likes 0 ·
Mark R avatar image Mark R commented ·

sorry, got late in checking forum messages. If you are still looking for comment -- You pass on the current modifier is as modids. modids_List can be build up using a loop if you have multiple modifiers for the same line item.

0 Likes 0 ·
kamlakar avatar image kamlakar commented ·

Hi, I solved this issue, After long and deep analysis I got the solution, we need to pass order id, lineitem id and the modifier id for particullar modifier from response order object. so we need to provide modifier id generated by response order object for modifier.

For Example: for(LineItem lineItem:order.getLineItems()){ if (lineItem.getId().equalsIgnoreCase(lineitemid)){ for (Modification modification:lineItem.getModifications()){ mod_ids.add(modification.getId()) }}}

0 Likes 0 ·

Welcome to the
Clover Developer Community