diff --git a/.editorconfig b/.editorconfig index 174e9120b..2d0fec721 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,7 +13,7 @@ charset = utf-8 [*.{json,yml}] indent_size = 2 -[*.neon] +[*.{neon,neon.dist}] indent_style = tab [Makefile] diff --git a/.vscode/extensions.json b/.vscode/extensions.json index db1056ca7..45314f805 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,9 +1,8 @@ { "recommendations": [ - "felixfbecker.php-intellisense", - "ikappas.phpcs", - "emallin.phpunit", - "EditorConfig.editorconfig", - "sophisticode.php-formatter" + "EditorConfig.editorconfig", // standard + "bmewburn.vscode-intelephense-client", // intellisense + "emallin.phpunit", // nice unit-testing runners + "SanderRonde.phpstan-vscode" // linting ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index d1ae331e1..2a97389de 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,12 +4,11 @@ "editor.renderWhitespace": "all", + "[php]": { + "editor.defaultFormatter": "bmewburn.vscode-intelephense-client" + }, + // Formatting "editor.formatOnSave": true, - "phpformatter.composer": true, - "phpformatter.arguments": [""], - - // Linting - "phpcs.enable": true, - "phpcs.standard": "PSR2" + "intelephense.format.braces": "psr12" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 3468cda8f..c764190b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## 15.0.0 - 2024-06-24 +* [#1714](https://github.com/stripe/stripe-php/pull/1714) + + This release changes the pinned API version to 2024-06-20. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-06-20) and carefully review the API changes before upgrading. + + ### ⚠️ Breaking changes + + * Remove the unused resource `PlatformTaxFee` + * Remove the protected method `_searchResource` on resources Charge, Customer, Invoice, PaymentIntent, Price, Product, and Subscription as it is no longer used. + + ### Additions + + * Add support for `finalize_amount` test helper method on resource `Issuing.Authorization` + * Add support for `fleet` and `fuel` on `Issuing.Authorization` + * Add support for new value `ch_uid` on enum `TaxId.type` + ## 14.11.0-beta.1 - 2024-06-13 * [#1705](https://github.com/stripe/stripe-php/pull/1705) Syncing changes from 14.10.0 release diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index ebd06a813..cd25cb7e2 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1077 \ No newline at end of file +v1102 \ No newline at end of file diff --git a/init.php b/init.php index c78f8ce2d..0439b7e86 100644 --- a/init.php +++ b/init.php @@ -169,7 +169,6 @@ require __DIR__ . '/lib/Payout.php'; require __DIR__ . '/lib/Person.php'; require __DIR__ . '/lib/Plan.php'; -require __DIR__ . '/lib/PlatformTaxFee.php'; require __DIR__ . '/lib/Price.php'; require __DIR__ . '/lib/Product.php'; require __DIR__ . '/lib/ProductFeature.php'; diff --git a/lib/BalanceTransaction.php b/lib/BalanceTransaction.php index d88cf9b52..5691d9573 100644 --- a/lib/BalanceTransaction.php +++ b/lib/BalanceTransaction.php @@ -22,7 +22,7 @@ * @property \Stripe\StripeObject[] $fee_details Detailed breakdown of fees (in cents (or local equivalent)) paid for this transaction. * @property int $net Net impact to a Stripe balance (in cents (or local equivalent)). A positive value represents incrementing a Stripe balance, and a negative value decrementing a Stripe balance. You can calculate the net impact of a transaction on a balance by amount - fee * @property string $reporting_category Learn more about how reporting categories can help you understand balance transactions from an accounting perspective. - * @property null|string|\Stripe\ApplicationFee|\Stripe\ApplicationFeeRefund|\Stripe\Charge|\Stripe\ConnectCollectionTransfer|\Stripe\CustomerCashBalanceTransaction|\Stripe\Dispute|\Stripe\Issuing\Authorization|\Stripe\Issuing\Dispute|\Stripe\Issuing\Transaction|\Stripe\Payout|\Stripe\PlatformTaxFee|\Stripe\Refund|\Stripe\ReserveTransaction|\Stripe\TaxDeductedAtSource|\Stripe\Topup|\Stripe\Transfer|\Stripe\TransferReversal $source This transaction relates to the Stripe object. + * @property null|string|\Stripe\ApplicationFee|\Stripe\ApplicationFeeRefund|\Stripe\Charge|\Stripe\ConnectCollectionTransfer|\Stripe\CustomerCashBalanceTransaction|\Stripe\Dispute|\Stripe\Issuing\Authorization|\Stripe\Issuing\Dispute|\Stripe\Issuing\Transaction|\Stripe\Payout|\Stripe\Refund|\Stripe\ReserveTransaction|\Stripe\TaxDeductedAtSource|\Stripe\Topup|\Stripe\Transfer|\Stripe\TransferReversal $source This transaction relates to the Stripe object. * @property string $status The transaction's net funds status in the Stripe balance, which are either available or pending. * @property string $type Transaction type: adjustment, advance, advance_funding, anticipation_repayment, application_fee, application_fee_refund, charge, climate_order_purchase, climate_order_refund, connect_collection_transfer, contribution, issuing_authorization_hold, issuing_authorization_release, issuing_dispute, issuing_transaction, obligation_outbound, obligation_reversal_inbound, payment, payment_failure_refund, payment_network_reserve_hold, payment_network_reserve_release, payment_refund, payment_reversal, payment_unreconciled, payout, payout_cancel, payout_failure, refund, refund_failure, reserve_transaction, reserved_funds, stripe_fee, stripe_fx_fee, tax_fee, topup, topup_reversal, transfer, transfer_cancel, transfer_failure, or transfer_refund. Learn more about balance transaction types and what they represent. To classify transactions for accounting purposes, consider reporting_category instead. */ diff --git a/lib/Charge.php b/lib/Charge.php index 4b1d575ec..7c4a47fdc 100644 --- a/lib/Charge.php +++ b/lib/Charge.php @@ -64,7 +64,6 @@ class Charge extends ApiResource const OBJECT_NAME = 'charge'; use ApiOperations\NestedResource; - use ApiOperations\Search; use ApiOperations\Update; const STATUS_FAILED = 'failed'; diff --git a/lib/Customer.php b/lib/Customer.php index a89347462..00ef44342 100644 --- a/lib/Customer.php +++ b/lib/Customer.php @@ -43,7 +43,6 @@ class Customer extends ApiResource const OBJECT_NAME = 'customer'; use ApiOperations\NestedResource; - use ApiOperations\Search; use ApiOperations\Update; const TAX_EXEMPT_EXEMPT = 'exempt'; diff --git a/lib/Invoice.php b/lib/Invoice.php index e313d7d03..6ac5ae130 100644 --- a/lib/Invoice.php +++ b/lib/Invoice.php @@ -130,7 +130,6 @@ class Invoice extends ApiResource const OBJECT_NAME = 'invoice'; use ApiOperations\NestedResource; - use ApiOperations\Search; use ApiOperations\Update; const BILLING_REASON_AUTOMATIC_PENDING_INVOICE_ITEM_INVOICE = 'automatic_pending_invoice_item_invoice'; diff --git a/lib/Issuing/Authorization.php b/lib/Issuing/Authorization.php index f675cb167..ed14cd4e8 100644 --- a/lib/Issuing/Authorization.php +++ b/lib/Issuing/Authorization.php @@ -22,6 +22,8 @@ * @property null|string|\Stripe\Issuing\Cardholder $cardholder The cardholder to whom this authorization belongs. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency The currency of the cardholder. This currency can be different from the currency presented at authorization and the merchant_currency field on this authorization. Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property null|\Stripe\StripeObject $fleet Fleet-specific information for authorizations using Fleet cards. + * @property null|\Stripe\StripeObject $fuel Information about fuel that was purchased with this transaction. Typically this information is received from the merchant after the authorization has been approved and the fuel dispensed. * @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 $merchant_amount The total amount that was authorized or rejected. This amount is in the merchant_currency and in the smallest currency unit. merchant_amount should be the same as amount, unless merchant_currency and currency are different. * @property string $merchant_currency The local currency that was presented to the cardholder for the authorization. This currency can be different from the cardholder currency and the currency field on this authorization. Three-letter ISO currency code, in lowercase. Must be a supported currency. diff --git a/lib/Margin.php b/lib/Margin.php index f3c2aaf3a..ad4a52fe1 100644 --- a/lib/Margin.php +++ b/lib/Margin.php @@ -26,7 +26,7 @@ class Margin extends ApiResource /** * Create a margin object to be used with invoices, invoice items, and invoice line - * items for a customer to represent a partner discount.A margin has a + * items for a customer to represent a partner discount. A margin has a * percent_off which is the percent that will be taken off the * subtotal after all items and other discounts and promotions) of any invoices for * a customer. Calculation of prorations do not include any partner margins applied diff --git a/lib/PaymentIntent.php b/lib/PaymentIntent.php index 740592bd0..9d6cf0e5b 100644 --- a/lib/PaymentIntent.php +++ b/lib/PaymentIntent.php @@ -64,7 +64,6 @@ class PaymentIntent extends ApiResource { const OBJECT_NAME = 'payment_intent'; - use ApiOperations\Search; use ApiOperations\Update; const CANCELLATION_REASON_ABANDONED = 'abandoned'; diff --git a/lib/PlatformTaxFee.php b/lib/PlatformTaxFee.php deleted file mode 100644 index cb9fea7db..000000000 --- a/lib/PlatformTaxFee.php +++ /dev/null @@ -1,17 +0,0 @@ -percent_off which is the percent that will be taken off the * subtotal after all items and other discounts and promotions) of any invoices for * a customer. Calculation of prorations do not include any partner margins applied diff --git a/lib/Service/Tax/CalculationService.php b/lib/Service/Tax/CalculationService.php index 252c599c2..60cb3ea4f 100644 --- a/lib/Service/Tax/CalculationService.php +++ b/lib/Service/Tax/CalculationService.php @@ -11,7 +11,8 @@ class CalculationService extends \Stripe\Service\AbstractService { /** - * Retrieves the line items of a persisted tax calculation as a collection. + * Retrieves the line items of a tax calculation as a collection, if the + * calculation hasn’t expired. * * @param string $id * @param null|array $params @@ -27,7 +28,8 @@ public function allLineItems($id, $params = null, $opts = null) } /** - * Calculates tax based on input and returns a Tax Calculation object. + * Calculates tax based on the input and returns a Tax Calculation + * object. * * @param null|array $params * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts diff --git a/lib/Service/TestHelpers/Issuing/AuthorizationService.php b/lib/Service/TestHelpers/Issuing/AuthorizationService.php index 50db7c836..82faeff47 100644 --- a/lib/Service/TestHelpers/Issuing/AuthorizationService.php +++ b/lib/Service/TestHelpers/Issuing/AuthorizationService.php @@ -57,6 +57,23 @@ public function expire($id, $params = null, $opts = null) return $this->request('post', $this->buildPath('/v1/test_helpers/issuing/authorizations/%s/expire', $id), $params, $opts); } + /** + * Finalize the amount on an Authorization prior to capture, when the initial + * authorization was for an estimated amount. + * + * @param string $id + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Authorization + */ + public function finalizeAmount($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/test_helpers/issuing/authorizations/%s/finalize_amount', $id), $params, $opts); + } + /** * Increment a test-mode Authorization. * diff --git a/lib/Subscription.php b/lib/Subscription.php index c16603af9..2fa86ae33 100644 --- a/lib/Subscription.php +++ b/lib/Subscription.php @@ -61,7 +61,6 @@ class Subscription extends ApiResource { const OBJECT_NAME = 'subscription'; - use ApiOperations\Search; use ApiOperations\Update; const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically'; diff --git a/lib/Tax/Calculation.php b/lib/Tax/Calculation.php index f70b46593..d9155267d 100644 --- a/lib/Tax/Calculation.php +++ b/lib/Tax/Calculation.php @@ -30,7 +30,8 @@ class Calculation extends \Stripe\ApiResource const OBJECT_NAME = 'tax.calculation'; /** - * Calculates tax based on input and returns a Tax Calculation object. + * Calculates tax based on the input and returns a Tax Calculation + * object. * * @param null|array $params * @param null|array|string $options diff --git a/lib/TaxId.php b/lib/TaxId.php index 18a214c83..e69a22a88 100644 --- a/lib/TaxId.php +++ b/lib/TaxId.php @@ -17,7 +17,7 @@ * @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 null|\Stripe\StripeObject $owner The account or customer the tax ID belongs to. - * @property string $type Type of the tax ID, one of ad_nrt, ae_trn, ar_cuit, au_abn, au_arn, bg_uic, bh_vat, 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, de_stn, 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, kz_bin, li_uid, mx_rfc, my_frp, my_itn, my_sst, ng_tin, no_vat, no_voec, nz_gst, om_vat, 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 $type Type of the tax ID, one of ad_nrt, ae_trn, ar_cuit, au_abn, au_arn, bg_uic, bh_vat, bo_tin, br_cnpj, br_cpf, ca_bn, ca_gst_hst, ca_pst_bc, ca_pst_mb, ca_pst_sk, ca_qst, ch_uid, ch_vat, cl_tin, cn_tin, co_nit, cr_tin, de_stn, 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, kz_bin, li_uid, mx_rfc, my_frp, my_itn, my_sst, ng_tin, no_vat, no_voec, nz_gst, om_vat, 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. */ @@ -41,6 +41,7 @@ class TaxId extends ApiResource const TYPE_CA_PST_MB = 'ca_pst_mb'; const TYPE_CA_PST_SK = 'ca_pst_sk'; const TYPE_CA_QST = 'ca_qst'; + const TYPE_CH_UID = 'ch_uid'; const TYPE_CH_VAT = 'ch_vat'; const TYPE_CL_TIN = 'cl_tin'; const TYPE_CN_TIN = 'cn_tin'; diff --git a/lib/Terminal/Configuration.php b/lib/Terminal/Configuration.php index 7a0e411b1..66a6e6673 100644 --- a/lib/Terminal/Configuration.php +++ b/lib/Terminal/Configuration.php @@ -14,6 +14,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 null|string $name String indicating the name of the Configuration object, set by the user * @property null|\Stripe\StripeObject $offline + * @property null|\Stripe\StripeObject $reboot_window * @property null|\Stripe\StripeObject $stripe_s700 * @property null|\Stripe\StripeObject $tipping * @property null|\Stripe\StripeObject $verifone_p400 diff --git a/lib/Terminal/ConnectionToken.php b/lib/Terminal/ConnectionToken.php index dd8ce032a..276ec2ad5 100644 --- a/lib/Terminal/ConnectionToken.php +++ b/lib/Terminal/ConnectionToken.php @@ -10,7 +10,7 @@ * Related guide: Fleet management * * @property string $object String representing the object's type. Objects of the same type share the same value. - * @property null|string $location The id of the location that this connection token is scoped to. Note that location scoping only applies to internet-connected readers. For more details, see the docs on scoping connection tokens. + * @property null|string $location The id of the location that this connection token is scoped to. Note that location scoping only applies to internet-connected readers. For more details, see the docs on scoping connection tokens. * @property string $secret Your application should pass this token to the Stripe Terminal SDK. */ class ConnectionToken extends \Stripe\ApiResource diff --git a/lib/Util/ApiVersion.php b/lib/Util/ApiVersion.php index e180c3166..481a81dcd 100644 --- a/lib/Util/ApiVersion.php +++ b/lib/Util/ApiVersion.php @@ -6,6 +6,6 @@ class ApiVersion { - const CURRENT = '2024-04-10'; + const CURRENT = '2024-06-20'; const PREVIEW = '2024-05-23.preview-v2'; } diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index 8ebb68fbc..85589ad7e 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -101,7 +101,6 @@ class ObjectTypes \Stripe\Payout::OBJECT_NAME => \Stripe\Payout::class, \Stripe\Person::OBJECT_NAME => \Stripe\Person::class, \Stripe\Plan::OBJECT_NAME => \Stripe\Plan::class, - \Stripe\PlatformTaxFee::OBJECT_NAME => \Stripe\PlatformTaxFee::class, \Stripe\Price::OBJECT_NAME => \Stripe\Price::class, \Stripe\Product::OBJECT_NAME => \Stripe\Product::class, \Stripe\ProductFeature::OBJECT_NAME => \Stripe\ProductFeature::class, diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 983b38e60..0f6df7019 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -11,3 +11,7 @@ parameters: - '#Unsafe usage of new static\(\).#' reportUnmatchedIgnoredErrors: false + + paths: + - lib + - tests diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index 59c17b245..8f0f1ba98 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -3674,7 +3674,7 @@ public function testTestHelpersIssuingAuthorizationsCapturePost() 'type' => 'diesel', 'unit' => 'liter', 'unit_cost_decimal' => '3.5', - 'volume_decimal' => '10', + 'quantity_decimal' => '10', ], 'lodging' => [ 'check_in_at' => 1633651200, @@ -3907,7 +3907,7 @@ public function testTestHelpersIssuingTransactionsCreateForceCapturePost() 'type' => 'diesel', 'unit' => 'liter', 'unit_cost_decimal' => '3.5', - 'volume_decimal' => '10', + 'quantity_decimal' => '10', ], 'lodging' => [ 'check_in_at' => 1533651200, @@ -3968,7 +3968,7 @@ public function testTestHelpersIssuingTransactionsCreateUnlinkedRefundPost() 'type' => 'diesel', 'unit' => 'liter', 'unit_cost_decimal' => '3.5', - 'volume_decimal' => '10', + 'quantity_decimal' => '10', ], 'lodging' => [ 'check_in_at' => 1533651200,