Actualización

This commit is contained in:
Xes
2025-04-10 12:24:57 +02:00
parent 8969cc929d
commit 45420b6f0d
39760 changed files with 4303286 additions and 0 deletions

View File

@@ -0,0 +1,93 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Tax;
/**
* A Tax Calculation allows you to calculate the tax to collect from your customer.
*
* Related guide: <a href="https://stripe.com/docs/tax/custom">Calculate tax in your custom payment flow</a>
*
* @property null|string $id Unique identifier for the calculation.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $amount_total Total amount after taxes in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property null|string $customer The ID of an existing <a href="https://stripe.com/docs/api/customers/object">Customer</a> used for the resource.
* @property \Stripe\StripeObject $customer_details
* @property null|int $expires_at Timestamp of date at which the tax calculation will expire.
* @property null|\Stripe\Collection<\Stripe\Tax\CalculationLineItem> $line_items The list of items the customer is purchasing.
* @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.
* @property null|\Stripe\StripeObject $ship_from_details The details of the ship from location, such as the address.
* @property null|\Stripe\StripeObject $shipping_cost The shipping cost details for the calculation.
* @property int $tax_amount_exclusive The amount of tax to be collected on top of the line item prices.
* @property int $tax_amount_inclusive The amount of tax already included in the line item prices.
* @property \Stripe\StripeObject[] $tax_breakdown Breakdown of individual tax amounts that add up to the total.
* @property int $tax_date Timestamp of date at which the tax rules and rates in effect applies for the calculation.
*/
class Calculation extends \Stripe\ApiResource
{
const OBJECT_NAME = 'tax.calculation';
/**
* Calculates tax based on the input and returns a Tax <code>Calculation</code>
* object.
*
* @param null|array $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Tax\Calculation the created resource
*/
public static function create($params = null, $options = null)
{
self::_validateParams($params);
$url = static::classUrl();
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* Retrieves a Tax <code>Calculation</code> object, if the calculation hasnt
* expired.
*
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Tax\Calculation
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();
return $instance;
}
/**
* @param string $id
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\Tax\CalculationLineItem> list of calculation line items
*/
public static function allLineItems($id, $params = null, $opts = null)
{
$url = static::resourceUrl($id) . '/line_items';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
}

View File

@@ -0,0 +1,26 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Tax;
/**
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $amount The line item amount in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. If <code>tax_behavior=inclusive</code>, then this amount includes taxes. Otherwise, taxes were calculated on top of this amount.
* @property int $amount_tax The amount of tax calculated for this line item, in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
* @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.
* @property null|string $product The ID of an existing <a href="https://stripe.com/docs/api/products/object">Product</a>.
* @property int $quantity The number of units of the item being purchased. For reversals, this is the quantity reversed.
* @property null|string $reference A custom identifier for this line item.
* @property string $tax_behavior Specifies whether the <code>amount</code> includes taxes. If <code>tax_behavior=inclusive</code>, then the amount includes taxes.
* @property null|\Stripe\StripeObject[] $tax_breakdown Detailed account of taxes relevant to this line item.
* @property string $tax_code The <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID used for this resource.
*/
class CalculationLineItem extends \Stripe\ApiResource
{
const OBJECT_NAME = 'tax.calculation_line_item';
const TAX_BEHAVIOR_EXCLUSIVE = 'exclusive';
const TAX_BEHAVIOR_INCLUSIVE = 'inclusive';
}

View File

@@ -0,0 +1,117 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Tax;
/**
* A Tax <code>Registration</code> lets us know that your business is registered to collect tax on payments within a region, enabling you to <a href="https://stripe.com/docs/tax">automatically collect tax</a>.
*
* Stripe doesn't register on your behalf with the relevant authorities when you create a Tax <code>Registration</code> object. For more information on how to register to collect tax, see <a href="https://stripe.com/docs/tax/registering">our guide</a>.
*
* Related guide: <a href="https://stripe.com/docs/tax/registrations-api">Using the Registrations API</a>
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $active_from Time at which the registration becomes active. Measured in seconds since the Unix epoch.
* @property string $country Two-letter country code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>).
* @property \Stripe\StripeObject $country_options
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|int $expires_at If set, the registration stops being active at this time. If not set, the registration will be active indefinitely. Measured in seconds since the Unix epoch.
* @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.
* @property string $status The status of the registration. This field is present for convenience and can be deduced from <code>active_from</code> and <code>expires_at</code>.
*/
class Registration extends \Stripe\ApiResource
{
const OBJECT_NAME = 'tax.registration';
use \Stripe\ApiOperations\Update;
const STATUS_ACTIVE = 'active';
const STATUS_EXPIRED = 'expired';
const STATUS_SCHEDULED = 'scheduled';
/**
* Creates a new Tax <code>Registration</code> object.
*
* @param null|array $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Tax\Registration the created resource
*/
public static function create($params = null, $options = null)
{
self::_validateParams($params);
$url = static::classUrl();
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* Returns a list of Tax <code>Registration</code> objects.
*
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\Tax\Registration> of ApiResources
*/
public static function all($params = null, $opts = null)
{
$url = static::classUrl();
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
}
/**
* Returns a Tax <code>Registration</code> object.
*
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Tax\Registration
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();
return $instance;
}
/**
* Updates an existing Tax <code>Registration</code> object.
*
* A registration cannot be deleted after it has been created. If you wish to end a
* registration you may do so by setting <code>expires_at</code>.
*
* @param string $id the ID of the resource to update
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Tax\Registration the updated resource
*/
public static function update($id, $params = null, $opts = null)
{
self::_validateParams($params);
$url = static::resourceUrl($id);
list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
}

View File

@@ -0,0 +1,86 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Tax;
/**
* You can use Tax <code>Settings</code> to manage configurations used by Stripe Tax calculations.
*
* Related guide: <a href="https://stripe.com/docs/tax/settings-api">Using the Settings API</a>
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property \Stripe\StripeObject $defaults
* @property null|\Stripe\StripeObject $head_office The place where your business is located.
* @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.
* @property string $status The status of the Tax <code>Settings</code>.
* @property \Stripe\StripeObject $status_details
*/
class Settings extends \Stripe\SingletonApiResource
{
const OBJECT_NAME = 'tax.settings';
const STATUS_ACTIVE = 'active';
const STATUS_PENDING = 'pending';
/**
* Retrieves Tax <code>Settings</code> for a merchant.
*
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Tax\Settings
*/
public static function retrieve($opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$instance = new static(null, $opts);
$instance->refresh();
return $instance;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return static the updated resource
*/
public static function update($params = null, $opts = null)
{
self::_validateParams($params);
$url = '/v1/tax/settings';
list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return static the saved resource
*
* @deprecated The `save` method is deprecated and will be removed in a
* future major version of the library. Use the static method `update`
* on the resource instead.
*/
public function save($opts = null)
{
$params = $this->serializeParameters();
if (\count($params) > 0) {
$url = $this->instanceUrl();
list($response, $opts) = $this->_request('post', $url, $params, $opts, ['save']);
$this->refreshFrom($response, $opts);
}
return $this;
}
}

View File

@@ -0,0 +1,109 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Tax;
/**
* A Tax Transaction records the tax collected from or refunded to your customer.
*
* Related guide: <a href="https://stripe.com/docs/tax/custom#tax-transaction">Calculate tax in your custom payment flow</a>
*
* @property string $id Unique identifier for the transaction.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property null|string $customer The ID of an existing <a href="https://stripe.com/docs/api/customers/object">Customer</a> used for the resource.
* @property \Stripe\StripeObject $customer_details
* @property null|\Stripe\Collection<\Stripe\Tax\TransactionLineItem> $line_items The tax collected or refunded, by line item.
* @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.
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property int $posted_at The Unix timestamp representing when the tax liability is assumed or reduced.
* @property string $reference A custom unique identifier, such as 'myOrder_123'.
* @property null|\Stripe\StripeObject $reversal If <code>type=reversal</code>, contains information about what was reversed.
* @property null|\Stripe\StripeObject $ship_from_details The details of the ship from location, such as the address.
* @property null|\Stripe\StripeObject $shipping_cost The shipping cost details for the transaction.
* @property int $tax_date Timestamp of date at which the tax rules and rates in effect applies for the calculation.
* @property string $type If <code>reversal</code>, this transaction reverses an earlier transaction.
*/
class Transaction extends \Stripe\ApiResource
{
const OBJECT_NAME = 'tax.transaction';
const TYPE_REVERSAL = 'reversal';
const TYPE_TRANSACTION = 'transaction';
/**
* Retrieves a Tax <code>Transaction</code> object.
*
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Tax\Transaction
*/
public static function retrieve($id, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$instance = new static($id, $opts);
$instance->refresh();
return $instance;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Tax\Transaction the created transaction
*/
public static function createFromCalculation($params = null, $opts = null)
{
$url = static::classUrl() . '/create_from_calculation';
list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Tax\Transaction the created transaction
*/
public static function createReversal($params = null, $opts = null)
{
$url = static::classUrl() . '/create_reversal';
list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* @param string $id
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\Tax\TransactionLineItem> list of transaction line items
*/
public static function allLineItems($id, $params = null, $opts = null)
{
$url = static::resourceUrl($id) . '/line_items';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
}

View File

@@ -0,0 +1,31 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe\Tax;
/**
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $amount The line item amount in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. If <code>tax_behavior=inclusive</code>, then this amount includes taxes. Otherwise, taxes were calculated on top of this amount.
* @property int $amount_tax The amount of tax calculated for this line item, in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
* @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.
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|string $product The ID of an existing <a href="https://stripe.com/docs/api/products/object">Product</a>.
* @property int $quantity The number of units of the item being purchased. For reversals, this is the quantity reversed.
* @property string $reference A custom identifier for this line item in the transaction.
* @property null|\Stripe\StripeObject $reversal If <code>type=reversal</code>, contains information about what was reversed.
* @property string $tax_behavior Specifies whether the <code>amount</code> includes taxes. If <code>tax_behavior=inclusive</code>, then the amount includes taxes.
* @property string $tax_code The <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID used for this resource.
* @property string $type If <code>reversal</code>, this line item reverses an earlier transaction.
*/
class TransactionLineItem extends \Stripe\ApiResource
{
const OBJECT_NAME = 'tax.transaction_line_item';
const TAX_BEHAVIOR_EXCLUSIVE = 'exclusive';
const TAX_BEHAVIOR_INCLUSIVE = 'inclusive';
const TYPE_REVERSAL = 'reversal';
const TYPE_TRANSACTION = 'transaction';
}