Ejemplo n.º 1
0
 def delete(self):
     self._authenticate()
     self.account_repository.remove(self.account)
     membership = self.account.membership
     if membership is not None:
         cancel_stripe_subscription(membership.payment_id)
     return '', HTTPStatus.NO_CONTENT
Ejemplo n.º 2
0
    def delete(self):
        """Process a HTTP DELETE request for an account."""
        self._authenticate()
        self.account_repository.remove(self.account)
        self.account_activity_repository.increment_accounts_deleted()
        if self.account.membership is not None:
            cancel_stripe_subscription(self.account.membership.payment_id)
        self._change_wake_word_file_status()

        return "", HTTPStatus.NO_CONTENT
Ejemplo n.º 3
0
 def _cancel_membership(self, active_membership):
     cancel_stripe_subscription(active_membership.payment_id)
     active_membership.end_date = datetime.utcnow()
     account_repository = AccountRepository(self.db)
     account_repository.end_membership(active_membership)
Ejemplo n.º 4
0
 def _cancel_membership(self, active_membership):
     """Cancel the Stripe plan and expire the database row."""
     cancel_stripe_subscription(active_membership.payment_id)
     active_membership.end_date = datetime.utcnow()
     account_repository = AccountRepository(self.db)
     account_repository.end_membership(active_membership)