private static void StripePlanToPlan(StripePlan stripePlan, Plan plan) { plan.Name = stripePlan.Name; plan.AmountInCents = stripePlan.Amount; plan.Currency = stripePlan.Currency; plan.Interval = stripePlan.Interval; plan.TrialPeriodDays = stripePlan.TrialPeriodDays; }
private static Invoice.Plan Map(StripePlan stripePlan) { return new Invoice.Plan { AmountInCents = stripePlan.Amount, Created = stripePlan.Created, Currency = stripePlan.Currency, StatementDescriptor = stripePlan.StatementDescriptor, Interval = stripePlan.Interval, IntervalCount = stripePlan.IntervalCount, Name = stripePlan.Name, StripePlanId = stripePlan.Id, TrialPeriodDays = stripePlan.TrialPeriodDays }; }
private static SubscriptionPlan SubscriptionPlanMapper(StripePlan stripePlan) { return new SubscriptionPlan { Id = stripePlan.Id, Name = stripePlan.Name, Currency = stripePlan.Currency, Interval = GetInterval(stripePlan.Interval), Price = stripePlan.Amount, TrialPeriodInDays = stripePlan.TrialPeriodDays ?? 0, }; }
private StripeCustomer GetCustomer(NewDonationModel model, StripePlan plan) { var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext())); var currentUser = manager.FindById(User.Identity.GetUserId()); string userEmail = currentUser.Email; var myCustomer = new StripeCustomerCreateOptions { Email = userEmail, Description = currentUser.FirstName + currentUser.LastName, Source = new StripeSourceOptions() { TokenId = model.Token } }; myCustomer.PlanId = plan.Id; var customerService = new StripeCustomerService("sk_test_yPi2XADkAP3wiS1i6tkjErxZ"); return customerService.Create(myCustomer); }