Here is a code snippet:
private void addDiscountPercentageForOrder(OrderV31Connector orderConnector, Order order, Double percentage) throws RemoteException, ServiceException, BindingException, ClientException {
Discount discount = new Discount(); discount.setName(PROMOTION_LABEL); discount.setPercentage(percentage.longValue()); orderConnector.addDiscount(order.getId(), discount); } private void addDiscountAmountForOrder(OrderV31Connector orderConnector, Order order, Double amount) throws RemoteException, ServiceException, BindingException, ClientException { Discount discount = new Discount(); discount.setName(PROMOTION_LABEL); discount.setAmount(-(long) (amount * 100)); orderConnector.addDiscount(order.getId(), discount);
} //The OrderConnector is taken via the following code on the main thread: public static OrderV31Connector connectToOrderConnector(Context context) { Account mAccount = CloverAccount.getAccount(context); if (mAccount == null) { return null; } OrderV31Connector orderV31Connector = new OrderV31Connector(context, mAccount, null); orderV31Connector.connect(); return orderV31Connector;
}
Please advise.