Table of Contents

Interface ICardReplacementRequestRepository

Namespace
SEBT.Portal.Core.Repositories
Assembly
SEBT.Portal.Core.dll

Repository for tracking card replacement requests. Used to enforce the 14-day cooldown between replacement requests per case. All identifier values are pre-hashed by callers via IIdentifierHasher.

public interface ICardReplacementRequestRepository

Methods

CreateAsync(string, string, Guid, CancellationToken)

Records a new card replacement request.

Task CreateAsync(string householdIdentifierHash, string caseIdHash, Guid requestedByUserId, CancellationToken cancellationToken = default)

Parameters

householdIdentifierHash string

HMAC hash of the household identifier.

caseIdHash string

HMAC hash of the case ID.

requestedByUserId Guid

The ID of the user making the request.

cancellationToken CancellationToken

Cancellation token.

Returns

Task

GetMostRecentRequestDateAsync(string, string, CancellationToken)

Returns the most recent request timestamp for a given household+case, or null if no request has ever been recorded. Used to hydrate CardRequestedAt so the frontend can enforce cooldown UI.

Task<DateTime?> GetMostRecentRequestDateAsync(string householdIdentifierHash, string caseIdHash, CancellationToken cancellationToken = default)

Parameters

householdIdentifierHash string
caseIdHash string
cancellationToken CancellationToken

Returns

Task<DateTime?>

HasRecentRequestAsync(string, string, TimeSpan, CancellationToken)

Checks whether a card replacement request exists for the given household+case within the specified cooldown period.

Task<bool> HasRecentRequestAsync(string householdIdentifierHash, string caseIdHash, TimeSpan cooldownPeriod, CancellationToken cancellationToken = default)

Parameters

householdIdentifierHash string

HMAC hash of the household identifier.

caseIdHash string

HMAC hash of the case ID.

cooldownPeriod TimeSpan

The minimum time that must elapse between requests.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<bool>

True if a request exists within the cooldown window.