diff --git a/fundraising/management/commands/create_stripe_plans.py b/fundraising/management/commands/create_stripe_plans.py index 7f17c06a8a..32e655261c 100644 --- a/fundraising/management/commands/create_stripe_plans.py +++ b/fundraising/management/commands/create_stripe_plans.py @@ -11,7 +11,7 @@ def handle(self, **kwargs): try: stripe.Plan.retrieve("monthly") print("Monthly plan exists, not creating!") - except stripe.error.InvalidRequestError: + except stripe.InvalidRequestError: name = "Monthly donation" logger.info(f"Creating plan: {name}") stripe.Plan.create( @@ -25,7 +25,7 @@ def handle(self, **kwargs): try: stripe.Plan.retrieve("quarterly") print("Quarterly plan exists, not creating!") - except stripe.error.InvalidRequestError: + except stripe.InvalidRequestError: name = "Quarterly donation" logger.info(f"Creating plan: {name}") stripe.Plan.create( @@ -40,7 +40,7 @@ def handle(self, **kwargs): try: stripe.Plan.retrieve("yearly") print("Yearly plan exists, not creating!") - except stripe.error.InvalidRequestError: + except stripe.InvalidRequestError: name = "Yearly donation" logger.info(f"Creating plan: {name}") stripe.Plan.create( diff --git a/fundraising/tests/test_views.py b/fundraising/tests/test_views.py index 2e2a441562..aca9d85903 100644 --- a/fundraising/tests/test_views.py +++ b/fundraising/tests/test_views.py @@ -263,7 +263,7 @@ def stripe_data(self, filename): file_path = settings.BASE_DIR.joinpath(f"fundraising/test_data/{filename}.json") with file_path.open() as f: data = json.load(f) - return stripe.util.convert_to_stripe_object(data, stripe.api_key, None) + return stripe.convert_to_stripe_object(data, stripe.api_key, None) def post_event(self, data): return self.client.post( diff --git a/fundraising/views.py b/fundraising/views.py index 39b5d4295c..2270808441 100644 --- a/fundraising/views.py +++ b/fundraising/views.py @@ -160,7 +160,7 @@ def update_card(request): donation.stripe_customer_id, source=request.POST["stripe_token"], ) - except stripe.error.StripeError as e: + except stripe.StripeError as e: data = {"success": False, "error": str(e)} else: data = {"success": True} @@ -195,7 +195,7 @@ def receive_webhook(request): request.headers["stripe-signature"], settings.STRIPE_ENDPOINT_SECRET, ) - except (KeyError, ValueError, stripe.error.SignatureVerificationError): + except (KeyError, ValueError, stripe.SignatureVerificationError): return HttpResponse(status=422) return WebhookHandler(event).handle() diff --git a/requirements/common.txt b/requirements/common.txt index 7488cd775a..d079e49cbe 100644 --- a/requirements/common.txt +++ b/requirements/common.txt @@ -19,5 +19,5 @@ pykismet3==0.1.1 requests==2.32.5 sorl-thumbnail==12.11.0 Sphinx==8.1.3 -stripe==12.5.1 +stripe==13.0.1 time-machine==2.19.0