Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generated code for beta (new) #1459

Merged
merged 10 commits into from
Mar 23, 2023
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v264
v277
2 changes: 2 additions & 0 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
1 change: 1 addition & 0 deletions lib/Capital/FinancingSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -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. <a href="https://stripe.com/docs/api/capital/financing_summary">/v1/capital/financing_summary</a> will only return <code>details</code> for <code>paid_out</code> financing.
*/
class FinancingSummary extends \Stripe\SingletonApiResource
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/Tax/CalculationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/Tax/TransactionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
16 changes: 16 additions & 0 deletions lib/Service/Terminal/ReaderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>Reader</code> object.
*
Expand Down
1 change: 1 addition & 0 deletions lib/SetupIntent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <p>If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.</p><p>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.</p>
* @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 <code>abandoned</code>, <code>requested_by_customer</code>, or <code>duplicate</code>.
* @property null|string $client_secret <p>The client secret of this SetupIntent. Used for client-side retrieval using a publishable key.</p><p>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.</p>
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
Expand Down
6 changes: 3 additions & 3 deletions lib/Tax/Calculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* @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. 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 <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 $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.
Expand All @@ -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)
{
Expand Down
26 changes: 26 additions & 0 deletions lib/Tax/CalculationLineItem.php
Original file line number Diff line number Diff line change
@@ -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 integer cents. 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 integer cents.
* @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 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 <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';
}
7 changes: 3 additions & 4 deletions lib/Tax/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
namespace Stripe\Tax;

/**
* A Tax <code>Transaction</code> 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.
* @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\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 <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 string $reference A custom unique identifier, such as 'myOrder_123'.
Expand Down Expand Up @@ -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)
{
Expand Down
30 changes: 30 additions & 0 deletions lib/Tax/TransactionLineItem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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 integer cents. 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 integer cents.
* @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 $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';
}
17 changes: 17 additions & 0 deletions lib/Terminal/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/Util/ObjectTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
35 changes: 35 additions & 0 deletions tests/Stripe/GeneratedExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}