private void LoadSubscribers(string query = null) { var subscribers = string.IsNullOrEmpty(query) ? SubscriberHelper.GetSubscribers() : SubscriberHelper.SearchSubscribers(query); lbSubscribers.Items.Clear(); lbSubscribers.Items.AddRange(subscribers.Select(x => x.ToString()).ToArray()); }
public void UpgradeSubscription_ChargesProRatadAmount() { var subscriberHelper = new SubscriberHelper(TestConstants.TestSiteName, TestConstants.TestApiKey); var subscriber = new Subscriber { CustomerId = TestConstants.TestCustomerId, ScreenName = TestConstants.TestCustomerId, Email = "*****@*****.**" }; var creditCard = new CreditCard { CardType = "visa", ExpirationMonth = 12, ExpirationYear = 2012, FirstName = "Tester", LastName = "Testing", Number = TestConstants.ValidCard, VerificationValue = "123" }; subscriberHelper.SubscribeToSubscriptionPlanWithCreditCard(subscriber, TestConstants.MediumSubscriptionPlanId, creditCard); var upgradeInvoice = subscriberHelper.ChangeSubscriberFeatureLevelWithOnFilePayment(subscriber, TestConstants.HighSubscriptionPlanId); Assert.AreEqual(15, upgradeInvoice.Amount.Value); }
public void Init() { _subscriberClient = Substitute.For<ISpreedlySubscribers>(); _subscriptionPlansClient = Substitute.For<ISpreedlySubscriptionPlans>(); _paymentsClient = Substitute.For<ISpreedlyInvoices>(); _subscriberHelper = new SubscriberHelper(_subscriberClient, _paymentsClient, _subscriptionPlansClient); }
private void btnSubscriberShowInfo_Click(object sender, EventArgs e) { var sub = SubscriberHelper.GetSubscribers().Where(x => x.ToString().Equals(lbSubscribers.SelectedItem)).FirstOrDefault(); var form = new SubscriberInfo(sub); form.ShowDialog(); }
public ActionResult Create([Bind(Include = "Id,FirstName,LastName,State,ZipCode")] Subscriber subscriber) { if (ModelState.IsValid) { SubscriberHelper.AddSubscriber(subscriber); return(RedirectToAction("Index")); } return(View(subscriber)); }
private void btnSubscriberUpdate_Click(object sender, EventArgs e) { var sub = SubscriberHelper.GetSubscribers().Where(x => x.ToString().Equals(lbSubscribers.SelectedItem)).FirstOrDefault(); var form = new SubscriberUpdate(sub); form.FormClosed += delegate { LoadSubscribers(); }; form.ShowDialog(); }
private void btnAddSubscriber_Click(object sender, EventArgs e) { try { SubscriberHelper.AddSubscriber(tbSubscriberName.Text, tbSubscriberSurname.Text, tbSubscriberPhoneNumber.Text); LoadSubscribers(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSubscriberDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to delete this subscriber?", "Deleting", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { var sub = SubscriberHelper.GetSubscribers().Where(x => x.ToString().Equals(lbSubscribers.SelectedItem)).FirstOrDefault(); SubscriberHelper.DeleteSubscriber(sub.Id); LoadSubscribers(); } }
public void Init() { var subscriberHelper = new SubscriberHelper(TestConstants.TestSiteName, TestConstants.TestApiKey); var subscriber = new Subscriber { CustomerId = TestConstants.TestCustomerId, ScreenName = TestConstants.TestCustomerId, Email = "*****@*****.**" }; if (!subscriberHelper.Exists(subscriber.CustomerId)) subscriberHelper.CreateSubscriber(subscriber.CustomerId, subscriber.Email, subscriber.ScreenName); }
// GET: Subscribers/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var subscriber = SubscriberHelper.FindSubscriber((int)id); if (subscriber == null) { return(HttpNotFound()); } return(View(subscriber)); }
public void CreateSubscription_WithHelper_ReturnsInvoice() { var subscriberHelper = new SubscriberHelper(TestConstants.TestSiteName, TestConstants.TestApiKey); var subscriber = new Subscriber { CustomerId = TestConstants.TestCustomerId, ScreenName = TestConstants.TestCustomerId, Email = "*****@*****.**" }; var creditCard = new CreditCard { CardType = "visa", ExpirationMonth = 12, ExpirationYear = 2012, FirstName = "Tester", LastName = "Testing", Number = TestConstants.ValidCard, VerificationValue = "123" }; var invoice = subscriberHelper.SubscribeToSubscriptionPlanWithCreditCard(subscriber, TestConstants.MediumSubscriptionPlanId, creditCard); Assert.NotNull(invoice); }
public ActionResult DeleteConfirmed(int id) { SubscriberHelper.DeleteSubscriber(id); return(RedirectToAction("Index")); }
private void Bootstrapper_Bootstrapped(object sender, EventArgs e) { FrontendModule.Current.DependencyResolver.Rebind <ISubscribeFormModel>().To <SubscribeFormModelCustom>(); SubscriberHelper.CreateCustomSubscriberField(); }
public void DowngradeSubscription_GivesStoreCreditToSubscriber() { var subscriberHelper = new SubscriberHelper(TestConstants.TestSiteName, TestConstants.TestApiKey); var subscriber = new Subscriber { CustomerId = TestConstants.TestCustomerId, ScreenName = TestConstants.TestCustomerId, Email = "*****@*****.**" }; var creditCard = new CreditCard { CardType = "visa", ExpirationMonth = 12, ExpirationYear = 2012, FirstName = "Tester", LastName = "Testing", Number = TestConstants.ValidCard, VerificationValue = "123" }; subscriberHelper.SubscribeToSubscriptionPlanWithCreditCard(subscriber, TestConstants.HighSubscriptionPlanId, creditCard); subscriberHelper.ChangeSubscriberFeatureLevelWithOnFilePayment(subscriber, TestConstants.LowSubscriptionPlanId); var downgradedSubscriber = subscriberHelper.FetchSubscriber(subscriber.CustomerId); Assert.GreaterOrEqual(downgradedSubscriber.StoreCredit.Value, 0); }
public void CreateSubscription_WithHelper_ForFreeSubscriptionPlan_ThrowsForbiddenActionException() { var subscriberHelper = new SubscriberHelper(TestConstants.TestSiteName, TestConstants.TestApiKey); var subscriber = new Subscriber { CustomerId = TestConstants.TestCustomerId, ScreenName = TestConstants.TestCustomerId, Email = "*****@*****.**" }; var creditCard = new CreditCard { CardType = "visa", ExpirationMonth = 12, ExpirationYear = 2012, FirstName = "Tester", LastName = "Testing", Number = TestConstants.ValidCard, VerificationValue = "123" }; var invoice = subscriberHelper.SubscribeToSubscriptionPlanWithCreditCard(subscriber, TestConstants.FreePlanSubscriptionPlanId, creditCard); }
public void CreateSubscription_WithHelper_WhenGatewayTimesout_ThrowsPaymentGatewayTimeoutException() { var subscriberHelper = new SubscriberHelper(TestConstants.TestSiteName, TestConstants.TestApiKey); var subscriber = new Subscriber { CustomerId = TestConstants.TestCustomerId, ScreenName = TestConstants.TestCustomerId, Email = "*****@*****.**" }; var creditCard = new CreditCard { CardType = "visa", ExpirationMonth = 12, ExpirationYear = 2012, FirstName = "Tester", LastName = "Testing", Number = TestConstants.GatewayUnavailableCard, VerificationValue = "123" }; var invoice = subscriberHelper.SubscribeToSubscriptionPlanWithCreditCard(subscriber, TestConstants.MediumSubscriptionPlanId, creditCard); }
// GET: Subscribers public ActionResult Index(string searchString) { var subscribers = SubscriberHelper.GetSubscribers(searchString); return(View(subscribers)); }
// GET: Subscribers/Report public ActionResult Report() { var subscribers = SubscriberHelper.GetSubscribers(null); return(View(subscribers)); }
public void MyTestInitialize() { // Helper code to get the HttpContext var mySIMPLTestContext = new SIMPLTestContext(); HttpContext.Current = mySIMPLTestContext.GetHttpSession(); // Helper Code to get the user logged into Windows var userName = mySIMPLTestContext.GetNameFromWindowsIdentity(); // Calling actual production code to set the instance for this username CurrentUser.SetInstance(userName); // Calling actual production code to get the Rosettian User Object RosettianUser = CurrentUser.AsUserDto(); BusinessFacadeforTests = DependencyResolver.Current.GetService<IBusinessFacade>(); SubscriberHelperforTests = DependencyResolver.Current.GetService<SubscriberHelper>(); // Set up the LocationController LocationController4Tests = DependencyResolver.Current.GetService<LocationController>(); LocationController4Tests.ControllerContext = new ControllerContext(new HttpContextWrapper(HttpContext.Current), new RouteData(), LocationController4Tests); }
private void btnUpdate_Click(object sender, EventArgs e) { SubscriberHelper.UpdateSubscriber(_subscriber.Id, tbName.Text, tbSurname.Text, tbPhoneNumber.Text, tbBalance.Text); Close(); }