Mandate Adapter Base (adapters/base.py)

bernstein · src/bernstein/core/payments/adapters/base.py · python · Apache-2.0
payments, integration, tag:mandate, tag:adapter, tag:protocol

Defines a protocol for converting internal spend mandates to external signed mandates, enabling third‑party payment interoperability.

# Source: https://github.com/sipyourdrink-ltd/bernstein | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""``MandateAdapter`` - the narrow protocol for external mandate interop.

A signed :class:`~bernstein.core.payments.mandate.SpendMandate` can be projected
to an external signed-mandate representation and parsed back without the core
declaring any one external scheme canonical. Concrete third-party schemes are
implemented as out-of-tree adapters conforming to this protocol; the core ships
only a bernstein-native adapter and a generic JWS pass-through.

The round-trip contract is exact: for any adapter ``a`` and mandate ``m``,
``a.from_external(a.to_external(m)).to_dict() == m.to_

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key