Skip to content

Migration 0.26x

Use when upgrading from a version older than these releases: 0.269.0, 0.265.0, 0.264.0, 0.263.0, 0.261.0 and 0.260.0.

Part of the Migration guide.

0.269.0 — Charge.expires_in became an int

No signature changes. What changes is the type of one OpenPix response field.

What changes

Charge.expires_in was str | None and is now int | None. Woovi's document declares expiresIn as string, the API returns 3600, and validation blew up before any consumer saw the charge:

charge.expiresIn
  Input should be a valid string [type=string_type, input_value=3600, input_type=int]

What to do

Nothing at runtime. Since no charge response was ever constructed, the old type never handed anyone a value — there is no code out there that read a str from this field and worked.

If you annotated the field, change the type:

from tempest_fastapi_sdk.integrations.payment.openpix import Charge


def seconds_left(charge: Charge) -> int:
    """How many seconds are left before the charge expires."""
    return charge.expires_in or 0

Why not int | str

A union would push the ambiguity onto every consumer, who would then need a defensive int(charge.expires_in) without ever knowing whether text arrives someday. The document contradicts itself about this field in three places (Charge says string, ChargePayload says number, WebhookCharge says integer) — the evidence is in vendor/openpix-evidence.md, section 7.

0.265.0 — an optional array in a request body became | None

No method signature changes. What changes is the type of some fields on the generated body models, and what goes on the wire.

What changes

An array the specification lists as optional, on a model the SDK only sends, is no longer list[T] with default_factory=list; it is list[T] | None with default=None. That is 21 fields: 9 on OpenPix, 12 on Mercado Pago.

Alongside it, the generated _dump now passes exclude_unset=True, so no field you did not touch reaches the body — including on the shared models, which kept the list spelling.

Response models are untouched: Charge.additional_info is still [] when the provider sends nothing, which is the SDK's convention.

What to do

Nothing, if you only build the payload and send it. That case is exactly what the fix repairs:

before: {"correlationID": "...", "value": 1190, "additionalInfo": [], "splits": []}  → 400
now:    {"correlationID": "...", "value": 1190}                                      → 200

If you read the field back off a payload you built, it is now None instead of []. Before, for split in payload.splits: iterated an empty list and did nothing; now it raises TypeError. The form that works on both versions:

from tempest_fastapi_sdk.integrations.payment.openpix import ChargePayload

payload: ChargePayload = ChargePayload(correlation_id="abc", value=1190)

for split in payload.splits or []:
    print(split.pix_key)

Sending an empty list is still possible — and still a claim

ChargePayload(..., splits=[]) does send "splits": [], and Woovi answers 400 O array de split precisa ter ao menos um item. That is correct: you asserted something and the provider judged it. What changed is that the SDK stopped asserting it for you.

0.264.0 — the language belongs to the flow, not to each end

Breaks no signature. It changes the language some pages come out in — to the correct one, but observably.

What changes

Through v0.263.0 the email read AUTH_DEFAULT_LOCALE and the page negotiated Accept-Language, each on its own. Both now call resolve_locale, in the same order:

1. ?lang= on the link (the language THIS email went out in)
2. user.locale        (the preference you stored on the row)
3. Accept-Language    (pages only)
4. AUTH_DEFAULT_LOCALE

Two observable consequences:

  1. A user with a stored locale on a differently-configured browser now sees the page in their language. The header used to win.
  2. The emailed link gains ?lang=<locale>. The previous query string is preserved byte for byte — the token is never re-encoded — but the URL carries one more parameter.

What to do

Nothing, if you store no user language and don't validate the link's query. With no signal at all the behaviour is what it was: Accept-Language, then AUTH_DEFAULT_LOCALE.

If your front-end route rejects unknown query parameters, turn the stamp off:

AUTH_STAMP_LOCALE_IN_LINK=false

If you want the user's preference to win, store it — the SDK reads the attribute with getattr, so it just has to exist:

