C#微信提现功能

1. 今天第一次了解微信提现功能,主要就是提供appid,appsercert,keys,商户号等

2. 先在微信公众号中开通【企业付款到用户零钱】,下载关于商户号的p12文件

.............

//引用都是必须的
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
using System.Xml;
using Hidistro.Entities.OutPay;
using Hidistro.ControlPanel.OutPay;

    public class OutPayHelp
	{
		// Token: 0x060003DC RID: 988 RVA: 0x00014B74 File Offset: 0x00012D74
		

		// Token: 0x060003E1 RID: 993 RVA: 0x000155D8 File Offset: 0x000137D8
		public static string BuildRequest(SortedDictionary<string, string> sParaTemp, string strMethod, string strButtonValue, string _key, string _input_charset)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			dictionary = OutPayHelp.BuildRequestPara(sParaTemp, _key, _input_charset);
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(string.Concat(new string[]
			{
				"<form id='alipaysubmit' name='alipaysubmit' action='",
				OutPayHelp.GATEWAY_NEW,
				"_input_charset=",
				_input_charset,
				"' method='",
				strMethod.ToLower().Trim(),
				"'>"
			}));
			foreach (KeyValuePair<string, string> current in dictionary)
			{
				stringBuilder.Append(string.Concat(new string[]
				{
					"<input type='hidden' name='",
					current.Key,
					"' value='",
					current.Value,
					"'/>"
				}));
			}
			stringBuilder.Append("<input type='submit' value='" + strButtonValue + "' style='display:none;'></form>");
			stringBuilder.Append("<script>document.forms['alipaysubmit'].submit();</script>");
			return stringBuilder.ToString();
		}

		// Token: 0x060003E3 RID: 995 RVA: 0x00015754 File Offset: 0x00013954
		private static string BuildRequestMysign(Dictionary<string, string> sPara, string _key, string _input_charset)
		{
			string prestr = OutPayHelp.CreateLinkString(sPara);
			return OutPayHelp.Sign(prestr, _key, _input_charset);
		}

		// Token: 0x060003E2 RID: 994 RVA: 0x0001570C File Offset: 0x0001390C
		private static Dictionary<string, string> BuildRequestPara(SortedDictionary<string, string> sParaTemp, string _key, string _input_charset)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			dictionary = OutPayHelp.FilterPara(sParaTemp);
			string value = OutPayHelp.BuildRequestMysign(dictionary, _key, _input_charset);
			dictionary.Add("sign", value);
			dictionary.Add("sign_type", "MD5");
			return dictionary;
		}

		// Token: 0x060003E5 RID: 997 RVA: 0x00015844 File Offset: 0x00013A44
		public static string CreateLinkString(Dictionary<string, string> dicArray)
		{
			StringBuilder stringBuilder = new StringBuilder();
			foreach (KeyValuePair<string, string> current in dicArray)
			{
				stringBuilder.Append(current.Key + "=" + current.Value + "&");
			}
			int length = stringBuilder.Length;
			stringBuilder.Remove(length - 1, 1);
			return stringBuilder.ToString();
		}

		// Token: 0x060003E4 RID: 996 RVA: 0x00015778 File Offset: 0x00013978
		public static Dictionary<string, string> FilterPara(SortedDictionary<string, string> dicArrayPre)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			foreach (KeyValuePair<string, string> current in dicArrayPre)
			{
				if (current.Key.ToLower() != "sign" && current.Key.ToLower() != "sign_type" && current.Value != "" && current.Value != null)
				{
					dictionary.Add(current.Key, current.Value);
				}
			}
			return dictionary;
		}

		// Token: 0x060003DA RID: 986 RVA: 0x00014A90 File Offset: 0x00012C90
		public static string GetMD5(string myString, string _input_charset = "utf-8")
		{
			MD5 mD = new MD5CryptoServiceProvider();
			byte[] bytes = Encoding.GetEncoding(_input_charset).GetBytes(myS
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值