refactor(billing): consume dunite-stripe-core (DEV-514) #491

Merged
longjacksonle merged 2 commits from feat/DEV-514-consume-stripe-core into main 2026-08-03 19:27:07 +02:00

What

First consumer of the shared dunite-stripe-core crate (DEV-514, under the DEV-495 epic). Replaces mokosh's local Stripe primitives with the shared, framework-agnostic crate so a8n-tools, bunyip, and mokosh stop maintaining three copies.

Changes

  • Depend on dunite-stripe-core (pinned by git rev to psa-systems/dunite; see the companion dunite PR #27). Add .cargo/config.toml with git-fetch-with-cli so CI authenticates against the private repo (mirrors bunyip).
  • provider/stripe.rs: drop the local verify_stripe_signature + hex_encode, to_minor_units/from_minor_units, and the manual event-envelope parse; call the crate's verify_webhook_signature (constant-time), to/from_minor_units, and parse_event_envelope instead. mokosh keeps its own data.object -> PaymentEvent mapping.
  • The signature + money unit tests moved to dunite (tested at the source); mokosh keeps its event-mapping tests, now carrying the id field Stripe always sends.

Testing

  • just check clean (clippy -D warnings, fmt, gates).
  • 5 provider unit tests (event mapping) pass.
  • pms711_stripe_pay_now integration suite (paid + idempotent redelivery, partial refund, abandoned no-op, bad-signature 401) all pass in-container against the real webhook route - confirming the swapped constant-time verifier behaves identically.

Merge order

Depends on dunite PR #27. Once dunite lands, re-pin the rev to the merged commit before merging this. bunyip and a8n-tools adoption follow under DEV-514 (a8n's adoption fixes its non-constant-time verifier).

🤖 Generated with Claude Code

https://claude.ai/code/session_01QLd9c7niucrqx68v4AxVss

## What First consumer of the shared `dunite-stripe-core` crate (DEV-514, under the DEV-495 epic). Replaces mokosh's local Stripe primitives with the shared, framework-agnostic crate so a8n-tools, bunyip, and mokosh stop maintaining three copies. ## Changes - Depend on `dunite-stripe-core` (pinned by git rev to psa-systems/dunite; see the companion dunite PR #27). Add `.cargo/config.toml` with `git-fetch-with-cli` so CI authenticates against the private repo (mirrors bunyip). - `provider/stripe.rs`: drop the local `verify_stripe_signature` + `hex_encode`, `to_minor_units`/`from_minor_units`, and the manual event-envelope parse; call the crate's `verify_webhook_signature` (constant-time), `to/from_minor_units`, and `parse_event_envelope` instead. mokosh keeps its own `data.object -> PaymentEvent` mapping. - The signature + money unit tests moved to dunite (tested at the source); mokosh keeps its event-mapping tests, now carrying the `id` field Stripe always sends. ## Testing - `just check` clean (clippy `-D warnings`, fmt, gates). - 5 provider unit tests (event mapping) pass. - `pms711_stripe_pay_now` integration suite (paid + idempotent redelivery, partial refund, abandoned no-op, bad-signature 401) all pass in-container against the real webhook route - confirming the swapped constant-time verifier behaves identically. ## Merge order Depends on dunite PR #27. Once dunite lands, re-pin the rev to the merged commit before merging this. bunyip and a8n-tools adoption follow under DEV-514 (a8n's adoption fixes its non-constant-time verifier). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QLd9c7niucrqx68v4AxVss
Add the git-rev-pinned dunite-stripe-core dependency (the first shared crate under the DEV-495 epic) and a .cargo/config.toml with git-fetch-with-cli so cargo authenticates against the private psa-systems/dunite Forgejo repo (mirrors bunyip's config). Pinned by rev, not branch, so a dunite bump is an explicit reviewable diff; re-pin to the merged commit once dunite PR #27 lands.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QLd9c7niucrqx68v4AxVss
refactor(billing): consume dunite-stripe-core for Stripe primitives (DEV-514)
Some checks failed
Check / fmt + clippy + build + tests (pull_request) Successful in 1m51s
Integration / integration tests (pull_request) Successful in 3m20s
E2E / Playwright against staging (pull_request) Failing after 6m21s
Create release / Gate (release-branch merges only) (pull_request) Successful in 1s
Create release / Create release from merged PR (pull_request) Has been skipped
32fb7de3a5
Replace mokosh's local Stripe webhook signature verifier, hex encoder, money major<->minor conversion, and raw event-envelope parse with the shared dunite-stripe-core crate (also consumed by a8n-tools and bunyip, so the same defect is not fixed three times). The verifier is now the crate's constant-time implementation. parse_stripe_event keeps mokosh's own data.object -> PaymentEvent mapping on top of the shared envelope parse. The signature + money unit tests moved to dunite (tested there); mokosh keeps its event-mapping tests, now carrying the id field Stripe always sends. pms711 integration suite (paid/refund/abandoned/bad-signature) stays green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QLd9c7niucrqx68v4AxVss
longjacksonle scheduled this pull request to auto merge when all checks succeed 2026-08-03 18:07:29 +02:00
longjacksonle deleted branch feat/DEV-514-consume-stripe-core 2026-08-03 19:27:07 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!491
No description provided.