from tempest_fastapi_sdk import BaseUserModel, LocaleColumnMixin


class UserModel(LocaleColumnMixin, BaseUserModel):
    """The BCP-47 `locale` column (nullable) comes from the mixin."""

    __tablename__ = "users"

A locale the SDK doesn't ship is not an answer

The SDK ships pt-BR and en-US. A row saying locale="fr-FR" does not stop the search: it falls through to the next signal instead of rendering in a language that does not exist.

0.263.0 — AdminAuthBackend became generic

Breaks no runtime at all. It breaks the type-check for anyone who subclasses AdminAuthBackend and runs mypy --strict — which the pyproject.toml written by tempest new turns on by default.

What changes

AdminAuthBackend is now Generic[PrincipalT], parameterized by the principal — the value authenticate returns and that load_principal, principal_id, display_name, mfa_enabled and verify_mfa consume. Before, all six passed that value around as Any.

Subclassing without a parameter is still valid at runtime and resolves to AdminAuthBackend[Any], the behaviour through v0.262.0. What changes is that mypy --strict enables disallow_any_generics, and then:

src/admin/backend.py:12: error: Missing type arguments for generic type
"AdminAuthBackend"  [type-arg]

Measured: basedpyright in standard mode does not complain; mypy strict does.

What to do

1. Name your principal in the parameter. This is the option that buys you something — it was class LdapAuthBackend(AdminAuthBackend) with principal: Any on every method; it becomes:

from dataclasses import dataclass

from sqlalchemy.ext.asyncio import AsyncSession

from tempest_fastapi_sdk import AdminAuthBackend, AdminAuthError


@dataclass
class LdapEntry:
    """The principal your directory hands back."""

    dn: str
    common_name: str


DIRECTORY: dict[str, LdapEntry] = {
    "admin@example.com": LdapEntry(dn="cn=admin", common_name="Admin"),
}


class LdapAuthBackend(AdminAuthBackend[LdapEntry]):
    """Authenticate against the directory instead of the user table."""

    async def authenticate(
        self,
        session: AsyncSession,
        *,
        identifier: str,
        password: str,
    ) -> LdapEntry:
        """Return the directory entry, or reject the login."""
        entry = DIRECTORY.get(identifier)
        if entry is None:
            raise AdminAuthError("Invalid credentials")
        return entry

    async def load_principal(
        self,
        session: AsyncSession,
        principal_id: str,
    ) -> LdapEntry | None:
        """Reload the entry on every request."""
        for entry in DIRECTORY.values():
            if entry.dn == principal_id:
                return entry
        return None

    def principal_id(self, principal: LdapEntry) -> str:
        """Return what gets serialized into the cookie."""
        return principal.dn

    def display_name(self, principal: LdapEntry) -> str:
        """Return what the admin header shows."""
        return principal.common_name

With the parameter written down, a display_name reading a different type than authenticate returned becomes an override error — in mypy (which names Liskov outright) and in basedpyright. That was exactly the defect Any let through.

2. Or preserve the previous behaviour, literally. AdminAuthBackend[Any] is what the unparameterized class already resolved to:

from typing import Any

from sqlalchemy.ext.asyncio import AsyncSession

from tempest_fastapi_sdk import AdminAuthBackend, AdminAuthError


class LegacyAuthBackend(AdminAuthBackend[Any]):
    """Exactly the behaviour through v0.262.0."""

    async def authenticate(
        self,
        session: AsyncSession,
        *,
        identifier: str,
        password: str,
    ) -> Any:
        """Return whatever principal your IdP hands back."""
        raise AdminAuthError("Invalid credentials")

    async def load_principal(
        self,
        session: AsyncSession,
        principal_id: str,
    ) -> Any | None:
        """Reload the principal, or invalidate the session."""
        return None

    def principal_id(self, principal: Any) -> str:
        """Return the cookie identifier."""
        return str(principal)

No difference from what you had; it only silences disallow_any_generics.

UserModelAuthBackend asks for nothing

