public async Task <StripeResponse> CreateBankAccount(StripeBankAccount token) { try { StripeResponse temp = await cloudService.client.InvokeApiAsync <StripeBankAccount, StripeResponse>("StripeBank", token); return(temp); } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert("Stripe Failure", ex.Message, "OK"); } return(null); }
private async Task ExecuteGetBankDetailsCommand() { string id; var loginProvider = DependencyService.Get<ILoginProvider>(); Account acc = loginProvider.RetreiveAccountFromSecureStore(); acc.Properties.TryGetValue("stripe_account_id", out id); var stripeService = (StripeService)ServiceLocator.Instance.Resolve<IStripeProvider>(); StripeBankAccount bankAccount = await stripeService.RetreiveBankAccount(id); AccountHolderName = bankAccount.account_holder_name; AccountNumber = bankAccount.account_number; Currency = bankAccount.currency; Country = bankAccount.country; }
public async Task <StripeBankAccount> RetreiveBankAccount(string customerId) { //string JToken = JsonConvert.SerializeObject(token); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("customerId", customerId); try { StripeResponse temp = await cloudService.client.InvokeApiAsync <StripeResponse>("StripeBank", HttpMethod.Get, parameters); StripeBankAccount bankAccount = JsonConvert.DeserializeObject <StripeBankAccount>(temp.ObjectJson); return(bankAccount); } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert("Stripe Failure", ex.Message, "OK"); } return(null); }
private async Task ExecuteSaveBankDetailsCommand() { //Get account details string id; var loginProvider = DependencyService.Get<ILoginProvider>(); Account acc = loginProvider.RetreiveAccountFromSecureStore(); acc.Properties.TryGetValue("stripe_account_id", out id); var stripeService = (StripeService)ServiceLocator.Instance.Resolve<IStripeProvider>(); StripeBankAccount stripeBankAccount = new StripeBankAccount() { account_holder_name = _accountHolderName, account_number = _accountNumber, currency = _currency, country = _country, customerId = id }; StripeResponse response = await stripeService.CreateBankAccount(stripeBankAccount); }