| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# File generated from our OpenAPI spec |
| 3 |
from stripe._singleton_api_resource import SingletonAPIResource |
| 4 |
from stripe._stripe_object import StripeObject |
| 5 |
from stripe._updateable_api_resource import UpdateableAPIResource |
| 6 |
from typing import ClassVar, List, Optional, cast |
| 7 |
from typing_extensions import Literal, Unpack, TYPE_CHECKING |
| 8 |
|
| 9 |
if TYPE_CHECKING: |
| 10 |
from stripe.params.tax._settings_modify_params import SettingsModifyParams |
| 11 |
from stripe.params.tax._settings_retrieve_params import ( |
| 12 |
SettingsRetrieveParams, |
| 13 |
) |
| 14 |
|
| 15 |
|
| 16 |
class Settings( |
| 17 |
SingletonAPIResource["Settings"], |
| 18 |
UpdateableAPIResource["Settings"], |
| 19 |
): |
| 20 |
""" |
| 21 |
You can use Tax `Settings` to manage configurations used by Stripe Tax calculations. |
| 22 |
|
| 23 |
Related guide: [Using the Settings API](https://docs.stripe.com/tax/settings-api) |
| 24 |
""" |
| 25 |
|
| 26 |
OBJECT_NAME: ClassVar[Literal["tax.settings"]] = "tax.settings" |
| 27 |
|
| 28 |
class Defaults(StripeObject): |
| 29 |
provider: Literal["anrok", "avalara", "sphere", "stripe"] |
| 30 |
""" |
| 31 |
The tax calculation provider this account uses. Defaults to `stripe` when not using a [third-party provider](https://docs.stripe.com/tax/third-party-apps). |
| 32 |
""" |
| 33 |
tax_behavior: Optional[ |
| 34 |
Literal["exclusive", "inclusive", "inferred_by_currency"] |
| 35 |
] |
| 36 |
""" |
| 37 |
Default [tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#tax-behavior) used to specify whether the price is considered inclusive of taxes or exclusive of taxes. If the item's price has a tax behavior set, it will take precedence over the default tax behavior. |
| 38 |
""" |
| 39 |
tax_code: Optional[str] |
| 40 |
""" |
| 41 |
Default [tax code](https://stripe.com/docs/tax/tax-categories) used to classify your products and prices. |
| 42 |
""" |
| 43 |
|
| 44 |
class HeadOffice(StripeObject): |
| 45 |
class Address(StripeObject): |
| 46 |
city: Optional[str] |
| 47 |
""" |
| 48 |
City, district, suburb, town, or village. |
| 49 |
""" |
| 50 |
country: Optional[str] |
| 51 |
""" |
| 52 |
Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). |
| 53 |
""" |
| 54 |
line1: Optional[str] |
| 55 |
""" |
| 56 |
Address line 1, such as the street, PO Box, or company name. |
| 57 |
""" |
| 58 |
line2: Optional[str] |
| 59 |
""" |
| 60 |
Address line 2, such as the apartment, suite, unit, or building. |
| 61 |
""" |
| 62 |
postal_code: Optional[str] |
| 63 |
""" |
| 64 |
ZIP or postal code. |
| 65 |
""" |
| 66 |
state: Optional[str] |
| 67 |
""" |
| 68 |
State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). |
| 69 |
""" |
| 70 |
|
| 71 |
address: Address |
| 72 |
_inner_class_types = {"address": Address} |
| 73 |
|
| 74 |
class StatusDetails(StripeObject): |
| 75 |
class Active(StripeObject): |
| 76 |
pass |
| 77 |
|
| 78 |
class Pending(StripeObject): |
| 79 |
missing_fields: Optional[List[str]] |
| 80 |
""" |
| 81 |
The list of missing fields that are required to perform calculations. It includes the entry `head_office` when the status is `pending`. It is recommended to set the optional values even if they aren't listed as required for calculating taxes. Calculations can fail if missing fields aren't explicitly provided on every call. |
| 82 |
""" |
| 83 |
|
| 84 |
active: Optional[Active] |
| 85 |
pending: Optional[Pending] |
| 86 |
_inner_class_types = {"active": Active, "pending": Pending} |
| 87 |
|
| 88 |
defaults: Defaults |
| 89 |
head_office: Optional[HeadOffice] |
| 90 |
""" |
| 91 |
The place where your business is located. |
| 92 |
""" |
| 93 |
livemode: bool |
| 94 |
""" |
| 95 |
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. |
| 96 |
""" |
| 97 |
object: Literal["tax.settings"] |
| 98 |
""" |
| 99 |
String representing the object's type. Objects of the same type share the same value. |
| 100 |
""" |
| 101 |
status: Literal["active", "pending"] |
| 102 |
""" |
| 103 |
The status of the Tax `Settings`. |
| 104 |
""" |
| 105 |
status_details: StatusDetails |
| 106 |
|
| 107 |
@classmethod |
| 108 |
def modify(cls, **params: Unpack["SettingsModifyParams"]) -> "Settings": |
| 109 |
""" |
| 110 |
Updates Tax Settings parameters used in tax calculations. All parameters are editable but none can be removed once set. |
| 111 |
""" |
| 112 |
return cast( |
| 113 |
"Settings", |
| 114 |
cls._static_request( |
| 115 |
"post", |
| 116 |
cls.class_url(), |
| 117 |
params=params, |
| 118 |
), |
| 119 |
) |
| 120 |
|
| 121 |
@classmethod |
| 122 |
async def modify_async( |
| 123 |
cls, **params: Unpack["SettingsModifyParams"] |
| 124 |
) -> "Settings": |
| 125 |
""" |
| 126 |
Updates Tax Settings parameters used in tax calculations. All parameters are editable but none can be removed once set. |
| 127 |
""" |
| 128 |
return cast( |
| 129 |
"Settings", |
| 130 |
await cls._static_request_async( |
| 131 |
"post", |
| 132 |
cls.class_url(), |
| 133 |
params=params, |
| 134 |
), |
| 135 |
) |
| 136 |
|
| 137 |
@classmethod |
| 138 |
def retrieve( |
| 139 |
cls, **params: Unpack["SettingsRetrieveParams"] |
| 140 |
) -> "Settings": |
| 141 |
""" |
| 142 |
Retrieves Tax Settings for a merchant. |
| 143 |
""" |
| 144 |
instance = cls(None, **params) |
| 145 |
instance.refresh() |
| 146 |
return instance |
| 147 |
|
| 148 |
@classmethod |
| 149 |
async def retrieve_async( |
| 150 |
cls, **params: Unpack["SettingsRetrieveParams"] |
| 151 |
) -> "Settings": |
| 152 |
""" |
| 153 |
Retrieves Tax Settings for a merchant. |
| 154 |
""" |
| 155 |
instance = cls(None, **params) |
| 156 |
await instance.refresh_async() |
| 157 |
return instance |
| 158 |
|
| 159 |
@classmethod |
| 160 |
def class_url(cls): |
| 161 |
return "/v1/tax/settings" |
| 162 |
|
| 163 |
_inner_class_types = { |
| 164 |
"defaults": Defaults, |
| 165 |
"head_office": HeadOffice, |
| 166 |
"status_details": StatusDetails, |
| 167 |
} |