mirror of
https://github.com/D4M13N-D3V/art_platform.git
synced 2025-03-14 07:44:54 +00:00
comments
This commit is contained in:
parent
65c7a720c4
commit
52bd3cce1d
@ -19,6 +19,12 @@ public class AdminSellerProfileRequestsController : Controller
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of all of the requests from users to become a seller.
|
||||
/// </summary>
|
||||
/// <param name="offset"> The offset to start at.</param>
|
||||
/// <param name="pageSize"> The amount of records to return.</param>
|
||||
/// <returns>A list of seller profile requests</returns>
|
||||
[HttpGet]
|
||||
[Authorize("read:seller-profile-request")]
|
||||
[Route("SellerRequests")]
|
||||
@ -29,6 +35,10 @@ public class AdminSellerProfileRequestsController : Controller
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the amount of requests there are from users to become a seller.
|
||||
/// </summary>
|
||||
/// <returns>The number of requests.</returns>
|
||||
[HttpGet]
|
||||
[Authorize("read:seller-profile-request")]
|
||||
[Route("SellerRequests/Count")]
|
||||
@ -38,6 +48,11 @@ public class AdminSellerProfileRequestsController : Controller
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Accepts a request to become a seller from a user.
|
||||
/// </summary>
|
||||
/// <param name="userId">The ID of the user to accept the request for.</param>
|
||||
/// <returns>The new seller profile.</returns>
|
||||
[HttpPut]
|
||||
[Authorize("write:seller-profile-request")]
|
||||
[Route("SellerRequests/{userId}")]
|
||||
|
@ -18,6 +18,7 @@ public class DiscoveryController : Controller
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
[Route("Sellers")]
|
||||
public async Task<IActionResult> GetSellers(string search="",int offset = 0, int pageSize = 10)
|
||||
|
@ -53,7 +53,7 @@ public class OrderController : Controller
|
||||
.FirstOrDefaultAsync(x=>x.Id==int.Parse(orderId));
|
||||
if (order != null && order.Status == EnumOrderStatus.WaitingForPayment)
|
||||
{
|
||||
order.PaymentUrl = _paymentService.ChargeForService(order.Id, order.Seller.StripeAccountId, order.Price);
|
||||
order.PaymentUrl = null;
|
||||
}
|
||||
}
|
||||
else if (stripeEvent.Type == Events.CheckoutSessionCompleted)
|
||||
@ -213,23 +213,13 @@ public class OrderController : Controller
|
||||
return BadRequest("Order is already complete.");
|
||||
if(order.Status!=EnumOrderStatus.WaitingForPayment)
|
||||
return BadRequest("Order does not need to be paid for.");
|
||||
order.TermsAcceptedDate = DateTime.UtcNow;
|
||||
if (order.Seller.PrepaymentRequired)
|
||||
{
|
||||
order.Status = EnumOrderStatus.InProgress;
|
||||
var url = _paymentService.ChargeForService(order.Id, order.Seller.StripeAccountId, order.Price);
|
||||
order.PaymentUrl = url;
|
||||
}
|
||||
else
|
||||
{
|
||||
order.Status = EnumOrderStatus.Completed;
|
||||
var url = _paymentService.ChargeForService(order.Id, order.Seller.StripeAccountId, order.Price);
|
||||
order.PaymentUrl = url;
|
||||
}
|
||||
if(order.PaymentUrl!=null)
|
||||
return BadRequest("Order has already has a payment url.");
|
||||
var url = _paymentService.ChargeForService(order.Id, order.Seller.StripeAccountId, order.Price);
|
||||
order.PaymentUrl = url;
|
||||
order = _dbContext.SellerServiceOrders.Update(order).Entity;
|
||||
await _dbContext.SaveChangesAsync();
|
||||
var result = order.ToModel();
|
||||
return Ok(result);
|
||||
return Ok(order.PaymentUrl);
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
|
Loading…
x
Reference in New Issue
Block a user