Skip to content

Commit

Permalink
fixup! fixup! Add support for Coupons and Discounts objects
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Nov 20, 2017
1 parent e3a4f07 commit cdb67f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions pinax/stripe/actions/coupons.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
4 changes: 3 additions & 1 deletion pinax/stripe/tests/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
},
Expand All @@ -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)
Expand Down

0 comments on commit cdb67f4

Please sign in to comment.