question

dazza5000 avatar image
dazza5000 asked saru-fivestars answered

What permissions are needed to GET merchant configured discounts?

What permissions are needed to GET merchant configured discounts?


I added inventory read in the latest release and the permissions match what I have in my sandbox, but I am getting 403 permission denied when trying to get merchant discounts


This is how i am fetching discounts


private val account = CloverAccount.getAccount(context)
private val inventoryConnector = InventoryConnector(context, account, onServiceConnectedListener)

init {
    inventoryConnector.connect()
}

override suspend fun getMerchantDiscounts(): Result<List<Discount>> {
    return try {
        val discounts = inventoryConnector.discounts
        Result.Success(discounts)
    } catch (throwable: Throwable) {
        Result.Failure(throwable)
    }
}


Discounts
5 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 ·

In production? When permissions are changed the application needs to be uninstalled/re-installed.

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

In production, yes.

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

When permissions are changed on an app, the apps needs to be uninstalled/reinstalled.

0 Likes 0 ·
Show more comments
saru-fivestars avatar image
saru-fivestars answered David Marginian Deactivated commented

We have a similar issue..


1 We don't see the pre-defined discounts, yet when a custom one is created, it appears.

2. We also don't see a 403 error in the sandbox, but we do on production machines

3. Uninstalling and reinstalling or installing on a new machine makes no difference.

To date the only solution has been to create custom discounts.. these appear This is not tested on production machines yet.


Obviously creating custom discount fields is not scaleable for Merchants we don't have access to


The error we see..

1614998933311.png


The Loggly report points to permissions as the root cause. yet a new or re-install on a sandbox machine does not present these errors and we still don't see the default discounts.




1614998933311.png (316.5 KiB)
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.

David Marginian avatar image David Marginian ♦♦ commented ·

Does your app in sandbox have the same permissions as your app in production? What are your app IDs in both environments?

0 Likes 0 ·
saru-fivestars avatar image saru-fivestars David Marginian ♦♦ commented ·



Staging -
Default discounts do NOT appear.
Custom Discounts do appear.
App ID = J87MJRSF0RKGR
Permissions set = All ( both read and wite

Read and Write: Customers, Employees, Inventory, Merchant, Orders, Payments, Ecommerce


loggly does NOT report permission errors


Production -
Default discounts do NOT appear.
Custom Discounts do NOT appear
App ID =DDFWQ4H4JZXNE
Permissions set = read.
Inventory, Merchant, Orders, Payments, Ecommerce

Permissions set = write.
Merchant, Orders, Payments, Ecommerce

loggly does report permission errors

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ saru-fivestars commented ·

It looks like only INVENTORY_R is required to fetch discounts.

3. Uninstalling and reinstalling or installing on a new machine makes no difference.

How you are performing this step matters. Can you explain what steps you take when you uninstall/re-install?


0 Likes 0 ·
saru-fivestars avatar image
saru-fivestars answered saru-fivestars commented

Staging.

New machine via a merchant account via staging account.

Older APP. uninstall from merchants device, re install from merchants device using merchants account in the staging environment


Also tried via ADB process. the result is the same as if pushed from merchants account.

Production.

Only push new app and ask the merchant to install it (App is in the private marketplace on production) .

We already have been told that the app will need to be installed/reinstalled for production devices which we are fine with. provided we can do it unassisted.



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.

David Marginian avatar image David Marginian ♦♦ commented ·

Staging: You need to uninstall and re-install the app from the dashboard.

Production: Pushing a new APK is not going to be enough. The merchant needs to uninstall the app and re-install it.

0 Likes 0 ·
saru-fivestars avatar image saru-fivestars David Marginian ♦♦ commented ·

Staging: You need to uninstall and re-install the app from the dashboard.


Already did this.. again the result is.


Standard discounts invisible

Custom discounts visible.


re production..


testing this now..

0 Likes 0 ·
saru-fivestars avatar image
saru-fivestars answered David Marginian Deactivated commented

Also, how does a merchant delete the app. Is this done on the device inside the setup app?

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.

David Marginian avatar image David Marginian ♦♦ commented ·

On a prodution device, the merchant can just uninstall the app and install it again. Of course, this is assuming that the permission changes you have made have been approved/are live.

0 Likes 0 ·
saru-fivestars avatar image
saru-fivestars answered David Marginian Deactivated commented

I'd feel confident about this IS the delete/install process worked in the sandbox.

again..

We can see any Custom Discounts, just not the standard ones after a delete/ install.

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.

David Marginian avatar image David Marginian ♦♦ commented ·

Sandbox is different because you are sideloading apps, etc.

Ok, so you are saying that inventoryConnector.discounts returns some discounts, but not all. Can you provide the merchant you are working with in sandbox and a bit of a description of what discounts are not being returned?

0 Likes 0 ·
saru-fivestars avatar image
saru-fivestars answered saru-fivestars commented

Account = Fivestars
Merchant = PM - Salisbury


By default discounts (Current setting) - looks like this..

In dashboard no custom discounts are added


On the device.. (clovers discount experience)

1615242553615.png

Our experience

1615242495673.png








1615242495673.png (471.8 KiB)
1615242553615.png (446.7 KiB)
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.

David Marginian avatar image David Marginian ♦♦ commented ·

So, in "your" experience (lower image), you also want to show the discounts from the default experience (top image)? But they aren't being returned in the API call?

0 Likes 0 ·
saru-fivestars avatar image saru-fivestars David Marginian ♦♦ commented ·

Correct.. we would like to display in either case.. default discounts and custom discounts..

0 Likes 0 ·
saru-fivestars avatar image saru-fivestars saru-fivestars commented ·

Also, I was able to confirm that for a production device, deleting and reinstalling the app allowed for the same experience as sandbox.. so the issue remains.. how to pull in the standard discounts.. asking a merchant to configure custom discounts is not always possible.

0 Likes 0 ·
saru-fivestars avatar image
saru-fivestars answered

when custom discounts are set.



clover discount experience.


1615243151694.png


Our discount experiance


1615243221170.png


1615243151694.png (272.5 KiB)
1615243221170.png (139.3 KiB)
10 |2000

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

saru-fivestars avatar image
saru-fivestars answered

We have confirmed that in production. uninstalling and reinstalling the app in production resolves the permissions issue.. We still have an issue where if default discounts are set, we are not able to display the default discounts.

10 |2000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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