From add478dd076a8e1658781a8657cd9d339516487a Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Wed, 22 Jan 2020 19:58:12 -0500 Subject: [PATCH] Autogen from 6f6e3ce3c --- lib/Account.php | 229 ++++++++++++++++++++-------------- lib/ApplicationFee.php | 17 ++- lib/Balance.php | 7 +- lib/BalanceTransaction.php | 2 +- lib/BitcoinReceiver.php | 2 +- lib/Charge.php | 12 +- lib/Checkout/Session.php | 3 +- lib/CreditNote.php | 32 ++++- lib/Customer.php | 185 ++++++++++++++++----------- lib/Dispute.php | 2 +- lib/EphemeralKey.php | 4 +- lib/Event.php | 2 +- lib/File.php | 10 +- lib/Invoice.php | 80 ++++++------ lib/InvoiceItem.php | 3 +- lib/Issuing/Authorization.php | 9 +- lib/Issuing/Card.php | 4 +- lib/Issuing/Cardholder.php | 2 +- lib/Mandate.php | 4 +- lib/Order.php | 26 ++-- lib/OrderReturn.php | 2 +- lib/PaymentIntent.php | 12 +- lib/PaymentMethod.php | 7 +- lib/Plan.php | 4 +- lib/Product.php | 4 +- lib/Recipient.php | 2 +- lib/Reporting/ReportRun.php | 2 +- lib/Review.php | 4 +- lib/SKU.php | 2 +- lib/SetupIntent.php | 7 +- lib/Source.php | 5 +- lib/Subscription.php | 14 ++- lib/SubscriptionItem.php | 22 ++-- lib/SubscriptionSchedule.php | 12 +- lib/Token.php | 4 +- lib/Transfer.php | 20 ++- phpstan-baseline.neon | 5 + 37 files changed, 445 insertions(+), 318 deletions(-) diff --git a/lib/Account.php b/lib/Account.php index 57581f8285..f57d7fa686 100644 --- a/lib/Account.php +++ b/lib/Account.php @@ -7,7 +7,7 @@ * * @property string $id * @property string $object - * @property mixed|null $business_profile + * @property \Stripe\StripeObject|null $business_profile * @property string|null $business_type * @property mixed $capabilities * @property bool $charges_enabled @@ -22,7 +22,7 @@ * @property \Stripe\StripeObject $metadata * @property bool $payouts_enabled * @property mixed $requirements - * @property mixed|null $settings + * @property \Stripe\StripeObject|null $settings * @property mixed $tos_acceptance * @property string $type * @@ -36,10 +36,11 @@ class Account extends ApiResource use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\NestedResource; + use ApiOperations\Update; + use ApiOperations\Retrieve { retrieve as protected _retrieve; } - use ApiOperations\Update; /** * Possible string representations of an account's business type. @@ -85,11 +86,6 @@ public static function getSavedNestedResources() return $savedNestedResources; } - const PATH_CAPABILITIES = '/capabilities'; - const PATH_EXTERNAL_ACCOUNTS = '/external_accounts'; - const PATH_LOGIN_LINKS = '/login_links'; - const PATH_PERSONS = '/persons'; - public function instanceUrl() { if ($this['id'] === null) { @@ -99,6 +95,55 @@ public function instanceUrl() } } + public function serializeParameters($force = false) + { + $update = parent::serializeParameters($force); + if (isset($this->_values['legal_entity'])) { + $entity = $this['legal_entity']; + if (isset($entity->_values['additional_owners'])) { + $owners = $entity['additional_owners']; + $entityUpdate = isset($update['legal_entity']) ? $update['legal_entity'] : []; + $entityUpdate['additional_owners'] = $this->serializeAdditionalOwners($entity, $owners); + $update['legal_entity'] = $entityUpdate; + } + } + if (isset($this->_values['individual'])) { + $individual = $this['individual']; + if (($individual instanceof Person) && !isset($update['individual'])) { + $update['individual'] = $individual->serializeParameters($force); + } + } + return $update; + } + + private function serializeAdditionalOwners($legalEntity, $additionalOwners) + { + if (isset($legalEntity->_originalValues['additional_owners'])) { + $originalValue = $legalEntity->_originalValues['additional_owners']; + } else { + $originalValue = []; + } + if (($originalValue) && (count($originalValue) > count($additionalOwners))) { + throw new Exception\InvalidArgumentException( + "You cannot delete an item from an array, you must instead set a new array" + ); + } + + $updateArr = []; + foreach ($additionalOwners as $i => $v) { + $update = ($v instanceof StripeObject) ? $v->serializeParameters() : $v; + + if ($update !== []) { + if (!$originalValue || + !array_key_exists($i, $originalValue) || + ($update != $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) { + $updateArr[$i] = $update; + } + } + } + return $updateArr; + } + /** * @param array|string|null $id The ID of the account to retrieve, or an * options array containing an `id` key. @@ -117,22 +162,6 @@ public static function retrieve($id = null, $opts = null) return self::_retrieve($id, $opts); } - /** - * @param array|null $params - * @param array|string|null $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return Account The rejected account. - */ - public function reject($params = null, $opts = null) - { - $url = $this->instanceUrl() . '/reject'; - list($response, $opts) = $this->_request('post', $url, $params, $opts); - $this->refreshFrom($response, $opts); - return $this; - } - /** * @param array|null $clientId * @param array|string|null $opts @@ -150,6 +179,22 @@ public function deauthorize($clientId = null, $opts = null) return OAuth::deauthorize($params, $opts); } + /** + * @param array|null $params + * @param array|string|null $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Account The rejected account. + */ + public function reject($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/reject'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + return $this; + } + /* * Capabilities methods * We can not add the capabilities() method today as the Account object already has a @@ -157,6 +202,8 @@ public function deauthorize($clientId = null, $opts = null) */ + const PATH_CAPABILITIES = '/capabilities'; + /** * @param string $id The ID of the account to which the capability belongs. * @param string $capabilityId The ID of the capability to retrieve. @@ -167,8 +214,12 @@ public function deauthorize($clientId = null, $opts = null) * * @return Capability */ - public static function retrieveCapability($id, $capabilityId, $params = null, $opts = null) - { + public static function retrieveCapability( + $id, + $capabilityId, + $params = null, + $opts = null + ) { return self::_retrieveNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts); } @@ -182,8 +233,12 @@ public static function retrieveCapability($id, $capabilityId, $params = null, $o * * @return Capability */ - public static function updateCapability($id, $capabilityId, $params = null, $opts = null) - { + public static function updateCapability( + $id, + $capabilityId, + $params = null, + $opts = null + ) { return self::_updateNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts); } @@ -201,6 +256,8 @@ public static function allCapabilities($id, $params = null, $opts = null) return self::_allNestedResources($id, static::PATH_CAPABILITIES, $params, $opts); } + const PATH_EXTERNAL_ACCOUNTS = '/external_accounts'; + /** * @param string $id The ID of the account on which to create the external account. * @param array|null $params @@ -210,8 +267,11 @@ public static function allCapabilities($id, $params = null, $opts = null) * * @return BankAccount|Card */ - public static function createExternalAccount($id, $params = null, $opts = null) - { + public static function createExternalAccount( + $id, + $params = null, + $opts = null + ) { return self::_createNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts); } @@ -225,8 +285,12 @@ public static function createExternalAccount($id, $params = null, $opts = null) * * @return BankAccount|Card */ - public static function retrieveExternalAccount($id, $externalAccountId, $params = null, $opts = null) - { + public static function retrieveExternalAccount( + $id, + $externalAccountId, + $params = null, + $opts = null + ) { return self::_retrieveNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts); } @@ -240,8 +304,12 @@ public static function retrieveExternalAccount($id, $externalAccountId, $params * * @return BankAccount|Card */ - public static function updateExternalAccount($id, $externalAccountId, $params = null, $opts = null) - { + public static function updateExternalAccount( + $id, + $externalAccountId, + $params = null, + $opts = null + ) { return self::_updateNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts); } @@ -255,8 +323,12 @@ public static function updateExternalAccount($id, $externalAccountId, $params = * * @return BankAccount|Card */ - public static function deleteExternalAccount($id, $externalAccountId, $params = null, $opts = null) - { + public static function deleteExternalAccount( + $id, + $externalAccountId, + $params = null, + $opts = null + ) { return self::_deleteNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts); } @@ -269,11 +341,16 @@ public static function deleteExternalAccount($id, $externalAccountId, $params = * * @return Collection The list of external accounts (BankAccount or Card). */ - public static function allExternalAccounts($id, $params = null, $opts = null) - { + public static function allExternalAccounts( + $id, + $params = null, + $opts = null + ) { return self::_allNestedResources($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts); } + const PATH_LOGIN_LINKS = '/login_links'; + /** * @param string $id The ID of the account on which to create the login link. * @param array|null $params @@ -288,6 +365,8 @@ public static function createLoginLink($id, $params = null, $opts = null) return self::_createNestedResource($id, static::PATH_LOGIN_LINKS, $params, $opts); } + const PATH_PERSONS = '/persons'; + /** * @param array|null $params * @param array|string|null $opts @@ -305,6 +384,7 @@ public function persons($params = null, $opts = null) return $obj; } + /** * @param string $id The ID of the account on which to create the person. * @param array|null $params @@ -329,8 +409,12 @@ public static function createPerson($id, $params = null, $opts = null) * * @return Person */ - public static function retrievePerson($id, $personId, $params = null, $opts = null) - { + public static function retrievePerson( + $id, + $personId, + $params = null, + $opts = null + ) { return self::_retrieveNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts); } @@ -344,8 +428,12 @@ public static function retrievePerson($id, $personId, $params = null, $opts = nu * * @return Person */ - public static function updatePerson($id, $personId, $params = null, $opts = null) - { + public static function updatePerson( + $id, + $personId, + $params = null, + $opts = null + ) { return self::_updateNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts); } @@ -359,8 +447,12 @@ public static function updatePerson($id, $personId, $params = null, $opts = null * * @return Person */ - public static function deletePerson($id, $personId, $params = null, $opts = null) - { + public static function deletePerson( + $id, + $personId, + $params = null, + $opts = null + ) { return self::_deleteNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts); } @@ -377,53 +469,4 @@ public static function allPersons($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_PERSONS, $params, $opts); } - - public function serializeParameters($force = false) - { - $update = parent::serializeParameters($force); - if (isset($this->_values['legal_entity'])) { - $entity = $this['legal_entity']; - if (isset($entity->_values['additional_owners'])) { - $owners = $entity['additional_owners']; - $entityUpdate = isset($update['legal_entity']) ? $update['legal_entity'] : []; - $entityUpdate['additional_owners'] = $this->serializeAdditionalOwners($entity, $owners); - $update['legal_entity'] = $entityUpdate; - } - } - if (isset($this->_values['individual'])) { - $individual = $this['individual']; - if (($individual instanceof Person) && !isset($update['individual'])) { - $update['individual'] = $individual->serializeParameters($force); - } - } - return $update; - } - - private function serializeAdditionalOwners($legalEntity, $additionalOwners) - { - if (isset($legalEntity->_originalValues['additional_owners'])) { - $originalValue = $legalEntity->_originalValues['additional_owners']; - } else { - $originalValue = []; - } - if (($originalValue) && (count($originalValue) > count($additionalOwners))) { - throw new Exception\InvalidArgumentException( - "You cannot delete an item from an array, you must instead set a new array" - ); - } - - $updateArr = []; - foreach ($additionalOwners as $i => $v) { - $update = ($v instanceof StripeObject) ? $v->serializeParameters() : $v; - - if ($update !== []) { - if (!$originalValue || - !array_key_exists($i, $originalValue) || - ($update != $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) { - $updateArr[$i] = $update; - } - } - } - return $updateArr; - } } diff --git a/lib/ApplicationFee.php b/lib/ApplicationFee.php index 07f6f0acda..a20e835cb5 100644 --- a/lib/ApplicationFee.php +++ b/lib/ApplicationFee.php @@ -30,6 +30,7 @@ class ApplicationFee extends ApiResource use ApiOperations\NestedResource; use ApiOperations\Retrieve; + const PATH_REFUNDS = '/refunds'; /** @@ -56,8 +57,12 @@ public static function createRefund($id, $params = null, $opts = null) * * @return ApplicationFeeRefund */ - public static function retrieveRefund($id, $refundId, $params = null, $opts = null) - { + public static function retrieveRefund( + $id, + $refundId, + $params = null, + $opts = null + ) { return self::_retrieveNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $opts); } @@ -71,8 +76,12 @@ public static function retrieveRefund($id, $refundId, $params = null, $opts = nu * * @return ApplicationFeeRefund */ - public static function updateRefund($id, $refundId, $params = null, $opts = null) - { + public static function updateRefund( + $id, + $refundId, + $params = null, + $opts = null + ) { return self::_updateNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $opts); } diff --git a/lib/Balance.php b/lib/Balance.php index aacd60cbe3..0c7749eaf4 100644 --- a/lib/Balance.php +++ b/lib/Balance.php @@ -6,10 +6,10 @@ * Class Balance * * @property string $object - * @property array $available - * @property array $connect_reserved + * @property \Stripe\StripeObject[] $available + * @property \Stripe\StripeObject[] $connect_reserved * @property bool $livemode - * @property array $pending + * @property \Stripe\StripeObject[] $pending * * @package Stripe */ @@ -17,6 +17,7 @@ class Balance extends SingletonApiResource { const OBJECT_NAME = 'balance'; + /** * @param array|string|null $opts * diff --git a/lib/BalanceTransaction.php b/lib/BalanceTransaction.php index 6ee4b9c80a..9493d4c95a 100644 --- a/lib/BalanceTransaction.php +++ b/lib/BalanceTransaction.php @@ -14,7 +14,7 @@ * @property string|null $description * @property float|null $exchange_rate * @property int $fee - * @property mixed $fee_details + * @property \Stripe\StripeObject[] $fee_details * @property int $net * @property string $reporting_category * @property string|null $source diff --git a/lib/BitcoinReceiver.php b/lib/BitcoinReceiver.php index 734476daee..e6fb2b4e07 100644 --- a/lib/BitcoinReceiver.php +++ b/lib/BitcoinReceiver.php @@ -27,7 +27,7 @@ * @property \Stripe\StripeObject $metadata * @property string|null $payment * @property string|null $refund_address - * @property mixed $transactions + * @property \Stripe\Collection $transactions * @property bool $uncaptured_funds * @property bool|null $used_for_payment * diff --git a/lib/Charge.php b/lib/Charge.php index f14f27ca41..42d0a1211a 100644 --- a/lib/Charge.php +++ b/lib/Charge.php @@ -24,31 +24,31 @@ * @property bool $disputed * @property string|null $failure_code * @property string|null $failure_message - * @property mixed|null $fraud_details + * @property \Stripe\StripeObject|null $fraud_details * @property string|null $invoice * @property bool $livemode * @property \Stripe\StripeObject $metadata * @property string|null $on_behalf_of * @property string|null $order - * @property mixed|null $outcome + * @property \Stripe\StripeObject|null $outcome * @property bool $paid * @property string|null $payment_intent * @property string|null $payment_method - * @property mixed|null $payment_method_details + * @property \Stripe\StripeObject|null $payment_method_details * @property string|null $receipt_email * @property string|null $receipt_number * @property string $receipt_url * @property bool $refunded * @property \Stripe\Collection $refunds * @property string|null $review - * @property mixed|null $shipping - * @property mixed|null $source + * @property \Stripe\StripeObject|null $shipping + * @property \Stripe\StripeObject|null $source * @property string|null $source_transfer * @property string|null $statement_descriptor * @property string|null $statement_descriptor_suffix * @property string $status * @property string $transfer - * @property mixed|null $transfer_data + * @property \Stripe\StripeObject|null $transfer_data * @property string|null $transfer_group * * @package Stripe diff --git a/lib/Checkout/Session.php b/lib/Checkout/Session.php index 8cac83f852..109b3a50e7 100644 --- a/lib/Checkout/Session.php +++ b/lib/Checkout/Session.php @@ -12,9 +12,10 @@ * @property string|null $client_reference_id * @property string|null $customer * @property string|null $customer_email - * @property mixed|null $display_items + * @property \Stripe\StripeObject[]|null $display_items * @property bool $livemode * @property string|null $locale + * @property \Stripe\StripeObject|null $metadata * @property string|null $mode * @property string|null $payment_intent * @property string[] $payment_method_types diff --git a/lib/CreditNote.php b/lib/CreditNote.php index 1919cdb554..a9d9932e01 100644 --- a/lib/CreditNote.php +++ b/lib/CreditNote.php @@ -12,15 +12,21 @@ * @property string $currency * @property string $customer * @property string|null $customer_balance_transaction + * @property int $discount_amount * @property string $invoice + * @property \Stripe\Collection $lines * @property bool $livemode * @property string|null $memo * @property \Stripe\StripeObject $metadata * @property string $number + * @property int|null $out_of_band_amount * @property string $pdf * @property string|null $reason * @property string|null $refund * @property string $status + * @property int $subtotal + * @property \Stripe\StripeObject[] $tax_amounts + * @property int $total * @property string $type * @property int|null $voided_at * @@ -32,9 +38,9 @@ class CreditNote extends ApiResource use ApiOperations\All; use ApiOperations\Create; + use ApiOperations\NestedResource; use ApiOperations\Retrieve; use ApiOperations\Update; - use ApiOperations\NestedResource; /** * Possible string representations of the credit note reason. @@ -59,8 +65,6 @@ class CreditNote extends ApiResource const TYPE_POST_PAYMENT = 'post_payment'; const TYPE_PRE_PAYMENT = 'pre_payment'; - const PATH_LINES = '/lines'; - /** * @param array|null $params * @param array|string|null $opts @@ -78,6 +82,22 @@ public static function preview($params = null, $opts = null) return $obj; } + /** + * @param array|null $params + * @param array|string|null $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return CreditNote The previewed credit note. + */ + public function previewLines($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/lines'; + list($response, $opts) = $this->_request('get', $url, $params, $opts); + $obj = \Stripe\Util\Util::convertToStripeObject($response, $opts); + $obj->setLastResponse($response); + return $obj; + } /** * @param array|null $params * @param array|string|null $opts @@ -94,14 +114,16 @@ public function voidCreditNote($params = null, $opts = null) return $this; } + const PATH_LINES = '/lines'; + /** - * @param string $id The ID of the credit note on which to retrieve the lines. + * @param string $id The ID of the credit note on which to retrieve the credit note line items. * @param array|null $params * @param array|string|null $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return Collection The list of lines (CreditNoteLineItem). + * @return Collection The list of credit note line items. */ public static function allLines($id, $params = null, $opts = null) { diff --git a/lib/Customer.php b/lib/Customer.php index 336ddc7b44..7433d1c9fd 100644 --- a/lib/Customer.php +++ b/lib/Customer.php @@ -7,7 +7,7 @@ * * @property string $id * @property string $object - * @property mixed|null $address + * @property \Stripe\StripeObject|null $address * @property int $balance * @property int $created * @property string|null $currency @@ -23,7 +23,7 @@ * @property string|null $name * @property string|null $phone * @property string[]|null $preferred_locales - * @property mixed|null $shipping + * @property \Stripe\StripeObject|null $shipping * @property \Stripe\Collection $sources * @property \Stripe\Collection $subscriptions * @property string|null $tax_exempt @@ -61,10 +61,6 @@ public static function getSavedNestedResources() return $savedNestedResources; } - const PATH_BALANCE_TRANSACTIONS = '/balance_transactions'; - const PATH_SOURCES = '/sources'; - const PATH_TAX_IDS = '/tax_ids'; - /** * @param array|null $params * @param array|string|null $opts @@ -78,192 +74,233 @@ public function deleteDiscount($params = null, $opts = null) $this->refreshFrom(['discount' => null], $opts, true); } + + const PATH_BALANCE_TRANSACTIONS = '/balance_transactions'; + /** - * @param string $id The ID of the customer on which to create the source. + * @param string $id The ID of the customer on which to create the customer balance transaction. * @param array|null $params * @param array|string|null $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return ApiResource + * @return BalanceTransaction */ - public static function createSource($id, $params = null, $opts = null) - { - return self::_createNestedResource($id, static::PATH_SOURCES, $params, $opts); + public static function createBalanceTransaction( + $id, + $params = null, + $opts = null + ) { + return self::_createNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts); } /** - * @param string $id The ID of the customer to which the source belongs. - * @param string $sourceId The ID of the source to retrieve. + * @param string $id The ID of the customer to which the customer balance transaction belongs. + * @param string $balanceTransactionId The ID of the customer balance transaction to retrieve. * @param array|null $params * @param array|string|null $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return ApiResource + * @return BalanceTransaction */ - public static function retrieveSource($id, $sourceId, $params = null, $opts = null) - { - return self::_retrieveNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts); + public static function retrieveBalanceTransaction( + $id, + $balanceTransactionId, + $params = null, + $opts = null + ) { + return self::_retrieveNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts); } /** - * @param string $id The ID of the customer to which the source belongs. - * @param string $sourceId The ID of the source to update. + * @param string $id The ID of the customer to which the customer balance transaction belongs. + * @param string $balanceTransactionId The ID of the customer balance transaction to update. * @param array|null $params * @param array|string|null $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return ApiResource + * @return BalanceTransaction */ - public static function updateSource($id, $sourceId, $params = null, $opts = null) - { - return self::_updateNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts); + public static function updateBalanceTransaction( + $id, + $balanceTransactionId, + $params = null, + $opts = null + ) { + return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts); } /** - * @param string $id The ID of the customer to which the source belongs. - * @param string $sourceId The ID of the source to delete. + * @param string $id The ID of the customer on which to retrieve the customer balance transactions. * @param array|null $params * @param array|string|null $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return ApiResource + * @return Collection The list of customer balance transactions. */ - public static function deleteSource($id, $sourceId, $params = null, $opts = null) - { - return self::_deleteNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts); + public static function allBalanceTransactions( + $id, + $params = null, + $opts = null + ) { + return self::_allNestedResources($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts); } + const PATH_SOURCES = '/sources'; + /** - * @param string $id The ID of the customer on which to retrieve the sources. + * @param string $id The ID of the customer on which to create the payment source. * @param array|null $params * @param array|string|null $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return Collection The list of sources. + * @return AlipayAccount|BankAccount|BitcoinReceiver|Card|Source */ - public static function allSources($id, $params = null, $opts = null) + public static function createSource($id, $params = null, $opts = null) { - return self::_allNestedResources($id, static::PATH_SOURCES, $params, $opts); + return self::_createNestedResource($id, static::PATH_SOURCES, $params, $opts); } /** - * @param string $id The ID of the customer on which to create the tax id. + * @param string $id The ID of the customer to which the payment source belongs. + * @param string $sourceId The ID of the payment source to retrieve. * @param array|null $params * @param array|string|null $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return TaxId + * @return AlipayAccount|BankAccount|BitcoinReceiver|Card|Source */ - public static function createTaxId($id, $params = null, $opts = null) - { - return self::_createNestedResource($id, static::PATH_TAX_IDS, $params, $opts); + public static function retrieveSource( + $id, + $sourceId, + $params = null, + $opts = null + ) { + return self::_retrieveNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts); } /** - * @param string $id The ID of the customer to which the tax id belongs. - * @param string $taxIdId The ID of the tax id to retrieve. + * @param string $id The ID of the customer to which the payment source belongs. + * @param string $sourceId The ID of the payment source to update. * @param array|null $params * @param array|string|null $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return TaxId + * @return AlipayAccount|BankAccount|BitcoinReceiver|Card|Source */ - public static function retrieveTaxId($id, $taxIdId, $params = null, $opts = null) - { - return self::_retrieveNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts); + public static function updateSource( + $id, + $sourceId, + $params = null, + $opts = null + ) { + return self::_updateNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts); } /** - * @param string $id The ID of the customer to which the tax id belongs. - * @param string $taxIdId The ID of the tax id to delete. + * @param string $id The ID of the customer to which the payment source belongs. + * @param string $sourceId The ID of the payment source to delete. * @param array|null $params * @param array|string|null $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return TaxId + * @return AlipayAccount|BankAccount|BitcoinReceiver|Card|Source */ - public static function deleteTaxId($id, $taxIdId, $params = null, $opts = null) - { - return self::_deleteNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts); + public static function deleteSource( + $id, + $sourceId, + $params = null, + $opts = null + ) { + return self::_deleteNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts); } /** - * @param string $id The ID of the customer on which to retrieve the tax ids. + * @param string $id The ID of the customer on which to retrieve the payment sources. * @param array|null $params * @param array|string|null $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return Collection The list of tax ids. + * @return Collection The list of payment sources (AlipayAccount, BankAccount, BitcoinReceiver, Card or Source). */ - public static function allTaxIds($id, $params = null, $opts = null) + public static function allSources($id, $params = null, $opts = null) { - return self::_allNestedResources($id, static::PATH_TAX_IDS, $params, $opts); + return self::_allNestedResources($id, static::PATH_SOURCES, $params, $opts); } + const PATH_TAX_IDS = '/tax_ids'; + /** - * @param string $id The ID of the customer on which to create the balance transaction. + * @param string $id The ID of the customer on which to create the tax id. * @param array|null $params * @param array|string|null $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return BalanceTransaction + * @return TaxId */ - public static function createBalanceTransaction($id, $params = null, $opts = null) + public static function createTaxId($id, $params = null, $opts = null) { - return self::_createNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts); + return self::_createNestedResource($id, static::PATH_TAX_IDS, $params, $opts); } /** - * @param string $id The ID of the customer to which the balance transaction belongs. - * @param string $balanceTransactionId The ID of the balance transaction to retrieve. + * @param string $id The ID of the customer to which the tax id belongs. + * @param string $taxIdId The ID of the tax id to retrieve. * @param array|null $params * @param array|string|null $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return BalanceTransaction + * @return TaxId */ - public static function retrieveBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null) - { - return self::_retrieveNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts); + public static function retrieveTaxId( + $id, + $taxIdId, + $params = null, + $opts = null + ) { + return self::_retrieveNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts); } /** - * @param string $id The ID of the customer to which the balance transaction belongs. - * @param string $balanceTransactionId The ID of the balance transaction to update. + * @param string $id The ID of the customer to which the tax id belongs. + * @param string $taxIdId The ID of the tax id to delete. * @param array|null $params * @param array|string|null $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return BalanceTransaction + * @return TaxId */ - public static function updateBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null) - { - return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts); + public static function deleteTaxId( + $id, + $taxIdId, + $params = null, + $opts = null + ) { + return self::_deleteNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts); } /** - * @param string $id The ID of the customer on which to retrieve the balance transactions. + * @param string $id The ID of the customer on which to retrieve the tax ids. * @param array|null $params * @param array|string|null $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return Collection The list of balance transactions. + * @return Collection The list of tax ids. */ - public static function allBalanceTransactions($id, $params = null, $opts = null) + public static function allTaxIds($id, $params = null, $opts = null) { - return self::_allNestedResources($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts); + return self::_allNestedResources($id, static::PATH_TAX_IDS, $params, $opts); } } diff --git a/lib/Dispute.php b/lib/Dispute.php index 8f7478f2e6..aa568ab2f0 100644 --- a/lib/Dispute.php +++ b/lib/Dispute.php @@ -8,7 +8,7 @@ * @property string $id * @property string $object * @property int $amount - * @property BalanceTransaction[] $balance_transactions + * @property \Stripe\BalanceTransaction[] $balance_transactions * @property string $charge * @property int $created * @property string $currency diff --git a/lib/EphemeralKey.php b/lib/EphemeralKey.php index 4479ebe412..f1fb5cab3e 100644 --- a/lib/EphemeralKey.php +++ b/lib/EphemeralKey.php @@ -11,7 +11,6 @@ * @property int $expires * @property bool $livemode * @property string $secret - * @property array $associated_objects * * @package Stripe */ @@ -19,10 +18,11 @@ class EphemeralKey extends ApiResource { const OBJECT_NAME = 'ephemeral_key'; + use ApiOperations\Delete; + use ApiOperations\Create { create as protected _create; } - use ApiOperations\Delete; /** * @param array|null $params diff --git a/lib/Event.php b/lib/Event.php index 2d37155b23..a4f675b9f1 100644 --- a/lib/Event.php +++ b/lib/Event.php @@ -13,7 +13,7 @@ * @property mixed $data * @property bool $livemode * @property int $pending_webhooks - * @property mixed|null $request + * @property \Stripe\StripeObject|null $request * @property string $type * * @package Stripe diff --git a/lib/File.php b/lib/File.php index a4f8b1900e..6e14ef6927 100644 --- a/lib/File.php +++ b/lib/File.php @@ -20,18 +20,20 @@ */ class File extends ApiResource { + const OBJECT_NAME = 'file'; + + use ApiOperations\All; + use ApiOperations\Retrieve; + // This resource can have two different object names. In latter API // versions, only `file` is used, but since stripe-php may be used with // any API version, we need to support deserializing the older // `file_upload` object into the same class. - const OBJECT_NAME = 'file'; - const OBJECT_NAME_ALT = "file_upload"; + const OBJECT_NAME_ALT = 'file_upload'; - use ApiOperations\All; use ApiOperations\Create { create as protected _create; } - use ApiOperations\Retrieve; public static function classUrl() { diff --git a/lib/Invoice.php b/lib/Invoice.php index a5427d4450..7579c5006e 100644 --- a/lib/Invoice.php +++ b/lib/Invoice.php @@ -21,18 +21,18 @@ * @property string|null $collection_method * @property int $created * @property string $currency - * @property array|null $custom_fields + * @property \Stripe\StripeObject[]|null $custom_fields * @property string $customer - * @property mixed|null $customer_address + * @property \Stripe\StripeObject|null $customer_address * @property string|null $customer_email * @property string|null $customer_name * @property string|null $customer_phone - * @property mixed|null $customer_shipping + * @property \Stripe\StripeObject|null $customer_shipping * @property string|null $customer_tax_exempt - * @property array|null $customer_tax_ids + * @property \Stripe\StripeObject[]|null $customer_tax_ids * @property string|null $default_payment_method * @property string|null $default_source - * @property array|null $default_tax_rates + * @property \Stripe\TaxRate[]|null $default_tax_rates * @property string|null $description * @property \Stripe\Discount|null $discount * @property int|null $due_date @@ -60,9 +60,10 @@ * @property int $subscription_proration_date * @property int $subtotal * @property int|null $tax + * @property float|null $tax_percent * @property mixed $threshold_reason * @property int $total - * @property array|null $total_tax_amounts + * @property \Stripe\StripeObject[]|null $total_tax_amounts * @property int|null $webhooks_delivered_at * * @package Stripe @@ -76,6 +77,7 @@ class Invoice extends ApiResource use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; + use ApiOperations\NestedResource; /** @@ -117,6 +119,37 @@ class Invoice extends ApiResource const PATH_LINES = '/lines'; + /** + * @param array|null $params + * @param array|string|null $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Invoice The upcoming invoice. + */ + public static function upcoming($params = null, $opts = null) + { + $url = static::classUrl() . '/upcoming'; + list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); + $obj = Util\Util::convertToStripeObject($response->json, $opts); + $obj->setLastResponse($response); + return $obj; + } + + /** + * @param string $id The ID of the invoice on which to retrieve the lins. + * @param array|null $params + * @param array|string|null $opts + * + * @throws StripeExceptionApiErrorException if the request fails + * + * @return Collection The list of lines (InvoiceLineItem). + */ + public static function allLines($id, $params = null, $opts = null) + { + return self::_allNestedResources($id, static::PATH_LINES, $params, $opts); + } + /** * @param array|null $params * @param array|string|null $opts @@ -132,7 +165,6 @@ public function finalizeInvoice($params = null, $opts = null) $this->refreshFrom($response, $opts); return $this; } - /** * @param array|null $params * @param array|string|null $opts @@ -148,7 +180,6 @@ public function markUncollectible($params = null, $opts = null) $this->refreshFrom($response, $opts); return $this; } - /** * @param array|null $params * @param array|string|null $opts @@ -164,7 +195,6 @@ public function pay($params = null, $opts = null) $this->refreshFrom($response, $opts); return $this; } - /** * @param array|null $params * @param array|string|null $opts @@ -180,24 +210,6 @@ public function sendInvoice($params = null, $opts = null) $this->refreshFrom($response, $opts); return $this; } - - /** - * @param array|null $params - * @param array|string|null $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return Invoice The upcoming invoice. - */ - public static function upcoming($params = null, $opts = null) - { - $url = static::classUrl() . '/upcoming'; - list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); - $obj = Util\Util::convertToStripeObject($response->json, $opts); - $obj->setLastResponse($response); - return $obj; - } - /** * @param array|null $params * @param array|string|null $opts @@ -213,18 +225,4 @@ public function voidInvoice($params = null, $opts = null) $this->refreshFrom($response, $opts); return $this; } - - /** - * @param string $id The ID of the invoice on which to retrieve the lins. - * @param array|null $params - * @param array|string|null $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return Collection The list of lines (InvoiceLineItem). - */ - public static function allLines($id, $params = null, $opts = null) - { - return self::_allNestedResources($id, static::PATH_LINES, $params, $opts); - } } diff --git a/lib/InvoiceItem.php b/lib/InvoiceItem.php index 567be13cb3..2e26f8019e 100644 --- a/lib/InvoiceItem.php +++ b/lib/InvoiceItem.php @@ -22,7 +22,8 @@ * @property int $quantity * @property string|null $subscription * @property string $subscription_item - * @property array|null $tax_rates + * @property \Stripe\TaxRate[]|null $tax_rates + * @property bool $unified_proration * @property int|null $unit_amount * @property string|null $unit_amount_decimal * diff --git a/lib/Issuing/Authorization.php b/lib/Issuing/Authorization.php index 6ce2f735e7..142ca4cbdf 100644 --- a/lib/Issuing/Authorization.php +++ b/lib/Issuing/Authorization.php @@ -11,8 +11,8 @@ * @property string $authorization_method * @property int $authorized_amount * @property string $authorized_currency - * @property \Stripe\Collection $balance_transactions - * @property Card $card + * @property \Stripe\BalanceTransaction[] $balance_transactions + * @property mixed $card * @property string|null $cardholder * @property int $created * @property int $held_amount @@ -23,9 +23,9 @@ * @property \Stripe\StripeObject $metadata * @property int $pending_authorized_amount * @property int $pending_held_amount - * @property mixed $request_history + * @property \Stripe\StripeObject[] $request_history * @property string $status - * @property array $transactions + * @property \Stripe\Issuing\Transaction[] $transactions * @property mixed $verification_data * @property string|null $wallet_provider * @@ -54,7 +54,6 @@ public function approve($params = null, $opts = null) $this->refreshFrom($response, $opts); return $this; } - /** * @param array|null $params * @param array|string|null $opts diff --git a/lib/Issuing/Card.php b/lib/Issuing/Card.php index f157f70ed9..d1fc644e75 100644 --- a/lib/Issuing/Card.php +++ b/lib/Issuing/Card.php @@ -18,10 +18,10 @@ * @property bool $livemode * @property \Stripe\StripeObject $metadata * @property string $name - * @property mixed|null $pin + * @property \Stripe\StripeObject|null $pin * @property string|null $replacement_for * @property string|null $replacement_reason - * @property mixed|null $shipping + * @property \Stripe\StripeObject|null $shipping * @property string $status * @property string $type * diff --git a/lib/Issuing/Cardholder.php b/lib/Issuing/Cardholder.php index c444e910fb..8256cc66fa 100644 --- a/lib/Issuing/Cardholder.php +++ b/lib/Issuing/Cardholder.php @@ -7,7 +7,7 @@ * * @property string $id * @property string $object - * @property mixed|null $authorization_controls + * @property \Stripe\StripeObject|null $authorization_controls * @property mixed $billing * @property \Stripe\StripeObject|null $company * @property int $created diff --git a/lib/Mandate.php b/lib/Mandate.php index 0083f63ad7..4b686a11ff 100644 --- a/lib/Mandate.php +++ b/lib/Mandate.php @@ -9,10 +9,10 @@ * @property string $object * @property mixed $customer_acceptance * @property bool $livemode - * @property mixed|null $multi_use + * @property mixed $multi_use * @property string $payment_method * @property mixed $payment_method_details - * @property mixed|null $single_use + * @property mixed $single_use * @property string $status * @property string $type * diff --git a/lib/Order.php b/lib/Order.php index ef284be1d8..834e343b42 100644 --- a/lib/Order.php +++ b/lib/Order.php @@ -17,15 +17,15 @@ * @property string|null $customer * @property string|null $email * @property string $external_coupon_code - * @property OrderItem[] $items + * @property \Stripe\OrderItem[] $items * @property bool $livemode * @property \Stripe\StripeObject $metadata * @property \Stripe\Collection|null $returns * @property string|null $selected_shipping_method - * @property mixed|null $shipping - * @property array|null $shipping_methods + * @property \Stripe\StripeObject|null $shipping + * @property \Stripe\StripeObject[]|null $shipping_methods * @property string $status - * @property mixed|null $status_transitions + * @property \Stripe\StripeObject|null $status_transitions * @property int|null $updated * @property string $upstream_id * @@ -46,14 +46,13 @@ class Order extends ApiResource * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return Order The paid order. + * @return OrderReturn The newly created return. */ - public function pay($params = null, $opts = null) + public function returnOrder($params = null, $opts = null) { - $url = $this->instanceUrl() . '/pay'; + $url = $this->instanceUrl() . '/returns'; list($response, $opts) = $this->_request('post', $url, $params, $opts); - $this->refreshFrom($response, $opts); - return $this; + return Util\Util::convertToStripeObject($response, $opts); } /** @@ -62,12 +61,13 @@ public function pay($params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return OrderReturn The newly created return. + * @return Order The paid order. */ - public function returnOrder($params = null, $opts = null) + public function pay($params = null, $opts = null) { - $url = $this->instanceUrl() . '/returns'; + $url = $this->instanceUrl() . '/pay'; list($response, $opts) = $this->_request('post', $url, $params, $opts); - return Util\Util::convertToStripeObject($response, $opts); + $this->refreshFrom($response, $opts); + return $this; } } diff --git a/lib/OrderReturn.php b/lib/OrderReturn.php index 8189f452bf..0c61056308 100644 --- a/lib/OrderReturn.php +++ b/lib/OrderReturn.php @@ -10,7 +10,7 @@ * @property int $amount * @property int $created * @property string $currency - * @property OrderItem[] $items + * @property \Stripe\OrderItem[] $items * @property bool $livemode * @property string|null $order * @property string|null $refund diff --git a/lib/PaymentIntent.php b/lib/PaymentIntent.php index 4dd65f906a..f8b080b653 100644 --- a/lib/PaymentIntent.php +++ b/lib/PaymentIntent.php @@ -23,23 +23,23 @@ * @property string|null $customer * @property string|null $description * @property string|null $invoice - * @property mixed|null $last_payment_error + * @property \Stripe\StripeObject|null $last_payment_error * @property bool $livemode * @property \Stripe\StripeObject $metadata - * @property mixed|null $next_action + * @property \Stripe\StripeObject|null $next_action * @property string|null $on_behalf_of * @property string|null $payment_method - * @property mixed|null $payment_method_options + * @property \Stripe\StripeObject|null $payment_method_options * @property string[] $payment_method_types * @property string|null $receipt_email * @property string|null $review * @property string|null $setup_future_usage - * @property mixed|null $shipping + * @property \Stripe\StripeObject|null $shipping * @property string|null $source * @property string|null $statement_descriptor * @property string|null $statement_descriptor_suffix * @property string $status - * @property mixed|null $transfer_data + * @property \Stripe\StripeObject|null $transfer_data * @property string|null $transfer_group * * @package Stripe @@ -81,7 +81,6 @@ public function cancel($params = null, $opts = null) $this->refreshFrom($response, $opts); return $this; } - /** * @param array|null $params * @param array|string|null $opts @@ -97,7 +96,6 @@ public function capture($params = null, $opts = null) $this->refreshFrom($response, $opts); return $this; } - /** * @param array|null $params * @param array|string|null $opts diff --git a/lib/PaymentMethod.php b/lib/PaymentMethod.php index 301541613d..e38342bc84 100644 --- a/lib/PaymentMethod.php +++ b/lib/PaymentMethod.php @@ -7,16 +7,16 @@ * * @property string $id * @property string $object - * @property mixed|null $au_becs_debit + * @property mixed $au_becs_debit * @property mixed $billing_details * @property mixed $card * @property mixed $card_present * @property int $created * @property string|null $customer - * @property mixed|null $ideal + * @property mixed $ideal * @property bool $livemode * @property \Stripe\StripeObject $metadata - * @property mixed|null $sepa_debit + * @property mixed $sepa_debit * @property string $type * * @package Stripe @@ -45,7 +45,6 @@ public function attach($params = null, $opts = null) $this->refreshFrom($response, $opts); return $this; } - /** * @param array|null $params * @param array|string|null $opts diff --git a/lib/Plan.php b/lib/Plan.php index f6ac5653db..f1abcf87ee 100644 --- a/lib/Plan.php +++ b/lib/Plan.php @@ -20,9 +20,9 @@ * @property \Stripe\StripeObject $metadata * @property string|null $nickname * @property string|null $product - * @property mixed|null $tiers + * @property \Stripe\StripeObject[]|null $tiers * @property string|null $tiers_mode - * @property mixed|null $transform_usage + * @property \Stripe\StripeObject|null $transform_usage * @property int|null $trial_period_days * @property string $usage_type * diff --git a/lib/Product.php b/lib/Product.php index faf44dfa4a..3c75cc7319 100644 --- a/lib/Product.php +++ b/lib/Product.php @@ -7,7 +7,7 @@ * * @property string $id * @property string $object - * @property bool|null $active + * @property bool $active * @property string[]|null $attributes * @property string|null $caption * @property int $created @@ -17,7 +17,7 @@ * @property bool $livemode * @property \Stripe\StripeObject $metadata * @property string $name - * @property mixed|null $package_dimensions + * @property \Stripe\StripeObject|null $package_dimensions * @property bool|null $shippable * @property string|null $statement_descriptor * @property string $type diff --git a/lib/Recipient.php b/lib/Recipient.php index 944791ac89..fa4ec4d1b4 100644 --- a/lib/Recipient.php +++ b/lib/Recipient.php @@ -7,7 +7,7 @@ * * @property string $id * @property string $object - * @property mixed|null $active_account + * @property \Stripe\BankAccount|null $active_account * @property \Stripe\Collection|null $cards * @property int $created * @property string|null $default_card diff --git a/lib/Reporting/ReportRun.php b/lib/Reporting/ReportRun.php index 99c6db9ad3..7a85316a5d 100644 --- a/lib/Reporting/ReportRun.php +++ b/lib/Reporting/ReportRun.php @@ -12,7 +12,7 @@ * @property bool $livemode * @property mixed $parameters * @property string $report_type - * @property mixed|null $result + * @property \Stripe\File|null $result * @property string $status * @property int|null $succeeded_at * diff --git a/lib/Review.php b/lib/Review.php index 2a39c85c25..9573d0c7a7 100644 --- a/lib/Review.php +++ b/lib/Review.php @@ -12,13 +12,13 @@ * @property string|null $closed_reason * @property int $created * @property string|null $ip_address - * @property mixed|null $ip_address_location + * @property \Stripe\Terminal\Location|null $ip_address_location * @property bool $livemode * @property bool $open * @property string $opened_reason * @property string $payment_intent * @property string $reason - * @property mixed|null $session + * @property \Stripe\Checkout\Session|null $session * * @package Stripe */ diff --git a/lib/SKU.php b/lib/SKU.php index ccb5f125e4..af2f5ba70f 100644 --- a/lib/SKU.php +++ b/lib/SKU.php @@ -15,7 +15,7 @@ * @property mixed $inventory * @property bool $livemode * @property \Stripe\StripeObject $metadata - * @property mixed|null $package_dimensions + * @property \Stripe\StripeObject|null $package_dimensions * @property int $price * @property string $product * @property int $updated diff --git a/lib/SetupIntent.php b/lib/SetupIntent.php index 3e21c78517..96f10a7eac 100644 --- a/lib/SetupIntent.php +++ b/lib/SetupIntent.php @@ -13,14 +13,14 @@ * @property int $created * @property string|null $customer * @property string|null $description - * @property mixed|null $last_setup_error + * @property \Stripe\StripeObject|null $last_setup_error * @property bool $livemode * @property string|null $mandate * @property \Stripe\StripeObject $metadata - * @property mixed|null $next_action + * @property \Stripe\StripeObject|null $next_action * @property string|null $on_behalf_of * @property string|null $payment_method - * @property mixed|null $payment_method_options + * @property \Stripe\StripeObject|null $payment_method_options * @property string[] $payment_method_types * @property string|null $single_use_mandate * @property string $status @@ -64,7 +64,6 @@ public function cancel($params = null, $opts = null) $this->refreshFrom($response, $opts); return $this; } - /** * @param array|null $params * @param array|string|null $opts diff --git a/lib/Source.php b/lib/Source.php index c22c0f5dc0..33d1928b87 100644 --- a/lib/Source.php +++ b/lib/Source.php @@ -29,7 +29,7 @@ * @property bool $livemode * @property \Stripe\StripeObject|null $metadata * @property mixed $multibanco - * @property mixed|null $owner + * @property \Stripe\StripeObject|null $owner * @property mixed $p24 * @property mixed $receiver * @property mixed $redirect @@ -51,10 +51,11 @@ class Source extends ApiResource const OBJECT_NAME = 'source'; use ApiOperations\Create; - use ApiOperations\NestedResource; use ApiOperations\Retrieve; use ApiOperations\Update; + use ApiOperations\NestedResource; + /** * Possible string representations of source flows. * @link https://stripe.com/docs/api#source_object-flow diff --git a/lib/Subscription.php b/lib/Subscription.php index d9f35ddefb..82e9deaf5d 100644 --- a/lib/Subscription.php +++ b/lib/Subscription.php @@ -9,7 +9,7 @@ * @property string $object * @property float|null $application_fee_percent * @property int $billing_cycle_anchor - * @property mixed|null $billing_thresholds + * @property \Stripe\StripeObject|null $billing_thresholds * @property int|null $cancel_at * @property bool $cancel_at_period_end * @property int|null $canceled_at @@ -21,7 +21,7 @@ * @property int|null $days_until_due * @property string|null $default_payment_method * @property string|null $default_source - * @property array|null $default_tax_rates + * @property \Stripe\TaxRate[]|null $default_tax_rates * @property \Stripe\Discount|null $discount * @property int|null $ended_at * @property \Stripe\Collection $items @@ -29,8 +29,9 @@ * @property bool $livemode * @property \Stripe\StripeObject $metadata * @property int|null $next_pending_invoice_item_invoice - * @property mixed|null $pending_invoice_item_interval + * @property \Stripe\StripeObject|null $pending_invoice_item_interval * @property string|null $pending_setup_intent + * @property \Stripe\StripeObject|null $pending_update * @property \Stripe\Plan|null $plan * @property int|null $quantity * @property string|null $schedule @@ -48,9 +49,6 @@ class Subscription extends ApiResource use ApiOperations\All; use ApiOperations\Create; - use ApiOperations\Delete { - delete as protected _delete; - } use ApiOperations\Retrieve; use ApiOperations\Update; @@ -67,6 +65,10 @@ class Subscription extends ApiResource const STATUS_INCOMPLETE = 'incomplete'; const STATUS_INCOMPLETE_EXPIRED = 'incomplete_expired'; + use ApiOperations\Delete { + delete as protected _delete; + } + public static function getSavedNestedResources() { static $savedNestedResources = null; diff --git a/lib/SubscriptionItem.php b/lib/SubscriptionItem.php index 338a1c8d2b..42fed17c7b 100644 --- a/lib/SubscriptionItem.php +++ b/lib/SubscriptionItem.php @@ -7,13 +7,13 @@ * * @property string $id * @property string $object - * @property mixed|null $billing_thresholds + * @property \Stripe\StripeObject|null $billing_thresholds * @property int $created * @property \Stripe\StripeObject $metadata - * @property \Stripe\Plan $plan + * @property mixed $plan * @property int $quantity * @property string $subscription - * @property array|null $tax_rates + * @property \Stripe\TaxRate[]|null $tax_rates * * @package Stripe */ @@ -28,7 +28,7 @@ class SubscriptionItem extends ApiResource use ApiOperations\Retrieve; use ApiOperations\Update; - const PATH_USAGE_RECORDS = "/usage_records"; + const PATH_USAGE_RECORDS = '/usage_records'; /** * @param string|null $id The ID of the subscription item on which to create the usage record. @@ -63,8 +63,11 @@ public function usageRecordSummaries($params = null, $opts = null) return $obj; } + + const PATH_USAGE_RECORD_SUMMARIES = '/usage_record_summaries'; + /** - * @param string $id + * @param string $id The ID of the subscription item on which to retrieve the usage record summaries. * @param array|null $params * @param array|string|null $opts * @@ -72,8 +75,11 @@ public function usageRecordSummaries($params = null, $opts = null) * * @return Collection The list of usage record summaries. */ - public static function allUsageRecordSummaries($id, $params = null, $opts = null) - { - return self::_allNestedResources($id, '/usage_record_summaries', $params, $opts); + public static function allUsageRecordSummaries( + $id, + $params = null, + $opts = null + ) { + return self::_allNestedResources($id, static::PATH_USAGE_RECORD_SUMMARIES, $params, $opts); } } diff --git a/lib/SubscriptionSchedule.php b/lib/SubscriptionSchedule.php index 307a05600d..f02b158213 100644 --- a/lib/SubscriptionSchedule.php +++ b/lib/SubscriptionSchedule.php @@ -7,22 +7,19 @@ * * @property string $id * @property string $object - * @property mixed|null $billing_thresholds * @property int|null $canceled_at - * @property string|null $collection_method * @property int|null $completed_at * @property int $created - * @property mixed|null $current_phase + * @property \Stripe\StripeObject|null $current_phase * @property string $customer - * @property string|null $default_payment_method + * @property mixed $default_settings * @property string $end_behavior - * @property mixed|null $invoice_settings * @property bool $livemode * @property \Stripe\StripeObject|null $metadata - * @property mixed $phases + * @property \Stripe\StripeObject[] $phases * @property int|null $released_at * @property string|null $released_subscription - * @property mixed|null $renewal_interval + * @property \Stripe\StripeObject|null $renewal_interval * @property string $status * @property string|null $subscription * @@ -52,7 +49,6 @@ public function cancel($params = null, $opts = null) $this->refreshFrom($response, $opts); return $this; } - /** * @param array|null $params * @param array|string|null $opts diff --git a/lib/Token.php b/lib/Token.php index d608574b2f..56864c1e1d 100644 --- a/lib/Token.php +++ b/lib/Token.php @@ -7,8 +7,8 @@ * * @property string $id * @property string $object - * @property \Stripe\BankAccount $bank_account - * @property \Stripe\Card $card + * @property mixed $bank_account + * @property mixed $card * @property string|null $client_ip * @property int $created * @property bool $livemode diff --git a/lib/Transfer.php b/lib/Transfer.php index 1a44ee30dc..2fd1951a93 100644 --- a/lib/Transfer.php +++ b/lib/Transfer.php @@ -35,8 +35,6 @@ class Transfer extends ApiResource use ApiOperations\Retrieve; use ApiOperations\Update; - const PATH_REVERSALS = '/reversals'; - /** * Possible string representations of the source type of the transfer. * @link https://stripe.com/docs/api/transfers/object#transfer_object-source_type @@ -62,6 +60,8 @@ public function cancel($params = null, $opts = null) return $this; } + const PATH_REVERSALS = '/reversals'; + /** * @param string $id The ID of the transfer on which to create the transfer reversal. * @param array|null $params @@ -86,8 +86,12 @@ public static function createReversal($id, $params = null, $opts = null) * * @return TransferReversal */ - public static function retrieveReversal($id, $reversalId, $params = null, $opts = null) - { + public static function retrieveReversal( + $id, + $reversalId, + $params = null, + $opts = null + ) { return self::_retrieveNestedResource($id, static::PATH_REVERSALS, $reversalId, $params, $opts); } @@ -101,8 +105,12 @@ public static function retrieveReversal($id, $reversalId, $params = null, $opts * * @return TransferReversal */ - public static function updateReversal($id, $reversalId, $params = null, $opts = null) - { + public static function updateReversal( + $id, + $reversalId, + $params = null, + $opts = null + ) { return self::_updateNestedResource($id, static::PATH_REVERSALS, $reversalId, $params, $opts); } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 2d465bc2ff..0249106480 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -12,4 +12,9 @@ parameters: count: 1 path: lib/SingletonApiResource.php + - + message: "#^Constant SIGTERM not found\\.$#" + count: 1 + path: tests/StripeMock.php +