Beispiel #1
0
        public TransactionReport GetTransactionReport(OrderResponse response, ReportReturnType returnType)
        {
            CheckInitialized();
            var error = "unknown";
            var requestResult = RequestResultType.Error;
            var reportData = "";
            var orderStatus = "";

            OrderType type = response.OrderType;

            if (TestMode)
            {
                reportData = "This is a test order report. Order ID: ( " + response.OrderID + " ) Type: ( " + type.ToString() + " )";
                requestResult = RequestResultType.TestMode;
                orderStatus = "Test Mode.";
                error = "none";
            }
            else
            {
                try
                {
                    var location = new StringBuilder(_url);

                    if (type == OrderType.FaxMessage) // test for FaxMessage/TL since it's url doesn't follow the convention
                    {
                        location.Append(@"/");
                        location.Append(OrderTypeUtil.GetCode(type));
                        location.Append("ReportByUnqid.aspx?");
                    }
                    else
                    {
                        location.Append(@"/");
                        location.Append(OrderTypeUtil.GetCode(type));
                        location.Append("report.aspx?");
                    }

                    location.Append("UserName="******"&UserPassword="******"&ReturnType=");
                    location.Append(returnType.ToString());

                    if (type == OrderType.EmailMessage || type == OrderType.SMSMessage ||
                        type == OrderType.VoiceMessage || type == OrderType.FaxMessage)
                    {
                        location.Append("&Unqid=");
                        location.Append(response.Unqid);
                    }

                    location.Append("&OrderID=");
                    location.Append(response.OrderID);

                    reportData = webClientProxy.UploadString(location.ToString(), "");

                    requestResult = RequestResultType.Success;
                    error = "none";

                    var xmlDoc = new XmlDocument();
                    xmlDoc.LoadXml(reportData);
                    //assumes there is only one of this kind of tag
                    var xnList = xmlDoc.SelectNodes("/PostAPIResponse/SaveTransactionalOrderResult");
                    foreach (XmlNode xn in xnList)
                    {
                        try
                        {
                            orderStatus = xn["status"].InnerText;
                        }
                        catch (NullReferenceException)
                        {
                            requestResult = RequestResultType.Error;
                            error = xn["Exception"].InnerText;
                        }
                    }
                }
                catch (Exception ex)
                {
                    requestResult = RequestResultType.Error;
                    error = "An error occurred while requesting the order report. " + ex.ToString();
                }
            }

            return new TransactionReport()
            {
                OrderID = response.OrderID,
                Unqid = response.Unqid,
                OrderType = response.OrderType,
                RequestResult = requestResult,
                RequestErrorMessage = error,
                OrderStatus = orderStatus,
                ReportData = reportData,
            };
        }
Beispiel #2
0
 /// <summary>
 /// Gets a report for the associated message using the message's transactionID
 /// </summary>
 public TransactionReport GetTransactionReport(string transactionID, OrderType type, ReportReturnType returnType)
 {
     CheckInitialized();
     return GetTransactionReport(new OrderResponse() { Unqid = transactionID, OrderType = type }, returnType);
 }
Beispiel #3
0
 /// <summary>
 /// Gets a report for the associated broadcast or message
 /// </summary>
 public OrderReport GetOrderReport(int OrderID, OrderType type, ReportReturnType returnType)
 {
     CheckInitialized();
     return GetOrderReport(new OrderResponse() { OrderID = OrderID, OrderType = type }, returnType);
 }
Beispiel #4
0
 public OrderReport GetOrderReport(OrderResponse response, ReportReturnType returnType)
 {
     CheckInitialized();
     var trans = GetTransactionReport(response, returnType);
     return new OrderReport()
         {
             OrderID = trans.OrderID,
             OrderType = trans.OrderType,
             RequestResult = trans.RequestResult,
             RequestErrorMessage = trans.RequestErrorMessage,
             OrderStatus = trans.OrderStatus,
             ReportData = trans.ReportData
         };
 }
Beispiel #5
0
        /// <summary>
        /// Returns a collection of contact lists associated with the user.
        /// </summary>
        public string GetLists(ReportReturnType returnType)
        {
            CheckInitialized();
            var location = new StringBuilder();
            location.Append(_url);
            location.Append("/xml/lists.aspx?");
            location.Append("UserName="******"&UserPassword="******"&ReturnType=");
            location.Append(returnType.ToString());

            return webClientProxy.DownloadString(location.ToString());
        }