Example #1
0
        public static PaidHandleResult PayReturn <T>(PayMethods pm, PayApiType pt, PayMointor <T> proc) where T : class
        {
            IPay _pay = null;

            if (pm == PayMethods.Alipay)
            {
                if (pt == PayApiType.Direct)
                {
                    _pay = new AlipayRedirect();
                }
                else if (pt == PayApiType.Normal)
                {
                    _pay = new AlipayNormal();
                }
                else if (pt == PayApiType.Mobile)
                {
                    _pay = new AlipayMobile();
                }
                else
                {
                    _pay = new AlipayComfireApi();
                }
            }
            else if (pm == PayMethods.Tenpay)
            {
                //财付通默认支持所有
                _pay = new Tenpay.Tenpay();
            }
            else if (pm == PayMethods.ChinaPay)
            {
                _pay = new ChinaPayApi();
            }


            if (_pay == null)
            {
                SetLogMessage("不支持的支付方式");
                return(PaidHandleResult.Fail);
            }
            else
            {
                return(_pay.Return(proc));
            }
        }
Example #2
0
        /// <summary>
        /// 获取网关地址
        /// </summary>
        /// <param name="pm"></param>
        /// <param name="pt"></param>
        /// <param name="ht"></param>
        /// <returns></returns>
        public static string GetGatewayStr(PayMethods pm, PayApiType pt, Hashtable ht)
        {
            IPay _pay = null;

            if (pm == PayMethods.Alipay)
            {
                if (ht.Contains("bank"))
                {
                    pt = PayApiType.Direct;
                }

                if (pt == PayApiType.Direct)
                {
                    _pay = new AlipayRedirect();
                }
                else if (pt == PayApiType.Normal)
                {
                    _pay = new AlipayNormal();
                }
                else if (pt == PayApiType.Mobile)
                {
                    _pay = new AlipayMobile();
                }
                else
                {
                    _pay = new AlipayComfireApi();
                }
            }
            else if (pm == PayMethods.Tenpay)
            {
                //财付通默认支持所有
                _pay = new Tenpay.Tenpay();
            }
            else if (pm == PayMethods.ChinaPay)
            {
                _pay = new ChinaPayApi();
            }


            return(_pay == null ? String.Empty : _pay.GetPayRequest(ht));
        }
Example #3
0
        public static string PayNotify <T>(PayMethods pm, PayApiType pt, PayMointor <T> proc) where T : class
        {
            IPay _pay = null;

            if (pm == PayMethods.Alipay)
            {
                if (pt == PayApiType.Direct)
                {
                    _pay = new AlipayRedirect();
                }
                else if (pt == PayApiType.Normal)
                {
                    _pay = new AlipayNormal();
                }
                else if (pt == PayApiType.Mobile)
                {
                    _pay = new AlipayMobile();
                }
                else
                {
                    _pay = new AlipayComfireApi();
                }
            }
            else if (pm == PayMethods.Tenpay)
            {
                //财付通默认支持所有
                _pay = new Tenpay.Tenpay();
            }
            else if (pm == PayMethods.ChinaPay)
            {
                _pay = new ChinaPayApi();
            }


            return(_pay == null ? "不支持的支付方式" : _pay.Notify(proc));
        }