The implementation the SDK ships already declares AdminAuthBackend[BaseUserModel]. If you use the default backend — auth_backend=UserModelAuthBackend(user_model=UserModel) — nothing changes for you.

The Redis protocols only got easier to satisfy

The same release made every required parameter of ThrottleBackend, _RedisHashClient and RedisLike positional-only, and swapped Awaitable[Any] for the concrete type. That widens what is accepted: a backend of yours that already passed still passes, and redis.asyncio.Redis/fakeredis — which basedpyright rejected — pass now. The only way to feel it is to have a call site that declared the wrong return type on the back of Any; there, the type-checker will point at the line.

0.261.0 — the WebSocket router sends a hello first

Breaks a client that reads the first frame positionally. A client that dispatches on type and ignores what it does not know is unaffected.

What changes

The first frame make_websocket_router sends is now:

{"type": "hello", "data": {"heartbeat_seconds": 30}, "request_id": null}

Before, the server's first frame was the ping, or whatever your handler sent.

What to do

1. If your client reads the first frame positionally, consume the hello.

// up to v0.260.0
socket.onmessage = (event) => {
  const first = JSON.parse(event.data);   // was a ping, or application data
};

// from v0.261.0 — dispatch on type, which is stable
socket.onmessage = (event) => {
  const frame = JSON.parse(event.data);
  if (frame.type === "hello") {
    calibrateWatchdog(frame.data.heartbeat_seconds);
    return;
  }
  if (frame.type === "ping") {
    socket.send(JSON.stringify({ type: "pong", data: {} }));
    return;
  }
  handle(frame);
};

2. Use the number. A browser socket only reports a connection that closes cleanly; a link that dies in flight leaves readyState at OPEN with nothing ever arriving again. The client's silence watchdog is not optional, and calibrating it from the hello means retuning WS_HEARTBEAT_SECONDS on the server no longer turns every client's normal interval into a perceived drop.

What you get for free

  • Any inbound frame counts as proof of life. Only pong used to, so a busy client answering something else could cross the deadline and be closed with 4408. The pong is still consumed before the handler.
  • heartbeat is public, usable on an endpoint with no auth and no hub. Recipe in docs/recipes/websocket.md, section "Heartbeat without the router".
  • CompactPaginationSchema/CompactPaginationFilterSchema, for services publishing size rather than page_size. Nothing moves if you do not use them.

0.260.0 — the OpenPix spec was refreshed, and every method was renamed

Breaks every OpenPixClient caller: all 125 methods changed name. Also breaks anyone importing an operation-derived schema class, reading OpenPixEnvironment.PRODUCTION, or relying on extra="allow" on a model that is also a payload.

Why

The vendored document was two versions behind the published one — 3.0.3 titled "OpenPix" against the 3.1.0 "Woovi" — and nothing in the repository measured that. The new document carries an operationId on 125 of 125 operations where the old one had none: the generator used to derive names from the path, and now uses the name the provider gave.

This is upside wearing a break's clothes. post_api_v1_charge was the name you get when there is no name; create_charge is the operation's name.

What to do

1. Rename the calls. Each row is a direct substitution. Of the 103, only three changed signature:

Method Change
update_customer the path parameter went from correlation_id to id — positional callers are fine, keyword callers are not
get_statement gained company_bank_account, optional
get_transaction gained company_bank_account, optional
from tempest_fastapi_sdk.integrations.payment.openpix import (
    ChargePayload,
    OpenPixClient,
)


async def charge(client: OpenPixClient, payload: ChargePayload) -> None:
    """Create one charge with the renamed method."""
    # up to v0.259.0: await client.post_api_v1_charge(body=payload)
    await client.create_charge(body=payload)
