Skip to content

Phase 1B: carddemo-refdata Spring Boot service for reference data (types, categories, disclosure groups) - #212

Open
devin-ai-integration[bot] wants to merge 3 commits into
devin/1781281050-modernization-blueprintfrom
devin/1781281993-phase1b-refdata-service
Open

devin-ai-integration[bot] wants to merge 3 commits into
devin/1781281050-modernization-blueprintfrom
devin/1781281993-phase1b-refdata-service

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 12, 2026

Copy link
Copy Markdown

Summary

New services/carddemo-refdata Spring Boot 3.3 module that replaces the COBOL/DB2 reference-data subsystem (COTRTLIC, COTRTUPC, COBTUPDT) with a REST API backed by PostgreSQL (H2 for tests).

Three JPA entities mirror the legacy copybook record layouts:

Copybook Entity PK
CVTRA03Y (RECLN=60) TransactionType typeCode CHAR(2)
CVTRA04Y (RECLN=60) TransactionCategory (typeCode, categoryCode) composite
CVTRA02Y (RECLN=50) DisclosureGroup (accountGroupId, transactionTypeCode, transactionCategoryCode) composite

REST endpoints — full CRUD under /reference/:

/reference/types              GET POST
/reference/types/{code}       GET PUT DELETE
/reference/categories         GET POST
/reference/categories/{typeCode}/{catCode}   GET PUT DELETE
/reference/disclosure-groups  GET POST
/reference/disclosure-groups/{groupId}/{typeCode}/{catCode}  GET PUT DELETE

Validation enforces COBOL field constraints: type code max 2 chars, category code 0–9999, interest rate as BigDecimal with @Digits(integer=4, fraction=2) matching PIC S9(04)V99.

63 tests pass (unit tests with Mockito for services, @SpringBootTest integration tests with MockMvc + H2 for controllers, @DataJpaTest for repositories).

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/31f7cb3a9d244544898908c73ce02252
Requested by: @DhrovS


Open in Devin Review

… categories, and disclosure groups

- JPA entities mapping COBOL copybooks CVTRA03Y, CVTRA04Y, CVTRA02Y
- Full CRUD REST API under /reference/{types,categories,disclosure-groups}
- Bean validation: type code length, category code range, interest rate precision
- PostgreSQL-backed with H2 test profile
- 63 passing tests (unit + integration)
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

devin-ai-integration[bot]

This comment was marked as resolved.

…9 responses

Addresses Devin Review findings:
- Custom DuplicateEntityException avoids catching unrelated IllegalArgumentExceptions as 409
- Null-safe message handling in GlobalExceptionHandler

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Devin Review found 3 new potential issues.

Open in Devin Review

Comment on lines +35 to +39
@Id
@Column(name = "category_code", nullable = false)
@Min(0)
@Max(9999)
private int categoryCode;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🚩 Primitive int PK fields silently default to 0 when omitted from JSON

The categoryCode field in TransactionCategory (TransactionCategory.java:39) and transactionCategoryCode in DisclosureGroup (DisclosureGroup.java:50) are primitive int, so Jackson defaults them to 0 when the JSON field is absent. Since @Min(0) allows 0, a POST request omitting the category code will silently create an entity with code 0 rather than rejecting the request. This is technically valid per the COBOL PIC 9(04) spec (range 0000–9999), but could surprise API consumers. Using Integer with @NotNull would make the field truly required in the JSON body.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Acknowledged — this is technically valid per the COBOL PIC 9(04) spec (range 0000–9999), so 0 is a legitimate category code. Switching to Integer + @NotNull would change the semantics by disallowing code 0, which the legacy system permits. Leaving as-is for fidelity to the COBOL layout.

Comment on lines +7 to +8
username: carddemo
password: carddemo

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🚩 Hardcoded database credentials in application.yml shipped with the artifact

The main application.yml contains username: carddemo and password: carddemo (application.yml:7-8). While these are documented as development defaults in the README, they are baked into the packaged JAR. If the application is deployed without overriding these properties via environment variables or external config, it would attempt to connect with these credentials. For a service intended to be deployed as a microservice, consider using placeholder syntax (e.g., ${DB_PASSWORD}) to force explicit configuration at deployment time.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Acknowledged — these are intentional development defaults for local/demo usage. Spring Boot's externalized config (env vars, --spring.datasource.password=..., or external application.yml) will override at deployment time. This matches the pattern used in the other CardDemo modernization modules.

…creates

Catches constraint violations from concurrent inserts that pass the
existsById check but hit the DB unique constraint, returning 409
instead of 500.
@devin-ai-integration
devin-ai-integration Bot changed the base branch from main to devin/1781281050-modernization-blueprint June 12, 2026 16:53
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