更新
This commit is contained in:
@@ -43,6 +43,33 @@ public class OrdersController : ControllerBase
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("{id}/payment-qrcode")]
|
||||
public async Task<IActionResult> CreatePaymentQrCode(int id)
|
||||
{
|
||||
var order = await _orderService.GetOrderAsync(id);
|
||||
if (order == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var payment = await _weChatPayService.CreateNativePayAsync(order, HttpContext.RequestAborted);
|
||||
|
||||
return Ok(new CreateOrderResponse
|
||||
{
|
||||
Order = order,
|
||||
CodeUrl = payment.CodeUrl,
|
||||
OutTradeNo = payment.OutTradeNo,
|
||||
ExpiresAt = payment.ExpiresAt
|
||||
});
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
return StatusCode(StatusCodes.Status502BadGateway, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("{id}/payment")]
|
||||
public async Task<IActionResult> ConfirmPayment(int id)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user