diff --git a/CHANGELOG.md b/CHANGELOG.md index 48a680a3b..a73568014 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 10.18.0 - 2023-07-20 +* [#1533](https://github.com/stripe/stripe-php/pull/1533) Update generated code + * Add support for new value `service_tax` on enum `TaxRate.tax_type` +* [#1526](https://github.com/stripe/stripe-php/pull/1526) Add constants for payment intent cancellation reasons +* [#1487](https://github.com/stripe/stripe-php/pull/1487) PHPDoc: use union of literals for $method parameter throughout + ## 10.18.0-beta.1 - 2023-07-13 * [#1527](https://github.com/stripe/stripe-php/pull/1527) Update generated code for beta Release specs are identical. @@ -9,7 +15,7 @@ * Add support for `payment_method_configuration_details` on `PaymentIntent` * Rename `Tax.SettingService` -> `Tax.SettingsService` (parity with main release) * [#1519](https://github.com/stripe/stripe-php/pull/1519) Update generated code for beta - * Rename `Tax.SettingsService` -> `Tax.SettingService` + * Rename `Tax.SettingsService` -> `Tax.SettingService` ## 10.17.0 - 2023-07-13 * [#1525](https://github.com/stripe/stripe-php/pull/1525) Update generated code diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index bfd5e01b8..ae2bb1461 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v417 \ No newline at end of file +v425 \ No newline at end of file diff --git a/lib/Balance.php b/lib/Balance.php index 4561c153e..05a94ccfa 100644 --- a/lib/Balance.php +++ b/lib/Balance.php @@ -23,7 +23,7 @@ * @property null|\Stripe\StripeObject[] $instant_available Funds that can be paid out using Instant Payouts. * @property null|\Stripe\StripeObject $issuing * @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 \Stripe\StripeObject[] $pending Funds that are not yet available in the balance, due to the 7-day rolling pay cycle. The pending balance for each currency, and for each payment type, can be found in the source_types property. + * @property \Stripe\StripeObject[] $pending Funds that are not yet available in the balance. The pending balance for each currency, and for each payment type, can be found in the source_types property. */ class Balance extends SingletonApiResource { diff --git a/lib/Coupon.php b/lib/Coupon.php index 9ef5888ab..611b51b24 100644 --- a/lib/Coupon.php +++ b/lib/Coupon.php @@ -36,4 +36,9 @@ class Coupon extends ApiResource use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; + + const DURATION_FOREVER = 'forever'; + const DURATION_ONCE = 'once'; + const DURATION_REPEATING = 'repeating'; + const DURATION_VARIABLE = 'variable'; } diff --git a/lib/CustomerCashBalanceTransaction.php b/lib/CustomerCashBalanceTransaction.php index 38ad7de2c..1793247d3 100644 --- a/lib/CustomerCashBalanceTransaction.php +++ b/lib/CustomerCashBalanceTransaction.php @@ -21,7 +21,7 @@ * @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 int $net_amount The amount by which the cash balance changed, represented in the smallest currency unit. A positive value represents funds being added to the cash balance, a negative value represents funds being removed from the cash balance. * @property null|\Stripe\StripeObject $refunded_from_payment - * @property string $type The type of the cash balance transaction. One of applied_to_payment, unapplied_from_payment, refunded_from_payment, funded, return_initiated, or return_canceled. New types may be added in future. See Customer Balance to learn more about these types. + * @property string $type The type of the cash balance transaction. New types may be added in future. See Customer Balance to learn more about these types. * @property null|\Stripe\StripeObject $unapplied_from_payment */ class CustomerCashBalanceTransaction extends ApiResource diff --git a/lib/Invoice.php b/lib/Invoice.php index 878d2d20c..176fe6aec 100644 --- a/lib/Invoice.php +++ b/lib/Invoice.php @@ -149,6 +149,10 @@ class Invoice extends ApiResource const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically'; const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice'; + const CUSTOMER_TAX_EXEMPT_EXEMPT = 'exempt'; + const CUSTOMER_TAX_EXEMPT_NONE = 'none'; + const CUSTOMER_TAX_EXEMPT_REVERSE = 'reverse'; + /** @deprecated */ const STATUS_DELETED = 'deleted'; const STATUS_DRAFT = 'draft'; diff --git a/lib/Issuing/Authorization.php b/lib/Issuing/Authorization.php index 13820b9a5..2e2bda7e1 100644 --- a/lib/Issuing/Authorization.php +++ b/lib/Issuing/Authorization.php @@ -44,6 +44,16 @@ class Authorization extends \Stripe\ApiResource use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; + const AUTHORIZATION_METHOD_CHIP = 'chip'; + const AUTHORIZATION_METHOD_CONTACTLESS = 'contactless'; + const AUTHORIZATION_METHOD_KEYED_IN = 'keyed_in'; + const AUTHORIZATION_METHOD_ONLINE = 'online'; + const AUTHORIZATION_METHOD_SWIPE = 'swipe'; + + const STATUS_CLOSED = 'closed'; + const STATUS_PENDING = 'pending'; + const STATUS_REVERSED = 'reversed'; + /** * @param null|array $params * @param null|array|string $opts diff --git a/lib/Issuing/Card.php b/lib/Issuing/Card.php index 2d26c55e1..c52cf5fe4 100644 --- a/lib/Issuing/Card.php +++ b/lib/Issuing/Card.php @@ -40,4 +40,20 @@ class Card extends \Stripe\ApiResource use \Stripe\ApiOperations\Create; use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; + + const CANCELLATION_REASON_DESIGN_REJECTED = 'design_rejected'; + const CANCELLATION_REASON_LOST = 'lost'; + const CANCELLATION_REASON_STOLEN = 'stolen'; + + const REPLACEMENT_REASON_DAMAGED = 'damaged'; + const REPLACEMENT_REASON_EXPIRED = 'expired'; + const REPLACEMENT_REASON_LOST = 'lost'; + const REPLACEMENT_REASON_STOLEN = 'stolen'; + + const STATUS_ACTIVE = 'active'; + const STATUS_CANCELED = 'canceled'; + const STATUS_INACTIVE = 'inactive'; + + const TYPE_PHYSICAL = 'physical'; + const TYPE_VIRTUAL = 'virtual'; } diff --git a/lib/Issuing/Cardholder.php b/lib/Issuing/Cardholder.php index aac314a30..b98e74d42 100644 --- a/lib/Issuing/Cardholder.php +++ b/lib/Issuing/Cardholder.php @@ -34,4 +34,11 @@ class Cardholder extends \Stripe\ApiResource use \Stripe\ApiOperations\Create; use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; + + const STATUS_ACTIVE = 'active'; + const STATUS_BLOCKED = 'blocked'; + const STATUS_INACTIVE = 'inactive'; + + const TYPE_COMPANY = 'company'; + const TYPE_INDIVIDUAL = 'individual'; } diff --git a/lib/Issuing/Dispute.php b/lib/Issuing/Dispute.php index 8d5a33a1b..aa4c454d5 100644 --- a/lib/Issuing/Dispute.php +++ b/lib/Issuing/Dispute.php @@ -31,6 +31,12 @@ class Dispute extends \Stripe\ApiResource use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; + const STATUS_EXPIRED = 'expired'; + const STATUS_LOST = 'lost'; + const STATUS_SUBMITTED = 'submitted'; + const STATUS_UNSUBMITTED = 'unsubmitted'; + const STATUS_WON = 'won'; + /** * @param null|array $params * @param null|array|string $opts diff --git a/lib/Issuing/Transaction.php b/lib/Issuing/Transaction.php index ce391f369..912e253d0 100644 --- a/lib/Issuing/Transaction.php +++ b/lib/Issuing/Transaction.php @@ -40,4 +40,11 @@ class Transaction extends \Stripe\ApiResource use \Stripe\ApiOperations\All; use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; + + const TYPE_CAPTURE = 'capture'; + const TYPE_REFUND = 'refund'; + + const WALLET_APPLE_PAY = 'apple_pay'; + const WALLET_GOOGLE_PAY = 'google_pay'; + const WALLET_SAMSUNG_PAY = 'samsung_pay'; } diff --git a/lib/Mandate.php b/lib/Mandate.php index 55bc75839..9883aeaaf 100644 --- a/lib/Mandate.php +++ b/lib/Mandate.php @@ -24,4 +24,11 @@ class Mandate extends ApiResource const OBJECT_NAME = 'mandate'; use ApiOperations\Retrieve; + + const STATUS_ACTIVE = 'active'; + const STATUS_INACTIVE = 'inactive'; + const STATUS_PENDING = 'pending'; + + const TYPE_MULTI_USE = 'multi_use'; + const TYPE_SINGLE_USE = 'single_use'; } diff --git a/lib/PaymentIntent.php b/lib/PaymentIntent.php index 46b7535e6..5f19b2811 100644 --- a/lib/PaymentIntent.php +++ b/lib/PaymentIntent.php @@ -70,9 +70,27 @@ class PaymentIntent extends ApiResource use ApiOperations\Search; use ApiOperations\Update; + const CANCELLATION_REASON_ABANDONED = 'abandoned'; + const CANCELLATION_REASON_AUTOMATIC = 'automatic'; + const CANCELLATION_REASON_DUPLICATE = 'duplicate'; + const CANCELLATION_REASON_FAILED_INVOICE = 'failed_invoice'; + const CANCELLATION_REASON_FRAUDULENT = 'fraudulent'; + const CANCELLATION_REASON_REQUESTED_BY_CUSTOMER = 'requested_by_customer'; + const CANCELLATION_REASON_VOID_INVOICE = 'void_invoice'; + + const CAPTURE_METHOD_AUTOMATIC = 'automatic'; + const CAPTURE_METHOD_AUTOMATIC_ASYNC = 'automatic_async'; + const CAPTURE_METHOD_MANUAL = 'manual'; + + const CONFIRMATION_METHOD_AUTOMATIC = 'automatic'; + const CONFIRMATION_METHOD_MANUAL = 'manual'; + const SECRET_KEY_CONFIRMATION_OPTIONAL = 'optional'; const SECRET_KEY_CONFIRMATION_REQUIRED = 'required'; + const SETUP_FUTURE_USAGE_OFF_SESSION = 'off_session'; + const SETUP_FUTURE_USAGE_ON_SESSION = 'on_session'; + const STATUS_CANCELED = 'canceled'; const STATUS_PROCESSING = 'processing'; const STATUS_REQUIRES_ACTION = 'requires_action'; @@ -81,11 +99,6 @@ class PaymentIntent extends ApiResource const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method'; const STATUS_SUCCEEDED = 'succeeded'; - const CANCELLATION_REASON_DUPLICATE = 'duplicate'; - const CANCELLATION_REASON_FRAUDULENT = 'fraudulent'; - const CANCELLATION_REASON_REQUESTED_BY_CUSTOMER = 'requested_by_customer'; - const CANCELLATION_REASON_ABANDONED = 'abandoned'; - /** * @param null|array $params * @param null|array|string $opts diff --git a/lib/PaymentMethod.php b/lib/PaymentMethod.php index 3ee40cd7d..630b1d0c7 100644 --- a/lib/PaymentMethod.php +++ b/lib/PaymentMethod.php @@ -63,6 +63,40 @@ class PaymentMethod extends ApiResource use ApiOperations\Retrieve; use ApiOperations\Update; + const TYPE_ACSS_DEBIT = 'acss_debit'; + const TYPE_AFFIRM = 'affirm'; + const TYPE_AFTERPAY_CLEARPAY = 'afterpay_clearpay'; + const TYPE_ALIPAY = 'alipay'; + const TYPE_AU_BECS_DEBIT = 'au_becs_debit'; + const TYPE_BACS_DEBIT = 'bacs_debit'; + const TYPE_BANCONTACT = 'bancontact'; + const TYPE_BLIK = 'blik'; + const TYPE_BOLETO = 'boleto'; + const TYPE_CARD = 'card'; + const TYPE_CARD_PRESENT = 'card_present'; + const TYPE_CASHAPP = 'cashapp'; + const TYPE_CUSTOMER_BALANCE = 'customer_balance'; + const TYPE_EPS = 'eps'; + const TYPE_FPX = 'fpx'; + const TYPE_GIROPAY = 'giropay'; + const TYPE_GRABPAY = 'grabpay'; + const TYPE_IDEAL = 'ideal'; + const TYPE_INTERAC_PRESENT = 'interac_present'; + const TYPE_KLARNA = 'klarna'; + const TYPE_KONBINI = 'konbini'; + const TYPE_LINK = 'link'; + const TYPE_OXXO = 'oxxo'; + const TYPE_P24 = 'p24'; + const TYPE_PAYNOW = 'paynow'; + const TYPE_PAYPAL = 'paypal'; + const TYPE_PIX = 'pix'; + const TYPE_PROMPTPAY = 'promptpay'; + const TYPE_SEPA_DEBIT = 'sepa_debit'; + const TYPE_SOFORT = 'sofort'; + const TYPE_US_BANK_ACCOUNT = 'us_bank_account'; + const TYPE_WECHAT_PAY = 'wechat_pay'; + const TYPE_ZIP = 'zip'; + /** * @param null|array $params * @param null|array|string $opts diff --git a/lib/Plan.php b/lib/Plan.php index 3f77306f3..148138b4e 100644 --- a/lib/Plan.php +++ b/lib/Plan.php @@ -44,4 +44,23 @@ class Plan extends ApiResource use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; + + const AGGREGATE_USAGE_LAST_DURING_PERIOD = 'last_during_period'; + const AGGREGATE_USAGE_LAST_EVER = 'last_ever'; + const AGGREGATE_USAGE_MAX = 'max'; + const AGGREGATE_USAGE_SUM = 'sum'; + + const BILLING_SCHEME_PER_UNIT = 'per_unit'; + const BILLING_SCHEME_TIERED = 'tiered'; + + const INTERVAL_DAY = 'day'; + const INTERVAL_MONTH = 'month'; + const INTERVAL_WEEK = 'week'; + const INTERVAL_YEAR = 'year'; + + const TIERS_MODE_GRADUATED = 'graduated'; + const TIERS_MODE_VOLUME = 'volume'; + + const USAGE_TYPE_LICENSED = 'licensed'; + const USAGE_TYPE_METERED = 'metered'; } diff --git a/lib/Quote.php b/lib/Quote.php index 9a86f3e4e..e3539754f 100644 --- a/lib/Quote.php +++ b/lib/Quote.php @@ -67,24 +67,6 @@ class Quote extends ApiResource const STATUS_OPEN = 'open'; const STATUS_STALE = 'stale'; - /** - * @param callable $readBodyChunkCallable - * @param null|array $params - * @param null|array|string $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - */ - public function pdf($readBodyChunkCallable, $params = null, $opts = null) - { - $opts = \Stripe\Util\RequestOptions::parse($opts); - if (null === $opts->apiBase) { - $opts->apiBase = Stripe::$apiUploadBase; - } - - $url = $this->instanceUrl() . '/pdf'; - $this->_requestStream('get', $url, $readBodyChunkCallable, $params, $opts); - } - /** * @param null|array $params * @param null|array|string $opts @@ -227,6 +209,25 @@ public function markStaleQuote($params = null, $opts = null) return $this; } + /** + * @param callable $readBodyChunkCallable + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return void + */ + public function pdf($readBodyChunkCallable, $params = null, $opts = null) + { + $opts = \Stripe\Util\RequestOptions::parse($opts); + if (!isset($opts->apiBase)) { + $opts->apiBase = Stripe::$apiUploadBase; + } + $url = $this->instanceUrl() . '/pdf'; + $this->_requestStream('get', $url, $readBodyChunkCallable, $params, $opts); + } + /** * @param string $id * @param string $preview_invoice diff --git a/lib/Radar/ValueList.php b/lib/Radar/ValueList.php index feea78837..fd09ba994 100644 --- a/lib/Radar/ValueList.php +++ b/lib/Radar/ValueList.php @@ -29,4 +29,13 @@ class ValueList extends \Stripe\ApiResource use \Stripe\ApiOperations\Delete; use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; + + const ITEM_TYPE_CARD_BIN = 'card_bin'; + const ITEM_TYPE_CARD_FINGERPRINT = 'card_fingerprint'; + const ITEM_TYPE_CASE_SENSITIVE_STRING = 'case_sensitive_string'; + const ITEM_TYPE_COUNTRY = 'country'; + const ITEM_TYPE_CUSTOMER_ID = 'customer_id'; + const ITEM_TYPE_EMAIL = 'email'; + const ITEM_TYPE_IP_ADDRESS = 'ip_address'; + const ITEM_TYPE_STRING = 'string'; } diff --git a/lib/Review.php b/lib/Review.php index 71be80ed0..cb49431ab 100644 --- a/lib/Review.php +++ b/lib/Review.php @@ -32,6 +32,15 @@ class Review extends ApiResource use ApiOperations\All; use ApiOperations\Retrieve; + const CLOSED_REASON_APPROVED = 'approved'; + const CLOSED_REASON_DISPUTED = 'disputed'; + const CLOSED_REASON_REDACTED = 'redacted'; + const CLOSED_REASON_REFUNDED = 'refunded'; + const CLOSED_REASON_REFUNDED_AS_FRAUD = 'refunded_as_fraud'; + + const OPENED_REASON_MANUAL = 'manual'; + const OPENED_REASON_RULE = 'rule'; + /** * Possible string representations of the current, the opening or the closure reason of the review. * Not all of these enumeration apply to all of the ´reason´ fields. Please consult the Review object to diff --git a/lib/Service/QuoteService.php b/lib/Service/QuoteService.php index 446e34227..8fb70865e 100644 --- a/lib/Service/QuoteService.php +++ b/lib/Service/QuoteService.php @@ -93,41 +93,40 @@ public function allLines($id, $params = null, $opts = null) } /** - * Cancels the quote. + * Preview the invoice line items that would be generated by accepting the quote. * + * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\Stripe\Util\RequestOptions $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Quote + * @return \Stripe\Collection<\Stripe\InvoiceLineItem> */ - public function cancel($id, $params = null, $opts = null) + public function allPreviewInvoiceLines($parentId, $id, $params = null, $opts = null) { - return $this->request('post', $this->buildPath('/v1/quotes/%s/cancel', $id), $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/preview_invoices/%s/lines', $parentId, $id), $params, $opts); } /** - * A quote models prices and services for a customer. Default options for - * header, description, footer, and - * expires_at can be set in the dashboard via the quote template. + * Preview the invoices that would be generated by accepting the quote. * + * @param string $id * @param null|array $params * @param null|array|\Stripe\Util\RequestOptions $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Quote + * @return \Stripe\Collection<\Stripe\Invoice> */ - public function create($params = null, $opts = null) + public function allPreviewInvoices($id, $params = null, $opts = null) { - return $this->request('post', '/v1/quotes', $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/preview_invoices', $id), $params, $opts); } /** - * Converts a stale quote to draft. + * Preview the schedules that would be generated by accepting the quote. * * @param string $id * @param null|array $params @@ -135,15 +134,15 @@ public function create($params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Quote + * @return \Stripe\Collection<\Stripe\SubscriptionSchedule> */ - public function draftQuote($id, $params = null, $opts = null) + public function allPreviewSubscriptionSchedules($id, $params = null, $opts = null) { - return $this->request('post', $this->buildPath('/v1/quotes/%s/mark_draft', $id), $params, $opts); + return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/preview_subscription_schedules', $id), $params, $opts); } /** - * Finalizes the quote. + * Cancels the quote. * * @param string $id * @param null|array $params @@ -153,15 +152,17 @@ public function draftQuote($id, $params = null, $opts = null) * * @return \Stripe\Quote */ - public function finalizeQuote($id, $params = null, $opts = null) + public function cancel($id, $params = null, $opts = null) { - return $this->request('post', $this->buildPath('/v1/quotes/%s/finalize', $id), $params, $opts); + return $this->request('post', $this->buildPath('/v1/quotes/%s/cancel', $id), $params, $opts); } /** - * Converts a draft or open quote to stale. + * A quote models prices and services for a customer. Default options for + * header, description, footer, and + * expires_at can be set in the dashboard via the quote template. * - * @param string $id * @param null|array $params * @param null|array|\Stripe\Util\RequestOptions $opts * @@ -169,30 +170,29 @@ public function finalizeQuote($id, $params = null, $opts = null) * * @return \Stripe\Quote */ - public function markStaleQuote($id, $params = null, $opts = null) + public function create($params = null, $opts = null) { - return $this->request('post', $this->buildPath('/v1/quotes/%s/mark_stale', $id), $params, $opts); + return $this->request('post', '/v1/quotes', $params, $opts); } /** - * Preview the invoice line items that would be generated by accepting the quote. + * Converts a stale quote to draft. * - * @param string $parentId * @param string $id * @param null|array $params * @param null|array|\Stripe\Util\RequestOptions $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\InvoiceLineItem> + * @return \Stripe\Quote */ - public function previewInvoiceLines($parentId, $id, $params = null, $opts = null) + public function draftQuote($id, $params = null, $opts = null) { - return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/preview_invoices/%s/lines', $parentId, $id), $params, $opts); + return $this->request('post', $this->buildPath('/v1/quotes/%s/mark_draft', $id), $params, $opts); } /** - * Preview the invoices that would be generated by accepting the quote. + * Finalizes the quote. * * @param string $id * @param null|array $params @@ -200,15 +200,15 @@ public function previewInvoiceLines($parentId, $id, $params = null, $opts = null * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\Invoice> + * @return \Stripe\Quote */ - public function previewInvoices($id, $params = null, $opts = null) + public function finalizeQuote($id, $params = null, $opts = null) { - return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/preview_invoices', $id), $params, $opts); + return $this->request('post', $this->buildPath('/v1/quotes/%s/finalize', $id), $params, $opts); } /** - * Preview the schedules that would be generated by accepting the quote. + * Converts a draft or open quote to stale. * * @param string $id * @param null|array $params @@ -216,31 +216,37 @@ public function previewInvoices($id, $params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\SubscriptionSchedule> + * @return \Stripe\Quote */ - public function previewSubscriptionSchedules($id, $params = null, $opts = null) + public function markStaleQuote($id, $params = null, $opts = null) { - return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/preview_subscription_schedules', $id), $params, $opts); + return $this->request('post', $this->buildPath('/v1/quotes/%s/mark_stale', $id), $params, $opts); } /** - * Recompute the upcoming invoice estimate for the quote. + * Download the PDF for a finalized quote. * * @param string $id + * @param callable $readBodyChunkCallable * @param null|array $params * @param null|array|\Stripe\Util\RequestOptions $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Quote + * @return mixed */ - public function reestimate($id, $params = null, $opts = null) + public function pdf($id, $readBodyChunkCallable, $params = null, $opts = null) { - return $this->request('post', $this->buildPath('/v1/quotes/%s/reestimate', $id), $params, $opts); + $opts = \Stripe\Util\RequestOptions::parse($opts); + if (!isset($opts->apiBase)) { + $opts->apiBase = $this->getClient()->getFilesBase(); + } + + return $this->requestStream('get', $this->buildPath('/v1/quotes/%s/pdf', $id), $readBodyChunkCallable, $params, $opts); } /** - * Retrieves the quote with the given ID. + * Recompute the upcoming invoice estimate for the quote. * * @param string $id * @param null|array $params @@ -250,13 +256,13 @@ public function reestimate($id, $params = null, $opts = null) * * @return \Stripe\Quote */ - public function retrieve($id, $params = null, $opts = null) + public function reestimate($id, $params = null, $opts = null) { - return $this->request('get', $this->buildPath('/v1/quotes/%s', $id), $params, $opts); + return $this->request('post', $this->buildPath('/v1/quotes/%s/reestimate', $id), $params, $opts); } /** - * A quote models prices and services for a customer. + * Retrieves the quote with the given ID. * * @param string $id * @param null|array $params @@ -266,27 +272,24 @@ public function retrieve($id, $params = null, $opts = null) * * @return \Stripe\Quote */ - public function update($id, $params = null, $opts = null) + public function retrieve($id, $params = null, $opts = null) { - return $this->request('post', $this->buildPath('/v1/quotes/%s', $id), $params, $opts); + return $this->request('get', $this->buildPath('/v1/quotes/%s', $id), $params, $opts); } /** - * Download the PDF for a finalized quote. + * A quote models prices and services for a customer. * * @param string $id - * @param callable $readBodyChunkCallable * @param null|array $params * @param null|array|\Stripe\Util\RequestOptions $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Quote */ - public function pdf($id, $readBodyChunkCallable, $params = null, $opts = null) + public function update($id, $params = null, $opts = null) { - $opts = \Stripe\Util\RequestOptions::parse($opts); - if (!isset($opts->apiBase)) { - $opts->apiBase = $this->getClient()->getFilesBase(); - } - $this->requestStream('get', $this->buildPath('/v1/quotes/%s/pdf', $id), $readBodyChunkCallable, $params, $opts); + return $this->request('post', $this->buildPath('/v1/quotes/%s', $id), $params, $opts); } } diff --git a/lib/SetupIntent.php b/lib/SetupIntent.php index e7e7b1b97..9f7dff7af 100644 --- a/lib/SetupIntent.php +++ b/lib/SetupIntent.php @@ -62,6 +62,10 @@ class SetupIntent extends ApiResource use ApiOperations\Retrieve; use ApiOperations\Update; + const CANCELLATION_REASON_ABANDONED = 'abandoned'; + const CANCELLATION_REASON_DUPLICATE = 'duplicate'; + const CANCELLATION_REASON_REQUESTED_BY_CUSTOMER = 'requested_by_customer'; + const STATUS_CANCELED = 'canceled'; const STATUS_PROCESSING = 'processing'; const STATUS_REQUIRES_ACTION = 'requires_action'; diff --git a/lib/ShippingRate.php b/lib/ShippingRate.php index 031bf6a2e..c1ac21de2 100644 --- a/lib/ShippingRate.php +++ b/lib/ShippingRate.php @@ -5,9 +5,8 @@ namespace Stripe; /** - * Shipping rates describe the price of shipping presented to your customers and can be - * applied to Checkout Sessions - * and Orders to collect shipping costs. + * Shipping rates describe the price of shipping presented to your customers and + * applied to a purchase. For more information, see Charge for shipping. * * @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. diff --git a/lib/Source.php b/lib/Source.php index f26fa0f9d..438bdeb61 100644 --- a/lib/Source.php +++ b/lib/Source.php @@ -75,6 +75,27 @@ class Source extends ApiResource const STATUS_FAILED = 'failed'; const STATUS_PENDING = 'pending'; + const TYPE_ACH_CREDIT_TRANSFER = 'ach_credit_transfer'; + const TYPE_ACH_DEBIT = 'ach_debit'; + const TYPE_ACSS_DEBIT = 'acss_debit'; + const TYPE_ALIPAY = 'alipay'; + const TYPE_AU_BECS_DEBIT = 'au_becs_debit'; + const TYPE_BANCONTACT = 'bancontact'; + const TYPE_CARD = 'card'; + const TYPE_CARD_PRESENT = 'card_present'; + const TYPE_EPS = 'eps'; + const TYPE_GIROPAY = 'giropay'; + const TYPE_IDEAL = 'ideal'; + const TYPE_KLARNA = 'klarna'; + const TYPE_MULTIBANCO = 'multibanco'; + const TYPE_P24 = 'p24'; + const TYPE_PAYPAL = 'paypal'; + const TYPE_SEPA_CREDIT_TRANSFER = 'sepa_credit_transfer'; + const TYPE_SEPA_DEBIT = 'sepa_debit'; + const TYPE_SOFORT = 'sofort'; + const TYPE_THREE_D_SECURE = 'three_d_secure'; + const TYPE_WECHAT = 'wechat'; + const USAGE_REUSABLE = 'reusable'; const USAGE_SINGLE_USE = 'single_use'; diff --git a/lib/Subscription.php b/lib/Subscription.php index 5cdd9c03c..ceb6052d3 100644 --- a/lib/Subscription.php +++ b/lib/Subscription.php @@ -65,6 +65,9 @@ class Subscription extends ApiResource use ApiOperations\Search; use ApiOperations\Update; + const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically'; + const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice'; + const PAYMENT_BEHAVIOR_ALLOW_INCOMPLETE = 'allow_incomplete'; const PAYMENT_BEHAVIOR_DEFAULT_INCOMPLETE = 'default_incomplete'; const PAYMENT_BEHAVIOR_ERROR_IF_INCOMPLETE = 'error_if_incomplete'; diff --git a/lib/SubscriptionSchedule.php b/lib/SubscriptionSchedule.php index 1d7fe97a4..b2db623cd 100644 --- a/lib/SubscriptionSchedule.php +++ b/lib/SubscriptionSchedule.php @@ -40,6 +40,20 @@ class SubscriptionSchedule extends ApiResource use ApiOperations\Retrieve; use ApiOperations\Update; + const BILLING_BEHAVIOR_PRORATE_ON_NEXT_PHASE = 'prorate_on_next_phase'; + const BILLING_BEHAVIOR_PRORATE_UP_FRONT = 'prorate_up_front'; + + const END_BEHAVIOR_CANCEL = 'cancel'; + const END_BEHAVIOR_NONE = 'none'; + const END_BEHAVIOR_RELEASE = 'release'; + const END_BEHAVIOR_RENEW = 'renew'; + + const STATUS_ACTIVE = 'active'; + const STATUS_CANCELED = 'canceled'; + const STATUS_COMPLETED = 'completed'; + const STATUS_NOT_STARTED = 'not_started'; + const STATUS_RELEASED = 'released'; + /** * @param null|array $params * @param null|array|string $opts diff --git a/lib/TaxId.php b/lib/TaxId.php index 314a07974..e85c71bbc 100644 --- a/lib/TaxId.php +++ b/lib/TaxId.php @@ -16,7 +16,7 @@ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string|\Stripe\Customer $customer ID of the customer. * @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 string $type Type of the tax ID, one of ad_nrt, ae_trn, ar_cuit, au_abn, au_arn, bg_uic, bo_tin, br_cnpj, br_cpf, ca_bn, ca_gst_hst, ca_pst_bc, ca_pst_mb, ca_pst_sk, ca_qst, ch_vat, cl_tin, cn_tin, co_nit, cr_tin, do_rcn, ec_ruc, eg_tin, es_cif, eu_oss_vat, eu_vat, gb_vat, ge_vat, hk_br, hu_tin, id_npwp, il_vat, in_gst, is_vat, jp_cn, jp_rn, jp_trn, ke_pin, kr_brn, li_uid, mx_rfc, my_frp, my_itn, my_sst, no_vat, nz_gst, pe_ruc, ph_tin, rs_pib, ru_inn, ru_kpp, sa_vat, sg_gst, sg_uen, si_tin, sv_nit, th_vat, tr_tin, tw_vat, ua_vat, us_ein, uy_ruc, ve_rif, vn_tin, or za_vat. Note that some legacy tax IDs have type unknown + * @property string $type Type of the tax ID, one of ad_nrt, ae_trn, ar_cuit, au_abn, au_arn, bg_uic, bo_tin, br_cnpj, br_cpf, ca_bn, ca_gst_hst, ca_pst_bc, ca_pst_mb, ca_pst_sk, ca_qst, ch_vat, cl_tin, cn_tin, co_nit, cr_tin, do_rcn, ec_ruc, eg_tin, es_cif, eu_oss_vat, eu_vat, gb_vat, ge_vat, hk_br, hu_tin, id_npwp, il_vat, in_gst, is_vat, jp_cn, jp_rn, jp_trn, ke_pin, kr_brn, li_uid, mx_rfc, my_frp, my_itn, my_sst, no_vat, nz_gst, pe_ruc, ph_tin, ro_tin, rs_pib, ru_inn, ru_kpp, sa_vat, sg_gst, sg_uen, si_tin, sv_nit, th_vat, tr_tin, tw_vat, ua_vat, us_ein, uy_ruc, ve_rif, vn_tin, or za_vat. Note that some legacy tax IDs have type unknown * @property string $value Value of the tax ID. * @property null|\Stripe\StripeObject $verification Tax ID verification information. */ @@ -74,6 +74,7 @@ class TaxId extends ApiResource const TYPE_NZ_GST = 'nz_gst'; const TYPE_PE_RUC = 'pe_ruc'; const TYPE_PH_TIN = 'ph_tin'; + const TYPE_RO_TIN = 'ro_tin'; const TYPE_RS_PIB = 'rs_pib'; const TYPE_RU_INN = 'ru_inn'; const TYPE_RU_KPP = 'ru_kpp'; diff --git a/lib/TaxRate.php b/lib/TaxRate.php index 3c928db39..c0bc90262 100644 --- a/lib/TaxRate.php +++ b/lib/TaxRate.php @@ -45,5 +45,6 @@ class TaxRate extends ApiResource const TAX_TYPE_QST = 'qst'; const TAX_TYPE_RST = 'rst'; const TAX_TYPE_SALES_TAX = 'sales_tax'; + const TAX_TYPE_SERVICE_TAX = 'service_tax'; const TAX_TYPE_VAT = 'vat'; } diff --git a/lib/Terminal/Reader.php b/lib/Terminal/Reader.php index 7c5f93413..44c635414 100644 --- a/lib/Terminal/Reader.php +++ b/lib/Terminal/Reader.php @@ -32,6 +32,13 @@ class Reader extends \Stripe\ApiResource use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; + const DEVICE_TYPE_BBPOS_CHIPPER2X = 'bbpos_chipper2x'; + const DEVICE_TYPE_BBPOS_WISEPAD3 = 'bbpos_wisepad3'; + const DEVICE_TYPE_BBPOS_WISEPOS_E = 'bbpos_wisepos_e'; + const DEVICE_TYPE_SIMULATED_WISEPOS_E = 'simulated_wisepos_e'; + const DEVICE_TYPE_STRIPE_M2 = 'stripe_m2'; + const DEVICE_TYPE_VERIFONE_P400 = 'verifone_P400'; + /** * @param null|array $params * @param null|array|string $opts diff --git a/lib/Util/ApiVersion.php b/lib/Util/ApiVersion.php index 78e2e53f5..3c364ac95 100644 --- a/lib/Util/ApiVersion.php +++ b/lib/Util/ApiVersion.php @@ -7,5 +7,5 @@ class ApiVersion { const CURRENT = '2022-11-15'; - const PREVIEW = '20230712T200515'; + const PREVIEW = '2023-07-13.preview-v2'; } diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index e6ce7a82a..b196c5b96 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -4036,13 +4036,13 @@ public function testListLineItemsCalculation() static::assertInstanceOf(\Stripe\Tax\CalculationLineItem::class, $result->data[0]); } - public function testPreviewInvoiceLinesQuote() + public function testListPreviewInvoiceLinesQuote() { $this->expectsRequest( 'get', '/v1/quotes/qt_xyz/preview_invoices/in_xyz/lines' ); - $result = $this->client->quotes->previewInvoiceLines( + $result = $this->client->quotes->allPreviewInvoiceLines( 'qt_xyz', 'in_xyz', []