Skip to content

Commit

Permalink
Merge pull request #635 from chauhoang99/master
Browse files Browse the repository at this point in the history
Update pinax.stripe.actions.charge
  • Loading branch information
paltman authored Nov 26, 2021
2 parents 922ff0c + cff1dd8 commit 990216f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ site/

# IDEs
.idea/

*venv
7 changes: 6 additions & 1 deletion pinax/stripe/actions/charges.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ def sync_charge_from_stripe_data(data):
"""
obj, _ = models.Charge.objects.get_or_create(stripe_id=data["id"])
obj.customer = models.Customer.objects.filter(stripe_id=data["customer"]).first()
obj.source = data["source"]["id"]
# obj.source = data["source"]["id"]
# Charges made by Checkout Session don't have Source
if data.get('source'):
obj.source = data["source"]["id"]
else:
obj.source = ''
obj.currency = data["currency"]
obj.invoice = models.Invoice.objects.filter(stripe_id=data["invoice"]).first()
obj.amount = utils.convert_amount_for_db(data["amount"], obj.currency)
Expand Down

0 comments on commit 990216f

Please sign in to comment.