djstripe.utils

Utility functions related to the djstripe app.

QuerySetMock

Bases: QuerySet

A mocked QuerySet class that does not handle updates. Used by UpcomingInvoice.invoiceitems (deprecated) and UpcomingInvoice.lineitems.

delete

delete(self)

from_iterable

from_iterable(cls, model, iterable)

update

update(self)

clear_expired_idempotency_keys

clear_expired_idempotency_keys()

convert_tstamp

convert_tstamp(response) -> datetime.datetime | None

Convert a Stripe API timestamp response (unix epoch) to a native datetime.

get_friendly_currency_amount

get_friendly_currency_amount(amount, currency: str) -> str

get_id_from_stripe_data

get_id_from_stripe_data(data)

Extract stripe id from stripe field data

get_model

get_model(model_name)

get_queryset

get_queryset(pks, model_name)

get_supported_currency_choices

get_supported_currency_choices(api_key)

Pull a stripe account's supported currencies and returns a choices tuple of those supported currencies.

:param api_key: The api key associated with the account from which to pull data. :type api_key: str

get_timezone_utc

get_timezone_utc()

Returns the UTC timezone.