|
| 1 | +// File generated from our OpenAPI spec |
| 2 | +package com.stripe.model.tax; |
| 3 | + |
| 4 | +import com.google.gson.annotations.SerializedName; |
| 5 | +import com.stripe.exception.StripeException; |
| 6 | +import com.stripe.model.Address; |
| 7 | +import com.stripe.model.HasId; |
| 8 | +import com.stripe.net.ApiRequest; |
| 9 | +import com.stripe.net.ApiRequestParams; |
| 10 | +import com.stripe.net.ApiResource; |
| 11 | +import com.stripe.net.BaseAddress; |
| 12 | +import com.stripe.net.RequestOptions; |
| 13 | +import com.stripe.net.StripeResponseGetter; |
| 14 | +import com.stripe.param.tax.LocationCreateParams; |
| 15 | +import com.stripe.param.tax.LocationListParams; |
| 16 | +import com.stripe.param.tax.LocationRetrieveParams; |
| 17 | +import java.util.Map; |
| 18 | +import lombok.EqualsAndHashCode; |
| 19 | +import lombok.Getter; |
| 20 | +import lombok.Setter; |
| 21 | + |
| 22 | +/** Tax locations represent venues for services, tickets, or other product types. */ |
| 23 | +@Getter |
| 24 | +@Setter |
| 25 | +@EqualsAndHashCode(callSuper = false) |
| 26 | +public class Location extends ApiResource implements HasId { |
| 27 | + @SerializedName("address") |
| 28 | + Address address; |
| 29 | + |
| 30 | + /** |
| 31 | + * A descriptive text providing additional context about the tax location. This can include |
| 32 | + * information about the venue, types of events held, services available, or any relevant details |
| 33 | + * for better identification (e.g., "A spacious auditorium suitable for large concerts and |
| 34 | + * events."). |
| 35 | + */ |
| 36 | + @SerializedName("description") |
| 37 | + String description; |
| 38 | + |
| 39 | + /** Unique identifier for the object. */ |
| 40 | + @Getter(onMethod_ = {@Override}) |
| 41 | + @SerializedName("id") |
| 42 | + String id; |
| 43 | + |
| 44 | + /** |
| 45 | + * String representing the object's type. Objects of the same type share the same value. |
| 46 | + * |
| 47 | + * <p>Equal to {@code tax.location}. |
| 48 | + */ |
| 49 | + @SerializedName("object") |
| 50 | + String object; |
| 51 | + |
| 52 | + /** |
| 53 | + * The type of tax location to be defined. Currently the only option is {@code performance}. |
| 54 | + * |
| 55 | + * <p>Equal to {@code performance}. |
| 56 | + */ |
| 57 | + @SerializedName("type") |
| 58 | + String type; |
| 59 | + |
| 60 | + /** |
| 61 | + * Create a tax location to use in calculating taxes for a service, ticket, or other type of |
| 62 | + * product. The resulting object contains the id, address, name, description, and current |
| 63 | + * operational status of the tax location. |
| 64 | + */ |
| 65 | + public static Location create(Map<String, Object> params) throws StripeException { |
| 66 | + return create(params, (RequestOptions) null); |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * Create a tax location to use in calculating taxes for a service, ticket, or other type of |
| 71 | + * product. The resulting object contains the id, address, name, description, and current |
| 72 | + * operational status of the tax location. |
| 73 | + */ |
| 74 | + public static Location create(Map<String, Object> params, RequestOptions options) |
| 75 | + throws StripeException { |
| 76 | + String path = "/v1/tax/locations"; |
| 77 | + ApiRequest request = |
| 78 | + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); |
| 79 | + return getGlobalResponseGetter().request(request, Location.class); |
| 80 | + } |
| 81 | + |
| 82 | + /** |
| 83 | + * Create a tax location to use in calculating taxes for a service, ticket, or other type of |
| 84 | + * product. The resulting object contains the id, address, name, description, and current |
| 85 | + * operational status of the tax location. |
| 86 | + */ |
| 87 | + public static Location create(LocationCreateParams params) throws StripeException { |
| 88 | + return create(params, (RequestOptions) null); |
| 89 | + } |
| 90 | + |
| 91 | + /** |
| 92 | + * Create a tax location to use in calculating taxes for a service, ticket, or other type of |
| 93 | + * product. The resulting object contains the id, address, name, description, and current |
| 94 | + * operational status of the tax location. |
| 95 | + */ |
| 96 | + public static Location create(LocationCreateParams params, RequestOptions options) |
| 97 | + throws StripeException { |
| 98 | + String path = "/v1/tax/locations"; |
| 99 | + ApiResource.checkNullTypedParams(path, params); |
| 100 | + ApiRequest request = |
| 101 | + new ApiRequest( |
| 102 | + BaseAddress.API, |
| 103 | + ApiResource.RequestMethod.POST, |
| 104 | + path, |
| 105 | + ApiRequestParams.paramsToMap(params), |
| 106 | + options); |
| 107 | + return getGlobalResponseGetter().request(request, Location.class); |
| 108 | + } |
| 109 | + |
| 110 | + /** |
| 111 | + * Retrieve a list of all tax locations. Tax locations can represent the venues for services, |
| 112 | + * tickets, or other product types. |
| 113 | + * |
| 114 | + * <p>The response includes detailed information for each tax location, such as its address, name, |
| 115 | + * description, and current operational status. |
| 116 | + * |
| 117 | + * <p>You can paginate through the list by using the {@code limit} parameter to control the number |
| 118 | + * of results returned in each request. |
| 119 | + */ |
| 120 | + public static LocationCollection list(Map<String, Object> params) throws StripeException { |
| 121 | + return list(params, (RequestOptions) null); |
| 122 | + } |
| 123 | + |
| 124 | + /** |
| 125 | + * Retrieve a list of all tax locations. Tax locations can represent the venues for services, |
| 126 | + * tickets, or other product types. |
| 127 | + * |
| 128 | + * <p>The response includes detailed information for each tax location, such as its address, name, |
| 129 | + * description, and current operational status. |
| 130 | + * |
| 131 | + * <p>You can paginate through the list by using the {@code limit} parameter to control the number |
| 132 | + * of results returned in each request. |
| 133 | + */ |
| 134 | + public static LocationCollection list(Map<String, Object> params, RequestOptions options) |
| 135 | + throws StripeException { |
| 136 | + String path = "/v1/tax/locations"; |
| 137 | + ApiRequest request = |
| 138 | + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options); |
| 139 | + return getGlobalResponseGetter().request(request, LocationCollection.class); |
| 140 | + } |
| 141 | + |
| 142 | + /** |
| 143 | + * Retrieve a list of all tax locations. Tax locations can represent the venues for services, |
| 144 | + * tickets, or other product types. |
| 145 | + * |
| 146 | + * <p>The response includes detailed information for each tax location, such as its address, name, |
| 147 | + * description, and current operational status. |
| 148 | + * |
| 149 | + * <p>You can paginate through the list by using the {@code limit} parameter to control the number |
| 150 | + * of results returned in each request. |
| 151 | + */ |
| 152 | + public static LocationCollection list(LocationListParams params) throws StripeException { |
| 153 | + return list(params, (RequestOptions) null); |
| 154 | + } |
| 155 | + |
| 156 | + /** |
| 157 | + * Retrieve a list of all tax locations. Tax locations can represent the venues for services, |
| 158 | + * tickets, or other product types. |
| 159 | + * |
| 160 | + * <p>The response includes detailed information for each tax location, such as its address, name, |
| 161 | + * description, and current operational status. |
| 162 | + * |
| 163 | + * <p>You can paginate through the list by using the {@code limit} parameter to control the number |
| 164 | + * of results returned in each request. |
| 165 | + */ |
| 166 | + public static LocationCollection list(LocationListParams params, RequestOptions options) |
| 167 | + throws StripeException { |
| 168 | + String path = "/v1/tax/locations"; |
| 169 | + ApiResource.checkNullTypedParams(path, params); |
| 170 | + ApiRequest request = |
| 171 | + new ApiRequest( |
| 172 | + BaseAddress.API, |
| 173 | + ApiResource.RequestMethod.GET, |
| 174 | + path, |
| 175 | + ApiRequestParams.paramsToMap(params), |
| 176 | + options); |
| 177 | + return getGlobalResponseGetter().request(request, LocationCollection.class); |
| 178 | + } |
| 179 | + |
| 180 | + /** |
| 181 | + * Fetch the details of a specific tax location using its unique identifier. Use a tax location to |
| 182 | + * calculate taxes based on the location of the end product, such as a performance, instead of the |
| 183 | + * customer address. For more details, check the <a |
| 184 | + * href="https://docs.stripe.com/tax/tax-for-tickets/integration-guide">integration guide</a>. |
| 185 | + */ |
| 186 | + public static Location retrieve(String location) throws StripeException { |
| 187 | + return retrieve(location, (Map<String, Object>) null, (RequestOptions) null); |
| 188 | + } |
| 189 | + |
| 190 | + /** |
| 191 | + * Fetch the details of a specific tax location using its unique identifier. Use a tax location to |
| 192 | + * calculate taxes based on the location of the end product, such as a performance, instead of the |
| 193 | + * customer address. For more details, check the <a |
| 194 | + * href="https://docs.stripe.com/tax/tax-for-tickets/integration-guide">integration guide</a>. |
| 195 | + */ |
| 196 | + public static Location retrieve(String location, RequestOptions options) throws StripeException { |
| 197 | + return retrieve(location, (Map<String, Object>) null, options); |
| 198 | + } |
| 199 | + |
| 200 | + /** |
| 201 | + * Fetch the details of a specific tax location using its unique identifier. Use a tax location to |
| 202 | + * calculate taxes based on the location of the end product, such as a performance, instead of the |
| 203 | + * customer address. For more details, check the <a |
| 204 | + * href="https://docs.stripe.com/tax/tax-for-tickets/integration-guide">integration guide</a>. |
| 205 | + */ |
| 206 | + public static Location retrieve( |
| 207 | + String location, Map<String, Object> params, RequestOptions options) throws StripeException { |
| 208 | + String path = String.format("/v1/tax/locations/%s", ApiResource.urlEncodeId(location)); |
| 209 | + ApiRequest request = |
| 210 | + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options); |
| 211 | + return getGlobalResponseGetter().request(request, Location.class); |
| 212 | + } |
| 213 | + |
| 214 | + /** |
| 215 | + * Fetch the details of a specific tax location using its unique identifier. Use a tax location to |
| 216 | + * calculate taxes based on the location of the end product, such as a performance, instead of the |
| 217 | + * customer address. For more details, check the <a |
| 218 | + * href="https://docs.stripe.com/tax/tax-for-tickets/integration-guide">integration guide</a>. |
| 219 | + */ |
| 220 | + public static Location retrieve( |
| 221 | + String location, LocationRetrieveParams params, RequestOptions options) |
| 222 | + throws StripeException { |
| 223 | + String path = String.format("/v1/tax/locations/%s", ApiResource.urlEncodeId(location)); |
| 224 | + ApiResource.checkNullTypedParams(path, params); |
| 225 | + ApiRequest request = |
| 226 | + new ApiRequest( |
| 227 | + BaseAddress.API, |
| 228 | + ApiResource.RequestMethod.GET, |
| 229 | + path, |
| 230 | + ApiRequestParams.paramsToMap(params), |
| 231 | + options); |
| 232 | + return getGlobalResponseGetter().request(request, Location.class); |
| 233 | + } |
| 234 | + |
| 235 | + @Override |
| 236 | + public void setResponseGetter(StripeResponseGetter responseGetter) { |
| 237 | + super.setResponseGetter(responseGetter); |
| 238 | + trySetResponseGetter(address, responseGetter); |
| 239 | + } |
| 240 | +} |
0 commit comments