Skip to content

feat: link issued orders to payment intents - #170

Merged
afeezorobsco-cyber merged 12 commits into
DocForum:mainfrom
Marvellous805:feat/issue-85-order-payment-intents
Oct 20, 2026
Merged

afeezorobsco-cyber merged 12 commits into
DocForum:mainfrom
Marvellous805:feat/issue-85-order-payment-intents

Conversation

@Marvellous805

Copy link
Copy Markdown
Contributor

Summary

  • Implement the order model and doctor issuance paths from [Phase 4] Order models: Prescription + LabOrder (append-only) #9: consultations, immutable prescriptions and lab orders, corrections, and audit/export support.
  • Replace opaque payment order references with nullable typed foreign keys and a database constraint requiring exactly one order.
  • Create payment intents atomically when orders are issued; move unpaid intents to corrections and leave funded intents attached to their original orders.
  • Remove manual intent creation and update migration, API/architecture docs, and tests/fixtures.

Closes #85
Closes #9

Design decision

The issuing clinician selects the facility and total in native XLM stroops. A correction moves a created intent; once escrowed, the intent remains with the immutable original order and existing admin refund policy applies.

Validation

  • git diff --check passed.
  • Prisma validation, typecheck, and integration tests could not be run: backend dependencies were unavailable to install in this environment.

@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@Marvellous805 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@afeezorobsco-cyber

Copy link
Copy Markdown
Contributor

@Marvellous805 Thanks for the PR. It can't be merged yet. To unblock it:

CI is failing. Here's what broke:

Backend (typecheck + test + build):

src/export-sections.ts(21,28): error TS1005: ',' expected.
tests/testnet-integration/payments.test.mts(63,35): error TS1005: ';' expected.

Please fix these errors and run the same steps locally before pushing (npm run typecheck && npm test && npm run build, or cargo test for contracts).

Merge conflicts: this branch conflicts with main. Please rebase onto the latest main (git fetch upstream && git rebase upstream/main), resolve the conflicts (often ROADMAP.md, ARCHITECTURE*.md or prisma/schema.prisma), and force-push.

Push to this same branch and CI will re-run. Once it's green and conflict-free, it'll be reviewed for merge.

@afeezorobsco-cyber

Copy link
Copy Markdown
Contributor

@Marvellous805 Thanks for the update. The typecheck errors are fixed, but 1 test still fails (173 passed):

AssertionError: expected 23 to be 21

A count assertion is off by 2, probably a test that counts routes, migrations or records and now sees your additions. Please run npm test in backend/, update the expectation or fix the extra entries, rebase onto the latest main (this branch also conflicts with it), and push.

@afeezorobsco-cyber
afeezorobsco-cyber merged commit ae386dd into DocForum:main Oct 20, 2026
1 check passed
Oyinkans0la12 added a commit to Oyinkans0la12/docforum-core that referenced this pull request Oct 20, 2026
The main merge resolution dropped the Consultation doctorProfileId/signedAt
fields, the ConsultationAddendum model, the config block, the
/consultations router mount and the auto-sign-off job startup, so Prisma
could not generate and the controllers were unreachable.

Consultations are now created against the appointment they close (the FK
added in DocForum#170): creation resolves it through the appointments service so
only the authoring doctor can open a note, and orders/fixtures seed it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants