Files
MoneyMap/MoneyMap.Core/Models/Import/PaymentResolutionResult.cs
T
2026-04-20 18:16:33 -04:00

33 lines
1.2 KiB
C#

namespace MoneyMap.Models.Import
{
/// <summary>
/// Result of resolving a payment method (card or account) for a transaction.
/// </summary>
public class PaymentResolutionResult
{
public bool IsSuccess { get; init; }
public int? CardId { get; init; }
public int? AccountId { get; init; }
public string? Last4 { get; init; }
public string? ErrorMessage { get; init; }
/// <summary>
/// Creates a successful result when a card is used.
/// </summary>
public static PaymentResolutionResult SuccessCard(int cardId, int accountId, string last4) =>
new() { IsSuccess = true, CardId = cardId, AccountId = accountId, Last4 = last4 };
/// <summary>
/// Creates a successful result when a direct account transaction (no card).
/// </summary>
public static PaymentResolutionResult SuccessAccount(int accountId, string last4) =>
new() { IsSuccess = true, AccountId = accountId, Last4 = last4 };
/// <summary>
/// Creates a failure result with error message.
/// </summary>
public static PaymentResolutionResult Failure(string error) =>
new() { IsSuccess = false, ErrorMessage = error };
}
}