You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1427 lines
59 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NetLibrary.OnlineTrade;
using System.Web.Script.Serialization;
using System.Xml;
using System.Xml.Linq;
using System.Net;
using System.Text;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Security;
using Org.BouncyCastle.Crypto.Parameters;
using System.IO;
using NetLibrary.Log;
using TradeData;
using TradeModel;
using NetLibrary.Data;
using System.Data.Common;
using System.Data;
namespace TradeManageNew
{
public class WalmartApi
{
//public string Url = "http://api-gateway.walmart.com/v3/orders";
public string NAME = "";
public string TIMESTAMP = "";
public string AUTH_SIGNATURE = "";
public static string ConsumerId = "1db5f62b-2fd1-4a89-b26c-8f02470984a7";
public static string PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALjEQj9vLHgRk+U296zqmBQgFthoJIdt2PaBGMsMtdjNORovoLb0Fs5Xtvg3Mq9Z8gOeXtgNtTLM5mpkSrZLWe3R95Ri6GO4/HiYDtE5i6+j82H8s5GqJlWEhBrp84jRt7yKL1fxixqDSnFhNWUeYA6vRXNYGAuw5OKXN4LKv0O1AgMBAAECgYAo6cyBn2yJadsF9pYBhDEIw9JLOURdeMWCUDPdQoNB7q+mTMWZvZMPPf0WGaLvkUs14eu+i8qD5Ttgc7TXiPfwgL1FhuFKrK2kaoxKrNbNRU0MmV9QcK3pxpW/yqUGlytvKzlvsjU7AKgdG0AjlzGfghI+dfUSXKcUKeysoWnIQQJBAO8mG7IXQ99lmPKQmZmXOn2C3n9phZJsym2TgTr6+3clJuZ8vIHkax5qOTpagBNozZeePi5CxTU/B5XWREFQ7DcCQQDFySz5hFNBT3H9QpIQ1BpVrOGluRSPbW8RTaFMGUVyhy7IhUExeCnJTTT82Ti90eEQAGOXAFAMjrJYA/yGNpFzAkEAj+ajZa9AJQ2SUesWsefgxyNXVN2fBTO3PuYyLdZWOCQ/2xMVrydOGZgbZXSNeqBmjaQnkFiXJ+oMW2n52j+iUwJAM4NTCGWzfWYgrTKicmmbtkbBunT66uQ4skwCv5wxX0PgJm+2bBj84SYPr+8vfRjlwlInnhOBxdOAlbXsFlSuCwJAPBDdFunkCSFrjIXrcId5RxKNuMmAB/plwszvbyumybJDl1ntwuyIrg6UUdY0UtQGxN2b1xUOBJWey95Rogo+Mw==";
public static string ChannelType = "0f3e4dd4-0514-4346-b39d-af0e00ea066d";
public static string ClientID = "bec89fab-b0c1-433d-95f4-606f14c7a6ab";// "f0205135-5435-4f92-9622-5872f60d0f5e";
public static string ClientSecret = "AKWVDtfuqPZqRVTNkK16795PTLhPlWH8M10kII0ZA-_dK2_g3Aa0ToC2EOystiWoZMVTQ4X8o9fzLWcXSDTvoSw";// "AOMXEInq-BnSoTn4WvvkLQKiIBzkCHckxb6-Dd8jyVaNEkGe8aUPd2QWPZSReWkgidPFUwVUhjIwcB_jWAIu7_g";
public static string ACCESS_TOKEN = "";
public static DateTime? GetTokenTime = null;
public static Int32? ShopId = 0;
public string Accept = "";
public string Host = "";
JavaScriptSerializer JsonConvert = null;
// WM_SVC.NAME: Walmart Marketplace
//WM_QOS.CORRELATION_ID: 123456abcdef
//WM_SEC.TIMESTAMP: 1438147839
//WM_SEC.AUTH_SIGNATURE: 7QzL9PeRt0WSGbXNGGj4kSQ9L6PMBX/q+ovdy9bDQfvdhYs8NoEsjRX4fD7UNIHTddgkmSVqAqeIIHlaLcRIl0Y4DcJqQYHL27LiWlsm91nYodGssWTKsOq6dJfUHEy95M4zXFGWDDhbHYCor28SCV/g/JdEQybGkcX9Zj5aDyg=
//WM_CONSUMER.ID: a20ac266-9add-4fc7-9392-fec303f5155c
//WM_CONSUMER.CHANNEL.TYPE: 0f3e4dd4-0514-4346-b39d-af0e00ea
//Accept: application/xml
//Host: marketplace.walmartapis.com
public WalmartApi()
{
}
public static string GetCurrentTimestamp()
{
TimeSpan t = DateTime.UtcNow- new DateTime(1970, 1, 1);
return ((long)t.TotalMilliseconds).ToString();
}
public static string GetCurrentTimestamp2()
{
TimeSpan t = DateTime.UtcNow.AddHours(-15) - new DateTime(1970, 1, 1);
return ((long)t.TotalMilliseconds).ToString();
}
private string GetSignature(string Url, string Method, string timestamp)
{
var requestUri = Url;
var httpMethod = Method;// "GET";
// Construct the string to sign
string stringToSign = string.Join("\n", new List<string>() {
ConsumerId,
requestUri,
httpMethod,
timestamp
}) + "\n"; // extra newline symbol required for valid signature
try
{
return SignData(stringToSign, PrivateKey);
}
catch (System.Exception ex)
{
//pop up this to the user of SDK
return "";
// throw Base.Exception.SignatureException.Factory(creds.ConsumerId, requestUri, httpMethod, ex);
}
}
internal static string SignData(string stringToBeSigned, string privateKey)
{
byte[] encodedKeyBytes = Convert.FromBase64String(privateKey);
byte[] data = Encoding.UTF8.GetBytes(stringToBeSigned);
AsymmetricKeyParameter asymmetricKeyParameter = PrivateKeyFactory.CreateKey(encodedKeyBytes);
RsaKeyParameters rsaKeyParameters = (RsaKeyParameters)asymmetricKeyParameter;
ISigner signer = SignerUtilities.GetSigner("SHA-256withRSA");
signer.Init(true, rsaKeyParameters);
var stringToSignInBytes = Encoding.UTF8.GetBytes(stringToBeSigned);
signer.BlockUpdate(stringToSignInBytes, 0, stringToSignInBytes.Length);
var signature = signer.GenerateSignature();
return Convert.ToBase64String(signature);
}
public static DateTime GetTime(string utc)
{
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
startTime = startTime.AddMilliseconds(Convert.ToInt64(utc));
//startTime = startTime.AddHours(8);//转化为北京时间(北京时间=UTC时间+8小时 )
return startTime;
}
#region Walmart数据导入
public string ImportWalmart(DateTime? StartDate, DateTime? StopDate, List<int> ListModel)
{
string error = "";
if (StartDate == null)
StartDate = DateTime.Today.AddDays(-2);
WalmartApi obj = new WalmartApi();
foreach (int ShopId in ListModel)
{
JC_Shop ShopModel = JC_ShopService.GetModel(ShopId);
WalmartApi.ShopId = ShopModel.ShopId;
WalmartApi.ACCESS_TOKEN = ShopModel.AccessToken;
WalmartApi.ClientID = ShopModel.Appkey;
WalmartApi.ClientSecret = ShopModel.DeveKey;
WalmartApi.GetTokenTime = ShopModel.AccessTokenUpdateTime;
//var list= GetWalmartOrder(StartDate, StopDate, out error);
List<OrderModel> ListOrderModel = obj.GetWalmartOrder(StartDate, StopDate, out error);
if (ListOrderModel == null) ListOrderModel = new List<OrderModel>();
if (string.IsNullOrEmpty(error) == false) return "导入订单失败:" + error;
error = "导入订单:" + ListOrderModel.Count.ToString() + "条;";
API_OrderInfoService.SaveOrderModel(ShopModel.CompanyId, ShopId, ShopModel.ShopName, 6, 0, ListOrderModel);
}
return error;
}
#endregion
#region Walmart数据导入
public string ImportWalmartFBA(DateTime? StartDate, DateTime? StopDate, List<int> ListModel)
{
string error = "";
if (StartDate == null)
StartDate = DateTime.Today.AddDays(-2);
WalmartApi obj = new WalmartApi();
foreach (int ShopId in ListModel)
{
JC_Shop ShopModel = JC_ShopService.GetModel(ShopId);
WalmartApi.ShopId = ShopModel.ShopId;
WalmartApi.ACCESS_TOKEN = ShopModel.AccessToken;
WalmartApi.ClientID = ShopModel.Appkey;
WalmartApi.ClientSecret = ShopModel.DeveKey;
WalmartApi.GetTokenTime = ShopModel.AccessTokenUpdateTime;
//var list= GetWalmartOrder(StartDate, StopDate, out error);
List<OrderModel> ListOrderModel = obj.GetWalmartOrderFBA(StartDate, StopDate, out error);
if (ListOrderModel == null) ListOrderModel = new List<OrderModel>();
if (string.IsNullOrEmpty(error) == false) return "导入订单失败:" + error;
error = "导入订单:" + ListOrderModel.Count.ToString() + "条;";
API_OrderInfoService.SaveOrderModel(ShopModel.CompanyId, ShopId, ShopModel.ShopName, 6, 0, ListOrderModel);
}
return error;
}
#endregion
#region 读取订单
public List<OrderModel> GetWalmartOrder(DateTime? StartTime, DateTime? StopTime, out string ErrorMessage)
{
try
{
if (GetTokenTime == null || GetTokenTime.Value< DateTime.Now)//过期
{
string error = "";
GetToken(out error);
}
// string json =File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "yy.txt");
//
// var m2 = jsonconvert.Deserialize<WalmartList>(json);
// int a = 0;
JavaScriptSerializer jsonconvert = new JavaScriptSerializer();
string Url = "https://marketplace.walmartapis.com/v3/orders?createdStartDate=" + StartTime.Value.ToString("yyyy-MM-dd") + "&limit=50";// "https://marketplace.walmartapis.com/v3/ https://marketplace.walmartapis.com/v3/feeds?&limit=10&offset=0";// "https://api-gateway.walmart.com/v3/feeds";
string BaseUrl = Url;
string jsonContent = GetWalmartOrderList(BaseUrl,"GET",Url, out ErrorMessage);
// ErrorFollow.TraceWrite("GetWalmartOrder22", jsonContent, ErrorMessage);
List<WalmartOrder> list = new List<WalmartOrder>();
if (jsonContent != "")
{
var wmd = jsonconvert.Deserialize<WalmartList>(jsonContent);
if (wmd.list.elements.order != null)
{
foreach (var md in wmd.list.elements.order)
{
if (md.customerOrderId == "6863320780341" || md.purchaseOrderId == "6863320780341")
{
string a = "";
}
if (md.orderLines.orderLine[0].orderLineStatuses.orderLineStatus[0].status != "Canceled" && md.orderLines.orderLine[0].orderLineStatuses.orderLineStatus[0].status != "Shipped")
list.Add(md);
}
}
int Next = 0;
string nextCursor = wmd.list.meta.nextCursor;
if (nextCursor != null && nextCursor != "")
{
Next = 1;
}
while (Next == 1)
{
Url = "https://marketplace.walmartapis.com/v3/orders" + nextCursor;
jsonContent = GetWalmartOrderList(Url,"GET", Url, out ErrorMessage);
if (jsonContent != "")
{
wmd = jsonconvert.Deserialize<WalmartList>(jsonContent);
if (wmd != null && wmd.list.elements.order != null)
{
foreach (var md in wmd.list.elements.order)
{
if (md.customerOrderId == "6863320780341" || md.purchaseOrderId == "6863320780341")
{
string a = "";
}
if (md.orderLines.orderLine[0].orderLineStatuses.orderLineStatus[0].status != "Canceled" && md.orderLines.orderLine[0].orderLineStatuses.orderLineStatus[0].status != "Shipped")
list.Add(md);
}
}
if (wmd == null || wmd.list == null || wmd.list.meta == null || wmd.list.meta.nextCursor == null || wmd.list.meta.nextCursor == "")
{
Next = 0;
}
else
nextCursor = wmd.list.meta.nextCursor;
}
else
Next = 0;
}
}
List<OrderModel> olsit = new List<OrderModel>();
if (list != null)
{
int Num = list.Count;
foreach(var ordermd in list)
{
OrderModel model = new OrderModel();
model.OrderCode = ordermd.purchaseOrderId.ToString();
//if (model.OrderCode == "17101714399VXNA")
//{
// string a = "1";
//}
decimal TotalPrice = 0;
string MoneyCode = "USD";
if (ordermd.orderLines != null && ordermd.orderLines.orderLine!=null)
{
foreach (var orderLine in ordermd.orderLines.orderLine)
{
if (orderLine.charges != null && orderLine.charges.charge != null)
{
foreach (var charge in orderLine.charges.charge)
{
if (charge.chargeAmount != null && charge.chargeAmount.amount != null)
{
TotalPrice += charge.chargeAmount.amount.Value;
}
if (charge.chargeAmount != null && charge.chargeAmount.currency != null)
MoneyCode = charge.chargeAmount.currency;
}
}
}
}
model.TotalPrice = TotalPrice;
model.MoneyCode = MoneyCode;
if (ordermd.orderDate != null)
model.OrderDate = GetTime(ordermd.orderDate);
else
model.OrderDate = DateTime.Now;
model.BuyerID = "";
model.OrderState = 2;
if (ordermd.shippingInfo != null && ordermd.shippingInfo.postalAddress != null)
{
model.BuyerName = ordermd.shippingInfo.postalAddress.name;
model.BuyerZip = ordermd.shippingInfo.postalAddress.postalCode;
// model.BuyerCountry = ordermd.shippingInfo.postalAddress.country;
// if (model.BuyerCountryordermd.shippingInfo.postalAddress.country == null || ordermd.shippingInfo.postalAddress.country == "")
model.BuyerCountry = "US";
model.BuyerProvince = ordermd.shippingInfo.postalAddress.state;
model.BuyerCity = ordermd.shippingInfo.postalAddress.city;
model.BuyerAddr = ordermd.shippingInfo.postalAddress.address1;
if(ordermd.shippingInfo.postalAddress.address2!=null)
model.BuyerAddr +=" "+ordermd.shippingInfo.postalAddress.address2;
model.BuyerFax = ordermd.shippingInfo.postalAddress.addressType;
}
model.BuyerPhone = "";
model.BuyerPhone = ordermd.shippingInfo.phone;
model.BuyerMobile = "";
model.BuyerMail = ordermd.customerEmailId;
//model.logisticsAmount =ordermd.buyerInfo.logisticsAmount;
model.OrderRemark = ""; //memo
model.LeaveWord ="";
model.PayDate = model.OrderDate;
model.OutOrderDate = model.OrderDate.Value.AddDays(7);
if (ordermd.orderLines != null && ordermd.orderLines.orderLine != null && ordermd.orderLines.orderLine[0].fulfillment != null)
{
if(ordermd.orderLines.orderLine[0].fulfillment.pickUpDateTime!=null)
model.OutOrderDate = GetTime(ordermd.orderLines.orderLine[0].fulfillment.pickUpDateTime);
model.PostInfo = ordermd.orderLines.orderLine[0].fulfillment.fulfillmentOption;
}
if (model.OrderDate != null && model.OrderDate.Value <= Convert.ToDateTime("1753-01-01"))
{
model.OrderDate = DateTime.Now;
}
if (model.PayDate != null && model.PayDate.Value <= Convert.ToDateTime("1753-01-01"))
{
model.PayDate = DateTime.Now;
}
if (model.OutOrderDate != null && model.OutOrderDate.Value <= Convert.ToDateTime("1753-01-01"))
{
model.OutOrderDate = DateTime.Now.AddDays(7);
}
model.ListModel = new List<OrderDetailModel>();
if (ordermd.orderLines!=null&&ordermd.orderLines.orderLine != null)
{
foreach (var item2 in ordermd.orderLines.orderLine)
{
OrderDetailModel model2 = new OrderDetailModel();
// {"item_name":"Adjustable Kids Safety Harness Wrist Leash Anti-lost Link","item_sku":"\tZHI049","variation_discounted_price":"7.74","variation_id":320874188,"variation_name":"Blue, 250CM","item_id":418147192,
// "variation_quantity_purchased":1,"variation_sku":"\tZHI049","variation_original_price":"8.60"
model2.TypeDesc = "";
model2.productImgUrl = "";
model2.GoodsNum = 1;
if (item2.orderLineQuantity != null && item2.orderLineQuantity .amount!= null)
model2.GoodsNum = Convert.ToInt32(item2.orderLineQuantity.amount);
// if (item2. != null)
// model2.GoodsPrice = Convert.ToDecimal(item2.variation_original_price);
model2.MoneyCode = "";
model2.GoodsName = item2.item.productName;
model2.GoodsSKU = item2.item.sku;
model2.PostInfo = "";
model.ListModel.Add(model2);
}
}
olsit.Add(model);
}
}
return olsit;
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
ErrorFollow.TraceWrite("GetWalmartOrder", "", ex.Message);
return null;
}
}
#endregion
#region 读取订单
public List<OrderModel> GetWalmartOrderFBA(DateTime? StartTime, DateTime? StopTime, out string ErrorMessage)
{
try
{
if (GetTokenTime == null || GetTokenTime.Value < DateTime.Now)//过期
{
string error = "";
GetToken(out error);
}
// string json =File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "yy.txt");
//
// var m2 = jsonconvert.Deserialize<WalmartList>(json);
// int a = 0;
JavaScriptSerializer jsonconvert = new JavaScriptSerializer();
string Url = "https://marketplace.walmartapis.com/v3/orders?shipNodeType=WFSFulfilled&createdStartDate=" + StartTime.Value.ToString("yyyy-MM-dd") + "&limit=50";// "https://marketplace.walmartapis.com/v3/ https://marketplace.walmartapis.com/v3/feeds?&limit=10&offset=0";// "https://api-gateway.walmart.com/v3/feeds";
string BaseUrl = Url;
string jsonContent = GetWalmartOrderList(BaseUrl, "GET", Url, out ErrorMessage);
// ErrorFollow.TraceWrite("GetWalmartOrder22", jsonContent, ErrorMessage);
List<WalmartOrder> list = new List<WalmartOrder>();
if (jsonContent != "")
{
var wmd = jsonconvert.Deserialize<WalmartList>(jsonContent);
if (wmd.list.elements.order != null)
{
foreach (var md in wmd.list.elements.order)
{
if (md.customerOrderId == "6863320780341" || md.purchaseOrderId == "6863320780341")
{
string a = "";
}
if (md.orderLines.orderLine[0].orderLineStatuses.orderLineStatus[0].status != "Canceled")
list.Add(md);
}
}
int Next = 0;
string nextCursor = wmd.list.meta.nextCursor;
if (nextCursor != null && nextCursor != "")
{
Next = 1;
}
while (Next == 1)
{
Url = "https://marketplace.walmartapis.com/v3/orders" + nextCursor;
jsonContent = GetWalmartOrderList(Url, "GET", Url, out ErrorMessage);
if (jsonContent != "")
{
wmd = jsonconvert.Deserialize<WalmartList>(jsonContent);
if (wmd != null && wmd.list.elements.order != null)
{
foreach (var md in wmd.list.elements.order)
{
if (md.orderLines.orderLine[0].orderLineStatuses.orderLineStatus[0].status != "Canceled")
list.Add(md);
}
}
if (wmd == null || wmd.list == null || wmd.list.meta == null || wmd.list.meta.nextCursor == null || wmd.list.meta.nextCursor == "")
{
Next = 0;
}
else
nextCursor = wmd.list.meta.nextCursor;
}
else
Next = 0;
}
}
List<OrderModel> olsit = new List<OrderModel>();
if (list != null)
{
int Num = list.Count;
foreach (var ordermd in list)
{
OrderModel model = new OrderModel();
model.OrderCode = ordermd.purchaseOrderId.ToString();
//if (model.OrderCode == "17101714399VXNA")
//{
// string a = "1";
//}
decimal TotalPrice = 0;
string MoneyCode = "USD";
if (ordermd.orderLines != null && ordermd.orderLines.orderLine != null)
{
foreach (var orderLine in ordermd.orderLines.orderLine)
{
if (orderLine.charges != null && orderLine.charges.charge != null)
{
foreach (var charge in orderLine.charges.charge)
{
if (charge.chargeAmount != null && charge.chargeAmount.amount != null)
{
TotalPrice += charge.chargeAmount.amount.Value;
}
if (charge.chargeAmount != null && charge.chargeAmount.currency != null)
MoneyCode = charge.chargeAmount.currency;
}
}
}
}
model.TotalPrice = TotalPrice;
model.MoneyCode = MoneyCode;
if (ordermd.orderDate != null)
model.OrderDate = GetTime(ordermd.orderDate);
else
model.OrderDate = DateTime.Now;
model.BuyerID = "";
model.OrderState = 2;
if (ordermd.shippingInfo != null && ordermd.shippingInfo.postalAddress != null)
{
model.BuyerName = ordermd.shippingInfo.postalAddress.name;
model.BuyerZip = ordermd.shippingInfo.postalAddress.postalCode;
// model.BuyerCountry = ordermd.shippingInfo.postalAddress.country;
// if (model.BuyerCountryordermd.shippingInfo.postalAddress.country == null || ordermd.shippingInfo.postalAddress.country == "")
model.BuyerCountry = "US";
model.BuyerProvince = ordermd.shippingInfo.postalAddress.state;
model.BuyerCity = ordermd.shippingInfo.postalAddress.city;
model.BuyerAddr = ordermd.shippingInfo.postalAddress.address1;
if (ordermd.shippingInfo.postalAddress.address2 != null)
model.BuyerAddr += " " + ordermd.shippingInfo.postalAddress.address2;
model.BuyerFax = ordermd.shippingInfo.postalAddress.addressType;
}
model.BuyerPhone = "";
model.BuyerPhone = ordermd.shippingInfo.phone;
model.BuyerMobile = "";
model.BuyerMail = ordermd.customerEmailId;
//model.logisticsAmount =ordermd.buyerInfo.logisticsAmount;
model.OrderRemark = ""; //memo
model.LeaveWord = "";
model.PayDate = model.OrderDate;
model.OutOrderDate = model.OrderDate.Value.AddDays(7);
if (ordermd.orderLines != null && ordermd.orderLines.orderLine != null && ordermd.orderLines.orderLine[0].fulfillment != null)
{
if (ordermd.orderLines.orderLine[0].fulfillment.pickUpDateTime != null)
model.OutOrderDate = GetTime(ordermd.orderLines.orderLine[0].fulfillment.pickUpDateTime);
model.PostInfo = ordermd.orderLines.orderLine[0].fulfillment.fulfillmentOption;
}
if (model.OrderDate != null && model.OrderDate.Value <= Convert.ToDateTime("1753-01-01"))
{
model.OrderDate = DateTime.Now;
}
if (model.PayDate != null && model.PayDate.Value <= Convert.ToDateTime("1753-01-01"))
{
model.PayDate = DateTime.Now;
}
if (model.OutOrderDate != null && model.OutOrderDate.Value <= Convert.ToDateTime("1753-01-01"))
{
model.OutOrderDate = DateTime.Now.AddDays(7);
}
model.ListModel = new List<OrderDetailModel>();
if (ordermd.orderLines != null && ordermd.orderLines.orderLine != null)
{
foreach (var item2 in ordermd.orderLines.orderLine)
{
OrderDetailModel model2 = new OrderDetailModel();
// {"item_name":"Adjustable Kids Safety Harness Wrist Leash Anti-lost Link","item_sku":"\tZHI049","variation_discounted_price":"7.74","variation_id":320874188,"variation_name":"Blue, 250CM","item_id":418147192,
// "variation_quantity_purchased":1,"variation_sku":"\tZHI049","variation_original_price":"8.60"
model2.TypeDesc = "";
model2.productImgUrl = "";
model2.GoodsNum = 1;
if (item2.orderLineQuantity != null && item2.orderLineQuantity.amount != null)
model2.GoodsNum = Convert.ToInt32(item2.orderLineQuantity.amount);
// if (item2. != null)
// model2.GoodsPrice = Convert.ToDecimal(item2.variation_original_price);
model2.MoneyCode = "";
model2.GoodsName = item2.item.productName;
model2.GoodsSKU = item2.item.sku;
model2.PostInfo = "";
model.ListModel.Add(model2);
}
}
olsit.Add(model);
}
}
return olsit;
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
ErrorFollow.TraceWrite("GetWalmartOrder", "", ex.Message);
return null;
}
}
#endregion
#region 读取订单
public string GetWalmartOrderList(string BaseUrl,string Method, string Url, out string ErrorMessage)
{
try
{
ErrorMessage = "";
// string timestamp = GetCurrentTimestamp();
// string signature = GetSignature(BaseUrl,"GET",timestamp);
string CORRELATION_ID = Guid.NewGuid().ToString();
ErrorMessage = "";
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(Url);
myRequest.Method = Method;// "GET"; //GET,POST
myRequest.Accept = "application/json";
myRequest.ContentType = "application/json";
//myRequest.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; qihu theworld)";
//myRequest.Headers["Accept"]= "application/json";
myRequest.Headers.Add("WM_SVC.NAME", "Walmart Marketplace");//"Walmart Marketplace"
myRequest.Headers.Add("WM_QOS.CORRELATION_ID", CORRELATION_ID);
string au = Base64En(ClientID + ":" + ClientSecret);
myRequest.Headers.Add("Authorization", "Basic " + au);
//string token = "eyJraWQiOiI3ZWU0ZjdkNS0xYTk4LTRlODMtYjY2Yy02ZDUyOWU3MmJiZTYiLCJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiZGlyIn0..JS39U7jLKZGFqiye.og4QC0xStzUVmzguCK6pUL0CgZOCzhGpR996BlbnXulH4_e39IlE-1JYHx1JJgptUya-pZdLpV3dmtK9paSoAf75sZ3OJ84vibY3OigSzkuXHmEoHMQaTlcK6ayzi-MJVgIeXtk3qvCu5261NyGLgRzOO4LBLrmpNMxVy7t0GUxJyQqquxPQw3e0cPAo6YS3NW7YbBOfoG8t0gs3WPQAryh0CvbhY8Bms7fgL7MwweMlf9ibdlPrmqasu0bOLmo9wdoHAAsEGPqcWQBfkBgq0JH1DjYowbPmV-L4F1z49-0rZI5AF-tppdJn9IEaPGv4CCMITHuQaT_Q0jxnwukSIipzul6iRMggYdlyza38QxSrhaD2MphYVjsmNRY3oZtpAHkKGJIwvRqHVB2Iw7aDIAWsnDUo-OENqeiqStHfBa4mPR27s3qdfVN6ef06KUo0Az0RebuN_m5sZ1iAe1Ffgg3ySolGI2es3LTonfH1uwIXL1YoIzh8kB8JNVynLSqPq4vtopbHlXXjTHOJ_vxDh6_CI3OHKnYMIlvGlHDIqAKSBqsA-udo2GDh7Y7wHfY3hQDDWwrJsDE3PcctsnXr5yrBil2qfUCJjU2JrZyCWF3c3dgYEIs-IL0Jb-lYCrJ0u9mt9mfDmGB-szSRO6c_IpGMT9Wb1IBrBhQIRm4Ro8fcsLifYMf6wKty51mT.v91A2BpgtRQGp7s3x2Vl_w";
myRequest.Headers.Add("WM_SEC.ACCESS_TOKEN", ACCESS_TOKEN);
//myRequest.Headers.Add("WM_CONSUMER.ID", ConsumerId);
//myRequest.Headers.Add("WM_SEC.AUTH_SIGNATURE", signature);
//myRequest.Headers.Add("WM_SEC.TIMESTAMP", timestamp);
//myRequest.Headers.Add("WM_QOS.CORRELATION_ID", CORRELATION_ID);
//myRequest.Headers.Add("WM_CONSUMER.CHANNEL.TYPE", ChannelType);
myRequest.Headers["Pragma"] = "no-cache"; //禁用缓存
myRequest.Headers["Cache-Control"] = "no-cache"; //禁用缓存
myRequest.Timeout = 3 * 60 * 1000;
myRequest.ProtocolVersion = HttpVersion.Version11;
//获得接口返回值
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
Stream myResponseStream = myResponse.GetResponseStream();
StreamReader reader = new StreamReader(myResponseStream, Encoding.UTF8);
string content = reader.ReadToEnd();
reader.Close();
myResponseStream.Close();
myResponse.Close();
return content;
}
catch (WebException ex)
{
ErrorMessage = ex.Message;
ErrorFollow.TraceWrite("GetWalmartOrderList", Url, ex.Message);
return "";
}
}
#endregion
#region 读取订单
public string GetWalmartOrderList2(string BaseUrl, string Method, byte[] bytes, string Url, out string ErrorMessage)
{
try
{
ErrorMessage = "";
// string timestamp = GetCurrentTimestamp();
// string signature = GetSignature(BaseUrl,"POST", timestamp);
string CORRELATION_ID = Guid.NewGuid().ToString();
ErrorMessage = "";
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(Url);
myRequest.Method = Method;// "GET"; //GET,POST
myRequest.Accept = "application/json";
myRequest.ContentType = "application/json";
//myRequest.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; qihu theworld)";
//myRequest.Headers["Accept"]= "application/json";
myRequest.Headers.Add("WM_SVC.NAME", "Walmart Marketplace");
// myRequest.Headers.Add("WM_CONSUMER.ID", ConsumerId);
string au = Base64En(ClientID + ":" + ClientSecret);
myRequest.Headers.Add("Authorization", "Basic " + au);
// string token = "eyJraWQiOiI3ZWU0ZjdkNS0xYTk4LTRlODMtYjY2Yy02ZDUyOWU3MmJiZTYiLCJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiZGlyIn0..JS39U7jLKZGFqiye.og4QC0xStzUVmzguCK6pUL0CgZOCzhGpR996BlbnXulH4_e39IlE-1JYHx1JJgptUya-pZdLpV3dmtK9paSoAf75sZ3OJ84vibY3OigSzkuXHmEoHMQaTlcK6ayzi-MJVgIeXtk3qvCu5261NyGLgRzOO4LBLrmpNMxVy7t0GUxJyQqquxPQw3e0cPAo6YS3NW7YbBOfoG8t0gs3WPQAryh0CvbhY8Bms7fgL7MwweMlf9ibdlPrmqasu0bOLmo9wdoHAAsEGPqcWQBfkBgq0JH1DjYowbPmV-L4F1z49-0rZI5AF-tppdJn9IEaPGv4CCMITHuQaT_Q0jxnwukSIipzul6iRMggYdlyza38QxSrhaD2MphYVjsmNRY3oZtpAHkKGJIwvRqHVB2Iw7aDIAWsnDUo-OENqeiqStHfBa4mPR27s3qdfVN6ef06KUo0Az0RebuN_m5sZ1iAe1Ffgg3ySolGI2es3LTonfH1uwIXL1YoIzh8kB8JNVynLSqPq4vtopbHlXXjTHOJ_vxDh6_CI3OHKnYMIlvGlHDIqAKSBqsA-udo2GDh7Y7wHfY3hQDDWwrJsDE3PcctsnXr5yrBil2qfUCJjU2JrZyCWF3c3dgYEIs-IL0Jb-lYCrJ0u9mt9mfDmGB-szSRO6c_IpGMT9Wb1IBrBhQIRm4Ro8fcsLifYMf6wKty51mT.v91A2BpgtRQGp7s3x2Vl_w";
myRequest.Headers.Add("WM_SEC.ACCESS_TOKEN", ACCESS_TOKEN);
//myRequest.Headers.Add("WM_QOS.CORRELATION_ID", CORRELATION_ID);
//myRequest.Headers.Add("WM_CONSUMER.ID", ConsumerId);
//myRequest.Headers.Add("WM_SEC.AUTH_SIGNATURE", signature);
//myRequest.Headers.Add("WM_SEC.TIMESTAMP", timestamp);
//myRequest.Headers.Add("WM_QOS.CORRELATION_ID", CORRELATION_ID);
//myRequest.Headers.Add("WM_CONSUMER.CHANNEL.TYPE", ChannelType);
myRequest.Headers["Pragma"] = "no-cache"; //禁用缓存
myRequest.Headers["Cache-Control"] = "no-cache"; //禁用缓存
myRequest.Timeout = 3 * 60 * 1000;
myRequest.ProtocolVersion = HttpVersion.Version11;
if (bytes != null && bytes.Length > 0)
{
//myRequest.GetRequestStream().Write(bytes, 0, bytes.Length);
Stream stream = myRequest.GetRequestStream();
stream.Write(bytes, 0, bytes.Length);
stream.Close();
}
//获得接口返回值
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
Stream myResponseStream = myResponse.GetResponseStream();
StreamReader reader = new StreamReader(myResponseStream, Encoding.UTF8);
string content = reader.ReadToEnd();
reader.Close();
myResponseStream.Close();
myRequest.Abort();
myResponse.Close();
return content;
}
catch (WebException ex)
{
ErrorMessage = ex.Message;
ErrorFollow.TraceWrite("GetWalmartOrderList", Url, ex.Message);
return "";
}
}
#endregion
private string Base64En(string str)
{
byte[] inArray = System.Text.Encoding.UTF8.GetBytes(str);
return Convert.ToBase64String(inArray);
}
#region 读取订单
public string GetWalmartOrderList3(string BaseUrl, string Method, byte[] bytes, string Url, out string ErrorMessage)
{
try
{
ErrorMessage = "";
string timestamp = GetCurrentTimestamp();
//string signature = GetSignature(BaseUrl, "POST", timestamp);
string CORRELATION_ID = Guid.NewGuid().ToString();
ErrorMessage = "";
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(Url);
myRequest.Method = Method;// "GET"; //GET,POST
myRequest.Accept = "application/json";
myRequest.ContentType = "application/json";
//myRequest.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; qihu theworld)";
//myRequest.Headers["Accept"]= "application/json";
myRequest.Headers.Add("WM_SVC.NAME", "Walmart Marketplace");
// myRequest.Headers.Add("WM_CONSUMER.ID", ConsumerId);
string au = Base64En(ClientID + ":" + ClientSecret);
myRequest.Headers.Add("Authorization", "Basic " + au);
myRequest.Headers.Add("WM_SEC.ACCESS_TOKEN",ACCESS_TOKEN);
myRequest.Headers.Add("WM_QOS.CORRELATION_ID", CORRELATION_ID);
// myRequest.Headers.Add("WM_CONSUMER.CHANNEL.TYPE", ChannelType);
myRequest.Headers["Pragma"] = "no-cache"; //禁用缓存
myRequest.Headers["Cache-Control"] = "no-cache"; //禁用缓存
myRequest.Timeout = 3 * 60 * 1000;
myRequest.ProtocolVersion = HttpVersion.Version11;
if (bytes != null && bytes.Length > 0)
{
//myRequest.GetRequestStream().Write(bytes, 0, bytes.Length);
Stream stream = myRequest.GetRequestStream();
stream.Write(bytes, 0, bytes.Length);
stream.Close();
}
//获得接口返回值
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
Stream myResponseStream = myResponse.GetResponseStream();
StreamReader reader = new StreamReader(myResponseStream, Encoding.UTF8);
string content = reader.ReadToEnd();
reader.Close();
myResponseStream.Close();
myRequest.Abort();
myResponse.Close();
return content;
}
catch (WebException ex)
{
ErrorMessage = ex.Message;
ErrorFollow.TraceWrite("GetWalmartOrderList", Url, ex.Message);
return "";
}
}
#endregion
#region 确认订单
public int GetWalmartOrderSure(string orderid,out string ErrorMessage)
{
try
{
// string json =File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "yy.txt");
//
// var m2 = jsonconvert.Deserialize<WalmartList>(json);
// int a = 0;
JavaScriptSerializer jsonconvert = new JavaScriptSerializer();//https://marketplace.walmartapis.com/v3/orders/{purchaseOrderId}/acknowledge
string Url = "https://marketplace.walmartapis.com/v3/orders/" + orderid + "/acknowledge";// "https://marketplace.walmartapis.com/v3/feeds?&limit=10&offset=0";// "https://api-gateway.walmart.com/v3/feeds";
string BaseUrl = Url;// "https://marketplace.walmartapis.com/v3/orders/";
JavaScriptSerializer JsonConvert = new JavaScriptSerializer();
WalmartOrderSure md = new WalmartOrderSure();
md.purchaseOrderId = orderid;
string postmessage = JsonConvert.Serialize(md);
//UTF8Encoding encoding = new UTF8Encoding();
byte[] data = Encoding.UTF8.GetBytes(postmessage);
string jsonContent = GetWalmartOrderList2(BaseUrl, "POST", data, Url, out ErrorMessage);
return 1;
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
ErrorFollow.TraceWrite("GetWalmartOrderSure", "", ex.Message);
return 0;
}
}
#endregion
#region
public string GetToken(out string ErrorMessage)
{
try
{
string postmessage = "grant_type=client_credentials";
//UTF8Encoding encoding = new UTF8Encoding();
byte[] bytes = Encoding.UTF8.GetBytes(postmessage);
ErrorMessage = "";
string timestamp = GetCurrentTimestamp();
//string signature = GetSignature(BaseUrl, "POST", timestamp);
string CORRELATION_ID = Guid.NewGuid().ToString();
ErrorMessage = "";
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("https://marketplace.walmartapis.com/v3/token");
myRequest.Method = "POST";// "GET"; //GET,POST
myRequest.Accept = "application/json";
myRequest.ContentType = "application/x-www-form-urlencoded";
//myRequest.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; qihu theworld)";
//myRequest.Headers["Accept"]= "application/json";
myRequest.Headers.Add("WM_SVC.NAME", "Walmart Marketplace");
// myRequest.Headers.Add("WM_CONSUMER.ID", ConsumerId);
string au = Base64En(ClientID+":"+ClientSecret);
myRequest.Headers.Add("Authorization", "Basic " + au);
//myRequest.Headers.Add("WM_SEC.ACCESS_TOKEN", PrivateKey);
myRequest.Headers.Add("WM_QOS.CORRELATION_ID", CORRELATION_ID);
// myRequest.Headers.Add("ContentType", "application/x-www-form-urlencoded");
// myRequest.Headers.Add("Accept", "application/xml");
// myRequest.Headers.Add("WM_CONSUMER.CHANNEL.TYPE", ChannelType);
myRequest.Headers["Pragma"] = "no-cache"; //禁用缓存
myRequest.Headers["Cache-Control"] = "no-cache"; //禁用缓存
myRequest.Timeout = 3 * 60 * 1000;
myRequest.ProtocolVersion = HttpVersion.Version11;
if (bytes != null && bytes.Length > 0)
{
//myRequest.GetRequestStream().Write(bytes, 0, bytes.Length);
Stream stream = myRequest.GetRequestStream();
stream.Write(bytes, 0, bytes.Length);
stream.Close();
}
//获得接口返回值
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
Stream myResponseStream = myResponse.GetResponseStream();
StreamReader reader = new StreamReader(myResponseStream, Encoding.UTF8);
string content = reader.ReadToEnd();
reader.Close();
myResponseStream.Close();
myRequest.Abort();
myResponse.Close();
JavaScriptSerializer JsonConvert = new JavaScriptSerializer();
WToken wmd = JsonConvert.Deserialize<WToken>(content);
if (wmd != null)
{
ACCESS_TOKEN=wmd.access_token;
if(wmd.expires_in!=null)
GetTokenTime = DateTime.Now.AddSeconds(wmd.expires_in.Value);
UpdateShopToken(GetTokenTime.Value);
}
return "";
}
catch (WebException ex)
{
ErrorMessage = ex.Message;
//ErrorFollow.TraceWrite("GetWalmartOrderList", "", ex.Message);
return "";
}
}
#endregion
#region 订单发货
public int WalmartOrderPost(string orderid, string postmessage, out string ErrorMessage)
{
try
{
//GetToken(out ErrorMessage);
// string json =File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "yy.txt");
//
// var m2 = jsonconvert.Deserialize<WalmartList>(json);
// int a = 0;
JavaScriptSerializer jsonconvert = new JavaScriptSerializer();
string Url = "https://marketplace.walmartapis.com/v3/orders/" + orderid.Trim() + "/shipping";// "https://marketplace.walmartapis.com/v3/feeds?&limit=10&offset=0";// "https://api-gateway.walmart.com/v3/feeds";
string BaseUrl = Url;// "https://marketplace.walmartapis.com/v3/orders/";
JavaScriptSerializer JsonConvert = new JavaScriptSerializer();
// WalmartOrderSure md = new WalmartOrderSure();
// md.purchaseOrderId = orderid;
//string postmessage = JsonConvert.Serialize(md);
//UTF8Encoding encoding = new UTF8Encoding();
byte[] data = Encoding.UTF8.GetBytes(postmessage);
string jsonContent = GetWalmartOrderList3(BaseUrl, "POST", data, Url, out ErrorMessage);
return 1;
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
ErrorFollow.TraceWrite("GetWalmartOrderSure", "", ex.Message);
return 0;
}
}
#endregion
#region 修改tocken
public void UpdateShopToken(DateTime AccessTokenUpdateTime)
{
string tsql = @"
Update [JC_Shop] set [AccessToken]=@AccessToken,[AccessTokenUpdateTime]=@AccessTokenUpdateTime where ShopId=@ShopId
";
Database db = DatabaseFactory.CreateDatabase();
DbCommand cmd = db.GetSqlStringCommand(tsql);
db.AddInParameter(cmd, "@ShopId", DbType.Int32, ShopId);
db.AddInParameter(cmd, "@AccessToken", DbType.String, ACCESS_TOKEN);
db.AddInParameter(cmd, "@AccessTokenUpdateTime", DbType.String, AccessTokenUpdateTime);
db.ExecuteNonQuery(cmd);
}
#endregion
}
// "order": {
// "purchaseOrderId": "1577584045841",
// "customerOrderId": "2751700075054",
// "customerEmailId": "mgr@walmartlabs.com",
// "orderDate": 1483552509000,
// "shippingInfo": {
// "phone": "6502248603",
// "estimatedDeliveryDate": 1484636400000,
// "estimatedShipDate": 1484204400000,
// "methodCode": "Standard",
// "postalAddress": {
// "name": "Madhukara PGOMS",
// "address1": "860 W Cal Ave",
// "address2": "Seat # 860C.2.176",
// "city": "Sunnyvale",
// "state": "CA",
// "postalCode": "94086",
// "country": "USA",
// "addressType": "RESIDENTIAL"
// }
// },
// "orderLines": {
// "orderLine": [
// {
// "lineNumber": "1",
// "item": {
// "productName": "Ocean Spray Cran-Cherry Juice Drink, 64 oz",
// "sku": "FOOD_AND_BEVERAGE_LIMO_008"
// },
// "charges": {
// "charge": [
// {
// "chargeType": "PRODUCT",
// "chargeName": "ItemPrice",
// "chargeAmount": {
// "currency": "USD",
// "amount": 12
// },
// "tax": {
// "taxName": "Tax1",
// "taxAmount": {
// "currency": "USD",
// "amount": 1.03
// }
// }
// },
// {
// "chargeType": "SHIPPING",
// "chargeName": "Shipping",
// "chargeAmount": {
// "currency": "USD",
// "amount": 3
// },
// "tax": {
// "taxName": "Tax2",
// "taxAmount": {
// "currency": "USD",
// "amount": 0.24
// }
// }
// }
// ]
// },
// "orderLineQuantity": {
// "unitOfMeasurement": "EACH",
// "amount": "1"
// },
// "statusDate": 1486407115000,
// "orderLineStatuses": {
// "orderLineStatus": [
// {
// "status": "Shipped",
// "statusQuantity": {
// "unitOfMeasurement": "EACH",
// "amount": "1"
// },
// "cancellationReason": null,
// "trackingInfo": {
// "shipDateTime": 1485973673000,
// "carrierName": {
// "otherCarrier": null,
// "carrier": "FedEx"
// },
// "methodCode": "Standard",
// "trackingNumber": "12333635111",
// "trackingURL": "http://walmart.narvar.com/walmart/tracking/Fedex?&type=MP&seller_id=801&promise_date=01/17/2017&dzip=94086&tracking_numbers=12333635111"
// }
// }
// ]
// },
// "refund": {
// "refundId": null,
// "refundComments": null,
// "refundCharges": {
// "refundCharge": [
// {
// "refundReason": "TaxExemptCustomer",
// "charge": {
// "chargeType": "PRODUCT",
// "chargeName": "Tax Exempt",
// "chargeAmount": {
// "currency": "USD",
// "amount": -0.1
// },
// "tax": null
// }
// },
// {
// "refundReason": "TaxExemptCustomer",
// "charge": {
// "chargeType": "SHIPPING",
// "chargeName": "Tax Exempt",
// "chargeAmount": {
// "currency": "USD",
// "amount": -0.11
// },
// "tax": null
// }
// }
// ]
// }
// }
// }
// ]
// }
// }
//}
public class WToken
{
public string access_token { get; set; }
public Int32? expires_in { get; set; }
}
public class WalmartList
{
public Walmartmeta list { get; set; }
}
public class Walmartmeta
{
public WalmartCount meta { get; set; }
public Walmartelements elements { get; set; }
}
public class WalmartCount
{
public Int32? totalCount { get; set; }
public Int32? limit { get; set; }
public string nextCursor { get; set; }
}
public class Walmartelements
{
public List<WalmartOrder> order { get; set; }
}
#region 订单明细
public class WalmartOrderSure
{
public string purchaseOrderId { get; set; }
}
public class WalmartOrder
{
public string purchaseOrderId { get; set; }
public string customerOrderId { get; set; }
public string customerEmailId { get; set; }
public string orderDate { get; set; }
public WalmartshippingInfo shippingInfo { get; set; }
public WalmartorderLine orderLines { get; set; }
}
public class WalmartshippingInfo
{
public string phone { get; set; }
public string estimatedDeliveryDate { get; set; }
public string estimatedShipDate { get; set; }
public string methodCode { get; set; }
public WalmartpostalAddress postalAddress { get; set; }
}
#endregion
public class WalmartpostalAddress
{
public string name { get; set; }
public string address1 { get; set; }
public string address2 { get; set; }
public string city { get; set; }
public string state { get; set; }
public string postalCode { get; set; }
public string country { get; set; }
public string addressType { get; set; }
}
public class WalmartorderLine
{
public List<WalmartorderLineList> orderLine { get; set; }
}
public class WalmartorderLineList
{
public string lineNumber { get; set; }
public Walmartitem item { get; set; }
public Walmartcharges charges { get; set; }
public WalmartorderLineQuantity orderLineQuantity { get; set; }
public string statusDate { get; set; }
public orderLineStatuses orderLineStatuses { get; set; }
public Walmartfulfillment fulfillment { get; set; }
}
public class Walmartfulfillment
{
public string fulfillmentOption { get; set; }
public string pickUpDateTime { get; set; }
public string shipMethod { get; set; }
public string offerId { get; set; }
public string pickUpBy { get; set; }
}
public class Walmartitem
{
public string productName { get; set; }
public string sku { get; set; }
}
public class Walmartcharges
{
public List<WalmartchargesList> charge { get; set; }
}
public class WalmartchargesList
{
public string chargeType { get; set; }
public string chargeName { get; set; }
public WalmartchargeAmount chargeAmount { get; set; }
public Walmarttax tax { get; set; }
}
public class Walmartcharge
{
public string chargeType { get; set; }
public string chargeName { get; set; }
public WalmartchargeAmount chargeAmount { get; set; }
public Walmarttax tax { get; set; }
}
public class WalmartchargeAmount
{
public string currency { get; set; }
public Decimal? amount { get; set; }
}
public class Walmarttax
{
public string taxName { get; set; }
public WalmartchargeAmount taxAmount { get; set; }
}
public class WalmartorderLineQuantity
{
public string unitOfMeasurement { get; set; }
public Decimal? amount { get; set; }
}
public class orderLineStatuses
{
public List<orderLineStatusList> orderLineStatus { get; set; }
}
public class orderLineStatusList
{
public string status { get; set; }
public statusQuantity statusQuantity { get; set; }
public string cancellationReason { get; set; }
public WalmarttrackingInfo trackingInfo { get; set; }
public string methodCode { get; set; }
public string trackingNumber { get; set; }
public string trackingURL { get; set; }
}
public class WalmarttrackingInfo
{
public string shipDateTime { get; set; }
public WalmartcarrierName carrierName { get; set; }
}
public class WalmartcarrierName
{
public string otherCarrier { get; set; }
public string carrier { get; set; }
}
public class statusQuantity
{
public string unitOfMeasurement { get; set; }
public Decimal? amount { get; set; }
}
public class FHorderShipment
{
public FHorderLines orderShipment { get; set; }
}
public class FHorderLines
{
public FHorderLines2 orderLines { get; set; }
}
public class FHorderLines2
{
public List<FHorderLine> orderLine { get; set; }
}
public class FHorderLine
{
public string lineNumber { get; set; }
public FHorderLineStatus2 orderLineStatuses { get; set; }
}
public class FHorderLineStatus2
{
public List<FHorderLineStatus> orderLineStatus { get; set; }
}
public class FHorderLineStatus
{
public string status { get; set; }
public FHstatusQuantity statusQuantity { get; set; }
public trackingInfo trackingInfo { get; set; }
}
public class FHstatusQuantity
{
public string unitOfMeasurement { get; set; }
public string amount { get; set; }
}
public class trackingInfo
{
public string shipDateTime { get; set; }
public fhcarrierName carrierName { get; set; }
public string methodCode { get; set; }
public string trackingNumber { get; set; }
public string trackingURL { get; set; }
}
public class fhcarrierName
{
public string otherCarrier { get; set; }
public string carrier { get; set; }
}
// "statusQuantity": {
// "unitOfMeasurement": "EACH",
// "amount": "1"
// },
// "statusDate": 1486407115000,
}