admin/src/Oms.Application/Integrations/SmallBagTrack/SmallBagTrackUpsertApiRequest.cs
zzh e642f089ba fix(track): UpsertSmallBag auth params in query, align sign helper
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 12:18:57 +08:00

48 lines
1.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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}";
}
}