Ejemplo n.º 1
0
        public void GetExtraOrderInfo(string orderId, LogNode parentNode = null)
        {
            LogNode onlinePaysLog = null;

            if (parentNode != null)
            {
                onlinePaysLog = parentNode.AddSubNode("Online payments:");
            }
            else
            {
                onlinePaysLog = LogNode.Create("Online payments:");
            }

            List <OnlinePayment> onlinePays = this.Ctx.OnlinePayment.Where(op => op.ObjectId == orderId).ToList();

            foreach (OnlinePayment olPay in onlinePays)
            {
                LogNode olPayLog = onlinePaysLog.AddSubNode("Online payment € {0}", olPay.Amount);
                olPayLog.AddItem("Created at: {0} - Updated at: {1}", olPay.CreatedAt.ToString(), olPay.UpdatedAt.ToString());

                if (!string.IsNullOrWhiteSpace(olPay.FinalAutoResponse))
                {
                    LogNode finalAutoResponseLog = olPayLog.AddSubNode("FinalAutoResponse");

                    WorldlinePayment worldline = new WorldlinePayment(WorldlinePaymentType.Acquirer, olPay.FinalAutoResponse);

                    //string codeInfo = worldline.ResponseCodeInfo;


                    finalAutoResponseLog.AddItem("Response code: {0} = {1}", worldline.ResponseCode, worldline.ResponseCodeInfo);
                    finalAutoResponseLog.AddItem("TransactionDateTime: {0}", worldline.TransactionDateTime);
                    finalAutoResponseLog.AddItem("PaymentMeanBrand: {0}", worldline.PaymentMeanBrand);
                }
                else
                {
                    olPayLog.AddSubNode("No autoresponse available!");
                }
            }

            /*
             * LogNode orderLog = LogNode.Create("Order id='{0}'", this.Id);
             *
             * LogNode orderLog = LogNode.Create("Info about order");
             *
             *
             * OrderSvc orderSvc = new OrderSvc();
             *
             * Order order = orderSvc.GetOrder(orderId, this.Ctx);
             *
             * if (order.OrderLines != null)
             * {
             *  foreach (var orderLine in order.OrderLines)
             *  {
             *      orderLog.AddSubNode("{0} x {1}", orderLine.Quantity, orderLine.Description);
             *  }
             * }
             */
        }
            private void OnLogMessageReceived(string logMessage, string stackTrace, LogType logType)
            {
                if (logType == LogType.Assert)
                {
                    logType = LogType.Error;
                }

                m_LogNodes.Enqueue(LogNode.Create(logType, logMessage, stackTrace));
                while (m_LogNodes.Count > m_MaxLine)
                {
                    ReferencePool.Release(m_LogNodes.Dequeue());
                }
            }