The service batch-confirms promo codes for a marketing campaign and returns a short summary of the call result. After a recent PR, behavior started to diverge from what is expected: some repeated requests are processed again, and when one item fails, the whole call ends early.
ClaimAsync method accepts a set of codes IEnumerable<string> and a CancellationToken.Trim().Skipped.Skipped.Skipped.Failed;CancellationToken must still stop the call by throwing an exception, not turn into a normal summary.PromoClaimService." SAVE10 ", "SAVE10", "FAIL";"SAVE10" with code "SAVE10";"FAIL" appears among valid codes.[" SAVE10 ", "SAVE10", "FAIL", " "]
" SAVE10 " and "SAVE10" refer to the same code after normalization..NET 8.0C# 12Task-based async without external services or DBPromoClaimService.ClaimAsync(IEnumerable<string> codes, CancellationToken cancellationToken) returns ClaimBatchResult"FAIL" in IPromoGateway simulates an external confirmation failure via InvalidOperationExceptionTrim() must be case-insensitiveUse line comments to explain the problem, its impact, the fix and how to test it.