Skip to content
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
9dfee0a
Initial plan
Copilot Aug 11, 2025
2395dcf
Update Stripe.net from 47.4.0 to 48.0.2 and fix breaking changes
Copilot Aug 11, 2025
b32732f
Merge branch 'main' into copilot/fix-1937
niemyjski Aug 25, 2025
b2479a2
Fix Stripe.net v48 breaking changes: handle nullable UnitAmount and c…
Copilot Aug 25, 2025
ea39f39
Merge branch 'main' into copilot/fix-1937
niemyjski Aug 26, 2025
1f13ded
Fix remaining Stripe.net v48 breaking changes: Invoice.Paid, Invoice.…
Copilot Aug 26, 2025
25a00e2
Apply code review suggestions: use String.Equals for status compariso…
Copilot Aug 26, 2025
b0bc8c4
Fix InvoiceLineItem.Price property access for Stripe.net v48 compatib…
Copilot Aug 26, 2025
77a7c41
Fix InvoiceLineItem property access for Stripe.net v48 - remove Price…
Copilot Aug 28, 2025
80a9faf
Attempt to fix InvoiceLineItem.Price access using separate PriceServi…
Copilot Aug 28, 2025
048364e
Attempt to fix Stripe.net v48 line item Price property access with ex…
Copilot Aug 28, 2025
539e0ef
Use reflection to explore InvoiceLineItem properties and fallback to …
Copilot Aug 28, 2025
ba014dc
Implement full reflection-based approach for Price property access in…
Copilot Aug 28, 2025
c07716a
Remove reflection-based approach and use direct Price property access…
Copilot Aug 28, 2025
56f2daa
Update Stripe.net to v49.0.0 and fix breaking API changes
Copilot Oct 21, 2025
56a1efd
Use C# 12 collection expression syntax for cleaner initialization
Copilot Oct 21, 2025
faa6d3c
Fix v49 breaking change: Discount.Coupon moved to Discount.Source.Coupon
Copilot Oct 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Exceptionless.Core/Exceptionless.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.8" />
<PackageReference Include="Stripe.net" Version="47.4.0" />
<PackageReference Include="Stripe.net" Version="48.0.2" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to latest version: 49

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to Stripe.net v49.0.0 and fixed the breaking API changes. The main change in v49 is that InvoiceLineItem.Price was completely removed - now using Pricing.PriceDetails.Price for the price ID and fetching full Price objects via PriceService. Fixed in ee24f43.

<PackageReference Include="System.DirectoryServices" Version="9.0.8" />
<PackageReference Include="UAParser" Version="3.1.47" />
<PackageReference Include="Foundatio.Repositories.Elasticsearch" Version="7.17.17" Condition="'$(ReferenceFoundatioRepositoriesSource)' == '' OR '$(ReferenceFoundatioRepositoriesSource)' == 'false'" />
Expand Down
50 changes: 38 additions & 12 deletions src/Exceptionless.Web/Controllers/OrganizationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,19 @@
OrganizationId = organization.Id,
OrganizationName = organization.Name,
Date = stripeInvoice.Created,
Paid = stripeInvoice.Paid,
Paid = stripeInvoice.Status == "paid",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Paid = stripeInvoice.Status == "paid",
Paid = String.Equals(stripeInvoice.Status, "paid"),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Paid = String.Equals(stripeInvoice.Status, "paid"),

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied the suggestion to use String.Equals() for more robust string comparison. Fixed in 25a00e2.

Total = stripeInvoice.Total / 100.0m
};

foreach (var line in stripeInvoice.Lines.Data)
{
var item = new InvoiceLineItem { Amount = line.Amount / 100.0m, Description = line.Description };
if (line.Plan is not null)
if (line.Price is not null)
{
string planName = line.Plan.Nickname ?? _billingManager.GetBillingPlan(line.Plan.Id)?.Name ?? line.Plan.Id;
item.Description = $"Exceptionless - {planName} Plan ({(line.Plan.Amount / 100.0):c}/{line.Plan.Interval})";
string planName = line.Price.Nickname ?? _billingManager.GetBillingPlan(line.Price.Id)?.Name ?? line.Price.Id;

Check failure on line 251 in src/Exceptionless.Web/Controllers/OrganizationController.cs

View workflow job for this annotation

GitHub Actions / test-api

'InvoiceLineItem' does not contain a definition for 'Price' and no accessible extension method 'Price' accepting a first argument of type 'InvoiceLineItem' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 251 in src/Exceptionless.Web/Controllers/OrganizationController.cs

View workflow job for this annotation

GitHub Actions / test-api

'InvoiceLineItem' does not contain a definition for 'Price' and no accessible extension method 'Price' accepting a first argument of type 'InvoiceLineItem' could be found (are you missing a using directive or an assembly reference?)
var intervalText = line.Price.Recurring?.Interval ?? "one-time";
var priceAmount = line.Price.UnitAmount.HasValue ? (line.Price.UnitAmount.Value / 100.0) : 0.0;
item.Description = $"Exceptionless - {planName} Plan ({priceAmount:c}/{intervalText})";
}

var periodStart = line.Period.Start >= DateTime.MinValue ? line.Period.Start : stripeInvoice.PeriodStart;
Expand All @@ -258,7 +260,7 @@
invoice.Items.Add(item);
}

