From cdb67f40478e6a4a4bc6d126c01908d3fc567661 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 20 Nov 2017 21:46:31 +0100 Subject: [PATCH] fixup! fixup! Add support for Coupons and Discounts objects --- pinax/stripe/actions/coupons.py | 1 + pinax/stripe/tests/test_actions.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pinax/stripe/actions/coupons.py b/pinax/stripe/actions/coupons.py index 1dc0e0fe9..522b95a28 100644 --- a/pinax/stripe/actions/coupons.py +++ b/pinax/stripe/actions/coupons.py @@ -26,6 +26,7 @@ def sync_coupon_from_stripe_data(coupon, stripe_account=None): currency=coupon["currency"] or "", duration=coupon["duration"], duration_in_months=coupon["duration_in_months"], + livemode=coupon["livemode"], max_redemptions=coupon["max_redemptions"], metadata=coupon["metadata"], percent_off=coupon["percent_off"], diff --git a/pinax/stripe/tests/test_actions.py b/pinax/stripe/tests/test_actions.py index 0f39573b3..70602a33c 100644 --- a/pinax/stripe/tests/test_actions.py +++ b/pinax/stripe/tests/test_actions.py @@ -1198,7 +1198,7 @@ def test_sync_coupon_from_stripe_data(self): "currency": None, "duration": "repeating", "duration_in_months": 3, - "livemode": False, + "livemode": True, "max_redemptions": None, "metadata": { }, @@ -1208,9 +1208,11 @@ def test_sync_coupon_from_stripe_data(self): "valid": True } cs1 = coupons.sync_coupon_from_stripe_data(coupon) + self.assertTrue(cs1.livemode) c1 = Coupon.objects.get(stripe_id=coupon["id"], stripe_account=None) self.assertEquals(c1, cs1) self.assertEquals(c1.percent_off, decimal.Decimal(35.00)) + cs2 = coupons.sync_coupon_from_stripe_data(coupon, stripe_account=account) c2 = Coupon.objects.get(stripe_id=coupon["id"], stripe_account=account) self.assertEquals(c2, cs2)