Hi Team,
I am trying to apply the discount to order when LINEITEMADDED, but it seems like the intent is not fetching the event from clover.
Below is onReceive() method of BroadcastReceiver class which i have used to intent.
public class EventReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals("com.clover.intent.action.LINE_ITEM_ADDED")) {
String orderId = intent.getStringExtra("com.clover.intent.extra.ORDER_ID");
String lineItemId = intent.getStringExtra("com.clover.intent.extra.LINE_ITEM_ID");
String itemId = intent.getStringExtra("com.clover.intent.extra.ITEM_ID");
AddDiscountActivity mainActivity = new AddDiscountActivity();
mainActivity.addDiscount(orderId);
}
}
}
and this is addDiscount() method of AddDiscountActivity class for add discount to order.
public void addDiscount(String orderId) {
try {
final Discount discount = new Discount();
discount.setPercentage(10l);
discount.setName("10% Discount");
orderConnector.addDiscount(orderId, discount);
} catch (Exception e) {
Log.e("Exception", " "+e);
}
}
I am not able to find out why this event is not working. Please let me know if I am missing anything. OR Is there any setting in clover account to active the intent functionality? I am new for this clover functionality so your help would be really appreciated.
Thanks.