open-standards/openpay/crates/op-payouts/src/lib.rs
Transaction Science 7ef14c2ea9 ingest wave B: 3 crates · op-payouts + smart-byte-nostr + eoc-streaming
OpenPay (1 crate, 2174 LOC, 14 tests)
  op-payouts          Multi-rail payout engine. Visa Direct, Mastercard Send,
                      ACH credits (NACHA), Fedwire + SWIFT MT103 + ISO 20022
                      pacs.008, SEPA SCT + SCT Inst (mod-97 IBAN), UK FPS,
                      FedNow, RTP, PayPal, Wise. Crypto: USDC/USDT on
                      ETH/Polygon/Base/Solana + BTC + Lightning with real
                      ERC-20 transfer(address,uint256) calldata. Offline-pure
                      drivers (emit wire payloads — operators transmit).

Smart Byte (1 crate, 2605 LOC, 38 tests)
  smart-byte-nostr    Nostr adapter. NIP-01 canonical event id + BIP-340
                      Schnorr sign/verify; from-scratch bech32 + NIP-19 TLV
                      (npub/nsec/note/nprofile/nevent/nrelay); NIP-04 legacy
                      AES-256-CBC DMs; NIP-44 v2 HKDF-SHA256→ChaCha20+HMAC
                      with bucketed padding; NIP-17 gift-wrap (kind 1059) +
                      seal (kind 13) + rumor (kind 14); NIP-05/11/13/26/65.
                      Relay client message vocabulary (REQ/EVENT/CLOSE/AUTH/
                      EOSE/OK/NOTICE/CLOSED) + in-memory router.

EOC (1 crate, 2024 LOC, 30 tests)
  eoc-streaming       Token-by-token + tool-call streaming primitives.
                      SSE framing (data: lines); Anthropic event mapper
                      (message_start/content_block_*/message_delta/stop/ping);
                      OpenAI delta mapper; Vercel AI SDK mapper. Bounded-channel
                      backpressure with watermarks; CancelToken propagation;
                      Last-Event-ID resumable streams; per-stream joule meter.

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

65 lines
2.8 KiB
Rust

//! # `op-payouts` — Multi-rail payout engine
//!
//! Sibling to the acceptance rails (`op-rails-card`, `op-rails-a2a`,
//! `op-rails-crypto`). Where the rails crates move funds **into** the
//! operator's balance, this crate moves funds **out** — to bank
//! accounts, debit cards, wallets and crypto addresses.
//!
//! ## Rails covered
//!
//! | Family | Module | Networks / Schemes |
//! |-------------------|-----------------|------------------------------------------------------------|
//! | Card push | [`visa_direct`] / [`mc_send`] | Visa Direct OCT, Mastercard Send |
//! | US batch | [`ach`] | NACHA ACH credits (PPD/CCD) |
//! | Wire | [`wire`] | Fedwire, SWIFT MT103, ISO 20022 `pacs.008` |
//! | SEPA | [`sepa`] | SCT, SCT Instant |
//! | UK | [`uk_fps`] | Faster Payments Service |
//! | US instant | [`fednow`] / [`rtp`] | FedNow, TCH RTP |
//! | Wallet | [`paypal`] / [`wise`] | PayPal Payouts API, Wise Platform API |
//! | Crypto | [`crypto`] | USDC/USDT on ETH/Polygon/Base/Solana, BTC, Lightning |
//!
//! ## Architecture
//!
//! Every driver implements the [`Payout`] trait. The orchestrator holds
//! `Box<dyn Payout>` and routes by [`PayoutMethod`]. KYC of the
//! beneficiary is delegated to `op-screening`; 1099/T5 triggers are
//! delegated to `op-tax`. Funding sources (prefunded balance vs
//! pull-based debit of the operator's settlement account) are modelled
//! in [`funding`].
//!
//! ## Determinism
//!
//! Per the OpenPay deterministic-contract doctrine, every driver in
//! this crate is offline-pure: it builds the rail-specific message and
//! returns it as bytes / a strongly-typed envelope alongside a planned
//! [`PayoutResult`]. Network submission is the operator's job. This
//! keeps payout logic testable without sandbox credentials and keeps
//! the inference loop out of the control plane.
#![forbid(unsafe_code)]
#![warn(missing_docs)]
#![warn(clippy::pedantic)]
#![allow(clippy::module_name_repetitions)]
#![allow(clippy::missing_errors_doc)]
pub mod ach;
pub mod crypto;
pub mod error;
pub mod fednow;
pub mod funding;
pub mod mc_send;
pub mod payout;
pub mod paypal;
pub mod rtp;
pub mod sepa;
pub mod uk_fps;
pub mod visa_direct;
pub mod wire;
pub mod wise;
pub use error::{Error, Result};
pub use funding::{FundingMode, FundingSource, PullDebitInstruction};
pub use payout::{
Beneficiary, BeneficiaryAccount, Payout, PayoutMethod, PayoutRequest, PayoutResult,
PayoutStatus,
};