Skip to content

Commit

Permalink
Codegen for openapi fc5a2b9
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-stripe committed Apr 7, 2022
1 parent ac1b4ca commit 5f73d98
Show file tree
Hide file tree
Showing 101 changed files with 1,493 additions and 1,760 deletions.
6 changes: 2 additions & 4 deletions stripe/api_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@
from stripe.api_resources.credit_note import CreditNote
from stripe.api_resources.credit_note_line_item import CreditNoteLineItem
from stripe.api_resources.customer import Customer
from stripe.api_resources.customer_balance_transaction import (
CustomerBalanceTransaction,
)
from stripe.api_resources.customer_balance_transaction import CustomerBalanceTransaction
from stripe.api_resources.dispute import Dispute
from stripe.api_resources.ephemeral_key import EphemeralKey
from stripe.api_resources.event import Event
Expand Down Expand Up @@ -88,4 +86,4 @@
from stripe.api_resources.transfer import Transfer
from stripe.api_resources.usage_record import UsageRecord
from stripe.api_resources.usage_record_summary import UsageRecordSummary
from stripe.api_resources.webhook_endpoint import WebhookEndpoint
from stripe.api_resources.webhook_endpoint import WebhookEndpoint
3 changes: 2 additions & 1 deletion stripe/api_resources/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ class Account(
UpdateableAPIResource,
):
OBJECT_NAME = "account"

def reject(self, idempotency_key=None, **params):
url = self.instance_url() + "/reject"
headers = util.populate_headers(idempotency_key)
self.refresh_from(self.request("post", url, params, headers))
return self


# We are not adding a helper for capabilities here as the Account object already has a
# capabilities property which is a hash and not the sub-list of capabilities.

Expand Down Expand Up @@ -88,3 +88,4 @@ def serialize(self, previous):
params[k] = v.serialize(previous.get(k, None))

return params

1 change: 1 addition & 0 deletions stripe/api_resources/account_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

class AccountLink(CreateableAPIResource):
OBJECT_NAME = "account_link"

1 change: 1 addition & 0 deletions stripe/api_resources/alipay_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ def retrieve(
"Can't retrieve an Alipay account without a customer ID. "
"Use customer.sources.retrieve('alipay_account_id') instead."
)

1 change: 1 addition & 0 deletions stripe/api_resources/apple_pay_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ class ApplePayDomain(
@classmethod
def class_url(cls):
return "/v1/apple_pay/domains"

1 change: 1 addition & 0 deletions stripe/api_resources/application_fee.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ def refund(self, idempotency_key=None, **params):
url = self.instance_url() + "/refund"
self.refresh_from(self.request("post", url, params, headers))
return self

1 change: 1 addition & 0 deletions stripe/api_resources/application_fee_refund.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ def retrieve(cls, id, api_key=None, **params):
"Can't retrieve a refund without an application fee ID. "
"Use application_fee.refunds.retrieve('refund_id') instead."
)

1 change: 1 addition & 0 deletions stripe/api_resources/balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

class Balance(SingletonAPIResource):
OBJECT_NAME = "balance"

1 change: 1 addition & 0 deletions stripe/api_resources/balance_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

class BalanceTransaction(ListableAPIResource):
OBJECT_NAME = "balance_transaction"

1 change: 1 addition & 0 deletions stripe/api_resources/bank_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ def retrieve(
"Use customer.sources.retrieve('bank_account_id') or "
"account.external_accounts.retrieve('bank_account_id') instead."
)

2 changes: 1 addition & 1 deletion stripe/api_resources/billing_portal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# flake8: noqa

from stripe.api_resources.billing_portal.configuration import Configuration
from stripe.api_resources.billing_portal.session import Session
from stripe.api_resources.billing_portal.session import Session
1 change: 1 addition & 0 deletions stripe/api_resources/billing_portal/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ class Configuration(
UpdateableAPIResource,
):
OBJECT_NAME = "billing_portal.configuration"

1 change: 1 addition & 0 deletions stripe/api_resources/billing_portal/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

class Session(CreateableAPIResource):
OBJECT_NAME = "billing_portal.session"

1 change: 1 addition & 0 deletions stripe/api_resources/bitcoin_receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ def instance_url(self):
@classmethod
def class_url(cls):
return "/v1/bitcoin/receivers"

1 change: 1 addition & 0 deletions stripe/api_resources/bitcoin_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

class BitcoinTransaction(StripeObject):
OBJECT_NAME = "bitcoin_transaction"

3 changes: 1 addition & 2 deletions stripe/api_resources/capability.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@ def instance_url(self):
acct_extn = quote_plus(account)
extn = quote_plus(token)
return "%s/%s/capabilities/%s" % (base, acct_extn, extn)

@classmethod
def modify(cls, sid, **params):
raise NotImplementedError(
"Can't update a capability without an account ID. Update a capability using "
"account.modify_capability('acct_123', 'acap_123', params)"
)