Before (v0.259.0) Now (v0.260.0)
get_api_image_qrcode_base64_by_id get_charge_qr_code_base64
post_api_v1_account duplicate_account
delete_api_v1_account_register_by_id delete_account_register
get_api_v1_account list_accounts
delete_api_v1_account_by_account_id close_account
get_api_v1_account_by_account_id get_account
post_api_v1_account_by_account_id_withdraw withdraw_from_account
delete_api_v1_application delete_application
post_api_v1_application create_application
post_api_v1_boleto_validate validate_boleto
post_api_v1_cashback_fidelity create_cashback_fidelity
get_api_v1_cashback_fidelity_balance_by_tax_id get_cashback_fidelity_balance
get_api_v1_charge list_charges
post_api_v1_charge create_charge
delete_api_v1_charge_by_id delete_charge
get_api_v1_charge_by_id get_charge
patch_api_v1_charge_by_id update_charge
get_api_v1_charge_by_id_refund list_charge_refunds
post_api_v1_charge_by_id_refund refund_charge
get_api_v1_company get_company
get_api_v1_customer list_customers
post_api_v1_customer create_customer
patch_api_v1_customer_by_correlation_id update_customer
get_api_v1_customer_by_id get_customer
post_api_v1_decode_emv decode_emv
get_api_v1_dispute list_disputes
get_api_v1_dispute_by_id get_dispute
post_api_v1_funds_recovery create_funds_recovery
get_api_v1_funds_recovery_by_id get_funds_recovery
post_api_v1_funds_recovery_by_id_cancel cancel_funds_recovery
get_api_v1_installments_by_id get_installment
post_api_v1_installments_by_id_cobr create_installment_cobr
post_api_v1_installments_by_id_cobr_retry retry_installment_cobr
get_api_v1_invoice list_invoices
post_api_v1_invoice create_invoice
get_api_v1_invoice_integration get_invoice_integration
patch_api_v1_invoice_integration set_invoice_integration_status
post_api_v1_invoice_integration upsert_invoice_integration
put_api_v1_invoice_integration update_invoice_integration_tax_fields
post_api_v1_invoice_integration_certificate upload_invoice_integration_certificate
post_api_v1_invoice_integration_test test_invoice_integration
post_api_v1_invoice_by_correlation_id_cancel cancel_invoice
get_api_v1_invoice_by_correlation_id_pdf get_invoice_pdf
get_api_v1_invoice_by_correlation_id_xml get_invoice_xml
post_api_v1_kyc_onboarding create_kyc_onboarding
get_api_v1_limits_by_account_id get_account_limits
get_api_v1_partner_affiliate list_partner_affiliates
post_api_v1_partner_application create_partner_application
get_api_v1_partner_company list_partner_companies
post_api_v1_partner_company create_partner_company
get_api_v1_partner_company_by_tax_id get_partner_company
get_api_v1_payment list_payments
post_api_v1_payment create_payment
post_api_v1_payment_approve approve_payment
get_api_v1_payment_by_id get_payment
get_api_v1_pix_keys list_pix_keys
post_api_v1_pix_keys create_pix_key
post_api_v1_pix_keys_check check_pix_key
get_api_v1_pix_keys_tokens list_pix_key_tokens
get_api_v1_pix_keys_tokens_logs list_pix_key_token_logs
delete_api_v1_pix_keys_by_pix_key delete_pix_key
get_api_v1_pix_keys_by_pix_key_check check_pix_key_by_key
put_api_v1_pix_keys_by_pix_key_default set_default_pix_key
get_api_v1_psp list_psps
get_api_v1_qrcode_static list_static_qr_codes
post_api_v1_qrcode_static create_static_qr_code
delete_api_v1_qrcode_static_by_id delete_static_qr_code
get_api_v1_qrcode_static_by_id get_static_qr_code
get_api_v1_receipt_by_receipt_type_by_end_to_end_id get_receipt
get_api_v1_refund list_refunds
post_api_v1_refund create_refund
get_api_v1_refund_by_id get_refund
post_api_v1_stablecoin_deposit create_stablecoin_deposit
post_api_v1_stablecoin_deposit_approve approve_stablecoin_deposit
get_api_v1_stablecoin_quote get_stablecoin_quote
get_api_v1_stablecoin_subaccount list_stablecoin_subaccounts
post_api_v1_stablecoin_subaccount create_stablecoin_subaccount
get_api_v1_stablecoin_subaccount_by_sub_account_id get_stablecoin_subaccount
get_api_v1_statement get_statement
get_api_v1_subaccount list_subaccounts
post_api_v1_subaccount create_subaccount
post_api_v1_subaccount_transfer transfer_between_subaccounts
delete_api_v1_subaccount_by_id delete_subaccount
get_api_v1_subaccount_by_id get_subaccount
post_api_v1_subaccount_by_id_credit credit_subaccount
post_api_v1_subaccount_by_id_debit debit_subaccount
get_api_v1_subaccount_by_id_statement get_subaccount_statement
post_api_v1_subaccount_by_id_withdraw withdraw_from_subaccount
get_api_v1_subscriptions list_subscriptions
post_api_v1_subscriptions create_subscription
get_api_v1_subscriptions_by_id get_subscription
put_api_v1_subscriptions_by_id_cancel cancel_subscription
get_api_v1_subscriptions_by_id_installments list_subscription_installments
put_api_v1_subscriptions_by_id_value update_subscription_value
get_api_v1_transaction list_transactions
get_api_v1_transaction_by_id get_transaction
post_api_v1_transfer create_transfer
get_api_v1_webhook list_webhooks
post_api_v1_webhook create_webhook
get_api_v1_webhook_events list_webhook_events
get_api_v1_webhook_ips list_webhook_ips
delete_api_v1_webhook_by_id delete_webhook
get_openpix_charge_brcode_image_id_png get_charge_qr_code_image

