Skip to main content

Deterministic in-memory Swarmauri billing provider for testing, examples, and full billing capability contract checks.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_billing_mock Discord

Swarmauri Billing Mock

swarmauri_billing_mock provides a deterministic in-memory billing provider for Swarmauri test suites, examples, and provider contract checks. It implements the full Swarmauri billing surface without network calls so applications can exercise products, prices, checkout, payments, subscriptions, invoices, refunds, customers, payment methods, payouts, transfers, reports, webhooks, coupons, and promotions through one predictable provider.

Why Swarmauri Billing Mock?

Use this package when billing code needs repeatable behavior without a real payment processor. It is useful for unit tests, documentation examples, local development, and compatibility checks for code that targets BillingProviderBase and the Swarmauri billing mixins.

FAQ

Q: Does this package call a live billing API?

A: No. The mock provider is intentionally local and deterministic. It returns Swarmauri-shaped billing payloads and never reaches external payment networks.

Q: Which billing capabilities does it advertise?

A: It advertises every Swarmauri billing capability through ALL_CAPABILITIES, including checkout, online payments, subscriptions, invoices, marketplace splits, refunds, customers, payment methods, payouts, balance transfers, reports, webhooks, coupons, and promotions.

Q: When should I use it instead of a real provider?

A: Use it in tests, examples, local workflows, and provider-neutral integration checks. Use Stripe, PayPal, Square, Braintree, Adyen, Authorize.Net, Paystack, or Razorpay packages when code needs a live provider API.

Features

  • Implements all billing mixins with predictable outputs.
  • Provides fast billing feedback without network calls.
  • Supports tests that need all Swarmauri billing capabilities available.
  • Demonstrates how to subclass BillingProviderBase for custom billing flows.
  • Supports Python 3.10, 3.11, 3.12, 3.13, and 3.14.

Installation

Install with uv:

uv add swarmauri_billing_mock

Install with pip:

pip install swarmauri_billing_mock

Usage

from swarmauri_billing_mock import MockBillingProvider
from swarmauri_base.billing import ProductSpec

provider = MockBillingProvider(api_key="mock-key")
product = provider.create_product(
    ProductSpec(payload={"name": "Test"}),
    idempotency_key="mock-prod-1",
)

print(product.raw)

Capability Mapping

The mock provider advertises every Capability and therefore maps to the entire set of tigrbl_billing capabilities when using capabilities_to_tigrbl.

Related Packages

Billing provider packages:

Foundational packages:

  • swarmauri_core defines billing capabilities and interfaces.
  • swarmauri_base provides billing specs, refs, mixins, and BillingProviderBase.
  • swarmauri provides namespace imports and plugin discovery.

License

Apache-2.0

Contributing

Need additional fixtures? Contributions that expand deterministic behavior are encouraged.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swarmauri_billing_mock-0.11.0.dev2.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swarmauri_billing_mock-0.11.0.dev2-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_billing_mock-0.11.0.dev2.tar.gz.

File metadata

  • Download URL: swarmauri_billing_mock-0.11.0.dev2.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_billing_mock-0.11.0.dev2.tar.gz
Algorithm Hash digest
SHA256 7d12909d60858698d59aa47e586418d8d12da23c0769d7c96d4039f9f0967cd7
MD5 387e98923b09ca9156365e35a171a7a9
BLAKE2b-256 426c6338779c4b824d2f59616226ee91f92eddb4ce7329d5ddd8ead99c58f09f

See more details on using hashes here.

File details

Details for the file swarmauri_billing_mock-0.11.0.dev2-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_billing_mock-0.11.0.dev2-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_billing_mock-0.11.0.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 83e30f10908e89435502b6a9eeb6b7cf1959aade9fb28fffaa4efd3a510ca4f2
MD5 47a269867f451f548a8101a45a7fa29d
BLAKE2b-256 1d5835fac30f75aa1c7265909b23c39e4f1cc3edd4ba163dcce7ddd2c96b9224

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page