forked from CGM_Public/pretix_original
Stripe: Guard against invalid JSON in API
This commit is contained in:
@@ -39,6 +39,7 @@ import re
|
|||||||
import urllib.parse
|
import urllib.parse
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
from json import JSONDecodeError
|
||||||
|
|
||||||
import stripe
|
import stripe
|
||||||
from django import forms
|
from django import forms
|
||||||
@@ -675,9 +676,12 @@ class StripeMethod(BasePaymentProvider):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def api_refund_details(self, refund: OrderRefund):
|
def api_refund_details(self, refund: OrderRefund):
|
||||||
return {
|
try:
|
||||||
"id": refund.info_data.get("id", None),
|
return {
|
||||||
}
|
"id": refund.info_data.get("id", None),
|
||||||
|
}
|
||||||
|
except JSONDecodeError:
|
||||||
|
return {}
|
||||||
|
|
||||||
def payment_control_render(self, request, payment) -> str:
|
def payment_control_render(self, request, payment) -> str:
|
||||||
if payment.info:
|
if payment.info:
|
||||||
|
|||||||
Reference in New Issue
Block a user