(cls, data)
return instance
Syncs this object from the stripe data provided.

        Foreign keys will also be retrieved and synced recursively.

        :param data: stripe object
        :type data: dict
        :rtype: cls
Syncs this object from the stripe data provided.
Syncs this object from the stripe data provided .
def sync_from_stripe_data(cls, data):
        """
        Syncs this object from the stripe data provided.

        Foreign keys will also be retrieved and synced recursively.

        :param data: stripe object
        :type data: dict
        :rtype: cls
        """
        current_ids = set()
        data_id = data.get("id")
        stripe_account = getattr(data, "stripe_account", None)

        if data_id:
            # stop nested objects from trying to retrieve this object before
            # initial sync is complete
            current_ids.add(data_id)

        instance, created = cls._get_or_create_from_stripe_object(
            data,
            current_ids=current_ids,
            stripe_account=stripe_account,
        )

        if not created:
            record_data = cls._stripe_object_to_record(data)
            for attr, value in record_data.items():
                setattr(instance, attr, value)
            instance._attach_objects_hook(cls, data, current_ids=current_ids)
            instance.save()
            instance._attach_objects_post_save_hook(cls, data)

        for field in instance._meta.concrete_fields:
            if isinstance(field, StripePercentField):
                # get rid of cached values
                delattr(instance, field.name)

        return instance
def sync_from_stripe_data ( cls , data ) : current_ids = set ( ) data_id = data . get ( "id" ) stripe_account = getattr ( data , "stripe_account" , None ) if data_id : # stop nested objects from trying to retrieve this object before # initial sync is complete current_ids . add ( data_id ) instance , created = cls . _get_or_create_from_stripe_object ( data , current_ids = current_ids , stripe_account = stripe_account , ) if not created : record_data = cls . _stripe_object_to_record ( data ) for attr , value in record_data . items ( ) : setattr ( instance , attr , value ) instance . _attach_objects_hook ( cls , data , current_ids = current_ids ) instance . save ( ) instance . _attach_objects_post_save_hook ( cls , data ) for field in instance . _meta . concrete_fields : if isinstance ( field , StripePercentField ) : # get rid of cached values delattr ( instance , field . name ) return instance