示例#1
0
        /// <summary>
        /// 注入支付服务
        /// </summary>
        /// <param name="cissyConfigBuilder"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        public static CissyConfigBuilder AddPaymentConfig(this CissyConfigBuilder cissyConfigBuilder)
        {
            ICissyConfig cissyConfig = cissyConfigBuilder.CissyConfig;

            if (cissyConfig.IsNotNull())
            {
                PaymentConfig payConfig = cissyConfig.GetConfig <PaymentConfig>();
                if (payConfig.IsNotNull())
                {
                    var factory = new DefaultPayAppFactory(payConfig);
                    cissyConfigBuilder.ServiceCollection.AddSingleton(typeof(IPayAppFactory), factory);
                }
            }
            cissyConfigBuilder.RegisterMapper(register =>
            {
                register.CreateMap <PaymentRequest, PaymentArg>().ForMember(b => b.AppName, n => n.Ignore());
            });
            return(cissyConfigBuilder);
        }
示例#2
0
 public DefaultPayApp(PaymentConfig config)
 {
     _config = config;
 }
示例#3
0
 public DefaultPayAppFactory(PaymentConfig config)
 {
     _config = config;
 }