refactor: extract Models and Data into MoneyMap.Core shared library
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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 };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user