mirror of
https://github.com/D4M13N-D3V/comissions-app-core-api.git
synced 2025-03-14 10:04:55 +00:00
fix: added endpoint to get stripe dashboard url
This commit is contained in:
parent
9973a31561
commit
b6eaee0831
@ -66,6 +66,23 @@ public class ArtistController : Controller
|
||||
var result = Artist.ToStatsModel();
|
||||
return Ok(result);
|
||||
}
|
||||
[HttpGet]
|
||||
[Authorize("read:artist")]
|
||||
[Route("PayoutDashboard")]
|
||||
public async Task<IActionResult> PayoutDashboard()
|
||||
{
|
||||
var userId = User.GetUserId();
|
||||
var Artist = await _dbContext.UserArtists.Include(x=>x.Requests).FirstOrDefaultAsync(Artist=>Artist.UserId==userId);
|
||||
if(Artist==null)
|
||||
{
|
||||
var ArtistRequest = await _dbContext.ArtistRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false);
|
||||
if(ArtistRequest!=null)
|
||||
return BadRequest();
|
||||
return Unauthorized();
|
||||
}
|
||||
var url = _paymentService.CreateDashboardUrl(Artist.StripeAccountId);
|
||||
return Ok(new {url});
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
[Authorize("write:artist")]
|
||||
|
@ -8,4 +8,5 @@ public interface IPaymentService
|
||||
string CreateArtistAccountOnboardingUrl(string accountId);
|
||||
bool ArtistAccountIsOnboarded(string accountId);
|
||||
string Charge(int orderArtistServiceId, string? sellerStripeAccountId, double orderPrice);
|
||||
string CreateDashboardUrl(string accountId);
|
||||
}
|
@ -128,4 +128,11 @@ public class StripePaymentServiceProvider:IPaymentService
|
||||
var session = service.Create(options, requestOptions);
|
||||
return session.Url;
|
||||
}
|
||||
|
||||
public string CreateDashboardUrl(string accountId)
|
||||
{
|
||||
var service = new LoginLinkService();
|
||||
var url = service.Create(accountId);
|
||||
return url.Url;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user