示例#1
0
        /// <summary>
        /// 页面回调
        /// </summary>
        /// <param name="pmid"></param>
        /// <param name="ptid">接口类型ID</param>
        /// <returns></returns>
        public PaidHandleResult Return(PayMethods pm, PayApiType pt, PayMointor <T> proc)
        {
            PaidHandleResult result;

            //PayMointor<string> proc = new PayMointor<string>(String.Empty);
            //proc.OnInit += orderNo =>
            //{
            //    proc.Instance=
            //};

            this.AttachEvent(proc);

            // PayMethods pm = (PayMethods)pmid;                //支付方式
            //PayApiType pt = (PayApiType)ptid;                //接口类型

            result = PayUtil.PayReturn(pm, pt, proc);
            if (result == PaidHandleResult.Success)
            {
                proc.PaidSuccess();
            }
            else if (result == PaidHandleResult.Fail)
            {
                proc.PaidFail();
            }
            return(result);
        }
示例#2
0
 private void AttachEvent(PayMointor <T> proc)
 {
     if (proc == null)
     {
         throw new ArgumentNullException("参数proc不能为空!");
     }
     else
     {
         //添加事件
         proc.OnFailed    += OnOrderPaidFail;
         proc.OnSuccessed += OnOrderPaidSuccess;
         proc.OnRepairPay += OnOrderRepairPay;
     }
 }
示例#3
0
        /// <summary>
        /// 主动通知
        /// </summary>
        /// <param name="ppid"></param>
        /// <returns></returns>
        public string Notify(PayMethods pm, PayApiType pt, PayMointor <T> proc)
        {
            // PaidMointor<T> proc = new PaidMointor<T>(null);

            // proc.OnInit += orderNo =>
            // {
            // var itm = this.LoadOrderPM(orderNo.ToString());
            //proc.Instance = itm.Instance;
            // this.AttachEvent(proc);
            // };

            this.AttachEvent(proc);

            return(PayUtil.PayNotify(pm, pt, proc));
        }
示例#4
0
文件: PayUtil.cs 项目: zyuhua/devfw
        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));
            }
        }
示例#5
0
文件: PayUtil.cs 项目: zyuhua/devfw
        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));
        }