fix: 문의 폼 제출과 텔레그램 추적 로그 개선
TaxBaik CI/CD / build-and-deploy (push) Successful in 59s
TaxBaik Browser E2E / browser-e2e (push) Failing after 1m42s

This commit is contained in:
2026-06-27 22:29:08 +09:00
parent 6be8a91cb6
commit 6af9221fab
2 changed files with 30 additions and 4 deletions
@@ -1,5 +1,6 @@
using System.Net.Http.Json;
using System.Text;
using System.Text.Json;
using TaxBaik.Application.Services;
namespace TaxBaik.Web.Services;
@@ -60,13 +61,14 @@ public class TelegramInquiryNotificationService : IInquiryNotificationService
try
{
var response = await client.PostAsJsonAsync(url, payload, ct);
var responseBody = await response.Content.ReadAsStringAsync(ct);
if (!response.IsSuccessStatusCode)
{
_logger.LogWarning("텔레그램 알림 전송 실패: {StatusCode}", response.StatusCode);
_logger.LogWarning("텔레그램 알림 전송 실패: {StatusCode} {ResponseBody}", response.StatusCode, Truncate(responseBody));
}
else
{
_logger.LogInformation("텔레그램 새 문의 알림 전송 성공: #{InquiryId}", inquiryId);
_logger.LogInformation("텔레그램 새 문의 알림 전송 성공: #{InquiryId}, message_id={MessageId}", inquiryId, TryGetMessageId(responseBody));
}
}
catch (Exception ex)
@@ -111,13 +113,14 @@ public class TelegramInquiryNotificationService : IInquiryNotificationService
try
{
var response = await client.PostAsJsonAsync(url, payload, ct);
var responseBody = await response.Content.ReadAsStringAsync(ct);
if (!response.IsSuccessStatusCode)
{
_logger.LogWarning("텔레그램 상태 변경 알림 실패: {StatusCode}", response.StatusCode);
_logger.LogWarning("텔레그램 상태 변경 알림 실패: {StatusCode} {ResponseBody}", response.StatusCode, Truncate(responseBody));
}
else
{
_logger.LogInformation("텔레그램 상태 변경 알림 전송 성공: #{InquiryId}", inquiryId);
_logger.LogInformation("텔레그램 상태 변경 알림 전송 성공: #{InquiryId}, message_id={MessageId}", inquiryId, TryGetMessageId(responseBody));
}
}
catch (Exception ex)
@@ -133,4 +136,26 @@ public class TelegramInquiryNotificationService : IInquiryNotificationService
"completed" => "완료",
_ => status
};
private static string TryGetMessageId(string responseBody)
{
try
{
using var document = JsonDocument.Parse(responseBody);
if (document.RootElement.TryGetProperty("result", out var result)
&& result.TryGetProperty("message_id", out var messageId))
{
return messageId.ToString();
}
}
catch (JsonException)
{
return "unknown";
}
return "unknown";
}
private static string Truncate(string value)
=> value.Length <= 500 ? value : value[..500] + "...";
}