Add Slip Verify
This commit is contained in:
41
AMREZ.EOP.API/Controllers/SCBController.cs
Normal file
41
AMREZ.EOP.API/Controllers/SCBController.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.Payments.SlipVerification;
|
||||
using AMREZ.EOP.Contracts.DTOs.Payments.SlipVerification;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace AMREZ.EOP.API.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class SCBController : ControllerBase
|
||||
{
|
||||
private readonly IVerifyFromImageUseCase _verifyFromImage;
|
||||
|
||||
public SCBController(IVerifyFromImageUseCase verifyFromImage)
|
||||
{
|
||||
_verifyFromImage = verifyFromImage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัปโหลด "รูปสลิป" เพื่อตรวจสอบกับธนาคาร (ไม่ใช้ OCR — scan QR + heuristic)
|
||||
/// </summary>
|
||||
[HttpPost("slips/verify")]
|
||||
[Consumes("multipart/form-data")]
|
||||
[RequestSizeLimit(5_000_000)]
|
||||
public async Task<IActionResult> VerifySlipFromImage(
|
||||
[FromForm(Name = "Image")] IFormFile? Image,
|
||||
[FromForm] string? OverrideSendingBank,
|
||||
CancellationToken ct)
|
||||
{
|
||||
if (Image is null || Image.Length == 0)
|
||||
return BadRequest(new { message = "Missing slip image" });
|
||||
|
||||
var res = await _verifyFromImage.ExecuteAsync(new VerifyFromImageRequest
|
||||
{
|
||||
Image = Image,
|
||||
OverrideSendingBank = OverrideSendingBank
|
||||
}, ct);
|
||||
|
||||
if (res is null) return NotFound(new { message = "Cannot extract transRef or verification failed" });
|
||||
return Ok(res);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user