(self)
Removes a legacy source from this customer's account.
Removes a legacy source from this customer's account.
Removes a legacy source from this customer s account .
def remove(self):
        """
        Removes a legacy source from this customer's account.
        """

        # First, wipe default source on all customers that use this card.
        Customer.objects.filter(default_source=self.id).update(default_source=None)

        try:
            self._api_delete()
        except InvalidRequestError as exc:
            if "No such source:" in str(exc) or "No such customer:" in str(exc):
                # The exception was thrown because the stripe customer or card
                # was already deleted on the stripe side, ignore the exception
                pass
            else:
                # The exception was raised for another reason, re-raise it
                raise

        self.delete()
def remove ( self ) : # First, wipe default source on all customers that use this card. Customer . objects . filter ( default_source = self . id ) . update ( default_source = None ) try : self . _api_delete ( ) except InvalidRequestError as exc : if "No such source:" in str ( exc ) or "No such customer:" in str ( exc ) : # The exception was thrown because the stripe customer or card # was already deleted on the stripe side, ignore the exception pass else : # The exception was raised for another reason, re-raise it raise self . delete ( )