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 #1634

Merged
merged 15 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v756
v796
9 changes: 4 additions & 5 deletions lib/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
* enabled to make live charges or receive payouts.
*
* For Custom accounts, the properties below are always returned. For other accounts, some properties are returned until that
* account has started to go through Connect Onboarding. Once you create an <a href="https://stripe.com/docs/api/account_links">Account Link</a>
* for a Standard or Express account, some parameters are no longer returned. These are marked as <strong>Custom Only</strong> or <strong>Custom and Express</strong>
* below. Learn about the differences <a href="https://stripe.com/docs/connect/accounts">between accounts</a>.
* account has started to go through Connect Onboarding. Once you create an <a href="https://stripe.com/docs/api/account_links">Account Link</a> or <a href="https://stripe.com/docs/api/account_sessions">Account Session</a>,
* some properties are only returned for Custom accounts. Learn about the differences <a href="https://stripe.com/docs/connect/accounts">between accounts</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 null|\Stripe\StripeObject $business_profile Business information about the account.
* @property null|string $business_type The business type.
* @property null|string $business_type The business type. Once you create an <a href="https://stripe.com/docs/api/account_links">Account Link</a> or <a href="https://stripe.com/docs/api/account_sessions">Account Session</a>, this property is only returned for Custom accounts.
* @property null|\Stripe\StripeObject $capabilities
* @property null|bool $charges_enabled Whether the account can create live charges.
* @property null|\Stripe\StripeObject $company
Expand All @@ -27,7 +26,7 @@
* @property null|string $default_currency Three-letter ISO currency code representing the default currency for the account. This must be a currency that <a href="https://stripe.com/docs/payouts">Stripe supports in the account's country</a>.
* @property null|bool $details_submitted Whether account details have been submitted. Standard accounts cannot receive payouts before this is true.
* @property null|string $email An email address associated with the account. It's not used for authentication and Stripe doesn't market to this field without explicit approval from the platform.
* @property null|\Stripe\Collection<\Stripe\BankAccount|\Stripe\Card> $external_accounts External accounts (bank accounts and debit cards) currently attached to this account
* @property null|\Stripe\Collection<\Stripe\BankAccount|\Stripe\Card> $external_accounts External accounts (bank accounts and debit cards) currently attached to this account. External accounts are only returned for requests where <code>controller[is_controller]</code> is true.
* @property null|\Stripe\StripeObject $future_requirements
* @property null|\Stripe\Person $individual <p>This is an object representing a person associated with a Stripe account.</p><p>A platform cannot access a Standard or Express account's persons after the account starts onboarding, such as after generating an account link for the account. See the <a href="https://stripe.com/docs/connect/standard-accounts">Standard onboarding</a> or <a href="https://stripe.com/docs/connect/express-accounts">Express onboarding documentation</a> for information about platform prefilling and account onboarding steps.</p><p>Related guide: <a href="https://stripe.com/docs/connect/handling-api-verification#person-information">Handling identity verification with the API</a></p>
* @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.
Expand Down
13 changes: 1 addition & 12 deletions lib/ApiOperations/All.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,8 @@ trait All
*/
public static function all($params = null, $opts = null)
{
self::_validateParams($params);
$url = static::classUrl();

list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
if (!($obj instanceof \Stripe\Collection)) {
throw new \Stripe\Exception\UnexpectedValueException(
'Expected type ' . \Stripe\Collection::class . ', got "' . \get_class($obj) . '" instead.'
);
}
$obj->setLastResponse($response);
$obj->setFilters($params);

return $obj;
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
}
}
34 changes: 31 additions & 3 deletions lib/ApiOperations/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ protected static function _validateParams($params = null)
{
if ($params && !\is_array($params)) {
$message = 'You must pass an array as the first argument to Stripe API '
. 'method calls. (HINT: an example call to create a charge '
. "would be: \"Stripe\\Charge::create(['amount' => 100, "
. "'currency' => 'usd', 'source' => 'tok_1234'])\")";
. 'method calls. (HINT: an example call to create a charge '
. "would be: \"Stripe\\Charge::create(['amount' => 100, "
. "'currency' => 'usd', 'source' => 'tok_1234'])\")";

throw new \Stripe\Exception\InvalidArgumentException($message);
}
Expand All @@ -46,6 +46,34 @@ protected function _request($method, $url, $params = [], $options = null, $usage
return [$resp->json, $options];
}

/**
* @param string $url URL for the request
* @param class-string< \Stripe\SearchResult|\Stripe\Collection > $resultClass indicating what type of paginated result is returned
* @param null|array $params list of parameters for the request
* @param null|array|string $options
* @param string[] $usage names of tracked behaviors associated with this request
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection|\Stripe\SearchResult
*/
protected static function _requestPage($url, $resultClass, $params = null, $options = null, $usage = [])
{
self::_validateParams($params);

list($response, $opts) = static::_staticRequest('get', $url, $params, $options, $usage);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
if (!($obj instanceof $resultClass)) {
throw new \Stripe\Exception\UnexpectedValueException(
'Expected type ' . $resultClass . ', got "' . \get_class($obj) . '" instead.'
);
}
$obj->setLastResponse($response);
$obj->setFilters($params);

return $obj;
}

/**
* @param 'delete'|'get'|'post' $method HTTP method ('get', 'post', etc.)
* @param string $url URL for the request
Expand Down
14 changes: 1 addition & 13 deletions lib/ApiOperations/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@ trait Search
*/
protected static function _searchResource($searchUrl, $params = null, $opts = null)
{
self::_validateParams($params);

list($response, $opts) = static::_staticRequest('get', $searchUrl, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
if (!($obj instanceof \Stripe\SearchResult)) {
throw new \Stripe\Exception\UnexpectedValueException(
'Expected type ' . \Stripe\SearchResult::class . ', got "' . \get_class($obj) . '" instead.'
);
}
$obj->setLastResponse($response);
$obj->setFilters($params);

return $obj;
return static::_requestPage($searchUrl, \Stripe\SearchResult::class, $params, $opts);
}
}
1 change: 1 addition & 0 deletions lib/Capital/FinancingOffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* @property string $object The object type: financing_offer.
* @property null|\Stripe\StripeObject $accepted_terms This is an object representing the terms of an offer of financing from Stripe Capital to a Connected account. This resource represents the terms accepted by the Connected account, which may differ from those offered.
* @property string $account The ID of the merchant associated with this financing object.
* @property null|int $charged_off_at The time at which this financing offer was charged off, if applicable. Given in seconds since unix epoch.
* @property int $created Time at which the offer was created. Given in seconds since unix epoch.
* @property float $expires_after Time at which the offer expires. Given in seconds since unix epoch.
* @property null|string $financing_type The type of financing being offered.
Expand Down
2 changes: 1 addition & 1 deletion lib/Charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,6 @@ public static function search($params = null, $opts = null)
{
$url = '/v1/charges/search';

return self::_searchResource($url, $params, $opts);
return static::_requestPage($url, \Stripe\SearchResult::class, $params, $opts);
}
}
2 changes: 1 addition & 1 deletion lib/Checkout/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|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|\Stripe\StripeObject $currency_conversion Currency conversion details for automatic currency conversion sessions
* @property \Stripe\StripeObject[] $custom_fields Collect additional information from your customer using custom fields. Up to 2 fields are supported.
* @property \Stripe\StripeObject[] $custom_fields Collect additional information from your customer using custom fields. Up to 3 fields are supported.
* @property \Stripe\StripeObject $custom_text
* @property null|string|\Stripe\Customer $customer The ID of the customer for this Session. For Checkout Sessions in <code>subscription</code> mode or Checkout Sessions with <code>customer_creation</code> set as <code>always</code> in <code>payment</code> mode, Checkout will create a new customer object based on information provided during the payment flow unless an existing customer was provided when the Session was created.
* @property null|string $customer_creation Configure whether a Checkout Session creates a Customer when the Checkout Session completes.
Expand Down
2 changes: 1 addition & 1 deletion lib/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public static function search($params = null, $opts = null)
{
$url = '/v1/customers/search';

return self::_searchResource($url, $params, $opts);
return static::_requestPage($url, \Stripe\SearchResult::class, $params, $opts);
}

