Calculation.php
7 months ago
CalculationLineItem.php
7 months ago
Registration.php
7 months ago
Settings.php
7 months ago
Transaction.php
7 months ago
TransactionLineItem.php
7 months ago
Transaction.php
110 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | |
| 5 | namespace AmeliaVendor\Stripe\Tax; |
| 6 | |
| 7 | /** |
| 8 | * A Tax Transaction records the tax collected from or refunded to your customer. |
| 9 | * |
| 10 | * Related guide: <a href="https://stripe.com/docs/tax/custom#tax-transaction">Calculate tax in your custom payment flow</a> |
| 11 | * |
| 12 | * @property string $id Unique identifier for the transaction. |
| 13 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 14 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. |
| 15 | * @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>. |
| 16 | * @property null|string $customer The ID of an existing <a href="https://stripe.com/docs/api/customers/object">Customer</a> used for the resource. |
| 17 | * @property (object{address: null|(object{city: null|string, country: string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&\AmeliaVendor\Stripe\StripeObject), address_source: null|string, ip_address: null|string, tax_ids: (object{type: string, value: string}&\AmeliaVendor\Stripe\StripeObject)[], taxability_override: string}&\AmeliaVendor\Stripe\StripeObject) $customer_details |
| 18 | * @property null|\AmeliaVendor\Stripe\Collection<TransactionLineItem> $line_items The tax collected or refunded, by line item. |
| 19 | * @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. |
| 20 | * @property null|\AmeliaVendor\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. |
| 21 | * @property int $posted_at The Unix timestamp representing when the tax liability is assumed or reduced. |
| 22 | * @property string $reference A custom unique identifier, such as 'myOrder_123'. |
| 23 | * @property null|(object{original_transaction: null|string}&\AmeliaVendor\Stripe\StripeObject) $reversal If <code>type=reversal</code>, contains information about what was reversed. |
| 24 | * @property null|(object{address: (object{city: null|string, country: string, line1: null|string, line2: null|string, postal_code: null|string, state: null|string}&\AmeliaVendor\Stripe\StripeObject)}&\AmeliaVendor\Stripe\StripeObject) $ship_from_details The details of the ship from location, such as the address. |
| 25 | * @property null|(object{amount: int, amount_tax: int, shipping_rate?: string, tax_behavior: string, tax_breakdown?: ((object{amount: int, jurisdiction: (object{country: string, display_name: string, level: string, state: null|string}&\AmeliaVendor\Stripe\StripeObject), sourcing: string, tax_rate_details: null|(object{display_name: string, percentage_decimal: string, tax_type: string}&\AmeliaVendor\Stripe\StripeObject), taxability_reason: string, taxable_amount: int}&\AmeliaVendor\Stripe\StripeObject))[], tax_code: string}&\AmeliaVendor\Stripe\StripeObject) $shipping_cost The shipping cost details for the transaction. |
| 26 | * @property int $tax_date Timestamp of date at which the tax rules and rates in effect applies for the calculation. |
| 27 | * @property string $type If <code>reversal</code>, this transaction reverses an earlier transaction. |
| 28 | */ |
| 29 | class Transaction extends \AmeliaVendor\Stripe\ApiResource |
| 30 | { |
| 31 | const OBJECT_NAME = 'tax.transaction'; |
| 32 | |
| 33 | const TYPE_REVERSAL = 'reversal'; |
| 34 | const TYPE_TRANSACTION = 'transaction'; |
| 35 | |
| 36 | /** |
| 37 | * Retrieves a Tax <code>Transaction</code> object. |
| 38 | * |
| 39 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 40 | * @param null|array|string $opts |
| 41 | * |
| 42 | * @return Transaction |
| 43 | * |
| 44 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 45 | */ |
| 46 | public static function retrieve($id, $opts = null) |
| 47 | { |
| 48 | $opts = \AmeliaVendor\Stripe\Util\RequestOptions::parse($opts); |
| 49 | $instance = new static($id, $opts); |
| 50 | $instance->refresh(); |
| 51 | |
| 52 | return $instance; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * @param null|array $params |
| 57 | * @param null|array|string $opts |
| 58 | * |
| 59 | * @return Transaction the created transaction |
| 60 | * |
| 61 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 62 | */ |
| 63 | public static function createFromCalculation($params = null, $opts = null) |
| 64 | { |
| 65 | $url = static::classUrl() . '/create_from_calculation'; |
| 66 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 67 | $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 68 | $obj->setLastResponse($response); |
| 69 | |
| 70 | return $obj; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * @param null|array $params |
| 75 | * @param null|array|string $opts |
| 76 | * |
| 77 | * @return Transaction the created transaction |
| 78 | * |
| 79 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 80 | */ |
| 81 | public static function createReversal($params = null, $opts = null) |
| 82 | { |
| 83 | $url = static::classUrl() . '/create_reversal'; |
| 84 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 85 | $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 86 | $obj->setLastResponse($response); |
| 87 | |
| 88 | return $obj; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * @param string $id |
| 93 | * @param null|array $params |
| 94 | * @param null|array|string $opts |
| 95 | * |
| 96 | * @return \AmeliaVendor\Stripe\Collection<TransactionLineItem> list of transaction line items |
| 97 | * |
| 98 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 99 | */ |
| 100 | public static function allLineItems($id, $params = null, $opts = null) |
| 101 | { |
| 102 | $url = static::resourceUrl($id) . '/line_items'; |
| 103 | list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); |
| 104 | $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 105 | $obj->setLastResponse($response); |
| 106 | |
| 107 | return $obj; |
| 108 | } |
| 109 | } |
| 110 |