Пример #1
0
        public string MakePurchase(double Dollars, double BtcPurchaseAmount /*,ClientBtcWalletAddress*/)
        {
            // Create a OctagonWallet Object
            OctagonWallet wallet = new OctagonWallet();

            // Get Bitcoin Balance in the wallet
            var BtcWalletBalance = wallet.GetBtcAvailable();

            // Withdraw money from the bank equal to the purchase (restoking)
            BankWithdrawal Withdrawal = new BankWithdrawal(Dollars.ToString());

            // Make purchase
            BuyBTC purchase = new BuyBTC(BtcPurchaseAmount);

            // While BTC's are not available in wallet, keep cheking until it's available in order to make a transfer
            while (Double.Parse(BtcWalletBalance) < BtcPurchaseAmount)
            {
                BtcWalletBalance = wallet.GetBtcAvailable();
            }

            // Make transfer to user's wallet from octagon's wallet
            // Create a Signature Object
            Signature signature = new Signature(BtcPurchaseAmount /*, ClientBtcWalletAddress  */);

            // View Result. ID if Successful, Error if not
            return(purchase.getResponseString());
        }
Пример #2
0
        public string MakePurchase()
        {
            // Create a BuyBTC Object
            BuyBTC purchase = new BuyBTC();

            // View Result. ID if Successful, Error if not
            return(purchase.getResponseString());
        }