question

hellocraig avatar image
hellocraig asked ·

can not delete order just created in emulator

I can successfully delete the order when I execute the code orderConnector.deleteOrder(id); in the demo app PayWithRegisterExample.

But in my own app, I got this error message, com.clover.sdk.v1.ForbiddenException: status code: 403 Delete order failed for order:

Can anyone kindly advise what possibly I did wrong. thank you very much.
OrdersDeveloper Pay API
10 |2000 characters needed characters left characters exceeded

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

Dan avatar image
Dan answered ·
Without any logs, best I can do is some guesswork.

Orders cannot be deleted if:
The app using the connector does not have the ORDERS_W permission.
The employee logged into the device does not have the delete orders permission (set in setup app)
The order has a payment, credit, refund, or printed line items

Based on status code and message, it looks like the logged in user does not have the delete orders permission
Share
10 |2000 characters needed characters left characters exceeded

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

hellocraig avatar image
hellocraig answered ·
Thank you Dan for your response. Please see below the additional information.

Here is the log:
Delete old order error:com.clover.sdk.v1.ForbiddenException: Delete order failed for order: Order{json='{"id":"2XS6GBPV22C64","device":{"id":"35b2aca8-f30a-4a97-9d11-fefb21e8caaa"},"currency":"USD","isVat":false,"groupLineItems":true,"testMode":false,"createdTime":1502309333772,"clientCreatedTime":1502309333772,"taxRemoved":false,"manualTransaction":false,"total":109,"employee":{"id":"Y9262FWK5H3J0"},"lineItems":{"elements":[{"id":"NTX7WK09KDA26","item":{"id":"1WZAAYFFVZPD4"},"createdTime":1502309333693,"binName":null,"userData":null,"itemCode":"","price":100,"alternateName":"","name":"Latte small","exchanged":false,"refunded":false,"printed":false,"isRevenue":true,"taxRates":{"elements":[{"id":"2S0YP5CBKKZ5W","name":"Tax","rate":888750,"isDefault":true}]}}]},"state":"open"}', bundle=null, changeLog=null} Make sure Delete Order Permissions are set for this account

Below is my work flow:

Below is the permission of the connector

for the employee permission, what I use is the admin account with the admin default permission setting

2017-08-09.png (50.8 KiB)
connector.png (43.8 KiB)
2 comments Share
10 |2000 characters needed characters left characters exceeded

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

That error message is consistent with:
The currently logged in employee not having the permission Delete Open Orders (in Employees app -> Permissions Tab -> Register group -> Delete Open Orders).

Other potential causes of that error message include:
No employee logged in to device at time of execution

Device has never synced permissions w/ server

Device was not configured correctly

I'd need the device logcat to investigate further. I was unable to find the order or employee from the error message. Are you sure the device is configured correctly and has internet?

0 Likes 0 · ·

Hey @Dan

How does one check a device's synced permission or configuration?

0 Likes 0 · ·
Bejoy Nair avatar image
Bejoy Nair answered ·
Craig - The best option is to delete order using API. SDK order deletion will take the employee role into consideration and you cannot guarantee that the order will get deleted.

Hope this helps.
thx,
Bejoy
Share
10 |2000 characters needed characters left characters exceeded

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