예제 #1
0
        private static CreatedBitcoinDeposit ReadCreatedBitcoinDeposit(string result)
        {
            dynamic responseServerD = JsonConvert.DeserializeObject(result);
            dynamic orderD          = responseServerD.data.order;

            CreatedBitcoinDeposit createdBitcoinDeposit = null;

            if (orderD != null)
            {
                string   id             = orderD.id ?? null;
                double?  amountInUsd    = orderD.amount_in_usd ?? null;
                string   bitcoinAddress = orderD.bitcoin_address ?? null;
                double?  bitcoinAmount  = orderD.bitcoin_amount ?? null;
                string   bitcoinUri     = orderD.bitcoin_uri ?? null;
                double?  currentPricePerBitcoinInUsd = orderD.current_price_per_bitcoin_in_usd ?? null;
                DateTime?createdAt = null;
                if (orderD.created_at != null)
                {
                    createdAt = DateTimeExtension.FromUnixTime((long)orderD.created_at);
                }
                DateTime?expiresAt = null;
                if (orderD.expires_at != null)
                {
                    expiresAt = DateTimeExtension.FromUnixTime((long)orderD.expires_at);
                }
                string note     = orderD.note ?? null;
                string provider = orderD.provider ?? null;

                createdBitcoinDeposit = new CreatedBitcoinDeposit(id, amountInUsd, bitcoinAddress, bitcoinAmount,
                                                                  bitcoinUri, currentPricePerBitcoinInUsd, createdAt, expiresAt, note, provider);
            }

            return(createdBitcoinDeposit);
        }
예제 #2
0
        /// <summary>
        /// WARNING!!! BitSkins stop support CryptoAPI! This api call can work not correct!
        /// Allows you to generate a payment request for Bitcoin.
        /// You can deposit any amount of Bitcoin (more than 0.0002 BTC).
        /// </summary>
        /// <param name="amount">Amount to deposit in USD.</param>
        /// <returns>Payment request for Bitcoin.</returns>
        public static CreatedBitcoinDeposit CreateBitcoinDeposit(double amount)
        {
            CheckParameters(amount);
            string urlRequest = GetUrlRequest(amount);
            string result     = Server.ServerRequest.RequestServer(urlRequest);
            CreatedBitcoinDeposit createdBitcoinDeposit = ReadCreatedBitcoinDeposit(result);

            return(createdBitcoinDeposit);
        }