Add fattureincloud-style and escrow-style adapters - #47
Merged
Conversation
Two new reference adapters, both with conformance tests.
fattureincloud-style: a Fatture in Cloud-style bookkeeping API v2
simulator — entities, received/issued documents (CRUD + metodata),
suppliers, clients, products (CRUD), taxes, cashbook, webhooks, archive.
It models the conventions client code gets wrong against thinner sims:
Laravel pagination envelopes (last_page must be followed), {data}
wrappers, company-id scoping where a foreign id is an indistinguishable
404, genuine 401s for missing bearers, and amounts as decimal strings.
escrow-style: an Escrow.com-style transaction API simulator (public
2017-09-01 surface) — create with parties/items/schedules and a
caller-controlled or defaulted fee split, per-party agreement via PATCH,
secured-state transitions, lookup by id or reference, webhook
registration, and a clearly-namespaced /sim fund affordance standing in
for the hosted payment page no API can drive.
Both pass `stunt adapter lint` clean; `go test ./internal/engine/` covers
the 401/404 paths, pagination, decimal-string amounts, the metodata
endpoint, and the full agree→fund lifecycle.
…n schema, platform conformance Reviewer findings on PR #47 (2 criticals, 8 majors, 8 minors): fattureincloud-style: - CRITICAL: routes re-schemed to the real v2 API — /c/{company_id}/... resources, /user/companies discovery (no invented create-company), /c/{company_id}/company/info; tests updated - json.loads (not a builtin; 500s) -> json_safe_decode with raw_body as the authoritative source (undecodable bodies surfaced as empty dicts via req.body); malformed JSON -> 400 flat OAuth shape - webhook subscriptions: company-scoped /c/{company_id}/subscriptions in the real shape (data.sink/types/config, SUB ids, verified/warnings), delivering SIGNED events (X-Signature base64 HMAC-SHA256, documented synthetic secret) on document/entity CRUD - /taxes is the v2 F24 collection (CRUD), not v1 VAT bands - archive upload accepts real multipart via parse_multipart (blob-backed) - platform builtins: query_select filters, paginate-based Laravel envelope; error shapes (401 flat, 404+ SCREAMING_SNAKE nested); int ids; _batch/internal keys stripped; concurrency_key on PUT/DELETE - seeded company (discovery needs one to exist) escrow-style: - CRITICAL: Transaction no longer carries a top-level status (the_bad_boys et al removed): funding on items[].schedule[].status.secured, item lifecycle on items[].status; close_date/is_cancelled added - basic auth (401 + WWW-Authenticate, documented synthetic credentials); real nested validation error shape; customer_type dropped - initiating party auto-agreed at creation; agree requires customer; amounts/fees as decimal strings (integer-cent math); clock-derived timestamps; webhook ids stable between create/list (int-rendered) - webhooks actually fire on lifecycle transitions (unsigned-by-design); list endpoint added (paginate); concurrency_key on PATCH/fund
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two new reference adapters, contributed from real integration work (a
marketplace that verifies company revenue and needed local sims for
bookkeeping and escrow flows).
fattureincloud-styleA Fatture in Cloud-style bookkeeping API v2 simulator — useful for
testing anything that reads supplier-side documents ("what does this
company spend, and on what?") or issues invoices.
and issued documents (full CRUD + the metodata
/infoendpoint),suppliers, clients, products (full CRUD), taxes, cashbook, webhooks,
archive.
that client code gets wrong when a sim is thinner than the real thing:
current_page/last_page/total) — a client that assumes one page is wrong in test, not inproduction.
{"data": {...}}wrappers on single resources.indistinguishable 404.
non-empty bearer is accepted for frictionless local testing).
"9800.00") — casting instead ofparsing is how a real integration ships a NaN.
e-invoice send/retrieve side effects, email dispatch — no local-test
observable behaviour.
escrow-styleAn Escrow.com-style transaction API simulator (public
2017-09-01surface) — the licensed-escrow lifecycle without remote accounts or money.
schedules, caller-controlled or defaulted fee split (buyer pays 3.25%).
PATCHwith{"action": "agree", "customer"};secured-state transitions on funding.
/sim/transaction/{id}/fundaffordance stands infor the buyer paying on the provider's hosted page — which no API can
drive. Namespaced so it can never be confused with API surface.
Verification
stunt adapter lintclean on both (zero warnings).internal/engine/following the existingadyen_style_test.gopattern: 401/404 paths, pagination envelope,decimal-string amounts, metodata categories, CRUD round-trips, and the
full create → agree (×2) → fund → secured escrow lifecycle.
go test ./...green.🤖 Generated with Claude Code