private static void ValidateCurrencies(CurrencyIso currencyFromIso, CurrencyIso currencyToIso) { if (currencyFromIso == CurrencyIso.NONE || currencyToIso == CurrencyIso.NONE) { throw new Exception($"Currency pair should contains one of these: {string.Join(",", Enum.GetNames(typeof(CurrencyIso)))}; "); } }
public async Task <EmoneyDTO> GetEmoney(string userId, CurrencyIso currency) { var targetUrl = $"{_baseUrl}/users/{userId}/emoney"; if (currency != CurrencyIso.NotSpecified) { targetUrl += "?currency=" + currency.ToString(); } return(await GetEntity <EmoneyDTO>(targetUrl)); }
/// <summary>Gets Emoney object.</summary> /// <param name="userId">User identifier.</param> /// <param name="currency">Currency ISO code.</param> /// <returns>Emoney object returned from API.</returns> public async Task <EmoneyDTO> GetEmoney(String userId, CurrencyIso currency) { var endPoint = GetApiEndPoint(MethodKey.UsersEmoneyGet); endPoint.SetParameters(new[] { userId }); var rest = new RestTool(_root, true); var parameters = new Dictionary <string, string>(); if (currency != CurrencyIso.NotSpecified) { parameters.Add("currency", currency.ToString()); } return(await rest.Request <EmoneyDTO, EmoneyDTO>(endPoint, parameters)); }
/// <summary>Gets Emoney object.</summary> /// <param name="userId">User identifier.</param> /// <param name="year">Emoney accounts for year</param> /// <param name="currency">Currency ISO code.</param> /// <returns>Emoney object returned from API.</returns> public EmoneyDTO GetEmoneyForYear(String userId, String year, CurrencyIso currencyIso) { var endPoint = GetApiEndPoint(MethodKey.UsersEmoneyYearGet); endPoint.SetParameters(new [] { userId, year }); var rest = new RestTool(_root, true); var parameters = new Dictionary <string, string>(); if (currencyIso != CurrencyIso.NotSpecified) { parameters.Add("currency", currencyIso.ToString()); } return(rest.Request <EmoneyDTO, EmoneyDTO>(endPoint, parameters)); }
/// <summary>Gets client wallet.</summary> /// <param name="fundsType">Type of funds.</param> /// <param name="currency">Currency.</param> /// <returns>Wallet with given funds type and currency.</returns> public async Task <WalletDTO> GetWallet(FundsType fundsType, CurrencyIso currency) { if (currency == CurrencyIso.NotSpecified) { return(null); } switch (fundsType) { case FundsType.DEFAULT: return(await this.GetObject <WalletDTO>(MethodKey.ClientGetWalletsDefaultWithCurrency, currency.ToString())); case FundsType.FEES: return(await this.GetObject <WalletDTO>(MethodKey.ClientGetWalletsFeesWithCurrency, currency.ToString())); case FundsType.CREDIT: return(await this.GetObject <WalletDTO>(MethodKey.ClientGetWalletsCreditWithCurrency, currency.ToString())); } return(null); }
/// <summary> /// Gets client wallet. /// </summary> /// <param name="fundsType">Type of funds.</param> /// <param name="currency">Currency.</param> /// <returns>Wallet with given funds type and currency.</returns> public async Task <WalletDTO> GetWallet(FundsType fundsType, CurrencyIso currency) { if (currency == CurrencyIso.NotSpecified) { return(null); } switch (fundsType) { case FundsType.DEFAULT: return(await GetEntity <WalletDTO>($"{_baseUrl}/clients/wallets/{currency.ToString()}")); case FundsType.FEES: return(await GetEntity <WalletDTO>($"{_baseUrl}/clients/wallets/fees/{currency.ToString()}")); case FundsType.CREDIT: return(await GetEntity <WalletDTO>($"{_baseUrl}/clients/wallets/credit/{currency.ToString()}")); default: return(null); } }
/// <summary>Gets client wallet transactions.</summary> /// <param name="fundsType">Type of funds.</param> /// <param name="currency">Currency.</param> /// <param name="pagination">Pagination.</param> /// <param name="filter">Filter.</param> /// <param name="sort">Sort.</param> /// <returns></returns> public async Task <ListPaginated <TransactionDTO> > GetWalletTransactions(FundsType fundsType, CurrencyIso currency, Pagination pagination, FilterTransactions filter, Sort sort = null) { if (filter == null) { filter = new FilterTransactions(); } return(await this.GetList <TransactionDTO>(MethodKey.ClientGetWalletTransactions, pagination, sort, filter.GetValues(), fundsType.ToString(), currency.ToString())); }
public CardRegistrationPostDTO(string userId, CurrencyIso currency, CardType cardType = CardType.CB_VISA_MASTERCARD) { UserId = userId; Currency = currency; CardType = cardType; }
public WalletPostDTO(List<String> owners, string description, CurrencyIso currency) { Owners = owners; Description = description; Currency = currency; }
public CurrencyItem GetByIsoName(CurrencyIso isoName) { return(_currencies.FirstOrDefault(i => i.IsoName == isoName)); }
public WalletPostDTO(List <string> owners, string description, CurrencyIso currency) { Owners = owners; Description = description; Currency = currency; }
public CardRegistrationPostDTO(string userId, CurrencyIso currency) { UserId = userId; Currency = currency; }
/// <summary> /// Gets client wallet transactions. /// </summary> /// <param name="fundsType">Type of funds.</param> /// <param name="currency">Currency.</param> /// <param name="pagination">Pagination.</param> /// <param name="filter">Filter.</param> /// <param name="sort">Sort.</param> /// <returns></returns> public async Task <ListPaginated <TransactionDTO> > GetWalletTransactions(FundsType fundsType, CurrencyIso currency, Pagination pagination, FilterTransactions filter, Sort sort = null) { var targetUrl = $"{_baseUrl}/clients/wallets/{fundsType.ToString()}/{currency.ToString()}/transactions"; if (filter == null) { filter = new FilterTransactions(); } return(await GetList <TransactionDTO>(targetUrl, pagination, sort, filter.GetValues())); }