fix: made the url endpoint better

This commit is contained in:
Damien Ostler 2024-02-24 22:11:43 -05:00
parent 3baa67fda3
commit 6b43c1bf8b

View File

@ -733,8 +733,11 @@ public class RequestsController : Controller
.FirstOrDefaultAsync(x=>x.Id==requestId); .FirstOrDefaultAsync(x=>x.Id==requestId);
if(request==null) if(request==null)
return NotFound(); return NotFound();
var paymentUrl = _paymentService.Charge(request.Id,request.Artist.StripeAccountId,Convert.ToDouble(request.Amount)); if(request.PaymentUrl==null)
return Ok(new {paymentUrl}); request.PaymentUrl = _paymentService.Charge(request.Id,request.Artist.StripeAccountId,Convert.ToDouble(request.Amount));
_dbContext.Entry(request).State = EntityState.Modified;
_dbContext.SaveChanges();
return Ok(new {paymentUrl = request.PaymentUrl});
} }
[Authorize("read:request")] [Authorize("read:request")]