payrix 0.3.0

Rust client for the Payrix payment processing API
//! High-level workflow modules for common Payrix operations.
//!
//! This module provides workflow abstractions that encapsulate multi-step
//! Payrix API operations into simple, user-friendly interfaces. Each workflow
//! handles the complexity of the underlying API, including:
//!
//! - Converting user-friendly types to Payrix's nested JSON format
//! - Managing the sequence of API calls required for complex operations
//! - Providing clear status tracking and error handling
//!
//! # Available Workflows
//!
//! - [`merchant_onboarding`] - Onboard new merchants with business info, bank accounts, and owners
//! - [`dispute_handling`] - Handle chargeback disputes with compile-time state enforcement
//! - [`hold_handling`] - Handle transaction holds from risk department with compile-time state enforcement
//! - [`webhook_setup`] - Set up webhook alerts for real-time event notifications
//! - [`subscription_management`] - Manage customer subscriptions to recurring payment plans
//! - [`payment_processing`] - Process credit card and bank account payments with metadata
//! - [`customer_management`] - Create and manage customers with address matching
//! - [`tokenization`] - Tokenize payment methods with automatic customer creation
//! - [`transaction_management`] - Handle refunds, voids, and transaction lookups
//! - [`account_management`] - Manage entities, merchants, bank accounts, and funds
//!
//! # Example
//!
//! ```no_run
//! use payrix::{PayrixClient, Environment};
//! use payrix::workflows::merchant_onboarding::{
//!     onboard_merchant, OnboardMerchantRequest, BusinessInfo, MerchantConfig,
//!     BankAccountInfo, MemberInfo, Address, TermsAcceptance,
//! };
//!
//! # async fn example() -> payrix::Result<()> {
//! let client = PayrixClient::new("api-key", Environment::Test)?;
//!
//! // Use the merchant onboarding workflow
//! // See merchant_onboarding module for complete examples
//! # Ok(())
//! # }
//! ```

/// Account management operations - entities, merchants, bank accounts, and funds
pub mod account_management;
/// Customer management operations - create, read, update, delete customers
pub mod customer_management;
/// Dispute handling operations - manage chargebacks and disputes
pub mod dispute_handling;
/// Hold handling operations - manage transaction holds from risk department
pub mod hold_handling;
/// Merchant onboarding operations - onboard new merchants
pub mod merchant_onboarding;
/// Payment processing operations - credit card and bank account transactions
pub mod payment_processing;
/// Subscription management operations - recurring payment plans
pub mod subscription_management;
/// Tokenization operations - tokenize payment methods
pub mod tokenization;
/// Transaction management operations - refunds, voids, and lookups
pub mod transaction_management;
/// Webhook setup operations - configure event notifications
pub mod webhook_setup;

// Re-export key types for convenience
pub use merchant_onboarding::{
    check_boarding_status, onboard_merchant, Address, BankAccountInfo, BoardingStatus,
    BoardingStatusResult, BusinessInfo, MemberInfo, MerchantConfig, OnboardMerchantRequest,
    OnboardMerchantResult, TermsAcceptance,
};

// Re-export dispute handling types
pub use dispute_handling::{
    ActiveDispute, Arbitration, ChargebackDispute, ChargebackState, Evidence, EvidenceDocument,
    First, PreArbitration, Representment, Retrieval, SecondChargeback, Terminal, TypedChargeback,
    evidence_from_base64_url, evidence_from_bytes, evidence_from_path,
    get_actionable_disputes, get_disputes_by_cycle, get_disputes_for_transaction,
    MAX_DOCUMENTS, MAX_DOCUMENT_SIZE, MAX_TOTAL_SIZE,
};

// Re-export hold handling types
pub use hold_handling::{
    // State types
    AwaitingResponse, DecisionReceived, HoldDocument, HoldState, HoldWorkflow, MerchantDecision,
    OnHold, Resolved, Submitted, TypedHold,
    // Configuration
    HoldEmailConfig, HoldNotificationConfig, HoldTimeoutConfig, HoldWorkflowConfig,
    HoldWorkflowConfigBuilder, ImapConfig, SmtpConfig,
    // Errors
    HoldError, HoldResult,
    // Detection
    detect_holds_for_transaction, detect_unreleased_holds, extract_hold_from_webhook, get_hold,
    load_workflow, poll_for_holds_at_startup, transaction_has_hold, webhook_event_has_hold,
    HoldPollingConfig,
    // Notification
    notify_merchant, send_notification, NotificationBuilder, NotificationContext,
    NotificationEmail,
    // Email parsing
    classify_decision, extract_workflow_id, parse_email_reply, receive_decision, ParsedAttachment,
    ParsedEmailReply,
    // Document upload
    create_hold_note, infer_file_type, infer_file_type_from_filename, upload_decision_documents,
    upload_document, CreateNoteParams, UploadDocumentParams, UploadResult,
    // Decision processing
    check_resolution, submit_decision, DecisionResult, ResolutionStatus,
};

// Re-export webhook setup types
pub use webhook_setup::{
    get_webhook_status, remove_webhook_by_id, remove_webhooks, setup_webhooks,
    WebhookAlertInfo, WebhookConfig, WebhookEventType, WebhookSetupResult, WebhookStatus,
};

// Re-export subscription management types
pub use subscription_management::{
    add_plan_to_customer, calculate_subscription_revenue, cancel_subscription,
    get_active_subscriptions_for_customer, get_subscribers_for_plan, get_subscription_status,
    get_upcoming_payments, next_payment, pause_subscription, payments_to_date,
    resume_subscription, retry_failed_payment, update_payment_method, BillingSchedule,
    NextPayment, PaymentHistory, PlanConfig, PlanReference, SubscribeCustomerConfig,
    SubscribeCustomerResult, SubscriptionError, SubscriptionResult, SubscriptionRevenue,
    SubscriptionState, SubscriptionStatus, TokenConfig, TokenReference, UpcomingPayment,
};

// Re-export payment processing types
pub use payment_processing::{
    create_credit_card_transaction, create_bank_transaction, get_transaction,
    TransactionConfig, TransactionOrigin, CardOnFileType,
};

// Re-export customer management types
pub use customer_management::{
    create_customer, find_customers_by_custom_field, delete_customer, delete_customers_by_custom_field,
    update_customer, get_customer, CustomerData,
};

// Address is exported from merchant_onboarding and reused by customer_management

// Re-export tokenization types
pub use tokenization::{
    tokenize_bank_account, tokenize_credit_card, PaymentMethod, PaymentType,
};

// Re-export transaction management types
pub use transaction_management::{
    cancel_transaction, refund_bank_account, refund_credit_card, ContactName,
};

// Re-export account management types
pub use account_management::{
    create_payout, get_accounts_for_entity, get_account_by_type, get_funds_for_entity,
    get_entity_by_custom_field, get_entity, get_merchant_for_entity, get_merchant,
    get_payouts_for_entity, BankAccount, PayoutConfig, PayoutSchedule, PayoutUsageMethod,
};