diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index d077c8303..ccddf6542 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v264 \ No newline at end of file +v277 \ No newline at end of file diff --git a/init.php b/init.php index 2659b9109..446610108 100644 --- a/init.php +++ b/init.php @@ -169,9 +169,11 @@ require __DIR__ . '/lib/SubscriptionItem.php'; require __DIR__ . '/lib/SubscriptionSchedule.php'; require __DIR__ . '/lib/Tax/Calculation.php'; +require __DIR__ . '/lib/Tax/CalculationLineItem.php'; require __DIR__ . '/lib/Tax/Registration.php'; require __DIR__ . '/lib/Tax/Settings.php'; require __DIR__ . '/lib/Tax/Transaction.php'; +require __DIR__ . '/lib/Tax/TransactionLineItem.php'; require __DIR__ . '/lib/TaxCode.php'; require __DIR__ . '/lib/TaxId.php'; require __DIR__ . '/lib/TaxRate.php'; diff --git a/lib/Capital/FinancingSummary.php b/lib/Capital/FinancingSummary.php index dc72b61d6..7d009235d 100644 --- a/lib/Capital/FinancingSummary.php +++ b/lib/Capital/FinancingSummary.php @@ -11,6 +11,7 @@ * * @property string $object The object type: financing_summary * @property null|\Stripe\StripeObject $details Additional information about the financing summary. Describes currency, advance amount, fee amount, withhold rate, remaining amount, paid amount, current repayment interval, repayment start date, and advance payout date. + * @property null|string $financing_offer The Financing Offer ID this Financing Summary corresponds to * @property null|string $status Status of the Connected Account's financing. /v1/capital/financing_summary will only return details for paid_out financing. */ class FinancingSummary extends \Stripe\SingletonApiResource diff --git a/lib/Service/Tax/CalculationService.php b/lib/Service/Tax/CalculationService.php index 498b2c286..dfb4b9046 100644 --- a/lib/Service/Tax/CalculationService.php +++ b/lib/Service/Tax/CalculationService.php @@ -15,7 +15,7 @@ class CalculationService extends \Stripe\Service\AbstractService * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\LineItem> + * @return \Stripe\Collection<\Stripe\Tax\CalculationLineItem> */ public function allLineItems($id, $params = null, $opts = null) { diff --git a/lib/Service/Tax/TransactionService.php b/lib/Service/Tax/TransactionService.php index b4b865fa1..f8e65fd32 100644 --- a/lib/Service/Tax/TransactionService.php +++ b/lib/Service/Tax/TransactionService.php @@ -15,7 +15,7 @@ class TransactionService extends \Stripe\Service\AbstractService * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\LineItem> + * @return \Stripe\Collection<\Stripe\Tax\TransactionLineItem> */ public function allLineItems($id, $params = null, $opts = null) { diff --git a/lib/Service/Terminal/ReaderService.php b/lib/Service/Terminal/ReaderService.php index 1f40f8c23..b0df7c46c 100644 --- a/lib/Service/Terminal/ReaderService.php +++ b/lib/Service/Terminal/ReaderService.php @@ -37,6 +37,22 @@ public function cancelAction($id, $params = null, $opts = null) return $this->request('post', $this->buildPath('/v1/terminal/readers/%s/cancel_action', $id), $params, $opts); } + /** + * Initiates an input collection flow on a Reader. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Terminal\Reader + */ + public function collectInputs($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/terminal/readers/%s/collect_inputs', $id), $params, $opts); + } + /** * Creates a new Reader object. * diff --git a/lib/SetupIntent.php b/lib/SetupIntent.php index a21573685..2e9c7a00e 100644 --- a/lib/SetupIntent.php +++ b/lib/SetupIntent.php @@ -44,6 +44,7 @@ * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string|\Stripe\StripeObject $application ID of the Connect application that created the SetupIntent. * @property null|bool $attach_to_self

If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.

It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.

+ * @property null|\Stripe\StripeObject $automatic_payment_methods Settings for automatic payment methods compatible with this Setup Intent * @property null|string $cancellation_reason Reason for cancellation of this SetupIntent, one of abandoned, requested_by_customer, or duplicate. * @property null|string $client_secret

The client secret of this SetupIntent. Used for client-side retrieval using a publishable key.

The client secret can be used to complete payment setup from your frontend. It should not be stored, logged, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.

* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. diff --git a/lib/Tax/Calculation.php b/lib/Tax/Calculation.php index 392be6298..c8ab80d5a 100644 --- a/lib/Tax/Calculation.php +++ b/lib/Tax/Calculation.php @@ -14,8 +14,8 @@ * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. * @property null|string $customer The ID of an existing Customer used for the resource. * @property \Stripe\StripeObject $customer_details - * @property null|int $expires_at Timestamp of date at which the tax calculation will expire. Empty if the calculation is an unsaved preview. - * @property null|\Stripe\Collection<\Stripe\LineItem> $line_items The list of items the customer is purchasing. + * @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 true if the object exists in live mode or the value false if the object exists in test mode. * @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. @@ -36,7 +36,7 @@ class Calculation extends \Stripe\ApiResource * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\LineItem> list of TaxProductResourceTaxCalculationLineItems + * @return \Stripe\Collection<\Stripe\Tax\CalculationLineItem> list of TaxProductResourceTaxCalculationLineItems */ public static function allLineItems($id, $params = null, $opts = null) { diff --git a/lib/Tax/CalculationLineItem.php b/lib/Tax/CalculationLineItem.php new file mode 100644 index 000000000..38280aa5b --- /dev/null +++ b/lib/Tax/CalculationLineItem.php @@ -0,0 +1,26 @@ +tax_behavior=inclusive, 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 integer cents. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|string $product A Product ID. + * @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 amount includes taxes. If tax_behavior=inclusive, 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 tax code 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'; +} diff --git a/lib/Tax/Transaction.php b/lib/Tax/Transaction.php index 536b9197f..38fc6801f 100644 --- a/lib/Tax/Transaction.php +++ b/lib/Tax/Transaction.php @@ -5,8 +5,7 @@ namespace Stripe\Tax; /** - * A Tax Transaction records the tax collected from or refunded to - * your customer. + * A Tax transaction records the tax collected from or refunded to your customer. * * @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. @@ -14,7 +13,7 @@ * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. * @property null|string $customer The ID of an existing Customer used for the resource. * @property \Stripe\StripeObject $customer_details - * @property null|\Stripe\Collection<\Stripe\LineItem> $line_items The tax collected or refunded, by line item. + * @property null|\Stripe\Collection<\Stripe\Tax\TransactionLineItem> $line_items The tax collected or refunded, by line item. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $reference A custom unique identifier, such as 'myOrder_123'. @@ -76,7 +75,7 @@ public static function createReversal($params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\LineItem> list of TaxProductResourceTaxTransactionLineItems + * @return \Stripe\Collection<\Stripe\Tax\TransactionLineItem> list of TaxProductResourceTaxTransactionLineItems */ public static function allLineItems($id, $params = null, $opts = null) { diff --git a/lib/Tax/TransactionLineItem.php b/lib/Tax/TransactionLineItem.php new file mode 100644 index 000000000..f5db49205 --- /dev/null +++ b/lib/Tax/TransactionLineItem.php @@ -0,0 +1,30 @@ +tax_behavior=inclusive, 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 integer cents. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @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 type=reversal, contains information about what was reversed. + * @property string $tax_behavior Specifies whether the amount includes taxes. If tax_behavior=inclusive, then the amount includes taxes. + * @property string $tax_code The tax code ID used for this resource. + * @property string $type If reversal, 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'; +} diff --git a/lib/Terminal/Reader.php b/lib/Terminal/Reader.php index 361a28e02..a50c942b6 100644 --- a/lib/Terminal/Reader.php +++ b/lib/Terminal/Reader.php @@ -51,6 +51,23 @@ public function cancelAction($params = null, $opts = null) return $this; } + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Terminal\Reader the collected reader + */ + public function collectInputs($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/collect_inputs'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + /** * @param null|array $params * @param null|array|string $opts diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index ba403033e..c81da1e56 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -101,9 +101,11 @@ class ObjectTypes \Stripe\SubscriptionItem::OBJECT_NAME => \Stripe\SubscriptionItem::class, \Stripe\SubscriptionSchedule::OBJECT_NAME => \Stripe\SubscriptionSchedule::class, \Stripe\Tax\Calculation::OBJECT_NAME => \Stripe\Tax\Calculation::class, + \Stripe\Tax\CalculationLineItem::OBJECT_NAME => \Stripe\Tax\CalculationLineItem::class, \Stripe\Tax\Registration::OBJECT_NAME => \Stripe\Tax\Registration::class, \Stripe\Tax\Settings::OBJECT_NAME => \Stripe\Tax\Settings::class, \Stripe\Tax\Transaction::OBJECT_NAME => \Stripe\Tax\Transaction::class, + \Stripe\Tax\TransactionLineItem::OBJECT_NAME => \Stripe\Tax\TransactionLineItem::class, \Stripe\TaxCode::OBJECT_NAME => \Stripe\TaxCode::class, \Stripe\TaxId::OBJECT_NAME => \Stripe\TaxId::class, \Stripe\TaxRate::OBJECT_NAME => \Stripe\TaxRate::class, diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index 06101c289..75a347962 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -4010,4 +4010,39 @@ public function testUpdateWebhookEndpoint() ); static::assertInstanceOf(\Stripe\WebhookEndpoint::class, $result); } + + public function testCreateFromCalculationTransaction() + { + $this->expectsRequest( + 'post', + '/v1/tax/transactions/create_from_calculation' + ); + $result = $this->client->tax->transactions->createFromCalculation( + ['calculation' => 'xxx', 'reference' => 'yyy'] + ); + static::assertInstanceOf(\Stripe\Tax\Transaction::class, $result); + } + + public function testListLineItemsCalculation() + { + $this->expectsRequest('get', '/v1/tax/calculations/xxx/line_items'); + $result = $this->client->tax->calculations->allLineItems('xxx', []); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Tax\CalculationLineItem::class, $result->data[0]); + } + + public function testPreviewInvoiceLinesQuote() + { + $this->expectsRequest( + 'get', + '/v1/quotes/qt_xyz/preview_invoices/in_xyz/lines' + ); + $result = $this->client->quotes->previewInvoiceLines( + 'qt_xyz', + 'in_xyz', + [] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\InvoiceLineItem::class, $result->data[0]); + } }