Skip to content

Reduce AddDailySummaryRecord parameter count with a summary totals value object#1686

Merged
StuartFerguson merged 3 commits into
masterfrom
copilot/fix-add-daily-summary-record-parameters
Mar 18, 2026
Merged

Reduce AddDailySummaryRecord parameter count with a summary totals value object#1686
StuartFerguson merged 3 commits into
masterfrom
copilot/fix-add-daily-summary-record-parameters

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 18, 2026

MerchantStatementAggregateExtensions.AddDailySummaryRecord exceeded the repository’s parameter-count complexity threshold by taking 10 arguments. This change collapses the daily summary metrics into a single value object while keeping the aggregate behavior and emitted event payload unchanged.

  • API refactor

    • Introduced MerchantStatementSummaryTotals in TransactionProcessor.Aggregates/MerchantStatementAggregate.cs
    • Changed AddDailySummaryRecord to accept:
      • DateTime activityDate
      • MerchantStatementSummaryTotals summaryTotals
  • Call site updates

    • Updated the merchant statement domain service to construct and pass the new totals object
    • Updated aggregate tests, statement builder tests, and shared test data helpers to use the new API
  • Behavior preserved

    • Duplicate-summary handling remains unchanged
    • The aggregate still emits StatementSummaryForDateEvent with the same individual counts and values
merchantStatementAggregate.AddDailySummaryRecord(
    merchantStatementForDateAggregate.ActivityDate,
    new MerchantStatementSummaryTotals(
        transactionsResult.Count,
        transactionsResult.TotalAmount,
        settledFeesResult.Count,
        settledFeesResult.TotalAmount,
        depositsResult.Count,
        depositsResult.TotalAmount,
        withdrawalsResult.Count,
        withdrawalsResult.TotalAmount));

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • f.feedz.io
    • Triggering command: /usr/bin/dotnet dotnet test /home/REDACTED/work/TransactionProcessor/TransactionProcessor/TransactionProcessor.Tests/TransactionProcessor.Tests.csproj --filter VerifyBootstrapperIsValid --no-restore -nologo (dns block)
    • Triggering command: /usr/bin/dotnet dotnet test /home/REDACTED/work/TransactionProcessor/TransactionProcessor/TransactionProcessor.Aggregates.Tests/TransactionProcessor.Aggregates.Tests.csproj --filter MerchantStatementAggregateTests --no-restore -nologo (dns block)
    • Triggering command: /usr/bin/dotnet dotnet test /home/REDACTED/work/TransactionProcessor/TransactionProcessor/TransactionProcessor.BusinessLogic.Tests/TransactionProcessor.BusinessLogic.Tests.csproj --filter StatementBuilderTests --no-restore -nologo (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[Complexity] Method MerchantStatementAggregateExtensions::AddDailySummaryRecord has 10 parameters (limit is 8)</issue_title>
<issue_description>Codacy ID: b954e92132cc4151ea21769fad3f13b

File: TransactionProcessor.Aggregates/MerchantStatementAggregate.cs
Line: 252
Rule: Complexity (Warning)
Commit: d6839d7baa9eededa6525914ad079ca09380b7e4

Message: Method MerchantStatementAggregateExtensions::AddDailySummaryRecord has 10 parameters (limit is 8)

**Code Snippet:**
```csharp
        public static Result AddDailySummaryRecord(this MerchantStatementAggregate aggregate, DateTime activityDate,  
```

</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
@StuartFerguson StuartFerguson marked this pull request as ready for review March 18, 2026 15:08
Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
Copilot AI changed the title [WIP] [Complexity] Fix method with excessive parameters Reduce AddDailySummaryRecord parameter count with a summary totals value object Mar 18, 2026
Copilot AI requested a review from StuartFerguson March 18, 2026 15:12
@StuartFerguson StuartFerguson merged commit 3934efb into master Mar 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Complexity] Method MerchantStatementAggregateExtensions::AddDailySummaryRecord has 10 parameters (limit is 8)

2 participants