Bump stripe-php from 16.4.0 to 17.2.1

This commit is contained in:
johnnyq
2025-05-22 12:37:35 -04:00
parent 5361391b3b
commit 6a368840fa
332 changed files with 4978 additions and 4624 deletions

View File

@@ -6,21 +6,22 @@ namespace Stripe\Service;
/**
* @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*
* @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
*/
class InvoiceService extends \Stripe\Service\AbstractService
class InvoiceService extends AbstractService
{
/**
* Adds multiple line items to an invoice. This is only possible when an invoice is
* still a draft.
*
* @param string $id
* @param null|array $params
* @param null|array{expand?: string[], invoice_metadata?: null|array<string, string>, lines: (array{amount?: int, description?: string, discountable?: bool, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], invoice_item?: string, metadata?: null|array<string, string>, period?: array{end: int, start: int}, price_data?: array{currency: string, product?: string, product_data?: array{description?: string, images?: string[], metadata?: array<string, string>, name: string, tax_code?: string}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, pricing?: array{price?: string}, quantity?: int, tax_amounts?: null|array{amount: int, tax_rate_data: array{country?: string, description?: string, display_name: string, inclusive: bool, jurisdiction?: string, jurisdiction_level?: string, percentage: float, state?: string, tax_type?: string}, taxability_reason?: string, taxable_amount: int}[], tax_rates?: null|string[]})[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function addLines($id, $params = null, $opts = null)
{
@@ -32,12 +33,12 @@ class InvoiceService extends \Stripe\Service\AbstractService
* invoices are returned sorted by creation date, with the most recently created
* invoices appearing first.
*
* @param null|array $params
* @param null|array{collection_method?: string, created?: array|int, customer?: string, due_date?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, status?: string, subscription?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\Invoice>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function all($params = null, $opts = null)
{
@@ -51,12 +52,12 @@ class InvoiceService extends \Stripe\Service\AbstractService
* items.
*
* @param string $parentId
* @param null|array $params
* @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\InvoiceLineItem>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function allLines($parentId, $params = null, $opts = null)
{
@@ -69,12 +70,12 @@ class InvoiceService extends \Stripe\Service\AbstractService
* allows you to <a href="#pay_invoice">pay</a> or <a href="#send_invoice">send</a>
* the invoice to your customers.
*
* @param null|array $params
* @param null|array{account_tax_ids?: null|string[], application_fee_amount?: int, auto_advance?: bool, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, automatically_finalizes_at?: int, collection_method?: string, currency?: string, custom_fields?: null|array{name: string, value: string}[], customer?: string, days_until_due?: int, default_payment_method?: string, default_source?: string, default_tax_rates?: string[], description?: string, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], due_date?: int, effective_at?: int, expand?: string[], footer?: string, from_invoice?: array{action: string, invoice: string}, issuer?: array{account?: string, type: string}, metadata?: null|array<string, string>, number?: string, on_behalf_of?: string, payment_settings?: array{default_mandate?: null|string, payment_method_options?: array{acss_debit?: null|array{mandate_options?: array{transaction_type?: string}, verification_method?: string}, bancontact?: null|array{preferred_language?: string}, card?: null|array{installments?: array{enabled?: bool, plan?: null|array{count?: int, interval?: string, type: string}}, request_three_d_secure?: string}, customer_balance?: null|array{bank_transfer?: array{eu_bank_transfer?: array{country: string}, type?: string}, funding_type?: string}, konbini?: null|array{}, sepa_debit?: null|array{}, us_bank_account?: null|array{financial_connections?: array{filters?: array{account_subcategories?: string[]}, permissions?: string[], prefetch?: string[]}, verification_method?: string}}, payment_method_types?: null|string[]}, pending_invoice_items_behavior?: string, rendering?: array{amount_tax_display?: null|string, pdf?: array{page_size?: string}, template?: string, template_version?: null|int}, shipping_cost?: array{shipping_rate?: string, shipping_rate_data?: array{delivery_estimate?: array{maximum?: array{unit: string, value: int}, minimum?: array{unit: string, value: int}}, display_name: string, fixed_amount?: array{amount: int, currency: string, currency_options?: array<string, array{amount: int, tax_behavior?: string}>}, metadata?: array<string, string>, tax_behavior?: string, tax_code?: string, type?: string}}, shipping_details?: array{address: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, name: string, phone?: null|string}, statement_descriptor?: string, subscription?: string, transfer_data?: array{amount?: int, destination: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function create($params = null, $opts = null)
{
@@ -82,10 +83,10 @@ class InvoiceService extends \Stripe\Service\AbstractService
}
/**
* At any time, you can preview the upcoming invoice for a customer. This will show
* you all the charges that are pending, including subscription renewal charges,
* invoice item charges, etc. It will also show you any discounts that are
* applicable to the invoice.
* At any time, you can preview the upcoming invoice for a subscription or
* subscription schedule. This will show you all the charges that are pending,
* including subscription renewal charges, invoice item charges, etc. It will also
* show you any discounts that are applicable to the invoice.
*
* Note that when you are viewing an upcoming invoice, you are simply viewing a
* preview the invoice has not yet been created. As such, the upcoming invoice
@@ -108,12 +109,12 @@ class InvoiceService extends \Stripe\Service\AbstractService
* invoice creation. <a href="https://docs.stripe.com/currencies/conversions">Learn
* more</a>
*
* @param null|array $params
* @param null|array{automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, currency?: string, customer?: string, customer_details?: array{address?: null|array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, shipping?: null|array{address: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, name: string, phone?: string}, tax?: array{ip_address?: null|string}, tax_exempt?: null|string, tax_ids?: array{type: string, value: string}[]}, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], expand?: string[], invoice_items?: (array{amount?: int, currency?: string, description?: string, discountable?: bool, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], invoiceitem?: string, metadata?: null|array<string, string>, period?: array{end: int, start: int}, price?: string, price_data?: array{currency: string, product: string, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_behavior?: string, tax_code?: null|string, tax_rates?: null|string[], unit_amount?: int, unit_amount_decimal?: string})[], issuer?: array{account?: string, type: string}, on_behalf_of?: null|string, preview_mode?: string, schedule?: string, schedule_details?: array{end_behavior?: string, phases?: (array{add_invoice_items?: (array{discounts?: array{coupon?: string, discount?: string, promotion_code?: string}[], price?: string, price_data?: array{currency: string, product: string, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], application_fee_percent?: float, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, billing_cycle_anchor?: string, collection_method?: string, currency?: string, default_payment_method?: string, default_tax_rates?: null|string[], description?: null|string, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], end_date?: array|int|string, invoice_settings?: array{account_tax_ids?: null|string[], days_until_due?: int, issuer?: array{account?: string, type: string}}, items: (array{discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], metadata?: array<string, string>, plan?: string, price?: string, price_data?: array{currency: string, product: string, recurring: array{interval: string, interval_count?: int}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], iterations?: int, metadata?: array<string, string>, on_behalf_of?: string, proration_behavior?: string, start_date?: array|int|string, transfer_data?: array{amount_percent?: float, destination: string}, trial?: bool, trial_end?: array|int|string})[], proration_behavior?: string}, subscription?: string, subscription_details?: array{billing_cycle_anchor?: array|int|string, cancel_at?: null|int, cancel_at_period_end?: bool, cancel_now?: bool, default_tax_rates?: null|string[], items?: (array{clear_usage?: bool, deleted?: bool, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], id?: string, metadata?: null|array<string, string>, plan?: string, price?: string, price_data?: array{currency: string, product: string, recurring: array{interval: string, interval_count?: int}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, quantity?: int, tax_rates?: null|string[]})[], proration_behavior?: string, proration_date?: int, resume_at?: string, start_date?: int, trial_end?: array|int|string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function createPreview($params = null, $opts = null)
{
@@ -130,9 +131,9 @@ class InvoiceService extends \Stripe\Service\AbstractService
* @param null|array $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function delete($id, $params = null, $opts = null)
{
@@ -145,12 +146,12 @@ class InvoiceService extends \Stripe\Service\AbstractService
* do so using this method.
*
* @param string $id
* @param null|array $params
* @param null|array{auto_advance?: bool, expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function finalizeInvoice($id, $params = null, $opts = null)
{
@@ -162,12 +163,12 @@ class InvoiceService extends \Stripe\Service\AbstractService
* that can be written off for accounting purposes.
*
* @param string $id
* @param null|array $params
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function markUncollectible($id, $params = null, $opts = null)
{
@@ -182,12 +183,12 @@ class InvoiceService extends \Stripe\Service\AbstractService
* normal collection schedule or for some other reason, you can do so.
*
* @param string $id
* @param null|array $params
* @param null|array{expand?: string[], forgive?: bool, mandate?: null|string, off_session?: bool, paid_out_of_band?: bool, payment_method?: string, source?: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function pay($id, $params = null, $opts = null)
{
@@ -199,12 +200,12 @@ class InvoiceService extends \Stripe\Service\AbstractService
* invoice is still a draft.
*
* @param string $id
* @param null|array $params
* @param null|array{expand?: string[], invoice_metadata?: null|array<string, string>, lines: array{behavior: string, id: string}[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function removeLines($id, $params = null, $opts = null)
{
@@ -215,12 +216,12 @@ class InvoiceService extends \Stripe\Service\AbstractService
* Retrieves the invoice with the given ID.
*
* @param string $id
* @param null|array $params
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function retrieve($id, $params = null, $opts = null)
{
@@ -235,12 +236,12 @@ class InvoiceService extends \Stripe\Service\AbstractService
* Occasionally, propagation of new or updated data can be up to an hour behind
* during outages. Search functionality is not available to merchants in India.
*
* @param null|array $params
* @param null|array{expand?: string[], limit?: int, page?: string, query: string} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\SearchResult<\Stripe\Invoice>
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function search($params = null, $opts = null)
{
@@ -258,75 +259,18 @@ class InvoiceService extends \Stripe\Service\AbstractService
* <code>invoice.sent</code> event.
*
* @param string $id
* @param null|array $params
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function sendInvoice($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/invoices/%s/send', $id), $params, $opts);
}
/**
* At any time, you can preview the upcoming invoice for a customer. This will show
* you all the charges that are pending, including subscription renewal charges,
* invoice item charges, etc. It will also show you any discounts that are
* applicable to the invoice.
*
* Note that when you are viewing an upcoming invoice, you are simply viewing a
* preview the invoice has not yet been created. As such, the upcoming invoice
* will not show up in invoice listing calls, and you cannot use the API to pay or
* edit the invoice. If you want to change the amount that your customer will be
* billed, you can add, remove, or update pending invoice items, or update the
* customers discount.
*
* You can preview the effects of updating a subscription, including a preview of
* what proration will take place. To ensure that the actual proration is
* calculated exactly the same as the previewed proration, you should pass the
* <code>subscription_details.proration_date</code> parameter when doing the actual
* subscription update. The recommended way to get only the prorations being
* previewed is to consider only proration line items where
* <code>period[start]</code> is equal to the
* <code>subscription_details.proration_date</code> value passed in the request.
*
* Note: Currency conversion calculations use the latest exchange rates. Exchange
* rates may vary between the time of the preview and the time of the actual
* invoice creation. <a href="https://docs.stripe.com/currencies/conversions">Learn
* more</a>
*
* @param null|array $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice
*/
public function upcoming($params = null, $opts = null)
{
return $this->request('get', '/v1/invoices/upcoming', $params, $opts);
}
/**
* When retrieving an upcoming invoice, youll get a <strong>lines</strong>
* property containing the total count of line items and the first handful of those
* items. There is also a URL where you can retrieve the full (paginated) list of
* line items.
*
* @param null|array $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\InvoiceLineItem>
*/
public function upcomingLines($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/invoices/upcoming/lines', $params, $opts);
}
/**
* Draft invoices are fully editable. Once an invoice is <a
* href="/docs/billing/invoices/workflow#finalized">finalized</a>, monetary values,
@@ -338,12 +282,12 @@ class InvoiceService extends \Stripe\Service\AbstractService
* invoices, pass <code>auto_advance=false</code>.
*
* @param string $id
* @param null|array $params
* @param null|array{account_tax_ids?: null|string[], application_fee_amount?: int, auto_advance?: bool, automatic_tax?: array{enabled: bool, liability?: array{account?: string, type: string}}, automatically_finalizes_at?: int, collection_method?: string, custom_fields?: null|array{name: string, value: string}[], days_until_due?: int, default_payment_method?: string, default_source?: null|string, default_tax_rates?: null|string[], description?: string, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], due_date?: int, effective_at?: null|int, expand?: string[], footer?: string, issuer?: array{account?: string, type: string}, metadata?: null|array<string, string>, number?: null|string, on_behalf_of?: null|string, payment_settings?: array{default_mandate?: null|string, payment_method_options?: array{acss_debit?: null|array{mandate_options?: array{transaction_type?: string}, verification_method?: string}, bancontact?: null|array{preferred_language?: string}, card?: null|array{installments?: array{enabled?: bool, plan?: null|array{count?: int, interval?: string, type: string}}, request_three_d_secure?: string}, customer_balance?: null|array{bank_transfer?: array{eu_bank_transfer?: array{country: string}, type?: string}, funding_type?: string}, konbini?: null|array{}, sepa_debit?: null|array{}, us_bank_account?: null|array{financial_connections?: array{filters?: array{account_subcategories?: string[]}, permissions?: string[], prefetch?: string[]}, verification_method?: string}}, payment_method_types?: null|string[]}, rendering?: array{amount_tax_display?: null|string, pdf?: array{page_size?: string}, template?: string, template_version?: null|int}, shipping_cost?: null|array{shipping_rate?: string, shipping_rate_data?: array{delivery_estimate?: array{maximum?: array{unit: string, value: int}, minimum?: array{unit: string, value: int}}, display_name: string, fixed_amount?: array{amount: int, currency: string, currency_options?: array<string, array{amount: int, tax_behavior?: string}>}, metadata?: array<string, string>, tax_behavior?: string, tax_code?: string, type?: string}}, shipping_details?: null|array{address: array{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string}, name: string, phone?: null|string}, statement_descriptor?: string, transfer_data?: null|array{amount?: int, destination: string}} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function update($id, $params = null, $opts = null)
{
@@ -360,12 +304,12 @@ class InvoiceService extends \Stripe\Service\AbstractService
*
* @param string $parentId
* @param string $id
* @param null|array $params
* @param null|array{amount?: int, description?: string, discountable?: bool, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], expand?: string[], metadata?: null|array<string, string>, period?: array{end: int, start: int}, price_data?: array{currency: string, product?: string, product_data?: array{description?: string, images?: string[], metadata?: array<string, string>, name: string, tax_code?: string}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, pricing?: array{price?: string}, quantity?: int, tax_amounts?: null|array{amount: int, tax_rate_data: array{country?: string, description?: string, display_name: string, inclusive: bool, jurisdiction?: string, jurisdiction_level?: string, percentage: float, state?: string, tax_type?: string}, taxability_reason?: string, taxable_amount: int}[], tax_rates?: null|string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\InvoiceLineItem
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function updateLine($parentId, $id, $params = null, $opts = null)
{
@@ -377,12 +321,12 @@ class InvoiceService extends \Stripe\Service\AbstractService
* is still a draft.
*
* @param string $id
* @param null|array $params
* @param null|array{expand?: string[], invoice_metadata?: null|array<string, string>, lines: (array{amount?: int, description?: string, discountable?: bool, discounts?: null|array{coupon?: string, discount?: string, promotion_code?: string}[], id: string, metadata?: null|array<string, string>, period?: array{end: int, start: int}, price_data?: array{currency: string, product?: string, product_data?: array{description?: string, images?: string[], metadata?: array<string, string>, name: string, tax_code?: string}, tax_behavior?: string, unit_amount?: int, unit_amount_decimal?: string}, pricing?: array{price?: string}, quantity?: int, tax_amounts?: null|array{amount: int, tax_rate_data: array{country?: string, description?: string, display_name: string, inclusive: bool, jurisdiction?: string, jurisdiction_level?: string, percentage: float, state?: string, tax_type?: string}, taxability_reason?: string, taxable_amount: int}[], tax_rates?: null|string[]})[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function updateLines($id, $params = null, $opts = null)
{
@@ -402,12 +346,12 @@ class InvoiceService extends \Stripe\Service\AbstractService
* consult with your legal counsel for advice specific to your business.
*
* @param string $id
* @param null|array $params
* @param null|array{expand?: string[]} $params
* @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Invoice
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function voidInvoice($id, $params = null, $opts = null)
{