question

keithp avatar image
keithp asked saqlain89 answered

Cannot add discounts to order recently with addLineItemDiscount2()

I had code working for applying discounts to the correct line item but it has stopped working properly as of recently. Would this potentially be caused by the Sandbox being down? I'm working in sandbox. I get the error of "com.clover.sdk.v1.BindingException: Could not bind to Android service". Around this time my code stopped applying discounts and only returning that error, we upgraded our Dev Kit (I think Station Duo) to a register bungle for testing with other discount types. Would any of this cause OrderConnector to work differently? I create my order connector and call orderConnector.connect() which appears to function correctly. Then I start a new thread to apply my discount like so

orderConnector.addLineItemDiscount2(order.id, order.lineItems[i].id, discount1)

Do you have any idea why my discounts (which worked for days and I have rolled back my code to then) would stop working?

Any advice would be greatly appreciated. Thank you.


I asked this question the other day but did not get an answer. It may provide more insight to my problems. https://community.clover.com/questions/35283/orderconnector-fails-to-be-connected-for-applying.html

OrdersClover Android SDKclover developer communityDiscounts
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 Deactivated answered keithp commented

Have you tried searching this community site for that error? There are a bunch of hits, I haven't looked through all of them. Sandbox is not currently down so that's not the issue. Do you notice anything in the log cat around that time?

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

keithp avatar image keithp commented ·

I have tried to search the community site but have not found a solution. There aren't many I could find with an answer to my specific error in my use case. I had it working for multiple days so I am not sure what I'm missing. I had a package upgrade around that time adding "Discounts" and other apps at that time. That's the only other thing I can think of that would impact this.

Log cat shows this which I believe it exhausting all binder threads and failing hence the error above.

D/Connected: false //in response to orderConnector.isConnected

I/ServiceConnector: waitForConnection result: true, retryCount: 0

I/ServiceConnector: waitForConnection result: true, retryCount: 1

I/ServiceConnector: waitForConnection result: true, retryCount: 2

I'm also still unsure why I would get the following results. Could help explain my problem.

val orderConnector = OrderConnector(this, mAccount, null)
val success = orderConnector.connect() // returns true
val success2 = orderConnector.isConnected // returns false
0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ keithp commented ·
Provide the complete logcat please (use pastebin or some other site).
0 Likes 0 ·
keithp avatar image keithp David Marginian ♦♦ commented ·
0 Likes 0 ·
Show more comments
saqlain89 avatar image
saqlain89 answered

It appears that a recent update may have affected the ability to apply discounts to orders using the addLineItemDiscount2() function. This could impact the flexibility and customization of pricing strategies for specific line items in orders. It's crucial to review the latest documentation or seek assistance from relevant resources to understand any changes or alternatives to implement discounts effectively within your system. Maintaining transparency and ease of use for such features is essential for a seamless user experience. dude theft wars moon gravity

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