(cls, data, api_key=djstripe_settings.STRIPE_SECRET_KEY)
return Account.get_or_retrieve_for_api_key(api_key)
Fetches the Stripe Account (djstripe_owner_account model field)
        linked to the class, cls.
        Tries to retreive using the Stripe_account if given.
        Otherwise uses the api_key.
Fetches the Stripe Account (djstripe_owner_account model field)
        linked to the class, cls.
        Tries to retreive using the Stripe_account if given.
        Otherwise uses the api_key.
Fetches the Stripe Account ( djstripe_owner_account model field ) linked to the class cls . Tries to retreive using the Stripe_account if given . Otherwise uses the api_key .
def _find_owner_account(cls, data, api_key=djstripe_settings.STRIPE_SECRET_KEY):
        """
        Fetches the Stripe Account (djstripe_owner_account model field)
        linked to the class, cls.
        Tries to retreive using the Stripe_account if given.
        Otherwise uses the api_key.
        """
        from .account import Account

        # try to fetch by stripe_account. Also takes care of Stripe Connected Accounts
        if data:
            # case of Webhook Event Trigger
            if data.get("object") == "event":
                # if account key exists and has a not null value
                if data.get("account"):
                    stripe_account_id = get_id_from_stripe_data(data.get("account"))
                    if stripe_account_id:
                        return Account._get_or_retrieve(id=stripe_account_id)

            else:
                stripe_account = getattr(data, "stripe_account", None)
                if stripe_account:
                    stripe_account_id = get_id_from_stripe_data(stripe_account)
                    if stripe_account_id:
                        return Account._get_or_retrieve(id=stripe_account_id)

        # try to fetch by the given api_key.
        return Account.get_or_retrieve_for_api_key(api_key)
def _find_owner_account ( cls , data , api_key = djstripe_settings . STRIPE_SECRET_KEY ) : from . account import Account # try to fetch by stripe_account. Also takes care of Stripe Connected Accounts if data : # case of Webhook Event Trigger if data . get ( "object" ) == "event" : # if account key exists and has a not null value if data . get ( "account" ) : stripe_account_id = get_id_from_stripe_data ( data . get ( "account" ) ) if stripe_account_id : return Account . _get_or_retrieve ( id = stripe_account_id ) else : stripe_account = getattr ( data , "stripe_account" , None ) if stripe_account : stripe_account_id = get_id_from_stripe_data ( stripe_account ) if stripe_account_id : return Account . _get_or_retrieve ( id = stripe_account_id ) # try to fetch by the given api_key. return Account . get_or_retrieve_for_api_key ( api_key )