Add FlatPaymentController with RESTful payment endpoints

Introduced FlatPaymentController under Distribution.Features.Payment, providing GET and POST endpoints at /api/payments. Supports listing, retrieving, and creating payments with filtering and error handling. Business logic is delegated to PaymentService.
This commit is contained in:
Kalana B. Thilakarathna
2026-08-26 20:18:58 +05:30
parent 83d3272784
commit dc7e7a70fc
27 changed files with 539 additions and 38 deletions
@@ -33,4 +33,15 @@ public class SaleController(SaleService service) : ControllerBase
var result = await service.CreateAsync(request, ct);
return result is null ? Forbid() : CreatedAtAction(nameof(GetById), new { id = result.Id }, result);
}
[HttpPatch("{id:guid}/cancel")]
public async Task<IActionResult> Cancel(Guid id, CancellationToken ct)
{
try
{
var result = await service.CancelAsync(id, ct);
return result is null ? NotFound() : Ok(result);
}
catch (InvalidOperationException ex) { return Conflict(new { error = ex.Message }); }
}
}