<commit_before>﻿using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using MultiSafepay.Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace MultiSafepay
{
    /// <summary>
    /// WebClient wrapper that encapsulates the logic required to submit an OrderRequest to 
    /// the MultiSafepay API. Contains methods for each available call on the API.
    /// </summary>
    public class MultiSafepayClient : IDisposable
    {
        private readonly WebClient _client;
        private readonly UrlProvider _urlProvider;
        private bool _disposed;
        public string Language { get; set; }

        public MultiSafepayClient(string apiKey, string apiUrl = "https://api.multisafepay.com/v1/json/", string languageCode = null)
        {
            _client = new WebClient();
            _client.Headers["api_key"] = apiKey;

            _urlProvider = new UrlProvider(apiUrl, languageCode);
        }



        #region API Methods

        /// <summary>
        /// Gets a list of all payment methods configured for the users account
        /// </summary>
        public Gateway[] GetGateways(string countryCode = null, string currency = null, int? amount = null)
        {
            var response = DoRequest<Gateway[]>(_urlProvider.GatewaysUrl(countryCode, currency, amount));
            return response.Data;
        }

        /// <summary>
        /// Gets data for a specific payment method
        /// </summary>
        /// <param name="gatewayId">The unique identifier for the payment method</param>
        public Gateway GetGateway(string gatewayId)
        {<commit_msg>+ UTF8 Web Client Encoding + Headers application/json<commit_after>﻿using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using MultiSafepay.Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace MultiSafepay
{
    /// <summary>
    /// WebClient wrapper that encapsulates the logic required to submit an OrderRequest to 
    /// the MultiSafepay API. Contains methods for each available call on the API.
    /// </summary>
    public class MultiSafepayClient : IDisposable
    {
        private readonly WebClient _client;
        private readonly UrlProvider _urlProvider;
        private bool _disposed;
        public string Language { get; set; }

        public MultiSafepayClient(string apiKey, string apiUrl = "https://api.multisafepay.com/v1/json/", string languageCode = null)
        {
            _client = new WebClient();
            _client.Headers["api_key"] = apiKey;
            _client.Headers[HttpRequestHeader.ContentType] = "application/json";
            _client.Encoding = System.Text.Encoding.UTF8;
            
            _urlProvider = new UrlProvider(apiUrl, languageCode);
        }



        #region API Methods

        /// <summary>
        /// Gets a list of all payment methods configured for the users account
        /// </summary>
        public Gateway[] GetGateways(string countryCode = null, string currency = null, int? amount = null)
        {
            var response = DoRequest<Gateway[]>(_urlProvider.GatewaysUrl(countryCode, currency, amount));
            return response.Data;
        }

        /// <summary>
        /// Gets data for a specific payment method
        /// </summary>
        /// <param name="gatewayId">The unique identifier for the payment method</param>
        public Gateway GetGateway(string gatewayId)
        {
{'fraction_non_alphanumeric': 0.09189640768588136, 'fraction_numerical': 0.001113895850737956, 'mean_word_length': 2.5215686274509803, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 2, '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': '509937', 'n_tokens_mistral': 955, 'n_tokens_neox': 908, 'n_words': 290}