var coupon = stripeInvoice.Discount?.Coupon;
var coupon = stripeInvoice.Discounts?.FirstOrDefault()?.Coupon;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var coupon = stripeInvoice.Discounts?.FirstOrDefault()?.Coupon;
var coupon = stripeInvoice.Discounts?.FirstOrDefault(d => d.Deleted is false)?.Coupon;

Also see if we do have to do this null check on Discounts

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot var coupon = stripeInvoice.Discounts?.FirstOrDefault(d => d.Deleted is false)?.Coupon;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied the suggestion to filter out deleted discounts using FirstOrDefault(d => d.Deleted is false). The null check on Discounts is already handled by the null-conditional operator ?.. Fixed in 25a00e2.

if (coupon is not null)
{
if (coupon.AmountOff.HasValue)
Expand Down Expand Up @@ -429,15 +431,29 @@
var createCustomer = new CustomerCreateOptions
{
Source = stripeToken,
Plan = planId,
Description = organization.Name,
Email = CurrentUser.EmailAddress
};

var customer = await customerService.CreateAsync(createCustomer);

// Create subscription separately since Plan is deprecated in CustomerCreateOptions
var subscriptionCreateOptions = new SubscriptionCreateOptions
{
Customer = customer.Id,
Items = new List<SubscriptionItemOptions> { new SubscriptionItemOptions { Price = planId } }
};

// Apply coupon as discount if provided
if (!String.IsNullOrWhiteSpace(couponId))
createCustomer.Coupon = couponId;
{
subscriptionCreateOptions.Discounts = new List<SubscriptionDiscountOptions>
{
new SubscriptionDiscountOptions { Coupon = couponId }
};
}

var customer = await customerService.CreateAsync(createCustomer);
await subscriptionService.CreateAsync(subscriptionCreateOptions);

organization.BillingStatus = BillingStatus.Active;
organization.RemoveSuspension();
Expand All @@ -446,8 +462,8 @@
}
else
{
var update = new SubscriptionUpdateOptions { Items = [] };
var create = new SubscriptionCreateOptions { Customer = organization.StripeCustomerId, Items = [] };
var update = new SubscriptionUpdateOptions { Items = new List<SubscriptionItemOptions>() };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var update = new SubscriptionUpdateOptions { Items = new List<SubscriptionItemOptions>() };
var update = new SubscriptionUpdateOptions { Items = [] };

do we even need to initialize Items?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplified to use C# 12 collection expression [] syntax. We do need to initialize Items since we call .Add() on it later (lines 499 and 504). Fixed in 78a8bcf.

var create = new SubscriptionCreateOptions { Customer = organization.StripeCustomerId, Items = new List<SubscriptionItemOptions>() };
bool cardUpdated = false;

var customerUpdateOptions = new CustomerUpdateOptions { Description = organization.Name };
Expand All @@ -466,12 +482,22 @@
var subscription = subscriptionList.FirstOrDefault(s => !s.CanceledAt.HasValue);
if (subscription is not null)
{
update.Items.Add(new SubscriptionItemOptions { Id = subscription.Items.Data[0].Id, Plan = planId });
update.Items.Add(new SubscriptionItemOptions { Id = subscription.Items.Data[0].Id, Price = planId });
await subscriptionService.UpdateAsync(subscription.Id, update);
}
else
{
create.Items.Add(new SubscriptionItemOptions { Plan = planId });
create.Items.Add(new SubscriptionItemOptions { Price = planId });

// Apply coupon as discount if provided
if (!String.IsNullOrWhiteSpace(couponId))
{
create.Discounts = new List<SubscriptionDiscountOptions>
{
new SubscriptionDiscountOptions { Coupon = couponId }
};
}

await subscriptionService.CreateAsync(create);
}

Expand Down
Loading