Skip to content

Commit

Permalink
fix sample
Browse files Browse the repository at this point in the history
  • Loading branch information
cecilphillip committed Nov 17, 2024
1 parent 14126b3 commit 877d54a
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions samples/SampleCheckout/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,13 @@
app.MapStripeWebhookHandler<MyWebhookHandler>();
app.Run();

public class MyWebhookHandler: StripeWebhookHandler
public class MyWebhookHandler(StripeClient stripeClient, StripeWebhookContext context, ILogger<MyWebhookHandler> logger)
: StripeWebhookHandler(context, logger)
{
private readonly StripeClient _stripeClient;
public MyWebhookHandler(IServiceProvider stripeServiceProvider, StripeWebhookContext context): base(context)
{
Logger = stripeServiceProvider.GetRequiredService<ILogger<MyWebhookHandler>>();
_stripeClient = stripeServiceProvider.GetRequiredService<StripeClient>();
//_stripeClient = stripeServiceProvider.GetKeyedService<StripeClient>(Context.StripeOptions.ClientName);
}

public override async Task OnCustomerCreatedAsync(Event e)
{
var customer = (e.Data.Object as Customer)!;
await _stripeClient.V1.Customers.UpdateAsync(customer.Id, new CustomerUpdateOptions()
await stripeClient.V1.Customers.UpdateAsync(customer.Id, new CustomerUpdateOptions()
{
Description = "New customer"
});
Expand Down

0 comments on commit 877d54a

Please sign in to comment.