public override void SetupData(XmlDocument doc)
        {
            XmlNodeList methods = null;

            try {
                methods = doc.DocumentElement.SelectNodes("/Transaction/Receipt/Payment");

                int counter = 0;
                foreach (XmlNode paymentNode in methods)
                {
                    csvData.Add(new List <string>());
                    csvData[counter].Add(SummaTransactionCommon.GetTransactionId(doc));
                    csvData[counter].Add(SummaPaymentMethodsCommon.GetPaymentId(paymentNode));
                    csvData[counter].Add(SummaPaymentMethodsCommon.GetCardNumber(paymentNode));
                    csvData[counter].Add(SummaPaymentMethodsCommon.GetSalesValue(paymentNode));
                    csvData[counter].Add(SummaTransactionCommon.GetStoreId(doc));

                    counter++;

                    csvLineData.Add(new StringBuilder());
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing transaction payment methods", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Exemple #2
0
        /// <summary>
        /// Setup internal data values for each product.
        /// </summary>
        /// <param name="doc"></param>
        public override void SetupData(XmlDocument doc) {

            XmlNodeList products = null;
            try {
                products = doc.DocumentElement.SelectNodes("/Transaction/Receipt/Product");

                int counter = 0;
                foreach (XmlNode productNode in products) {

                    csvData.Add(new List<string>());
                    csvData[counter].Add(SummaTransactionCommon.GetTransactionId(doc));
                    csvData[counter].Add(SummaTransactionProductCommon.GetProductId(productNode));
                    csvData[counter].Add(SummaTransactionProductCommon.GetQuantity(productNode));
                    csvData[counter].Add(SummaTransactionProductCommon.GetUnitPrice(productNode));
                    csvData[counter].Add(SummaTransactionProductCommon.GetDiscount(productNode));
                    csvData[counter].Add(SummaTransactionProductCommon.GetPromotionId(productNode));
                    csvData[counter].Add(SummaTransactionProductCommon.GetBarcode(productNode));
                    csvData[counter].Add(SummaTransactionCommon.GetStoreId(doc));

                    counter++;

                    csvLineData.Add(new StringBuilder());
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing transaction detail", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Exemple #3
0
        /// <summary>
        /// Deconstruct xml document and populate internal data fields
        /// </summary>
        /// <param name="doc"></param>
        public override void SetupData(XmlDocument doc)
        {
            try {
                csvData.Add(new List <string>());
                csvLineData.Add(new StringBuilder());

                csvData[0].Add(SummaTransactionCommon.GetTransactionId(doc));
                csvData[0].Add(SummaTransactionCommon.GetTransactionType(doc));
                csvData[0].Add(SummaTransactionCommon.GetTerminalID(doc));
                csvData[0].Add(SummaTransactionCommon.GetCustomerId(doc));
                csvData[0].Add(SummaTransactionCommon.GetSalesTotal(doc));
                csvData[0].Add(SummaTransactionCommon.GetDateStamp(doc));
                csvData[0].Add(SummaTransactionCommon.GetPromotionId(doc));
                csvData[0].Add(SummaTransactionCommon.GetOperatorId(doc));
                csvData[0].Add(SummaTransactionCommon.GetExtra1(doc));
                csvData[0].Add(SummaTransactionCommon.GetExtra2(doc));
                csvData[0].Add(SummaTransactionCommon.GetExtra3(doc));
                csvData[0].Add(SummaTransactionCommon.GetStoreId(doc));
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing transaction", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Exemple #4
0
        /// <summary>
        /// Builds Transaction Id from Site Id and Receipt Number, or returns 999999999.
        /// NOTE: Does not use the ID attribute of the Transaction element!
        /// </summary>
        /// <param name="document"></param>
        /// <returns></returns>
        public static string GetTransactionId(XmlDocument document)
        {
            XmlNode receiptNode;
            string  rv;

            try {
                receiptNode = document.DocumentElement.SelectSingleNode("/Transaction/Receipt");
            }
            catch (XPathException xpe) {
                throw xpe;
            }

            if (receiptNode == null)
            {
                rv = "9999999999";
            }
            else
            {
                rv = SummaTransactionCommon.GetStoreId(document) + receiptNode.Attributes["ReceiptNumber"].Value;
            }

            return(rv);
        }