示例#1
0
        /// <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()));
        }
        /// <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()));
        }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the FundsResponseModel class.
 /// </summary>
 /// <param name="operation">Possible values include: 'Deposit',
 /// 'Withdraw'</param>
 /// <param name="type">Possible values include: 'Undefined', 'Card',
 /// 'Bank', 'Blockchain'</param>
 public FundsResponseModel(System.Guid id, string assetId, string assetName, double volume, FundsOperation operation, FundsType type, System.DateTime timestamp)
 {
     Id        = id;
     AssetId   = assetId;
     AssetName = assetName;
     Volume    = volume;
     Operation = operation;
     Type      = type;
     Timestamp = timestamp;
     CustomInit();
 }
示例#4
0
        /// <summary>Gets client wallets.</summary>
        /// <param name="fundsType">Type of funds.</param>
        /// <param name="pagination">Pagination.</param>
        /// <returns>Collection of client's wallets.</returns>
        public async Task <ListPaginated <WalletDTO> > GetWallets(FundsType fundsType, Pagination pagination)
        {
            switch (fundsType)
            {
            case FundsType.DEFAULT:
                return(await this.GetList <WalletDTO>(MethodKey.ClientGetWalletsDefault, pagination));

            case FundsType.FEES:
                return(await this.GetList <WalletDTO>(MethodKey.ClientGetWalletsFees, pagination));

            case FundsType.CREDIT:
                return(await this.GetList <WalletDTO>(MethodKey.ClientGetWalletsCredit, pagination));
            }

            return(null);
        }
        /// <summary>
        /// Gets client wallets.
        /// </summary>
        /// <param name="fundsType">Type of funds.</param>
        /// <param name="pagination">Pagination.</param>
        /// <returns>Collection of client's wallets.</returns>
        public async Task <ListPaginated <WalletDTO> > GetWallets(FundsType fundsType, Pagination pagination)
        {
            switch (fundsType)
            {
            case FundsType.DEFAULT:
                return(await GetList <WalletDTO>($"{_baseUrl}/clients/wallets", pagination));

            case FundsType.FEES:
                return(await GetList <WalletDTO>($"{_baseUrl}/clients/wallets/fees", pagination));

            case FundsType.CREDIT:
                return(await GetList <WalletDTO>($"{_baseUrl}/clients/wallets/credit", pagination));

            default:
                return(null);
            }
        }
        internal static string ToSerializedValue(this FundsType value)
        {
            switch (value)
            {
            case FundsType.Undefined:
                return("Undefined");

            case FundsType.Card:
                return("Card");

            case FundsType.Bank:
                return("Bank");

            case FundsType.Blockchain:
                return("Blockchain");
            }
            return(null);
        }
示例#7
0
        /// <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);
            }
        }
示例#9
0
        public Detail(BaiDetail data, string currencyCode)
        {
            TextList       = new List <string>();
            TextDictionary = new Dictionary <string, string>();

            var list = new List <string> {
                data.TransactionDetail
            };

            list.AddRange(data.DetailContinuation);

            var lineData = "";

            foreach (var section in list)
            {
                var line = section.Trim();
                // Some / are optional?
                //if (!line.EndsWith("/")) throw new Exception("I got a line without a trailing /");

                if (line.StartsWith("16"))
                {
                    line = line.Replace("/", "");
                }
                else if (line.StartsWith("88"))
                {
                    line = line.Substring(2);//.Replace("/", " ");
                }
                else
                {
                    throw new Exception("I got a bad line: " + line);
                }
                lineData += line;
            }

            // Now try to figure out what's left ;-)
            var stack = new Stack(lineData.Split(',').Reverse().ToArray());

            RecordCode = stack.Pop().ToString();
            TypeCode   = stack.Pop().ToString();
            Amount     = stack.Pop().ToString();
            FundsType  = stack.Pop().ToString();

            switch (FundsType.ToUpper())
            {
            case "S":
                Immediate     = stack.Pop().ToString();
                OneDay        = stack.Pop().ToString();
                TwoOrMoreDays = stack.Pop().ToString();
                break;

            case "D":
                // next field is the number of distripution pairs
                // number of days, avalible amount
                // currencyCode would be used here
                throw new Exception("I don't want to deal with this one yet - " + currencyCode);

            case "V":
                var date = stack.Pop().ToString();
                var time = stack.Pop().ToString();
                AvalibleDate = BaiFileHelpers.DateTimeFromFields(date, time);
                break;
            }

            BankReferenceNumber     = stack.Pop().ToString();
            CustomerReferenceNumber = stack.Pop().ToString();
            // What's left on the stack?
            Text = LeftoverStackToString(stack);

            CreateTextList();
            CreateTextDictionary();
        }