From b8500c9a5f47d7d24506bf5298e6ef5888e2501a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 11 Oct 2024 02:46:14 +0000 Subject: [PATCH] feat(api): api update (#61) --- .stats.yml | 4 +- api.md | 1 + src/conductor/resources/qbd/customers.py | 16 +- .../resources/qbd/sales_tax_codes.py | 16 +- .../resources/qbd/sales_tax_items.py | 199 +++++++++++++++++- src/conductor/types/qbd/__init__.py | 1 + .../types/qbd/customer_create_params.py | 8 +- src/conductor/types/qbd/qbd_customer.py | 8 +- src/conductor/types/qbd/qbd_invoice.py | 8 +- src/conductor/types/qbd/qbd_sales_tax_item.py | 6 +- src/conductor/types/qbd/sales_tax_code.py | 8 +- .../types/qbd/sales_tax_code_create_params.py | 8 +- .../types/qbd/sales_tax_item_create_params.py | 86 ++++++++ .../api_resources/qbd/test_sales_tax_items.py | 108 ++++++++++ 14 files changed, 434 insertions(+), 43 deletions(-) create mode 100644 src/conductor/types/qbd/sales_tax_item_create_params.py diff --git a/.stats.yml b/.stats.yml index 2f775de3..9bd3cf96 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 50 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/conductor%2Fconductor-7a0ba1541be8ca6fb246837deacc440c0f3dc1cfaf255dcec474b2f728d58272.yml +configured_endpoints: 51 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/conductor%2Fconductor-ff32725cb96be72b97d4411a1d1be06ceef77e12be1a71f66cda11260502a735.yml diff --git a/api.md b/api.md index aaed249b..105d05fd 100644 --- a/api.md +++ b/api.md @@ -197,6 +197,7 @@ from conductor.types.qbd import QbdSalesTaxItem Methods: +- client.qbd.sales_tax_items.create(\*\*params) -> QbdSalesTaxItem - client.qbd.sales_tax_items.retrieve(id) -> QbdSalesTaxItem - client.qbd.sales_tax_items.list(\*\*params) -> SyncCursorPage[QbdSalesTaxItem] diff --git a/src/conductor/resources/qbd/customers.py b/src/conductor/resources/qbd/customers.py index 11ad4e53..d7fb7246 100644 --- a/src/conductor/resources/qbd/customers.py +++ b/src/conductor/resources/qbd/customers.py @@ -180,10 +180,10 @@ def create( is_active: Indicates whether this customer is active. Inactive objects are typically hidden from views and reports in QuickBooks. - item_sales_tax_id: The specific sales-tax item used to calculate the actual tax amount for this - customer's transactions. It represents a single tax rate collected for a single - tax agency. This is more specific than `salesTaxCode`, which only indicates - taxability, and is used for the actual tax calculation and reporting. + item_sales_tax_id: The sales-tax item used to calculate the actual tax amount for this customer's + transactions by applying a specific tax rate collected for a single tax agency. + Unlike `salesTaxCode`, which only indicates general taxability, this field + drives the actual tax calculation and reporting. job_description: A brief description of this customer's job, if this object is a job (i.e., sub-customer). @@ -679,10 +679,10 @@ async def create( is_active: Indicates whether this customer is active. Inactive objects are typically hidden from views and reports in QuickBooks. - item_sales_tax_id: The specific sales-tax item used to calculate the actual tax amount for this - customer's transactions. It represents a single tax rate collected for a single - tax agency. This is more specific than `salesTaxCode`, which only indicates - taxability, and is used for the actual tax calculation and reporting. + item_sales_tax_id: The sales-tax item used to calculate the actual tax amount for this customer's + transactions by applying a specific tax rate collected for a single tax agency. + Unlike `salesTaxCode`, which only indicates general taxability, this field + drives the actual tax calculation and reporting. job_description: A brief description of this customer's job, if this object is a job (i.e., sub-customer). diff --git a/src/conductor/resources/qbd/sales_tax_codes.py b/src/conductor/resources/qbd/sales_tax_codes.py index 9f93b702..3612a7cc 100644 --- a/src/conductor/resources/qbd/sales_tax_codes.py +++ b/src/conductor/resources/qbd/sales_tax_codes.py @@ -83,10 +83,10 @@ def create( is_active: Indicates whether this sales-tax code is active. Inactive objects are typically hidden from views and reports in QuickBooks. - item_sales_tax_id: The specific sales-tax item used to calculate the actual tax amount for this - sales-tax code's transactions. It represents a single tax rate collected for a - single tax agency. This is more specific than `salesTaxCode`, which only - indicates taxability, and is used for the actual tax calculation and reporting. + item_sales_tax_id: The sales-tax item used to calculate the actual tax amount for this sales-tax + code's transactions by applying a specific tax rate collected for a single tax + agency. Unlike `salesTaxCode`, which only indicates general taxability, this + field drives the actual tax calculation and reporting. extra_headers: Send extra headers @@ -323,10 +323,10 @@ async def create( is_active: Indicates whether this sales-tax code is active. Inactive objects are typically hidden from views and reports in QuickBooks. - item_sales_tax_id: The specific sales-tax item used to calculate the actual tax amount for this - sales-tax code's transactions. It represents a single tax rate collected for a - single tax agency. This is more specific than `salesTaxCode`, which only - indicates taxability, and is used for the actual tax calculation and reporting. + item_sales_tax_id: The sales-tax item used to calculate the actual tax amount for this sales-tax + code's transactions by applying a specific tax rate collected for a single tax + agency. Unlike `salesTaxCode`, which only indicates general taxability, this + field drives the actual tax calculation and reporting. extra_headers: Send extra headers diff --git a/src/conductor/resources/qbd/sales_tax_items.py b/src/conductor/resources/qbd/sales_tax_items.py index 1bab7702..b6ede244 100644 --- a/src/conductor/resources/qbd/sales_tax_items.py +++ b/src/conductor/resources/qbd/sales_tax_items.py @@ -7,7 +7,10 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import maybe_transform +from ..._utils import ( + maybe_transform, + async_maybe_transform, +) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -16,7 +19,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...types.qbd import sales_tax_item_list_params +from ...types.qbd import sales_tax_item_list_params, sales_tax_item_create_params from ...pagination import SyncCursorPage, AsyncCursorPage from ..._base_client import AsyncPaginator, make_request_options from ...types.qbd.qbd_sales_tax_item import QbdSalesTaxItem @@ -44,6 +47,96 @@ def with_streaming_response(self) -> SalesTaxItemsResourceWithStreamingResponse: """ return SalesTaxItemsResourceWithStreamingResponse(self) + def create( + self, + *, + name: str, + conductor_end_user_id: str, + barcode: sales_tax_item_create_params.Barcode | NotGiven = NOT_GIVEN, + class_id: str | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + external_id: str | NotGiven = NOT_GIVEN, + is_active: bool | NotGiven = NOT_GIVEN, + sales_tax_return_line_id: str | NotGiven = NOT_GIVEN, + tax_rate: str | NotGiven = NOT_GIVEN, + tax_vendor_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> QbdSalesTaxItem: + """ + Creates a sales-tax item. + + Args: + name: The case-insensitive unique name of this sales-tax item, unique across all + sales-tax items. + + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + barcode: The sales-tax item's barcode. + + class_id: The sales-tax item's class. Classes can be used to categorize objects into + meaningful segments, such as department, location, or type of work. In + QuickBooks, class tracking is off by default. + + description: The sales-tax item's description that will appear on sales forms that include + this item. + + external_id: A developer-assigned globally unique identifier (GUID) for tracking this object + in external systems. Must be formatted as a valid GUID; otherwise, QuickBooks + will return an error. + + is_active: Indicates whether this sales-tax item is active. Inactive objects are typically + hidden from views and reports in QuickBooks. + + sales_tax_return_line_id: The specific line on the sales tax return form where the tax collected using + this sales-tax item should be reported. + + tax_rate: The tax rate defined by this sales-tax item, represented as a decimal string. + For example, "7.5" represents a 7.5% tax rate. This rate determines the amount + of sales tax applied when this item is used in transactions. If a non-zero + `taxRate` is specified, then the `taxVendor` field is required. + + tax_vendor_id: The tax agency (vendor) to whom collected sales taxes are owed for this + sales-tax item. This field refers to a vendor in QuickBooks that represents the + tax authority. If a non-zero `taxRate` is specified, then `taxVendor` is + required. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Conductor-End-User-Id": conductor_end_user_id, **(extra_headers or {})} + return self._post( + "/quickbooks-desktop/sales-tax-items", + body=maybe_transform( + { + "name": name, + "barcode": barcode, + "class_id": class_id, + "description": description, + "external_id": external_id, + "is_active": is_active, + "sales_tax_return_line_id": sales_tax_return_line_id, + "tax_rate": tax_rate, + "tax_vendor_id": tax_vendor_id, + }, + sales_tax_item_create_params.SalesTaxItemCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QbdSalesTaxItem, + ) + def retrieve( self, id: str, @@ -229,6 +322,96 @@ def with_streaming_response(self) -> AsyncSalesTaxItemsResourceWithStreamingResp """ return AsyncSalesTaxItemsResourceWithStreamingResponse(self) + async def create( + self, + *, + name: str, + conductor_end_user_id: str, + barcode: sales_tax_item_create_params.Barcode | NotGiven = NOT_GIVEN, + class_id: str | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + external_id: str | NotGiven = NOT_GIVEN, + is_active: bool | NotGiven = NOT_GIVEN, + sales_tax_return_line_id: str | NotGiven = NOT_GIVEN, + tax_rate: str | NotGiven = NOT_GIVEN, + tax_vendor_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> QbdSalesTaxItem: + """ + Creates a sales-tax item. + + Args: + name: The case-insensitive unique name of this sales-tax item, unique across all + sales-tax items. + + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + barcode: The sales-tax item's barcode. + + class_id: The sales-tax item's class. Classes can be used to categorize objects into + meaningful segments, such as department, location, or type of work. In + QuickBooks, class tracking is off by default. + + description: The sales-tax item's description that will appear on sales forms that include + this item. + + external_id: A developer-assigned globally unique identifier (GUID) for tracking this object + in external systems. Must be formatted as a valid GUID; otherwise, QuickBooks + will return an error. + + is_active: Indicates whether this sales-tax item is active. Inactive objects are typically + hidden from views and reports in QuickBooks. + + sales_tax_return_line_id: The specific line on the sales tax return form where the tax collected using + this sales-tax item should be reported. + + tax_rate: The tax rate defined by this sales-tax item, represented as a decimal string. + For example, "7.5" represents a 7.5% tax rate. This rate determines the amount + of sales tax applied when this item is used in transactions. If a non-zero + `taxRate` is specified, then the `taxVendor` field is required. + + tax_vendor_id: The tax agency (vendor) to whom collected sales taxes are owed for this + sales-tax item. This field refers to a vendor in QuickBooks that represents the + tax authority. If a non-zero `taxRate` is specified, then `taxVendor` is + required. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Conductor-End-User-Id": conductor_end_user_id, **(extra_headers or {})} + return await self._post( + "/quickbooks-desktop/sales-tax-items", + body=await async_maybe_transform( + { + "name": name, + "barcode": barcode, + "class_id": class_id, + "description": description, + "external_id": external_id, + "is_active": is_active, + "sales_tax_return_line_id": sales_tax_return_line_id, + "tax_rate": tax_rate, + "tax_vendor_id": tax_vendor_id, + }, + sales_tax_item_create_params.SalesTaxItemCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QbdSalesTaxItem, + ) + async def retrieve( self, id: str, @@ -398,6 +581,9 @@ class SalesTaxItemsResourceWithRawResponse: def __init__(self, sales_tax_items: SalesTaxItemsResource) -> None: self._sales_tax_items = sales_tax_items + self.create = to_raw_response_wrapper( + sales_tax_items.create, + ) self.retrieve = to_raw_response_wrapper( sales_tax_items.retrieve, ) @@ -410,6 +596,9 @@ class AsyncSalesTaxItemsResourceWithRawResponse: def __init__(self, sales_tax_items: AsyncSalesTaxItemsResource) -> None: self._sales_tax_items = sales_tax_items + self.create = async_to_raw_response_wrapper( + sales_tax_items.create, + ) self.retrieve = async_to_raw_response_wrapper( sales_tax_items.retrieve, ) @@ -422,6 +611,9 @@ class SalesTaxItemsResourceWithStreamingResponse: def __init__(self, sales_tax_items: SalesTaxItemsResource) -> None: self._sales_tax_items = sales_tax_items + self.create = to_streamed_response_wrapper( + sales_tax_items.create, + ) self.retrieve = to_streamed_response_wrapper( sales_tax_items.retrieve, ) @@ -434,6 +626,9 @@ class AsyncSalesTaxItemsResourceWithStreamingResponse: def __init__(self, sales_tax_items: AsyncSalesTaxItemsResource) -> None: self._sales_tax_items = sales_tax_items + self.create = async_to_streamed_response_wrapper( + sales_tax_items.create, + ) self.retrieve = async_to_streamed_response_wrapper( sales_tax_items.retrieve, ) diff --git a/src/conductor/types/qbd/__init__.py b/src/conductor/types/qbd/__init__.py index 729efe53..512cf0ba 100644 --- a/src/conductor/types/qbd/__init__.py +++ b/src/conductor/types/qbd/__init__.py @@ -42,6 +42,7 @@ from .inventory_item_create_params import InventoryItemCreateParams as InventoryItemCreateParams from .sales_tax_code_create_params import SalesTaxCodeCreateParams as SalesTaxCodeCreateParams from .sales_tax_code_list_response import SalesTaxCodeListResponse as SalesTaxCodeListResponse +from .sales_tax_item_create_params import SalesTaxItemCreateParams as SalesTaxItemCreateParams from .credit_card_charge_list_params import CreditCardChargeListParams as CreditCardChargeListParams from .date_driven_term_create_params import DateDrivenTermCreateParams as DateDrivenTermCreateParams from .date_driven_term_list_response import DateDrivenTermListResponse as DateDrivenTermListResponse diff --git a/src/conductor/types/qbd/customer_create_params.py b/src/conductor/types/qbd/customer_create_params.py index 8fa25e9b..0d90f8dd 100644 --- a/src/conductor/types/qbd/customer_create_params.py +++ b/src/conductor/types/qbd/customer_create_params.py @@ -141,10 +141,10 @@ class CustomerCreateParams(TypedDict, total=False): item_sales_tax_id: Annotated[str, PropertyInfo(alias="itemSalesTaxId")] """ - The specific sales-tax item used to calculate the actual tax amount for this - customer's transactions. It represents a single tax rate collected for a single - tax agency. This is more specific than `salesTaxCode`, which only indicates - taxability, and is used for the actual tax calculation and reporting. + The sales-tax item used to calculate the actual tax amount for this customer's + transactions by applying a specific tax rate collected for a single tax agency. + Unlike `salesTaxCode`, which only indicates general taxability, this field + drives the actual tax calculation and reporting. """ job_description: Annotated[str, PropertyInfo(alias="jobDescription")] diff --git a/src/conductor/types/qbd/qbd_customer.py b/src/conductor/types/qbd/qbd_customer.py index d592626b..a0e02072 100644 --- a/src/conductor/types/qbd/qbd_customer.py +++ b/src/conductor/types/qbd/qbd_customer.py @@ -580,10 +580,10 @@ class QbdCustomer(BaseModel): item_sales_tax: Optional[ItemSalesTax] = FieldInfo(alias="itemSalesTax", default=None) """ - The specific sales-tax item used to calculate the actual tax amount for this - customer's transactions. It represents a single tax rate collected for a single - tax agency. This is more specific than `salesTaxCode`, which only indicates - taxability, and is used for the actual tax calculation and reporting. + The sales-tax item used to calculate the actual tax amount for this customer's + transactions by applying a specific tax rate collected for a single tax agency. + Unlike `salesTaxCode`, which only indicates general taxability, this field + drives the actual tax calculation and reporting. """ job_description: Optional[str] = FieldInfo(alias="jobDescription", default=None) diff --git a/src/conductor/types/qbd/qbd_invoice.py b/src/conductor/types/qbd/qbd_invoice.py index e6446ff1..edefad8e 100644 --- a/src/conductor/types/qbd/qbd_invoice.py +++ b/src/conductor/types/qbd/qbd_invoice.py @@ -1168,10 +1168,10 @@ class QbdInvoice(BaseModel): item_sales_tax: Optional[ItemSalesTax] = FieldInfo(alias="itemSalesTax", default=None) """ - The specific sales-tax item used to calculate the actual tax amount for this - invoice's transactions. It represents a single tax rate collected for a single - tax agency. This is more specific than `salesTaxCode`, which only indicates - taxability, and is used for the actual tax calculation and reporting. + The sales-tax item used to calculate the actual tax amount for this invoice's + transactions by applying a specific tax rate collected for a single tax agency. + Unlike `salesTaxCode`, which only indicates general taxability, this field + drives the actual tax calculation and reporting. """ linked_transactions: List[LinkedTransaction] = FieldInfo(alias="linkedTransactions") diff --git a/src/conductor/types/qbd/qbd_sales_tax_item.py b/src/conductor/types/qbd/qbd_sales_tax_item.py index add01c7e..245aae62 100644 --- a/src/conductor/types/qbd/qbd_sales_tax_item.py +++ b/src/conductor/types/qbd/qbd_sales_tax_item.py @@ -147,9 +147,9 @@ class QbdSalesTaxItem(BaseModel): tax_rate: Optional[str] = FieldInfo(alias="taxRate", default=None) """The tax rate defined by this sales-tax item, represented as a decimal string. - For example, "7.5" represents a 7.5% tax rate. If a non-zero `taxRate` is - specified, the `taxVendor` field becomes required. This rate determines the - amount of sales tax applied when this item is used in transactions. + For example, "7.5" represents a 7.5% tax rate. This rate determines the amount + of sales tax applied when this item is used in transactions. If a non-zero + `taxRate` is specified, then the `taxVendor` field is required. """ tax_vendor: Optional[TaxVendor] = FieldInfo(alias="taxVendor", default=None) diff --git a/src/conductor/types/qbd/sales_tax_code.py b/src/conductor/types/qbd/sales_tax_code.py index 82209e74..10f70b93 100644 --- a/src/conductor/types/qbd/sales_tax_code.py +++ b/src/conductor/types/qbd/sales_tax_code.py @@ -60,10 +60,10 @@ class SalesTaxCode(BaseModel): item_sales_tax: Optional[ItemSalesTax] = FieldInfo(alias="itemSalesTax", default=None) """ - The specific sales-tax item used to calculate the actual tax amount for this - sales-tax code's transactions. It represents a single tax rate collected for a - single tax agency. This is more specific than `salesTaxCode`, which only - indicates taxability, and is used for the actual tax calculation and reporting. + The sales-tax item used to calculate the actual tax amount for this sales-tax + code's transactions by applying a specific tax rate collected for a single tax + agency. Unlike `salesTaxCode`, which only indicates general taxability, this + field drives the actual tax calculation and reporting. """ name: str diff --git a/src/conductor/types/qbd/sales_tax_code_create_params.py b/src/conductor/types/qbd/sales_tax_code_create_params.py index a5a1cb8d..c34ae5f9 100644 --- a/src/conductor/types/qbd/sales_tax_code_create_params.py +++ b/src/conductor/types/qbd/sales_tax_code_create_params.py @@ -41,8 +41,8 @@ class SalesTaxCodeCreateParams(TypedDict, total=False): item_sales_tax_id: Annotated[str, PropertyInfo(alias="itemSalesTaxId")] """ - The specific sales-tax item used to calculate the actual tax amount for this - sales-tax code's transactions. It represents a single tax rate collected for a - single tax agency. This is more specific than `salesTaxCode`, which only - indicates taxability, and is used for the actual tax calculation and reporting. + The sales-tax item used to calculate the actual tax amount for this sales-tax + code's transactions by applying a specific tax rate collected for a single tax + agency. Unlike `salesTaxCode`, which only indicates general taxability, this + field drives the actual tax calculation and reporting. """ diff --git a/src/conductor/types/qbd/sales_tax_item_create_params.py b/src/conductor/types/qbd/sales_tax_item_create_params.py new file mode 100644 index 00000000..13a375ac --- /dev/null +++ b/src/conductor/types/qbd/sales_tax_item_create_params.py @@ -0,0 +1,86 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["SalesTaxItemCreateParams", "Barcode"] + + +class SalesTaxItemCreateParams(TypedDict, total=False): + name: Required[str] + """ + The case-insensitive unique name of this sales-tax item, unique across all + sales-tax items. + """ + + conductor_end_user_id: Required[Annotated[str, PropertyInfo(alias="Conductor-End-User-Id")]] + """ + The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + """ + + barcode: Barcode + """The sales-tax item's barcode.""" + + class_id: Annotated[str, PropertyInfo(alias="classId")] + """The sales-tax item's class. + + Classes can be used to categorize objects into meaningful segments, such as + department, location, or type of work. In QuickBooks, class tracking is off by + default. + """ + + description: str + """ + The sales-tax item's description that will appear on sales forms that include + this item. + """ + + external_id: Annotated[str, PropertyInfo(alias="externalId")] + """ + A developer-assigned globally unique identifier (GUID) for tracking this object + in external systems. Must be formatted as a valid GUID; otherwise, QuickBooks + will return an error. + """ + + is_active: Annotated[bool, PropertyInfo(alias="isActive")] + """Indicates whether this sales-tax item is active. + + Inactive objects are typically hidden from views and reports in QuickBooks. + """ + + sales_tax_return_line_id: Annotated[str, PropertyInfo(alias="salesTaxReturnLineId")] + """ + The specific line on the sales tax return form where the tax collected using + this sales-tax item should be reported. + """ + + tax_rate: Annotated[str, PropertyInfo(alias="taxRate")] + """The tax rate defined by this sales-tax item, represented as a decimal string. + + For example, "7.5" represents a 7.5% tax rate. This rate determines the amount + of sales tax applied when this item is used in transactions. If a non-zero + `taxRate` is specified, then the `taxVendor` field is required. + """ + + tax_vendor_id: Annotated[str, PropertyInfo(alias="taxVendorId")] + """ + The tax agency (vendor) to whom collected sales taxes are owed for this + sales-tax item. This field refers to a vendor in QuickBooks that represents the + tax authority. If a non-zero `taxRate` is specified, then `taxVendor` is + required. + """ + + +class Barcode(TypedDict, total=False): + allow_override: Annotated[bool, PropertyInfo(alias="allowOverride")] + """Whether to allow the barcode to be overridden.""" + + assign_even_if_used: Annotated[bool, PropertyInfo(alias="assignEvenIfUsed")] + """Whether to assign the barcode even if it is already used.""" + + bar_code_value: Annotated[str, PropertyInfo(alias="barCodeValue")] + """The item's barcode value.""" diff --git a/tests/api_resources/qbd/test_sales_tax_items.py b/tests/api_resources/qbd/test_sales_tax_items.py index 20d02ca6..c75bbae1 100644 --- a/tests/api_resources/qbd/test_sales_tax_items.py +++ b/tests/api_resources/qbd/test_sales_tax_items.py @@ -18,6 +18,60 @@ class TestSalesTaxItems: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + def test_method_create(self, client: Conductor) -> None: + sales_tax_item = client.qbd.sales_tax_items.create( + name="Standard Tax", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(QbdSalesTaxItem, sales_tax_item, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Conductor) -> None: + sales_tax_item = client.qbd.sales_tax_items.create( + name="Standard Tax", + conductor_end_user_id="end_usr_1234567abcdefg", + barcode={ + "allow_override": False, + "assign_even_if_used": False, + "bar_code_value": "1234567890", + }, + class_id="80000001-1234567890", + description="Standard rate sales tax for California", + external_id="12345678-abcd-1234-abcd-1234567890ab", + is_active=True, + sales_tax_return_line_id="80000021-1234567890", + tax_rate="7.5", + tax_vendor_id="80000020-1234567890", + ) + assert_matches_type(QbdSalesTaxItem, sales_tax_item, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Conductor) -> None: + response = client.qbd.sales_tax_items.with_raw_response.create( + name="Standard Tax", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + sales_tax_item = response.parse() + assert_matches_type(QbdSalesTaxItem, sales_tax_item, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Conductor) -> None: + with client.qbd.sales_tax_items.with_streaming_response.create( + name="Standard Tax", + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + sales_tax_item = response.parse() + assert_matches_type(QbdSalesTaxItem, sales_tax_item, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_retrieve(self, client: Conductor) -> None: sales_tax_item = client.qbd.sales_tax_items.retrieve( @@ -115,6 +169,60 @@ def test_streaming_response_list(self, client: Conductor) -> None: class TestAsyncSalesTaxItems: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + async def test_method_create(self, async_client: AsyncConductor) -> None: + sales_tax_item = await async_client.qbd.sales_tax_items.create( + name="Standard Tax", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(QbdSalesTaxItem, sales_tax_item, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncConductor) -> None: + sales_tax_item = await async_client.qbd.sales_tax_items.create( + name="Standard Tax", + conductor_end_user_id="end_usr_1234567abcdefg", + barcode={ + "allow_override": False, + "assign_even_if_used": False, + "bar_code_value": "1234567890", + }, + class_id="80000001-1234567890", + description="Standard rate sales tax for California", + external_id="12345678-abcd-1234-abcd-1234567890ab", + is_active=True, + sales_tax_return_line_id="80000021-1234567890", + tax_rate="7.5", + tax_vendor_id="80000020-1234567890", + ) + assert_matches_type(QbdSalesTaxItem, sales_tax_item, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncConductor) -> None: + response = await async_client.qbd.sales_tax_items.with_raw_response.create( + name="Standard Tax", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + sales_tax_item = await response.parse() + assert_matches_type(QbdSalesTaxItem, sales_tax_item, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncConductor) -> None: + async with async_client.qbd.sales_tax_items.with_streaming_response.create( + name="Standard Tax", + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + sales_tax_item = await response.parse() + assert_matches_type(QbdSalesTaxItem, sales_tax_item, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize async def test_method_retrieve(self, async_client: AsyncConductor) -> None: sales_tax_item = await async_client.qbd.sales_tax_items.retrieve(