#27 small changes for the userTransaction
This commit is contained in:
@@ -5,7 +5,7 @@ namespace Hutopy.Application.Stripe.Commands;
|
||||
public record CreateSessionCheckoutCommand : IRequest<string>
|
||||
{
|
||||
public required string CreatorId { get; init; }
|
||||
public required int Price { get; init; }
|
||||
public required int Amount { get; init; }
|
||||
public string Currency { get; init; } = "CAD";
|
||||
public string TipMessage { get; init; } = string.Empty;
|
||||
}
|
||||
@@ -18,11 +18,16 @@ public class CreateSessionCheckoutCommandHandler(
|
||||
{
|
||||
public async Task<string> Handle(CreateSessionCheckoutCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var stripeSecret = await stripeService.CreateCheckoutSession(request.Price, request.Currency);
|
||||
var stripeSecret = await stripeService.CreateCheckoutSession(request.Amount, request.Currency);
|
||||
|
||||
// ReSharper disable once PossibleLossOfFraction
|
||||
decimal priceInDollars = (request.Amount / 100);
|
||||
|
||||
|
||||
//todo: Need to add this transaction after the confirmation from stripe in the frontEnd ( redirect, re-call backend )
|
||||
var userTransaction = new UserTransaction
|
||||
{
|
||||
Currency = request.Currency, Amount = request.Price, TipMessage = request.TipMessage, ApplicationUserId = request.CreatorId
|
||||
Currency = request.Currency, Amount = priceInDollars, TipMessage = request.TipMessage, ApplicationUserId = request.CreatorId
|
||||
};
|
||||
|
||||
await dbContext.UserTransactions.AddAsync(userTransaction, cancellationToken);
|
||||
|
||||
Reference in New Issue
Block a user