Exemplo n.º 1
0
        /// <summary>
        /// 创建线下支付通道
        /// </summary>
        /// <param name="platformType"></param>
        /// <param name="sourceOption"></param>
        /// <returns></returns>
        private IPaymentService CreateOffline(PaymentPlatformType platformType, BrowserType sourceOption = BrowserType.Wechat, string acsSubNo = "")
        {
            //var flag = Convert.ToBoolean(AppSettingsHelper.Configuration["ConfigConstants.IsOpenAcsPayment"]);
            switch (platformType)
            {
            case PaymentPlatformType.Alipay:
                //中金暂不支持支付宝支付,这里启用公司支付宝
                //if (flag)
                //{
                //    return new AcsPayment(sourceOption);
                //}
                return(new AlipayPayment(sourceOption));

            //case PaymentPlatformType.Zhongjin:
            //    return new AcsPayment(sourceOption);
            case PaymentPlatformType.Wechat:
                //if (flag && !acsSubNo.IsNullOrWhiteSpace() && !ConfigConstants.PaymentWechatStore.Contains(StoreId))
                //{
                //    return new AcsPayment(sourceOption);
                //}
                return(new WechatPayment(sourceOption));

            //case PaymentPlatformType.Blance:
            //    return new BalancePayment(sourceOption);
            default:
                throw new PaymentException("未找到可以使用的支付通道");
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 创建第三方实现对象
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="type"></param>
 /// <param name="platformType"></param>
 /// <param name="sourceOption"></param>
 /// <returns></returns>
 public T Create <T>(PaymentType type, PaymentPlatformType platformType, BrowserType sourceOption = BrowserType.Wechat, string acsSubNo = "") where T : IThird
 {
     if (type == PaymentType.Online)
     {
         return((T)CreateOnline(platformType, sourceOption));
     }
     else
     {
         return((T)CreateOffline(platformType, sourceOption, acsSubNo));
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 创建线上支付通道
        /// </summary>
        /// <param name="platformType"></param>
        /// <param name="sourceOption"></param>
        /// <returns></returns>
        private IPaymentService CreateOnline(PaymentPlatformType platformType, BrowserType sourceOption = BrowserType.Wechat)
        {
            switch (platformType)
            {
            case PaymentPlatformType.Alipay:
                return(new AlipayPayment(sourceOption));

            case PaymentPlatformType.Wechat:
                return(new WechatPayment(sourceOption));

            //case PaymentPlatformType.Blance:
            //    return new BalancePayment(sourceOption);
            default:
                throw new PaymentException("未找到可以使用的支付通道");
            }
        }