Removed need for users to be signed in to tip
This commit is contained in:
@@ -51,6 +51,8 @@ public class SendTipHandler(
|
|||||||
{
|
{
|
||||||
Post("/api/tips");
|
Post("/api/tips");
|
||||||
Options(o => o.WithTags("Memberships"));
|
Options(o => o.WithTags("Memberships"));
|
||||||
|
|
||||||
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(
|
public override async Task HandleAsync(
|
||||||
@@ -68,8 +70,6 @@ public class SendTipHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
var checkoutSession = await stripeService.CreateTipCheckoutSessionAsync(
|
var checkoutSession = await stripeService.CreateTipCheckoutSessionAsync(
|
||||||
User.GetUserId(),
|
|
||||||
User.GetAlias()!,
|
|
||||||
creator.Id,
|
creator.Id,
|
||||||
creator.Name,
|
creator.Name,
|
||||||
req.Amount,
|
req.Amount,
|
||||||
@@ -77,7 +77,8 @@ public class SendTipHandler(
|
|||||||
req.Message,
|
req.Message,
|
||||||
creator.StripeAccountId,
|
creator.StripeAccountId,
|
||||||
req.CheckoutSuccessUrl,
|
req.CheckoutSuccessUrl,
|
||||||
req.CheckoutCancelledUrl);
|
req.CheckoutCancelledUrl
|
||||||
|
);
|
||||||
|
|
||||||
await SendAsync(
|
await SendAsync(
|
||||||
new SendTipResponse("Pending", checkoutSession.Url),
|
new SendTipResponse("Pending", checkoutSession.Url),
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ public sealed class StripeService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Session> CreateTipCheckoutSessionAsync(
|
public async Task<Session> CreateTipCheckoutSessionAsync(
|
||||||
Guid tipperId,
|
|
||||||
string tipperName,
|
|
||||||
Guid creatorId,
|
Guid creatorId,
|
||||||
string creatorName,
|
string creatorName,
|
||||||
decimal amount,
|
decimal amount,
|
||||||
@@ -72,10 +70,7 @@ public sealed class StripeService(
|
|||||||
// Create Stripe customer for the user if not already created
|
// Create Stripe customer for the user if not already created
|
||||||
var customerService = new CustomerService();
|
var customerService = new CustomerService();
|
||||||
var customer = await customerService.CreateAsync(
|
var customer = await customerService.CreateAsync(
|
||||||
new CustomerCreateOptions
|
new CustomerCreateOptions{},
|
||||||
{
|
|
||||||
Metadata = new Dictionary<string, string> { { "userId", tipperId.ToString() } }
|
|
||||||
},
|
|
||||||
cancellationToken: ct);
|
cancellationToken: ct);
|
||||||
|
|
||||||
// Create paymentIntent for the user
|
// Create paymentIntent for the user
|
||||||
@@ -116,8 +111,6 @@ public sealed class StripeService(
|
|||||||
CancelUrl = cancelUrl, // Redirect after canceled payment
|
CancelUrl = cancelUrl, // Redirect after canceled payment
|
||||||
Metadata = new Dictionary<string, string>
|
Metadata = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "tipperId", tipperId.ToString() },
|
|
||||||
{ "tipperName", tipperName },
|
|
||||||
{ "creatorId", creatorId.ToString() },
|
{ "creatorId", creatorId.ToString() },
|
||||||
{ "creatorName", creatorName },
|
{ "creatorName", creatorName },
|
||||||
{ "message", message },
|
{ "message", message },
|
||||||
|
|||||||
Reference in New Issue
Block a user