How is the card payment triggered? Is it opened from your app using Intents.ACTION_SECURE_PAY? Or does the merchant complete the sale outside your app's flow? When the payment is being made, is the total amount shown on Pay $y or $y-x? If the order total remains $y, it's likely the order object hasn't been updated with the new discount when the payment is requested.
@vhsg It sounds like the discount object is not being added correctly onto the order object. If the discount amount is removed from the total but discount object doesn't exist on the order object, it will result in a partial payment since the full amount has not been paid off. I was able to add a discount to my order using this code snippet:
public void addDiscount(View view) {
new AsyncTask<Void, Void, Void>() {
OrderConnector OC = new OrderConnector (getBaseContext(), mAccount, null);
@Overrideprotected Void doInBackground(Void... voids) {
try {
Discount discount = new Discount();
discount.setName("test discount");
discount.setAmount(-1000L);
OC.addDiscount2("77HHVDRHQW2M6", discount);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}.execute();
}
The resulting behavior is shown in this video: https://youtu.be/iBxbvOJfiUY
We are using orderConnector.addDiscount instead of orderConnector.addDiscount2- is orderConnector.addDiscount not working?
Because our SDK need to maintain all backward functionality, you will sometimes see functions with names such as addDiscount2
which are newer functions that should be used in preference to older deprecated (but still operative) functions.
If it wasn't working I suspect it wouldn't work all the time, not just for 1 merchant, sometimes.
With single instance errors, our approach is to first achieve reproduction. This may require looking through this merchant crashalytics log to parse out where in the code might have failed. It may be helpful to paste a redacted error log to pinpoint the issue.
Also, our Order Connector is OrderV31Connector. OrderConnector or OrderV31Connector? addDiscount or addDiscount2? OrderConnector is a subclass of OrderV31Connector. Use OrderConnector unless you have a specific reason for using the older versions directly (eg. OrderV3Connector).
1 Person is following this question.