open-standards/openpay/crates/op-openbanking/tests/fdx_consent.rs
Transaction Science 6ea90afbed ingest wave A4: 3 crates · smart-byte-atproto + op-openbanking + eoc-distributed
Smart Byte (1 crate, 2127 LOC, 35 tests)
  smart-byte-atproto    ATProto (Bluesky federation) adapter.
                        PLC + did:web resolution; XRPC client; CARv1 encode/decode
                        with CIDv1 (dag-cbor + raw, SHA-256); sketch MST with
                        order-independent BLAKE3 root; Repo + UnsignedCommit /
                        SignedCommit (Ed25519 over CBOR); firehose transport
                        trait + in-memory impl; AT URI ↔ smart-byte AID bridge
                        with SAID commitment.

OpenPay (1 crate, 2397 LOC, 44 tests)
  op-openbanking        UK OBIE R/W v3.1.10/3.1.11, Berlin Group NextGenPSD2
                        XS2A v1.3.13, STET PSD2 v1.7, Australia CDR Banking v1.31,
                        FDX v5/v6, SGFinDex shapes. AISP / PISP / PIIS / VRP
                        traits. FAPI 1.0 Advanced (PS256/ES256, mTLS, RFC 8705
                        certificate binding, JWK registration). Operators wire
                        their own JWS signer + HTTP transport — keeps the crate
                        KMS-agnostic.

EOC (1 crate, 2179 LOC, 32 tests)
  eoc-distributed       Distributed-inference scheduling. Worker trait with
                        Capability + Accelerator (CPU/GPU/TPU/NPU/Mixed) +
                        Load.busyness()/projected_micro_joules()/projected_g_co2e().
                        RoundRobin / LeastBusy / LatencyWeighted / JouleWeighted
                        (default) / CarbonWeighted routers. Work-stealing
                        scheduler. vLLM-style continuous batching with KV-block
                        budget. Ray-Serve-style auto-scaler with cooldown.
                        KV-cache-aware sticky-session routing.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-05-24 12:22:09 -04:00

60 lines
1.7 KiB
Rust

//! FDX v6 consent + resource-endpoint integration test.
use op_openbanking::fdx::{FdxConsent, FdxResource, FdxService, FdxVersion};
#[test]
fn v6_endpoint_routing() {
let svc = FdxService {
provider_base_url: "https://api.fi.example".into(),
version: FdxVersion::V6,
};
assert_eq!(
svc.endpoint(FdxResource::Accounts),
"https://api.fi.example/fdx/v6/accounts"
);
assert_eq!(
svc.endpoint(FdxResource::TaxForms),
"https://api.fi.example/fdx/v6/tax/forms"
);
assert_eq!(
svc.endpoint(FdxResource::RecurringPayments),
"https://api.fi.example/fdx/v6/payments/recurring"
);
}
#[test]
fn consent_serde_round_trips() {
let c = FdxConsent {
id: "fdx-consent-1".into(),
resources: vec![FdxResource::Accounts, FdxResource::Transactions],
account_ids: vec!["acc-a".into(), "acc-b".into()],
expires_at: Some(time::OffsetDateTime::UNIX_EPOCH),
};
let json = serde_json::to_string(&c).expect("ser");
let back: FdxConsent = serde_json::from_str(&json).expect("de");
assert_eq!(c, back);
}
#[test]
fn indefinite_consent_supports_none_expiry() {
let c = FdxConsent {
id: "fdx-indef".into(),
resources: vec![FdxResource::Customers],
account_ids: vec![],
expires_at: None,
};
let json = serde_json::to_string(&c).expect("ser");
assert!(json.contains("null"));
}
#[test]
fn v5_still_supported_for_legacy_holders() {
let svc = FdxService {
provider_base_url: "https://api.legacy.example".into(),
version: FdxVersion::V5,
};
assert!(
svc.endpoint(FdxResource::Investments)
.starts_with("https://api.legacy.example/fdx/v5/")
);
}