Skip to content

Commit

Permalink
Fix logging stripe one time charge transactions (#469)
Browse files Browse the repository at this point in the history
* Fix logging stripe one time charge transactions

Stripe's API probably changed sometime ago.

* fix tests

* fix tests - 2
  • Loading branch information
amCap1712 authored Jul 15, 2024
1 parent f4278ea commit 4a8d5cf
Show file tree
Hide file tree
Showing 2 changed files with 219 additions and 160 deletions.
4 changes: 2 additions & 2 deletions metabrainz/model/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ def log_subscription_charge(cls, invoice):
def log_one_time_charge(cls, session):
""" Log successful Stripe charge for one time payment/donation """
payment_intent = stripe.PaymentIntent.retrieve(session["payment_intent"],
expand=["charges.data.balance_transaction"])
charge = payment_intent["charges"]["data"][0]
expand=["latest_charge.balance_transaction"])
charge = payment_intent["latest_charge"]
metadata = payment_intent["metadata"]
return cls._log_stripe_charge(charge, metadata)

Expand Down
Loading

0 comments on commit 4a8d5cf

Please sign in to comment.