stubbing in methods to help with stripe refactor work.
modified: make_post_sell/models/stripe_user_shop.py
This commit is contained in:
parent
712b5d6563
commit
db6f1ac795
1 changed files with 19 additions and 0 deletions
|
|
@ -38,6 +38,25 @@ class StripeUserShop(RBase, Base):
|
|||
"""Return this object's remote API stripe Customer object."""
|
||||
return self.shop.stripe_customer(self.user)
|
||||
|
||||
@property
|
||||
def stripe_customer_default_source(self):
|
||||
if self.stripe_customer:
|
||||
if self.stripe_customer.default_source:
|
||||
return self.stripe_customer.sources.retrieve(
|
||||
self.stripe_customer.default_source
|
||||
)
|
||||
return None
|
||||
|
||||
@property
|
||||
def stripe_active_card(self):
|
||||
|
||||
cards = self.shop.stripe.Customer.list_payment_methods(self.stripe_customer, type="card")["data"]
|
||||
|
||||
for card in cards:
|
||||
#print(card)
|
||||
if card.id == self.active_card_id:
|
||||
return card
|
||||
|
||||
|
||||
def get_all_stripe_user_shop_objects(dbsession):
|
||||
return dbsession.query(StripeUserShop).all()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue