Hi,
I'm trying to create an order and place a cash payment. After creating an order with some custom items on it I try to pay using:
Payment payment = new Payment();
payment.setTender(mTender);
payment.setCashTendered(amount);
payment.setAmount(amount);
orderConnector.addPayment(mOrderId, payment, order.getLineItems());
I also tried:
PaymentRequest paymentRequest = new PaymentRequest();
paymentRequest.setTender(mTender);
paymentRequest.setCashTendered(amount);
paymentRequest.setAmount(amount);
orderConnector.pay(order.getId(), paymentRequest, true, null);
I use this code to retrieve the tender:
List<com.clover.sdk.v1.tender.Tender> tenders = tenderConnector.getTenders();
for (com.clover.sdk.v1.tender.Tender tender :
tenders) {
if (tender.getLabelKey().equalsIgnoreCase(TenderConstants.CASH))
{
mTender = getV3TenderFromV1(tender);
break;
}
}
But I'm getting the error:
com.clover.sdk.v1.ForbiddenException: App doesn't have required permission
at com.clover.sdk.v1.ServiceConnector.throwOnFailure(ServiceConnector.java:275)
at com.clover.sdk.v1.ServiceConnector.execute(ServiceConnector.java:210)
at com.clover.sdk.v3.order.OrderConnector.pay(OrderConnector.java:432)
The application has all permissions. I do not have point to upload the picture....
Thank you
EDIT
I also tried REST API:
This is what I do:
CloverAuth.AuthResult authResult = CloverAuth.authenticate(this, account);
CustomHttpClient httpClient = CustomHttpClient.getHttpClient();
String paymentsUri = "/v3/merchants/" + mMerchant.getId() + "/orders/" + mOrderId + "/payments/";
String url = authResult.baseUrl + paymentsUri + "?access_token=" + authResult.authToken;
JSONObject payment = new JSONObject();
payment.put("amount", amount);
JSONObject tender = new JSONObject();
tender.put("id", mTender.getId());
payment.put("tender", tender);
String result = httpClient.post(url, payment.toString());
I get tender as described above and merchant as follows:
App app = appsConnector.getApp();
mMerchant = app.getMerchant();
Also I checked the apps permissions:
{
"androidPermissions": {
"elements": [
]
},
"permissionPaymentsRead": true,
"permissionInventoryRead": true,
"permissionProcessCards": true,
"permissionEmployeesWrite": true,
"permissionInventoryWrite": true,
"permissionCustomersWrite": false,
"permissionMerchantWrite": true,
"permissionOrdersWrite": true,
"permissionMerchantRead": true,
"permissionMidRead": true,
"permissionPaymentsWrite": true,
"permissionOrdersRead": true,
"permissionCustomersRead": false,
"permissionEmployeesRead": true
}
How can I solve this issue? Could this be a sandbox issue?