question

aadel avatar image
aadel asked aadel commented

InventoryConnector.getItems throws Permission Exception While the Equivalent REST API Works

Hi,

Calling mInventoryConnector.getItems() throws INVENTORY_R permission exception while the equivalent REST API https://apisandbox.dev.clover.com/v3/merchants/{mI... works fine with the same permissions granted from the application settings.

...
if (mAccount != null) {
    mInventoryConnector = new InventoryConnector(this, mAccount, null);
    mInventoryConnector.connect();
    new InventoryAsyncTask().execute();
}
...
InventoryAsyncTask definition can be found here.

Environment: Sandbox
Compile SDK: 25
Target SDK: 25

Any thoughts?

Thanks,
A.
App MarketSandbox
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

Bryanne Vega avatar image
Bryanne Vega answered aadel commented
  • Hello!
    The REST permissions are not the same than SDK permissions, check on your dashboard that you've:
    • Enabled Read/Write permissions of Inventory enabling the checkmark in required modules on the app settings in your developer dashboard.
    • You're using the same app id com.example.myapp in your App's Settings on your developer dashboard & on your app in the IDE.
    • Restarted/Synced the settings, just in case.
    • Install the app to the developer merchant
    Good luck!
    Good
    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.

    aadel avatar image aadel commented ·

    Thank you for your reply. We have gone through all actions above, however, the application still throws permission INVENTORY_R exception. Attached is a screenshot of the permissions page:

    We also double checked that the main application package name is exactly the same on the sandbox dashboard,

    Any further thoughts are appreciated.

    Best,
    A,

    0 Likes 0 ·
    Bryanne Vega avatar image Bryanne Vega commented ·

    Hello @aadel

    These permissions are for the REST API, you need to configure what modules your app uses (you will see in the options it says "Your app is available for Terminal, Register Lite" etc merchants. You must select the option "items". (This is in your app settings, on your developer dashboard).

    Sorry I can't provide a screenshot, the system I'm using won't let me.

    0 Likes 0 ·
    aadel avatar image aadel commented ·
    Hi @Bryanne Vega - thanks for the clarification. The "Items" checkbox is already checked under "Register Lite Merchants" however, the exception is still thrown.
    0 Likes 0 ·
    Bryanne Vega avatar image Bryanne Vega commented ·
    This might sound silly, I was facing this same issue with my Emulated Dev unit (brand new install).

    I gave up and went for a walk, when I came back, I turned on the device & it's just magically working.

    Somewhere, somehow the settings haven't sync, try doing it manually:

    Settings -> Accounts -> Clover and then hit the sync now button, restart, re-do the steps, go to the settings app from clover & hit the sync button. Uninstall & re-install the app.

    Hope it helps!
    0 Likes 0 ·
    aadel avatar image aadel commented ·
    Yep, sync and restart resolved the issue!
    0 Likes 0 ·
    Bryanne Vega avatar image Bryanne Vega aadel commented ·

    Glad to be of help!


    You're welcome for any further questions regarding this specific matter and/or to close the thread, looking forward to see your app in motion!

    0 Likes 0 ·

    Welcome to the
    Clover Developer Community