public static void PaytmShipped() { string paytmShipmentUrl = "https://fulfillment.paytm.com/v1/merchant/{0}/fulfillment/create/{1}?authtoken={2}"; string paymDownloadPackingLabelUrl = "https://fulfillment.paytm.com/v2/invoice/merchant/{0}/fulfillment/bulkfetch?fulfillment_ids={1}&template=shared&authtoken={2}&ffUpdate=true"; string paytmShippedUrl = "https://fulfillment.paytm.com/v1/merchant/{0}/fulfillment/bulkmarkshipped?fulfillment_ids={1}&authtoken={2}"; string weigth = "0.030000"; string token = "4162fcb7-0dfd-40f9-822e-18223735b8ca"; string merchantID = "572305"; string orderId = "6962500622"; string[] itemIdList = new string[] { "7449585824" }; string trackingNum = "682390067"; paytmShipmentUrl = String.Format(paytmShipmentUrl, merchantID, orderId, token); using (System.Net.Http.HttpClient client = new System.Net.Http.HttpClient()) { try { CreateShipmentRequstParameter parameter = new CreateShipmentRequstParameter() { order_item_ids = itemIdList, tracking_url = "https://www.17track.net", shipper_id = "159", shipping_description = "shipping_description", tracking_number = trackingNum, weight = weigth }; string json = JsonConvert.SerializeObject(parameter); HttpContent contentPost = new StringContent(json, Encoding.UTF8, "application/json"); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; HttpResponseMessage response = client.PostAsync(paytmShipmentUrl, contentPost).Result; string result = response.Content.ReadAsStringAsync().Result; if (!string.IsNullOrEmpty(result)) { CreateShipmentRequstResponse shipmentRequstResponse = JsonConvert.DeserializeObject <CreateShipmentRequstResponse>(result); if (shipmentRequstResponse.res == "success") { if (shipmentRequstResponse.fulfillment_details.status == "15") { } //下载标签 paymDownloadPackingLabelUrl = String.Format(paymDownloadPackingLabelUrl, merchantID, shipmentRequstResponse.fulfillment_id, token); contentPost = new StringContent("", Encoding.UTF8, "application/json"); response = client.GetAsync(paymDownloadPackingLabelUrl).Result; result = response.Content.ReadAsStringAsync().Result; //标识发货 paytmShippedUrl = String.Format(paytmShippedUrl, merchantID, shipmentRequstResponse.fulfillment_id, token); contentPost = new StringContent("", Encoding.UTF8, "application/json"); response = client.PostAsync(paytmShippedUrl, contentPost).Result; result = response.Content.ReadAsStringAsync().Result; if (!string.IsNullOrEmpty(result)) { BulkmarkShippedResponse bulkmarkShippedResponse = JsonConvert.DeserializeObject <BulkmarkShippedResponse>(result); if (bulkmarkShippedResponse.changedRows > 0) { //bulkmarkShippedResponse.success.ForEach(p => //{ // if (p.message == "Successful") // { // string msg = p.message; // } // else // { // string msg = p.message; // } //}); } } } } } catch (Exception ex) { string errorMsg = ex.Message; } } }
static void Main(string[] args) { CreateOrder(); SyncProductsPushed(); SignExtension.Validate("", ""); UpLoadOrder(); string result = "{\"changedRows\":1,\"success\":[{\"ffid\":5081368743,\"item_id\":7449585824,\"message\":\"Successful\"}],\"error\":[]}"; BulkmarkShippedResponse bulkmarkShippedResponse = JsonConvert.DeserializeObject <BulkmarkShippedResponse>(result); bulkmarkShippedResponse.success.ForEach(p => { if (p.message == "Successful") { string msg = p.message; } else { string msg = p.message; } }); DataTable dataTable = DataTableHelper.InitBatchData(); string dataTableJson = JsonConvert.SerializeObject(dataTable); Test test = new Test(); List <string> list = new List <string>(); string str1 = "0"; test.ListTest(list, str1); string zp = nameof(result); //ShopeeTest.ConvertJsonToModel(ShopeeTest.jsonResult); //ShopeeTest.GetEscrowDetails(); ShopeeTest.GetOrderDetails(); // ParameterToJson(); // PaytmShipped(); // PaytmShipped1(); //CreateOrderPreview(); //GetSubaccountAuthInfo(); // SubaccountAuthCancel(new List<string>() { "深圳傲基2018:fz006" }); // LoadProduct(); // GetSubaccountAuthInfo(); // GetSubaccountAuth(); //GetMessage(); // ConvertStringToDateTime(); // GetTime("21000101000000000+0800"); // GetSubaccountAuth(); //GetSubAccounts(); // GetProductId(); //ResultModel<SyncProductPushedResponse> resultModel = SyncProductsPushed(); //UpLoadOrder(); // LoadProduct(); // CreateOrderPreview(); // CreateOrder(); //CancelOrder(); // RefeshToken(); //UpLoadOrder(); // GetReceiveAddress(); // ResultModel<SubAccountResponse> resultModel = GetSubAccounts(); // ResultModel<ReceiveAddressItems> result = GetReceiveAddress(); }