@classmethod
def retrieve(cls, id, api_key=None, **params):
raise NotImplementedError(
"Can't retrieve a capability without an account ID. Retrieve a capability using "
"account.retrieve_capability('acct_123', 'acap_123')"
)

1 change: 1 addition & 0 deletions stripe/api_resources/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ def retrieve(
"recipient.cards.retrieve('card_id'), or "
"account.external_accounts.retrieve('card_id') instead."
)

7 changes: 5 additions & 2 deletions stripe/api_resources/charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class Charge(
UpdateableAPIResource,
):
OBJECT_NAME = "charge"

def capture(self, idempotency_key=None, **params):
url = self.instance_url() + "/capture"
headers = util.populate_headers(idempotency_key)
Expand All @@ -27,12 +26,15 @@ def capture(self, idempotency_key=None, **params):

@classmethod
def search(cls, *args, **kwargs):
return cls._search(search_url="/v1/charges/search", *args, **kwargs)
return cls._search( search_url="/v1/charges/search", *args, **kwargs)


@classmethod
def search_auto_paging_iter(cls, *args, **kwargs):
return cls.search(*args, **kwargs).auto_paging_iter()



def refund(self, idempotency_key=None, **params):
url = self.instance_url() + "/refund"
headers = util.populate_headers(idempotency_key)
Expand Down Expand Up @@ -76,3 +78,4 @@ def mark_as_safe(self, idempotency_key=None):
headers = util.populate_headers(idempotency_key)
self.refresh_from(self.request("post", url, params, headers))
return self

2 changes: 1 addition & 1 deletion stripe/api_resources/checkout/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

# flake8: noqa

from stripe.api_resources.checkout.session import Session
from stripe.api_resources.checkout.session import Session
3 changes: 2 additions & 1 deletion stripe/api_resources/checkout/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
@nested_resource_class_methods("line_item", operations=["list"])
class Session(CreateableAPIResource, ListableAPIResource):
OBJECT_NAME = "checkout.session"

def expire(self, idempotency_key=None, **params):
url = self.instance_url() + "/expire"
headers = util.populate_headers(idempotency_key)
self.refresh_from(self.request("post", url, params, headers))
return self


1 change: 1 addition & 0 deletions stripe/api_resources/country_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

class CountrySpec(ListableAPIResource):
OBJECT_NAME = "country_spec"

1 change: 1 addition & 0 deletions stripe/api_resources/coupon.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ class Coupon(
UpdateableAPIResource,
):
OBJECT_NAME = "coupon"

3 changes: 2 additions & 1 deletion stripe/api_resources/credit_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ class CreditNote(
UpdateableAPIResource,
):
OBJECT_NAME = "credit_note"

def void_credit_note(self, idempotency_key=None, **params):
url = self.instance_url() + "/void"
headers = util.populate_headers(idempotency_key)
self.refresh_from(self.request("post", url, params, headers))
return self


