I am trying to implement the eBay Trading API SetShippingDiscountProfiles (SetShippingDiscountProfilesCall), when there are no "Calculated shipping rule" defined on eBay (Home > My eBay > My Account > Preferences > Combined Payments and Shipping Discounts) and I try to add a calculated shipping rule through the SetShippingDiscountProfilesCall, I get the the below exception
com.ebay.sdk.ApiException: Not able to perform action, since the profile data you specified is not matching with the existing profiles or action is not supported.
Error Code: 2190995
Here is the code
try
{
SetShippingDiscountProfilesRequestType discountProfile = new SetShippingDiscountProfilesRequestType();
CurrencyCodeType cct = CurrencyCodeType.fromValue(combineProfile.getCurrencyCode());
discountProfile.setCurrencyID(cct);
discountProfile.setCombinedDuration(CombinedPaymentPeriodCodeType.DAYS_7);
discountProfile.setModifyActionCode(ModifyActionCodeType.ADD);
CalculatedShippingDiscountType calcShippingDiscount = new CalculatedShippingDiscountType();
calcShippingDiscount.setDiscountName(DiscountNameCodeType.WEIGHT_OFF);
DiscountProfileType calcDiscountProfile = new DiscountProfileType();
calcDiscountProfile.setDiscountProfileName("Calc1");
MeasureType weight = new MeasureType();
weight.setValue(BigDecimal.valueOf(5.0));
calcDiscountProfile.setWeightOff(weight);
calcShippingDiscount.setDiscountProfile(new DiscountProfileType[] {calcDiscountProfile});
CalculatedHandlingDiscountType calcHandlingDiscount = new CalculatedHandlingDiscountType();
calcHandlingDiscount.setDiscountName(HandlingNameCodeType.COMBINED_HANDLING_FEE);
calcHandlingDiscount.setOrderHandlingAmount(this.MakeAmountType(10.0, cct));
discountProfile.setCalculatedShippingDiscount(calcShippingDiscount);
discountProfile.setCalculatedHandlingDiscount(calcHandlingDiscount);
if(this.eBay != null)
{
SiteCodeType siteCode = SiteCodeType.fromValue(combineProfile.getSite().getAbbreviation());
SetShippingDiscountProfilesResponseType response = this.eBay.uploadCombineShippingProfile(discountProfile, siteCode);
if(response.getAck() != AckCodeType.SUCCESS)
{
String errorMsg = response.getErrors()[0].getLongMessage();
}
}
}
catch(Exception e)
{
e.printStackTrace();
}