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
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
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)
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)