Commit b300bb1d authored by 吴春's avatar 吴春

修改支付信息

parent c281b81f
......@@ -46,13 +46,12 @@ namespace Mall.WebApi.App_Code
/// <returns></returns>
public static string GetMinUnifiedOrder(string sOrderNo, string sProductName, decimal dPrice, string CustomerId, string openid, RB_MiniProgram_Extend model, IHttpContextAccessor _accessor)
{
App_Code.PayUtil payUtil = new App_Code.PayUtil();
var req = new Common.Pay.WeChatPat.RequestHandler();
req.SetKey(model.WeChatApiSecret);
//
req.SetParameter("appid", model.MiniAppId);//微信开放平台审核通过的应用APPID
req.SetParameter("mch_id", model.WeChatPayMerchants);//微信支付分配的商户号
req.SetParameter("nonce_str", payUtil.GetNoncestr());//随机字符串,不长于32位
req.SetParameter("nonce_str", GetNoncestr());//随机字符串,不长于32位
req.SetParameter("body", sProductName);
req.SetParameter("attach", CustomerId);
req.SetParameter("out_trade_no", sOrderNo);
......@@ -209,8 +208,6 @@ namespace Mall.WebApi.App_Code
/// <returns></returns>
public BaseResult Refund(PayParam param, RB_MiniProgram_Extend model, IHttpContextAccessor _accessor)
{
App_Code.PayUtil payUtil = new App_Code.PayUtil();
if (param.TotalFee == null || param.RefundFee == null || string.IsNullOrWhiteSpace(param.OrderNumber) || string.IsNullOrWhiteSpace(param.RefundNumber))
{
return new BaseResult() { IsSuccess = false, Message = "参数错误!" };
......@@ -220,7 +217,7 @@ namespace Mall.WebApi.App_Code
packageReq.SetKey(model.WeChatApiSecret);
packageReq.SetParameter("appid", model.MiniAppId);
packageReq.SetParameter("mch_id", model.WeChatPayMerchants);
packageReq.SetParameter("nonce_str", payUtil.GetNoncestr());
packageReq.SetParameter("nonce_str", GetNoncestr());
//packageReq.SetParameter("transaction_id", param.OrderNumber);
packageReq.SetParameter("out_trade_no", param.OrderNumber);
packageReq.SetParameter("out_refund_no", param.RefundNumber);
......@@ -265,7 +262,7 @@ namespace Mall.WebApi.App_Code
packageReq.SetKey(model.WeChatApiSecret);
packageReq.SetParameter("appid", model.MiniAppId);
packageReq.SetParameter("mch_id", model.WeChatPayMerchants);
packageReq.SetParameter("nonce_str", payUtil.GetNoncestr());
packageReq.SetParameter("nonce_str", GetNoncestr());
packageReq.SetParameter("sign", packageReq.CreateMd5Sign(_accessor));
packageReq.SetParameter("out_refund_no", param.RefundNumber);
......@@ -303,15 +300,15 @@ namespace Mall.WebApi.App_Code
/// <param name="CustomerId"></param>
/// <param name="openid"></param>
/// <returns></returns>
private string GetTransfersOrder(string sOrderNo, string sProductName, decimal dPrice, string CustomerId, string openid, RB_MiniProgram_Extend model, IHttpContextAccessor _accessor)
private static string GetTransfersOrder(string sOrderNo, string sProductName, decimal dPrice, string CustomerId, string openid, RB_MiniProgram_Extend model, IHttpContextAccessor _accessor)
{
App_Code.PayUtil payUtil = new App_Code.PayUtil();
var req = new Common.Pay.WeChatPat.RequestHandler();
req.SetKey(model.WeChatApiSecret);
//
req.SetParameter("mch_appid", model.MiniAppId);//微信开放平台审核通过的应用APPID
req.SetParameter("mchid", model.WeChatPayMerchants);//微信支付分配的商户号
req.SetParameter("nonce_str", payUtil.GetNoncestr());//随机字符串,不长于32位
req.SetParameter("nonce_str", GetNoncestr());//随机字符串,不长于32位
req.SetParameter("sign", req.CreateMd5Sign(_accessor));
req.SetParameter("partner_trade_no", sProductName);//商户订单号,需保持唯一性(只能是字母或者数字,不能包含有其它字符)
req.SetParameter("openid", openid);
......@@ -340,8 +337,8 @@ namespace Mall.WebApi.App_Code
payReq.SetKey(model.WeChatApiSecret);
payReq.SetParameter("appId", model.MiniAppId);
// req.SetParameter("mch_id", EheMall.WeChat.Common.WeChatConfig.GetOpenMchID());//微信支付分配的商户号
payReq.SetParameter("timeStamp", payUtil.GetTimestamp());
payReq.SetParameter("nonceStr", payUtil.GetNoncestr());
payReq.SetParameter("timeStamp", GetTimestamp());
payReq.SetParameter("nonceStr", GetNoncestr());
payReq.SetParameter("package", "prepay_id=" + prepayId);
payReq.SetParameter("signType", "MD5");
//创建签名
......@@ -364,7 +361,7 @@ namespace Mall.WebApi.App_Code
/// 获取随机字符串
/// </summary>
/// <returns></returns>
public string GetNoncestr()
public static string GetNoncestr()
{
var random = new Random();
return SecurityHelper.MD5EncryptWeChat(random.Next(1000).ToString(CultureInfo.InvariantCulture), "GBK");
......@@ -374,7 +371,7 @@ namespace Mall.WebApi.App_Code
/// 获取时间戳
/// </summary>
/// <returns></returns>
public string GetTimestamp()
public static string GetTimestamp()
{
var ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
return Convert.ToInt64(ts.TotalSeconds).ToString(CultureInfo.InvariantCulture);
......@@ -386,7 +383,7 @@ namespace Mall.WebApi.App_Code
/// <param name="instr"></param>
/// <param name="charset">默认值:utf-8</param>
/// <returns></returns>
public string UrlEncode(string instr, string charset)
public static string UrlEncode(string instr, string charset)
{
if (instr == null || instr.Trim() == "")
return "";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment