Beispiel #1
0
        public static string AlipayRefundRequest(string _notify_url, List <alipayReturnInfo> RefundList)
        {
            string       str;
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);

            if (!masterSettings.EnableAlipayRequest)
            {
                str = "支付宝支付功能未开启,无法完成支付!";
            }
            else if ((masterSettings.Alipay_Pid == "" || masterSettings.Alipay_Key == "" || masterSettings.Alipay_mid == "" ? false : !(masterSettings.Alipay_mName == "")))
            {
                string alipayPid   = masterSettings.Alipay_Pid;
                string alipayKey   = masterSettings.Alipay_Key;
                string alipayMid   = masterSettings.Alipay_mid;
                string alipayMName = masterSettings.Alipay_mName;
                string str1        = "utf-8";
                Hidistro.ControlPanel.OutPay.App.Core.setConfig(alipayPid, "MD5", alipayKey, str1);
                string        _notifyUrl = _notify_url;
                string        alipayMid1 = masterSettings.Alipay_mid;
                string        str2       = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                string        str3       = RefundHelper.GenerateRefundOrderId();
                string        str4       = RefundList.Count.ToString();
                string        str5       = "";
                List <string> strs       = new List <string>();
                foreach (alipayReturnInfo refundList in RefundList)
                {
                    string[] remark = new string[] { refundList.alipaynum, "^", null, null, null };
                    remark[2] = refundList.refundNum.ToString("F2");
                    remark[3] = "^";
                    remark[4] = refundList.Remark;
                    strs.Add(string.Concat(remark));
                }
                str5 = string.Join("#", strs);
                SortedDictionary <string, string> strs1 = new SortedDictionary <string, string>()
                {
                    { "partner", alipayPid },
                    { "_input_charset", str1 },
                    { "service", "refund_fastpay_by_platform_pwd" },
                    { "notify_url", _notifyUrl },
                    { "seller_email", alipayMid1 },
                    { "refund_date", str2 },
                    { "batch_no", str3 },
                    { "batch_num", str4 },
                    { "detail_data", str5 }
                };
                str = Hidistro.ControlPanel.OutPay.App.Core.BuildRequest(strs1, "get", "确认");
            }
            else
            {
                str = "支付宝参数设置错误,请检查支付宝配置参数!";
            }
            return(str);
        }
Beispiel #2
0
        public static string AlipayRefundRequest(string _notify_url, List <alipayReturnInfo> RefundList)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            string       result;

            if (!masterSettings.EnableAlipayRequest)
            {
                result = "支付宝支付功能未开启,无法完成支付!";
            }
            else if (masterSettings.Alipay_Pid == "" || masterSettings.Alipay_Key == "" || masterSettings.Alipay_mid == "" || masterSettings.Alipay_mName == "")
            {
                result = "支付宝参数设置错误,请检查支付宝配置参数!";
            }
            else
            {
                string alipay_Pid   = masterSettings.Alipay_Pid;
                string alipay_Key   = masterSettings.Alipay_Key;
                string alipay_mid   = masterSettings.Alipay_mid;
                string alipay_mName = masterSettings.Alipay_mName;
                string text         = "utf-8";
                App.Core.setConfig(alipay_Pid, "MD5", alipay_Key, text);
                string        alipay_mid2 = masterSettings.Alipay_mid;
                string        value       = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                string        value2      = RefundHelper.GenerateRefundOrderId();
                string        value3      = RefundList.Count.ToString();
                List <string> list        = new List <string>();
                foreach (alipayReturnInfo current in RefundList)
                {
                    list.Add(string.Concat(new string[]
                    {
                        current.alipaynum,
                        "^",
                        current.refundNum.ToString("F2"),
                        "^",
                        current.Remark
                    }));
                }
                string value4 = string.Join("#", list);
                string text2  = App.Core.BuildRequest(new SortedDictionary <string, string>
                {
                    {
                        "partner",
                        alipay_Pid
                    },
                    {
                        "_input_charset",
                        text
                    },
                    {
                        "service",
                        "refund_fastpay_by_platform_pwd"
                    },
                    {
                        "notify_url",
                        _notify_url
                    },
                    {
                        "seller_email",
                        alipay_mid2
                    },
                    {
                        "refund_date",
                        value
                    },
                    {
                        "batch_no",
                        value2
                    },
                    {
                        "batch_num",
                        value3
                    },
                    {
                        "detail_data",
                        value4
                    }
                }, "get", "确认");
                result = text2;
            }
            return(result);
        }