@classmethod
def preview(
cls, api_key=None, stripe_version=None, stripe_account=None, **params
Expand All @@ -35,3 +35,4 @@ def preview(
return util.convert_to_stripe_object(
response, api_key, stripe_version, stripe_account
)

1 change: 1 addition & 0 deletions stripe/api_resources/credit_note_line_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

class CreditNoteLineItem(StripeObject):
OBJECT_NAME = "credit_note_line_item"

7 changes: 5 additions & 2 deletions stripe/api_resources/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class Customer(
UpdateableAPIResource,
):
OBJECT_NAME = "customer"

def list_payment_methods(self, idempotency_key=None, **params):
url = self.instance_url() + "/payment_methods"
headers = util.populate_headers(idempotency_key)
Expand All @@ -49,12 +48,15 @@ def list_payment_methods(self, idempotency_key=None, **params):

@classmethod
def search(cls, *args, **kwargs):
return cls._search(search_url="/v1/customers/search", *args, **kwargs)
return cls._search( search_url="/v1/customers/search", *args, **kwargs)


@classmethod
def search_auto_paging_iter(cls, *args, **kwargs):
return cls.search(*args, **kwargs).auto_paging_iter()



def delete_discount(self, **params):
requestor = api_requestor.APIRequestor(
self.api_key,
Expand All @@ -64,3 +66,4 @@ def delete_discount(self, **params):
url = self.instance_url() + "/discount"
_, api_key = requestor.request("delete", url, params)
self.refresh_from({"discount": None}, api_key, True)

2 changes: 1 addition & 1 deletion stripe/api_resources/customer_balance_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ def instance_url(self):
cust_extn = quote_plus(customer)
extn = quote_plus(token)
return "%s/%s/balance_transactions/%s" % (base, cust_extn, extn)

@classmethod
def retrieve(cls, id, api_key=None, **params):
raise NotImplementedError(
"Can't retrieve a Customer Balance Transaction without a Customer ID. "
"Use Customer.retrieve_customer_balance_transaction('cus_123', 'cbtxn_123')"
)

3 changes: 2 additions & 1 deletion stripe/api_resources/dispute.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
@custom_method("close", http_verb="post")
class Dispute(ListableAPIResource, UpdateableAPIResource):
OBJECT_NAME = "dispute"

def close(self, idempotency_key=None, **params):
url = self.instance_url() + "/close"
headers = util.populate_headers(idempotency_key)
self.refresh_from(self.request("post", url, params, headers))
return self


1 change: 1 addition & 0 deletions stripe/api_resources/ephemeral_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ def create(
return util.convert_to_stripe_object(
response, api_key, stripe_version, stripe_account
)

1 change: 1 addition & 0 deletions stripe/api_resources/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

class Event(ListableAPIResource):
OBJECT_NAME = "event"

1 change: 1 addition & 0 deletions stripe/api_resources/exchange_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

class ExchangeRate(ListableAPIResource):
OBJECT_NAME = "exchange_rate"

8 changes: 1 addition & 7 deletions stripe/api_resources/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ def class_url(cls):
@classmethod
def create(
# 'api_version' is deprecated, please use 'stripe_version'
cls,
api_key=None,
api_version=None,
stripe_version=None,
stripe_account=None,
**params
cls, api_key=None, api_version=None, stripe_version=None, stripe_account=None, **params
):
version = api_version or stripe_version
requestor = api_requestor.APIRequestor(
Expand All @@ -46,6 +41,5 @@ def create(
response, api_key, version, stripe_account
)


# For backwards compatibility, the `File` class is aliased to `FileUpload`.
FileUpload = File
1 change: 1 addition & 0 deletions stripe/api_resources/file_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ class FileLink(
UpdateableAPIResource,
):
OBJECT_NAME = "file_link"

8 changes: 2 additions & 6 deletions stripe/api_resources/identity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@

# flake8: noqa

from stripe.api_resources.identity.verification_report import (
VerificationReport,
)
from stripe.api_resources.identity.verification_session import (
VerificationSession,
)
from stripe.api_resources.identity.verification_report import VerificationReport
from stripe.api_resources.identity.verification_session import VerificationSession
1 change: 1 addition & 0 deletions stripe/api_resources/identity/verification_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

class VerificationReport(ListableAPIResource):
OBJECT_NAME = "identity.verification_report"

3 changes: 2 additions & 1 deletion stripe/api_resources/identity/verification_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class VerificationSession(
UpdateableAPIResource,
):
OBJECT_NAME = "identity.verification_session"

def cancel(self, idempotency_key=None, **params):
url = self.instance_url() + "/cancel"
headers = util.populate_headers(idempotency_key)
Expand All @@ -28,3 +27,5 @@ def redact(self, idempotency_key=None, **params):
headers = util.populate_headers(idempotency_key)
self.refresh_from(self.request("post", url, params, headers))
return self


7 changes: 5 additions & 2 deletions stripe/api_resources/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class Invoice(
UpdateableAPIResource,
):
OBJECT_NAME = "invoice"

def finalize_invoice(self, idempotency_key=None, **params):
url = self.instance_url() + "/finalize"
headers = util.populate_headers(idempotency_key)
Expand Down Expand Up @@ -57,12 +56,15 @@ def void_invoice(self, idempotency_key=None, **params):

@classmethod
def search(cls, *args, **kwargs):
return cls._search(search_url="/v1/invoices/search", *args, **kwargs)
return cls._search( search_url="/v1/invoices/search", *args, **kwargs)


@classmethod
def search_auto_paging_iter(cls, *args, **kwargs):
return cls.search(*args, **kwargs).auto_paging_iter()



@classmethod
def upcoming(
cls, api_key=None, stripe_version=None, stripe_account=None, **params
Expand All @@ -75,3 +77,4 @@ def upcoming(
return util.convert_to_stripe_object(
response, api_key, stripe_version, stripe_account
)

1 change: 1 addition & 0 deletions stripe/api_resources/invoice_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ class InvoiceItem(
UpdateableAPIResource,
):
OBJECT_NAME = "invoiceitem"

1 change: 1 addition & 0 deletions stripe/api_resources/invoice_line_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

class InvoiceLineItem(StripeObject):
OBJECT_NAME = "line_item"

1 change: 1 addition & 0 deletions stripe/api_resources/issuer_fraud_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

class IssuerFraudRecord(ListableAPIResource):
OBJECT_NAME = "issuer_fraud_record"

2 changes: 1 addition & 1 deletion stripe/api_resources/issuing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
from stripe.api_resources.issuing.card_details import CardDetails
from stripe.api_resources.issuing.cardholder import Cardholder
from stripe.api_resources.issuing.dispute import Dispute
from stripe.api_resources.issuing.transaction import Transaction
from stripe.api_resources.issuing.transaction import Transaction
Loading

0 comments on commit 5f73d98

Please sign in to comment.