Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1086 payouts activation approval #1087

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions subscribie/blueprints/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
get_stripe_connect_account,
create_stripe_connect_account,
get_stripe_connect_account_id,
modify_stripe_account_capability,
create_stripe_tax_rate,
get_shop_default_currency_code,
get_stripe_invoices,
Expand Down Expand Up @@ -956,7 +955,19 @@ def stripe_connect():
payment_provider = PaymentProvider.query.first()
try:
account = get_stripe_connect_account()
if account is not None and account.charges_enabled and account.payouts_enabled:
if payment_provider.stripe_livemode is False:
card_payments_enabled = True
else:
card_payments_capability = stripe.Account.retrieve_capability(
account.id, "card_payments"
)
card_payments_enabled = card_payments_capability["requested"]
if (
account is not None
and account.charges_enabled
and account.payouts_enabled
and card_payments_enabled is True
):
payment_provider.stripe_active = True
else:
payment_provider.stripe_active = False
Expand All @@ -973,7 +984,6 @@ def stripe_connect():
# Attempt to Updates an existing Account Capability to accept card payments
try:
account = get_stripe_connect_account()
modify_stripe_account_capability(account.id)
except Exception as e:
log.error(f"Could not update card_payments capability for account. {e}")

Expand Down Expand Up @@ -1046,6 +1056,7 @@ def stripe_connect():
"admin/settings/stripe/stripe_connect.html",
stripe_onboard_path=url_for("admin.stripe_onboarding"),
account=account,
card_payments_enabled=card_payments_enabled,
payment_provider=payment_provider,
stripe_express_dashboard_url=stripe_express_dashboard_url,
default_currency=setting.default_currency,
Expand Down Expand Up @@ -1102,7 +1113,6 @@ def stripe_onboarding():
payment_provider.stripe_test_connect_account_id = account.id

database.session.commit()

session["account_id"] = account.id
account_link_url = _generate_account_link(account.id)
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ <h2>Connect Stripe to your shop</h2>
you can switch to live mode using real money.</b>
</div>
{% endif %}
{% if card_payments_enabled is not sameas True %}
<div class="alert alert-warning" role="alert">
<b>Your account is currently disabled from payments, please wait a few days for us to finish the screening process to prove the account's veracity</b>
</div>
{% endif %}

<a href="{{ stripe_express_dashboard_url }}" class="btn btn-success">
View balance, payouts and change bank account settings
Expand Down
2 changes: 1 addition & 1 deletion subscribie/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def create_stripe_connect_account(company, country_code=None, default_currency=N
default_currency=default_currency,
business_profile={"url": url, "name": company.name},
capabilities={
"card_payments": {"requested": True},
"card_payments": {"requested": False},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm missing something, Card payments aren't/shouldn't be related to whether payouts are enabled in anyway

"transfers": {"requested": True},
},
)
Expand Down