Skip to content

Instantly share code, notes, and snippets.

@jaymedavis
Created June 13, 2016 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaymedavis/644dd1df2cf1c78edbab573edc5e24db to your computer and use it in GitHub Desktop.
Save jaymedavis/644dd1df2cf1c78edbab573edc5e24db to your computer and use it in GitHub Desktop.
i would expect this test to pass, because the upcoming invoice should be less than the original $5 amount
public class when_updating_a_subscription_with_proration
{
private static StripeSubscriptionService _subscriptionService;
private static StripeSubscription _subscription;
private static string _customerId;
private static string _planId;
private static StripeInvoice _upcomingInvoice;
Establish context = () =>
{
var planService = new StripePlanService();
var plan = planService.Create(test_data.stripe_plan_create_options.ThirtyDayIntervalWithFiveDollars());
var customerService = new StripeCustomerService();
var customer = customerService.Create(test_data.stripe_customer_create_options.ValidCard());
_subscriptionService = new StripeSubscriptionService();
_subscription = _subscriptionService.Create(customer.Id, plan.Id);
_customerId = customer.Id;
_planId = plan.Id;
};
Because of = () =>
{
var updateOptions = new StripeSubscriptionUpdateOptions()
{
Prorate = true,
ProrationDate = DateTime.Now.AddDays(10)
};
_subscription = _subscriptionService.Update(_customerId, _subscription.Id, updateOptions);
_upcomingInvoice = new StripeInvoiceService().Upcoming(_customerId, new StripeUpcomingInvoiceOptions() { SubscriptionId = _subscription.Id });
};
It should_be_less_than_five_dollars = () =>
_upcomingInvoice.AmountDue.ShouldBeLessThan(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment