2018-07-24 15:16:50 +02:00
|
|
|
import stripe.error as error
|
|
|
|
import stripe.util as util
|
2018-08-03 12:38:16 +02:00
|
|
|
from stripe.api_resources.list_object import SubscriptionListObject
|
2018-07-24 15:16:50 +02:00
|
|
|
|
2018-08-31 20:09:36 +02:00
|
|
|
from typing import Optional, Any, Dict, List, Union
|
2018-07-24 15:16:50 +02:00
|
|
|
|
|
|
|
api_key: Optional[str]
|
|
|
|
|
|
|
|
class Customer:
|
|
|
|
default_source: Card
|
|
|
|
created: int
|
|
|
|
id: str
|
2018-08-14 03:33:31 +02:00
|
|
|
source: str
|
2018-08-03 12:38:16 +02:00
|
|
|
subscriptions: SubscriptionListObject
|
2018-08-23 07:45:19 +02:00
|
|
|
coupon: str
|
2018-08-31 20:09:36 +02:00
|
|
|
account_balance: int
|
2018-09-06 15:14:54 +02:00
|
|
|
email: str
|
2018-07-24 15:16:50 +02:00
|
|
|
|
|
|
|
@staticmethod
|
2018-09-01 02:49:02 +02:00
|
|
|
def retrieve(customer_id: str=..., expand: Optional[List[str]]=...) -> Customer:
|
2018-07-24 15:16:50 +02:00
|
|
|
...
|
2018-07-26 15:45:51 +02:00
|
|
|
|
2018-07-24 15:16:50 +02:00
|
|
|
@staticmethod
|
2018-09-01 02:49:02 +02:00
|
|
|
def create(description: str=..., email: str=..., metadata: Dict[str, Any]=...,
|
|
|
|
source: Optional[str]=..., coupon: Optional[str]=...) -> Customer:
|
2018-07-24 15:16:50 +02:00
|
|
|
...
|
|
|
|
|
2018-08-14 03:33:31 +02:00
|
|
|
@staticmethod
|
2018-08-23 03:36:03 +02:00
|
|
|
def save() -> Customer:
|
2018-08-14 03:33:31 +02:00
|
|
|
...
|
|
|
|
|
2018-07-24 15:16:50 +02:00
|
|
|
class Invoice:
|
|
|
|
amount_due: int
|
2018-08-31 20:09:36 +02:00
|
|
|
total: int
|
2018-07-26 15:45:51 +02:00
|
|
|
|
2018-07-24 15:16:50 +02:00
|
|
|
@staticmethod
|
2018-08-31 20:09:36 +02:00
|
|
|
def upcoming(customer: str=..., subscription: str=...,
|
|
|
|
subscription_items: List[Dict[str, Union[str, int]]]=...) -> Invoice:
|
2018-07-24 15:16:50 +02:00
|
|
|
...
|
|
|
|
|
|
|
|
class Subscription:
|
|
|
|
created: int
|
|
|
|
status: str
|
2018-07-26 15:45:51 +02:00
|
|
|
canceled_at: int
|
2018-07-26 16:10:07 +02:00
|
|
|
cancel_at_period_end: bool
|
2018-07-03 21:49:55 +02:00
|
|
|
proration_date: int
|
|
|
|
quantity: int
|
2018-07-26 15:45:51 +02:00
|
|
|
|
2018-07-24 15:16:50 +02:00
|
|
|
@staticmethod
|
2018-09-01 02:49:02 +02:00
|
|
|
def create(customer: str=..., billing: str=..., items: List[Dict[str, Any]]=...,
|
|
|
|
prorate: bool=..., tax_percent: float=...) -> Subscription:
|
2018-07-24 15:16:50 +02:00
|
|
|
...
|
|
|
|
|
|
|
|
class Card:
|
|
|
|
last4: str
|
|
|
|
|
|
|
|
class Plan:
|
|
|
|
id: str
|
2018-07-26 15:45:51 +02:00
|
|
|
|
2018-07-24 15:16:50 +02:00
|
|
|
@staticmethod
|
2018-09-01 02:49:02 +02:00
|
|
|
def create(currency: str=..., interval: str=..., product: str=..., amount: int=...,
|
|
|
|
billing_scheme: str=..., nickname: str=..., usage_type: str=...) -> Plan:
|
2018-07-24 15:16:50 +02:00
|
|
|
...
|
|
|
|
|
|
|
|
class Product:
|
|
|
|
id: str
|
|
|
|
|
|
|
|
@staticmethod
|
2018-09-01 02:49:02 +02:00
|
|
|
def create(name: str=..., type: str=..., statement_descriptor: str=..., unit_label: str=...) -> Product:
|
2018-07-24 15:16:50 +02:00
|
|
|
...
|
2018-08-23 07:45:19 +02:00
|
|
|
|
|
|
|
class Coupon:
|
|
|
|
id: str
|
|
|
|
|
|
|
|
@staticmethod
|
2018-09-01 02:49:02 +02:00
|
|
|
def create(duration: str=..., name: str=..., percent_off: int=...) -> Coupon:
|
2018-08-23 07:45:19 +02:00
|
|
|
...
|