93f2f1bd3b
Major refactor replacing Sale/Order with ShopPO → Invoice → LoadingSheet flow. Removed legacy Sale/Order models and features; introduced ShopPO, ShopPOItem, Invoice, LoadingSheetOrder, and SysConfig models. Updated related entities, enums, repositories, and controllers. Added new migrations for schema changes and system config. Overhauled business logic and DI registrations. Updated documentation with migration plan.
27 lines
841 B
C#
27 lines
841 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Distribution.Features.Payment;
|
|
|
|
[ApiController]
|
|
[Route("api/invoices/{invoiceId:guid}/payments")]
|
|
public class PaymentController(PaymentService service) : ControllerBase
|
|
{
|
|
[HttpGet]
|
|
public async Task<IActionResult> GetByInvoice(Guid invoiceId)
|
|
{
|
|
var result = await service.GetByInvoiceIdAsync(invoiceId);
|
|
return result is null ? NotFound() : Ok(result);
|
|
}
|
|
|
|
[HttpPost]
|
|
public async Task<IActionResult> Create(Guid invoiceId, CreatePaymentRequest request, CancellationToken ct)
|
|
{
|
|
try
|
|
{
|
|
var result = await service.CreateAsync(invoiceId, request, ct);
|
|
return result is null ? NotFound() : Ok(result);
|
|
}
|
|
catch (InvalidOperationException ex) { return BadRequest(new { error = ex.Message }); }
|
|
}
|
|
}
|