Skip to content

Expose RechargeAccount direction as string property#539

Open
jSylvestre wants to merge 2 commits into
masterfrom
JCS/InfoForRechargeDetails
Open

Expose RechargeAccount direction as string property#539
jSylvestre wants to merge 2 commits into
masterfrom
JCS/InfoForRechargeDetails

Conversation

@jSylvestre

@jSylvestre jSylvestre commented Jul 1, 2026

Copy link
Copy Markdown
Member

So API calls to get details are clear

Summary by CodeRabbit

  • New Features

    • Added a human-readable direction label for recharge accounts (Credit/Debit).
  • Bug Fixes

    • Updated validation to stay consistent with the new non-persisted direction label.
  • Tests

    • Extended database tests to verify the direction label output for both Credit and Debit values.
  • Documentation / API Updates

    • Refreshed Swagger contact details and removed the declared X-Auth-Token header from Swagger operations.

So API calls to get details are clear
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

A computed DirectionType property is added to RechargeAccount and covered by tests. Swagger contact metadata is updated, and the generated operation header parameter for X-Auth-Token is removed.

Changes

RechargeAccount DirectionType

Layer / File(s) Summary
Property and tests
src/Payments.Core/Domain/RechargeAccount.cs, tests/Payments.Tests/DatabaseTests/RechargeAccountTests.cs
Adds a [NotMapped] computed DirectionType property returning Direction.ToString(), updates the database field-coverage assertion, and adds theory coverage for Credit and Debit.

Swagger metadata

Layer / File(s) Summary
Swagger contact and operation filter
src/Payments.Mvc/Startup.cs, src/Payments.Mvc/Swagger/SecurityRequirementsOperationFilter.cs
Changes the OpenAPI contact name and URL, and removes the X-Auth-Token header parameter from generated Swagger operations while leaving the remaining security handling in place.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: srkirkland

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main change: exposing RechargeAccount direction as a string property.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch JCS/InfoForRechargeDetails

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/Payments.Core/Domain/RechargeAccount.cs (1)

22-24: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider a clearer property name.

DirectionType returns the direction's name (e.g. "Credit"), not a "type" per se — DirectionName or DirectionString would better convey intent. Purely stylistic, not blocking.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Payments.Core/Domain/RechargeAccount.cs` around lines 22 - 24, Rename the
RechargeAccount computed property DirectionType to a clearer name such as
DirectionName or DirectionString, and update any internal references to match;
the property currently returns Direction.ToString(), so the new name should
better reflect that it exposes the direction’s string representation rather than
a type.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/Payments.Core/Domain/RechargeAccount.cs`:
- Around line 22-24: Rename the RechargeAccount computed property DirectionType
to a clearer name such as DirectionName or DirectionString, and update any
internal references to match; the property currently returns
Direction.ToString(), so the new name should better reflect that it exposes the
direction’s string representation rather than a type.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b3848c7f-38fa-4726-aa39-20dbc777cf75

📥 Commits

Reviewing files that changed from the base of the PR and between 6867c69 and fed485f.

📒 Files selected for processing (2)
  • src/Payments.Core/Domain/RechargeAccount.cs
  • tests/Payments.Tests/DatabaseTests/RechargeAccountTests.cs

Remove redundant X-Auth-Token header parameter to avoid confusion with the main authorization flow.
Update the Swagger API contact information to the central CAES help portal URL.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/Payments.Mvc/Swagger/SecurityRequirementsOperationFilter.cs (1)

50-67: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove dead code instead of commenting it out.

The operation.Parameters list initialization (Lines 50-53) is now unused since the only parameter addition is commented out (Lines 55-67). Delete both instead of leaving commented-out code behind; version control already preserves history if it's needed later.

♻️ Proposed cleanup
-            if (operation.Parameters == null)
-            {
-                operation.Parameters = new List<OpenApiParameter>();
-            }
-
-            //Having this parameter causes confusion in swagger UI as the main authorization must be used
-            //operation.Parameters.Add(new OpenApiParameter
-            //{
-            //    Name = "X-Auth-Token", //ApiKeyMiddleware.HeaderKey,
-            //    In = ParameterLocation.Header,
-            //    Description = "access token",
-            //    Required = true,
-            //    Schema = new OpenApiSchema
-            //    {
-            //        Type = "string",
-            //        Default = new OpenApiString("ApiKey"),
-            //    }
-            //});
         }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Payments.Mvc/Swagger/SecurityRequirementsOperationFilter.cs` around lines
50 - 67, Remove the dead code from SecurityRequirementsOperationFilter: the
operation.Parameters null-initialization and the commented-out OpenApiParameter
block are no longer used. Update the method that builds the Swagger operation so
it no longer creates Parameters solely for the removed X-Auth-Token entry, and
keep the implementation focused on the active security requirements logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/Payments.Mvc/Swagger/SecurityRequirementsOperationFilter.cs`:
- Around line 50-67: Remove the dead code from
SecurityRequirementsOperationFilter: the operation.Parameters
null-initialization and the commented-out OpenApiParameter block are no longer
used. Update the method that builds the Swagger operation so it no longer
creates Parameters solely for the removed X-Auth-Token entry, and keep the
implementation focused on the active security requirements logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 81a6e287-dd84-4c46-80ba-1d7084253cb1

📥 Commits

Reviewing files that changed from the base of the PR and between fed485f and 7cbd021.

📒 Files selected for processing (2)
  • src/Payments.Mvc/Startup.cs
  • src/Payments.Mvc/Swagger/SecurityRequirementsOperationFilter.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant