diff --git a/subscribie/api.py b/subscribie/api.py index c77bc36b8..beb871f47 100644 --- a/subscribie/api.py +++ b/subscribie/api.py @@ -265,7 +265,7 @@ def create_plan(): plan = Plan() database.session.add(plan) for field in planData: - if type(field[1]) == list: + if isinstance(field[1], list): for sellingPoint in field[1]: plan.selling_points.append( PlanSellingPoints(point=sellingPoint.point) diff --git a/subscribie/auth.py b/subscribie/auth.py index dd214d5b4..301d8fffc 100644 --- a/subscribie/auth.py +++ b/subscribie/auth.py @@ -579,7 +579,7 @@ def wrapped_view(**kwargs): stripe_connect_url = url_for("admin.stripe_connect") flash( Markup( - f"You must connect Stripe first." # noqa: E501 + f"You must connect Stripe first." # noqa: E501 ) ) log.debug(f'Redirecting user to {url_for("admin.dashboard")}') diff --git a/subscribie/blueprints/admin/subscriber.py b/subscribie/blueprints/admin/subscriber.py index 07bb73ab0..8e212782b 100644 --- a/subscribie/blueprints/admin/subscriber.py +++ b/subscribie/blueprints/admin/subscriber.py @@ -2,7 +2,7 @@ from subscribie.auth import login_required from subscribie.models import Person from flask import render_template -from subscribie.utils import get_stripe_secret_key, get_stripe_connect_account, get_stripe_connect_account_id +from subscribie.utils import get_stripe_secret_key, get_stripe_connect_account_id import stripe import logging @@ -22,10 +22,18 @@ def show_subscriber(subscriber_id): # Add hosted_invoice_url attribute to all open invoices try: for index, open_invoice in enumerate(open_invoices): - stripe_invoice = stripe.Invoice.retrieve(id=open_invoice.id, stripe_account=stripe_connect_account_id) - setattr(open_invoices[index], 'hosted_invoice_url', stripe_invoice.hosted_invoice_url) + stripe_invoice = stripe.Invoice.retrieve( + id=open_invoice.id, stripe_account=stripe_connect_account_id + ) + setattr( + open_invoices[index], + "hosted_invoice_url", + stripe_invoice.hosted_invoice_url, + ) except Exception as e: - log.error(f"Unable to get/set hosted_invoice_url for invoice: {open_invoice.id}. {e}") + log.error( + f"Unable to get/set hosted_invoice_url for invoice: {open_invoice.id}. {e}" + ) # Try to be helpful to the shop owner by highlighting recent payment # payment stripe_decline_code errors (if any). diff --git a/subscribie/blueprints/iframe/__init__.py b/subscribie/blueprints/iframe/__init__.py index cb4cb65f2..120e26074 100644 --- a/subscribie/blueprints/iframe/__init__.py +++ b/subscribie/blueprints/iframe/__init__.py @@ -12,13 +12,14 @@ def get_iframe_embed(): """Set optimised title tags for your pages.""" log.info("Generating iframe") - iframe = """ - """.format( - request.host_url + '?iframe_embeded="1"' + iframe = ( + f'" ) + try: return render_template("show-iframe-embed.html", iframe=iframe) except TemplateNotFound: diff --git a/subscribie/utils.py b/subscribie/utils.py index f6416ee61..908f3179e 100644 --- a/subscribie/utils.py +++ b/subscribie/utils.py @@ -249,15 +249,8 @@ def modify_stripe_account_capability(account_id): def create_stripe_tax_rate(): - from .models import PaymentProvider from subscribie.models import TaxRate - payment_provider = PaymentProvider.query.first() - if payment_provider.stripe_livemode: - livemode = True - else: - livemode = False - # If there's no tax rate for current live mode create and save one: # if TaxRate.query.filter_by(stripe_livemode=livemode).first() is None: stripe.api_key = get_stripe_secret_key()