String buyerId = (String) context.get("buyerId");
List<Map<String, Object>> soldItems = FastList.newInstance();
double reservPrice = 0;
try {
ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator);
GetSellingManagerSoldListingsCall sellingManagerSoldListings = new GetSellingManagerSoldListingsCall(apiContext);
if (UtilValidate.isNotEmpty(filter)) {
SellingManagerSoldListingsPropertyTypeCodeType[] filterObject = {SellingManagerSoldListingsPropertyTypeCodeType.valueOf(filter)};
sellingManagerSoldListings.setFilter(filterObject );
}
if (UtilValidate.isNotEmpty(itemId)) {
SellingManagerSearchType search = new SellingManagerSearchType();
search.setSearchType(SellingManagerSearchTypeCodeType.ITEM_ID);
search.setSearchValue(itemId);
sellingManagerSoldListings.setSearch(search);
}
if (UtilValidate.isNotEmpty(buyerId)) {
SellingManagerSearchType search = new SellingManagerSearchType();
search.setSearchType(SellingManagerSearchTypeCodeType.BUYER_USER_ID);
search.setSearchValue(buyerId);
sellingManagerSoldListings.setSearch(search);
}
sellingManagerSoldListings.getSellingManagerSoldListings();
SellingManagerSoldOrderType[] sellingManagerSoldOrders = sellingManagerSoldListings.getReturnedSaleRecord();
if (UtilValidate.isNotEmpty(sellingManagerSoldOrders)) {
int soldOrderLength = sellingManagerSoldOrders.length;
for (int i = 0; i < soldOrderLength; i++) {
SellingManagerSoldOrderType sellingManagerSoldOrder = sellingManagerSoldOrders[i];