Exemplo n.º 1
0
        /// <summary>
        /// 用于企业向微信用户个人付款
        /// 目前支持向指定微信用户的openid付款
        /// </summary>
        /// <param name="dataInfo">微信支付需要post的xml数据</param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static TransfersResult Transfers(TenPayV3TransfersRequestData dataInfo, string cert, string certPassword, int timeOut = Config.TIME_OUT)
        {
            var    url             = ReurnPayApiUrl("https://api.mch.weixin.qq.com/{0}mmpaymkttransfers/promotion/transfers");
            var    data            = dataInfo.PackageRequestHandler.ParseXML();
            string responseContent = CertPost(cert, certPassword, data, url);

            return(new TransfersResult(responseContent));
        }
Exemplo n.º 2
0
        /// <summary>
        ///【异步方法】 用于企业向微信用户个人付款
        /// 目前支持向指定微信用户的openid付款
        /// </summary>
        /// <param name="dataInfo">微信支付需要post的xml数据</param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static async Task <TransfersResult> TransfersAsync(TenPayV3TransfersRequestData dataInfo, string cert, string certPassword, int timeOut = Config.TIME_OUT)
        {
            var    url             = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers";
            var    data            = dataInfo.PackageRequestHandler.ParseXML();
            string responseContent = await CertPostAsync(cert, certPassword, data, url);

            return(new TransfersResult(responseContent));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 用于企业向微信用户个人付款
        /// 目前支持向指定微信用户的openid付款
        /// </summary>
        /// <param name="dataInfo">微信支付需要post的xml数据</param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static TransfersResult Transfers(TenPayV3TransfersRequestData dataInfo, int timeOut = Config.TIME_OUT)
        {
            var          urlFormat     = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers";
            var          data          = dataInfo.PackageRequestHandler.ParseXML();
            var          formDataBytes = data == null ? new byte[0] : Encoding.UTF8.GetBytes(data);
            MemoryStream ms            = new MemoryStream();

            ms.Write(formDataBytes, 0, formDataBytes.Length);
            ms.Seek(0, SeekOrigin.Begin);//设置指针读取位置
            var result = RequestUtility.HttpPost(urlFormat, null, ms, timeOut: timeOut);

            return(new TransfersResult(result));
        }