48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
namespace Oms.Application.Integrations.SmallBagTrack;
|
||
|
||
/// <summary>
|
||
/// POST /OrderV2/UpsertSmallBag 业务请求体(公共参数 appKey/timestamp/sign 走 Query)。
|
||
/// </summary>
|
||
internal sealed class SmallBagTrackUpsertApiRequest
|
||
{
|
||
public string Client { get; set; } = string.Empty;
|
||
|
||
public string OrderNo { get; set; } = string.Empty;
|
||
|
||
public string TrackNo { get; set; } = string.Empty;
|
||
|
||
public string OtherNo { get; set; } = string.Empty;
|
||
|
||
public string Channel { get; set; } = string.Empty;
|
||
|
||
public string Product { get; set; } = string.Empty;
|
||
|
||
public string ApiCode { get; set; } = string.Empty;
|
||
|
||
public SmallBagTrackConsigneeRequest Consignee { get; set; } = new();
|
||
|
||
public static SmallBagTrackUpsertApiRequest FromBusinessRequest(SmallBagTrackUpsertRequest request) =>
|
||
new()
|
||
{
|
||
Client = request.Client,
|
||
OrderNo = request.OrderNo,
|
||
TrackNo = request.TrackNo,
|
||
OtherNo = request.OtherNo,
|
||
Channel = request.Channel,
|
||
Product = request.Product,
|
||
ApiCode = request.ApiCode,
|
||
Consignee = request.Consignee
|
||
};
|
||
|
||
public static string BuildRequestUrl(string baseUrl, string appKey, long timestamp, string sign)
|
||
{
|
||
var root = $"{baseUrl.Trim().TrimEnd('/')}/OrderV2/UpsertSmallBag";
|
||
var query = string.Join(
|
||
'&',
|
||
$"appKey={Uri.EscapeDataString(appKey)}",
|
||
$"timestamp={timestamp}",
|
||
$"sign={Uri.EscapeDataString(sign)}");
|
||
return $"{root}?{query}";
|
||
}
|
||
}
|