File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ def test_cancel_donation(self, retrieve_customer):
149
149
self .assertRedirects (
150
150
response , reverse ("fundraising:manage-donations" , kwargs = {"hero" : donor .id })
151
151
)
152
- retrieve_customer .assert_called_once_with ("54321" )
152
+ retrieve_customer .assert_called_once_with ("54321" , expand = [ "subscriptions" ] )
153
153
donation = Donation .objects .get (id = donation .id )
154
154
self .assertEqual ("" , donation .stripe_subscription_id )
155
155
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ def update_card(request):
160
160
donation .stripe_customer_id , expand = ["subscriptions" ]
161
161
)
162
162
subscription = customer .subscriptions .retrieve (donation .stripe_subscription_id )
163
- subscription .source = request .POST ["stripe_token" ]
163
+ subscription .default_source = request .POST ["stripe_token" ]
164
164
subscription .save ()
165
165
except stripe .error .StripeError as e :
166
166
data = {"success" : False , "error" : str (e )}
@@ -176,7 +176,9 @@ def cancel_donation(request, hero):
176
176
donations = hero .donation_set .exclude (stripe_subscription_id = "" )
177
177
donation = get_object_or_404 (donations , pk = donation_id )
178
178
179
- customer = stripe .Customer .retrieve (donation .stripe_customer_id )
179
+ customer = stripe .Customer .retrieve (
180
+ donation .stripe_customer_id , expand = ["subscriptions" ]
181
+ )
180
182
customer .subscriptions .retrieve (donation .stripe_subscription_id ).delete ()
181
183
182
184
donation .stripe_subscription_id = ""
You can’t perform that action at this time.
0 commit comments