question

kdm2020 avatar image
kdm2020 asked kdm2020 commented

mInventoryConnector.getItems().get(0); is returning nothing

When I call an object of the below class my text view is set to "Not Found". I have also set all merchant permissions for my app in the sandbox account to read and write. Please can anyone help?

private class InventoryAsyncTask extends AsyncTask<Void, Void, Item> {

        @Override
        protected final Item doInBackground(Void... params) {
            try {
                //Get inventory item
                Item tmp = mInventoryConnector.getItems().get(0);
                Log.d("Item Value : ", tmp.getName());
                return tmp;

            } catch (RemoteException | ClientException | ServiceException | BindingException e) {
                e.printStackTrace();
            }
            return null;
        }

        @Override
        protected final void onPostExecute(Item item) {
            if (item != null) {
                mTextView.setText(item.getName());
            }
            else{
                mTextView.setText("Not Found");
            }
        }
    }

Inventory
4 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.

David Marginian avatar image David Marginian ♦♦ commented ·

Dump the logs (adb logcat) and provide a link to them. I assume you are also getting into the catch block but are not providing us with the stack trace.

0 Likes 0 ·
kdm2020 avatar image kdm2020 David Marginian ♦♦ commented ·

This is the error I got in the catch block:

com.clover.sdk.v1.ForbiddenException: status code: 403 Permission denied

How to grant permission? I am very new to this environment. Your little help will mean a lot to me. Thanks.

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ kdm2020 commented ·

Permissions need to be granted from the developer dashboard. In this case you will also need inventory read. Once you have granted permissions you will need to uninstall/reinstall your app via the dashboard.

0 Likes 0 ·
Show more comments

0 Answers

Welcome to the
Clover Developer Community