2. Three methods have no direct replacement.

Before Now What was wrong
post_api_v1_dispute_id_evidence(body=...) upload_dispute_evidence(id, *, body=...) The path was /api/v1/dispute/:id/evidence, colon and all, and no argument named the dispute
get_api_v1_account_register() get_account_register(id) The docstring said "by CorrelationID" and the method took nothing
delete_api_v1_payment_by_id(id) removed The endpoint does not exist: the published document has only get on that path, and the DELETE Woovi documents is on /api/v1/charge/{id}

3. Operation-derived schema classes were renamed. The components ones were not — Charge, ChargePayload, ChargeStatus, Transaction, Customer are unchanged. The inline ones moved:

The name up to v0.259.0 was GetApiV1ChargeResponsePageInfo. From v0.260.0:

from tempest_fastapi_sdk.integrations.payment.openpix import (
    ListChargesResponsePageInfo,
)

The pattern follows the method: GetApiV1ChargeResponse… becomes ListChargesResponse…, PostApiV1PaymentBody… becomes CreatePaymentBody….

4. OpenPixEnvironment.PRODUCTION is now https://api.woovi.com. That is servers[0] of the refreshed document. The old host is still up — measured 2026-08-28, GET /api/v1/charge answers 401 on api.openpix.com.br, api.woovi.com and api.woovi-sandbox.com alike — so a service pinned to the old URL keeps working. If you assert the value in a test, update it.

5. If you read model_extra from a model that is also a payload. A class reachable from a response and from a request body goes back to extra="ignore". That is 4 classes on OpenPix — PreRegistrationPayloadObject, which is the body and the 200 of the same operation, plus the three it reaches — and 25 on Mercado Pago. The reason is what v0.259.0 already stated and could not enforce: an unexpected key on a payload is the caller's own typo, and carrying it to the provider is worse than dropping it.

What you get for free

  • 24 new operations: anticipation (7), stablecoin payout and wallets (7), boleto-transaction (2), kyc-validation (2), files, webhook/public-keys.
  • Transaction.webhook_sent[].status becomes an int — it is an HTTP code.
  • to_cents and reais_to_cents refuse with ValueError, always. Before, "abc" raised decimal.InvalidOperation, None raised TypeError and float("inf") raised OverflowError.