Skip to content

Commit 258c804

Browse files
committed
Fixed deprecated stripe.util and stripe.error imports
These imports were moved in stripe release 7.8.0
1 parent 3ec56d6 commit 258c804

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

fundraising/management/commands/create_stripe_plans.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def handle(self, **kwargs):
1111
try:
1212
stripe.Plan.retrieve("monthly")
1313
print("Monthly plan exists, not creating!")
14-
except stripe.error.InvalidRequestError:
14+
except stripe.InvalidRequestError:
1515
name = "Monthly donation"
1616
logger.info(f"Creating plan: {name}")
1717
stripe.Plan.create(
@@ -25,7 +25,7 @@ def handle(self, **kwargs):
2525
try:
2626
stripe.Plan.retrieve("quarterly")
2727
print("Quarterly plan exists, not creating!")
28-
except stripe.error.InvalidRequestError:
28+
except stripe.InvalidRequestError:
2929
name = "Quarterly donation"
3030
logger.info(f"Creating plan: {name}")
3131
stripe.Plan.create(
@@ -40,7 +40,7 @@ def handle(self, **kwargs):
4040
try:
4141
stripe.Plan.retrieve("yearly")
4242
print("Yearly plan exists, not creating!")
43-
except stripe.error.InvalidRequestError:
43+
except stripe.InvalidRequestError:
4444
name = "Yearly donation"
4545
logger.info(f"Creating plan: {name}")
4646
stripe.Plan.create(

fundraising/tests/test_views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def stripe_data(self, filename):
263263
file_path = settings.BASE_DIR.joinpath(f"fundraising/test_data/{filename}.json")
264264
with file_path.open() as f:
265265
data = json.load(f)
266-
return stripe.util.convert_to_stripe_object(data, stripe.api_key, None)
266+
return stripe.convert_to_stripe_object(data, stripe.api_key, None)
267267

268268
def post_event(self, data):
269269
return self.client.post(

fundraising/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def update_card(request):
160160
donation.stripe_customer_id,
161161
source=request.POST["stripe_token"],
162162
)
163-
except stripe.error.StripeError as e:
163+
except stripe.StripeError as e:
164164
data = {"success": False, "error": str(e)}
165165
else:
166166
data = {"success": True}
@@ -195,7 +195,7 @@ def receive_webhook(request):
195195
request.headers["stripe-signature"],
196196
settings.STRIPE_ENDPOINT_SECRET,
197197
)
198-
except (KeyError, ValueError, stripe.error.SignatureVerificationError):
198+
except (KeyError, ValueError, stripe.SignatureVerificationError):
199199
return HttpResponse(status=422)
200200

201201
return WebhookHandler(event).handle()

0 commit comments

Comments
 (0)