question

leobufibarrameda avatar image
leobufibarrameda asked leobufibarrameda edited

Split Customer Amount Issue with adding discount using Clover Android SDK

Hi guys,

I have this code that is working on Order Payment on Pay Full Amount scenario when you apply a discount but it is not working in Split Custom Amount scenario.

It throws this error log:

W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'com.clover.sdk.OrderTitle com.clover.common2.clover.Clover.getOrderTitleType()' on a null object reference
        at android.os.Parcel.readException(Parcel.java:2010)
W/System.err:     at android.os.Parcel.readException(Parcel.java:1950)
        at com.clover.sdk.v3.order.IOrderServiceV3_1$Stub$Proxy.addDiscount2(IOrderServiceV3_1.java:3608)
        at com.clover.sdk.v3.order.OrderV31Connector$28.call(OrderV31Connector.java:444)
        at com.clover.sdk.v3.order.OrderV31Connector$28.call(OrderV31Connector.java:441)
        at com.clover.sdk.v1.ServiceConnector.execute(ServiceConnector.java:258)
        at com.clover.sdk.v3.order.OrderV31Connector.addDiscount2(OrderV31Connector.java:441)
        at trezoro.merchant.clover.service.OrderService.addDiscountAmountForOrder(OrderService.java:306)
        at trezoro.merchant.clover.service.OrderService.addRedeemedItemsToOrder(OrderService.java:170)
        at trezoro.merchant.clover.service.OrderService.access$000(OrderService.java:44)
        at trezoro.merchant.clover.service.OrderService$1.doInBackground(OrderService.java:70)
        at trezoro.merchant.clover.service.OrderService$1.doInBackground(OrderService.java:60)
        at android.os.AsyncTask$2.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)

The code applies amount discount on the Payment and it looks like something like this:

OrderConnector oc = new OrderConnector(context, account, null);
oc.connect();
Discount discount = new Discount();
discount.setName("DISCOUNT LABEL );
discount.setAmount(-Math.round(19.99 * 100L));
oc.addDiscount(order.getId(), discount);

With the exception above, the discount is not applied on Split Payment but it is working on Pay Full Amount.

Clover Android SDKDiscounts
10 |2000

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

0 Answers

·

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