예제 #1
0
 private string DoRequest(IntlRateV2Request request)
 {
     return(_request.GetResponse(_apiUrl, string.Format("API=IntlRateV2&XML={0}", request.ToXmlString())));
 }
예제 #2
0
        private List <ShippingOption> DoInternationalRequest(GetShippingOptionRequest shipmentPackage, decimal minimumShippingRate, string password,
                                                             string username)
        {
            IRateResponse     response;
            IntlRateV2Request internationalRequest = CreateInternationalRequest(shipmentPackage, username, password);

            try {
                response = _rateService.Get(internationalRequest);
            } catch (Exception e) {
                throw new Exception("Unhandled exception with international request:\n\n" + internationalRequest.ToXmlString(), e);
            }

            return(response.Error == null
                ? InterpretShippingOptions((IntlRateV2Response)response, minimumShippingRate)
                : new List <ShippingOption>
            {
                new ShippingOption {
                    Name = response.Error.Description
                }
            });
        }