payrix 0.3.0

Rust client for the Payrix payment processing API
[package]
name = "payrix"
version = "0.3.0"
edition = "2024"
license = "MIT"
repository = "https://github.com/outlawpractice/payrix-rs"
description = "Rust client for the Payrix payment processing API"
documentation = "https://docs.rs/payrix"
readme = "../../README.md"
keywords = ["payrix", "payments", "api", "worldpay", "payment-processing"]
categories = ["api-bindings", "web-programming"]
exclude = ["tests/", "TESTING.md"]

[features]
default = []
sqlx = ["dep:sqlx"]
# Include financial/reporting types (settlements, statements, billing, profit shares, etc.)
financial = []
# Include terminal/physical device types (terminals, terminal transactions, etc.)
terminal = []
# Include all optional types
full = ["financial", "terminal"]
# Webhook server for receiving Payrix callbacks
webhooks = ["dep:axum", "dep:tower", "dep:tower-http", "dep:ipnet", "dep:async-trait"]
# CLI binary for webhook server management
webhook-cli = ["webhooks", "dep:clap", "dep:tracing-subscriber", "tokio/full"]
# Main CLI binary for entity lookups and operations
cli = ["dep:clap", "dep:tracing-subscriber", "tokio/full"]
# Local entity cache for faster queries and offline resilience
cache = ["sqlx", "dep:async-trait"]

[dependencies]
base64 = "0.22"
chrono = { version = "0.4", features = ["serde"] }
payrix-macros = { version = "0.1", path = "../payrix-macros" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_repr = "0.1"
sqlx = { version = "0.8", features = ["runtime-tokio", "postgres", "chrono"], optional = true }
thiserror = "1.0"
tokio = { version = "1", features = ["rt", "time", "sync"] }
tracing = "0.1"
uuid = { version = "1.11", features = ["v4", "serde"] }

# Native (non-WASM) dependencies
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
# CLI dependencies (only for native, not WASM)
clap = { version = "4.5", features = ["derive"], optional = true }
tracing-subscriber = { version = "0.3", features = ["env-filter"], optional = true }

# WASM dependencies
[target.'cfg(target_arch = "wasm32")'.dependencies]
reqwest = { version = "0.12", default-features = false, features = ["json"] }
uuid = { version = "1.11", features = ["v4", "serde", "js"] }
getrandom = { version = "0.3", features = ["wasm_js"] }

# Webhook server dependencies (optional, native only)
async-trait = { version = "0.1", optional = true }
axum = { version = "0.7", optional = true }
tower = { version = "0.5", optional = true }
tower-http = { version = "0.6", features = ["trace"], optional = true }
ipnet = { version = "2.10", optional = true }

[[bin]]
name = "payrix"
path = "src/bin/payrix.rs"
required-features = ["cli"]

[[bin]]
name = "payrix-webhooks"
path = "src/bin/payrix-webhooks.rs"
required-features = ["webhook-cli"]

[[example]]
name = "webhook_dispute_handler"
required-features = ["webhooks"]

[dev-dependencies]
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
wiremock = "0.6"
reqwest = { version = "0.12", default-features = false, features = ["json", "multipart", "rustls-tls"] }

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]