Skip to content

Commit

Permalink
Merge pull request #515 from blueyed/charge-outcome-upstream
Browse files Browse the repository at this point in the history
Add Charge.outcome
  • Loading branch information
paltman authored Dec 1, 2017
2 parents 6766a04 + d3731c5 commit 257a9f2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions pinax/stripe/actions/charges.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def sync_charge_from_stripe_data(data):
)
obj.fee_currency = balance_transaction["currency"]
obj.transfer_group = data.get("transfer_group")
obj.outcome = data.get("outcome")
obj.save()
return obj

Expand Down
21 changes: 21 additions & 0 deletions pinax/stripe/migrations/0013_charge_outcome.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-22 15:40
from __future__ import unicode_literals

from django.db import migrations
import jsonfield.fields


class Migration(migrations.Migration):

dependencies = [
('pinax_stripe', '0014_blank_with_null'),
]

operations = [
migrations.AddField(
model_name='charge',
name='outcome',
field=jsonfield.fields.JSONField(blank=True, null=True),
),
]
1 change: 1 addition & 0 deletions pinax/stripe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ class Charge(StripeAccountFromCustomerMixin, StripeObject):
fee_currency = models.CharField(max_length=10, null=True, blank=True)

transfer_group = models.TextField(null=True, blank=True)
outcome = JSONField(null=True, blank=True)

objects = ChargeManager()

Expand Down
1 change: 1 addition & 0 deletions pinax/stripe/tests/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2155,6 +2155,7 @@ def test_sync_charge_from_stripe_data_failed(self):
charge = Charge.objects.get(stripe_id=data["id"])
self.assertEqual(charge.amount, decimal.Decimal("2"))
self.assertEqual(charge.customer, None)
self.assertEqual(charge.outcome["risk_level"], "normal")

@patch("stripe.Subscription.retrieve")
def test_retrieve_stripe_subscription(self, RetrieveMock):
Expand Down

0 comments on commit 257a9f2

Please sign in to comment.