private async Task <AddressForCustumer> getNewAddressFromApiAsync(UserBitcoinAdress model) { String path = myWallet.ID + "/new_address?password="******"&label=" + model.UserId; //needs validation AddressForCustumer address = await GetNewAddressAsync(path); return(address); }
public async Task <ActionResult> GenerateAddressAsync(UserBitcoinAdress model) { //Generiranje na nova adresa za sekoj nov korisnik AddressForCustumer newAddress = await getNewAddressFromApiAsync(model); //model for all information needed for payment ReceivingPaymentForUser receivingPaymentForUser = new ReceivingPaymentForUser(); //the generated address for the specific user receivingPaymentForUser.AddressForReceiving = newAddress.NewAddress; //the label used when generating address receivingPaymentForUser.Label = newAddress.Label; //the bitcoin address of the specific usre receivingPaymentForUser.UserAddress = model.UserAddress; //the id of the specific user receivingPaymentForUser.UserId = model.UserId; ShoppingCart shoppingCart = db.ShoppingCarts.Find(model.ShoppingCartId); //the shopping cart id and the ammount to be paid receivingPaymentForUser.ShoppingCartId = shoppingCart.ID; receivingPaymentForUser.ammountToBePaid = shoppingCart.toBePaid(); receivingPaymentForUser.ammountToBePaidBitcoin = PriceOfBitcoin(receivingPaymentForUser.ammountToBePaid, "USD").Result; return(View(receivingPaymentForUser)); }