Ejemplo n.º 1
0
        public PaymentResult PaymentCompleted([FromBody] PaymentResult paymentResult)
        {
            if (null == paymentResult || string.IsNullOrEmpty(paymentResult.TradeCode))
            {
                this.ReturnPreconditionFailedMessage();
                return(null);
            }

            LogManager.GetLogger().Info("==>paymentResult[PaymentCompleted]: {0}", TradeSystem.JsonExtension.ToJson(paymentResult));

            var tradeJournal = ObjectIOCFactory.GetSingleton <PaymentEngine>().PaymentCompleted(paymentResult.TradeCode, paymentResult.PayWay, null, paymentResult.PaidDetail);

            if (null != tradeJournal)
            {
                return new PaymentResult()
                       {
                           Success = true, TradeCode = tradeJournal.TradeCode, TargetBizTradeCode = tradeJournal.TargetBizTradeCode
                       }
            }
            ;
            else
            {
                return new PaymentResult()
                       {
                           Success = false, ErrorMessage = "Paid failed."
                       }
            };
        }
Ejemplo n.º 2
0
        static ILog GetSystemLogger()
        {
            var log = ObjectIOCFactory.GetSingleton <SystemLogger>();

            log.Warn("not create a LogFactory");
            return(log);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 获取ILog的指定类别的实例
 /// </summary>
 /// <param name="categoryName"></param>
 /// <returns></returns>
 public static ILog GetLogger(string categoryName)
 {
     if (typeof(ILogFactory).GetMapType().CanCreated() == false)
     {
         return(GetSystemLogger());
     }
     return(ObjectIOCFactory.GetSingleton <ILogFactory>().GetLogger(categoryName));
 }
Ejemplo n.º 4
0
        public PaymentResult QueryTrade(string tradeCode)
        {
            if (string.IsNullOrEmpty(tradeCode))
            {
                return(null);
            }

            return(ObjectIOCFactory.GetSingleton <PaymentEngine>().QueryTrade(tradeCode));
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="productCode"></param>
        /// <param name="queryResult"></param>
        /// <returns></returns>
        public static IDictionary <string, object> ParseQueryResult(string productCode, string queryResult)
        {
            queryResult.AssertNotNull("queryResult");

            var client = ObjectIOCFactory.GetSingleton <SinowayClient>();

            if (null == client.ApiProviders || false == client.ApiProviders.ContainsKey(productCode))
            {
                throw new ArgumentOutOfRangeException("productCode", string.Format("Not support the productCode : {0}", productCode));
            }

            return(client.ApiProviders[productCode].ParseQueryResult(queryResult));
        }