String ratingComm = (String) context.get("ratingComm");
String ratingShip = (String) context.get("ratingShip");
String ratingShipHand = (String) context.get("ratingShipHand");
try {
if (commentType != null) {
LeaveFeedbackCall leaveFeedbackCall = new LeaveFeedbackCall();
leaveFeedbackCall.setApiContext(apiContext);
leaveFeedbackCall.setTargetUser(targetUser);
leaveFeedbackCall.setTransactionID(transactionId);
if (role.equals("seller")) {
ItemRatingDetailArrayType sellerItemRatingDetailArray = new ItemRatingDetailArrayType();
//The item description
ItemRatingDetailsType itemRatingDetailsType1 = new ItemRatingDetailsType();
int ratingItemValue = 0;
if (UtilValidate.isInteger(ratingItem)) {
ratingItemValue = Integer.parseInt(ratingItem);
}
if (ratingItemValue < 3) {
/*
String AqItemAsDescribed = null;
int AqItemAsDescribedId = Integer.parseInt((String) context.get("AqItemAsDescribedId"));
switch (AqItemAsDescribedId) {
case 5:
AqItemAsDescribed = "ItemNotReceived";
break;
case 6:
AqItemAsDescribed = "ItemBadQuality";
break;
case 2:
AqItemAsDescribed = "ItemDamaged";
break;
case 1:
AqItemAsDescribed = "ItemIneligible";
break;
case 3:
AqItemAsDescribed = "ItemLost";
break;
default:
AqItemAsDescribed = "Other";
break;
}
*/
}
itemRatingDetailsType1.setRating(ratingItemValue);
itemRatingDetailsType1.setRatingDetail(FeedbackRatingDetailCodeType.ITEM_AS_DESCRIBED);
//The seller's communication
ItemRatingDetailsType itemRatingDetailsType2 = new ItemRatingDetailsType();
int ratingCommValue = 0;
if (UtilValidate.isInteger(ratingComm)) {
ratingCommValue = Integer.parseInt(ratingComm);
}
itemRatingDetailsType2.setRating(ratingCommValue);
itemRatingDetailsType2.setRatingDetail(FeedbackRatingDetailCodeType.COMMUNICATION);
//the seller ship the item
ItemRatingDetailsType itemRatingDetailsType3 = new ItemRatingDetailsType();
int ratingShipValue = 0;
if (UtilValidate.isInteger(ratingShip)) {
ratingShipValue = Integer.parseInt(ratingShip);
}
itemRatingDetailsType3.setRating(ratingShipValue);
itemRatingDetailsType3.setRatingDetail(FeedbackRatingDetailCodeType.SHIPPING_TIME);
//the shipping and handling charges
ItemRatingDetailsType itemRatingDetailsType4 = new ItemRatingDetailsType();
int ratingShipHandValue = 0;
if (UtilValidate.isInteger(ratingShipHand)) {
ratingShipHandValue = Integer.parseInt(ratingShipHand);
}
itemRatingDetailsType4.setRating(ratingShipHandValue);
itemRatingDetailsType4.setRatingDetail(FeedbackRatingDetailCodeType.SHIPPING_AND_HANDLING_CHARGES);
//Rating Summary
ItemRatingDetailsType[] itemRatingDetailsType = {itemRatingDetailsType1, itemRatingDetailsType2, itemRatingDetailsType3, itemRatingDetailsType4};
sellerItemRatingDetailArray.setItemRatingDetails(itemRatingDetailsType);
leaveFeedbackCall.setSellerItemRatingDetailArray(sellerItemRatingDetailArray);
}
FeedbackDetailType feedbackDetail = new FeedbackDetailType();
feedbackDetail.setItemID(itemId);
feedbackDetail.setCommentingUser(commentingUser);
feedbackDetail.setCommentText(commentText);
feedbackDetail.setCommentTime(Calendar.getInstance());
if (commentType.equals("positive")) {
feedbackDetail.setCommentType(CommentTypeCodeType.POSITIVE);
} else if (commentType.equals("neutral")) {
feedbackDetail.setCommentType(CommentTypeCodeType.NEUTRAL);
} else if (commentType.equals("negative")) {
feedbackDetail.setCommentType(CommentTypeCodeType.NEGATIVE);
}
leaveFeedbackCall.setFeedbackDetail(feedbackDetail);
leaveFeedbackCall.leaveFeedback();
}
} catch (ApiException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SdkException e) {