Skip to content

Migrate the daily posting pipeline (CBTRN01C, CBTRN02C) to com.carddemo.batch.posting - #188

Open
devanshi-gpta wants to merge 1 commit into
devin/1786577620-carddemo-java-foundationfrom
devin/1786577935-carddemo-posting
Open

devanshi-gpta wants to merge 1 commit into
devin/1786577620-carddemo-java-foundationfrom
devin/1786577935-carddemo-posting

Conversation

@devanshi-gpta

@devanshi-gpta devanshi-gpta commented Aug 12, 2026

Copy link
Copy Markdown

Summary

Migrates the daily posting pipeline — CBTRN01C (verification pass) and CBTRN02C (posting, JCL POSTTRAN + DALYREJS) — into com.carddemo.batch.posting. Rules live in @Services; DailyPostingJobConfig only wires them into Spring Batch (dailyTransactionVerificationJob, postTransactionJob; DALYTRAN read ordered by DALYTRAN-ID, rejects to a flat file at carddemo.batch.posting.reject-file). No shared entity/repository/pom changes.

Behavioral details worth knowing, all taken literally from 1500-* / 2000-*:

  • Reject reasons are the COBOL codes and messages verbatim (PostingRejectReason): 100 INVALID CARD NUMBER FOUND, 101/109 ACCOUNT RECORD NOT FOUND, 102 OVERLIMIT TRANSACTION, 103 TRANSACTION RECEIVED AFTER ACCT EXPIRATION.
  • 1500-B-LOOKUP-ACCT evaluates the limit check then the expiry check into the same field, so a transaction that is both over limit and past expiry is rejected as 103 — reproduced by overwriting reason, not by short-circuiting.
  • Limit test is ACCT-CREDIT-LIMIT >= (cycCredit - cycDebit + amt), i.e. exactly-on-the-limit is accepted; expiry test is an alphanumeric compare of ACCT-EXPIRAION-DATE against DALYTRAN-ORIG-TS(1:10), so the expiration date itself is accepted.
  • 2800-UPDATE-ACCOUNT-REC adds the signed amount: currBal += amt, then amt >= 0 ? cycCredit += amt : cycDebit += amt (a negative amount therefore decreases the cycle debit). Update order is preserved: TCATBAL (create-or-add) → ACCOUNT → TRANSACT.
  • A failing account REWRITE only records reason 109 (PostingResult.getAccountUpdateFailure()); the transaction is still written to TRANSACT and no reject record is produced, as in the COBOL.
  • TransactionRejectRecord renders the 430-byte DALYREJS record (350-byte CVTRA06Y image + PIC 9(04) reason + PIC X(76) desc), including zoned-decimal overpunch for DALYTRAN-AMT; a test round-trips a real app/data/ASCII/dailytran.txt record through parse → render.
  • TRAN-PROC-TS uses the Z-GET-DB2-FORMAT-TIMESTAMP layout EEEE-MM-DD-UU.MM.SS.HH0000, with an injectable Clock for tests.

mvn -B clean verify passes (28 tests; 18 new covering an accepted posting, each reject reason, the limit/expiry boundaries, the negative/zero-amount branches and reason 109).

Link to Devin session: https://app.devin.ai/sessions/4ac427d3381745c0acad80fdc924e933
Requested by: @devanshi-gpta


Devin Review

Status Commit
⚪ Not started

Run Devin Review

Open in Devin Review (Staging)

Co-Authored-By: Devanshi Gupta <devanshi.gupta@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown

🤖 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

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