Calculation.php
6 months ago
CalculationLineItem.php
6 months ago
Registration.php
6 months ago
Settings.php
6 months ago
Transaction.php
6 months ago
TransactionLineItem.php
6 months ago
Settings.php
87 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | |
| 5 | namespace AmeliaVendor\Stripe\Tax; |
| 6 | |
| 7 | /** |
| 8 | * You can use Tax <code>Settings</code> to manage configurations used by Stripe Tax calculations. |
| 9 | * |
| 10 | * Related guide: <a href="https://stripe.com/docs/tax/settings-api">Using the Settings API</a> |
| 11 | * |
| 12 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 13 | * @property (object{tax_behavior: null|string, tax_code: null|string}&\AmeliaVendor\Stripe\StripeObject) $defaults |
| 14 | * @property null|(object{address: (object{city: null|string, country: null|string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&\AmeliaVendor\Stripe\StripeObject)}&\AmeliaVendor\Stripe\StripeObject) $head_office The place where your business is located. |
| 15 | * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. |
| 16 | * @property string $status The status of the Tax <code>Settings</code>. |
| 17 | * @property (object{active?: (object{}&\AmeliaVendor\Stripe\StripeObject), pending?: (object{missing_fields: null|string[]}&\AmeliaVendor\Stripe\StripeObject)}&\AmeliaVendor\Stripe\StripeObject) $status_details |
| 18 | */ |
| 19 | class Settings extends \AmeliaVendor\Stripe\SingletonApiResource |
| 20 | { |
| 21 | const OBJECT_NAME = 'tax.settings'; |
| 22 | |
| 23 | const STATUS_ACTIVE = 'active'; |
| 24 | const STATUS_PENDING = 'pending'; |
| 25 | |
| 26 | /** |
| 27 | * Retrieves Tax <code>Settings</code> for a merchant. |
| 28 | * |
| 29 | * @param null|array|string $opts |
| 30 | * |
| 31 | * @return Settings |
| 32 | * |
| 33 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 34 | */ |
| 35 | public static function retrieve($opts = null) |
| 36 | { |
| 37 | $opts = \AmeliaVendor\Stripe\Util\RequestOptions::parse($opts); |
| 38 | $instance = new static(null, $opts); |
| 39 | $instance->refresh(); |
| 40 | |
| 41 | return $instance; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * @param null|array $params |
| 46 | * @param null|array|string $opts |
| 47 | * |
| 48 | * @return static the updated resource |
| 49 | * |
| 50 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 51 | */ |
| 52 | public static function update($params = null, $opts = null) |
| 53 | { |
| 54 | self::_validateParams($params); |
| 55 | $url = '/v1/tax/settings'; |
| 56 | |
| 57 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 58 | $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 59 | $obj->setLastResponse($response); |
| 60 | |
| 61 | return $obj; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * @param null|array|string $opts |
| 66 | * |
| 67 | * @return static the saved resource |
| 68 | * |
| 69 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 70 | * |
| 71 | * @deprecated The `save` method is deprecated and will be removed in a |
| 72 | * future major version of the library. Use the static method `update` |
| 73 | * on the resource instead. |
| 74 | */ |
| 75 | public function save($opts = null) |
| 76 | { |
| 77 | $params = $this->serializeParameters(); |
| 78 | if (\count($params) > 0) { |
| 79 | $url = $this->instanceUrl(); |
| 80 | list($response, $opts) = $this->_request('post', $url, $params, $opts, ['save']); |
| 81 | $this->refreshFrom($response, $opts); |
| 82 | } |
| 83 | |
| 84 | return $this; |
| 85 | } |
| 86 | } |
| 87 |