Esempio n. 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ApiContext">The <see cref="ApiCall.ApiContext"/> for this API Call of type <see cref="ApiContext"/>.</param>
 public GetItemShippingCall(ApiContext ApiContext)
 {
     ApiRequest = new GetItemShippingRequestType();
     this.ApiContext = ApiContext;
 }
Esempio n. 2
0
 /// <summary>
 /// 
 /// </summary>
 public GetItemShippingCall()
 {
     ApiRequest = new GetItemShippingRequestType();
 }
Esempio n. 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ApiContext">The <see cref="ApiCall.ApiContext"/> for this API Call of type <see cref="ApiContext"/>.</param>
 public GetItemShippingCall(ApiContext ApiContext)
 {
     ApiRequest      = new GetItemShippingRequestType();
     this.ApiContext = ApiContext;
 }
    public GetItemShippingResponseType GetShippingCost(string userToken, string itemID)
    {
        string callname = "GetItemShipping";

        #region Initialise Needed Variables

        //Get the Server to use (Sandbox or Production)
        string serverUrl = ConfigurationManager.AppSettings["TradingService"];

        //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
        string siteID = "15";

        eBayAPIInterfaceService service = new eBayAPIInterfaceService();
        string requestURL = serverUrl + "?callname=" + callname + "&siteid=" + siteID
                            + "&appid=" + AppID + "&version=" + version + "&routing=default";
        service.Url = requestURL;

        // Set credentials
        service.RequesterCredentials = new CustomSecurityHeaderType();
        service.RequesterCredentials.Credentials = new UserIdPasswordType();
        service.RequesterCredentials.Credentials.AppId = AppID;
        service.RequesterCredentials.Credentials.DevId = DevID;
        service.RequesterCredentials.Credentials.AuthCert = CertID;
        service.RequesterCredentials.eBayAuthToken = userToken;

        #endregion

        GetItemShippingRequestType request = new GetItemShippingRequestType();
        request.DestinationCountryCode = CountryCodeType.AU;
        request.DestinationPostalCode = "3025";
        request.ItemID = itemID;
        request.QuantitySold = 1;
        request.Version = "505";
        request.DestinationCountryCodeSpecified = true;
        request.QuantitySoldSpecified = true;

        try
        {
            GetItemShippingResponseType response = service.GetItemShipping(request);
            return response;
        }
        catch (Exception ex)
        {
            if (ex.Message.ToLower().Contains("auth token"))
                throw new InvalidEbayCredentialsException();
            else
                throw ex;
        }
    }
Esempio n. 5
0
 /// <summary>
 ///
 /// </summary>
 public GetItemShippingCall()
 {
     ApiRequest = new GetItemShippingRequestType();
 }