diff --git a/.stats.yml b/.stats.yml index 08047ac..2a5356f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 72 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/conductor%2Fconductor-9640e89170c0ab0978aad84e29edcd3777691b90d341a0fa4ca5306377f84ad9.yml +configured_endpoints: 74 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/conductor%2Fconductor-689fadcdcb4854bad8d5572eb83302824ddb759e13a3ca9a3f573810dee160a9.yml diff --git a/api.md b/api.md index 936d3e4..1cca6b1 100644 --- a/api.md +++ b/api.md @@ -284,5 +284,7 @@ from conductor.types.qbd import QbdCheck Methods: +- client.qbd.checks.create(\*\*params) -> QbdCheck - client.qbd.checks.retrieve(id) -> QbdCheck +- client.qbd.checks.update(id, \*\*params) -> QbdCheck - client.qbd.checks.list(\*\*params) -> SyncCursorPage[QbdCheck] diff --git a/src/conductor/resources/qbd/checks.py b/src/conductor/resources/qbd/checks.py index 383046c..fc73cf6 100644 --- a/src/conductor/resources/qbd/checks.py +++ b/src/conductor/resources/qbd/checks.py @@ -2,13 +2,16 @@ from __future__ import annotations -from typing import List, Union +from typing import List, Union, Iterable from datetime import date 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 ( @@ -17,7 +20,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...types.qbd import check_list_params +from ...types.qbd import check_list_params, check_create_params, check_update_params from ...pagination import SyncCursorPage, AsyncCursorPage from ..._base_client import AsyncPaginator, make_request_options from ...types.qbd.qbd_check import QbdCheck @@ -45,6 +48,128 @@ def with_streaming_response(self) -> ChecksResourceWithStreamingResponse: """ return ChecksResourceWithStreamingResponse(self) + def create( + self, + *, + account_id: str, + transaction_date: Union[str, date], + conductor_end_user_id: str, + address: check_create_params.Address | NotGiven = NOT_GIVEN, + apply_checks_to_transactions: Iterable[check_create_params.ApplyChecksToTransaction] | NotGiven = NOT_GIVEN, + exchange_rate: float | NotGiven = NOT_GIVEN, + expense_lines: Iterable[check_create_params.ExpenseLine] | NotGiven = NOT_GIVEN, + external_id: str | NotGiven = NOT_GIVEN, + is_queued_for_print: bool | NotGiven = NOT_GIVEN, + item_group_lines: Iterable[check_create_params.ItemGroupLine] | NotGiven = NOT_GIVEN, + item_lines: Iterable[check_create_params.ItemLine] | NotGiven = NOT_GIVEN, + memo: str | NotGiven = NOT_GIVEN, + payee_id: str | NotGiven = NOT_GIVEN, + ref_number: str | NotGiven = NOT_GIVEN, + sales_tax_code_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, + ) -> QbdCheck: + """ + Creates a check. + + Args: + account_id: The account from which the funds are being drawn for this check; e.g., Checking + or Savings. This check decreases the balance of this account. + + transaction_date: The date written on this check, in ISO 8601 format (YYYY-MM-DD). + + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + address: The address that will print on the check. + + apply_checks_to_transactions: Transactions to be paid by this check. This will create a link between this + check and the specified transactions. + + NOTE: By default, QuickBooks will not return any information about the linked + transactions in this endpoint's response even when this request is successful. + To see the transactions linked via this field, refetch the check and check the + `linkedTransactions` response field. If fetching a list of checks, you must also + specify the parameter `includeLinkedTransactions` to see the + `linkedTransactions` response field. + + exchange_rate: The market exchange rate between this check's currency and the home currency in + QuickBooks at the time of this transaction. Represented as a decimal value + (e.g., 1.2345 for 1 EUR = 1.2345 USD if USD is the home currency). + + expense_lines: The check's expense lines, each representing one line in this expense. + + external_id: A globally unique identifier (GUID) you can provide for tracking this object in + your external system. Must be formatted as a valid GUID; otherwise, QuickBooks + will return an error. This field is immutable and can only be set during object + creation. + + is_queued_for_print: Indicates whether this check is queued for printing. If set to `true`, the check + will appear in the list of documents to be printed in QuickBooks. + + item_group_lines: The check's item group lines, each representing a predefined set of items + bundled together because they are commonly purchased together or grouped for + faster entry. + + item_lines: The check's item lines, each representing the purchase of a specific item or + service. + + memo: A memo or note for this check, as entered by the user. + + payee_id: The person or company to whom the check is written. + + ref_number: The case-sensitive user-defined reference number for this check, which can be + used to identify the transaction in QuickBooks. This value is not required to be + unique and can be arbitrarily changed by the QuickBooks user. + + sales_tax_code_id: The sales-tax code associated with this check, determining whether transactions + in this account are taxable or non-taxable. It's used to assign a default tax + status to all transactions for this check. Default codes include "Non" + (non-taxable) and "Tax" (taxable), but custom codes can also be created in + QuickBooks. If QuickBooks is not set up to charge sales tax (via the "Do You + Charge Sales Tax?" preference), it will assign the default non-taxable code to + all sales. + + 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/checks", + body=maybe_transform( + { + "account_id": account_id, + "transaction_date": transaction_date, + "address": address, + "apply_checks_to_transactions": apply_checks_to_transactions, + "exchange_rate": exchange_rate, + "expense_lines": expense_lines, + "external_id": external_id, + "is_queued_for_print": is_queued_for_print, + "item_group_lines": item_group_lines, + "item_lines": item_lines, + "memo": memo, + "payee_id": payee_id, + "ref_number": ref_number, + "sales_tax_code_id": sales_tax_code_id, + }, + check_create_params.CheckCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QbdCheck, + ) + def retrieve( self, id: str, @@ -85,6 +210,163 @@ def retrieve( cast_to=QbdCheck, ) + def update( + self, + id: str, + *, + revision_number: str, + conductor_end_user_id: str, + account_id: str | NotGiven = NOT_GIVEN, + address: check_update_params.Address | NotGiven = NOT_GIVEN, + apply_checks_to_transactions: Iterable[check_update_params.ApplyChecksToTransaction] | NotGiven = NOT_GIVEN, + clear_expense_lines: bool | NotGiven = NOT_GIVEN, + clear_item_lines: bool | NotGiven = NOT_GIVEN, + exchange_rate: float | NotGiven = NOT_GIVEN, + expense_lines: Iterable[check_update_params.ExpenseLine] | NotGiven = NOT_GIVEN, + is_queued_for_print: bool | NotGiven = NOT_GIVEN, + item_group_lines: Iterable[check_update_params.ItemGroupLine] | NotGiven = NOT_GIVEN, + item_lines: Iterable[check_update_params.ItemLine] | NotGiven = NOT_GIVEN, + memo: str | NotGiven = NOT_GIVEN, + payee_id: str | NotGiven = NOT_GIVEN, + ref_number: str | NotGiven = NOT_GIVEN, + sales_tax_code_id: str | NotGiven = NOT_GIVEN, + transaction_date: Union[str, date] | 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, + ) -> QbdCheck: + """ + Updates an existing check. + + Args: + id: The QuickBooks-assigned unique identifier of the check to update. + + revision_number: The current revision number of the check you are updating, which you can get by + fetching the object first. Provide the most recent `revisionNumber` to ensure + you're working with the latest data; otherwise, the update will return an error. + + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + account_id: The account from which the funds are being drawn for this check; e.g., Checking + or Savings. This check decreases the balance of this account. + + address: The address that will print on the check. + + apply_checks_to_transactions: Transactions to be paid by this check. This will create a link between this + check and the specified transactions. + + NOTE: By default, QuickBooks will not return any information about the linked + transactions in this endpoint's response even when this request is successful. + To see the transactions linked via this field, refetch the check and check the + `linkedTransactions` response field. If fetching a list of checks, you must also + specify the parameter `includeLinkedTransactions` to see the + `linkedTransactions` response field. + + clear_expense_lines: Indicates whether to clear all the expense lines of this check. To modify + individual lines, use the field `expenseLines`. + + clear_item_lines: Indicates whether to clear all the item lines of this check. To modify + individual lines, use the field `itemLines`. + + exchange_rate: The market exchange rate between this check's currency and the home currency in + QuickBooks at the time of this transaction. Represented as a decimal value + (e.g., 1.2345 for 1 EUR = 1.2345 USD if USD is the home currency). + + expense_lines: The check's expense lines, each representing one line in this expense. + + IMPORTANT: When updating a check's expense lines, this array completely REPLACES + all existing expense lines for that check. To retain any current expense lines, + include them in this array, even if they have not changed. Any expense lines not + included will be removed. To add a new expense line, include it with its `id` + set to `-1`. If you do not wish to modify the expense lines, you can omit this + field entirely to keep them unchanged. + + is_queued_for_print: Indicates whether this check is queued for printing. If set to `true`, the check + will appear in the list of documents to be printed in QuickBooks. + + item_group_lines: The check's item group lines, each representing a predefined set of items + bundled together because they are commonly purchased together or grouped for + faster entry. + + IMPORTANT: When updating a check's item group lines, this array completely + REPLACES all existing item group lines for that check. To retain any current + item group lines, include them in this array, even if they have not changed. Any + item group lines not included will be removed. To add a new item group line, + include it with its `id` set to `-1`. If you do not wish to modify the item + group lines, you can omit this field entirely to keep them unchanged. + + item_lines: The check's item lines, each representing the purchase of a specific item or + service. + + IMPORTANT: When updating a check's item lines, this array completely REPLACES + all existing item lines for that check. To retain any current item lines, + include them in this array, even if they have not changed. Any item lines not + included will be removed. To add a new item line, include it with its `id` set + to `-1`. If you do not wish to modify the item lines, you can omit this field + entirely to keep them unchanged. + + memo: A memo or note for this check, as entered by the user. + + payee_id: The person or company to whom the check is written. + + ref_number: The case-sensitive user-defined reference number for this check, which can be + used to identify the transaction in QuickBooks. This value is not required to be + unique and can be arbitrarily changed by the QuickBooks user. + + sales_tax_code_id: The sales-tax code associated with this check, determining whether transactions + in this account are taxable or non-taxable. It's used to assign a default tax + status to all transactions for this check. Default codes include "Non" + (non-taxable) and "Tax" (taxable), but custom codes can also be created in + QuickBooks. If QuickBooks is not set up to charge sales tax (via the "Do You + Charge Sales Tax?" preference), it will assign the default non-taxable code to + all sales. + + transaction_date: The date written on this check, in ISO 8601 format (YYYY-MM-DD). + + 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 + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + extra_headers = {"Conductor-End-User-Id": conductor_end_user_id, **(extra_headers or {})} + return self._post( + f"/quickbooks-desktop/checks/{id}", + body=maybe_transform( + { + "revision_number": revision_number, + "account_id": account_id, + "address": address, + "apply_checks_to_transactions": apply_checks_to_transactions, + "clear_expense_lines": clear_expense_lines, + "clear_item_lines": clear_item_lines, + "exchange_rate": exchange_rate, + "expense_lines": expense_lines, + "is_queued_for_print": is_queued_for_print, + "item_group_lines": item_group_lines, + "item_lines": item_lines, + "memo": memo, + "payee_id": payee_id, + "ref_number": ref_number, + "sales_tax_code_id": sales_tax_code_id, + "transaction_date": transaction_date, + }, + check_update_params.CheckUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QbdCheck, + ) + def list( self, *, @@ -258,6 +540,128 @@ def with_streaming_response(self) -> AsyncChecksResourceWithStreamingResponse: """ return AsyncChecksResourceWithStreamingResponse(self) + async def create( + self, + *, + account_id: str, + transaction_date: Union[str, date], + conductor_end_user_id: str, + address: check_create_params.Address | NotGiven = NOT_GIVEN, + apply_checks_to_transactions: Iterable[check_create_params.ApplyChecksToTransaction] | NotGiven = NOT_GIVEN, + exchange_rate: float | NotGiven = NOT_GIVEN, + expense_lines: Iterable[check_create_params.ExpenseLine] | NotGiven = NOT_GIVEN, + external_id: str | NotGiven = NOT_GIVEN, + is_queued_for_print: bool | NotGiven = NOT_GIVEN, + item_group_lines: Iterable[check_create_params.ItemGroupLine] | NotGiven = NOT_GIVEN, + item_lines: Iterable[check_create_params.ItemLine] | NotGiven = NOT_GIVEN, + memo: str | NotGiven = NOT_GIVEN, + payee_id: str | NotGiven = NOT_GIVEN, + ref_number: str | NotGiven = NOT_GIVEN, + sales_tax_code_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, + ) -> QbdCheck: + """ + Creates a check. + + Args: + account_id: The account from which the funds are being drawn for this check; e.g., Checking + or Savings. This check decreases the balance of this account. + + transaction_date: The date written on this check, in ISO 8601 format (YYYY-MM-DD). + + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + address: The address that will print on the check. + + apply_checks_to_transactions: Transactions to be paid by this check. This will create a link between this + check and the specified transactions. + + NOTE: By default, QuickBooks will not return any information about the linked + transactions in this endpoint's response even when this request is successful. + To see the transactions linked via this field, refetch the check and check the + `linkedTransactions` response field. If fetching a list of checks, you must also + specify the parameter `includeLinkedTransactions` to see the + `linkedTransactions` response field. + + exchange_rate: The market exchange rate between this check's currency and the home currency in + QuickBooks at the time of this transaction. Represented as a decimal value + (e.g., 1.2345 for 1 EUR = 1.2345 USD if USD is the home currency). + + expense_lines: The check's expense lines, each representing one line in this expense. + + external_id: A globally unique identifier (GUID) you can provide for tracking this object in + your external system. Must be formatted as a valid GUID; otherwise, QuickBooks + will return an error. This field is immutable and can only be set during object + creation. + + is_queued_for_print: Indicates whether this check is queued for printing. If set to `true`, the check + will appear in the list of documents to be printed in QuickBooks. + + item_group_lines: The check's item group lines, each representing a predefined set of items + bundled together because they are commonly purchased together or grouped for + faster entry. + + item_lines: The check's item lines, each representing the purchase of a specific item or + service. + + memo: A memo or note for this check, as entered by the user. + + payee_id: The person or company to whom the check is written. + + ref_number: The case-sensitive user-defined reference number for this check, which can be + used to identify the transaction in QuickBooks. This value is not required to be + unique and can be arbitrarily changed by the QuickBooks user. + + sales_tax_code_id: The sales-tax code associated with this check, determining whether transactions + in this account are taxable or non-taxable. It's used to assign a default tax + status to all transactions for this check. Default codes include "Non" + (non-taxable) and "Tax" (taxable), but custom codes can also be created in + QuickBooks. If QuickBooks is not set up to charge sales tax (via the "Do You + Charge Sales Tax?" preference), it will assign the default non-taxable code to + all sales. + + 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/checks", + body=await async_maybe_transform( + { + "account_id": account_id, + "transaction_date": transaction_date, + "address": address, + "apply_checks_to_transactions": apply_checks_to_transactions, + "exchange_rate": exchange_rate, + "expense_lines": expense_lines, + "external_id": external_id, + "is_queued_for_print": is_queued_for_print, + "item_group_lines": item_group_lines, + "item_lines": item_lines, + "memo": memo, + "payee_id": payee_id, + "ref_number": ref_number, + "sales_tax_code_id": sales_tax_code_id, + }, + check_create_params.CheckCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QbdCheck, + ) + async def retrieve( self, id: str, @@ -298,6 +702,163 @@ async def retrieve( cast_to=QbdCheck, ) + async def update( + self, + id: str, + *, + revision_number: str, + conductor_end_user_id: str, + account_id: str | NotGiven = NOT_GIVEN, + address: check_update_params.Address | NotGiven = NOT_GIVEN, + apply_checks_to_transactions: Iterable[check_update_params.ApplyChecksToTransaction] | NotGiven = NOT_GIVEN, + clear_expense_lines: bool | NotGiven = NOT_GIVEN, + clear_item_lines: bool | NotGiven = NOT_GIVEN, + exchange_rate: float | NotGiven = NOT_GIVEN, + expense_lines: Iterable[check_update_params.ExpenseLine] | NotGiven = NOT_GIVEN, + is_queued_for_print: bool | NotGiven = NOT_GIVEN, + item_group_lines: Iterable[check_update_params.ItemGroupLine] | NotGiven = NOT_GIVEN, + item_lines: Iterable[check_update_params.ItemLine] | NotGiven = NOT_GIVEN, + memo: str | NotGiven = NOT_GIVEN, + payee_id: str | NotGiven = NOT_GIVEN, + ref_number: str | NotGiven = NOT_GIVEN, + sales_tax_code_id: str | NotGiven = NOT_GIVEN, + transaction_date: Union[str, date] | 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, + ) -> QbdCheck: + """ + Updates an existing check. + + Args: + id: The QuickBooks-assigned unique identifier of the check to update. + + revision_number: The current revision number of the check you are updating, which you can get by + fetching the object first. Provide the most recent `revisionNumber` to ensure + you're working with the latest data; otherwise, the update will return an error. + + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + account_id: The account from which the funds are being drawn for this check; e.g., Checking + or Savings. This check decreases the balance of this account. + + address: The address that will print on the check. + + apply_checks_to_transactions: Transactions to be paid by this check. This will create a link between this + check and the specified transactions. + + NOTE: By default, QuickBooks will not return any information about the linked + transactions in this endpoint's response even when this request is successful. + To see the transactions linked via this field, refetch the check and check the + `linkedTransactions` response field. If fetching a list of checks, you must also + specify the parameter `includeLinkedTransactions` to see the + `linkedTransactions` response field. + + clear_expense_lines: Indicates whether to clear all the expense lines of this check. To modify + individual lines, use the field `expenseLines`. + + clear_item_lines: Indicates whether to clear all the item lines of this check. To modify + individual lines, use the field `itemLines`. + + exchange_rate: The market exchange rate between this check's currency and the home currency in + QuickBooks at the time of this transaction. Represented as a decimal value + (e.g., 1.2345 for 1 EUR = 1.2345 USD if USD is the home currency). + + expense_lines: The check's expense lines, each representing one line in this expense. + + IMPORTANT: When updating a check's expense lines, this array completely REPLACES + all existing expense lines for that check. To retain any current expense lines, + include them in this array, even if they have not changed. Any expense lines not + included will be removed. To add a new expense line, include it with its `id` + set to `-1`. If you do not wish to modify the expense lines, you can omit this + field entirely to keep them unchanged. + + is_queued_for_print: Indicates whether this check is queued for printing. If set to `true`, the check + will appear in the list of documents to be printed in QuickBooks. + + item_group_lines: The check's item group lines, each representing a predefined set of items + bundled together because they are commonly purchased together or grouped for + faster entry. + + IMPORTANT: When updating a check's item group lines, this array completely + REPLACES all existing item group lines for that check. To retain any current + item group lines, include them in this array, even if they have not changed. Any + item group lines not included will be removed. To add a new item group line, + include it with its `id` set to `-1`. If you do not wish to modify the item + group lines, you can omit this field entirely to keep them unchanged. + + item_lines: The check's item lines, each representing the purchase of a specific item or + service. + + IMPORTANT: When updating a check's item lines, this array completely REPLACES + all existing item lines for that check. To retain any current item lines, + include them in this array, even if they have not changed. Any item lines not + included will be removed. To add a new item line, include it with its `id` set + to `-1`. If you do not wish to modify the item lines, you can omit this field + entirely to keep them unchanged. + + memo: A memo or note for this check, as entered by the user. + + payee_id: The person or company to whom the check is written. + + ref_number: The case-sensitive user-defined reference number for this check, which can be + used to identify the transaction in QuickBooks. This value is not required to be + unique and can be arbitrarily changed by the QuickBooks user. + + sales_tax_code_id: The sales-tax code associated with this check, determining whether transactions + in this account are taxable or non-taxable. It's used to assign a default tax + status to all transactions for this check. Default codes include "Non" + (non-taxable) and "Tax" (taxable), but custom codes can also be created in + QuickBooks. If QuickBooks is not set up to charge sales tax (via the "Do You + Charge Sales Tax?" preference), it will assign the default non-taxable code to + all sales. + + transaction_date: The date written on this check, in ISO 8601 format (YYYY-MM-DD). + + 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 + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + extra_headers = {"Conductor-End-User-Id": conductor_end_user_id, **(extra_headers or {})} + return await self._post( + f"/quickbooks-desktop/checks/{id}", + body=await async_maybe_transform( + { + "revision_number": revision_number, + "account_id": account_id, + "address": address, + "apply_checks_to_transactions": apply_checks_to_transactions, + "clear_expense_lines": clear_expense_lines, + "clear_item_lines": clear_item_lines, + "exchange_rate": exchange_rate, + "expense_lines": expense_lines, + "is_queued_for_print": is_queued_for_print, + "item_group_lines": item_group_lines, + "item_lines": item_lines, + "memo": memo, + "payee_id": payee_id, + "ref_number": ref_number, + "sales_tax_code_id": sales_tax_code_id, + "transaction_date": transaction_date, + }, + check_update_params.CheckUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QbdCheck, + ) + def list( self, *, @@ -455,9 +1016,15 @@ class ChecksResourceWithRawResponse: def __init__(self, checks: ChecksResource) -> None: self._checks = checks + self.create = to_raw_response_wrapper( + checks.create, + ) self.retrieve = to_raw_response_wrapper( checks.retrieve, ) + self.update = to_raw_response_wrapper( + checks.update, + ) self.list = to_raw_response_wrapper( checks.list, ) @@ -467,9 +1034,15 @@ class AsyncChecksResourceWithRawResponse: def __init__(self, checks: AsyncChecksResource) -> None: self._checks = checks + self.create = async_to_raw_response_wrapper( + checks.create, + ) self.retrieve = async_to_raw_response_wrapper( checks.retrieve, ) + self.update = async_to_raw_response_wrapper( + checks.update, + ) self.list = async_to_raw_response_wrapper( checks.list, ) @@ -479,9 +1052,15 @@ class ChecksResourceWithStreamingResponse: def __init__(self, checks: ChecksResource) -> None: self._checks = checks + self.create = to_streamed_response_wrapper( + checks.create, + ) self.retrieve = to_streamed_response_wrapper( checks.retrieve, ) + self.update = to_streamed_response_wrapper( + checks.update, + ) self.list = to_streamed_response_wrapper( checks.list, ) @@ -491,9 +1070,15 @@ class AsyncChecksResourceWithStreamingResponse: def __init__(self, checks: AsyncChecksResource) -> None: self._checks = checks + self.create = async_to_streamed_response_wrapper( + checks.create, + ) self.retrieve = async_to_streamed_response_wrapper( checks.retrieve, ) + self.update = async_to_streamed_response_wrapper( + checks.update, + ) self.list = async_to_streamed_response_wrapper( checks.list, ) diff --git a/src/conductor/types/qbd/__init__.py b/src/conductor/types/qbd/__init__.py index 10d809a..60137be 100644 --- a/src/conductor/types/qbd/__init__.py +++ b/src/conductor/types/qbd/__init__.py @@ -26,6 +26,8 @@ from .non_inventory_item import NonInventoryItem as NonInventoryItem from .vendor_list_params import VendorListParams as VendorListParams from .account_list_params import AccountListParams as AccountListParams +from .check_create_params import CheckCreateParams as CheckCreateParams +from .check_update_params import CheckUpdateParams as CheckUpdateParams from .class_create_params import ClassCreateParams as ClassCreateParams from .class_list_response import ClassListResponse as ClassListResponse from .class_update_params import ClassUpdateParams as ClassUpdateParams diff --git a/src/conductor/types/qbd/check_create_params.py b/src/conductor/types/qbd/check_create_params.py new file mode 100644 index 0000000..e524fab --- /dev/null +++ b/src/conductor/types/qbd/check_create_params.py @@ -0,0 +1,494 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from datetime import date +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = [ + "CheckCreateParams", + "Address", + "ApplyChecksToTransaction", + "ExpenseLine", + "ExpenseLineCustomField", + "ItemGroupLine", + "ItemGroupLineCustomField", + "ItemLine", + "ItemLineCustomField", + "ItemLineLinkToTransactionLine", +] + + +class CheckCreateParams(TypedDict, total=False): + account_id: Required[Annotated[str, PropertyInfo(alias="accountId")]] + """ + The account from which the funds are being drawn for this check; e.g., Checking + or Savings. This check decreases the balance of this account. + """ + + transaction_date: Required[Annotated[Union[str, date], PropertyInfo(alias="transactionDate", format="iso8601")]] + """The date written on this check, in ISO 8601 format (YYYY-MM-DD).""" + + 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}}"`). + """ + + address: Address + """The address that will print on the check.""" + + apply_checks_to_transactions: Annotated[ + Iterable[ApplyChecksToTransaction], PropertyInfo(alias="applyChecksToTransactions") + ] + """Transactions to be paid by this check. + + This will create a link between this check and the specified transactions. + + NOTE: By default, QuickBooks will not return any information about the linked + transactions in this endpoint's response even when this request is successful. + To see the transactions linked via this field, refetch the check and check the + `linkedTransactions` response field. If fetching a list of checks, you must also + specify the parameter `includeLinkedTransactions` to see the + `linkedTransactions` response field. + """ + + exchange_rate: Annotated[float, PropertyInfo(alias="exchangeRate")] + """ + The market exchange rate between this check's currency and the home currency in + QuickBooks at the time of this transaction. Represented as a decimal value + (e.g., 1.2345 for 1 EUR = 1.2345 USD if USD is the home currency). + """ + + expense_lines: Annotated[Iterable[ExpenseLine], PropertyInfo(alias="expenseLines")] + """The check's expense lines, each representing one line in this expense.""" + + external_id: Annotated[str, PropertyInfo(alias="externalId")] + """ + A globally unique identifier (GUID) you can provide for tracking this object in + your external system. Must be formatted as a valid GUID; otherwise, QuickBooks + will return an error. This field is immutable and can only be set during object + creation. + """ + + is_queued_for_print: Annotated[bool, PropertyInfo(alias="isQueuedForPrint")] + """Indicates whether this check is queued for printing. + + If set to `true`, the check will appear in the list of documents to be printed + in QuickBooks. + """ + + item_group_lines: Annotated[Iterable[ItemGroupLine], PropertyInfo(alias="itemGroupLines")] + """ + The check's item group lines, each representing a predefined set of items + bundled together because they are commonly purchased together or grouped for + faster entry. + """ + + item_lines: Annotated[Iterable[ItemLine], PropertyInfo(alias="itemLines")] + """ + The check's item lines, each representing the purchase of a specific item or + service. + """ + + memo: str + """A memo or note for this check, as entered by the user.""" + + payee_id: Annotated[str, PropertyInfo(alias="payeeId")] + """The person or company to whom the check is written.""" + + ref_number: Annotated[str, PropertyInfo(alias="refNumber")] + """ + The case-sensitive user-defined reference number for this check, which can be + used to identify the transaction in QuickBooks. This value is not required to be + unique and can be arbitrarily changed by the QuickBooks user. + """ + + sales_tax_code_id: Annotated[str, PropertyInfo(alias="salesTaxCodeId")] + """ + The sales-tax code associated with this check, determining whether transactions + in this account are taxable or non-taxable. It's used to assign a default tax + status to all transactions for this check. Default codes include "Non" + (non-taxable) and "Tax" (taxable), but custom codes can also be created in + QuickBooks. If QuickBooks is not set up to charge sales tax (via the "Do You + Charge Sales Tax?" preference), it will assign the default non-taxable code to + all sales. + """ + + +class Address(TypedDict, total=False): + city: str + """The city, district, suburb, town, or village name of the address.""" + + country: str + """The country name of the address.""" + + line1: str + """The first line of the address (e.g., street, PO Box, or company name).""" + + line2: str + """ + The second line of the address, if needed (e.g., apartment, suite, unit, or + building). + """ + + line3: str + """The third line of the address, if needed.""" + + line4: str + """The fourth line of the address, if needed.""" + + line5: str + """The fifth line of the address, if needed.""" + + note: str + """ + A note written at the bottom of the address in the form in which it appears, + such as the invoice form. + """ + + postal_code: Annotated[str, PropertyInfo(alias="postalCode")] + """The postal code or ZIP code of the address.""" + + state: str + """The state, county, province, or region name of the address.""" + + +class ApplyChecksToTransaction(TypedDict, total=False): + id: Required[str] + """The QuickBooks-assigned unique identifier of the check to update.""" + + amount: str + """The monetary amount of this check, represented as a decimal string.""" + + +class ExpenseLineCustomField(TypedDict, total=False): + name: Required[str] + """The name of the custom field, unique for the specified `ownerId`. + + For public custom fields, this name is visible as a label in the QuickBooks UI. + """ + + owner_id: Required[Annotated[str, PropertyInfo(alias="ownerId")]] + """ + The identifier of the owner of the custom field, which QuickBooks internally + calls a "data extension". For public custom fields visible in the UI, such as + those added by the QuickBooks user, this is always "0". For private custom + fields that are only visible to the application that created them, this is a + valid GUID identifying the owning application. Internally, Conductor always + fetches all public custom fields (those with an `ownerId` of "0") for all + objects. + """ + + value: Required[str] + """The value of the custom field. + + The maximum length depends on the field's data type. + """ + + +class ExpenseLine(TypedDict, total=False): + account_id: Annotated[str, PropertyInfo(alias="accountId")] + """The expense account being debited (increased). + + The corresponding account being credited is usually a liability account (e.g., + Accounts Payable) or an asset account (e.g., Cash), depending on the transaction + type. + """ + + amount: str + """The monetary amount of this expense line, represented as a decimal string.""" + + billing_status: Annotated[ + Literal["billable", "has_been_billed", "not_billable"], PropertyInfo(alias="billingStatus") + ] + """The billing status of this expense line.""" + + class_id: Annotated[str, PropertyInfo(alias="classId")] + """The expense line'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. If a class is specified for the entire parent transaction, it is + automatically applied to all expense lines unless overridden here, at the + transaction line level. + """ + + custom_fields: Annotated[Iterable[ExpenseLineCustomField], PropertyInfo(alias="customFields")] + """ + The custom fields for the expense line object, added as user-defined data + extensions, not included in the standard QuickBooks object. + """ + + memo: str + """A memo or note for this expense line, as entered by the user.""" + + payee_id: Annotated[str, PropertyInfo(alias="payeeId")] + """ + If `account` refers to an Accounts Payable (A/P) account, `payee` refers to the + expense's vendor (not the customer). If `account` refers to any other type of + account, `payee` refers to the expense's customer (not the vendor). + """ + + sales_representative_id: Annotated[str, PropertyInfo(alias="salesRepresentativeId")] + """The expense line's sales representative. + + Sales representatives can be employees, vendors, or other names in QuickBooks. + """ + + sales_tax_code_id: Annotated[str, PropertyInfo(alias="salesTaxCodeId")] + """ + The sales-tax code associated with this expense line, determining whether it is + taxable or non-taxable. It's used to assign a default tax status to all + transactions for this expense line. Default codes include "Non" (non-taxable) + and "Tax" (taxable), but custom codes can also be created in QuickBooks. If + QuickBooks is not set up to charge sales tax (via the "Do You Charge Sales Tax?" + preference), it will assign the default non-taxable code to all sales. + """ + + +class ItemGroupLineCustomField(TypedDict, total=False): + name: Required[str] + """The name of the custom field, unique for the specified `ownerId`. + + For public custom fields, this name is visible as a label in the QuickBooks UI. + """ + + owner_id: Required[Annotated[str, PropertyInfo(alias="ownerId")]] + """ + The identifier of the owner of the custom field, which QuickBooks internally + calls a "data extension". For public custom fields visible in the UI, such as + those added by the QuickBooks user, this is always "0". For private custom + fields that are only visible to the application that created them, this is a + valid GUID identifying the owning application. Internally, Conductor always + fetches all public custom fields (those with an `ownerId` of "0") for all + objects. + """ + + value: Required[str] + """The value of the custom field. + + The maximum length depends on the field's data type. + """ + + +class ItemGroupLine(TypedDict, total=False): + item_group_id: Required[Annotated[str, PropertyInfo(alias="itemGroupId")]] + """ + The item group line's item group, representing a predefined set of items bundled + because they are commonly purchased together or grouped for faster entry. + """ + + custom_fields: Annotated[Iterable[ItemGroupLineCustomField], PropertyInfo(alias="customFields")] + """ + The custom fields for the item group line object, added as user-defined data + extensions, not included in the standard QuickBooks object. + """ + + inventory_site_id: Annotated[str, PropertyInfo(alias="inventorySiteId")] + """ + The site location where inventory for the item group associated with this item + group line is stored. + """ + + inventory_site_location_id: Annotated[str, PropertyInfo(alias="inventorySiteLocationId")] + """ + The specific location (e.g., bin or shelf) within the inventory site where the + item group associated with this item group line is stored. + """ + + quantity: float + """The quantity of the item group associated with this item group line.""" + + unit_of_measure: Annotated[str, PropertyInfo(alias="unitOfMeasure")] + """The unit-of-measure used for the `quantity` in this item group line. + + Must be a valid unit within the item's available units of measure. + """ + + +class ItemLineCustomField(TypedDict, total=False): + name: Required[str] + """The name of the custom field, unique for the specified `ownerId`. + + For public custom fields, this name is visible as a label in the QuickBooks UI. + """ + + owner_id: Required[Annotated[str, PropertyInfo(alias="ownerId")]] + """ + The identifier of the owner of the custom field, which QuickBooks internally + calls a "data extension". For public custom fields visible in the UI, such as + those added by the QuickBooks user, this is always "0". For private custom + fields that are only visible to the application that created them, this is a + valid GUID identifying the owning application. Internally, Conductor always + fetches all public custom fields (those with an `ownerId` of "0") for all + objects. + """ + + value: Required[str] + """The value of the custom field. + + The maximum length depends on the field's data type. + """ + + +class ItemLineLinkToTransactionLine(TypedDict, total=False): + transaction_id: Required[Annotated[str, PropertyInfo(alias="transactionId")]] + """The unique identifier of the transaction to link to.""" + + transaction_line_id: Required[Annotated[str, PropertyInfo(alias="transactionLineId")]] + """The unique identifier of the transaction line to link to.""" + + +class ItemLine(TypedDict, total=False): + amount: str + """The monetary amount of this item line, represented as a decimal string. + + If both `quantity` and `cost` are specified but not `amount`, QuickBooks will + use them to calculate `amount`. If `amount`, `cost`, and `quantity` are all + unspecified, then QuickBooks will calculate `amount` based on a `quantity` of + `1` and the suggested `cost`. + """ + + billing_status: Annotated[ + Literal["billable", "has_been_billed", "not_billable"], PropertyInfo(alias="billingStatus") + ] + """The billing status of this item line.""" + + class_id: Annotated[str, PropertyInfo(alias="classId")] + """The item line'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. If a class is specified for the entire parent transaction, it is + automatically applied to all item lines unless overridden here, at the + transaction line level. + """ + + cost: str + """The cost of this item line, represented as a decimal string. + + If both `quantity` and `amount` are specified but not `cost`, QuickBooks will + use them to calculate `cost`. + """ + + customer_id: Annotated[str, PropertyInfo(alias="customerId")] + """The customer or customer-job associated with this item line.""" + + custom_fields: Annotated[Iterable[ItemLineCustomField], PropertyInfo(alias="customFields")] + """ + The custom fields for the item line object, added as user-defined data + extensions, not included in the standard QuickBooks object. + """ + + description: str + """A description of this item line.""" + + expiration_date: Annotated[Union[str, date], PropertyInfo(alias="expirationDate", format="iso8601")] + """ + The expiration date for the serial number or lot number of the item associated + with this item line, in ISO 8601 format (YYYY-MM-DD). This is particularly + relevant for perishable or time-sensitive inventory items. Note that this field + is only supported on QuickBooks Desktop 2023 or later. + """ + + inventory_site_id: Annotated[str, PropertyInfo(alias="inventorySiteId")] + """ + The site location where inventory for the item associated with this item line is + stored. + """ + + inventory_site_location_id: Annotated[str, PropertyInfo(alias="inventorySiteLocationId")] + """ + The specific location (e.g., bin or shelf) within the inventory site where the + item associated with this item line is stored. + """ + + item_id: Annotated[str, PropertyInfo(alias="itemId")] + """The item associated with this item line. + + This can refer to any good or service that the business buys or sells, including + item types such as a service item, inventory item, or special calculation item + like a discount item or sales-tax item. + """ + + link_to_transaction_line: Annotated[ItemLineLinkToTransactionLine, PropertyInfo(alias="linkToTransactionLine")] + """An existing transaction line that you wish to link to this item line. + + Note that this only links to a single transaction line item, not an entire + transaction. If you want to link an entire transaction and bring in all its + lines, instead use the field `linkToTransactionIds` on the parent transaction, + if available. If the parent transaction is a bill or an item receipt, you can + only link to purchase orders; QuickBooks does not support linking these + transactions to other transaction types. + + Transaction lines can only be linked when creating this item line and cannot be + unlinked later. + + If you use `linkToTransactionLine` on this item line, you cannot use the field + `item` on this line (QuickBooks will return an error) because this field brings + in all of the item information you need. You can, however, specify whatever + `quantity` or `rate` that you want, or any other transaction line element other + than `item`. + + If the parent transaction supports the `linkToTransactionIds` field, you can use + both `linkToTransactionLine` (on this item line) and `linkToTransactionIds` (on + its parent transaction) in the same request as long as they do NOT link to the + same transaction (otherwise, QuickBooks will return an error). QuickBooks will + also return an error if you attempt to link a transaction that is empty or + already closed. + + NOTE: By default, QuickBooks will not return any information about the linked + transaction line in this endpoint's response even when this request is + successful. To see the transaction line linked via this field, refetch the + parent transaction and check the `linkedTransactions` response field. If + fetching a list of transactions, you must also specify the parameter + `includeLinkedTransactions` to see the `linkedTransactions` response field. + """ + + lot_number: Annotated[str, PropertyInfo(alias="lotNumber")] + """The lot number of the item associated with this item line. + + Used for tracking groups of inventory items that are purchased or manufactured + together. + """ + + override_item_account_id: Annotated[str, PropertyInfo(alias="overrideItemAccountId")] + """ + The account to use for this item line, overriding the default account associated + with the item. + """ + + quantity: float + """The quantity of the item associated with this item line.""" + + sales_representative_id: Annotated[str, PropertyInfo(alias="salesRepresentativeId")] + """The item line's sales representative. + + Sales representatives can be employees, vendors, or other names in QuickBooks. + """ + + sales_tax_code_id: Annotated[str, PropertyInfo(alias="salesTaxCodeId")] + """ + The sales-tax code associated with this item line, determining whether it is + taxable or non-taxable. It's used to assign a default tax status to all + transactions for this item line. Default codes include "Non" (non-taxable) and + "Tax" (taxable), but custom codes can also be created in QuickBooks. If + QuickBooks is not set up to charge sales tax (via the "Do You Charge Sales Tax?" + preference), it will assign the default non-taxable code to all sales. + """ + + serial_number: Annotated[str, PropertyInfo(alias="serialNumber")] + """The serial number of the item associated with this item line. + + This is used for tracking individual units of serialized inventory items. + """ + + unit_of_measure: Annotated[str, PropertyInfo(alias="unitOfMeasure")] + """The unit-of-measure used for the `quantity` in this item line. + + Must be a valid unit within the item's available units of measure. + """ diff --git a/src/conductor/types/qbd/check_update_params.py b/src/conductor/types/qbd/check_update_params.py new file mode 100644 index 0000000..f868b30 --- /dev/null +++ b/src/conductor/types/qbd/check_update_params.py @@ -0,0 +1,560 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from datetime import date +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = [ + "CheckUpdateParams", + "Address", + "ApplyChecksToTransaction", + "ExpenseLine", + "ItemGroupLine", + "ItemGroupLineItemLine", + "ItemLine", +] + + +class CheckUpdateParams(TypedDict, total=False): + revision_number: Required[Annotated[str, PropertyInfo(alias="revisionNumber")]] + """ + The current revision number of the check you are updating, which you can get by + fetching the object first. Provide the most recent `revisionNumber` to ensure + you're working with the latest data; otherwise, the update will return an error. + """ + + 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}}"`). + """ + + account_id: Annotated[str, PropertyInfo(alias="accountId")] + """ + The account from which the funds are being drawn for this check; e.g., Checking + or Savings. This check decreases the balance of this account. + """ + + address: Address + """The address that will print on the check.""" + + apply_checks_to_transactions: Annotated[ + Iterable[ApplyChecksToTransaction], PropertyInfo(alias="applyChecksToTransactions") + ] + """Transactions to be paid by this check. + + This will create a link between this check and the specified transactions. + + NOTE: By default, QuickBooks will not return any information about the linked + transactions in this endpoint's response even when this request is successful. + To see the transactions linked via this field, refetch the check and check the + `linkedTransactions` response field. If fetching a list of checks, you must also + specify the parameter `includeLinkedTransactions` to see the + `linkedTransactions` response field. + """ + + clear_expense_lines: Annotated[bool, PropertyInfo(alias="clearExpenseLines")] + """Indicates whether to clear all the expense lines of this check. + + To modify individual lines, use the field `expenseLines`. + """ + + clear_item_lines: Annotated[bool, PropertyInfo(alias="clearItemLines")] + """Indicates whether to clear all the item lines of this check. + + To modify individual lines, use the field `itemLines`. + """ + + exchange_rate: Annotated[float, PropertyInfo(alias="exchangeRate")] + """ + The market exchange rate between this check's currency and the home currency in + QuickBooks at the time of this transaction. Represented as a decimal value + (e.g., 1.2345 for 1 EUR = 1.2345 USD if USD is the home currency). + """ + + expense_lines: Annotated[Iterable[ExpenseLine], PropertyInfo(alias="expenseLines")] + """The check's expense lines, each representing one line in this expense. + + IMPORTANT: When updating a check's expense lines, this array completely REPLACES + all existing expense lines for that check. To retain any current expense lines, + include them in this array, even if they have not changed. Any expense lines not + included will be removed. To add a new expense line, include it with its `id` + set to `-1`. If you do not wish to modify the expense lines, you can omit this + field entirely to keep them unchanged. + """ + + is_queued_for_print: Annotated[bool, PropertyInfo(alias="isQueuedForPrint")] + """Indicates whether this check is queued for printing. + + If set to `true`, the check will appear in the list of documents to be printed + in QuickBooks. + """ + + item_group_lines: Annotated[Iterable[ItemGroupLine], PropertyInfo(alias="itemGroupLines")] + """ + The check's item group lines, each representing a predefined set of items + bundled together because they are commonly purchased together or grouped for + faster entry. + + IMPORTANT: When updating a check's item group lines, this array completely + REPLACES all existing item group lines for that check. To retain any current + item group lines, include them in this array, even if they have not changed. Any + item group lines not included will be removed. To add a new item group line, + include it with its `id` set to `-1`. If you do not wish to modify the item + group lines, you can omit this field entirely to keep them unchanged. + """ + + item_lines: Annotated[Iterable[ItemLine], PropertyInfo(alias="itemLines")] + """ + The check's item lines, each representing the purchase of a specific item or + service. + + IMPORTANT: When updating a check's item lines, this array completely REPLACES + all existing item lines for that check. To retain any current item lines, + include them in this array, even if they have not changed. Any item lines not + included will be removed. To add a new item line, include it with its `id` set + to `-1`. If you do not wish to modify the item lines, you can omit this field + entirely to keep them unchanged. + """ + + memo: str + """A memo or note for this check, as entered by the user.""" + + payee_id: Annotated[str, PropertyInfo(alias="payeeId")] + """The person or company to whom the check is written.""" + + ref_number: Annotated[str, PropertyInfo(alias="refNumber")] + """ + The case-sensitive user-defined reference number for this check, which can be + used to identify the transaction in QuickBooks. This value is not required to be + unique and can be arbitrarily changed by the QuickBooks user. + """ + + sales_tax_code_id: Annotated[str, PropertyInfo(alias="salesTaxCodeId")] + """ + The sales-tax code associated with this check, determining whether transactions + in this account are taxable or non-taxable. It's used to assign a default tax + status to all transactions for this check. Default codes include "Non" + (non-taxable) and "Tax" (taxable), but custom codes can also be created in + QuickBooks. If QuickBooks is not set up to charge sales tax (via the "Do You + Charge Sales Tax?" preference), it will assign the default non-taxable code to + all sales. + """ + + transaction_date: Annotated[Union[str, date], PropertyInfo(alias="transactionDate", format="iso8601")] + """The date written on this check, in ISO 8601 format (YYYY-MM-DD).""" + + +class Address(TypedDict, total=False): + city: str + """The city, district, suburb, town, or village name of the address.""" + + country: str + """The country name of the address.""" + + line1: str + """The first line of the address (e.g., street, PO Box, or company name).""" + + line2: str + """ + The second line of the address, if needed (e.g., apartment, suite, unit, or + building). + """ + + line3: str + """The third line of the address, if needed.""" + + line4: str + """The fourth line of the address, if needed.""" + + line5: str + """The fifth line of the address, if needed.""" + + note: str + """ + A note written at the bottom of the address in the form in which it appears, + such as the invoice form. + """ + + postal_code: Annotated[str, PropertyInfo(alias="postalCode")] + """The postal code or ZIP code of the address.""" + + state: str + """The state, county, province, or region name of the address.""" + + +class ApplyChecksToTransaction(TypedDict, total=False): + id: Required[str] + """The QuickBooks-assigned unique identifier of the check to update.""" + + amount: str + """The monetary amount of this check, represented as a decimal string.""" + + +class ExpenseLine(TypedDict, total=False): + id: Required[str] + """ + The QuickBooks-assigned unique identifier of an existing expense line you wish + to retain or update. Set this field to `-1` for new expense lines you wish to + add. + """ + + account_id: Annotated[str, PropertyInfo(alias="accountId")] + """The expense account being debited (increased). + + The corresponding account being credited is usually a liability account (e.g., + Accounts Payable) or an asset account (e.g., Cash), depending on the transaction + type. + """ + + amount: str + """The monetary amount of this expense line, represented as a decimal string.""" + + billing_status: Annotated[ + Literal["billable", "has_been_billed", "not_billable"], PropertyInfo(alias="billingStatus") + ] + """The billing status of this expense line.""" + + class_id: Annotated[str, PropertyInfo(alias="classId")] + """The expense line'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. If a class is specified for the entire parent transaction, it is + automatically applied to all expense lines unless overridden here, at the + transaction line level. + """ + + memo: str + """A memo or note for this expense line, as entered by the user.""" + + payee_id: Annotated[str, PropertyInfo(alias="payeeId")] + """ + If `account` refers to an Accounts Payable (A/P) account, `payee` refers to the + expense's vendor (not the customer). If `account` refers to any other type of + account, `payee` refers to the expense's customer (not the vendor). + """ + + sales_representative_id: Annotated[str, PropertyInfo(alias="salesRepresentativeId")] + """The expense line's sales representative. + + Sales representatives can be employees, vendors, or other names in QuickBooks. + """ + + sales_tax_code_id: Annotated[str, PropertyInfo(alias="salesTaxCodeId")] + """ + The sales-tax code associated with this expense line, determining whether it is + taxable or non-taxable. It's used to assign a default tax status to all + transactions for this expense line. Default codes include "Non" (non-taxable) + and "Tax" (taxable), but custom codes can also be created in QuickBooks. If + QuickBooks is not set up to charge sales tax (via the "Do You Charge Sales Tax?" + preference), it will assign the default non-taxable code to all sales. + """ + + +class ItemGroupLineItemLine(TypedDict, total=False): + id: Required[str] + """ + The QuickBooks-assigned unique identifier of an existing item line you wish to + retain or update. Set this field to `-1` for new item lines you wish to add. + """ + + amount: str + """The monetary amount of this item line, represented as a decimal string. + + If both `quantity` and `cost` are specified but not `amount`, QuickBooks will + use them to calculate `amount`. If `amount`, `cost`, and `quantity` are all + unspecified, then QuickBooks will calculate `amount` based on a `quantity` of + `1` and the suggested `cost`. + """ + + billing_status: Annotated[ + Literal["billable", "has_been_billed", "not_billable"], PropertyInfo(alias="billingStatus") + ] + """The billing status of this item line.""" + + class_id: Annotated[str, PropertyInfo(alias="classId")] + """The item line'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. If a class is specified for the entire parent transaction, it is + automatically applied to all item lines unless overridden here, at the + transaction line level. + """ + + cost: str + """The cost of this item line, represented as a decimal string. + + If both `quantity` and `amount` are specified but not `cost`, QuickBooks will + use them to calculate `cost`. + """ + + customer_id: Annotated[str, PropertyInfo(alias="customerId")] + """The customer or customer-job associated with this item line.""" + + description: str + """A description of this item line.""" + + expiration_date: Annotated[Union[str, date], PropertyInfo(alias="expirationDate", format="iso8601")] + """ + The expiration date for the serial number or lot number of the item associated + with this item line, in ISO 8601 format (YYYY-MM-DD). This is particularly + relevant for perishable or time-sensitive inventory items. Note that this field + is only supported on QuickBooks Desktop 2023 or later. + """ + + inventory_site_id: Annotated[str, PropertyInfo(alias="inventorySiteId")] + """ + The site location where inventory for the item associated with this item line is + stored. + """ + + inventory_site_location_id: Annotated[str, PropertyInfo(alias="inventorySiteLocationId")] + """ + The specific location (e.g., bin or shelf) within the inventory site where the + item associated with this item line is stored. + """ + + item_id: Annotated[str, PropertyInfo(alias="itemId")] + """The item associated with this item line. + + This can refer to any good or service that the business buys or sells, including + item types such as a service item, inventory item, or special calculation item + like a discount item or sales-tax item. + """ + + lot_number: Annotated[str, PropertyInfo(alias="lotNumber")] + """The lot number of the item associated with this item line. + + Used for tracking groups of inventory items that are purchased or manufactured + together. + """ + + override_item_account_id: Annotated[str, PropertyInfo(alias="overrideItemAccountId")] + """ + The account to use for this item line, overriding the default account associated + with the item. + """ + + override_unit_of_measure_set_id: Annotated[str, PropertyInfo(alias="overrideUnitOfMeasureSetId")] + """ + Specifies an alternative unit-of-measure set when updating this item line's + `unitOfMeasure` field (e.g., "pound" or "kilogram"). This allows you to select + units from a different set than the item's default unit-of-measure set, which + remains unchanged on the item itself. The override applies only to this specific + line. For example, you can sell an item typically measured in volume units using + weight units in a specific transaction by specifying a different unit-of-measure + set with this field. + """ + + quantity: float + """The quantity of the item associated with this item line.""" + + sales_representative_id: Annotated[str, PropertyInfo(alias="salesRepresentativeId")] + """The item line's sales representative. + + Sales representatives can be employees, vendors, or other names in QuickBooks. + """ + + sales_tax_code_id: Annotated[str, PropertyInfo(alias="salesTaxCodeId")] + """ + The sales-tax code associated with this item line, determining whether it is + taxable or non-taxable. It's used to assign a default tax status to all + transactions for this item line. Default codes include "Non" (non-taxable) and + "Tax" (taxable), but custom codes can also be created in QuickBooks. If + QuickBooks is not set up to charge sales tax (via the "Do You Charge Sales Tax?" + preference), it will assign the default non-taxable code to all sales. + """ + + serial_number: Annotated[str, PropertyInfo(alias="serialNumber")] + """The serial number of the item associated with this item line. + + This is used for tracking individual units of serialized inventory items. + """ + + unit_of_measure: Annotated[str, PropertyInfo(alias="unitOfMeasure")] + """The unit-of-measure used for the `quantity` in this item line. + + Must be a valid unit within the item's available units of measure. + """ + + +class ItemGroupLine(TypedDict, total=False): + id: Required[str] + """ + The QuickBooks-assigned unique identifier of an existing item group line you + wish to retain or update. Set this field to `-1` for new item group lines you + wish to add. + """ + + item_group_id: Annotated[str, PropertyInfo(alias="itemGroupId")] + """ + The item group line's item group, representing a predefined set of items bundled + because they are commonly purchased together or grouped for faster entry. + """ + + item_lines: Annotated[Iterable[ItemGroupLineItemLine], PropertyInfo(alias="itemLines")] + """ + The item group line's item lines, each representing the purchase of a specific + item or service. + + IMPORTANT: When updating an item group line's item lines, this array completely + REPLACES all existing item lines for that item group line. To retain any current + item lines, include them in this array, even if they have not changed. Any item + lines not included will be removed. To add a new item line, include it with its + `id` set to `-1`. If you do not wish to modify the item lines, you can omit this + field entirely to keep them unchanged. + """ + + override_unit_of_measure_set_id: Annotated[str, PropertyInfo(alias="overrideUnitOfMeasureSetId")] + """ + Specifies an alternative unit-of-measure set when updating this item group + line's `unitOfMeasure` field (e.g., "pound" or "kilogram"). This allows you to + select units from a different set than the item's default unit-of-measure set, + which remains unchanged on the item itself. The override applies only to this + specific line. For example, you can sell an item typically measured in volume + units using weight units in a specific transaction by specifying a different + unit-of-measure set with this field. + """ + + quantity: float + """The quantity of the item group associated with this item group line.""" + + unit_of_measure: Annotated[str, PropertyInfo(alias="unitOfMeasure")] + """The unit-of-measure used for the `quantity` in this item group line. + + Must be a valid unit within the item's available units of measure. + """ + + +class ItemLine(TypedDict, total=False): + id: Required[str] + """ + The QuickBooks-assigned unique identifier of an existing item line you wish to + retain or update. Set this field to `-1` for new item lines you wish to add. + """ + + amount: str + """The monetary amount of this item line, represented as a decimal string. + + If both `quantity` and `cost` are specified but not `amount`, QuickBooks will + use them to calculate `amount`. If `amount`, `cost`, and `quantity` are all + unspecified, then QuickBooks will calculate `amount` based on a `quantity` of + `1` and the suggested `cost`. + """ + + billing_status: Annotated[ + Literal["billable", "has_been_billed", "not_billable"], PropertyInfo(alias="billingStatus") + ] + """The billing status of this item line.""" + + class_id: Annotated[str, PropertyInfo(alias="classId")] + """The item line'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. If a class is specified for the entire parent transaction, it is + automatically applied to all item lines unless overridden here, at the + transaction line level. + """ + + cost: str + """The cost of this item line, represented as a decimal string. + + If both `quantity` and `amount` are specified but not `cost`, QuickBooks will + use them to calculate `cost`. + """ + + customer_id: Annotated[str, PropertyInfo(alias="customerId")] + """The customer or customer-job associated with this item line.""" + + description: str + """A description of this item line.""" + + expiration_date: Annotated[Union[str, date], PropertyInfo(alias="expirationDate", format="iso8601")] + """ + The expiration date for the serial number or lot number of the item associated + with this item line, in ISO 8601 format (YYYY-MM-DD). This is particularly + relevant for perishable or time-sensitive inventory items. Note that this field + is only supported on QuickBooks Desktop 2023 or later. + """ + + inventory_site_id: Annotated[str, PropertyInfo(alias="inventorySiteId")] + """ + The site location where inventory for the item associated with this item line is + stored. + """ + + inventory_site_location_id: Annotated[str, PropertyInfo(alias="inventorySiteLocationId")] + """ + The specific location (e.g., bin or shelf) within the inventory site where the + item associated with this item line is stored. + """ + + item_id: Annotated[str, PropertyInfo(alias="itemId")] + """The item associated with this item line. + + This can refer to any good or service that the business buys or sells, including + item types such as a service item, inventory item, or special calculation item + like a discount item or sales-tax item. + """ + + lot_number: Annotated[str, PropertyInfo(alias="lotNumber")] + """The lot number of the item associated with this item line. + + Used for tracking groups of inventory items that are purchased or manufactured + together. + """ + + override_item_account_id: Annotated[str, PropertyInfo(alias="overrideItemAccountId")] + """ + The account to use for this item line, overriding the default account associated + with the item. + """ + + override_unit_of_measure_set_id: Annotated[str, PropertyInfo(alias="overrideUnitOfMeasureSetId")] + """ + Specifies an alternative unit-of-measure set when updating this item line's + `unitOfMeasure` field (e.g., "pound" or "kilogram"). This allows you to select + units from a different set than the item's default unit-of-measure set, which + remains unchanged on the item itself. The override applies only to this specific + line. For example, you can sell an item typically measured in volume units using + weight units in a specific transaction by specifying a different unit-of-measure + set with this field. + """ + + quantity: float + """The quantity of the item associated with this item line.""" + + sales_representative_id: Annotated[str, PropertyInfo(alias="salesRepresentativeId")] + """The item line's sales representative. + + Sales representatives can be employees, vendors, or other names in QuickBooks. + """ + + sales_tax_code_id: Annotated[str, PropertyInfo(alias="salesTaxCodeId")] + """ + The sales-tax code associated with this item line, determining whether it is + taxable or non-taxable. It's used to assign a default tax status to all + transactions for this item line. Default codes include "Non" (non-taxable) and + "Tax" (taxable), but custom codes can also be created in QuickBooks. If + QuickBooks is not set up to charge sales tax (via the "Do You Charge Sales Tax?" + preference), it will assign the default non-taxable code to all sales. + """ + + serial_number: Annotated[str, PropertyInfo(alias="serialNumber")] + """The serial number of the item associated with this item line. + + This is used for tracking individual units of serialized inventory items. + """ + + unit_of_measure: Annotated[str, PropertyInfo(alias="unitOfMeasure")] + """The unit-of-measure used for the `quantity` in this item line. + + Must be a valid unit within the item's available units of measure. + """ diff --git a/tests/api_resources/qbd/test_checks.py b/tests/api_resources/qbd/test_checks.py index cc83eeb..30df259 100644 --- a/tests/api_resources/qbd/test_checks.py +++ b/tests/api_resources/qbd/test_checks.py @@ -19,6 +19,364 @@ class TestChecks: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + def test_method_create(self, client: Conductor) -> None: + check = client.qbd.checks.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Conductor) -> None: + check = client.qbd.checks.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + address={ + "city": "San Francisco", + "country": "United States", + "line1": "548 Market St.", + "line2": "Suite 100", + "line3": "line3", + "line4": "line4", + "line5": "line5", + "note": "Conductor HQ", + "postal_code": "94110", + "state": "CA", + }, + apply_checks_to_transactions=[ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + }, + ], + exchange_rate=1.2345, + expense_lines=[ + { + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + { + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + { + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + ], + external_id="12345678-abcd-1234-abcd-1234567890ab", + is_queued_for_print=True, + item_group_lines=[ + { + "item_group_id": "80000011-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + { + "item_group_id": "80000011-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + { + "item_group_id": "80000011-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + ], + item_lines=[ + { + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "link_to_transaction_line": { + "transaction_id": "123ABC-1234567890", + "transaction_line_id": "123ABC-1234567890", + }, + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "link_to_transaction_line": { + "transaction_id": "123ABC-1234567890", + "transaction_line_id": "123ABC-1234567890", + }, + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "link_to_transaction_line": { + "transaction_id": "123ABC-1234567890", + "transaction_line_id": "123ABC-1234567890", + }, + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + memo="Check memo", + payee_id="80000001-1234567890", + ref_number="CHECK-1234", + sales_tax_code_id="80000004-1234567890", + ) + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Conductor) -> None: + response = client.qbd.checks.with_raw_response.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + check = response.parse() + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Conductor) -> None: + with client.qbd.checks.with_streaming_response.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + check = response.parse() + assert_matches_type(QbdCheck, check, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_retrieve(self, client: Conductor) -> None: check = client.qbd.checks.retrieve( @@ -61,6 +419,415 @@ def test_path_params_retrieve(self, client: Conductor) -> None: conductor_end_user_id="end_usr_1234567abcdefg", ) + @parametrize + def test_method_update(self, client: Conductor) -> None: + check = client.qbd.checks.update( + id="123ABC-1234567890", + revision_number="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Conductor) -> None: + check = client.qbd.checks.update( + id="123ABC-1234567890", + revision_number="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + account_id="80000001-1234567890", + address={ + "city": "San Francisco", + "country": "United States", + "line1": "548 Market St.", + "line2": "Suite 100", + "line3": "line3", + "line4": "line4", + "line5": "line5", + "note": "Conductor HQ", + "postal_code": "94110", + "state": "CA", + }, + apply_checks_to_transactions=[ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + }, + ], + clear_expense_lines=False, + clear_item_lines=False, + exchange_rate=1.2345, + expense_lines=[ + { + "id": "123ABC-1234567890", + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + { + "id": "123ABC-1234567890", + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + { + "id": "123ABC-1234567890", + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + ], + is_queued_for_print=True, + item_group_lines=[ + { + "id": "123ABC-1234567890", + "item_group_id": "80000011-1234567890", + "item_lines": [ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "item_group_id": "80000011-1234567890", + "item_lines": [ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "item_group_id": "80000011-1234567890", + "item_lines": [ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + ], + item_lines=[ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + memo="Check memo", + payee_id="80000001-1234567890", + ref_number="CHECK-1234", + sales_tax_code_id="80000004-1234567890", + transaction_date=parse_date("2019-12-27"), + ) + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Conductor) -> None: + response = client.qbd.checks.with_raw_response.update( + id="123ABC-1234567890", + revision_number="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + check = response.parse() + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Conductor) -> None: + with client.qbd.checks.with_streaming_response.update( + id="123ABC-1234567890", + revision_number="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + check = response.parse() + assert_matches_type(QbdCheck, check, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Conductor) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.qbd.checks.with_raw_response.update( + id="", + revision_number="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + @parametrize def test_method_list(self, client: Conductor) -> None: check = client.qbd.checks.list( @@ -121,6 +888,364 @@ def test_streaming_response_list(self, client: Conductor) -> None: class TestAsyncChecks: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + async def test_method_create(self, async_client: AsyncConductor) -> None: + check = await async_client.qbd.checks.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncConductor) -> None: + check = await async_client.qbd.checks.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + address={ + "city": "San Francisco", + "country": "United States", + "line1": "548 Market St.", + "line2": "Suite 100", + "line3": "line3", + "line4": "line4", + "line5": "line5", + "note": "Conductor HQ", + "postal_code": "94110", + "state": "CA", + }, + apply_checks_to_transactions=[ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + }, + ], + exchange_rate=1.2345, + expense_lines=[ + { + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + { + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + { + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + ], + external_id="12345678-abcd-1234-abcd-1234567890ab", + is_queued_for_print=True, + item_group_lines=[ + { + "item_group_id": "80000011-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + { + "item_group_id": "80000011-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + { + "item_group_id": "80000011-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + ], + item_lines=[ + { + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "link_to_transaction_line": { + "transaction_id": "123ABC-1234567890", + "transaction_line_id": "123ABC-1234567890", + }, + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "link_to_transaction_line": { + "transaction_id": "123ABC-1234567890", + "transaction_line_id": "123ABC-1234567890", + }, + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "custom_fields": [ + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + { + "name": "Customer Rating", + "owner_id": "0", + "value": "Premium", + }, + ], + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "link_to_transaction_line": { + "transaction_id": "123ABC-1234567890", + "transaction_line_id": "123ABC-1234567890", + }, + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + memo="Check memo", + payee_id="80000001-1234567890", + ref_number="CHECK-1234", + sales_tax_code_id="80000004-1234567890", + ) + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncConductor) -> None: + response = await async_client.qbd.checks.with_raw_response.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + check = await response.parse() + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncConductor) -> None: + async with async_client.qbd.checks.with_streaming_response.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + check = await response.parse() + assert_matches_type(QbdCheck, check, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize async def test_method_retrieve(self, async_client: AsyncConductor) -> None: check = await async_client.qbd.checks.retrieve( @@ -163,6 +1288,415 @@ async def test_path_params_retrieve(self, async_client: AsyncConductor) -> None: conductor_end_user_id="end_usr_1234567abcdefg", ) + @parametrize + async def test_method_update(self, async_client: AsyncConductor) -> None: + check = await async_client.qbd.checks.update( + id="123ABC-1234567890", + revision_number="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncConductor) -> None: + check = await async_client.qbd.checks.update( + id="123ABC-1234567890", + revision_number="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + account_id="80000001-1234567890", + address={ + "city": "San Francisco", + "country": "United States", + "line1": "548 Market St.", + "line2": "Suite 100", + "line3": "line3", + "line4": "line4", + "line5": "line5", + "note": "Conductor HQ", + "postal_code": "94110", + "state": "CA", + }, + apply_checks_to_transactions=[ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + }, + ], + clear_expense_lines=False, + clear_item_lines=False, + exchange_rate=1.2345, + expense_lines=[ + { + "id": "123ABC-1234567890", + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + { + "id": "123ABC-1234567890", + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + { + "id": "123ABC-1234567890", + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + ], + is_queued_for_print=True, + item_group_lines=[ + { + "id": "123ABC-1234567890", + "item_group_id": "80000011-1234567890", + "item_lines": [ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "item_group_id": "80000011-1234567890", + "item_lines": [ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "item_group_id": "80000011-1234567890", + "item_lines": [ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + ], + item_lines=[ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + memo="Check memo", + payee_id="80000001-1234567890", + ref_number="CHECK-1234", + sales_tax_code_id="80000004-1234567890", + transaction_date=parse_date("2019-12-27"), + ) + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncConductor) -> None: + response = await async_client.qbd.checks.with_raw_response.update( + id="123ABC-1234567890", + revision_number="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + check = await response.parse() + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncConductor) -> None: + async with async_client.qbd.checks.with_streaming_response.update( + id="123ABC-1234567890", + revision_number="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + check = await response.parse() + assert_matches_type(QbdCheck, check, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncConductor) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.qbd.checks.with_raw_response.update( + id="", + revision_number="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + @parametrize async def test_method_list(self, async_client: AsyncConductor) -> None: check = await async_client.qbd.checks.list(