using GB5Shared.DTO.Framework.Login; using GoodBooks.PAY.PAYDAL.CustomCode.Order; using Microsoft.Extensions.Logging; namespace GoodBooks.PAY.PAYBLL.Transaction { // ───────────────────────────────────────────────────────────────────────── // PayTransactionBLL // // Read-only BLL for TPAYTRANSACTION. // Transactions are never created by direct API — they are created // internally by PayOrderBLL (on initiation) and PayWebhookBLL (on callback). // Cache level: NOT_REQUIRED — transactional financial data is always live. // ───────────────────────────────────────────────────────────────────────── public class PayTransactionBLL : IPayTransactionBLL { private readonly IPayTransactionDAL _dal; private readonly ILogger _logger; public PayTransactionBLL( IPayTransactionDAL dal, ILogger logger) { _dal = dal; _logger = logger; } // ── Get single transaction by internal Id ───────────────────────────── public async Task GetPayTransaction( int payTransactionId, LoginDTO login, CancellationToken ct) { try { return await _dal.GetPayTransaction(payTransactionId, login).ConfigureAwait(false); } catch (Exception ex) { _logger.LogError(ex, "GetPayTransaction failed for PayTransactionId {PayTransactionId}", payTransactionId); throw; } } // ── Get all transactions for a pay order ────────────────────────────── public async Task GetPayTransactionsByOrder( int payOrderId, LoginDTO login, CancellationToken ct) { try { return await _dal.GetPayTransactionsByOrder(payOrderId, login).ConfigureAwait(false); } catch (Exception ex) { _logger.LogError(ex, "GetPayTransactionsByOrder failed for PayOrderId {PayOrderId}", payOrderId); throw; } } } }