<commit_before>#pragma warning disable 1591

using System;
using System.Collections.Generic;
using System.Text;

namespace Braintree
{
    /// <summary>
    /// A class for building requests to manipulate <see cref="Transaction"/> records in the vault.
    /// </summary>
    /// <example>
    /// A transaction request can be constructed as follows:
    /// <code>
    /// var request = new TransactionRequest
    /// {
    ///     Amount = SandboxValues.TransactionAmount.AUTHORIZE,
    ///     CreditCard = new CreditCardRequest
    ///     {
    ///         Number = SandboxValues.CreditCardNumber.VISA,
    ///         ExpirationDate = "05/2009",
    ///     }
    /// };
    /// </code>
    /// </example>
    public class TransactionRequest : Request
    {
        public CreditCardRequest CreditCard { get; set; }
        public Decimal Amount { get; set; }
        public String OrderId { get; set; }
        public String MerchantAccountId { get; set; }
        public CustomerRequest Customer { get; set; }
        public AddressRequest BillingAddress { get; set; }
        public AddressRequest ShippingAddress { get; set; }
        public TransactionType Type { get; set; }
        public Dictionary<String, String> CustomFields { get; set; }
        public TransactionOptionsRequest Options { get; set; }
        public String PaymentMethodToken { get; set; }
        public String CustomerId { get; set; }
        public String ShippingAddressId { get; set; }

        public TransactionRequest()
        {
            CustomFields = new Dictionary<String, String>();
        }

        public override String Kind()
        {
            return TransparentRedirectGateway.CREATE_TRANSACTION;
        }

        public override String ToXml()
        {
            return ToXml("transaction");
        }

        public override String ToXml(String root)
        {
            return BuildRequest(root).ToXml();
        }

        public override String ToQueryString()
        {
            return ToQueryString("transaction");
        }

        public override String ToQueryString(String root)
        {
            return BuildRequest(root).
                AddTopLevelElement("payment_method_token", PaymentMethodToken).
                ToQueryString();
        }

        protected virtual RequestBuilder BuildRequest(String root)
        {
            RequestBuilder builder = new RequestBuilder(root);

            if (Amount != 0) builder.AddElement("amount", Amount.ToString());
            builder.AddElement("customer-id", CustomerId);
            builder.AddElement("order-id", OrderId);
            builder.AddElement("payment-method-token", PaymentMethodToken);
            builder.AddElement("shipping-address-id", ShippingAddressId);
            builder.AddElement("merchant-account-id", MerchantAccountId);

            if (Type != null) builder.AddElement("type", Type.ToString().ToLower());

            if (CustomFields.Count != 0) builder.AddElement("custom-fields", CustomFields);<commit_msg>[#1897] - removed unnecessary toplevel element from transaction<commit_after>#pragma warning disable 1591

using System;
using System.Collections.Generic;
using System.Text;

namespace Braintree
{
    /// <summary>
    /// A class for building requests to manipulate <see cref="Transaction"/> records in the vault.
    /// </summary>
    /// <example>
    /// A transaction request can be constructed as follows:
    /// <code>
    /// var request = new TransactionRequest
    /// {
    ///     Amount = SandboxValues.TransactionAmount.AUTHORIZE,
    ///     CreditCard = new CreditCardRequest
    ///     {
    ///         Number = SandboxValues.CreditCardNumber.VISA,
    ///         ExpirationDate = "05/2009",
    ///     }
    /// };
    /// </code>
    /// </example>
    public class TransactionRequest : Request
    {
        public CreditCardRequest CreditCard { get; set; }
        public Decimal Amount { get; set; }
        public String OrderId { get; set; }
        public String MerchantAccountId { get; set; }
        public CustomerRequest Customer { get; set; }
        public AddressRequest BillingAddress { get; set; }
        public AddressRequest ShippingAddress { get; set; }
        public TransactionType Type { get; set; }
        public Dictionary<String, String> CustomFields { get; set; }
        public TransactionOptionsRequest Options { get; set; }
        public String PaymentMethodToken { get; set; }
        public String CustomerId { get; set; }
        public String ShippingAddressId { get; set; }

        public TransactionRequest()
        {
            CustomFields = new Dictionary<String, String>();
        }

        public override String Kind()
        {
            return TransparentRedirectGateway.CREATE_TRANSACTION;
        }

        public override String ToXml()
        {
            return ToXml("transaction");
        }

        public override String ToXml(String root)
        {
            return BuildRequest(root).ToXml();
        }

        public override String ToQueryString()
        {
            return ToQueryString("transaction");
        }

        public override String ToQueryString(String root)
        {
            return BuildRequest(root).ToQueryString();
        }

        protected virtual RequestBuilder BuildRequest(String root)
        {
            RequestBuilder builder = new RequestBuilder(root);

            if (Amount != 0) builder.AddElement("amount", Amount.ToString());
            builder.AddElement("customer-id", CustomerId);
            builder.AddElement("order-id", OrderId);
            builder.AddElement("payment-method-token", PaymentMethodToken);
            builder.AddElement("shipping-address-id", ShippingAddressId);
            builder.AddElement("merchant-account-id", MerchantAccountId);

            if (Type != null) builder.AddElement("type", Type.ToString().ToLower());

            if (CustomFields.Count != 0) builder.AddElement("custom-fields", CustomFields);
{'fraction_non_alphanumeric': 0.10507065669160433, 'fraction_numerical': 0.004655029093931837, 'mean_word_length': 2.1982987772461455, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6177344', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1447, 'n_words': 396}