question

bbiwer avatar image
bbiwer asked igor-yazovtsev commented

Custom tender refund is no longer marking line items refunded

We implemented refunds and store credit in February on our custom tender. At the time, it was marking refunded line items properly. I have orders in my history to prove it. Today, when I run successful refunds with the same code, the line items are not marked and can be refunded again. Refunds using cash tender are functioning as expected.

I have no idea which version of Clover or the Orders app I was using in February, but it seems to me that a new version has been released with a bug or new requirements that we are not satisfying. Is this the case? I have another post open regarding Clover apps crashing after an update on all of my test devices, so I have a high level of suspicion at the moment. I have ruled out changes on our end.

There is virtually no documentation or example code for refunds, so any guidance will be appreciated. We are returning a result of OK with the refund amount and intent extras that are passed to us: lineitemids, amount, orderid, merchantid, and payment_id.

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

bbiwer avatar image bbiwer commented ·

The Clover app crashing issue has been resolved, but my refunds are still not marking line items. I just confirmed that an older version of the app that used to mark line items as refunded is no longer doing so, so I'm confident that we haven't broken something in our app.

0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

Do you have an app in production where this is failing? Or is this an app in development?

0 Likes 0 ·
bbiwer avatar image bbiwer commented ·

Both. The version in production has marked line items as refunded but is not now. My latest development version is behaving the same way.

0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

What's your app?

0 Likes 0 ·
bbiwer avatar image bbiwer commented ·
0 Likes 0 ·

1 Answer

Jeffrey Blattman avatar image
Jeffrey Blattman answered igor-yazovtsev commented
            Intent data = new Intent();
            data.putExtra(Intents.EXTRA_AMOUNT, amount);
            data.putExtra(Intents.EXTRA_ORDER_ID, orderId);
            data.putExtra(Intents.EXTRA_PAYMENT_ID, paymentId);
            data.putExtra(Intents.EXTRA_LINE_ITEM_IDS, lineItemIds);

            setResult(RESULT_OK, data);

I ran a test against the versions of our apps in prod and could not reproduce your problem. Can you grab the logcat and provide a pastebin link?

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.

bbiwer avatar image bbiwer commented ·

Good call checking the logs. It didn't occur to me to check if Clover was logging something regarding my intent.

Turns out it was the type of the value I was using for lineitemids. String[] causes a cast exception, and then Clover uses the default value of null. I must have changed that along the way.

Key clover.intent.extra.LINE_ITEM_IDS expected ArrayList<String> but value was a [Ljava.lang.String;.  The default value <null> was returned.
Attempt to cast generated internal exception:
java.lang.ClassCastException: java.lang.String[] cannot be cast to java.util.ArrayLiist
0 Likes 0 ·
igor-yazovtsev avatar image igor-yazovtsev commented ·

How do I transfer data when I pay to use it for Refund? I used "EXTRA_LINE_ITEM_IDS", "EXTRA_NOTE", but in Refund I could not retrieve them, I get null.

0 Likes 0 ·

Welcome to the
Clover Developer Community