This commit is contained in:
GukSang.Jin
2026-03-18 17:48:40 +08:00
parent 65f4fa02ca
commit fe8d433e32
30 changed files with 2037 additions and 26 deletions

View File

@@ -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)
{