我想为澳大利亚邮政运输方法提供service_code参数值..?

时间:2017-12-07 08:33:06

标签: c# asp.net .net shipping

我整合澳大利亚邮政运费计算。

这是我的代码:

        [HttpPost]
        public virtual ActionResult Calculation()
        {
            var lngth = "10";
            var wdth = "10";
            var hgth = "10";
            var fpcode = "3216";
            var tpcode = "3217";
            var weght = "5";
            var service_code = "AUS_PARCEL_Courier";

            string url = "https://auspost.com.au/api/postage/parcel/domestic/calculate.json?";
            url = url + "length=" + HttpUtility.UrlEncode(lngth) + "&width=" + HttpUtility.UrlEncode(wdth) + "&height=" + HttpUtility.UrlEncode(hgth) + "&from_postcode=" + HttpUtility.UrlEncode(fpcode) + "&to_postcode=" + HttpUtility.UrlEncode(tpcode) + "&option_code=&weight=" + HttpUtility.UrlEncode(weght) + "&service_code=" + HttpUtility.UrlEncode(service_code) + "&extra_cover=";
            Uri objURI = new Uri(url);
            HttpWebRequest objwebreq = (HttpWebRequest)WebRequest.Create(objURI);
            objwebreq.ContentType = "text/xml;charset=utf-8;";

            objwebreq.Method = "Get";
            objwebreq.Timeout = 15000;

            objwebreq.Headers.Set("AUTH-KEY", "enter your auth key");

            HttpWebResponse objWebResponse = (HttpWebResponse)objwebreq.GetResponse();
            Stream objStream = objWebResponse.GetResponseStream();
            StreamReader objStreamReader = new StreamReader(objStream);
            var a = objStreamReader.ReadToEnd();
            return null;
        }

这是我的工作代码,但我想要service_code参数值对于以下发货方式:

1)澳大利亚邮报。快递

2)澳大利亚邮报。快递

3)澳大利亚邮报。标准

4)澳大利亚邮报。经济空气

谢谢,Kaushik。

1 个答案:

答案 0 :(得分:0)

AUS_LETTER_EXPRESS_SMALL => Express Post Small Envelope
AUS_LETTER_REGULAR_LARGE => Large Letter
AUS_PARCEL_COURIER => Courier Post
AUS_PARCEL_COURIER_SATCHEL_MEDIUM => Courier Post Assessed Medium Satchel
AUS_PARCEL_EXPRESS => Express Post
AUS_PARCEL_REGULAR => Parcel Post

INT_PARCEL_COR_OWN_PACKAGING => International Courier
INT_PARCEL_EXP_OWN_PACKAGING => International Express
INT_PARCEL_STD_OWN_PACKAGING => International Standard
INT_PARCEL_AIR_OWN_PACKAGING => International Economy Air
INT_PARCEL_SEA_OWN_PACKAGING => International Economy Sea

For Extra Cover
AUS_SERVICE_OPTION_SIGNATURE_ON_DELIVERY => Signature on Delivery
AUS_SERVICE_OPTION_COURIER_EXTRA_COVER_SERVICE => Standard cover

Below is a postman example for "Parcel Post = AUS_PARCEL_REGULAR"

https://i.stack.imgur.com/ykg7R.jpg