QiFeng.ZWY.Utility/AlipaySignHelper.cs

(开头部分) 15KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using System.Security.Cryptography;
using Newtonsoft.Json;
using System.Text;

namespace QiFeng.LMSD.Utility
{
    public class AlipaySignHelper
    {
        #region Use


        /// <summary>
        /// 得到支付宝加签后的字符串
        /// </summary>
        /// <param name="appId">商户APPID</param>
        /// <param name="privateKey">应用私钥</param>
        /// <param name="notifyUrl">回调地址</param>
        /// <param name="orderNo">订单号</param>
        /// <param name="money">金额</param>
        /// <param name="subject">订单标题</param>
        /// <param name="body">对交易或商品的描述</param>
        /// <returns></returns>
        public static string GETRSASign(string appId, string privateKey, string notifyUrl, string orderNo, string money, string subject, string body)
        {
            if (string.IsNullOrEmpty(appId) || string.IsNullOrEmpty(privateKey) || string.IsNullOrEmpty(notifyUrl) || string.IsNullOrEmpty(orderNo) || string.IsNullOrEmpty(money) || string.IsNullOrEmpty(body) || string.IsNullOrEmpty(subject))
                throw new FormatException("请求参数全部不可为空");

            //交易金额
            double total_fee = new double();
            if (!double.TryParse(money, out total_fee))
                throw new FormatException("金额格式不正确");
            //商户私钥
            string privateKeyPem = privateKey;
            //订单号
            string out_trade_no = orderNo;
            //app支付,支付宝中该应用的ID
            string app_id = appId;
            //utf-8
            string charset = "utf-8";
            string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            //回调地址
            string notify_url = notifyUrl;
            string sign_type = @"RSA2";

            Dictionary<string, string> dic = new Dictionary<string, string>();

            //Dictionary<string, object> dic2 = new Dictionary<string, object>();
            dic.Add("app_id", app_id);
            dic.Add("method", "alipay.trade.app.pay");
            dic.Add("version", @"1.0");
            dic.Add("charset", charset);
            dic.Add("notify_url", notify_url);
            dic.Add("sign_type", sign_type);
            dic.Add("timestamp", timestamp);

后面还有 332 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。