feat(settlement): add receipt handling and detail view for settlements

This commit is contained in:
hamed
2026-06-25 17:34:39 +03:30
parent 71edc772c8
commit 694ee28787
11 changed files with 484 additions and 3 deletions
@@ -1495,6 +1495,52 @@ class AdminApiController extends BaseController
return $this->paginated($items, (int) $total, $page, $limit);
}
#[OA\Get(
path: '/api/v1/admin/settlement/{uuid}',
summary: 'جزئیات یک درخواست تسویه (ادمین)',
security: [['bearerAuth' => []]],
parameters: [new OA\Parameter(name: 'uuid', in: 'path', required: true, schema: new OA\Schema(type: 'string'))],
responses: [
new OA\Response(response: 200, description: 'جزئیات تسویه'),
new OA\Response(response: 404, description: 'یافت نشد'),
]
)]
#[Route('/api/v1/admin/settlement/{uuid}', methods: ['GET'])]
public function settlementDetail(string $uuid): JsonResponse
{
$row = $this->em->createQueryBuilder()
->select(
's.uuid, s.amountRials, s.status, s.bankAccount, s.adminNote, s.receipt, s.reviewedAt, s.createdAt, s.updatedAt',
'u.realName as user_name, u.mobileNumber as user_mobile',
)
->from(Settlement::class, 's')
->join('s.user', 'u')
->where('s.uuid = :uuid')
->setParameter('uuid', $uuid)
->getQuery()->getArrayResult();
if (empty($row)) {
return $this->error('NOT_FOUND', 'درخواست تسویه یافت نشد', 404);
}
$s = $row[0];
return $this->success([
'uuid' => $s['uuid'],
'representation_name' => $s['user_name'] ?? $s['user_mobile'],
'representation_mobile' => $s['user_mobile'],
'amount' => (int) $s['amountRials'],
'status' => $s['status'],
'bank_card' => $s['bankAccount']['card'] ?? null,
'bank_name' => $s['bankAccount']['bank_name'] ?? null,
'bank_iban' => $s['bankAccount']['iban'] ?? null,
'bank_owner' => $s['bankAccount']['owner_name'] ?? null,
'reject_reason' => $s['adminNote'],
'receipt' => $s['receipt'] ?? null,
'requested_at' => date('c', (int) $s['createdAt']),
'processed_at' => $s['reviewedAt'] ? date('c', (int) $s['reviewedAt']) : null,
]);
}
// ── SMS Templates (paginated list with optional status filter) ────────────
#[OA\Get(