mirror of
https://github.com/pretix/pretix.git
synced 2026-04-28 00:02:37 +00:00
Always register ApplePay domains in livemode (#2154)
This commit is contained in:
@@ -54,13 +54,28 @@ def stripe_verify_domain(event, domain):
|
||||
prov = StripeCC(event)
|
||||
account = get_stripe_account_key(prov)
|
||||
|
||||
# Yes, we could just use the **prov.api_kwargs
|
||||
# But since we absolutely need to always issue this call with live keys,
|
||||
# we're building our api_kwargs here by hand.
|
||||
# Only if no live connect secret key is set, we'll fall back to the testmode keys.
|
||||
# But this should never happen except in scenarios where pretix runs in devmode.
|
||||
if prov.settings.connect_client_id and prov.settings.connect_user_id:
|
||||
api_kwargs = {
|
||||
'api_key': prov.settings.connect_secret_key or prov.settings.connect_test_secret_key,
|
||||
'stripe_account': prov.settings.connect_user_id
|
||||
}
|
||||
else:
|
||||
api_kwargs = {
|
||||
'api_key': prov.settings.secret_key,
|
||||
}
|
||||
|
||||
if RegisteredApplePayDomain.objects.filter(account=account, domain=domain).exists():
|
||||
return
|
||||
|
||||
try:
|
||||
resp = stripe.ApplePayDomain.create(
|
||||
domain_name=domain,
|
||||
**prov.api_kwargs
|
||||
**api_kwargs
|
||||
)
|
||||
except stripe.error.StripeError:
|
||||
logger.exception('Could not verify domain with Stripe')
|
||||
|
||||
Reference in New Issue
Block a user