Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generated code for beta #995

Merged
merged 6 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v424
v431
2 changes: 1 addition & 1 deletion stripe/api_resources/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Person(UpdateableAPIResource):
This is an object representing a person associated with a Stripe account.

A platform cannot access a Standard or Express account's persons after the account starts onboarding, such as after generating an account link for the account.
See the [Standard onboarding](https://stripe.com/docs/connect/standard-accounts) or [Express onboarding documentation](https://stripe.com/docs/connect/express-accounts) for information about platform pre-filling and account onboarding steps.
See the [Standard onboarding](https://stripe.com/docs/connect/standard-accounts) or [Express onboarding documentation](https://stripe.com/docs/connect/express-accounts) for information about platform prefilling and account onboarding steps.

Related guide: [Handling identity verification with the API](https://stripe.com/docs/connect/identity-verification-api#person-information)
"""
Expand Down
1 change: 1 addition & 0 deletions stripe/api_resources/tax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# flake8: noqa

from stripe.api_resources.tax.calculation import Calculation
from stripe.api_resources.tax.form import Form
from stripe.api_resources.tax.registration import Registration
from stripe.api_resources.tax.settings import Settings
from stripe.api_resources.tax.transaction import Transaction
62 changes: 62 additions & 0 deletions stripe/api_resources/tax/form.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from __future__ import absolute_import, division, print_function

import stripe
from stripe import api_requestor, util
from stripe.api_resources.abstract import ListableAPIResource
from stripe.six.moves.urllib.parse import quote_plus


class Form(ListableAPIResource):
"""
Tax forms are legal documents which are delivered to one or more tax authorities for information reporting purposes.

Related guide: [US tax reporting for Connect platforms](https://stripe.com/docs/connect/tax-reporting)
"""

OBJECT_NAME = "tax.form"

@classmethod
def _cls_pdf(
cls,
sid,
api_key=None,
idempotency_key=None,
stripe_version=None,
stripe_account=None,
**params
):
url = "%s/%s/%s" % (
cls.class_url(),
quote_plus(util.utf8(sid)),
"pdf",
)
requestor = api_requestor.APIRequestor(
api_key,
api_base=stripe.upload_api_base,
api_version=stripe_version,
account=stripe_account,
)
headers = util.populate_headers(idempotency_key)
response, _ = requestor.request_stream("get", url, params, headers)
return response

@util.class_method_variant("_cls_pdf")
def pdf(
self,
api_key=None,
api_version=None,
stripe_version=None,
stripe_account=None,
**params
):
version = api_version or stripe_version
requestor = api_requestor.APIRequestor(
api_key,
api_base=stripe.upload_api_base,
api_version=version,
account=stripe_account,
)
url = self.instance_url() + "/pdf"
return requestor.request_stream("get", url, params=params)
1 change: 1 addition & 0 deletions stripe/object_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
api_resources.SubscriptionItem.OBJECT_NAME: api_resources.SubscriptionItem,
api_resources.SubscriptionSchedule.OBJECT_NAME: api_resources.SubscriptionSchedule,
api_resources.tax.Calculation.OBJECT_NAME: api_resources.tax.Calculation,
api_resources.tax.Form.OBJECT_NAME: api_resources.tax.Form,
api_resources.tax.Registration.OBJECT_NAME: api_resources.tax.Registration,
api_resources.tax.Settings.OBJECT_NAME: api_resources.tax.Settings,
api_resources.tax.Transaction.OBJECT_NAME: api_resources.tax.Transaction,
Expand Down
3 changes: 3 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,21 @@ def pytest_runtest_setup(item):
def setup_stripe():
orig_attrs = {
"api_base": stripe.api_base,
"upload_api_base": stripe.upload_api_base,
"api_key": stripe.api_key,
"client_id": stripe.client_id,
"default_http_client": stripe.default_http_client,
}
http_client = stripe.http_client.new_default_http_client()
stripe.api_base = "http://localhost:%s" % MOCK_PORT
stripe.upload_api_base = "http://localhost:%s" % MOCK_PORT
stripe.api_key = "sk_test_123"
stripe.client_id = "ca_123"
stripe.default_http_client = http_client
yield
http_client.close()
stripe.api_base = orig_attrs["api_base"]
stripe.upload_api_base = orig_attrs["upload_api_base"]
stripe.api_key = orig_attrs["api_key"]
stripe.client_id = orig_attrs["client_id"]
stripe.default_http_client = orig_attrs["default_http_client"]
Expand Down
14 changes: 14 additions & 0 deletions tests/test_generated_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -3655,3 +3655,17 @@ def test_creditnote_preview_lines(self, request_mock):
"get",
"/v1/credit_notes/preview/lines",
)

def test_quote_pdf(self, request_mock):
stripe.Quote.pdf("qt_xxxxxxxxxxxxx")
request_mock.assert_requested_stream(
"get",
"/v1/quotes/qt_xxxxxxxxxxxxx/pdf",
)

def test_tax_form_pdf(self, request_mock):
stripe.tax.Form.pdf("form_xxxxxxxxxxxxx")
request_mock.assert_requested_stream(
"get",
"/v1/tax/forms/form_xxxxxxxxxxxxx/pdf",
)