forked from pinax/pinax-stripe-light
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
link_customer: create missing customers
This also fixes some event fixtures. Fixes pinax#467.
- Loading branch information
Showing
3 changed files
with
65 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,14 +36,21 @@ def test_link_customer_customer_created(self): | |
"account_balance": 0, | ||
"active_card": None, | ||
"created": 1363911708, | ||
"currency": None, | ||
"default_source": None, | ||
"delinquent": False, | ||
"description": None, | ||
"discount": None, | ||
"email": "[email protected]", | ||
"id": "cus_xxxxxxxxxxxxxxx", | ||
"livemode": True, | ||
"object": "customer", | ||
"subscription": None | ||
"sources": { | ||
"data": [], | ||
}, | ||
"subscriptions": { | ||
"data": [], | ||
}, | ||
} | ||
}, | ||
"id": "evt_xxxxxxxxxxxxx", | ||
|
@@ -59,8 +66,11 @@ def test_link_customer_customer_created(self): | |
webhook_message=msg, | ||
validated_message=msg | ||
) | ||
self.assertIsNone(self.customer.account_balance) | ||
customers.link_customer(event) | ||
self.assertEquals(event.customer, self.customer) | ||
self.customer.refresh_from_db() | ||
self.assertEquals(self.customer.account_balance, 0) | ||
|
||
def test_link_customer_customer_updated(self): | ||
msg = { | ||
|
@@ -88,14 +98,21 @@ def test_link_customer_customer_updated(self): | |
"type": "MasterCard" | ||
}, | ||
"created": 1346855596, | ||
"currency": None, | ||
"default_source": None, | ||
"delinquent": False, | ||
"description": None, | ||
"discount": None, | ||
"email": "[email protected]", | ||
"id": "cus_xxxxxxxxxxxxxxx", | ||
"livemode": True, | ||
"object": "customer", | ||
"subscription": None | ||
"sources": { | ||
"data": [], | ||
}, | ||
"subscriptions": { | ||
"data": [], | ||
}, | ||
}, | ||
"previous_attributes": { | ||
"active_card": None | ||
|
@@ -125,14 +142,21 @@ def test_link_customer_customer_deleted(self): | |
"account_balance": 0, | ||
"active_card": None, | ||
"created": 1348286302, | ||
"currency": None, | ||
"default_source": None, | ||
"delinquent": False, | ||
"description": None, | ||
"discount": None, | ||
"email": "[email protected]", | ||
"id": "cus_xxxxxxxxxxxxxxx", | ||
"livemode": True, | ||
"object": "customer", | ||
"subscription": None | ||
"sources": { | ||
"data": [], | ||
}, | ||
"subscriptions": { | ||
"data": [], | ||
}, | ||
} | ||
}, | ||
"id": "evt_xxxxxxxxxxxxx", | ||
|
@@ -162,14 +186,21 @@ def test_process_customer_deleted(self, CustomerMock, EventMock): | |
"account_balance": 0, | ||
"active_card": None, | ||
"created": 1348286302, | ||
"currency": None, | ||
"default_source": None, | ||
"delinquent": False, | ||
"description": None, | ||
"discount": None, | ||
"email": "[email protected]", | ||
"id": "cus_xxxxxxxxxxxxxxx", | ||
"livemode": True, | ||
"object": "customer", | ||
"subscription": None | ||
"sources": { | ||
"data": [], | ||
}, | ||
"subscriptions": { | ||
"data": [], | ||
} | ||
} | ||
}, | ||
"id": "evt_xxxxxxxxxxxxx", | ||
|