public string ToXML()
        {
            NumberFormatInfo moneyFormatInfo = new NumberFormatInfo();

            moneyFormatInfo.NumberDecimalSeparator = ".";

            if (CreditCard == null)
            {
                CreditCard = new CreditCard();
            }

            StringBuilder strXML = new StringBuilder();

            strXML.AppendFormat("<{0}>", "VposRequest");
            if (!string.IsNullOrWhiteSpace(MerchantId))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "MerchantId", MerchantId);
            }
            if (!string.IsNullOrWhiteSpace(Password))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "Password", Password);
            }
            if (!string.IsNullOrWhiteSpace(TransactionId))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "TransactionId", TransactionId);
            }
            if (!string.IsNullOrWhiteSpace(TerminalNo))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "TerminalNo", TerminalNo);
            }
            if (TransactionType.HasValue)
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "TransactionType", TransactionType.ToString());
            }
            if (CurrencyAmount.HasValue)
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "CurrencyAmount", CurrencyAmount.Value.ToString(moneyFormatInfo));
            }
            if (SurchargeAmount.HasValue)
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "SurchargeAmount", SurchargeAmount.Value.ToString(moneyFormatInfo));
            }
            if (CurrencyCode.HasValue)
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "CurrencyCode", (int)Enum.Parse(typeof(Currency), CurrencyCode.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(CreditCard.PointAmount))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "PointAmount", CreditCard.PointAmount);
            }
            if (!string.IsNullOrWhiteSpace(CreditCard.PointCode))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "PointCode", CreditCard.PointCode);
            }
            if (CreditCard.NumberOfInstallments.HasValue)
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "NumberOfInstallments", CreditCard.NumberOfInstallments);
            }
            if (CreditCard.BrandName.HasValue)
            {
                strXML.AppendFormat("{0}={1}&", "BrandName", (int)Enum.Parse(typeof(BrandName), CreditCard.BrandName.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(CreditCard.Pan))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "Pan", CreditCard.Pan);
            }
            if (!string.IsNullOrWhiteSpace(CreditCard.Expiry))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "Expiry", CreditCard.Expiry);
            }
            if (!string.IsNullOrWhiteSpace(CreditCard.CVV))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "Cvv", CreditCard.CVV);
            }
            if (!string.IsNullOrWhiteSpace(CreditCard.SecurityCode))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "SecurityCode", CreditCard.SecurityCode);
            }
            if (!string.IsNullOrWhiteSpace(ReferenceTransactionId))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "ReferenceTransactionId", ReferenceTransactionId);
            }
            if (!string.IsNullOrWhiteSpace(CreditCard.CardHolderName))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "CardHoldersName", CreditCard.CardHolderName);
            }
            if (!string.IsNullOrWhiteSpace(CreditCard.CardHolderIp))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "ClientIp", CreditCard.CardHolderIp);
            }
            if (!string.IsNullOrWhiteSpace(OrderId))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "OrderId", OrderId);
            }
            if (!string.IsNullOrWhiteSpace(OrderDescription))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "OrderDescription", OrderDescription);
            }
            if (!string.IsNullOrWhiteSpace(RecurringFrequencyType))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "RecurringFrequencyType", RecurringFrequencyType);
            }
            if (RecurringFrequency.HasValue)
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "RecurringFrequency", RecurringFrequency);
            }
            if (IsRecurring.HasValue)
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "IsRecurring", IsRecurring.Value);
            }
            if (!string.IsNullOrWhiteSpace(TriggerDate))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "TriggerDate", TriggerDate);
            }
            if (RecurringInstallmentCount.HasValue)
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "RecurringInstallmentCount", RecurringInstallmentCount);
            }
            if (!string.IsNullOrWhiteSpace(CAVV))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "CAVV", CAVV);
            }
            if (!string.IsNullOrWhiteSpace(ECI))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "ECI", ECI);
            }
            if (CustomItems != null)
            {
                strXML.AppendFormat("<{0}>", "CustomItems");
                for (int i = 0; i < CustomItems.Count; i++)
                {
                    strXML.AppendFormat($"<Item name=\"{CustomItems.ElementAt(0).Key}\" value=\"{CustomItems.ElementAt(0).Value}\"/>");
                }
                strXML.AppendFormat("</{0}>", "CustomItems");
            }

            if (DeviceType.HasValue)
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "DeviceType", (int)Enum.Parse(typeof(DeviceType), DeviceType.ToString()));
            }
            if (TransactionDeviceSource.HasValue)
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "TransactionDeviceSource", (int)Enum.Parse(typeof(TransactionDeviceSource), TransactionDeviceSource.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(Extract))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "Extract", Extract);
            }
            if (!string.IsNullOrWhiteSpace(ExpSign))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "ExpSign", ExpSign);
            }
            if (!string.IsNullOrWhiteSpace(MpiTransactionId))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "MpiTransactionId", MpiTransactionId);
            }
            if (!string.IsNullOrWhiteSpace(Location))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "Location", Location);
            }
            if (MerchantType.HasValue)
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "MerchantType", (int)Enum.Parse(typeof(MerchantType), MerchantType.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(SubMerchantId))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "SubMerchantId", SubMerchantId);
            }
            if (!string.IsNullOrWhiteSpace(ClientIp))
            {
                strXML.AppendFormat("<{0}>{1}</{0}>", "ClientIp", ClientIp);
            }



            strXML.AppendFormat("</{0}>", "VposRequest");

            return(strXML.ToString());
        }