public async Task <BaseAudioticaResponse> SubscribeAsync( SubscriptionType plan, SubcriptionTimeFrame timeFrame, AudioticaStripeCard card, string coupon = null) { var creditCardData = new Dictionary <string, string> { { "name", card.Name }, { "number", card.Number }, { "expMonth", card.ExpMonth.ToString() }, { "expYear", card.ExpYear.ToString() }, { "cvc", card.Cvc } }; // plan id and coupon are passed in url query var planId = plan == SubscriptionType.Silver ? "autc_silver" : "autc_gold"; planId += "_" + timeFrame.ToString().ToLower(); var url = string.Format(SubscribePath, planId, coupon); var resp = await PostAsync <LoginData>(url, creditCardData); if (resp.Success) { await SaveLoginStateAsync(resp); } return(resp); }
public Task <BaseAudioticaResponse> SubscribeAsync( SubscriptionType plan, SubcriptionTimeFrame timeFrame, AudioticaStripeCard card, string coupon = null) { throw new NotImplementedException(); }
private async void ButtonClick(object sender, RoutedEventArgs e) { var card = new AudioticaStripeCard { Name = this.CardNameBox.Text, Number = this.CardNumBox.Text, Cvc = this.CardSecurityCode.Text }; var nameEmpty = string.IsNullOrEmpty(card.Name); var numberEmpty = string.IsNullOrEmpty(card.Number); var cvcEmpty = string.IsNullOrEmpty(card.Cvc); var expEmpty = this.ExpMonthBox.SelectedIndex == -1 || this.ExpYearBox.SelectedIndex == -1; if (nameEmpty && numberEmpty && cvcEmpty && expEmpty) { CurtainPrompt.ShowError("You forgot to enter all your card information."); } else if (nameEmpty) { CurtainPrompt.ShowError("You forgot to enter the name on the card."); } else if (numberEmpty) { CurtainPrompt.ShowError("You forgot to enter the card's number."); } else if (cvcEmpty) { CurtainPrompt.ShowError("You forgot to enter the card's security code."); } else if (expEmpty) { CurtainPrompt.ShowError("You forgot to enter the card's expiration date."); } else { card.ExpMonth = int.Parse(this.ExpMonthBox.SelectedItem as string); card.ExpYear = int.Parse(this.ExpYearBox.SelectedItem as string); var term = SubcriptionTimeFrame.Month; switch (this.PlanBox.SelectedIndex) { case 1: term = SubcriptionTimeFrame.Biyear; break; case 2: term = SubcriptionTimeFrame.Year; break; } UiBlockerUtility.Block("Subscribing..."); var result = await App.Locator.AudioticaService.SubscribeAsync( SubscriptionType.Silver, term, card, this.CouponCode.Text.Trim()); UiBlockerUtility.Unblock(); if (result.Success) { CurtainPrompt.Show("Welcome to the Cloud Club!"); App.Navigator.GoBack(); } else { CurtainPrompt.ShowError(result.Message); } } }