question

Ajmal M A avatar image
Ajmal M A asked Mateus commented

SecurityException: Access denied to package When Create TaxRate

When I tried to add tax rate to each inventory item using following code :

TaxRate taxRate = new TaxRate();
taxRate.setRate(1000l);
taxRate.setName("Custom Taxes");
taxRate.setIsDefault(false);
inventoryConnector.connect();

inventoryConnector.createTaxRate(taxRate); // Exception happend here

List<TaxRate> taxRates = new ArrayList<TaxRate>();
taxRates.add(taxRate);
newItem.setTaxRates(taxRates);

The following security exception throughs :

 java.lang.SecurityException: Access denied to package 
     at android.os.Parcel.readException(Parcel.java:1425)
     at android.os.Parcel.readException(Parcel.java:1379)
     at com.clover.sdk.v3.inventory.IInventoryService$Stub$Proxy.createTaxRate(IInventoryService.java:2427)
     at com.clover.sdk.v3.inventory.InventoryConnector$143.run(InventoryConnector.java:1206)

I have already added all permissions and installed from sandbox appstore as shown below: image description

Please help me to solve this issue.

Inventory
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

sam avatar image
sam Deactivated answered Mateus commented

Hi Ajmal, This is a bug we're aware of and working actively to fix. I'll keep you update on the resolution.

In the meantime, I would recommend using our REST endpoint to create a new TaxRate.

POST /v3/merchants/{mId}/tax_rates

body:

{
  "isDefault": false,
  "rate": "long",
  "name": ""
}

After which you should be able to associate the taxRate to an item.

               try {
                    List<String> taxRates = new ArrayList<String>();
                    taxRates.add([tax_id]);
                    mInventoryConnector.assignTaxRatesToItem([item_id], taxRates);
                } catch (Exception e) {
                    e.printStackTrace();
                }
2 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.

Mateus avatar image Mateus commented ·

If I call the assignTaxRatesToItem method after a successful response from the previous call(create tax rate), I get the error "com.clover.sdk.v1.ClientException: status code: 400 Invalid tax rate IDs". It looks like the tax rate is not synced yet. If I go to the setup app, the tax rate is not there either. It only appears after I click on the sync button(top right corner). Isn't there a way to have the tax rate synced faster? For my use case, I need to assign the tax rate to an item right after the tax rate is created.

0 Likes 0 ·
Mateus avatar image Mateus commented ·

And it would be great if the register app could refresh automatically when a tax rate is assigned to an item added to the current order, so we could see the tax value on the field "Tax", above "Total".

0 Likes 0 ·

Welcome to the
Clover Developer Community