Removed need for users to be signed in to tip

This commit is contained in:
Karl Carriere
2025-01-06 15:18:33 -05:00
parent 6b0cc416a9
commit a9c015e82d
2 changed files with 5 additions and 11 deletions

View File

@@ -51,6 +51,8 @@ public class SendTipHandler(
{
Post("/api/tips");
Options(o => o.WithTags("Memberships"));
AllowAnonymous();
}
public override async Task HandleAsync(
@@ -68,8 +70,6 @@ public class SendTipHandler(
}
var checkoutSession = await stripeService.CreateTipCheckoutSessionAsync(
User.GetUserId(),
User.GetAlias()!,
creator.Id,
creator.Name,
req.Amount,
@@ -77,7 +77,8 @@ public class SendTipHandler(
req.Message,
creator.StripeAccountId,
req.CheckoutSuccessUrl,
req.CheckoutCancelledUrl);
req.CheckoutCancelledUrl
);
await SendAsync(
new SendTipResponse("Pending", checkoutSession.Url),

View File

@@ -55,8 +55,6 @@ public sealed class StripeService(
}
public async Task<Session> CreateTipCheckoutSessionAsync(
Guid tipperId,
string tipperName,
Guid creatorId,
string creatorName,
decimal amount,
@@ -72,10 +70,7 @@ public sealed class StripeService(
// Create Stripe customer for the user if not already created
var customerService = new CustomerService();
var customer = await customerService.CreateAsync(
new CustomerCreateOptions
{
Metadata = new Dictionary<string, string> { { "userId", tipperId.ToString() } }
},
new CustomerCreateOptions{},
cancellationToken: ct);
// Create paymentIntent for the user
@@ -116,8 +111,6 @@ public sealed class StripeService(
CancelUrl = cancelUrl, // Redirect after canceled payment
Metadata = new Dictionary<string, string>
{
{ "tipperId", tipperId.ToString() },
{ "tipperName", tipperName },
{ "creatorId", creatorId.ToString() },
{ "creatorName", creatorName },
{ "message", message },