const PATH_CASH_BALANCE = '/cash_balance';
Expand Down
1 change: 1 addition & 0 deletions lib/Dispute.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @property string|\Stripe\Charge $charge ID of the charge that's disputed.
* @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[] $enhanced_eligibility_types List of eligibility types that are included in <code>enhanced_evidence</code>.
* @property \Stripe\StripeObject $evidence
* @property \Stripe\StripeObject $evidence_details
* @property bool $is_charge_refundable If true, it's still possible to refund the disputed payment. After the payment has been fully refunded, no further funds are withdrawn from your Stripe account as a result of this dispute.
Expand Down
22 changes: 20 additions & 2 deletions lib/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
* @property null|\Stripe\StripeObject $from_invoice Details of the invoice that was cloned. See the <a href="https://stripe.com/docs/invoicing/invoice-revisions">revision documentation</a> for more details.
* @property null|string $hosted_invoice_url The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null.
* @property null|string $invoice_pdf The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null.
* @property null|\Stripe\StripeObject $issuer
* @property \Stripe\StripeObject $issuer
* @property null|\Stripe\StripeObject $last_finalization_error The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized.
* @property null|string|\Stripe\Invoice $latest_revision The ID of the most recent non-draft revision of this invoice
* @property \Stripe\Collection<\Stripe\InvoiceLineItem> $lines The individual line items that make up the invoice. <code>lines</code> is sorted as follows: (1) pending invoice items (including prorations) in reverse chronological order, (2) subscription items in reverse chronological order, and (3) invoice items added after invoice creation in chronological order.
Expand Down Expand Up @@ -181,6 +181,24 @@ public function attachPaymentIntent($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\Invoice the created invoice
*/
public static function createPreview($params = null, $opts = null)
{
$url = static::classUrl() . '/create_preview';
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
Expand Down Expand Up @@ -314,7 +332,7 @@ public static function search($params = null, $opts = null)
{
$url = '/v1/invoices/search';

return self::_searchResource($url, $params, $opts);
return static::_requestPage($url, \Stripe\SearchResult::class, $params, $opts);
}

const PATH_PAYMENTS = '/payments';
Expand Down
2 changes: 1 addition & 1 deletion lib/PaymentIntent.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,6 @@ public static function search($params = null, $opts = null)
{
$url = '/v1/payment_intents/search';

return self::_searchResource($url, $params, $opts);
return static::_requestPage($url, \Stripe\SearchResult::class, $params, $opts);
}
}
2 changes: 1 addition & 1 deletion lib/PaymentLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @property string $billing_address_collection Configuration for collecting the customer's billing address.
* @property null|\Stripe\StripeObject $consent_collection When set, provides configuration to gather active consent from customers.
* @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 \Stripe\StripeObject[] $custom_fields Collect additional information from your customer using custom fields. Up to 2 fields are supported.
* @property \Stripe\StripeObject[] $custom_fields Collect additional information from your customer using custom fields. Up to 3 fields are supported.
* @property \Stripe\StripeObject $custom_text
* @property string $customer_creation Configuration for Customer creation during checkout.
* @property null|string $inactive_message The custom message to be displayed to a customer when a payment link is no longer active.
Expand Down
1 change: 1 addition & 0 deletions lib/PaymentMethodConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* @property null|\Stripe\StripeObject $card
* @property null|\Stripe\StripeObject $cartes_bancaires
* @property null|\Stripe\StripeObject $cashapp
* @property null|\Stripe\StripeObject $customer_balance
* @property null|\Stripe\StripeObject $eps
* @property null|\Stripe\StripeObject $fpx
* @property null|\Stripe\StripeObject $giropay
Expand Down
2 changes: 1 addition & 1 deletion lib/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ public static function search($params = null, $opts = null)
{
$url = '/v1/prices/search';

return self::_searchResource($url, $params, $opts);
return static::_requestPage($url, \Stripe\SearchResult::class, $params, $opts);
}
}
2 changes: 1 addition & 1 deletion lib/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ public static function search($params = null, $opts = null)
{
$url = '/v1/products/search';

return self::_searchResource($url, $params, $opts);
return static::_requestPage($url, \Stripe\SearchResult::class, $params, $opts);
}
}
2 changes: 1 addition & 1 deletion lib/QuotePreviewInvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
* @property null|int $ending_balance Ending customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null.
* @property null|string $footer Footer displayed on the invoice.
* @property null|\Stripe\StripeObject $from_invoice Details of the invoice that was cloned. See the <a href="https://stripe.com/docs/invoicing/invoice-revisions">revision documentation</a> for more details.
* @property null|\Stripe\StripeObject $issuer
* @property \Stripe\StripeObject $issuer
* @property null|\Stripe\StripeObject $last_finalization_error The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized.
* @property null|string|\Stripe\Invoice $latest_revision The ID of the most recent non-draft revision of this invoice
* @property \Stripe\Collection<\Stripe\InvoiceLineItem> $lines The individual line items that make up the invoice. <code>lines</code> is sorted as follows: (1) pending invoice items (including prorations) in reverse chronological order, (2) subscription items in reverse chronological order, and (3) invoice items added after invoice creation in chronological order.
Expand Down
6 changes: 3 additions & 3 deletions lib/Service/AccountService.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ public function retrievePerson($parentId, $id, $params = null, $opts = null)
* For Custom accounts, you can update any information on the account. For other
* accounts, you can update all information until that account has started to go
* through Connect Onboarding. Once you create an <a
* href="/docs/api/account_links">Account Link</a> for a Standard or Express
* account, some parameters can no longer be changed. These are marked as
* <strong>Custom Only</strong> or <strong>Custom and Express</strong> below.
* href="/docs/api/account_links">Account Link</a> or <a
* href="/docs/api/account_sessions">Account Session</a>, some properties can only
* be changed or updated for Custom accounts.
*
* To update your own account, use the <a
* href="https://dashboard.stripe.com/settings/account">Dashboard</a>. Refer to our
Expand Down
8 changes: 4 additions & 4 deletions lib/Service/ChargeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public function capture($id, $params = null, $opts = null)
}

/**
* Use the <a href="/docs/api/payment_intents">Payment Intents API</a> to initiate
* a new payment instead of using this method. Confirmation of the PaymentIntent
* creates the <code>Charge</code> object used to request payment, so this method
* is limited to legacy integrations.
* This method is no longer recommended—use the <a
* href="/docs/api/payment_intents">Payment Intents API</a> to initiate a new
* payment instead. Confirmation of the PaymentIntent creates the
* <code>Charge</code> object used to request payment.
*
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
Expand Down
Loading
Loading