/ // <summary>
/// post 生成支付订单
/// </summary>
/// <param name="order"></param>
/// <returns></returns>
public static dynamic PostGetPayCode_New(PayOrder order)
{
string str = string.Empty;
Dictionary<string, object> dir = new Dictionary<string, object>();
dir.Add("name", order.Title);
dir.Add("pay_type", "alipay");
dir.Add("price", order.PayAmount);
dir.Add("order_id", order.OrderNo);
dir.Add("notify_url", _callBack_Url);
foreach (var item in dir)
{
str += item.Value;
}
string sign = MD5Encryption.Encryption(str+_appSecretKey);
dir.Add("order_uid", order.OrderUserId);
dir.Add("expire", _expire_In);
dir.Add("more",order.More);
dir.Add("sign", sign);
var url = $"{_pay_Code_api}{_app_Id}";
var resData = HttpHelper.PostData(url, dir);
//{ "status": "ok", "info": { "qr": "https://qr.alipay.com/bax01068kxbbcz2r799i007c"}, "expires_in": "900", "aoid": "67736d7057d6465791c24a513afb52a7"}
return JsonConvert.DeserializeObject<dynamic>(resData);
}
#region 支付回调
/// <summary>
/// 支付回调
/// </summary>
/// <returns></returns>
public ApiResponse Pay_CallBack()
{
try
{
string aoid = HttpContextCore.Current.Request.Form["aoid"];
string detail = HttpContextCore.Current.Request.Form["detail"];
string more = HttpContextCore.Current.Request.Form["more"]; ;
string order_id = HttpContextCore.Current.Request.Form["order_id"];
string pay_price = HttpContextCore.Current.Request.Form["pay_price"];
string pay_time = HttpContextCore.Current.Request.Form["pay_time"];
string sign = HttpContextCore.Current.Request.Form["sign"];
_logger.Info(LogType.订单支付跟踪, "----------订单回调通知接收参数----------");
_logger.Info(LogType.订单支付跟踪, $"aoid:{aoid},detail:{detail},more:{more},order_id:{order_id},pay_price:{pay_price},pay_time:{pay_time},sign:{sign}");
//获取回调参数
if (!string.IsNullOrWhiteSpace(sign))
{
string parameters = $"{aoid}{order_id}{pay_price}{pay_time}";
//验证签名
if (FuBeiHelper.CheckNotify_New(parameters, sign))
{
if (!string.IsNullOrWhiteSpace(more))
{
var dyn = JsonConvert.DeserializeObject<ContentInfo>(more);
//业务逻辑处理
}
}
}
return Success();
}
catch (Exception ex)
{
return Error("支付回调业务处理异常");
}
}
#endregion
标签:string,C#,pay,Add,sign,二维码,xorpay,order,dir From: https://www.cnblogs.com/guangzhiruijie/p/16985533.html