public TransactionFields(Decimal?amount, string token,
                                 string transaction, string paymentType,
                                 CreditCardLevel3Defaults level3Defaults,
                                 string invoice, Decimal?tax)
        {
            AmountText = amount == null ? "" : amount.ToString();
            string taxAmount = tax == null ? "" : tax.ToString();

            PaymentToken    = token;
            TransactionType = transaction;
            PaymentType     = paymentType;

            PaymentDetails = new LevelTwoFields
            {
                Tax     = taxAmount,
                Invoice = invoice
            };

            LineItem = new LevelThreeFields
            {
                ItemCode        = level3Defaults.ItemCode,
                ItemDescription = level3Defaults.ItemDescription,
                LineItemTotal   = AmountText,
                ProductCode     = level3Defaults.ProductCode,
                CommodityCode   = level3Defaults.CommodityCode,
                Quantity        = level3Defaults.Quantity,
                TaxAmount       = taxAmount,
                TaxRate         = taxAmount,
                UnitCost        = AmountText,
                UnitOfMeasure   = level3Defaults.UnitOfMeasure
            };
        }
        /// <summary>
        /// Add fields required for Level 3 Processing
        /// </summary>
        /// <param name="lineItemFields">Data required for Level 3 processing</param>
        /// <param name="paymentFields">Data required for Level 2 processing</param>
        /// <returns></returns>
        private string LevelTwoAndThreeDataFields(LevelThreeFields lineItemFields, LevelTwoFields paymentFields)
        {
            // we are assuming the we either have all or none of level 2 & 3 data. If no invoice #, then don't include these fields
            if (String.IsNullOrWhiteSpace(paymentFields.Invoice))
            {
                return("");
            }

            var levelTwoData = $"&INVOICE_ID={paymentFields.Invoice}&AMOUNT_TAX={paymentFields.Tax}";

            var levelThreeData =
                $"&LV3_ITEM1_PRODUCT_CODE={HttpUtility.UrlEncode(lineItemFields.ProductCode)}" +
                $"&LV3_ITEM1_UNIT_COST={HttpUtility.UrlEncode(lineItemFields.UnitCost)}" +
                $"&LV3_ITEM1_QUANTITY={HttpUtility.UrlEncode(lineItemFields.Quantity)}" +
                $"&LV3_ITEM1_ITEM_DESCRIPTOR={HttpUtility.UrlEncode(lineItemFields.ItemDescription)}" +
                $"&LV3_ITEM1_MEASURE_UNITS={HttpUtility.UrlEncode(lineItemFields.UnitOfMeasure)}" +
                $"&LV3_ITEM1_COMMODITY_CODE={HttpUtility.UrlEncode(lineItemFields.CommodityCode)}" +
                $"&LV3_ITEM1_TAX_AMOUNT={HttpUtility.UrlEncode(lineItemFields.TaxAmount)}" +
                $"&LV3_ITEM1_TAX_RATE={HttpUtility.UrlEncode(lineItemFields.TaxRate)}" +
                $"&LV3_ITEM1_LINE_ITEM_TOTAL={HttpUtility.UrlEncode(lineItemFields.LineItemTotal)}";

            return($"{levelTwoData}{levelThreeData}");
        }