Skip to content

Commit b2479a2

Browse files
Copilotniemyjski
andcommitted
Fix Stripe.net v48 breaking changes: handle nullable UnitAmount and collection expressions
Co-authored-by: niemyjski <1020579+niemyjski@users.noreply.github.com>
1 parent b32732f commit b2479a2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Exceptionless.Web/Controllers/OrganizationController.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ public async Task<ActionResult<Invoice>> GetInvoiceAsync(string id)
250250
{
251251
string planName = line.Price.Nickname ?? _billingManager.GetBillingPlan(line.Price.Id)?.Name ?? line.Price.Id;
252252
var intervalText = line.Price.Recurring?.Interval ?? "one-time";
253-
item.Description = $"Exceptionless - {planName} Plan ({(line.Price.UnitAmount / 100.0):c}/{intervalText})";
253+
var priceAmount = line.Price.UnitAmount.HasValue ? (line.Price.UnitAmount.Value / 100.0) : 0.0;
254+
item.Description = $"Exceptionless - {planName} Plan ({priceAmount:c}/{intervalText})";
254255
}
255256

256257
var periodStart = line.Period.Start >= DateTime.MinValue ? line.Period.Start : stripeInvoice.PeriodStart;
@@ -443,7 +444,7 @@ public async Task<ActionResult<ChangePlanResult>> ChangePlanAsync(string id, str
443444
var subscriptionCreateOptions = new SubscriptionCreateOptions
444445
{
445446
Customer = customer.Id,
446-
Items = [new SubscriptionItemOptions { Price = planId }]
447+
Items = new List<SubscriptionItemOptions> { new SubscriptionItemOptions { Price = planId } }
447448
};
448449

449450
if (!String.IsNullOrWhiteSpace(couponId))
@@ -458,8 +459,8 @@ public async Task<ActionResult<ChangePlanResult>> ChangePlanAsync(string id, str
458459
}
459460
else
460461
{
461-
var update = new SubscriptionUpdateOptions { Items = [] };
462-
var create = new SubscriptionCreateOptions { Customer = organization.StripeCustomerId, Items = [] };
462+
var update = new SubscriptionUpdateOptions { Items = new List<SubscriptionItemOptions>() };
463+
var create = new SubscriptionCreateOptions { Customer = organization.StripeCustomerId, Items = new List<SubscriptionItemOptions>() };
463464
bool cardUpdated = false;
464465

465466
var customerUpdateOptions = new CustomerUpdateOptions { Description = organization.Name };

0 commit comments

Comments
 (0)