mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-04-05 17:37:54 +08:00
refactor(tenpayv3)
This commit is contained in:
parent
108814aeeb
commit
b14e9dab48
@ -1,27 +0,0 @@
|
||||
using System;
|
||||
using Flurl.Http;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
{
|
||||
internal static class FlurlHttpRequestOptionsExtensions
|
||||
{
|
||||
public static IFlurlRequest SetOptions(this IFlurlRequest request, WechatTenpayRequest options)
|
||||
{
|
||||
if (request == null) throw new ArgumentNullException(nameof(request));
|
||||
if (options == null) throw new ArgumentNullException(nameof(options));
|
||||
|
||||
if (options.Timeout.HasValue)
|
||||
{
|
||||
request.WithTimeout(TimeSpan.FromMilliseconds(options.Timeout.Value));
|
||||
}
|
||||
|
||||
if (options.WechatpayCertSerialNumber != null)
|
||||
{
|
||||
request.Headers.Remove("Wechatpay-Serial");
|
||||
request.WithHeader("Wechatpay-Serial", options.WechatpayCertSerialNumber);
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
}
|
||||
}
|
@ -28,8 +28,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "applyment4sub", "applyment")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "applyment4sub", "applyment");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateApplyForSubMerchantApplymentResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,10 +47,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "applyment4sub", "applyment", "business_code", request.BusinessCode)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "applyment4sub", "applyment", "business_code", request.BusinessCode);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetApplyForSubMerchantApplymentByBusinessCodeResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetApplyForSubMerchantApplymentByBusinessCodeResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -68,10 +66,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "applyment4sub", "applyment", "applyment_id", request.ApplymentId.ToString())
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "applyment4sub", "applyment", "applyment_id", request.ApplymentId.ToString());
|
||||
|
||||
return await client.SendRequestAsync<Models.GetApplyForSubMerchantApplymentByApplymentIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetApplyForSubMerchantApplymentByApplymentIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -89,8 +86,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "apply4sub", "sub_merchants", request.SubMerchantId, "modify-settlement")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "apply4sub", "sub_merchants", request.SubMerchantId, "modify-settlement");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.ModifyApplyForSubMerchantSettlementResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -110,10 +106,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "apply4sub", "sub_merchants", request.SubMerchantId, "settlement")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "apply4sub", "sub_merchants", request.SubMerchantId, "settlement");
|
||||
|
||||
return await client.SendRequestAsync<Models.GetApplyForSubMerchantSettlementResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetApplyForSubMerchantSettlementResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "apply4subject", "applyment")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "apply4subject", "applyment");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateApplyForSubjectApplymentResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,11 +47,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "apply4subject", "applyment")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "apply4subject", "applyment")
|
||||
.SetQueryParam("business_code", request.BusinessCode);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetApplyForSubjectApplymentByBusinessCodeResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetApplyForSubjectApplymentByBusinessCodeResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -69,11 +67,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "apply4subject", "applyment")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "apply4subject", "applyment")
|
||||
.SetQueryParam("applyment_id", request.ApplymentId.ToString());
|
||||
|
||||
return await client.SendRequestAsync<Models.GetApplyForSubjectApplymentByApplymentIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetApplyForSubjectApplymentByApplymentIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -90,8 +87,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "apply4subject", "applyment", request.BusinessCode, "cancel")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "apply4subject", "applyment", request.BusinessCode, "cancel");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CancelApplyForSubjectApplymentByBusinessCodeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -110,8 +106,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "apply4subject", "applyment", request.ApplymentId.ToString(), "cancel")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "apply4subject", "applyment", request.ApplymentId.ToString(), "cancel");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CancelApplyForSubjectApplymentByApplymentIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -130,10 +125,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "apply4subject", "applyment", "merchants", request.SubMerchantId, "state")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "apply4subject", "applyment", "merchants", request.SubMerchantId, "state");
|
||||
|
||||
return await client.SendRequestAsync<Models.GetApplyForSubjectApplymentMerchantStateResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetApplyForSubjectApplymentMerchantStateResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,8 +40,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "bill", "tradebill")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "bill", "tradebill")
|
||||
.SetQueryParam("bill_date", request.BillDateString);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.SubMerchantId))
|
||||
@ -53,7 +52,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (!string.IsNullOrEmpty(request.TarType))
|
||||
flurlReq.SetQueryParam("tar_type", request.TarType);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetBillTradeBillResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetBillTradeBillResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -82,8 +81,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "bill", "fundflowbill")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "bill", "fundflowbill")
|
||||
.SetQueryParam("bill_date", request.BillDateString);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.AccountType))
|
||||
@ -92,7 +90,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (!string.IsNullOrEmpty(request.TarType))
|
||||
flurlReq.SetQueryParam("tar_type", request.TarType);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetBillFundflowBillResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetBillFundflowBillResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -121,10 +119,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, request.DownloadUrl)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, request.DownloadUrl);
|
||||
|
||||
return await client.SendRequestAsync<Models.DownloadBillFileResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.DownloadBillFileResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "brand", "profitsharing", "orders")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "brand", "profitsharing", "orders");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateBrandProfitSharingOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,13 +47,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "brand", "profitsharing", "orders")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "brand", "profitsharing", "orders")
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId)
|
||||
.SetQueryParam("transaction_id", request.TransactionId)
|
||||
.SetQueryParam("out_order_no", request.OutOrderNumber);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetBrandProfitSharingOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetBrandProfitSharingOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -71,8 +69,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "brand", "profitsharing", "returnorders")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "brand", "profitsharing", "returnorders");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateBrandProfitSharingReturnOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -91,13 +88,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "brand", "profitsharing", "returnorders")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "brand", "profitsharing", "returnorders")
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId)
|
||||
.SetQueryParam("out_order_no", request.OutOrderNumber)
|
||||
.SetQueryParam("out_return_no", request.OutReturnNumber);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetBrandProfitSharingReturnOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetBrandProfitSharingReturnOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -114,13 +110,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "brand", "profitsharing", "returnorders")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "brand", "profitsharing", "returnorders")
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId)
|
||||
.SetQueryParam("order_id", request.OrderId)
|
||||
.SetQueryParam("out_return_no", request.OutReturnNumber);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetBrandProfitSharingReturnOrderByOrderIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetBrandProfitSharingReturnOrderByOrderIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -137,8 +132,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "brand", "profitsharing", "finish-order")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "brand", "profitsharing", "finish-order");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.SetBrandProfitSharingOrderFinishResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -157,10 +151,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "brand", "profitsharing", "orders", request.TransactionId, "amounts")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "brand", "profitsharing", "orders", request.TransactionId, "amounts");
|
||||
|
||||
return await client.SendRequestAsync<Models.GetBrandProfitSharingOrderAmountsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetBrandProfitSharingOrderAmountsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -177,10 +170,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "brand", "profitsharing", "brand-configs", request.BrandMerchantId)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "brand", "profitsharing", "brand-configs", request.BrandMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetBrandProfitSharingBrandConfigsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetBrandProfitSharingBrandConfigsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -197,8 +189,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "brand", "profitsharing", "receivers", "add")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "brand", "profitsharing", "receivers", "add");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.AddBrandProfitSharingReceiverResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -217,8 +208,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "brand", "profitsharing", "receivers", "delete")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "brand", "profitsharing", "receivers", "delete");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.DeleteBrandProfitSharingReceiverResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -29,8 +29,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "businesscircle", "points", "notify")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "businesscircle", "points", "notify");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.NotifyBusinessCirclePointsResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -50,14 +49,13 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "businesscircle", "user-authorizations", request.OpenId)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "businesscircle", "user-authorizations", request.OpenId)
|
||||
.SetQueryParam("appid", request.AppId);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.SubMerchantId))
|
||||
flurlReq.SetQueryParam("sub_mchid", request.SubMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetBusinessCircleUserAuthorizationByOpenIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetBusinessCircleUserAuthorizationByOpenIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,10 +29,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "certificates")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "certificates");
|
||||
|
||||
return await client.SendRequestAsync<Models.QueryCertificatesResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.QueryCertificatesResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
}
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "combine-transactions", "app")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "combine-transactions", "app");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateCombineTransactionAppResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -76,8 +75,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
}
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "combine-transactions", "jsapi")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "combine-transactions", "jsapi");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateCombineTransactionJsapiResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -109,8 +107,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
}
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "combine-transactions", "h5")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "combine-transactions", "h5");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateCombineTransactionH5Response>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -142,8 +139,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
}
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "combine-transactions", "native")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "combine-transactions", "native");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateCombineTransactionNativeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -163,10 +159,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "combine-transactions", "out-trade-no", request.CombineOutTradeNumber)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "combine-transactions", "out-trade-no", request.CombineOutTradeNumber);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetCombineTransactionByCombineOutTradeNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetCombineTransactionByCombineOutTradeNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -193,8 +188,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
}
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "combine-transactions", "out-trade-no", request.CombineOutTradeNumber, "close")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "combine-transactions", "out-trade-no", request.CombineOutTradeNumber, "close");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CloseCombineTransactionResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "discount-card", "cards")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "discount-card", "cards")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.PrepareDiscountCardResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,8 +48,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "discount-card", "cards", request.OutCardCode, "add-user-records")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "discount-card", "cards", request.OutCardCode, "add-user-records")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.AddDiscountCardUserRecordResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -68,10 +68,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "discount-card", "cards", request.OutCardCode)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "discount-card", "cards", request.OutCardCode)
|
||||
;
|
||||
|
||||
return await client.SendRequestAsync<Models.GetDiscountCardByOutCardCodeResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetDiscountCardByOutCardCodeResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "ecommerce", "applyments")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "ecommerce", "applyments");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateEcommerceApplymentResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,10 +47,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "ecommerce", "applyments", request.ApplymentId.ToString())
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "ecommerce", "applyments", request.ApplymentId.ToString());
|
||||
|
||||
return await client.SendRequestAsync<Models.GetEcommerceApplymentByApplymentIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetEcommerceApplymentByApplymentIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -68,10 +66,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "ecommerce", "applyments", "out-request-no", request.OutRequestNumber)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "ecommerce", "applyments", "out-request-no", request.OutRequestNumber);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetEcommerceApplymentByOutRequestNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetEcommerceApplymentByOutRequestNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "ecommerce", "bill", "fundflowbill")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "ecommerce", "bill", "fundflowbill")
|
||||
.SetQueryParam("bill_date", request.BillDateString)
|
||||
.SetQueryParam("account_type", request.AccountType)
|
||||
.SetQueryParam("algorithm", request.Algorithm);
|
||||
@ -37,7 +36,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (!string.IsNullOrEmpty(request.TarType))
|
||||
flurlReq.SetQueryParam("tar_type", request.TarType);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetEcommerceBillFundflowBillResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetEcommerceBillFundflowBillResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,13 +29,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "ecommerce", "fund", "balance", request.SubMerchantId)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "ecommerce", "fund", "balance", request.SubMerchantId);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.AccountType))
|
||||
flurlReq.SetQueryParam("account_type", request.AccountType);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetEcommerceFundBalanceResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetEcommerceFundBalanceResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -52,11 +51,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "ecommerce", "fund", "enddaybalance", request.SubMerchantId)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "ecommerce", "fund", "enddaybalance", request.SubMerchantId)
|
||||
.SetQueryParam("date", request.DateString);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetEcommerceFundDayendBalanceResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetEcommerceFundDayendBalanceResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "ecommerce", "fund", "withdraw")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "ecommerce", "fund", "withdraw")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateEcommerceFundWithdrawResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,11 +48,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "ecommerce", "fund", "withdraw", "out-request-no", request.OutRequestNumber)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "ecommerce", "fund", "withdraw", "out-request-no", request.OutRequestNumber)
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetEcommerceFundWithdrawByOutRequestNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetEcommerceFundWithdrawByOutRequestNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -69,11 +68,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "ecommerce", "fund", "withdraw", request.WithdrawId)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "ecommerce", "fund", "withdraw", request.WithdrawId)
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetEcommerceFundWithdrawByWithdrawIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetEcommerceFundWithdrawByWithdrawIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "ecommerce", "profitsharing", "orders")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "ecommerce", "profitsharing", "orders")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateEcommerceProfitSharingOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,13 +48,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "ecommerce", "profitsharing", "orders")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "ecommerce", "profitsharing", "orders")
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId)
|
||||
.SetQueryParam("transaction_id", request.TransactionId)
|
||||
.SetQueryParam("out_order_no", request.OutOrderNumber);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetEcommerceProfitSharingOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetEcommerceProfitSharingOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -71,8 +70,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "ecommerce", "profitsharing", "returnorders")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "ecommerce", "profitsharing", "returnorders")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateEcommerceProfitSharingReturnOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -91,13 +90,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "ecommerce", "profitsharing", "returnorders")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "ecommerce", "profitsharing", "returnorders")
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId)
|
||||
.SetQueryParam("out_order_no", request.OutOrderNumber)
|
||||
.SetQueryParam("out_return_no", request.OutReturnNumber);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetEcommerceProfitSharingReturnOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetEcommerceProfitSharingReturnOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -114,13 +112,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "ecommerce", "profitsharing", "returnorders")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "ecommerce", "profitsharing", "returnorders")
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId)
|
||||
.SetQueryParam("order_id", request.OrderId)
|
||||
.SetQueryParam("out_return_no", request.OutReturnNumber);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetEcommerceProfitSharingReturnOrderByOrderIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetEcommerceProfitSharingReturnOrderByOrderIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -137,8 +134,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "ecommerce", "profitsharing", "finish-order")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "ecommerce", "profitsharing", "finish-order")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.SetEcommerceProfitSharingOrderFinishResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -157,10 +154,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "ecommerce", "profitsharing", "orders", request.TransactionId, "amounts")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "ecommerce", "profitsharing", "orders", request.TransactionId, "amounts")
|
||||
;
|
||||
|
||||
return await client.SendRequestAsync<Models.GetEcommerceProfitSharingOrderAmountsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetEcommerceProfitSharingOrderAmountsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -177,8 +174,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "ecommerce", "profitsharing", "receivers", "add")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "ecommerce", "profitsharing", "receivers", "add")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.AddEcommerceProfitSharingReceiverResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -197,8 +194,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "ecommerce", "profitsharing", "receivers", "delete")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "ecommerce", "profitsharing", "receivers", "delete")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.DeleteEcommerceProfitSharingReceiverResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "ecommerce", "refunds", "apply")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "ecommerce", "refunds", "apply")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateEcommerceRefundResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,11 +48,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "ecommerce", "refunds", "out-refund-no", request.OutRefundNumber)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "ecommerce", "refunds", "out-refund-no", request.OutRefundNumber)
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetEcommerceRefundByOutRefundNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetEcommerceRefundByOutRefundNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -69,11 +68,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "ecommerce", "refunds", "id", request.RefundId)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "ecommerce", "refunds", "id", request.RefundId)
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetEcommerceRefundByRefundIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetEcommerceRefundByRefundIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -90,8 +88,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "ecommerce", "refunds", request.RefundId, "return-advance")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "ecommerce", "refunds", request.RefundId, "return-advance")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateEcommerceRefundReturnAdvanceResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -110,11 +108,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "ecommerce", "refunds", request.RefundId, "return-advance")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "ecommerce", "refunds", request.RefundId, "return-advance")
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetEcommerceRefundReturnAdvanceResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetEcommerceRefundReturnAdvanceResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "ecommerce", "subsidies", "create")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "ecommerce", "subsidies", "create");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateEcommerceSubsidyResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,8 +47,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "ecommerce", "subsidies", "return")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "ecommerce", "subsidies", "return");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateEcommerceSubsidyReturnResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -68,8 +66,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "ecommerce", "subsidies", "cancel")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "ecommerce", "subsidies", "cancel");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CancelEcommerceSubsidyResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "goldplan", "merchants", "changegoldplanstatus")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "goldplan", "merchants", "changegoldplanstatus");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.ChangeGoldPlanStatusResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,8 +47,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "goldplan", "merchants", "changecustompagestatus")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "goldplan", "merchants", "changecustompagestatus");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.ChangeGoldPlanCustomPageStatusResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -68,8 +66,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "goldplan", "merchants", "set-advertising-industry-filter")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "goldplan", "merchants", "set-advertising-industry-filter");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.SetGoldPlanAdvertisingIndustryFilterResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -88,8 +85,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "goldplan", "merchants", "open-advertising-show")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "goldplan", "merchants", "open-advertising-show");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.OpenGoldPlanAdvertisingShowResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -108,8 +104,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "goldplan", "merchants", "close-advertising-show")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "goldplan", "merchants", "close-advertising-show");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CloseGoldPlanAdvertisingShowResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.BelongMerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "busifavor", "stocks")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "busifavor", "stocks");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateMarketingBusifavorStockResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -53,10 +52,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "busifavor", "stocks", request.StockId)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "busifavor", "stocks", request.StockId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMarketingBusifavorStockByStockIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMarketingBusifavorStockByStockIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -74,8 +72,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(new HttpMethod("PATCH"), "marketing", "busifavor", "stocks", request.StockId)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, new HttpMethod("PATCH"), "marketing", "busifavor", "stocks", request.StockId);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.UpdateMarketingBusifavorStockResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -95,8 +92,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(new HttpMethod("PATCH"), "marketing", "busifavor", "stocks", request.StockId, "budget")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, new HttpMethod("PATCH"), "marketing", "busifavor", "stocks", request.StockId, "budget");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.UpdateMarketingBusifavorStockBudgetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -116,8 +112,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "busifavor", "stocks", request.StockId, "couponcodes")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "busifavor", "stocks", request.StockId, "couponcodes");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.UploadMarketingBusifavorStockCouponCodesResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -137,10 +132,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "busifavor", "users", request.OpenId, "coupons", request.CouponCode, "appids", request.AppId)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "busifavor", "users", request.OpenId, "coupons", request.CouponCode, "appids", request.AppId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMarketingBusifavorUserCouponByCouponCodeResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMarketingBusifavorUserCouponByCouponCodeResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -158,8 +152,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "busifavor", "users", request.OpenId, "coupons")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "busifavor", "users", request.OpenId, "coupons")
|
||||
.SetQueryParam("appid", request.AppId);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.StockId))
|
||||
@ -183,7 +176,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request.Offset.HasValue)
|
||||
flurlReq.SetQueryParam("offset", request.Offset.Value.ToString());
|
||||
|
||||
return await client.SendRequestAsync<Models.QueryMarketingBusifavorUserCouponsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.QueryMarketingBusifavorUserCouponsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -201,8 +194,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "busifavor", "coupons", "use")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "busifavor", "coupons", "use");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.SetMarketingBusifavorCouponUsedResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -222,8 +214,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "busifavor", "coupons", "associate")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "busifavor", "coupons", "associate");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.AssociateMarketingBusifavorCouponResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -243,8 +234,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "busifavor", "coupons", "disassociate")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "busifavor", "coupons", "disassociate");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.DisassociateMarketingBusifavorCouponResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -264,8 +254,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "busifavor", "coupons", "return")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "busifavor", "coupons", "return");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateMarketingBusifavorCouponReturnResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -285,8 +274,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "busifavor", "coupons", "deactivate")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "busifavor", "coupons", "deactivate");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.DeactivateMarketingBusifavorCouponResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -305,8 +293,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "busifavor", "coupons", request.CardId, "send")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "busifavor", "coupons", request.CardId, "send");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.SendMarketingBusifavorCouponResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -329,11 +316,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "busifavor", "callbacks")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "busifavor", "callbacks")
|
||||
.SetQueryParam("mchid", request.MerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMarketingBusifavorCallbackResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMarketingBusifavorCallbackResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -354,8 +340,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "busifavor", "callbacks")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "busifavor", "callbacks");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.UpdateMarketingBusifavorCallbackResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -381,8 +366,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.PayeeMerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "busifavor", "subsidy", "pay-receipts")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "busifavor", "subsidy", "pay-receipts");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateMarketingBusifavorSubsidyPayReceiptResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -402,10 +386,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "busifavor", "subsidy", "pay-receipts", request.SubsidyReceiptId)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "busifavor", "subsidy", "pay-receipts", request.SubsidyReceiptId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMarketingBusifavorSubsidyPayReceiptBySubsidyReceiptIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMarketingBusifavorSubsidyPayReceiptBySubsidyReceiptIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -429,8 +412,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.PayeeMerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "busifavor", "subsidy", "return-receipts")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "busifavor", "subsidy", "return-receipts");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateMarketingBusifavorSubsidyReturnReceiptResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.BelongMerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "favor", "coupon-stocks")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "favor", "coupon-stocks")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateMarketingFavorStockResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -56,8 +56,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.StockCreatorMerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "favor", "stocks", request.StockId, "start")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "favor", "stocks", request.StockId, "start")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.StartMarketingFavorStockResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -80,8 +80,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.StockCreatorMerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "favor", "stocks", request.StockId, "pause")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "favor", "stocks", request.StockId, "pause")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.PauseMarketingFavorStockResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -104,8 +104,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.StockCreatorMerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "favor", "stocks", request.StockId, "restart")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "favor", "stocks", request.StockId, "restart")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.RestartMarketingFavorStockResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -128,11 +128,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.StockCreatorMerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "favor", "stocks", request.StockId)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "favor", "stocks", request.StockId)
|
||||
.SetQueryParam("stock_creator_mchid", request.StockCreatorMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMarketingFavorStockByStockIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMarketingFavorStockByStockIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -153,8 +152,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.StockCreatorMerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "favor", "stocks")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "favor", "stocks")
|
||||
.SetQueryParam("stock_creator_mchid", request.StockCreatorMerchantId)
|
||||
.SetQueryParam("limit", request.Limit.ToString())
|
||||
.SetQueryParam("offset", request.Offset.ToString());
|
||||
@ -168,7 +166,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (!string.IsNullOrEmpty(request.Status))
|
||||
flurlReq.SetQueryParam("status", request.Status);
|
||||
|
||||
return await client.SendRequestAsync<Models.QueryMarketingFavorStocksResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.QueryMarketingFavorStocksResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -189,13 +187,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.StockCreatorMerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "favor", "stocks", request.StockId, "merchants")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "favor", "stocks", request.StockId, "merchants")
|
||||
.SetQueryParam("stock_creator_mchid", request.StockCreatorMerchantId)
|
||||
.SetQueryParam("limit", request.Limit.ToString())
|
||||
.SetQueryParam("offset", request.Offset.ToString());
|
||||
|
||||
return await client.SendRequestAsync<Models.QueryMarketingFavorStockMerchantsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.QueryMarketingFavorStockMerchantsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -216,13 +213,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.StockCreatorMerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "favor", "stocks", request.StockId, "items")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "favor", "stocks", request.StockId, "items")
|
||||
.SetQueryParam("stock_creator_mchid", request.StockCreatorMerchantId)
|
||||
.SetQueryParam("limit", request.Limit.ToString())
|
||||
.SetQueryParam("offset", request.Offset.ToString());
|
||||
|
||||
return await client.SendRequestAsync<Models.QueryMarketingFavorStockItemsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.QueryMarketingFavorStockItemsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -240,10 +236,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "favor", "stocks", request.StockId, "use-flow")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "favor", "stocks", request.StockId, "use-flow")
|
||||
;
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMarketingFavorStockUseFlowResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMarketingFavorStockUseFlowResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -261,10 +257,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "favor", "stocks", request.StockId, "refund-flow")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "favor", "stocks", request.StockId, "refund-flow")
|
||||
;
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMarketingFavorStockRefundFlowResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMarketingFavorStockRefundFlowResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -285,8 +281,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.StockCreatorMerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "favor", "users", request.OpenId, "coupons")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "favor", "users", request.OpenId, "coupons")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.SendMarketingFavorUserCouponResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -306,11 +302,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "favor", "users", request.OpenId, "coupons", request.CouponId)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "favor", "users", request.OpenId, "coupons", request.CouponId)
|
||||
.SetQueryParam("appid", request.AppId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMarketingFavorUserCouponByCouponIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMarketingFavorUserCouponByCouponIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -328,8 +323,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "favor", "users", request.OpenId, "coupons")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "favor", "users", request.OpenId, "coupons")
|
||||
.SetQueryParam("appid", request.AppId);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.StockId))
|
||||
@ -353,7 +347,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request.Offset.HasValue)
|
||||
flurlReq.SetQueryParam("offset", request.Offset.Value.ToString());
|
||||
|
||||
return await client.SendRequestAsync<Models.QueryMarketingFavorUserCouponsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.QueryMarketingFavorUserCouponsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -374,8 +368,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "favor", "callbacks")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "favor", "callbacks")
|
||||
;
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.UpdateMarketingFavorCallbackResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using Flurl;
|
||||
using Flurl.Http;
|
||||
|
||||
@ -36,31 +37,22 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.FileHash = Security.SHA256Utility.Hash(request.FileBytes).ToLower();
|
||||
|
||||
if (string.IsNullOrEmpty(request.FileContentType))
|
||||
{
|
||||
if (request.FileName!.EndsWith(".bmp", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "image/bmp";
|
||||
else if (request.FileName!.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "image/jpeg";
|
||||
else if (request.FileName!.EndsWith(".jpeg", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "image/jpeg";
|
||||
else
|
||||
request.FileContentType = "image/png";
|
||||
}
|
||||
request.FileContentType = Utilities.FileNameToContentTypeMapper.GetContentTypeForImage(request.FileName!) ?? "image/png";
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "favor", "media", "image-upload");
|
||||
|
||||
string boundary = "--BOUNDARY--" + DateTimeOffset.Now.Ticks.ToString("x");
|
||||
using var fileContent = new ByteArrayContent(request.FileBytes);
|
||||
using var metaContent = new ByteArrayContent(Encoding.UTF8.GetBytes(client.FlurlJsonSerializer.Serialize(request)));
|
||||
using var httpContent = new MultipartFormDataContent(boundary);
|
||||
httpContent.Add(metaContent, "\"" + Constants.FormDataFields.FORMDATA_META + "\""); // NOTICE: meta 必须要加双引号
|
||||
httpContent.Add(fileContent, "\"file\"", "\"" + request.FileName + "\""); // NOTICE: file 必须要加双引号
|
||||
httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data; boundary=" + boundary); // NOTICE: boundary 不能加引号
|
||||
httpContent.Add(metaContent, $"\"{Constants.FormDataFields.FORMDATA_META}\"");
|
||||
httpContent.Add(fileContent, "\"file\"", $"\"{HttpUtility.UrlEncode(request.FileName)}\"");
|
||||
httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data; boundary=" + boundary);
|
||||
metaContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
|
||||
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse(request.FileContentType);
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "favor", "media", "image-upload")
|
||||
.SetOptions(request);
|
||||
|
||||
return await client.SendRequestAsync<Models.UploadMarketingMediaImageResponse>(flurlReq, content: httpContent, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestAsync<Models.UploadMarketingMediaImageResponse>(flurlReq, httpContent: httpContent, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "partnerships", "build")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "partnerships", "build")
|
||||
.WithHeader("Idempotency-Key", request.IdempotencyKey);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.BuildMarketingPartnershipResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
@ -51,8 +50,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "partnerships", "terminate")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "partnerships", "terminate")
|
||||
.WithHeader("Idempotency-Key", request.IdempotencyKey);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.TerminateMarketingPartnershipResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
@ -73,8 +71,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "partnerships")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "partnerships");
|
||||
|
||||
if (request.Partner != null)
|
||||
flurlReq.SetQueryParam("partner", client.FlurlJsonSerializer.Serialize(request.Partner));
|
||||
@ -88,7 +85,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request.Offset.HasValue)
|
||||
flurlReq.SetQueryParam("offset", request.Offset.Value.ToString());
|
||||
|
||||
return await client.SendRequestAsync<Models.QueryMarketingPartnershipsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.QueryMarketingPartnershipsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "paygiftactivity", "unique-threshold-activity")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "paygiftactivity", "unique-threshold-activity");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateMarketingPayGiftActivityUniqueThresholdActivityResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -50,10 +49,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "paygiftactivity", "activities", request.ActivityId)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "paygiftactivity", "activities", request.ActivityId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMarketingPayGiftActivityByActivityIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMarketingPayGiftActivityByActivityIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -71,8 +69,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "paygiftactivity", "activities")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "paygiftactivity", "activities")
|
||||
.SetQueryParam("limit", request.Limit.ToString())
|
||||
.SetQueryParam("offset", request.Offset.ToString());
|
||||
|
||||
@ -85,7 +82,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (!string.IsNullOrEmpty(request.AwardType))
|
||||
flurlReq.SetQueryParam("award_type", request.AwardType);
|
||||
|
||||
return await client.SendRequestAsync<Models.QueryMarketingPayGiftActivitiesResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.QueryMarketingPayGiftActivitiesResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -103,8 +100,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "paygiftactivity", "activities", request.ActivityId, "terminate")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "paygiftactivity", "activities", request.ActivityId, "terminate");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.TerminateMarketingPayGiftActivityResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -124,8 +120,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "paygiftactivity", "activities", request.ActivityId, "merchants", "add")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "paygiftactivity", "activities", request.ActivityId, "merchants", "add");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.AddMarketingPayGiftActivityMerchantResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -145,8 +140,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "paygiftactivity", "activities", request.ActivityId, "merchants")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "paygiftactivity", "activities", request.ActivityId, "merchants");
|
||||
|
||||
if (request.Limit.HasValue)
|
||||
flurlReq.SetQueryParam("limit", request.Limit.Value.ToString());
|
||||
@ -154,7 +148,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request.Offset.HasValue)
|
||||
flurlReq.SetQueryParam("offset", request.Offset.Value.ToString());
|
||||
|
||||
return await client.SendRequestAsync<Models.QueryMarketingPayGiftActivityMerchantsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.QueryMarketingPayGiftActivityMerchantsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -172,8 +166,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "marketing", "paygiftactivity", "activities", request.ActivityId, "merchants", "delete")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "marketing", "paygiftactivity", "activities", request.ActivityId, "merchants", "delete");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.DeleteMarketingPayGiftActivityMerchantResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -193,8 +186,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "marketing", "paygiftactivity", "activities", request.ActivityId, "goods")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "marketing", "paygiftactivity", "activities", request.ActivityId, "goods");
|
||||
|
||||
if (request.Limit.HasValue)
|
||||
flurlReq.SetQueryParam("limit", request.Limit.Value.ToString());
|
||||
@ -202,7 +194,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request.Offset.HasValue)
|
||||
flurlReq.SetQueryParam("offset", request.Offset.Value.ToString());
|
||||
|
||||
return await client.SendRequestAsync<Models.QueryMarketingPayGiftActivityGoodsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.QueryMarketingPayGiftActivityGoodsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,10 +28,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "merchant", "fund", "balance", request.AccountType)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "merchant", "fund", "balance", request.AccountType);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMerchantFundBalanceResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMerchantFundBalanceResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -48,11 +47,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "merchant", "fund", "dayendbalance", request.AccountType)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "merchant", "fund", "dayendbalance", request.AccountType)
|
||||
.SetQueryParam("date", request.DateString);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMerchantFundDayendBalanceResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMerchantFundDayendBalanceResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "merchant", "fund", "withdraw")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "merchant", "fund", "withdraw");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateMerchantFundWithdrawResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,10 +47,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "merchant", "fund", "withdraw", "out-request-no", request.OutRequestNumber)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "merchant", "fund", "withdraw", "out-request-no", request.OutRequestNumber);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMerchantFundWithdrawByOutRequestNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMerchantFundWithdrawByOutRequestNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -68,10 +66,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "merchant", "fund", "withdraw", request.WithdrawId)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "merchant", "fund", "withdraw", request.WithdrawId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMerchantFundWithdrawByWithdrawIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMerchantFundWithdrawByWithdrawIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -88,14 +85,13 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "merchant", "fund", "withdraw", "bill-type", request.BillType)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "merchant", "fund", "withdraw", "bill-type", request.BillType)
|
||||
.SetQueryParam("bill_date", request.BillDateString);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.TarType))
|
||||
flurlReq.SetQueryParam("tar_type", request.TarType);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMerchantFundWithdrawBillResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMerchantFundWithdrawBillResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using Flurl;
|
||||
using Flurl.Http;
|
||||
|
||||
@ -36,31 +37,22 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.FileHash = Security.SHA256Utility.Hash(request.FileBytes).ToLower();
|
||||
|
||||
if (string.IsNullOrEmpty(request.FileContentType))
|
||||
{
|
||||
if (request.FileName!.EndsWith(".bmp", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "image/bmp";
|
||||
else if (request.FileName!.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "image/jpeg";
|
||||
else if (request.FileName!.EndsWith(".jpeg", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "image/jpeg";
|
||||
else
|
||||
request.FileContentType = "image/png";
|
||||
}
|
||||
request.FileContentType = Utilities.FileNameToContentTypeMapper.GetContentTypeForImage(request.FileName!) ?? "image/png";
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "merchant", "media", "upload");
|
||||
|
||||
string boundary = "--BOUNDARY--" + DateTimeOffset.Now.Ticks.ToString("x");
|
||||
using var fileContent = new ByteArrayContent(request.FileBytes);
|
||||
using var metaContent = new StringContent(client.FlurlJsonSerializer.Serialize(request), Encoding.UTF8, "application/json");
|
||||
using var httpContent = new MultipartFormDataContent(boundary);
|
||||
httpContent.Add(metaContent, "\"" + Constants.FormDataFields.FORMDATA_META + "\""); // NOTICE: meta 必须要加双引号
|
||||
httpContent.Add(fileContent, "\"file\"", "\"" + request.FileName + "\""); // NOTICE: file 必须要加双引号
|
||||
httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data; boundary=" + boundary); // NOTICE: boundary 不能加引号
|
||||
httpContent.Add(metaContent, $"\"{Constants.FormDataFields.FORMDATA_META}\"");
|
||||
httpContent.Add(fileContent, "\"file\"", $"\"{HttpUtility.UrlEncode(request.FileName)}\"");
|
||||
httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data; boundary=" + boundary);
|
||||
metaContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
|
||||
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse(request.FileContentType);
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "merchant", "media", "upload")
|
||||
.SetOptions(request);
|
||||
|
||||
return await client.SendRequestAsync<Models.UploadMerchantMediaImageResponse>(flurlReq, content: httpContent, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestAsync<Models.UploadMerchantMediaImageResponse>(flurlReq, httpContent: httpContent, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -84,43 +76,22 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.FileHash = Security.SHA256Utility.Hash(request.FileBytes).ToLower();
|
||||
|
||||
if (string.IsNullOrEmpty(request.FileContentType))
|
||||
{
|
||||
if (request.FileName!.EndsWith(".avi", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "video/x-msvideo";
|
||||
else if (request.FileName!.EndsWith(".wmv", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "video/x-ms-wmv";
|
||||
else if (request.FileName!.EndsWith(".mpeg", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "video/mpeg";
|
||||
else if (request.FileName!.EndsWith(".mov", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "video/quicktime";
|
||||
else if (request.FileName!.EndsWith(".mkv", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "video/mkv";
|
||||
else if (request.FileName!.EndsWith(".m4v", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "video/x-m4v";
|
||||
else if (request.FileName!.EndsWith(".flv", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "video/x-flv";
|
||||
else if (request.FileName!.EndsWith(".f4v", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "video/x-f4v";
|
||||
else if (request.FileName!.EndsWith(".rmvb", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "video/vnd.rn-realvideo";
|
||||
else
|
||||
request.FileContentType = "video/mp4";
|
||||
}
|
||||
request.FileContentType = Utilities.FileNameToContentTypeMapper.GetContentTypeForVideo(request.FileName!) ?? "video/mp4";
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "merchant", "media", "video_upload");
|
||||
|
||||
string boundary = "--BOUNDARY--" + DateTimeOffset.Now.Ticks.ToString("x");
|
||||
using var fileContent = new ByteArrayContent(request.FileBytes);
|
||||
using var metaContent = new ByteArrayContent(Encoding.UTF8.GetBytes(client.FlurlJsonSerializer.Serialize(request)));
|
||||
using var httpContent = new MultipartFormDataContent(boundary);
|
||||
httpContent.Add(metaContent, "\"meta\""); // NOTICE: meta 必须要加双引号
|
||||
httpContent.Add(fileContent, "\"file\"", "\"" + request.FileName + "\""); // NOTICE: file 必须要加双引号
|
||||
httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data; boundary=" + boundary); // NOTICE: boundary 不能加引号
|
||||
httpContent.Add(metaContent, $"\"{Constants.FormDataFields.FORMDATA_META}\"");
|
||||
httpContent.Add(fileContent, "\"file\"", $"\"{HttpUtility.UrlEncode(request.FileName)}\"");
|
||||
httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data; boundary=" + boundary);
|
||||
metaContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
|
||||
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse(request.FileContentType);
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "merchant", "media", "video_upload")
|
||||
.SetOptions(request);
|
||||
|
||||
return await client.SendRequestAsync<Models.UploadMerchantMediaVideoResponse>(flurlReq, content: httpContent, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestAsync<Models.UploadMerchantMediaVideoResponse>(flurlReq, httpContent: httpContent, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using Flurl;
|
||||
using Flurl.Http;
|
||||
|
||||
@ -30,8 +31,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "merchant-service", "complaints-v2")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "merchant-service", "complaints-v2")
|
||||
.SetQueryParam("begin_date", request.BeginDateString)
|
||||
.SetQueryParam("end_date", request.EndDateString);
|
||||
|
||||
@ -44,7 +44,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request.Offset.HasValue)
|
||||
flurlReq.SetQueryParam("offset", request.Offset.Value.ToString());
|
||||
|
||||
return await client.SendRequestAsync<Models.QueryMerchantServiceComplaintsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.QueryMerchantServiceComplaintsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -62,10 +62,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "merchant-service", "complaints-v2", request.ComplaintId)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "merchant-service", "complaints-v2", request.ComplaintId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMerchantServiceComplaintByComplaintIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMerchantServiceComplaintByComplaintIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -83,8 +82,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "merchant-service", "complaints-v2", request.ComplaintId, "negotiation-historys")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "merchant-service", "complaints-v2", request.ComplaintId, "negotiation-historys");
|
||||
|
||||
if (request.Limit.HasValue)
|
||||
flurlReq.SetQueryParam("limit", request.Limit.Value.ToString());
|
||||
@ -92,7 +90,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request.Offset.HasValue)
|
||||
flurlReq.SetQueryParam("offset", request.Offset.Value.ToString());
|
||||
|
||||
return await client.SendRequestAsync<Models.QueryMerchantServiceComplaintNegotiationHistoriesResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.QueryMerchantServiceComplaintNegotiationHistoriesResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -113,8 +111,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.ComplaintedMerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "merchant-service", "complaints-v2", request.ComplaintId, "response")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "merchant-service", "complaints-v2", request.ComplaintId, "response");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateMerchantServiceComplaintResponseResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -137,8 +134,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.ComplaintedMerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "merchant-service", "complaints-v2", request.ComplaintId, "complete")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "merchant-service", "complaints-v2", request.ComplaintId, "complete");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.SetMerchantServiceComplaintCompleteResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -158,8 +154,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "merchant-service", "complaint-notifications")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "merchant-service", "complaint-notifications");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateMerchantServiceComplaintNotificationResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -179,10 +174,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "merchant-service", "complaint-notifications")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "merchant-service", "complaint-notifications");
|
||||
|
||||
return await client.SendRequestAsync<Models.GetMerchantServiceComplaintNotificationResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMerchantServiceComplaintNotificationResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -200,8 +194,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Put, "merchant-service", "complaint-notifications")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Put, "merchant-service", "complaint-notifications");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.UpdateMerchantServiceComplaintNotificationResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -221,8 +214,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Delete, "merchant-service", "complaint-notifications")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Delete, "merchant-service", "complaint-notifications");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.DeleteMerchantServiceComplaintNotificationResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -248,31 +240,22 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.FileHash = Security.SHA256Utility.Hash(request.FileBytes).ToLower();
|
||||
|
||||
if (string.IsNullOrEmpty(request.FileContentType))
|
||||
{
|
||||
if (request.FileName!.EndsWith(".bmp", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "image/bmp";
|
||||
else if (request.FileName!.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "image/jpeg";
|
||||
else if (request.FileName!.EndsWith(".jpeg", StringComparison.OrdinalIgnoreCase))
|
||||
request.FileContentType = "image/jpeg";
|
||||
else
|
||||
request.FileContentType = "image/png";
|
||||
}
|
||||
request.FileContentType = Utilities.FileNameToContentTypeMapper.GetContentTypeForImage(request.FileName!) ?? "image/png";
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "merchant-service", "images", "upload");
|
||||
|
||||
string boundary = "--BOUNDARY--" + DateTimeOffset.Now.Ticks.ToString("x");
|
||||
using var fileContent = new ByteArrayContent(request.FileBytes);
|
||||
using var metaContent = new ByteArrayContent(Encoding.UTF8.GetBytes(client.FlurlJsonSerializer.Serialize(request)));
|
||||
using var httpContent = new MultipartFormDataContent(boundary);
|
||||
httpContent.Add(metaContent, "\"" + Constants.FormDataFields.FORMDATA_META + "\""); // NOTICE: meta 必须要加双引号
|
||||
httpContent.Add(fileContent, "\"file\"", "\"" + request.FileName + "\""); // NOTICE: file 必须要加双引号
|
||||
httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data; boundary=" + boundary); // NOTICE: boundary 不能加引号
|
||||
httpContent.Add(metaContent, $"\"{Constants.FormDataFields.FORMDATA_META}\"");
|
||||
httpContent.Add(fileContent, "\"file\"", $"\"{HttpUtility.UrlEncode(request.FileName)}\"");
|
||||
httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data; boundary=" + boundary);
|
||||
metaContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
|
||||
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse(request.FileContentType);
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "merchant-service", "images", "upload")
|
||||
.SetOptions(request);
|
||||
|
||||
return await client.SendRequestAsync<Models.UploadMerchantServiceImageResponse>(flurlReq, content: httpContent, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestAsync<Models.UploadMerchantServiceImageResponse>(flurlReq, httpContent: httpContent, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "pay", "partner", "transactions", "app")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "pay", "partner", "transactions", "app");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreatePayPartnerTransactionAppResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -58,8 +57,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "pay", "partner", "transactions", "jsapi")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "pay", "partner", "transactions", "jsapi");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreatePayPartnerTransactionJsapiResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -82,8 +80,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "pay", "partner", "transactions", "h5")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "pay", "partner", "transactions", "h5");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreatePayPartnerTransactionH5Response>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -105,8 +102,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "pay", "partner", "transactions", "native")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "pay", "partner", "transactions", "native");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreatePayPartnerTransactionNativeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -133,12 +129,11 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "pay", "partner", "transactions", "out-trade-no", request.OutTradeNumber)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "pay", "partner", "transactions", "out-trade-no", request.OutTradeNumber)
|
||||
.SetQueryParam("sp_mchid", request.MerchantId)
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetPayPartnerTransactionByOutTradeNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetPayPartnerTransactionByOutTradeNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -163,12 +158,11 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "pay", "partner", "transactions", "id", request.TransactionId)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "pay", "partner", "transactions", "id", request.TransactionId)
|
||||
.SetQueryParam("sp_mchid", request.MerchantId)
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetPayPartnerTransactionByIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetPayPartnerTransactionByIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -193,8 +187,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "pay", "partner", "transactions", "out-trade-no", request.OutTradeNumber, "close")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "pay", "partner", "transactions", "out-trade-no", request.OutTradeNumber, "close");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.ClosePayPartnerTransactionResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "partner", "permissions")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "partner", "permissions");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.ApplyPayScorePartnerPermissionsResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,12 +47,11 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "payscore", "partner", "permissions", "authorization-code", request.AuthorizationCode)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "payscore", "partner", "permissions", "authorization-code", request.AuthorizationCode)
|
||||
.SetQueryParam("service_id", request.ServiceId)
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetPayScorePartnerPermissionsByAuthorizationCodeResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetPayScorePartnerPermissionsByAuthorizationCodeResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -70,8 +68,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "partner", "permissions", "authorization-code", request.AuthorizationCode, "terminate")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "partner", "permissions", "authorization-code", request.AuthorizationCode, "terminate");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.TerminatePayScorePartnerPermissionsByAuthorizationCodeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -90,8 +87,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "payscore", "partner", "permissions", "search")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "payscore", "partner", "permissions", "search")
|
||||
.SetQueryParam("service_id", request.ServiceId)
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId)
|
||||
.SetQueryParam("appid", request.AppId)
|
||||
@ -103,7 +99,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (!string.IsNullOrEmpty(request.SubOpenId))
|
||||
flurlReq.SetQueryParam("sub_openid", request.SubOpenId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetPayScorePartnerPermissionsByOpenIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetPayScorePartnerPermissionsByOpenIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -120,8 +116,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "partner", "permissions", "terminate")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "partner", "permissions", "terminate");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.TerminatePayScorePartnerPermissionsByOpenIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "partner", "serviceorder")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "partner", "serviceorder");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreatePayScorePartnerServiceOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,13 +47,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "payscore", "partner", "serviceorder")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "payscore", "partner", "serviceorder")
|
||||
.SetQueryParam("out_order_no", request.OutOrderNumber)
|
||||
.SetQueryParam("service_id", request.ServiceId)
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetPayScorePartnerServiceOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetPayScorePartnerServiceOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -71,13 +69,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "payscore", "partner", "serviceorder")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "payscore", "partner", "serviceorder")
|
||||
.SetQueryParam("query_id", request.QueryId)
|
||||
.SetQueryParam("service_id", request.ServiceId)
|
||||
.SetQueryParam("sub_mchid", request.SubMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetPayScorePartnerServiceOrderByQueryIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetPayScorePartnerServiceOrderByQueryIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -94,8 +91,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "partner", "serviceorder", request.OutOrderNumber, "cancel")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "partner", "serviceorder", request.OutOrderNumber, "cancel");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CancelPayScorePartnerServiceOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -114,8 +110,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "partner", "serviceorder", request.OutOrderNumber, "modify")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "partner", "serviceorder", request.OutOrderNumber, "modify");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.ModifyPayScorePartnerServiceOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -134,8 +129,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "partner", "serviceorder", request.OutOrderNumber, "complete")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "partner", "serviceorder", request.OutOrderNumber, "complete");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.SetPayScorePartnerServiceOrderCompleteResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -154,8 +148,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "partner", "serviceorder", request.OutOrderNumber, "pay")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "partner", "serviceorder", request.OutOrderNumber, "pay");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.SetPayScorePartnerServiceOrderPayResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -174,8 +167,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "partner", "serviceorder", request.OutOrderNumber, "sync")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "partner", "serviceorder", request.OutOrderNumber, "sync");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.SetPayScorePartnerServiceOrderSyncResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "permissions")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "permissions");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.ApplyPayScorePermissionsResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,11 +47,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "payscore", "permissions", "authorization-code", request.AuthorizationCode)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "payscore", "permissions", "authorization-code", request.AuthorizationCode)
|
||||
.SetQueryParam("service_id", request.ServiceId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetPayScorePermissionsByAuthorizationCodeResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetPayScorePermissionsByAuthorizationCodeResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -69,8 +67,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "permissions", "authorization-code", request.AuthorizationCode, "terminate")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "permissions", "authorization-code", request.AuthorizationCode, "terminate");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.TerminatePayScorePermissionsByAuthorizationCodeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -89,12 +86,11 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "payscore", "permissions", "openid", request.OpenId!)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "payscore", "permissions", "openid", request.OpenId!)
|
||||
.SetQueryParam("appid", request.AppId)
|
||||
.SetQueryParam("service_id", request.ServiceId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetPayScorePermissionsByOpenIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetPayScorePermissionsByOpenIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -111,8 +107,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "permissions", "openid", request.OpenId!, "terminate")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "permissions", "openid", request.OpenId!, "terminate");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.TerminatePayScorePermissionsByOpenIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "serviceorder", "direct-complete")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "serviceorder", "direct-complete");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreatePayScoreServiceOrderDirectCompleteResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -48,8 +47,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "serviceorder")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "serviceorder");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreatePayScoreServiceOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -68,13 +66,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "payscore", "serviceorder")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "payscore", "serviceorder")
|
||||
.SetQueryParam("out_order_no", request.OutOrderNumber)
|
||||
.SetQueryParam("service_id", request.ServiceId)
|
||||
.SetQueryParam("appid", request.AppId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetPayScoreServiceOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetPayScoreServiceOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -91,13 +88,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "payscore", "serviceorder")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "payscore", "serviceorder")
|
||||
.SetQueryParam("query_id", request.QueryId)
|
||||
.SetQueryParam("service_id", request.ServiceId)
|
||||
.SetQueryParam("appid", request.AppId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetPayScoreServiceOrderByQueryIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetPayScoreServiceOrderByQueryIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -114,8 +110,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "serviceorder", request.OutOrderNumber, "cancel")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "serviceorder", request.OutOrderNumber, "cancel");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CancelPayScoreServiceOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -134,8 +129,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "serviceorder", request.OutOrderNumber, "modify")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "serviceorder", request.OutOrderNumber, "modify");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.ModifyPayScoreServiceOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -154,8 +148,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "serviceorder", request.OutOrderNumber, "complete")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "serviceorder", request.OutOrderNumber, "complete");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.SetPayScoreServiceOrderCompleteResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -174,8 +167,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "serviceorder", request.OutOrderNumber, "pay")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "serviceorder", request.OutOrderNumber, "pay");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.SetPayScoreServiceOrderPayResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -194,8 +186,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "payscore", "serviceorder", request.OutOrderNumber, "sync")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "payscore", "serviceorder", request.OutOrderNumber, "sync");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.SetPayScoreServiceOrderSyncResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -31,8 +31,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "pay", "transactions", "app")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "pay", "transactions", "app");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreatePayTransactionAppResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -55,8 +54,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "pay", "transactions", "jsapi")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "pay", "transactions", "jsapi");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreatePayTransactionJsapiResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -78,8 +76,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "pay", "transactions", "h5")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "pay", "transactions", "h5");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreatePayTransactionH5Response>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -101,8 +98,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "pay", "transactions", "native")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "pay", "transactions", "native");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreatePayTransactionNativeResponse >(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -128,11 +124,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "pay", "transactions", "out-trade-no", request.OutTradeNumber)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "pay", "transactions", "out-trade-no", request.OutTradeNumber)
|
||||
.SetQueryParam("mchid", request.MerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetPayTransactionByOutTradeNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetPayTransactionByOutTradeNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -156,11 +151,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "pay", "transactions", "id", request.TransactionId)
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "pay", "transactions", "id", request.TransactionId)
|
||||
.SetQueryParam("mchid", request.MerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetPayTransactionByIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetPayTransactionByIdResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -184,8 +178,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
request.MerchantId = client.WechatMerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "pay", "transactions", "out-trade-no", request.OutTradeNumber, "close")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "pay", "transactions", "out-trade-no", request.OutTradeNumber, "close");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.ClosePayTransactionResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -29,8 +29,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "profitsharing", "orders")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "profitsharing", "orders");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateProfitSharingOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -50,12 +49,11 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "profitsharing", "orders")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "profitsharing", "orders")
|
||||
.SetQueryParam("transaction_id", request.TransactionId)
|
||||
.SetQueryParam("out_order_no", request.OutOrderNumber);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetProfitSharingOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetProfitSharingOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -73,8 +71,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "profitsharing", "return-orders")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "profitsharing", "return-orders");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateProfitSharingReturnOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -94,15 +91,14 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "profitsharing", "return-orders")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "profitsharing", "return-orders")
|
||||
.SetQueryParam("out_order_no", request.OutOrderNumber)
|
||||
.SetQueryParam("out_return_no", request.OutReturnNumber);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.SubMerchantId))
|
||||
flurlReq.SetQueryParam("sub_mchid", request.SubMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetProfitSharingReturnOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetProfitSharingReturnOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -120,8 +116,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "profitsharing", "orders", "unfreeze")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "profitsharing", "orders", "unfreeze");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.SetProfitSharingOrderUnfrozenResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -141,10 +136,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "profitsharing", "transactions", request.TransactionId, "amounts")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "profitsharing", "transactions", request.TransactionId, "amounts");
|
||||
|
||||
return await client.SendRequestAsync<Models.GetProfitSharingTransactionAmountsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetProfitSharingTransactionAmountsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -161,10 +155,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "profitsharing", "merchant-configs", request.SubMerchantId)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "profitsharing", "merchant-configs", request.SubMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetProfitSharingMerchantConfigsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetProfitSharingMerchantConfigsResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -182,8 +175,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "profitsharing", "receivers", "add")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "profitsharing", "receivers", "add");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.AddProfitSharingReceiverResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -203,8 +195,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "profitsharing", "receivers", "delete")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "profitsharing", "receivers", "delete");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.DeleteProfitSharingReceiverResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -40,8 +40,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "refund", "domestic", "refunds")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "refund", "domestic", "refunds");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateRefundDomesticRefundResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -72,13 +71,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "refund", "domestic", "refunds", request.OutRefundNumber)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Get, "refund", "domestic", "refunds", request.OutRefundNumber);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.SubMerchantId))
|
||||
flurlReq.SetQueryParam("sub_mchid", request.SubMerchantId);
|
||||
|
||||
return await client.SendRequestAsync<Models.GetRefundDomesticRefundByOutRefundNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.GetRefundDomesticRefundByOutRefundNumberResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "smartguide", "guides")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "smartguide", "guides");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateSmartGuideResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -50,8 +49,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Post, "smartguide", "guides", request.GuideId, "assign")
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, HttpMethod.Post, "smartguide", "guides", request.GuideId, "assign");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.AssignSmartGuideResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
@ -71,8 +69,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(HttpMethod.Get, "smartguide", "guides")
|
||||
.SetOptions(request)
|
||||
.CreateRequest(request, HttpMethod.Get, "smartguide", "guides")
|
||||
.SetQueryParam("store_id", request.StoreId.ToString());
|
||||
|
||||
if (!string.IsNullOrEmpty(request.SubMerchantId))
|
||||
@ -93,7 +90,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request.Offset.HasValue)
|
||||
flurlReq.SetQueryParam("offset", request.Offset.Value.ToString());
|
||||
|
||||
return await client.SendRequestAsync<Models.QuerySmartGuidesResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
return await client.SendRequestWithJsonAsync<Models.QuerySmartGuidesResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -111,8 +108,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(new HttpMethod("PATCH"), "smartguide", "guides", request.GuideId)
|
||||
.SetOptions(request);
|
||||
.CreateRequest(request, new HttpMethod("PATCH"), "smartguide", "guides", request.GuideId);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.UpdateSmartGuideResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Interceptors
|
||||
}
|
||||
else
|
||||
{
|
||||
body = flurlCall.RequestBody;
|
||||
body = flurlCall.RequestBody ?? string.Empty;
|
||||
}
|
||||
|
||||
string plainText = $"{method}\n{url}\n{timestamp}\n{nonce}\n{body}\n";
|
||||
|
@ -179,7 +179,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
public string ContactIdCardNumber { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置联系邮箱(需使用微信支付平台公钥加密)。与字段 <see cref="OpenId"/> 二选一。
|
||||
/// 获取或设置联系邮箱(需使用微信支付平台公钥加密)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("contact_email")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("contact_email")]
|
||||
|
@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities
|
||||
{
|
||||
internal static class FileNameToContentTypeMapper
|
||||
{
|
||||
public static string? GetContentTypeForImage(string fileName)
|
||||
{
|
||||
string extension = Path.GetExtension(fileName ?? "/")?.ToLower() ?? string.Empty;
|
||||
switch (extension)
|
||||
{
|
||||
case ".jpg":
|
||||
case ".jpeg":
|
||||
return "image/jpeg";
|
||||
case ".bmp":
|
||||
return "image/bmp";
|
||||
case ".png":
|
||||
return "image/png";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string? GetContentTypeForVideo(string fileName)
|
||||
{
|
||||
string extension = Path.GetExtension(fileName ?? "/")?.ToLower() ?? string.Empty;
|
||||
switch (extension)
|
||||
{
|
||||
case ".avi":
|
||||
return "video/x-msvideo";
|
||||
case ".wmv":
|
||||
return "video/x-ms-wmv";
|
||||
case ".mpeg":
|
||||
return "video/mpeg";
|
||||
case ".mov":
|
||||
return "video/quicktime";
|
||||
case ".mkv":
|
||||
return "video/mkv";
|
||||
case ".m4v":
|
||||
return "video/x-m4v";
|
||||
case ".flv":
|
||||
return "video/x-flv";
|
||||
case ".f4v":
|
||||
return "video/x-f4v";
|
||||
case ".rmvb":
|
||||
return "video/vnd.rn-realvideo";
|
||||
case ".mp4":
|
||||
return "video/mp4";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -77,26 +77,51 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用当前客户端生成一个新的 <see cref="IFlurlRequest"/> 对象。
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="method"></param>
|
||||
/// <param name="urlSegments"></param>
|
||||
/// <returns></returns>
|
||||
public IFlurlRequest CreateRequest(WechatTenpayRequest request, HttpMethod method, params object[] urlSegments)
|
||||
{
|
||||
IFlurlRequest flurlRequest = FlurlClient.Request(urlSegments).WithVerb(method);
|
||||
|
||||
if (request.Timeout.HasValue)
|
||||
{
|
||||
flurlRequest.WithTimeout(TimeSpan.FromMilliseconds(request.Timeout.Value));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(request.WechatpayCertSerialNumber))
|
||||
{
|
||||
flurlRequest.Headers.Remove("Wechatpay-Serial");
|
||||
flurlRequest.WithHeader("Wechatpay-Serial", request.WechatpayCertSerialNumber);
|
||||
}
|
||||
|
||||
return flurlRequest;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步发起请求。
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="flurlRequest"></param>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="httpContent"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<T> SendRequestAsync<T>(IFlurlRequest flurlRequest, HttpContent? content = null, CancellationToken cancellationToken = default)
|
||||
public async Task<T> SendRequestAsync<T>(IFlurlRequest flurlRequest, HttpContent? httpContent = null, CancellationToken cancellationToken = default)
|
||||
where T : WechatTenpayResponse, new()
|
||||
{
|
||||
if (content != null)
|
||||
if (httpContent != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(content.Headers.ContentType?.MediaType))
|
||||
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||
if (string.IsNullOrEmpty(httpContent.Headers.ContentType?.MediaType))
|
||||
httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using IFlurlResponse flurlResponse = await base.SendRequestAsync(flurlRequest, content, cancellationToken).ConfigureAwait(false);
|
||||
using IFlurlResponse flurlResponse = await base.SendRequestAsync(flurlRequest, httpContent, cancellationToken).ConfigureAwait(false);
|
||||
return await GetResposneAsync<T>(flurlResponse).ConfigureAwait(false);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
|
@ -4,7 +4,7 @@ using System.Reflection;
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
{
|
||||
/// <summary>
|
||||
/// 一个用于构造 <see cref="WechatApiClient"/> 时使用的配置项。
|
||||
/// 一个用于构造 <see cref="WechatTenpayClient"/> 时使用的配置项。
|
||||
/// </summary>
|
||||
public class WechatTenpayClientOptions
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user