Added selectable num of records on each listing page, fixed up Pagination Records UI, added new stripe library, further worked on stripe integration, fixed mispelling in client details

This commit is contained in:
johnny@pittpc.com
2021-02-10 11:21:38 -05:00
parent c748388b9a
commit 530d46a812
352 changed files with 16193 additions and 7090 deletions

View File

@@ -1,769 +0,0 @@
# Changelog
## 7.0.2 - 2019-09-06
* [#729](https://github.com/stripe/stripe-php/pull/729) Fix usage of `SignatureVerificationException` in PHPDoc blocks
## 7.0.1 - 2019-09-05
* [#728](https://github.com/stripe/stripe-php/pull/728) Clean up Collection
## 7.0.0 - 2019-09-03
Major version release. The [migration guide](https://github.com/stripe/stripe-php/wiki/Migration-guide-for-v7) contains a detailed list of backwards-incompatible changes with upgrade instructions.
Pull requests included in this release (cf. [#552](https://github.com/stripe/stripe-php/pull/552)) (⚠️ = breaking changes):
* ⚠️ Drop support for PHP 5.4 ([#551](https://github.com/stripe/stripe-php/pull/551))
* ⚠️ Drop support for PHP 5.5 ([#554](https://github.com/stripe/stripe-php/pull/554))
* Bump dependencies ([#553](https://github.com/stripe/stripe-php/pull/553))
* Remove `CURLFile` check ([#555](https://github.com/stripe/stripe-php/pull/555))
* Update constant definitions for PHP >= 5.6 ([#556](https://github.com/stripe/stripe-php/pull/556))
* ⚠️ Remove `FileUpload` alias ([#557](https://github.com/stripe/stripe-php/pull/557))
* Remove `curl_reset` check ([#570](https://github.com/stripe/stripe-php/pull/570))
* Use `\Stripe\<class>::class` constant instead of strings ([#643](https://github.com/stripe/stripe-php/pull/643))
* Use `array_column` to flatten params ([#686](https://github.com/stripe/stripe-php/pull/686))
* ⚠️ Remove deprecated methods ([#692](https://github.com/stripe/stripe-php/pull/692))
* ⚠️ Remove `IssuerFraudRecord` ([#696](https://github.com/stripe/stripe-php/pull/696))
* Update constructors of Stripe exception classes ([#559](https://github.com/stripe/stripe-php/pull/559))
* Fix remaining TODOs ([#700](https://github.com/stripe/stripe-php/pull/700))
* Use yield for autopagination ([#703](https://github.com/stripe/stripe-php/pull/703))
* ⚠️ Rename fake magic methods and rewrite array conversion ([#704](https://github.com/stripe/stripe-php/pull/704))
* Add `ErrorObject` to Stripe exceptions ([#705](https://github.com/stripe/stripe-php/pull/705))
* Start using PHP CS Fixer ([#706](https://github.com/stripe/stripe-php/pull/706))
* Update error messages for nested resource operations ([#708](https://github.com/stripe/stripe-php/pull/708))
* Upgrade retry logic ([#707](https://github.com/stripe/stripe-php/pull/707))
* ⚠️ `Collection` improvements / fixes ([#715](https://github.com/stripe/stripe-php/pull/715))
* ⚠️ Modernize exceptions ([#709](https://github.com/stripe/stripe-php/pull/709))
* Add constants for error codes ([#716](https://github.com/stripe/stripe-php/pull/716))
* Update certificate bundle ([#717](https://github.com/stripe/stripe-php/pull/717))
* Retry requests on a 429 that's a lock timeout ([#718](https://github.com/stripe/stripe-php/pull/718))
* Fix `toArray()` calls ([#719](https://github.com/stripe/stripe-php/pull/719))
* Couple of fixes for PHP 7.4 ([#725](https://github.com/stripe/stripe-php/pull/725))
## 6.43.1 - 2019-08-29
* [#722](https://github.com/stripe/stripe-php/pull/722) Make `LoggerInterface::error` compatible with its PSR-3 counterpart
* [#714](https://github.com/stripe/stripe-php/pull/714) Add `pending_setup_intent` property in `Subscription`
* [#713](https://github.com/stripe/stripe-php/pull/713) Add typehint to `ApiResponse`
* [#712](https://github.com/stripe/stripe-php/pull/712) Fix comment
* [#701](https://github.com/stripe/stripe-php/pull/701) Start testing PHP 7.3
## 6.43.0 - 2019-08-09
* [#694](https://github.com/stripe/stripe-php/pull/694) Add `SubscriptionItem::createUsageRecord` method
## 6.42.0 - 2019-08-09
* [#688](https://github.com/stripe/stripe-php/pull/688) Remove `SubscriptionScheduleRevision`
* Note that this is technically a breaking change, however we've chosen to release it as a minor version in light of the fact that this resource and its API methods were virtually unused.
## 6.41.0 - 2019-07-31
* [#683](https://github.com/stripe/stripe-php/pull/683) Move the List Balance History API to `/v1/balance_transactions`
## 6.40.0 - 2019-06-27
* [#675](https://github.com/stripe/stripe-php/pull/675) Add support for `SetupIntent` resource and APIs
## 6.39.2 - 2019-06-26
* [#676](https://github.com/stripe/stripe-php/pull/676) Fix exception message in `CustomerBalanceTransaction::update()`
## 6.39.1 - 2019-06-25
* [#674](https://github.com/stripe/stripe-php/pull/674) Add new constants for `collection_method` on `Invoice`
## 6.39.0 - 2019-06-24
* [#673](https://github.com/stripe/stripe-php/pull/673) Enable request latency telemetry by default
## 6.38.0 - 2019-06-17
* [#649](https://github.com/stripe/stripe-php/pull/649) Add support for `CustomerBalanceTransaction` resource and APIs
## 6.37.2 - 2019-06-17
* [#671](https://github.com/stripe/stripe-php/pull/671) Add new PHPDoc
* [#672](https://github.com/stripe/stripe-php/pull/672) Add constants for `submit_type` on Checkout `Session`
## 6.37.1 - 2019-06-14
* [#670](https://github.com/stripe/stripe-php/pull/670) Add new PHPDoc
## 6.37.0 - 2019-05-23
* [#663](https://github.com/stripe/stripe-php/pull/663) Add support for `radar.early_fraud_warning` resource
## 6.36.0 - 2019-05-22
* [#661](https://github.com/stripe/stripe-php/pull/661) Add constants for new TaxId types
* [#662](https://github.com/stripe/stripe-php/pull/662) Add constants for BalanceTransaction types
## 6.35.2 - 2019-05-20
* [#655](https://github.com/stripe/stripe-php/pull/655) Add constants for payment intent statuses
* [#659](https://github.com/stripe/stripe-php/pull/659) Fix PHPDoc for various nested Account actions
* [#660](https://github.com/stripe/stripe-php/pull/660) Fix various PHPDoc
## 6.35.1 - 2019-05-20
* [#658](https://github.com/stripe/stripe-php/pull/658) Use absolute value when checking timestamp tolerance
## 6.35.0 - 2019-05-14
* [#651](https://github.com/stripe/stripe-php/pull/651) Add support for the Capability resource and APIs
## 6.34.6 - 2019-05-13
* [#654](https://github.com/stripe/stripe-php/pull/654) Fix typo in definition of `Event::PAYMENT_METHOD_ATTACHED` constant
## 6.34.5 - 2019-05-06
* [#647](https://github.com/stripe/stripe-php/pull/647) Set the return type to static for more operations
## 6.34.4 - 2019-05-06
* [#650](https://github.com/stripe/stripe-php/pull/650) Add missing constants for Event types
## 6.34.3 - 2019-05-01
* [#644](https://github.com/stripe/stripe-php/pull/644) Update return type to `static` to improve static analysis
* [#645](https://github.com/stripe/stripe-php/pull/645) Fix constant for `payment_intent.payment_failed`
## 6.34.2 - 2019-04-26
* [#642](https://github.com/stripe/stripe-php/pull/642) Fix an issue where existing idempotency keys would be overwritten when using automatic retries
## 6.34.1 - 2019-04-25
* [#640](https://github.com/stripe/stripe-php/pull/640) Add missing phpdocs
## 6.34.0 - 2019-04-24
* [#626](https://github.com/stripe/stripe-php/pull/626) Add support for the `TaxRate` resource and APIs
* [#639](https://github.com/stripe/stripe-php/pull/639) Fix multiple phpdoc issues
## 6.33.0 - 2019-04-22
* [#630](https://github.com/stripe/stripe-php/pull/630) Add support for the `TaxId` resource and APIs
## 6.32.1 - 2019-04-19
* [#636](https://github.com/stripe/stripe-php/pull/636) Correct type of `$personId` in PHPDoc
## 6.32.0 - 2019-04-18
* [#621](https://github.com/stripe/stripe-php/pull/621) Add support for `CreditNote`
## 6.31.5 - 2019-04-12
* [#628](https://github.com/stripe/stripe-php/pull/628) Add constants for `person.*` event types
* [#628](https://github.com/stripe/stripe-php/pull/628) Add missing constants for `Account` and `Person`
## 6.31.4 - 2019-04-05
* [#624](https://github.com/stripe/stripe-php/pull/624) Fix encoding of nested parameters in multipart requests
## 6.31.3 - 2019-04-02
* [#623](https://github.com/stripe/stripe-php/pull/623) Only use HTTP/2 with curl >= 7.60.0
## 6.31.2 - 2019-03-25
* [#619](https://github.com/stripe/stripe-php/pull/619) Fix PHPDoc return types for list methods for nested resources
## 6.31.1 - 2019-03-22
* [#612](https://github.com/stripe/stripe-php/pull/612) Add a lot of constants
* [#614](https://github.com/stripe/stripe-php/pull/614) Add missing subscription status constants
## 6.31.0 - 2019-03-18
* [#600](https://github.com/stripe/stripe-php/pull/600) Add support for the `PaymentMethod` resource and APIs
* [#606](https://github.com/stripe/stripe-php/pull/606) Add support for retrieving a Checkout `Session`
* [#611](https://github.com/stripe/stripe-php/pull/611) Add support for deleting a Terminal `Location` and `Reader`
## 6.30.5 - 2019-03-11
* [#607](https://github.com/stripe/stripe-php/pull/607) Correctly handle case where a metadata key is called `metadata`
## 6.30.4 - 2019-02-27
* [#602](https://github.com/stripe/stripe-php/pull/602) Add `subscription_schedule` to `Subscription` for PHPDoc.
## 6.30.3 - 2019-02-26
* [#603](https://github.com/stripe/stripe-php/pull/603) Improve PHPDoc on the `Source` object to cover all types of Sources currently supported.
## 6.30.2 - 2019-02-25
* [#601](https://github.com/stripe/stripe-php/pull/601) Fix PHPDoc across multiple resources and add support for new events.
## 6.30.1 - 2019-02-16
* [#599](https://github.com/stripe/stripe-php/pull/599) Fix PHPDoc for `SubscriptionSchedule` and `SubscriptionScheduleRevision`
## 6.30.0 - 2019-02-12
* [#590](https://github.com/stripe/stripe-php/pull/590) Add support for `SubscriptionSchedule` and `SubscriptionScheduleRevision`
## 6.29.3 - 2019-01-31
* [#592](https://github.com/stripe/stripe-php/pull/592) Some more PHPDoc fixes
## 6.29.2 - 2019-01-31
* [#591](https://github.com/stripe/stripe-php/pull/591) Fix PHPDoc for nested resources
## 6.29.1 - 2019-01-25
* [#566](https://github.com/stripe/stripe-php/pull/566) Fix dangling message contents
* [#586](https://github.com/stripe/stripe-php/pull/586) Don't overwrite `CURLOPT_HTTP_VERSION` option
## 6.29.0 - 2019-01-23
* [#579](https://github.com/stripe/stripe-php/pull/579) Rename `CheckoutSession` to `Session` and move it under the `Checkout` namespace. This is a breaking change, but we've reached out to affected merchants and all new merchants would use the new approach.
## 6.28.1 - 2019-01-21
* [#580](https://github.com/stripe/stripe-php/pull/580) Properly serialize `individual` on `Account` objects
## 6.28.0 - 2019-01-03
* [#576](https://github.com/stripe/stripe-php/pull/576) Add support for iterating directly over `Collection` instances
## 6.27.0 - 2018-12-21
* [#571](https://github.com/stripe/stripe-php/pull/571) Add support for the `CheckoutSession` resource
## 6.26.0 - 2018-12-11
* [#568](https://github.com/stripe/stripe-php/pull/568) Enable persistent connections
## 6.25.0 - 2018-12-10
* [#567](https://github.com/stripe/stripe-php/pull/567) Add support for account links
## 6.24.0 - 2018-11-28
* [#562](https://github.com/stripe/stripe-php/pull/562) Add support for the Review resource
* [#564](https://github.com/stripe/stripe-php/pull/564) Add event name constants for subscription schedule aborted/expiring
## 6.23.0 - 2018-11-27
* [#542](https://github.com/stripe/stripe-php/pull/542) Add support for `ValueList` and `ValueListItem` for Radar
## 6.22.1 - 2018-11-20
* [#561](https://github.com/stripe/stripe-php/pull/561) Add cast and some docs to telemetry introduced in 6.22.0/549
## 6.22.0 - 2018-11-15
* [#549](https://github.com/stripe/stripe-php/pull/549) Add support for client telemetry
## 6.21.1 - 2018-11-12
* [#548](https://github.com/stripe/stripe-php/pull/548) Don't mutate `Exception` class properties from `OAuthBase` error
## 6.21.0 - 2018-11-08
* [#537](https://github.com/stripe/stripe-php/pull/537) Add new API endpoints for the `Invoice` resource.
## 6.20.1 - 2018-11-07
* [#546](https://github.com/stripe/stripe-php/pull/546) Drop files from the Composer package that aren't needed in the release
## 6.20.0 - 2018-10-30
* [#536](https://github.com/stripe/stripe-php/pull/536) Add support for the `Person` resource
* [#541](https://github.com/stripe/stripe-php/pull/541) Add support for the `WebhookEndpoint` resource
## 6.19.5 - 2018-10-17
* [#539](https://github.com/stripe/stripe-php/pull/539) Fix methods on `\Stripe\PaymentIntent` to properly pass arguments to the API.
## 6.19.4 - 2018-10-11
* [#534](https://github.com/stripe/stripe-php/pull/534) Fix PSR-4 autoloading for `\Stripe\FileUpload` class alias
## 6.19.3 - 2018-10-09
* [#530](https://github.com/stripe/stripe-php/pull/530) Add constants for `flow` (`FLOW_*`), `status` (`STATUS_*`) and `usage` (`USAGE_*`) on `\Stripe\Source`
## 6.19.2 - 2018-10-08
* [#531](https://github.com/stripe/stripe-php/pull/531) Store HTTP response headers in case-insensitive array
## 6.19.1 - 2018-09-25
* [#526](https://github.com/stripe/stripe-php/pull/526) Ignore null values in request parameters
## 6.19.0 - 2018-09-24
* [#523](https://github.com/stripe/stripe-php/pull/523) Add support for Stripe Terminal
## 6.18.0 - 2018-09-24
* [#520](https://github.com/stripe/stripe-php/pull/520) Rename `\Stripe\FileUpload` to `\Stripe\File`
## 6.17.2 - 2018-09-18
* [#522](https://github.com/stripe/stripe-php/pull/522) Fix warning when adding a new additional owner to an existing array
## 6.17.1 - 2018-09-14
* [#517](https://github.com/stripe/stripe-php/pull/517) Integer-index encode all sequential arrays
## 6.17.0 - 2018-09-05
* [#514](https://github.com/stripe/stripe-php/pull/514) Add support for reporting resources
## 6.16.0 - 2018-08-23
* [#509](https://github.com/stripe/stripe-php/pull/509) Add support for usage record summaries
## 6.15.0 - 2018-08-03
* [#504](https://github.com/stripe/stripe-php/pull/504) Add cancel support for topups
## 6.14.0 - 2018-08-02
* [#505](https://github.com/stripe/stripe-php/pull/505) Add support for file links
## 6.13.0 - 2018-07-31
* [#502](https://github.com/stripe/stripe-php/pull/502) Add `isDeleted()` method to `\Stripe\StripeObject`
## 6.12.0 - 2018-07-28
* [#501](https://github.com/stripe/stripe-php/pull/501) Add support for scheduled query runs (`\Stripe\Sigma\ScheduledQueryRun`) for Sigma
## 6.11.0 - 2018-07-26
* [#500](https://github.com/stripe/stripe-php/pull/500) Add support for Stripe Issuing
## 6.10.4 - 2018-07-19
* [#498](https://github.com/stripe/stripe-php/pull/498) Internal improvements to the `\Stripe\ApiResource.classUrl()` method
## 6.10.3 - 2018-07-16
* [#497](https://github.com/stripe/stripe-php/pull/497) Use HTTP/2 only for HTTPS requests
## 6.10.2 - 2018-07-11
* [#494](https://github.com/stripe/stripe-php/pull/494) Enable HTTP/2 support
## 6.10.1 - 2018-07-10
* [#493](https://github.com/stripe/stripe-php/pull/493) Add PHPDoc for `auto_advance` on `\Stripe\Invoice`
## 6.10.0 - 2018-06-28
* [#488](https://github.com/stripe/stripe-php/pull/488) Add support for `$appPartnerId` to `Stripe::setAppInfo()`
## 6.9.0 - 2018-06-28
* [#487](https://github.com/stripe/stripe-php/pull/487) Add support for payment intents
## 6.8.2 - 2018-06-24
* [#486](https://github.com/stripe/stripe-php/pull/486) Make `Account.deauthorize()` return the `StripeObject` from the API
## 6.8.1 - 2018-06-13
* [#472](https://github.com/stripe/stripe-php/pull/472) Added phpDoc for `ApiRequestor` and others, especially regarding thrown errors
## 6.8.0 - 2018-06-13
* [#481](https://github.com/stripe/stripe-php/pull/481) Add new `\Stripe\Discount` and `\Stripe\OrderItem` classes, add more PHPDoc describing object attributes
## 6.7.4 - 2018-05-29
* [#480](https://github.com/stripe/stripe-php/pull/480) PHPDoc changes for API version 2018-05-21 and the addition of the new `CHARGE_EXPIRED` event type
## 6.7.3 - 2018-05-28
* [#479](https://github.com/stripe/stripe-php/pull/479) Fix unnecessary traits on `\Stripe\InvoiceLineItem`
## 6.7.2 - 2018-05-28
* [#471](https://github.com/stripe/stripe-php/pull/471) Add `OBJECT_NAME` constant to all API resource classes, add `\Stripe\InvoiceLineItem` class
## 6.7.1 - 2018-05-13
* [#468](https://github.com/stripe/stripe-php/pull/468) Update fields in PHP docs for accuracy
## 6.7.0 - 2018-05-09
* [#466](https://github.com/stripe/stripe-php/pull/466) Add support for issuer fraud records
## 6.6.0 - 2018-04-11
* [#460](https://github.com/stripe/stripe-php/pull/460) Add support for flexible billing primitives
## 6.5.0 - 2018-04-05
* [#461](https://github.com/stripe/stripe-php/pull/461) Don't zero keys on non-`metadata` subobjects
## 6.4.2 - 2018-03-17
* [#458](https://github.com/stripe/stripe-php/pull/458) Add PHPDoc for `account` on `\Stripe\Event`
## 6.4.1 - 2018-03-02
* [#455](https://github.com/stripe/stripe-php/pull/455) Fix namespaces in PHPDoc
* [#456](https://github.com/stripe/stripe-php/pull/456) Fix namespaces for some exceptions
## 6.4.0 - 2018-02-28
* [#453](https://github.com/stripe/stripe-php/pull/453) Add constants for `reason` (`REASON_*`) and `status` (`STATUS_*`) on `\Stripe\Dispute`
## 6.3.2 - 2018-02-27
* [#452](https://github.com/stripe/stripe-php/pull/452) Add PHPDoc for `amount_paid` and `amount_remaining` on `\Stripe\Invoice`
## 6.3.1 - 2018-02-26
* [#443](https://github.com/stripe/stripe-php/pull/443) Add event types as constants to `\Stripe\Event` class
## 6.3.0 - 2018-02-23
* [#450](https://github.com/stripe/stripe-php/pull/450) Add support for `code` attribute on all Stripe exceptions
## 6.2.0 - 2018-02-21
* [#440](https://github.com/stripe/stripe-php/pull/440) Add support for topups
* [#442](https://github.com/stripe/stripe-php/pull/442) Fix PHPDoc for `\Stripe\Error\SignatureVerification`
## 6.1.0 - 2018-02-12
* [#435](https://github.com/stripe/stripe-php/pull/435) Fix header persistence on `Collection` objects
* [#436](https://github.com/stripe/stripe-php/pull/436) Introduce new `Idempotency` error class
## 6.0.0 - 2018-02-07
Major version release. List of backwards incompatible changes to watch out for:
+ The minimum PHP version is now 5.4.0. If you're using PHP 5.3 or older, consider upgrading to a more recent version.
* `\Stripe\AttachedObject` no longer exists. Attributes that used to be instances of `\Stripe\AttachedObject` (such as `metadata`) are now instances of `\Stripe\StripeObject`.
+ Attributes that used to be PHP arrays (such as `legal_entity->additional_owners` on `\Stripe\Account` instances) are now instances of `\Stripe\StripeObject`, except when they are empty. `\Stripe\StripeObject` has array semantics so this should not be an issue unless you are actively checking types.
* `\Stripe\Collection` now derives from `\Stripe\StripeObject` rather than from `\Stripe\ApiResource`.
Pull requests included in this release:
* [#410](https://github.com/stripe/stripe-php/pull/410) Drop support for PHP 5.3
* [#411](https://github.com/stripe/stripe-php/pull/411) Use traits for common API operations
* [#414](https://github.com/stripe/stripe-php/pull/414) Use short array syntax
* [#404](https://github.com/stripe/stripe-php/pull/404) Fix serialization logic
* [#417](https://github.com/stripe/stripe-php/pull/417) Remove `ExternalAccount` class
* [#418](https://github.com/stripe/stripe-php/pull/418) Increase test coverage
* [#421](https://github.com/stripe/stripe-php/pull/421) Update CA bundle and add script for future updates
* [#422](https://github.com/stripe/stripe-php/pull/422) Use vendored CA bundle for all requests
* [#428](https://github.com/stripe/stripe-php/pull/428) Support for automatic request retries
## 5.9.2 - 2018-02-07
* [#431](https://github.com/stripe/stripe-php/pull/431) Update PHPDoc @property tags for latest API version
## 5.9.1 - 2018-02-06
* [#427](https://github.com/stripe/stripe-php/pull/427) Add and update PHPDoc @property tags on all API resources
## 5.9.0 - 2018-01-17
* [#421](https://github.com/stripe/stripe-php/pull/421) Updated bundled CA certificates
* [#423](https://github.com/stripe/stripe-php/pull/423) Escape unsanitized input in OAuth example
## 5.8.0 - 2017-12-20
* [#403](https://github.com/stripe/stripe-php/pull/403) Add `__debugInfo()` magic method to `StripeObject`
## 5.7.0 - 2017-11-28
* [#390](https://github.com/stripe/stripe-php/pull/390) Remove some unsupported API methods
* [#391](https://github.com/stripe/stripe-php/pull/391) Alphabetize the list of API resources in `Util::convertToStripeObject()` and add missing resources
* [#393](https://github.com/stripe/stripe-php/pull/393) Fix expiry date update for card sources
## 5.6.0 - 2017-10-31
* [#386](https://github.com/stripe/stripe-php/pull/386) Support for exchange rates APIs
## 5.5.1 - 2017-10-30
* [#387](https://github.com/stripe/stripe-php/pull/387) Allow `personal_address_kana` and `personal_address_kanji` to be updated on an account
## 5.5.0 - 2017-10-27
* [#385](https://github.com/stripe/stripe-php/pull/385) Support for listing source transactions
## 5.4.0 - 2017-10-24
* [#383](https://github.com/stripe/stripe-php/pull/383) Add static methods to manipulate resources from parent
* `Account` gains methods for external accounts and login links (e.g. `createExternalAccount`, `createLoginLink`)
* `ApplicationFee` gains methods for refunds
* `Customer` gains methods for sources
* `Transfer` gains methods for reversals
## 5.3.0 - 2017-10-11
* [#378](https://github.com/stripe/stripe-php/pull/378) Rename source `delete` to `detach` (and deprecate the former)
## 5.2.3 - 2017-09-27
* Add PHPDoc for `Card`
## 5.2.2 - 2017-09-20
* Fix deserialization mapping of `FileUpload` objects
## 5.2.1 - 2017-09-14
* Serialized `shipping` nested attribute
## 5.2.0 - 2017-08-29
* Add support for `InvalidClient` OAuth error
## 5.1.3 - 2017-08-14
* Allow `address_kana` and `address_kanji` to be updated for custom accounts
## 5.1.2 - 2017-08-01
* Fix documented return type of `autoPagingIterator()` (was missing namespace)
## 5.1.1 - 2017-07-03
* Fix order returns to use the right URL `/v1/order_returns`
## 5.1.0 - 2017-06-30
* Add support for OAuth
## 5.0.0 - 2017-06-27
* `pay` on invoice now takes params as well as opts
## 4.13.0 - 2017-06-19
* Add support for ephemeral keys
## 4.12.0 - 2017-06-05
* Clients can implement `getUserAgentInfo()` to add additional user agent information
## 4.11.0 - 2017-06-05
* Implement `Countable` for `AttachedObject` (`metadata` and `additional_owners`)
## 4.10.0 - 2017-05-25
* Add support for login links
## 4.9.1 - 2017-05-10
* Fix docs to include arrays on `$id` parameter for retrieve methods
## 4.9.0 - 2017-04-28
* Support for checking webhook signatures
## 4.8.1 - 2017-04-24
* Allow nested field `payout_schedule` to be updated
## 4.8.0 - 2017-04-20
* Add `\Stripe\Stripe::setLogger()` to support an external PSR-3 compatible logger
## 4.7.0 - 2017-04-10
* Add support for payouts and recipient transfers
## 4.6.0 - 2017-04-06
* Please see 4.7.0 instead (no-op release)
## 4.5.1 - 2017-03-22
* Remove hard dependency on cURL
## 4.5.0 - 2017-03-20
* Support for detaching sources from customers
## 4.4.2 - 2017-02-27
* Correct handling of `owner` parameter when updating sources
## 4.4.1 - 2017-02-24
* Correct the error check on a bad JSON decoding
## 4.4.0 - 2017-01-18
* Add support for updating sources
## 4.3.0 - 2016-11-30
* Add support for verifying sources
## 4.2.0 - 2016-11-21
* Add retrieve method for 3-D Secure resources
## 4.1.1 - 2016-10-21
* Add docblock with model properties for `Plan`
## 4.1.0 - 2016-10-18
* Support for 403 status codes (permission denied)
## 4.0.1 - 2016-10-17
* Fix transfer reversal materialization
* Fixes for some property definitions in docblocks
## 4.0.0 - 2016-09-28
* Support for subscription items
* Drop attempt to force TLS 1.2: please note that this could be breaking if you're using old OS distributions or packages and upgraded recently (so please make sure to test your integration!)
## 3.23.0 - 2016-09-15
* Add support for Apple Pay domains
## 3.22.0 - 2016-09-13
* Add `Stripe::setAppInfo` to allow plugins to register user agent information
## 3.21.0 - 2016-08-25
* Add `Source` model for generic payment sources
## 3.20.0 - 2016-08-08
* Add `getDeclineCode` to card errors
## 3.19.0 - 2016-07-29
* Opt requests directly into TLS 1.2 where OpenSSL >= 1.0.1 (see #277 for context)
## 3.18.0 - 2016-07-28
* Add new `STATUS_` constants for subscriptions
## 3.17.1 - 2016-07-28
* Fix auto-paging iterator so that it plays nicely with `iterator_to_array`
## 3.17.0 - 2016-07-14
* Add field annotations to model classes for better editor hinting
## 3.16.0 - 2016-07-12
* Add `ThreeDSecure` model for 3-D secure payments
## 3.15.0 - 2016-06-29
* Add static `update` method to all resources that can be changed.
## 3.14.3 - 2016-06-20
* Make sure that cURL never sends `Expects: 100-continue`, even on large request bodies
## 3.14.2 - 2016-06-03
* Add `inventory` under `SKU` to list of keys that have nested data and can be updated
## 3.14.1 - 2016-05-27
* Fix some inconsistencies in PHPDoc
## 3.14.0 - 2016-05-25
* Add support for returning Relay orders
## 3.13.0 - 2016-05-04
* Add `list`, `create`, `update`, `retrieve`, and `delete` methods to the Subscription class
## 3.12.1 - 2016-04-07
* Additional check on value arrays for some extra safety
## 3.12.0 - 2016-03-31
* Fix bug `refreshFrom` on `StripeObject` would not take an `$opts` array
* Fix bug where `$opts` not passed to parent `save` method in `Account`
* Fix bug where non-existent variable was referenced in `reverse` in `Transfer`
* Update CA cert bundle for compatibility with OpenSSL versions below 1.0.1
## 3.11.0 - 2016-03-22
* Allow `CurlClient` to be initialized with default `CURLOPT_*` options
## 3.10.1 - 2016-03-22
* Fix bug where request params and options were ignored in `ApplicationFee`'s `refund.`
## 3.10.0 - 2016-03-15
* Add `reject` on `Account` to support the new API feature
## 3.9.2 - 2016-03-04
* Fix error when an object's metadata is set more than once
## 3.9.1 - 2016-02-24
* Fix encoding behavior of nested arrays for requests (see #227)
## 3.9.0 - 2016-02-09
* Add automatic pagination mechanism with `autoPagingIterator()`
* Allow global account ID to be set with `Stripe::setAccountId()`
## 3.8.0 - 2016-02-08
* Add `CountrySpec` model for looking up country payment information
## 3.7.1 - 2016-02-01
* Update bundled CA certs
## 3.7.0 - 2016-01-27
* Support deleting Relay products and SKUs
## 3.6.0 - 2016-01-05
* Allow configuration of HTTP client timeouts
## 3.5.0 - 2015-12-01
* Add a verification routine for external accounts
## 3.4.0 - 2015-09-14
* Products, SKUs, and Orders -- https://stripe.com/relay
## 3.3.0 - 2015-09-11
* Add support for 429 Rate Limit response
## 3.2.0 - 2015-08-17
* Add refund listing and retrieval without an associated charge
## 3.1.0 - 2015-08-03
* Add dispute listing and retrieval
* Add support for manage account deletion
## 3.0.0 - 2015-07-28
* Rename `\Stripe\Object` to `\Stripe\StripeObject` (PHP 7 compatibility)
* Rename `getCode` and `getParam` in exceptions to `getStripeCode` and `getStripeParam`
* Add support for calling `json_encode` on Stripe objects in PHP 5.4+
* Start supporting/testing PHP 7
## 2.3.0 - 2015-07-06
* Add request ID to all Stripe exceptions
## 2.2.0 - 2015-06-01
* Add support for Alipay accounts as sources
* Add support for bank accounts as sources (private beta)
* Add support for bank accounts and cards as external_accounts on Account objects
## 2.1.4 - 2015-05-13
* Fix CA certificate file path (thanks @lphilps & @matthewarkin)
## 2.1.3 - 2015-05-12
* Fix to account updating to permit `tos_acceptance` and `personal_address` to be set properly
* Fix to Transfer reversal creation (thanks @neatness!)
* Network requests are now done through a swappable class for easier mocking
## 2.1.2 - 2015-04-10
* Remove SSL cert revokation checking (all pre-Heartbleed certs have expired)
* Bug fixes to account updating
## 2.1.1 - 2015-02-27
* Support transfer reversals
## 2.1.0 - 2015-02-19
* Support new API version (2015-02-18)
* Added Bitcoin Receiever update and delete actions
* Edited tests to prefer "source" over "card" as per new API version
## 2.0.1 - 2015-02-16
* Fix to fetching endpoints that use a non-default baseUrl (`FileUpload`)
## 2.0.0 - 2015-02-14
* Bumped minimum version to 5.3.3
* Switched to Stripe namespace instead of Stripe_ class name prefiexes (thanks @chadicus!)
* Switched tests to PHPUnit (thanks @chadicus!)
* Switched style guide to PSR2 (thanks @chadicus!)
* Added $opts hash to the end of most methods: this permits passing 'idempotency_key', 'stripe_account', or 'stripe_version'. The last 2 will persist across multiple object loads.
* Added support for retrieving Account by ID
## 1.18.0 - 2015-01-21
* Support making bitcoin charges through BitcoinReceiver source object
## 1.17.5 - 2014-12-23
* Adding support for creating file uploads.
## 1.17.4 - 2014-12-15
* Saving objects fetched with a custom key now works (thanks @JustinHook & @jpasilan)
* Added methods for reporting charges as safe or fraudulent and for specifying the reason for refunds
## 1.17.3 - 2014-11-06
* Better handling of HHVM support for SSL certificate blacklist checking.
## 1.17.2 - 2014-09-23
* Coupons now are backed by a `Stripe_Coupon` instead of `Stripe_Object`, and support updating metadata
* Running operations (`create`, `retrieve`, `all`) on upcoming invoice items now works
## 1.17.1 - 2014-07-31
* Requests now send Content-Type header
## 1.17.0 - 2014-07-29
* Application Fee refunds now a list instead of array
* HHVM now works
* Small bug fixes (thanks @bencromwell & @fastest963)
* `__toString` now returns the name of the object in addition to its JSON representation
## 1.16.0 - 2014-06-17
* Add metadata for refunds and disputes
## 1.15.0 - 2014-05-28
* Support canceling transfers
## 1.14.1 - 2014-05-21
* Support cards for recipients.
## 1.13.1 - 2014-05-15
* Fix bug in account resource where `id` wasn't in the result
## 1.13.0 - 2014-04-10
* Add support for certificate blacklisting
* Update ca bundle
* Drop support for HHVM (Temporarily)
## 1.12.0 - 2014-04-01
* Add Stripe_RateLimitError for catching rate limit errors.
* Update to Zend coding style (thanks, @jpiasetz)
## 1.11.0 - 2014-01-29
* Add support for multiple subscriptions per customer
## 1.10.1 - 2013-12-02
* Add new ApplicationFee
## 1.9.1 - 2013-11-08
* Fix a bug where a null nestable object causes warnings to fire.
## 1.9.0 - 2013-10-16
* Add support for metadata API.
## 1.8.4 - 2013-09-18
* Add support for closing disputes.
## 1.8.3 - 2013-08-13
* Add new Balance and BalanceTransaction
## 1.8.2 - 2013-08-12
* Add support for unsetting attributes by updating to NULL. Setting properties to a blank string is now an error.
## 1.8.1 - 2013-07-12
* Add support for multiple cards API (Stripe API version 2013-07-12: https://stripe.com/docs/upgrades#2013-07-05)
## 1.8.0 - 2013-04-11
* Allow Transfers to be creatable
* Add new Recipient resource
## 1.7.15 - 2013-02-21
* Add 'id' to the list of permanent object attributes
## 1.7.14 - 2013-02-20
* Don't re-encode strings that are already encoded in UTF-8. If you were previously using plan or coupon objects with UTF-8 IDs, they may have been treated as ISO-8859-1 (Latin-1) and encoded to UTF-8 a 2nd time. You may now need to pass the IDs to utf8_encode before passing them to Stripe_Plan::retrieve or Stripe_Coupon::retrieve.
* Ensure that all input is encoded in UTF-8 before submitting it to Stripe's servers. (github issue #27)
## 1.7.13 - 2013-02-01
* Add support for passing options when retrieving Stripe objects e.g., Stripe_Charge::retrieve(array("id"=>"foo", "expand" => array("customer"))); Stripe_Charge::retrieve("foo") will continue to work
## 1.7.12 - 2013-01-15
* Add support for setting a Stripe API version override
## 1.7.11 - 2012-12-30
* Version bump to cleanup constants and such (fix issue #26)
## 1.7.10 - 2012-11-08
* Add support for updating charge disputes.
* Fix bug preventing retrieval of null attributes
## 1.7.9 - 2012-11-08
* Fix usage under autoloaders such as the one generated by composer (fix issue #22)
## 1.7.8 - 2012-10-30
* Add support for creating invoices.
* Add support for new invoice lines return format
* Add support for new list objects
## 1.7.7 - 2012-09-14
* Get all of the various version numbers in the repo in sync (no other changes)
## 1.7.6 - 2012-08-31
* Add update and pay methods to Invoice resource
## 1.7.5 - 2012-08-23
* Change internal function names so that Stripe_SingletonApiRequest is E_STRICT-clean (github issue #16)
## 1.7.4 - 2012-08-21
* Bugfix so that Stripe objects (e.g. Customer, Charge objects) used in API calls are transparently converted to their object IDs
## 1.7.3 - 2012-08-15
* Add new Account resource
## 1.7.2 - 2012-06-26
* Make clearer that you should be including lib/Stripe.php, not test/Stripe.php (github issue #14)
## 1.7.1 - 2012-05-24
* Add missing argument to Stripe_InvalidRequestError constructor in Stripe_ApiResource::instanceUrl. Fixes a warning when Stripe_ApiResource::instanceUrl is called on a resource with no ID (fix issue #12)
## 1.7.0 - 2012-05-17
* Support Composer and Packagist (github issue #9)
* Add new deleteDiscount method to Stripe_Customer
* Add new Transfer resource
* Switch from using HTTP Basic auth to Bearer auth. (Note: Stripe will support Basic auth for the indefinite future, but recommends Bearer auth when possible going forward)
* Numerous test suite improvements

View File

@@ -1 +0,0 @@
7.0.2

View File

@@ -1,36 +0,0 @@
#!/usr/bin/env php
<?php
chdir(dirname(__FILE__));
$autoload = (int)$argv[1];
$returnStatus = null;
if (!$autoload) {
// Modify composer to not autoload Stripe
$composer = json_decode(file_get_contents('composer.json'), true);
unset($composer['autoload']);
unset($composer['require-dev']['squizlabs/php_codesniffer']);
file_put_contents('composer.json', json_encode($composer, JSON_PRETTY_PRINT));
}
passthru('composer update', $returnStatus);
if ($returnStatus !== 0) {
exit(1);
}
if ($autoload) {
// Only run CS on 1 of the 2 environments
passthru(
'./vendor/bin/phpcs --standard=PSR2 -n lib tests *.php',
$returnStatus
);
if ($returnStatus !== 0) {
exit(1);
}
}
$config = $autoload ? 'phpunit.xml' : 'phpunit.no_autoload.xml';
passthru("./vendor/bin/phpunit -c $config", $returnStatus);
if ($returnStatus !== 0) {
exit(1);
}

View File

@@ -1,149 +0,0 @@
<?php
// Stripe singleton
require(dirname(__FILE__) . '/lib/Stripe.php');
// Utilities
require(dirname(__FILE__) . '/lib/Util/CaseInsensitiveArray.php');
require(dirname(__FILE__) . '/lib/Util/LoggerInterface.php');
require(dirname(__FILE__) . '/lib/Util/DefaultLogger.php');
require(dirname(__FILE__) . '/lib/Util/RandomGenerator.php');
require(dirname(__FILE__) . '/lib/Util/RequestOptions.php');
require(dirname(__FILE__) . '/lib/Util/Set.php');
require(dirname(__FILE__) . '/lib/Util/Util.php');
// HttpClient
require(dirname(__FILE__) . '/lib/HttpClient/ClientInterface.php');
require(dirname(__FILE__) . '/lib/HttpClient/CurlClient.php');
// Exceptions
require(dirname(__FILE__) . '/lib/Exception/ExceptionInterface.php');
require(dirname(__FILE__) . '/lib/Exception/ApiErrorException.php');
require(dirname(__FILE__) . '/lib/Exception/ApiConnectionException.php');
require(dirname(__FILE__) . '/lib/Exception/AuthenticationException.php');
require(dirname(__FILE__) . '/lib/Exception/BadMethodCallException.php');
require(dirname(__FILE__) . '/lib/Exception/CardException.php');
require(dirname(__FILE__) . '/lib/Exception/IdempotencyException.php');
require(dirname(__FILE__) . '/lib/Exception/InvalidArgumentException.php');
require(dirname(__FILE__) . '/lib/Exception/InvalidRequestException.php');
require(dirname(__FILE__) . '/lib/Exception/PermissionException.php');
require(dirname(__FILE__) . '/lib/Exception/RateLimitException.php');
require(dirname(__FILE__) . '/lib/Exception/SignatureVerificationException.php');
require(dirname(__FILE__) . '/lib/Exception/UnexpectedValueException.php');
require(dirname(__FILE__) . '/lib/Exception/UnknownApiErrorException.php');
// OAuth exceptions
require(dirname(__FILE__) . '/lib/Exception/OAuth/ExceptionInterface.php');
require(dirname(__FILE__) . '/lib/Exception/OAuth/OAuthErrorException.php');
require(dirname(__FILE__) . '/lib/Exception/OAuth/InvalidClientException.php');
require(dirname(__FILE__) . '/lib/Exception/OAuth/InvalidGrantException.php');
require(dirname(__FILE__) . '/lib/Exception/OAuth/InvalidRequestException.php');
require(dirname(__FILE__) . '/lib/Exception/OAuth/InvalidScopeException.php');
require(dirname(__FILE__) . '/lib/Exception/OAuth/UnknownOAuthErrorException.php');
require(dirname(__FILE__) . '/lib/Exception/OAuth/UnsupportedGrantTypeException.php');
require(dirname(__FILE__) . '/lib/Exception/OAuth/UnsupportedResponseTypeException.php');
// API operations
require(dirname(__FILE__) . '/lib/ApiOperations/All.php');
require(dirname(__FILE__) . '/lib/ApiOperations/Create.php');
require(dirname(__FILE__) . '/lib/ApiOperations/Delete.php');
require(dirname(__FILE__) . '/lib/ApiOperations/NestedResource.php');
require(dirname(__FILE__) . '/lib/ApiOperations/Request.php');
require(dirname(__FILE__) . '/lib/ApiOperations/Retrieve.php');
require(dirname(__FILE__) . '/lib/ApiOperations/Update.php');
// Plumbing
require(dirname(__FILE__) . '/lib/ApiResponse.php');
require(dirname(__FILE__) . '/lib/RequestTelemetry.php');
require(dirname(__FILE__) . '/lib/StripeObject.php');
require(dirname(__FILE__) . '/lib/ApiRequestor.php');
require(dirname(__FILE__) . '/lib/ApiResource.php');
require(dirname(__FILE__) . '/lib/SingletonApiResource.php');
// Stripe API Resources
require(dirname(__FILE__) . '/lib/Account.php');
require(dirname(__FILE__) . '/lib/AccountLink.php');
require(dirname(__FILE__) . '/lib/AlipayAccount.php');
require(dirname(__FILE__) . '/lib/ApplePayDomain.php');
require(dirname(__FILE__) . '/lib/ApplicationFee.php');
require(dirname(__FILE__) . '/lib/ApplicationFeeRefund.php');
require(dirname(__FILE__) . '/lib/Balance.php');
require(dirname(__FILE__) . '/lib/BalanceTransaction.php');
require(dirname(__FILE__) . '/lib/BankAccount.php');
require(dirname(__FILE__) . '/lib/BitcoinReceiver.php');
require(dirname(__FILE__) . '/lib/BitcoinTransaction.php');
require(dirname(__FILE__) . '/lib/Capability.php');
require(dirname(__FILE__) . '/lib/Card.php');
require(dirname(__FILE__) . '/lib/Charge.php');
require(dirname(__FILE__) . '/lib/Checkout/Session.php');
require(dirname(__FILE__) . '/lib/Collection.php');
require(dirname(__FILE__) . '/lib/CountrySpec.php');
require(dirname(__FILE__) . '/lib/Coupon.php');
require(dirname(__FILE__) . '/lib/CreditNote.php');
require(dirname(__FILE__) . '/lib/Customer.php');
require(dirname(__FILE__) . '/lib/CustomerBalanceTransaction.php');
require(dirname(__FILE__) . '/lib/Discount.php');
require(dirname(__FILE__) . '/lib/Dispute.php');
require(dirname(__FILE__) . '/lib/EphemeralKey.php');
require(dirname(__FILE__) . '/lib/ErrorObject.php');
require(dirname(__FILE__) . '/lib/Event.php');
require(dirname(__FILE__) . '/lib/ExchangeRate.php');
require(dirname(__FILE__) . '/lib/File.php');
require(dirname(__FILE__) . '/lib/FileLink.php');
require(dirname(__FILE__) . '/lib/Invoice.php');
require(dirname(__FILE__) . '/lib/InvoiceItem.php');
require(dirname(__FILE__) . '/lib/InvoiceLineItem.php');
require(dirname(__FILE__) . '/lib/Issuing/Authorization.php');
require(dirname(__FILE__) . '/lib/Issuing/Card.php');
require(dirname(__FILE__) . '/lib/Issuing/CardDetails.php');
require(dirname(__FILE__) . '/lib/Issuing/Cardholder.php');
require(dirname(__FILE__) . '/lib/Issuing/Dispute.php');
require(dirname(__FILE__) . '/lib/Issuing/Transaction.php');
require(dirname(__FILE__) . '/lib/LoginLink.php');
require(dirname(__FILE__) . '/lib/Order.php');
require(dirname(__FILE__) . '/lib/OrderItem.php');
require(dirname(__FILE__) . '/lib/OrderReturn.php');
require(dirname(__FILE__) . '/lib/PaymentIntent.php');
require(dirname(__FILE__) . '/lib/PaymentMethod.php');
require(dirname(__FILE__) . '/lib/Payout.php');
require(dirname(__FILE__) . '/lib/Person.php');
require(dirname(__FILE__) . '/lib/Plan.php');
require(dirname(__FILE__) . '/lib/Product.php');
require(dirname(__FILE__) . '/lib/Radar/EarlyFraudWarning.php');
require(dirname(__FILE__) . '/lib/Radar/ValueList.php');
require(dirname(__FILE__) . '/lib/Radar/ValueListItem.php');
require(dirname(__FILE__) . '/lib/Recipient.php');
require(dirname(__FILE__) . '/lib/RecipientTransfer.php');
require(dirname(__FILE__) . '/lib/Refund.php');
require(dirname(__FILE__) . '/lib/Reporting/ReportRun.php');
require(dirname(__FILE__) . '/lib/Reporting/ReportType.php');
require(dirname(__FILE__) . '/lib/Review.php');
require(dirname(__FILE__) . '/lib/SetupIntent.php');
require(dirname(__FILE__) . '/lib/SKU.php');
require(dirname(__FILE__) . '/lib/Sigma/ScheduledQueryRun.php');
require(dirname(__FILE__) . '/lib/Source.php');
require(dirname(__FILE__) . '/lib/SourceTransaction.php');
require(dirname(__FILE__) . '/lib/Subscription.php');
require(dirname(__FILE__) . '/lib/SubscriptionItem.php');
require(dirname(__FILE__) . '/lib/SubscriptionSchedule.php');
require(dirname(__FILE__) . '/lib/TaxId.php');
require(dirname(__FILE__) . '/lib/TaxRate.php');
require(dirname(__FILE__) . '/lib/Terminal/ConnectionToken.php');
require(dirname(__FILE__) . '/lib/Terminal/Location.php');
require(dirname(__FILE__) . '/lib/Terminal/Reader.php');
require(dirname(__FILE__) . '/lib/ThreeDSecure.php');
require(dirname(__FILE__) . '/lib/Token.php');
require(dirname(__FILE__) . '/lib/Topup.php');
require(dirname(__FILE__) . '/lib/Transfer.php');
require(dirname(__FILE__) . '/lib/TransferReversal.php');
require(dirname(__FILE__) . '/lib/UsageRecord.php');
require(dirname(__FILE__) . '/lib/UsageRecordSummary.php');
// OAuth
require(dirname(__FILE__) . '/lib/OAuth.php');
require(dirname(__FILE__) . '/lib/OAuthErrorObject.php');
// Webhooks
require(dirname(__FILE__) . '/lib/Webhook.php');
require(dirname(__FILE__) . '/lib/WebhookEndpoint.php');
require(dirname(__FILE__) . '/lib/WebhookSignature.php');

View File

@@ -1,20 +0,0 @@
<?php
namespace Stripe;
/**
* Class AccountLink
*
* @property string $object
* @property int $created
* @property int $expires_at
* @property string $url
*
* @package Stripe
*/
class AccountLink extends ApiResource
{
const OBJECT_NAME = "account_link";
use ApiOperations\Create;
}

View File

@@ -1,27 +0,0 @@
<?php
namespace Stripe;
/**
* Class ApplePayDomain
*
* @package Stripe
*/
class ApplePayDomain extends ApiResource
{
const OBJECT_NAME = "apple_pay_domain";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Delete;
use ApiOperations\Retrieve;
/**
* @return string The class URL for this resource. It needs to be special
* cased because it doesn't fit into the standard resource pattern.
*/
public static function classUrl()
{
return '/v1/apple_pay/domains';
}
}

View File

@@ -1,92 +0,0 @@
<?php
namespace Stripe;
/**
* Class ApplicationFee
*
* @property string $id
* @property string $object
* @property string $account
* @property int $amount
* @property int $amount_refunded
* @property string $application
* @property string $balance_transaction
* @property string $charge
* @property int $created
* @property string $currency
* @property bool $livemode
* @property string $originating_transaction
* @property bool $refunded
* @property Collection $refunds
*
* @package Stripe
*/
class ApplicationFee extends ApiResource
{
const OBJECT_NAME = "application_fee";
use ApiOperations\All;
use ApiOperations\NestedResource;
use ApiOperations\Retrieve;
const PATH_REFUNDS = '/refunds';
/**
* @param string|null $id The ID of the application fee on which to create the refund.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return ApplicationFeeRefund
*/
public static function createRefund($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_REFUNDS, $params, $opts);
}
/**
* @param string|null $id The ID of the application fee to which the refund belongs.
* @param array|null $refundId The ID of the refund to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return ApplicationFeeRefund
*/
public static function retrieveRefund($id, $refundId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $opts);
}
/**
* @param string|null $id The ID of the application fee to which the refund belongs.
* @param array|null $refundId The ID of the refund to update.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return ApplicationFeeRefund
*/
public static function updateRefund($id, $refundId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $opts);
}
/**
* @param string|null $id The ID of the application fee on which to retrieve the refunds.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Collection The list of refunds.
*/
public static function allRefunds($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_REFUNDS, $params, $opts);
}
}

View File

@@ -1,59 +0,0 @@
<?php
namespace Stripe;
/**
* Class ApplicationFeeRefund
*
* @property string $id
* @property string $object
* @property int $amount
* @property string $balance_transaction
* @property int $created
* @property string $currency
* @property string $fee
* @property StripeObject $metadata
*
* @package Stripe
*/
class ApplicationFeeRefund extends ApiResource
{
const OBJECT_NAME = "fee_refund";
use ApiOperations\Update {
save as protected _save;
}
/**
* @return string The API URL for this Stripe refund.
*/
public function instanceUrl()
{
$id = $this['id'];
$fee = $this['fee'];
if (!$id) {
throw new Exception\UnexpectedValueException(
"Could not determine which URL to request: " .
"class instance has invalid ID: $id",
null
);
}
$id = Util\Util::utf8($id);
$fee = Util\Util::utf8($fee);
$base = ApplicationFee::classUrl();
$feeExtn = urlencode($fee);
$extn = urlencode($id);
return "$base/$feeExtn/refunds/$extn";
}
/**
* @param array|string|null $opts
*
* @return ApplicationFeeRefund The saved refund.
*/
public function save($opts = null)
{
return $this->_save($opts);
}
}

View File

@@ -1,31 +0,0 @@
<?php
namespace Stripe;
/**
* Class Balance
*
* @property string $object
* @property array $available
* @property array $connect_reserved
* @property bool $livemode
* @property array $pending
*
* @package Stripe
*/
class Balance extends SingletonApiResource
{
const OBJECT_NAME = "balance";
/**
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Balance
*/
public static function retrieve($opts = null)
{
return self::_singletonRetrieve($opts);
}
}

View File

@@ -1,65 +0,0 @@
<?php
namespace Stripe;
/**
* Class BalanceTransaction
*
* @property string $id
* @property string $object
* @property int $amount
* @property int $available_on
* @property int $created
* @property string $currency
* @property string $description
* @property float $exchange_rate
* @property int $fee
* @property mixed $fee_details
* @property int $net
* @property string $source
* @property string $status
* @property string $type
*
* @package Stripe
*/
class BalanceTransaction extends ApiResource
{
const OBJECT_NAME = "balance_transaction";
use ApiOperations\All;
use ApiOperations\Retrieve;
/**
* Possible string representations of the type of balance transaction.
* @link https://stripe.com/docs/api/balance/balance_transaction#balance_transaction_object-type
*/
const TYPE_ADJUSTMENT = 'adjustment';
const TYPE_ADVANCE = 'advance';
const TYPE_ADVANCE_FUNDING = 'advance_funding';
const TYPE_APPLICATION_FEE = 'application_fee';
const TYPE_APPLICATION_FEE_REFUND = 'application_fee_refund';
const TYPE_CHARGE = 'charge';
const TYPE_CONNECT_COLLECTION_TRANSFER = 'connect_collection_transfer';
const TYPE_ISSUING_AUTHORIZATION_HOLD = 'issuing_authorization_hold';
const TYPE_ISSUING_AUTHORIZATION_RELEASE = 'issuing_authorization_release';
const TYPE_ISSUING_TRANSACTION = 'issuing_transaction';
const TYPE_PAYMENT = 'payment';
const TYPE_PAYMENT_FAILURE_REFUND = 'payment_failure_refund';
const TYPE_PAYMENT_REFUND = 'payment_refund';
const TYPE_PAYOUT = 'payout';
const TYPE_PAYOUT_CANCEL = 'payout_cancel';
const TYPE_PAYOUT_FAILURE = 'payout_failure';
const TYPE_REFUND = 'refund';
const TYPE_REFUND_FAILURE = 'refund_failure';
const TYPE_RESERVE_TRANSACTION = 'reserve_transaction';
const TYPE_RESERVED_FUNDS = 'reserved_funds';
const TYPE_STRIPE_FEE = 'stripe_fee';
const TYPE_STRIPE_FX_FEE = 'stripe_fx_fee';
const TYPE_TAX_FEE = 'tax_fee';
const TYPE_TOPUP = 'topup';
const TYPE_TOPUP_REVERSAL = 'topup_reversal';
const TYPE_TRANSFER = 'transfer';
const TYPE_TRANSFER_CANCEL = 'transfer_cancel';
const TYPE_TRANSFER_FAILURE = 'transfer_failure';
const TYPE_TRANSFER_REFUND = 'transfer_refund';
}

View File

@@ -1,114 +0,0 @@
<?php
namespace Stripe;
/**
* Class BankAccount
*
* @property string $id
* @property string $object
* @property string $account
* @property string $account_holder_name
* @property string $account_holder_type
* @property string $bank_name
* @property string $country
* @property string $currency
* @property string $customer
* @property bool $default_for_currency
* @property string $fingerprint
* @property string $last4
* @property StripeObject $metadata
* @property string $routing_number
* @property string $status
*
* @package Stripe
*/
class BankAccount extends ApiResource
{
const OBJECT_NAME = "bank_account";
use ApiOperations\Delete;
use ApiOperations\Update;
/**
* Possible string representations of the bank verification status.
* @link https://stripe.com/docs/api/external_account_bank_accounts/object#account_bank_account_object-status
*/
const STATUS_NEW = 'new';
const STATUS_VALIDATED = 'validated';
const STATUS_VERIFIED = 'verified';
const STATUS_VERIFICATION_FAILED = 'verification_failed';
const STATUS_ERRORED = 'errored';
/**
* @return string The instance URL for this resource. It needs to be special
* cased because it doesn't fit into the standard resource pattern.
*/
public function instanceUrl()
{
if ($this['customer']) {
$base = Customer::classUrl();
$parent = $this['customer'];
$path = 'sources';
} elseif ($this['account']) {
$base = Account::classUrl();
$parent = $this['account'];
$path = 'external_accounts';
} else {
$msg = "Bank accounts cannot be accessed without a customer ID or account ID.";
throw new Exception\UnexpectedValueException($msg, null);
}
$parentExtn = urlencode(Util\Util::utf8($parent));
$extn = urlencode(Util\Util::utf8($this['id']));
return "$base/$parentExtn/$path/$extn";
}
/**
* @param array|string $_id
* @param array|string|null $_opts
*
* @throws \Stripe\Exception\BadMethodCallException
*/
public static function retrieve($_id, $_opts = null)
{
$msg = "Bank accounts cannot be retrieved without a customer ID or " .
"an account ID. Retrieve a bank account using " .
"`Customer::retrieveSource('customer_id', " .
"'bank_account_id')` or `Account::retrieveExternalAccount(" .
"'account_id', 'bank_account_id')`.";
throw new Exception\BadMethodCallException($msg, null);
}
/**
* @param string $_id
* @param array|null $_params
* @param array|string|null $_options
*
* @throws \Stripe\Exception\BadMethodCallException
*/
public static function update($_id, $_params = null, $_options = null)
{
$msg = "Bank accounts cannot be updated without a customer ID or an " .
"account ID. Update a bank account using " .
"`Customer::updateSource('customer_id', 'bank_account_id', " .
"\$updateParams)` or `Account::updateExternalAccount(" .
"'account_id', 'bank_account_id', \$updateParams)`.";
throw new Exception\BadMethodCallException($msg, null);
}
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return BankAccount The verified bank account.
*/
public function verify($params = null, $options = null)
{
$url = $this->instanceUrl() . '/verify';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -1,48 +0,0 @@
<?php
namespace Stripe;
/**
* Class BitcoinReceiver
*
* @package Stripe
*
* @deprecated Bitcoin receivers are deprecated. Please use the sources API instead.
* @link https://stripe.com/docs/sources/bitcoin
*/
class BitcoinReceiver extends ApiResource
{
const OBJECT_NAME = "bitcoin_receiver";
use ApiOperations\All;
use ApiOperations\Retrieve;
/**
* @return string The class URL for this resource. It needs to be special
* cased because it doesn't fit into the standard resource pattern.
*/
public static function classUrl()
{
return "/v1/bitcoin/receivers";
}
/**
* @return string The instance URL for this resource. It needs to be special
* cased because it doesn't fit into the standard resource pattern.
*/
public function instanceUrl()
{
if ($this['customer']) {
$base = Customer::classUrl();
$parent = $this['customer'];
$path = 'sources';
$parentExtn = urlencode(Util\Util::utf8($parent));
$extn = urlencode(Util\Util::utf8($this['id']));
return "$base/$parentExtn/$path/$extn";
} else {
$base = BitcoinReceiver::classUrl();
$extn = urlencode(Util\Util::utf8($this['id']));
return "$base/$extn";
}
}
}

View File

@@ -1,13 +0,0 @@
<?php
namespace Stripe;
/**
* Class BitcoinTransaction
*
* @package Stripe
*/
class BitcoinTransaction extends ApiResource
{
const OBJECT_NAME = "bitcoin_transaction";
}

View File

@@ -1,84 +0,0 @@
<?php
namespace Stripe;
/**
* Class Capability
*
* @package Stripe
*
* @property string $id
* @property string $object
* @property string $account
* @property bool $requested
* @property int $requested_at
* @property mixed $requirements
* @property string $status
*/
class Capability extends ApiResource
{
const OBJECT_NAME = "capability";
use ApiOperations\Update;
/**
* Possible string representations of a capability's status.
* @link https://stripe.com/docs/api/capabilities/object#capability_object-status
*/
const STATUS_ACTIVE = 'active';
const STATUS_INACTIVE = 'inactive';
const STATUS_PENDING = 'pending';
const STATUS_UNREQUESTED = 'unrequested';
/**
* @return string The API URL for this Stripe account reversal.
*/
public function instanceUrl()
{
$id = $this['id'];
$account = $this['account'];
if (!$id) {
throw new Exception\UnexpectedValueException(
"Could not determine which URL to request: " .
"class instance has invalid ID: $id",
null
);
}
$id = Util\Util::utf8($id);
$account = Util\Util::utf8($account);
$base = Account::classUrl();
$accountExtn = urlencode($account);
$extn = urlencode($id);
return "$base/$accountExtn/capabilities/$extn";
}
/**
* @param array|string $_id
* @param array|string|null $_opts
*
* @throws \Stripe\Exception\BadMethodCallException
*/
public static function retrieve($_id, $_opts = null)
{
$msg = "Capabilities cannot be retrieved without an account ID. " .
"Retrieve a capability using `Account::retrieveCapability(" .
"'account_id', 'capability_id')`.";
throw new Exception\BadMethodCallException($msg, null);
}
/**
* @param string $_id
* @param array|null $_params
* @param array|string|null $_options
*
* @throws \Stripe\Exception\BadMethodCallException
*/
public static function update($_id, $_params = null, $_options = null)
{
$msg = "Capabilities cannot be updated without an account ID. " .
"Update a capability using `Account::updateCapability(" .
"'account_id', 'capability_id', \$updateParams)`.";
throw new Exception\BadMethodCallException($msg, null);
}
}

View File

@@ -1,130 +0,0 @@
<?php
namespace Stripe;
/**
* Class Card
*
* @property string $id
* @property string $object
* @property string $account
* @property string $address_city
* @property string $address_country
* @property string $address_line1
* @property string $address_line1_check
* @property string $address_line2
* @property string $address_state
* @property string $address_zip
* @property string $address_zip_check
* @property string[] $available_payout_methods
* @property string $brand
* @property string $country
* @property string $currency
* @property string $customer
* @property string $cvc_check
* @property bool $default_for_currency
* @property string $dynamic_last4
* @property int $exp_month
* @property int $exp_year
* @property string $fingerprint
* @property string $funding
* @property string $last4
* @property StripeObject $metadata
* @property string $name
* @property string $recipient
* @property string $tokenization_method
*
* @package Stripe
*/
class Card extends ApiResource
{
const OBJECT_NAME = "card";
use ApiOperations\Delete;
use ApiOperations\Update;
/**
* Possible string representations of the CVC check status.
* @link https://stripe.com/docs/api/cards/object#card_object-cvc_check
*/
const CVC_CHECK_FAIL = 'fail';
const CVC_CHECK_PASS = 'pass';
const CVC_CHECK_UNAVAILABLE = 'unavailable';
const CVC_CHECK_UNCHECKED = 'unchecked';
/**
* Possible string representations of the funding of the card.
* @link https://stripe.com/docs/api/cards/object#card_object-funding
*/
const FUNDING_CREDIT = 'credit';
const FUNDING_DEBIT = 'debit';
const FUNDING_PREPAID = 'prepaid';
const FUNDING_UNKNOWN = 'unknown';
/**
* Possible string representations of the tokenization method when using Apple Pay or Google Pay.
* @link https://stripe.com/docs/api/cards/object#card_object-tokenization_method
*/
const TOKENIZATION_METHOD_APPLE_PAY = 'apple_pay';
const TOKENIZATION_METHOD_GOOGLE_PAY = 'google_pay';
/**
* @return string The instance URL for this resource. It needs to be special
* cased because cards are nested resources that may belong to different
* top-level resources.
*/
public function instanceUrl()
{
if ($this['customer']) {
$base = Customer::classUrl();
$parent = $this['customer'];
$path = 'sources';
} elseif ($this['account']) {
$base = Account::classUrl();
$parent = $this['account'];
$path = 'external_accounts';
} elseif ($this['recipient']) {
$base = Recipient::classUrl();
$parent = $this['recipient'];
$path = 'cards';
} else {
$msg = "Cards cannot be accessed without a customer ID, account ID or recipient ID.";
throw new Exception\UnexpectedValueException($msg);
}
$parentExtn = urlencode(Util\Util::utf8($parent));
$extn = urlencode(Util\Util::utf8($this['id']));
return "$base/$parentExtn/$path/$extn";
}
/**
* @param array|string $_id
* @param array|string|null $_opts
*
* @throws \Stripe\Exception\BadMethodCallException
*/
public static function retrieve($_id, $_opts = null)
{
$msg = "Cards cannot be retrieved without a customer ID or an " .
"account ID. Retrieve a card using " .
"`Customer::retrieveSource('customer_id', 'card_id')` or " .
"`Account::retrieveExternalAccount('account_id', 'card_id')`.";
throw new Exception\BadMethodCallException($msg);
}
/**
* @param string $_id
* @param array|null $_params
* @param array|string|null $_options
*
* @throws \Stripe\Exception\BadMethodCallException
*/
public static function update($_id, $_params = null, $_options = null)
{
$msg = "Cards cannot be updated without a customer ID or an " .
"account ID. Update a card using " .
"`Customer::updateSource('customer_id', 'card_id', " .
"\$updateParams)` or `Account::updateExternalAccount(" .
"'account_id', 'card_id', \$updateParams)`.";
throw new Exception\BadMethodCallException($msg);
}
}

View File

@@ -1,135 +0,0 @@
<?php
namespace Stripe;
/**
* Class Charge
*
* @property string $id
* @property string $object
* @property int $amount
* @property int $amount_refunded
* @property string $application
* @property string $application_fee
* @property int $application_fee_amount
* @property string $balance_transaction
* @property mixed $billing_details
* @property bool $captured
* @property int $created
* @property string $currency
* @property string $customer
* @property string $description
* @property string $destination
* @property string $dispute
* @property string $failure_code
* @property string $failure_message
* @property mixed $fraud_details
* @property string $invoice
* @property bool $livemode
* @property StripeObject $metadata
* @property string $on_behalf_of
* @property string $order
* @property mixed $outcome
* @property bool $paid
* @property string $payment_intent
* @property string $payment_method
* @property mixed $payment_method_details
* @property string $receipt_email
* @property string $receipt_number
* @property string $receipt_url
* @property bool $refunded
* @property Collection $refunds
* @property string $review
* @property mixed $shipping
* @property mixed $source
* @property string $source_transfer
* @property string $statement_descriptor
* @property string $status
* @property string $transfer
* @property mixed $transfer_data
* @property string $transfer_group
*
* @package Stripe
*/
class Charge extends ApiResource
{
const OBJECT_NAME = "charge";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* Possible string representations of decline codes.
* These strings are applicable to the decline_code property of the \Stripe\Exception\CardException exception.
* @link https://stripe.com/docs/declines/codes
*/
const DECLINED_APPROVE_WITH_ID = 'approve_with_id';
const DECLINED_CALL_ISSUER = 'call_issuer';
const DECLINED_CARD_NOT_SUPPORTED = 'card_not_supported';
const DECLINED_CARD_VELOCITY_EXCEEDED = 'card_velocity_exceeded';
const DECLINED_CURRENCY_NOT_SUPPORTED = 'currency_not_supported';
const DECLINED_DO_NOT_HONOR = 'do_not_honor';
const DECLINED_DO_NOT_TRY_AGAIN = 'do_not_try_again';
const DECLINED_DUPLICATED_TRANSACTION = 'duplicate_transaction';
const DECLINED_EXPIRED_CARD = 'expired_card';
const DECLINED_FRAUDULENT = 'fraudulent';
const DECLINED_GENERIC_DECLINE = 'generic_decline';
const DECLINED_INCORRECT_NUMBER = 'incorrect_number';
const DECLINED_INCORRECT_CVC = 'incorrect_cvc';
const DECLINED_INCORRECT_PIN = 'incorrect_pin';
const DECLINED_INCORRECT_ZIP = 'incorrect_zip';
const DECLINED_INSUFFICIENT_FUNDS = 'insufficient_funds';
const DECLINED_INVALID_ACCOUNT = 'invalid_account';
const DECLINED_INVALID_AMOUNT = 'invalid_amount';
const DECLINED_INVALID_CVC = 'invalid_cvc';
const DECLINED_INVALID_EXPIRY_YEAR = 'invalid_expiry_year';
const DECLINED_INVALID_NUMBER = 'invalid_number';
const DECLINED_INVALID_PIN = 'invalid_pin';
const DECLINED_ISSUER_NOT_AVAILABLE = 'issuer_not_available';
const DECLINED_LOST_CARD = 'lost_card';
const DECLINED_MERCHANT_BLACKLIST = 'merchant_blacklist';
const DECLINED_NEW_ACCOUNT_INFORMATION_AVAILABLE = 'new_account_information_available';
const DECLINED_NO_ACTION_TAKEN = 'no_action_taken';
const DECLINED_NOT_PERMITTED = 'not_permitted';
const DECLINED_PICKUP_CARD = 'pickup_card';
const DECLINED_PIN_TRY_EXCEEDED = 'pin_try_exceeded';
const DECLINED_PROCESSING_ERROR = 'processing_error';
const DECLINED_REENTER_TRANSACTION = 'reenter_transaction';
const DECLINED_RESTRICTED_CARD = 'restricted_card';
const DECLINED_REVOCATION_OF_ALL_AUTHORIZATIONS = 'revocation_of_all_authorizations';
const DECLINED_REVOCATION_OF_AUTHORIZATION = 'revocation_of_authorization';
const DECLINED_SECURITY_VIOLATION = 'security_violation';
const DECLINED_SERVICE_NOT_ALLOWED = 'service_not_allowed';
const DECLINED_STOLEN_CARD = 'stolen_card';
const DECLINED_STOP_PAYMENT_ORDER = 'stop_payment_order';
const DECLINED_TESTMODE_DECLINE = 'testmode_decline';
const DECLINED_TRANSACTION_NOT_ALLOWED = 'transaction_not_allowed';
const DECLINED_TRY_AGAIN_LATER = 'try_again_later';
const DECLINED_WITHDRAWAL_COUNT_LIMIT_EXCEEDED = 'withdrawal_count_limit_exceeded';
/**
* Possible string representations of the status of the charge.
* @link https://stripe.com/docs/api/charges/object#charge_object-status
*/
const STATUS_FAILED = 'failed';
const STATUS_PENDING = 'pending';
const STATUS_SUCCEEDED = 'succeeded';
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Charge The captured charge.
*/
public function capture($params = null, $options = null)
{
$url = $this->instanceUrl() . '/capture';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -1,39 +0,0 @@
<?php
namespace Stripe\Checkout;
/**
* Class Session
*
* @property string $id
* @property string $object
* @property string $cancel_url
* @property string $client_reference_id
* @property string $customer
* @property string $customer_email
* @property mixed $display_items
* @property bool $livemode
* @property string $payment_intent
* @property string[] $payment_method_types
* @property string $submit_type
* @property string $subscription
* @property string $success_url
*
* @package Stripe
*/
class Session extends \Stripe\ApiResource
{
const OBJECT_NAME = "checkout.session";
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Retrieve;
/**
* Possible string representations of submit type.
* @link https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-submit_type
*/
const SUBMIT_TYPE_AUTO = 'auto';
const SUBMIT_TYPE_BOOK = 'book';
const SUBMIT_TYPE_DONATE = 'donate';
const SUBMIT_TYPE_PAY = 'pay';
}

View File

@@ -1,25 +0,0 @@
<?php
namespace Stripe;
/**
* Class CountrySpec
*
* @property string $id
* @property string $object
* @property string $default_currency
* @property mixed $supported_bank_account_currencies
* @property string[] $supported_payment_currencies
* @property string[] $supported_payment_methods
* @property string[] $supported_transfer_countries
* @property mixed $verification_fields
*
* @package Stripe
*/
class CountrySpec extends ApiResource
{
const OBJECT_NAME = "country_spec";
use ApiOperations\All;
use ApiOperations\Retrieve;
}

View File

@@ -1,35 +0,0 @@
<?php
namespace Stripe;
/**
* Class Coupon
*
* @property string $id
* @property string $object
* @property int $amount_off
* @property int $created
* @property string $currency
* @property string $duration
* @property int $duration_in_months
* @property bool $livemode
* @property int $max_redemptions
* @property StripeObject $metadata
* @property string $name
* @property float $percent_off
* @property int $redeem_by
* @property int $times_redeemed
* @property bool $valid
*
* @package Stripe
*/
class Coupon extends ApiResource
{
const OBJECT_NAME = "coupon";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Delete;
use ApiOperations\Retrieve;
use ApiOperations\Update;
}

View File

@@ -1,75 +0,0 @@
<?php
namespace Stripe;
/**
* Class CreditNote
*
* @property string $id
* @property string $object
* @property int $amount
* @property string $customer_balance_transaction
* @property int $created
* @property string $currency
* @property string $customer
* @property string $invoice
* @property bool $livemode
* @property string $memo
* @property StripeObject $metadata
* @property string $number
* @property string $pdf
* @property string $reason
* @property string $refund
* @property string $status
* @property string $type
*
* @package Stripe
*/
class CreditNote extends ApiResource
{
const OBJECT_NAME = "credit_note";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* Possible string representations of the credit note reason.
* @link https://stripe.com/docs/api/credit_notes/object#credit_note_object-reason
*/
const REASON_DUPLICATE = 'duplicate';
const REASON_FRAUDULENT = 'fraudulent';
const REASON_ORDER_CHANGE = 'order_change';
const REASON_PRODUCT_UNSATISFACTORY = 'product_unsatisfactory';
/**
* Possible string representations of the credit note status.
* @link https://stripe.com/docs/api/credit_notes/object#credit_note_object-status
*/
const STATUS_ISSUED = 'issued';
const STATUS_VOID = 'void';
/**
* Possible string representations of the credit note type.
* @link https://stripe.com/docs/api/credit_notes/object#credit_note_object-status
*/
const TYPE_POST_PAYMENT = 'post_payment';
const TYPE_PRE_PAYMENT = 'pre_payment';
/**
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return CreditNote The voided credit note.
*/
public function voidCreditNote($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/void';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -1,264 +0,0 @@
<?php
namespace Stripe;
/**
* Class Customer
*
* @property string $id
* @property string $object
* @property mixed $address
* @property int $balance
* @property string $created
* @property string $currency
* @property string $default_source
* @property bool $delinquent
* @property string $description
* @property Discount $discount
* @property string $email
* @property string $invoice_prefix
* @property mixed $invoice_settings
* @property bool $livemode
* @property StripeObject $metadata
* @property string $name
* @property string $phone
* @property string[] preferred_locales
* @property mixed $shipping
* @property Collection $sources
* @property Collection $subscriptions
* @property string $tax_exempt
* @property Collection $tax_ids
*
* @package Stripe
*/
class Customer extends ApiResource
{
const OBJECT_NAME = "customer";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Delete;
use ApiOperations\NestedResource;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* Possible string representations of the customer's type of tax exemption.
* @link https://stripe.com/docs/api/customers/object#customer_object-tax_exempt
*/
const TAX_EXEMPT_NONE = 'none';
const TAX_EXEMPT_EXEMPT = 'exempt';
const TAX_EXEMPT_REVERSE = 'reverse';
public static function getSavedNestedResources()
{
static $savedNestedResources = null;
if ($savedNestedResources === null) {
$savedNestedResources = new Util\Set([
'source',
]);
}
return $savedNestedResources;
}
const PATH_BALANCE_TRANSACTIONS = '/balance_transactions';
const PATH_SOURCES = '/sources';
const PATH_TAX_IDS = '/tax_ids';
/**
* @return Customer The updated customer.
*/
public function deleteDiscount()
{
$url = $this->instanceUrl() . '/discount';
list($response, $opts) = $this->_request('delete', $url);
$this->refreshFrom(['discount' => null], $opts, true);
}
/**
* @param string|null $id The ID of the customer on which to create the source.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return ApiResource
*/
public static function createSource($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_SOURCES, $params, $opts);
}
/**
* @param string|null $id The ID of the customer to which the source belongs.
* @param string|null $sourceId The ID of the source to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return ApiResource
*/
public static function retrieveSource($id, $sourceId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts);
}
/**
* @param string|null $id The ID of the customer to which the source belongs.
* @param string|null $sourceId The ID of the source to update.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return ApiResource
*/
public static function updateSource($id, $sourceId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts);
}
/**
* @param string|null $id The ID of the customer to which the source belongs.
* @param string|null $sourceId The ID of the source to delete.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return ApiResource
*/
public static function deleteSource($id, $sourceId, $params = null, $opts = null)
{
return self::_deleteNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts);
}
/**
* @param string|null $id The ID of the customer on which to retrieve the sources.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Collection The list of sources.
*/
public static function allSources($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_SOURCES, $params, $opts);
}
/**
* @param string|null $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 ApiResource
*/
public static function createTaxId($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_TAX_IDS, $params, $opts);
}
/**
* @param string|null $id The ID of the customer to which the tax id belongs.
* @param string|null $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 ApiResource
*/
public static function retrieveTaxId($id, $taxIdId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts);
}
/**
* @param string|null $id The ID of the customer to which the tax id belongs.
* @param string|null $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 ApiResource
*/
public static function deleteTaxId($id, $taxIdId, $params = null, $opts = null)
{
return self::_deleteNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts);
}
/**
* @param string|null $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 tax ids.
*/
public static function allTaxIds($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_TAX_IDS, $params, $opts);
}
/**
* @param string|null $id The ID of the customer on which to create the balance transaction.
* @param array|null $params
* @param array|string|null $opts
*
* @return ApiResource
*/
public static function createBalanceTransaction($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts);
}
/**
* @param string|null $id The ID of the customer to which the balance transaction belongs.
* @param string|null $balanceTransactionId The ID of the balance transaction to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return ApiResource
*/
public static function retrieveBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
}
/**
* @param string|null $id The ID of the customer on which to update the balance transaction.
* @param string|null $balanceTransactionId The ID of the balance transaction to update.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return ApiResource
*/
public static function updateBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
}
/**
* @param string|null $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 Collection The list of customer balance transactions.
*/
public static function allBalanceTransactions($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts);
}
}

View File

@@ -1,92 +0,0 @@
<?php
namespace Stripe;
/**
* Class CustomerBalanceTransaction
*
* @package Stripe
*
* @property string $id
* @property string $object
* @property int $amount
* @property string $credit_note
* @property int $created
* @property string $currency
* @property string $customer
* @property string $description
* @property int $ending_balance
* @property string $invoice
* @property bool $livemode
* @property StripeObject $metadata
* @property string $type
*/
class CustomerBalanceTransaction extends ApiResource
{
const OBJECT_NAME = "customer_balance_transaction";
/**
* Possible string representations of a balance transaction's type.
* @link https://stripe.com/docs/api/customers/customer_balance_transaction_object#customer_balance_transaction_object-type
*/
const TYPE_ADJUSTEMENT = 'adjustment';
const TYPE_APPLIED_TO_INVOICE = 'applied_to_invoice';
const TYPE_CREDIT_NOTE = 'credit_note';
const TYPE_INITIAL = 'initial';
const TYPE_INVOICE_TOO_LARGE = 'invoice_too_large';
const TYPE_INVOICE_TOO_SMALL = 'invoice_too_small';
const TYPE_UNSPENT_RECEIVER_CREDIT = 'unspent_receiver_credit';
/**
* @return string The API URL for this balance transaction.
*/
public function instanceUrl()
{
$id = $this['id'];
$customer = $this['customer'];
if (!$id) {
throw new Exception\UnexpectedValueException(
"Could not determine which URL to request: class instance has invalid ID: $id",
null
);
}
$id = Util\Util::utf8($id);
$customer = Util\Util::utf8($customer);
$base = Customer::classUrl();
$customerExtn = urlencode($customer);
$extn = urlencode($id);
return "$base/$customerExtn/balance_transactions/$extn";
}
/**
* @param array|string $_id
* @param array|string|null $_opts
*
* @throws \Stripe\Exception\BadMethodCallException
*/
public static function retrieve($_id, $_opts = null)
{
$msg = "Customer Balance Transactions cannot be retrieved without a " .
"customer ID. Retrieve a Customer Balance Transaction using " .
"`Customer::retrieveBalanceTransaction('customer_id', " .
"'balance_transaction_id')`.";
throw new Exception\BadMethodCallException($msg, null);
}
/**
* @param string $_id
* @param array|null $_params
* @param array|string|null $_options
*
* @throws \Stripe\Exception\BadMethodCallException
*/
public static function update($_id, $_params = null, $_options = null)
{
$msg = "Customer Balance Transactions cannot be updated without a " .
"customer ID. Update a Customer Balance Transaction using " .
"`Customer::updateBalanceTransaction('customer_id', " .
"'balance_transaction_id', \$updateParams)`.";
throw new Exception\BadMethodCallException($msg, null);
}
}

View File

@@ -1,20 +0,0 @@
<?php
namespace Stripe;
/**
* Class Discount
*
* @property string $object
* @property Coupon $coupon
* @property string $customer
* @property int $end
* @property int $start
* @property string $subscription
*
* @package Stripe
*/
class Discount extends StripeObject
{
const OBJECT_NAME = "discount";
}

View File

@@ -1,79 +0,0 @@
<?php
namespace Stripe;
/**
* Class Dispute
*
* @property string $id
* @property string $object
* @property int $amount
* @property BalanceTransaction[] $balance_transactions
* @property string $charge
* @property int $created
* @property string $currency
* @property mixed $evidence
* @property mixed $evidence_details
* @property bool $is_charge_refundable
* @property bool $livemode
* @property StripeObject $metadata
* @property string $reason
* @property string $status
*
* @package Stripe
*/
class Dispute extends ApiResource
{
const OBJECT_NAME = "dispute";
use ApiOperations\All;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* Possible string representations of dispute reasons.
* @link https://stripe.com/docs/api#dispute_object
*/
const REASON_BANK_CANNOT_PROCESS = 'bank_cannot_process';
const REASON_CHECK_RETURNED = 'check_returned';
const REASON_CREDIT_NOT_PROCESSED = 'credit_not_processed';
const REASON_CUSTOMER_INITIATED = 'customer_initiated';
const REASON_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized';
const REASON_DUPLICATE = 'duplicate';
const REASON_FRAUDULENT = 'fraudulent';
const REASON_GENERAL = 'general';
const REASON_INCORRECT_ACCOUNT_DETAILS = 'incorrect_account_details';
const REASON_INSUFFICIENT_FUNDS = 'insufficient_funds';
const REASON_PRODUCT_NOT_RECEIVED = 'product_not_received';
const REASON_PRODUCT_UNACCEPTABLE = 'product_unacceptable';
const REASON_SUBSCRIPTION_CANCELED = 'subscription_canceled';
const REASON_UNRECOGNIZED = 'unrecognized';
/**
* Possible string representations of dispute statuses.
* @link https://stripe.com/docs/api#dispute_object
*/
const STATUS_CHARGE_REFUNDED = 'charge_refunded';
const STATUS_LOST = 'lost';
const STATUS_NEEDS_RESPONSE = 'needs_response';
const STATUS_UNDER_REVIEW = 'under_review';
const STATUS_WARNING_CLOSED = 'warning_closed';
const STATUS_WARNING_NEEDS_RESPONSE = 'warning_needs_response';
const STATUS_WARNING_UNDER_REVIEW = 'warning_under_review';
const STATUS_WON = 'won';
/**
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Dispute The closed dispute.
*/
public function close($options = null)
{
$url = $this->instanceUrl() . '/close';
list($response, $opts) = $this->_request('post', $url, null, $options);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -1,43 +0,0 @@
<?php
namespace Stripe;
/**
* Class EphemeralKey
*
* @property string $id
* @property string $object
* @property int $created
* @property int $expires
* @property bool $livemode
* @property string $secret
* @property array $associated_objects
*
* @package Stripe
*/
class EphemeralKey extends ApiResource
{
const OBJECT_NAME = "ephemeral_key";
use ApiOperations\Create {
create as protected _create;
}
use ApiOperations\Delete;
/**
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\InvalidArgumentException if stripe_version is missing
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return EphemeralKey The created key.
*/
public static function create($params = null, $opts = null)
{
if (!$opts || !isset($opts['stripe_version'])) {
throw new Exception\InvalidArgumentException('stripe_version must be specified to create an ephemeral key');
}
return self::_create($params, $opts);
}
}

View File

@@ -1,162 +0,0 @@
<?php
namespace Stripe;
/**
* Class ErrorObject
*
* @property string $charge For card errors, the ID of the failed charge.
* @property string $code For some errors that could be handled
* programmatically, a short string indicating the error code reported.
* @property string $decline_code For card errors resulting from a card issuer
* decline, a short string indicating the card issuer's reason for the
* decline if they provide one.
* @property string $doc_url A URL to more information about the error code
* reported.
* @property string $message A human-readable message providing more details
* about the error. For card errors, these messages can be shown to your
* users.
* @property string $param If the error is parameter-specific, the parameter
* related to the error. For example, you can use this to display a message
* near the correct form field.
* @property PaymentIntent $payment_intent The PaymentIntent object for errors
* returned on a request involving a PaymentIntent.
* @property PaymentMethod $payment_method The PaymentMethod object for errors
* returned on a request involving a PaymentMethod.
* @property SetupIntent $setup_intent The SetupIntent object for errors
* returned on a request involving a SetupIntent.
* @property StripeObject $source The source object for errors returned on a
* request involving a source.
* @property string $type The type of error returned. One of
* `api_connection_error`, `api_error`, `authentication_error`,
* `card_error`, `idempotency_error`, `invalid_request_error`, or
* `rate_limit_error`.
*
* @package Stripe
*/
class ErrorObject extends StripeObject
{
/**
* Possible string representations of an error's code.
* @link https://stripe.com/docs/error-codes
*/
const CODE_ACCOUNT_ALREADY_EXISTS = 'account_already_exists';
const CODE_ACCOUNT_COUNTRY_INVALID_ADDRESS = 'account_country_invalid_address';
const CODE_ACCOUNT_INVALID = 'account_invalid';
const CODE_ACCOUNT_NUMBER_INVALID = 'account_number_invalid';
const CODE_ALIPAY_UPGRADE_REQUIRED = 'alipay_upgrade_required';
const CODE_AMOUNT_TOO_LARGE = 'amount_too_large';
const CODE_AMOUNT_TOO_SMALL = 'amount_too_small';
const CODE_API_KEY_EXPIRED = 'api_key_expired';
const CODE_BALANCE_INSUFFICIENT = 'balance_insufficient';
const CODE_BANK_ACCOUNT_EXISTS = 'bank_account_exists';
const CODE_BANK_ACCOUNT_UNUSABLE = 'bank_account_unusable';
const CODE_BANK_ACCOUNT_UNVERIFIED = 'bank_account_unverified';
const CODE_BITCOIN_UPGRADE_REQUIRED = 'bitcoin_upgrade_required';
const CODE_CARD_DECLINED = 'card_declined';
const CODE_CHARGE_ALREADY_CAPTURED = 'charge_already_captured';
const CODE_CHARGE_ALREADY_REFUNDED = 'charge_already_refunded';
const CODE_CHARGE_DISPUTED = 'charge_disputed';
const CODE_CHARGE_EXCEEDS_SOURCE_LIMIT = 'charge_exceeds_source_limit';
const CODE_CHARGE_EXPIRED_FOR_CAPTURE = 'charge_expired_for_capture';
const CODE_COUNTRY_UNSUPPORTED = 'country_unsupported';
const CODE_COUPON_EXPIRED = 'coupon_expired';
const CODE_CUSTOMER_MAX_SUBSCRIPTIONS = 'customer_max_subscriptions';
const CODE_EMAIL_INVALID = 'email_invalid';
const CODE_EXPIRED_CARD = 'expired_card';
const CODE_IDEMPOTENCY_KEY_IN_USE = 'idempotency_key_in_use';
const CODE_INCORRECT_ADDRESS = 'incorrect_address';
const CODE_INCORRECT_CVC = 'incorrect_cvc';
const CODE_INCORRECT_NUMBER = 'incorrect_number';
const CODE_INCORRECT_ZIP = 'incorrect_zip';
const CODE_INSTANT_PAYOUTS_UNSUPPORTED = 'instant_payouts_unsupported';
const CODE_INVALID_CARD_TYPE = 'invalid_card_type';
const CODE_INVALID_CHARGE_AMOUNT = 'invalid_charge_amount';
const CODE_INVALID_CVC = 'invalid_cvc';
const CODE_INVALID_EXPIRY_MONTH = 'invalid_expiry_month';
const CODE_INVALID_EXPIRY_YEAR = 'invalid_expiry_year';
const CODE_INVALID_NUMBER = 'invalid_number';
const CODE_INVALID_SOURCE_USAGE = 'invalid_source_usage';
const CODE_INVOICE_NO_CUSTOMER_LINE_ITEMS = 'invoice_no_customer_line_items';
const CODE_INVOICE_NO_SUBSCRIPTION_LINE_ITEMS = 'invoice_no_subscription_line_items';
const CODE_INVOICE_NOT_EDITABLE = 'invoice_not_editable';
const CODE_INVOICE_PAYMENT_INTENT_REQUIRES_ACTION = 'invoice_payment_intent_requires_action';
const CODE_INVOICE_UPCOMING_NONE = 'invoice_upcoming_none';
const CODE_LIVEMODE_MISMATCH = 'livemode_mismatch';
const CODE_LOCK_TIMEOUT = 'lock_timeout';
const CODE_MISSING = 'missing';
const CODE_NOT_ALLOWED_ON_STANDARD_ACCOUNT = 'not_allowed_on_standard_account';
const CODE_ORDER_CREATION_FAILED = 'order_creation_failed';
const CODE_ORDER_REQUIRED_SETTINGS = 'order_required_settings';
const CODE_ORDER_STATUS_INVALID = 'order_status_invalid';
const CODE_ORDER_UPSTREAM_TIMEOUT = 'order_upstream_timeout';
const CODE_OUT_OF_INVENTORY = 'out_of_inventory';
const CODE_PARAMETER_INVALID_EMPTY = 'parameter_invalid_empty';
const CODE_PARAMETER_INVALID_INTEGER = 'parameter_invalid_integer';
const CODE_PARAMETER_INVALID_STRING_BLANK = 'parameter_invalid_string_blank';
const CODE_PARAMETER_INVALID_STRING_EMPTY = 'parameter_invalid_string_empty';
const CODE_PARAMETER_MISSING = 'parameter_missing';
const CODE_PARAMETER_UNKNOWN = 'parameter_unknown';
const CODE_PARAMETERS_EXCLUSIVE = 'parameters_exclusive';
const CODE_PAYMENT_INTENT_AUTHENTICATION_FAILURE = 'payment_intent_authentication_failure';
const CODE_PAYMENT_INTENT_INCOMPATIBLE_PAYMENT_METHOD = 'payment_intent_incompatible_payment_method';
const CODE_PAYMENT_INTENT_INVALID_PARAMETER = 'payment_intent_invalid_parameter';
const CODE_PAYMENT_INTENT_PAYMENT_ATTEMPT_FAILED = 'payment_intent_payment_attempt_failed';
const CODE_PAYMENT_INTENT_UNEXPECTED_STATE = 'payment_intent_unexpected_state';
const CODE_PAYMENT_METHOD_UNACTIVATED = 'payment_method_unactivated';
const CODE_PAYMENT_METHOD_UNEXPECTED_STATE = 'payment_method_unexpected_state';
const CODE_PAYOUTS_NOT_ALLOWED = 'payouts_not_allowed';
const CODE_PLATFORM_API_KEY_EXPIRED = 'platform_api_key_expired';
const CODE_POSTAL_CODE_INVALID = 'postal_code_invalid';
const CODE_PROCESSING_ERROR = 'processing_error';
const CODE_PRODUCT_INACTIVE = 'product_inactive';
const CODE_RATE_LIMIT = 'rate_limit';
const CODE_RESOURCE_ALREADY_EXISTS = 'resource_already_exists';
const CODE_RESOURCE_MISSING = 'resource_missing';
const CODE_ROUTING_NUMBER_INVALID = 'routing_number_invalid';
const CODE_SECRET_KEY_REQUIRED = 'secret_key_required';
const CODE_SEPA_UNSUPPORTED_ACCOUNT = 'sepa_unsupported_account';
const CODE_SETUP_ATTEMPT_FAILED = 'setup_attempt_failed';
const CODE_SETUP_INTENT_AUTHENTICATION_FAILURE = 'setup_intent_authentication_failure';
const CODE_SETUP_INTENT_UNEXPECTED_STATE = 'setup_intent_unexpected_state';
const CODE_SHIPPING_CALCULATION_FAILED = 'shipping_calculation_failed';
const CODE_SKU_INACTIVE = 'sku_inactive';
const CODE_STATE_UNSUPPORTED = 'state_unsupported';
const CODE_TAX_ID_INVALID = 'tax_id_invalid';
const CODE_TAXES_CALCULATION_FAILED = 'taxes_calculation_failed';
const CODE_TESTMODE_CHARGES_ONLY = 'testmode_charges_only';
const CODE_TLS_VERSION_UNSUPPORTED = 'tls_version_unsupported';
const CODE_TOKEN_ALREADY_USED = 'token_already_used';
const CODE_TOKEN_IN_USE = 'token_in_use';
const CODE_TRANSFERS_NOT_ALLOWED = 'transfers_not_allowed';
const CODE_UPSTREAM_ORDER_CREATION_FAILED = 'upstream_order_creation_failed';
const CODE_URL_INVALID = 'url_invalid';
/**
* Refreshes this object using the provided values.
*
* @param array $values
* @param null|string|array|Util\RequestOptions $opts
* @param boolean $partial Defaults to false.
*/
public function refreshFrom($values, $opts, $partial = false)
{
// Unlike most other API resources, the API will omit attributes in
// error objects when they have a null value. We manually set default
// values here to facilitate generic error handling.
$values = array_merge([
'charge' => null,
'code' => null,
'decline_code' => null,
'doc_url' => null,
'message' => null,
'param' => null,
'payment_intent' => null,
'payment_method' => null,
'setup_intent' => null,
'source' => null,
'type' => null,
], $values);
parent::refreshFrom($values, $opts, $partial);
}
}

View File

@@ -1,167 +0,0 @@
<?php
namespace Stripe;
/**
* Class Event
*
* @property string $id
* @property string $object
* @property string $account
* @property string $api_version
* @property int $created
* @property mixed $data
* @property bool $livemode
* @property int $pending_webhooks
* @property mixed $request
* @property string $type
*
* @package Stripe
*/
class Event extends ApiResource
{
const OBJECT_NAME = "event";
/**
* Possible string representations of event types.
* @link https://stripe.com/docs/api#event_types
*/
const ACCOUNT_UPDATED = 'account.updated';
const ACCOUNT_APPLICATION_AUTHORIZED = 'account.application.authorized';
const ACCOUNT_APPLICATION_DEAUTHORIZED = 'account.application.deauthorized';
const ACCOUNT_EXTERNAL_ACCOUNT_CREATED = 'account.external_account.created';
const ACCOUNT_EXTERNAL_ACCOUNT_DELETED = 'account.external_account.deleted';
const ACCOUNT_EXTERNAL_ACCOUNT_UPDATED = 'account.external_account.updated';
const APPLICATION_FEE_CREATED = 'application_fee.created';
const APPLICATION_FEE_REFUNDED = 'application_fee.refunded';
const APPLICATION_FEE_REFUND_UPDATED = 'application_fee.refund.updated';
const BALANCE_AVAILABLE = 'balance.available';
const CHARGE_CAPTURED = 'charge.captured';
const CHARGE_EXPIRED = 'charge.expired';
const CHARGE_FAILED = 'charge.failed';
const CHARGE_PENDING = 'charge.pending';
const CHARGE_REFUNDED = 'charge.refunded';
const CHARGE_SUCCEEDED = 'charge.succeeded';
const CHARGE_UPDATED = 'charge.updated';
const CHARGE_DISPUTE_CLOSED = 'charge.dispute.closed';
const CHARGE_DISPUTE_CREATED = 'charge.dispute.created';
const CHARGE_DISPUTE_FUNDS_REINSTATED = 'charge.dispute.funds_reinstated';
const CHARGE_DISPUTE_FUNDS_WITHDRAWN = 'charge.dispute.funds_withdrawn';
const CHARGE_DISPUTE_UPDATED = 'charge.dispute.updated';
const CHARGE_REFUND_UPDATED = 'charge.refund.updated';
const CHECKOUT_SESSION_COMPLETED = 'checkout.session.completed';
const COUPON_CREATED = 'coupon.created';
const COUPON_DELETED = 'coupon.deleted';
const COUPON_UPDATED = 'coupon.updated';
const CREDIT_NOTE_CREATED = 'credit_note.created';
const CREDIT_NOTE_UPDATED = 'credit_note.updated';
const CREDIT_NOTE_VOIDED = 'credit_note.voided';
const CUSTOMER_CREATED = 'customer.created';
const CUSTOMER_DELETED = 'customer.deleted';
const CUSTOMER_UPDATED = 'customer.updated';
const CUSTOMER_DISCOUNT_CREATED = 'customer.discount.created';
const CUSTOMER_DISCOUNT_DELETED = 'customer.discount.deleted';
const CUSTOMER_DISCOUNT_UPDATED = 'customer.discount.updated';
const CUSTOMER_SOURCE_CREATED = 'customer.source.created';
const CUSTOMER_SOURCE_DELETED = 'customer.source.deleted';
const CUSTOMER_SOURCE_EXPIRING = 'customer.source.expiring';
const CUSTOMER_SOURCE_UPDATED = 'customer.source.updated';
const CUSTOMER_SUBSCRIPTION_CREATED = 'customer.subscription.created';
const CUSTOMER_SUBSCRIPTION_DELETED = 'customer.subscription.deleted';
const CUSTOMER_SUBSCRIPTION_TRIAL_WILL_END = 'customer.subscription.trial_will_end';
const CUSTOMER_SUBSCRIPTION_UPDATED = 'customer.subscription.updated';
const FILE_CREATED = 'file.created';
const INVOICE_CREATED = 'invoice.created';
const INVOICE_DELETED = 'invoice.deleted';
const INVOICE_FINALIZED = 'invoice.finalized';
const INVOICE_MARKED_UNCOLLECTIBLE = 'invoice.marked_uncollectible';
const INVOICE_PAYMENT_ACTION_REQUIRED = 'invoice.payment_action_required';
const INVOICE_PAYMENT_FAILED = 'invoice.payment_failed';
const INVOICE_PAYMENT_SUCCEEDED = 'invoice.payment_succeeded';
const INVOICE_SENT = 'invoice.sent';
const INVOICE_UPCOMING = 'invoice.upcoming';
const INVOICE_UPDATED = 'invoice.updated';
const INVOICE_VOIDED = 'invoice.voided';
const INVOICEITEM_CREATED = 'invoiceitem.created';
const INVOICEITEM_DELETED = 'invoiceitem.deleted';
const INVOICEITEM_UPDATED = 'invoiceitem.updated';
const ISSUER_FRAUD_RECORD_CREATED = 'issuer_fraud_record.created';
const ISSUING_AUTHORIZATION_CREATED = 'issuing_authorization.created';
const ISSUING_AUTHORIZATION_REQUEST = 'issuing_authorization.request';
const ISSUING_AUTHORIZATION_UPDATED = 'issuing_authorization.updated';
const ISSUING_CARD_CREATED = 'issuing_card.created';
const ISSUING_CARD_UPDATED = 'issuing_card.updated';
const ISSUING_CARDHOLDER_CREATED = 'issuing_cardholder.created';
const ISSUING_CARDHOLDER_UPDATED = 'issuing_cardholder.updated';
const ISSUING_DISPUTE_CREATED = 'issuing_dispute.created';
const ISSUING_DISPUTE_UPDATED = 'issuing_dispute.updated';
const ISSUING_TRANSACTION_CREATED = 'issuing_transaction.created';
const ISSUING_TRANSACTION_UPDATED = 'issuing_transaction.updated';
const ORDER_CREATED = 'order.created';
const ORDER_PAYMENT_FAILED = 'order.payment_failed';
const ORDER_PAYMENT_SUCCEEDED = 'order.payment_succeeded';
const ORDER_UPDATED = 'order.updated';
const ORDER_RETURN_CREATED = 'order_return.created';
const PAYMENT_INTENT_AMOUNT_CAPTURABLE_UPDATED = 'payment_intent.amount_capturable_updated';
const PAYMENT_INTENT_CREATED = 'payment_intent.created';
const PAYMENT_INTENT_PAYMENT_FAILED = 'payment_intent.payment_failed';
const PAYMENT_INTENT_SUCCEEDED = 'payment_intent.succeeded';
const PAYMENT_METHOD_ATTACHED = 'payment_method.attached';
const PAYMENT_METHOD_CARD_AUTOMATICALLY_UPDATED = 'payment_method.card_automatically_updated';
const PAYMENT_METHOD_DETACHED = 'payment_method.detached';
const PAYMENT_METHOD_UPDATED = 'payment_method.updated';
const PAYOUT_CANCELED = 'payout.canceled';
const PAYOUT_CREATED = 'payout.created';
const PAYOUT_FAILED = 'payout.failed';
const PAYOUT_PAID = 'payout.paid';
const PAYOUT_UPDATED = 'payout.updated';
const PERSON_CREATED = 'person.created';
const PERSON_DELETED = 'person.deleted';
const PERSON_UPDATED = 'person.updated';
const PING = 'ping';
const PLAN_CREATED = 'plan.created';
const PLAN_DELETED = 'plan.deleted';
const PLAN_UPDATED = 'plan.updated';
const PRODUCT_CREATED = 'product.created';
const PRODUCT_DELETED = 'product.deleted';
const PRODUCT_UPDATED = 'product.updated';
const RECIPIENT_CREATED = 'recipient.created';
const RECIPIENT_DELETED = 'recipient.deleted';
const RECIPIENT_UPDATED = 'recipient.updated';
const REPORTING_REPORT_RUN_FAILED = 'reporting.report_run.failed';
const REPORTING_REPORT_RUN_SUCCEEDED = 'reporting.report_run.succeeded';
const REPORTING_REPORT_TYPE_UPDATED = 'reporting.report_type.updated';
const REVIEW_CLOSED = 'review.closed';
const REVIEW_OPENED = 'review.opened';
const SIGMA_SCHEDULED_QUERY_RUN_CREATED = 'sigma.scheduled_query_run.created';
const SKU_CREATED = 'sku.created';
const SKU_DELETED = 'sku.deleted';
const SKU_UPDATED = 'sku.updated';
const SOURCE_CANCELED = 'source.canceled';
const SOURCE_CHARGEABLE = 'source.chargeable';
const SOURCE_FAILED = 'source.failed';
const SOURCE_MANDATE_NOTIFICATION = 'source.mandate_notification';
const SOURCE_REFUND_ATTRIBUTES_REQUIRED = 'source.refund_attributes_required';
const SOURCE_TRANSACTION_CREATED = 'source.transaction.created';
const SOURCE_TRANSACTION_UPDATED = 'source.transaction.updated';
const SUBSCRIPTION_SCHEDULE_ABORTED = 'subscription_schedule.aborted';
const SUBSCRIPTION_SCHEDULE_CANCELED = 'subscription_schedule.canceled';
const SUBSCRIPTION_SCHEDULE_COMPLETED = 'subscription_schedule.completed';
const SUBSCRIPTION_SCHEDULE_CREATED = 'subscription_schedule.created';
const SUBSCRIPTION_SCHEDULE_EXPIRING = 'subscription_schedule.expiring';
const SUBSCRIPTION_SCHEDULE_RELEASED = 'subscription_schedule.released';
const SUBSCRIPTION_SCHEDULE_UPDATED = 'subscription_schedule.updated';
const TAX_RATE_CREATED = 'tax_rate.created';
const TAX_RATE_UPDATED = 'tax_rate.updated';
const TOPUP_CANCELED = 'topup.canceled';
const TOPUP_CREATED = 'topup.created';
const TOPUP_FAILED = 'topup.failed';
const TOPUP_REVERSED = 'topup.reversed';
const TOPUP_SUCCEEDED = 'topup.succeeded';
const TRANSFER_CREATED = 'transfer.created';
const TRANSFER_REVERSED = 'transfer.reversed';
const TRANSFER_UPDATED = 'transfer.updated';
use ApiOperations\All;
use ApiOperations\Retrieve;
}

View File

@@ -1,16 +0,0 @@
<?php
namespace Stripe;
/**
* Class ExchangeRate
*
* @package Stripe
*/
class ExchangeRate extends ApiResource
{
const OBJECT_NAME = "exchange_rate";
use ApiOperations\All;
use ApiOperations\Retrieve;
}

View File

@@ -1,60 +0,0 @@
<?php
namespace Stripe;
/**
* Class File
*
* @property string $id
* @property string $object
* @property int $created
* @property string $filename
* @property Collection $links
* @property string $purpose
* @property int $size
* @property string $title
* @property string $type
* @property string $url
*
* @package Stripe
*/
class File extends ApiResource
{
// 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";
use ApiOperations\All;
use ApiOperations\Create {
create as protected _create;
}
use ApiOperations\Retrieve;
public static function classUrl()
{
return '/v1/files';
}
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\File The created resource.
*/
public static function create($params = null, $options = null)
{
$opts = \Stripe\Util\RequestOptions::parse($options);
if (is_null($opts->apiBase)) {
$opts->apiBase = Stripe::$apiUploadBase;
}
// Manually flatten params, otherwise curl's multipart encoder will
// choke on nested arrays.
$flatParams = array_column(\Stripe\Util\Util::flattenParams($params), 1, 0);
return static::_create($flatParams, $opts);
}
}

View File

@@ -1,28 +0,0 @@
<?php
namespace Stripe;
/**
* Class FileLink
*
* @property string $id
* @property string $object
* @property int $created
* @property bool $expired
* @property int $expires_at
* @property string $file
* @property bool $livemode
* @property StripeObject $metadata
* @property string $url
*
* @package Stripe
*/
class FileLink extends ApiResource
{
const OBJECT_NAME = "file_link";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
}

View File

@@ -1,214 +0,0 @@
<?php
namespace Stripe;
/**
* Class Invoice
*
* @property string $id
* @property string $object
* @property string $account_country
* @property string $account_name
* @property int $amount_due
* @property int $amount_paid
* @property int $amount_remaining
* @property int $application_fee_amount
* @property int $attempt_count
* @property bool $attempted
* @property bool $auto_advance
* @property string $billing
* @property string $billing_reason
* @property string $charge
* @property string $collection_method
* @property int $created
* @property string $currency
* @property array $custom_fields
* @property string $customer
* @property mixed $customer_address
* @property string $customer_email
* @property string $customer_name
* @property string $customer_phone
* @property mixed $customer_shipping
* @property string $customer_tax_exempt
* @property array $customer_tax_ids
* @property string $default_payment_method
* @property string $default_source
* @property array $default_tax_rates
* @property string $description
* @property Discount $discount
* @property int $due_date
* @property int $ending_balance
* @property string $footer
* @property string $hosted_invoice_url
* @property string $invoice_pdf
* @property Collection $lines
* @property bool $livemode
* @property StripeObject $metadata
* @property int $next_payment_attempt
* @property string $number
* @property bool $paid
* @property string $payment_intent
* @property int $period_end
* @property int $period_start
* @property int $post_payment_credit_notes_amount
* @property int $pre_payment_credit_notes_amount
* @property string $receipt_number
* @property int $starting_balance
* @property string $statement_descriptor
* @property string $status
* @property mixed $status_transitions
* @property string $subscription
* @property int $subscription_proration_date
* @property int $subtotal
* @property int $tax
* @property mixed $threshold_reason
* @property int $total
* @property array $total_tax_amounts
* @property int $webhooks_delivered_at
*
* @package Stripe
*/
class Invoice extends ApiResource
{
const OBJECT_NAME = "invoice";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Delete;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* Possible string representations of the billing reason.
* @link https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason
*/
const BILLING_REASON_MANUAL = 'manual';
const BILLING_REASON_SUBSCRIPTION = 'subscription';
const BILLING_REASON_SUBSCRIPTION_CREATE = 'subscription_create';
const BILLING_REASON_SUBSCRIPTION_CYCLE = 'subscription_cycle';
const BILLING_REASON_SUBSCRIPTION_THRESHOLD = 'subscription_threshold';
const BILLING_REASON_SUBSCRIPTION_UPDATE = 'subscription_update';
const BILLING_REASON_UPCOMING = 'upcoming';
/**
* Possible string representations of the `collection_method` property.
* @link https://stripe.com/docs/api/invoices/object#invoice_object-collection_method
*/
const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically';
const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice';
/**
* Possible string representations of the invoice status.
* @link https://stripe.com/docs/api/invoices/object#invoice_object-status
*/
const STATUS_DRAFT = 'draft';
const STATUS_OPEN = 'open';
const STATUS_PAID = 'paid';
const STATUS_UNCOLLECTIBLE = 'uncollectible';
const STATUS_VOID = 'void';
/**
* Possible string representations of the `billing` property.
* @deprecated Use `collection_method` instead.
* @link https://stripe.com/docs/api/invoices/object#invoice_object-billing
*/
const BILLING_CHARGE_AUTOMATICALLY = 'charge_automatically';
const BILLING_SEND_INVOICE = 'send_invoice';
/**
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Invoice The finalized invoice.
*/
public function finalizeInvoice($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/finalize';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$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 uncollectible invoice.
*/
public function markUncollectible($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/mark_uncollectible';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$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 paid invoice.
*/
public function pay($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/pay';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$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 sent invoice.
*/
public function sendInvoice($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/send';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$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
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Invoice The voided invoice.
*/
public function voidInvoice($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/void';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -1,39 +0,0 @@
<?php
namespace Stripe;
/**
* Class InvoiceItem
*
* @property string $id
* @property string $object
* @property int $amount
* @property string $currency
* @property string $customer
* @property int $date
* @property string $description
* @property bool $discountable
* @property string $invoice
* @property bool $livemode
* @property StripeObject $metadata
* @property mixed $period
* @property Plan $plan
* @property bool $proration
* @property int $quantity
* @property string $subscription
* @property string $subscription_item
* @property array $tax_rates
* @property int $unit_amount
*
* @package Stripe
*/
class InvoiceItem extends ApiResource
{
const OBJECT_NAME = "invoiceitem";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Delete;
use ApiOperations\Retrieve;
use ApiOperations\Update;
}

View File

@@ -1,32 +0,0 @@
<?php
namespace Stripe;
/**
* Class InvoiceLineItem
*
* @property string $id
* @property string $object
* @property int $amount
* @property string $currency
* @property string $description
* @property bool $discountable
* @property string $invoice_item
* @property bool $livemode
* @property StripeObject $metadata
* @property mixed $period
* @property Plan $plan
* @property bool $proration
* @property int $quantity
* @property string $subscription
* @property string $subscription_item
* @property array $tax_amounts
* @property array $tax_rates
* @property string $type
*
* @package Stripe
*/
class InvoiceLineItem extends ApiResource
{
const OBJECT_NAME = "line_item";
}

View File

@@ -1,72 +0,0 @@
<?php
namespace Stripe\Issuing;
/**
* Class Authorization
*
* @property string $id
* @property string $object
* @property bool $approved
* @property string $authorization_method
* @property int $authorized_amount
* @property string $authorized_currency
* @property \Stripe\Collection $balance_transactions
* @property Card $card
* @property Cardholder $cardholder
* @property int $created
* @property int $held_amount
* @property string $held_currency
* @property bool $is_held_amount_controllable
* @property bool $livemode
* @property mixed $merchant_data
* @property \Stripe\StripeObject $metadata
* @property int $pending_authorized_amount
* @property int $pending_held_amount
* @property mixed $request_history
* @property string $status
* @property \Stripe\Collection $transactions
* @property mixed $verification_data
*
* @package Stripe\Issuing
*/
class Authorization extends \Stripe\ApiResource
{
const OBJECT_NAME = "issuing.authorization";
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Retrieve;
use \Stripe\ApiOperations\Update;
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Authorization The approved authorization.
*/
public function approve($params = null, $options = null)
{
$url = $this->instanceUrl() . '/approve';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Authorization The declined authorization.
*/
public function decline($params = null, $options = null)
{
$url = $this->instanceUrl() . '/decline';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -1,53 +0,0 @@
<?php
namespace Stripe\Issuing;
/**
* Class Card
*
* @property string $id
* @property string $object
* @property mixed $authorization_controls
* @property mixed $billing
* @property string $brand
* @property Cardholder $cardholder
* @property int $created
* @property string $currency
* @property int $exp_month
* @property int $exp_year
* @property string $last4
* @property bool $livemode
* @property \Stripe\StripeObject $metadata
* @property string $name
* @property mixed $shipping
* @property string $status
* @property string $type
*
* @package Stripe\Issuing
*/
class Card extends \Stripe\ApiResource
{
const OBJECT_NAME = "issuing.card";
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Retrieve;
use \Stripe\ApiOperations\Update;
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return CardDetails The card details associated with that issuing card.
*/
public function details($params = null, $options = null)
{
$url = $this->instanceUrl() . '/details';
list($response, $opts) = $this->_request('get', $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response, $opts);
$obj->setLastResponse($response);
return $obj;
}
}

View File

@@ -1,30 +0,0 @@
<?php
namespace Stripe\Issuing;
/**
* Class Cardholder
*
* @property string $id
* @property string $object
* @property mixed $billing
* @property int $created
* @property string $email
* @property bool $livemode
* @property \Stripe\StripeObject $metadata
* @property string $name
* @property string $phone_number
* @property string $status
* @property string $type
*
* @package Stripe\Issuing
*/
class Cardholder extends \Stripe\ApiResource
{
const OBJECT_NAME = "issuing.cardholder";
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Retrieve;
use \Stripe\ApiOperations\Update;
}

View File

@@ -1,30 +0,0 @@
<?php
namespace Stripe\Issuing;
/**
* Class Dispute
*
* @property string $id
* @property string $object
* @property int $amount
* @property int $created
* @property string $currency
* @property mixed $evidence
* @property bool $livemode
* @property \Stripe\StripeObject $metadata
* @property string $reason
* @property string $status
* @property Transaction $transaction
*
* @package Stripe\Issuing
*/
class Dispute extends \Stripe\ApiResource
{
const OBJECT_NAME = "issuing.dispute";
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Retrieve;
use \Stripe\ApiOperations\Update;
}

View File

@@ -1,35 +0,0 @@
<?php
namespace Stripe\Issuing;
/**
* Class Transaction
*
* @property string $id
* @property string $object
* @property int $amount
* @property string $authorization
* @property string $balance_transaction
* @property string $card
* @property string $cardholder
* @property int $created
* @property string $currency
* @property string $dispute
* @property bool $livemode
* @property mixed $merchant_data
* @property int $merchant_amount
* @property string $merchant_currency
* @property \Stripe\StripeObject $metadata
* @property string $type
*
* @package Stripe\Issuing
*/
class Transaction extends \Stripe\ApiResource
{
const OBJECT_NAME = "issuing.transaction";
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Retrieve;
use \Stripe\ApiOperations\Update;
}

View File

@@ -1,17 +0,0 @@
<?php
namespace Stripe;
/**
* Class LoginLink
*
* @property string $object
* @property int $created
* @property string $url
*
* @package Stripe
*/
class LoginLink extends ApiResource
{
const OBJECT_NAME = "login_link";
}

View File

@@ -1,67 +0,0 @@
<?php
namespace Stripe;
/**
* Class Order
*
* @property string $id
* @property string $object
* @property int $amount
* @property int $amount_returned
* @property string $application
* @property int $application_fee
* @property string $charge
* @property int $created
* @property string $currency
* @property string $customer
* @property string $email
* @property string $external_coupon_code
* @property OrderItem[] $items
* @property bool $livemode
* @property StripeObject $metadata
* @property Collection $returns
* @property string $selected_shipping_method
* @property mixed $shipping
* @property array $shipping_methods
* @property string $status
* @property mixed $status_transitions
* @property int $updated
* @property string $upstream_id
*
* @package Stripe
*/
class Order extends ApiResource
{
const OBJECT_NAME = "order";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Order The paid order.
*/
public function pay($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/pay';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return OrderReturn The newly created return.
*/
public function returnOrder($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/returns';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
return Util\Util::convertToStripeObject($response, $opts);
}
}

View File

@@ -1,26 +0,0 @@
<?php
namespace Stripe;
/**
* Class OrderReturn
*
* @property string $id
* @property string $object
* @property int $amount
* @property int $created
* @property string $currency
* @property OrderItem[] $items
* @property bool $livemode
* @property string $order
* @property string $refund
*
* @package Stripe
*/
class OrderReturn extends ApiResource
{
const OBJECT_NAME = "order_return";
use ApiOperations\All;
use ApiOperations\Retrieve;
}

View File

@@ -1,112 +0,0 @@
<?php
namespace Stripe;
/**
* Class PaymentIntent
*
* @property string $id
* @property string $object
* @property int $amount
* @property int $amount_capturable
* @property int $amount_received
* @property string $application
* @property int $application_fee_amount
* @property int $canceled_at
* @property string $cancellation_reason
* @property string $capture_method
* @property Collection $charges
* @property string $client_secret
* @property string $confirmation_method
* @property int $created
* @property string $currency
* @property string $customer
* @property string $description
* @property mixed $last_payment_error
* @property bool $livemode
* @property StripeObject $metadata
* @property mixed $next_action
* @property string $on_behalf_of
* @property string $payment_method
* @property string[] $payment_method_types
* @property string $receipt_email
* @property string $review
* @property mixed $shipping
* @property string $source
* @property string $statement_descriptor
* @property string $status
* @property mixed $transfer_data
* @property string $transfer_group
*
* @package Stripe
*/
class PaymentIntent extends ApiResource
{
const OBJECT_NAME = "payment_intent";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* These constants are possible representations of the status field.
*
* @link https://stripe.com/docs/api/payment_intents/object#payment_intent_object-status
*/
const STATUS_CANCELED = 'canceled';
const STATUS_PROCESSING = 'processing';
const STATUS_REQUIRES_ACTION = 'requires_action';
const STATUS_REQUIRES_CAPTURE = 'requires_capture';
const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation';
const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method';
const STATUS_SUCCEEDED = 'succeeded';
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return PaymentIntent The canceled payment intent.
*/
public function cancel($params = null, $options = null)
{
$url = $this->instanceUrl() . '/cancel';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return PaymentIntent The captured payment intent.
*/
public function capture($params = null, $options = null)
{
$url = $this->instanceUrl() . '/capture';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return PaymentIntent The confirmed payment intent.
*/
public function confirm($params = null, $options = null)
{
$url = $this->instanceUrl() . '/confirm';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -1,63 +0,0 @@
<?php
namespace Stripe;
/**
* Class PaymentMethod
*
* @property string $id
* @property string $object
* @property mixed $billing_details
* @property mixed $card
* @property mixed $card_present
* @property int $created
* @property string $customer
* @property mixed $ideal
* @property bool $livemode
* @property StripeObject $metadata
* @property mixed $sepa_debit
* @property string $type
*
* @package Stripe
*/
class PaymentMethod extends ApiResource
{
const OBJECT_NAME = "payment_method";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return PaymentMethod The attached payment method.
*/
public function attach($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/attach';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return PaymentMethod The detached payment method.
*/
public function detach($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/detach';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -1,94 +0,0 @@
<?php
namespace Stripe;
/**
* Class Payout
*
* @property string $id
* @property string $object
* @property int $amount
* @property int $arrival_date
* @property bool $automatic
* @property string $balance_transaction
* @property int $created
* @property string $currency
* @property string $description
* @property string $destination
* @property string $failure_balance_transaction
* @property string $failure_code
* @property string $failure_message
* @property bool $livemode
* @property StripeObject $metadata
* @property string $method
* @property string $source_type
* @property string $statement_descriptor
* @property string $status
* @property string $type
*
* @package Stripe
*/
class Payout extends ApiResource
{
const OBJECT_NAME = "payout";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* Types of payout failure codes.
* @link https://stripe.com/docs/api#payout_failures
*/
const FAILURE_ACCOUNT_CLOSED = 'account_closed';
const FAILURE_ACCOUNT_FROZEN = 'account_frozen';
const FAILURE_BANK_ACCOUNT_RESTRICTED = 'bank_account_restricted';
const FAILURE_BANK_OWNERSHIP_CHANGED = 'bank_ownership_changed';
const FAILURE_COULD_NOT_PROCESS = 'could_not_process';
const FAILURE_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized';
const FAILURE_DECLINED = 'declined';
const FAILURE_INCORRECT_ACCOUNT_HOLDER_NAME = 'incorrect_account_holder_name';
const FAILURE_INSUFFICIENT_FUNDS = 'insufficient_funds';
const FAILURE_INVALID_ACCOUNT_NUMBER = 'invalid_account_number';
const FAILURE_INVALID_CURRENCY = 'invalid_currency';
const FAILURE_NO_ACCOUNT = 'no_account';
const FAILURE_UNSUPPORTED_CARD = 'unsupported_card';
/**
* Possible string representations of the payout methods.
* @link https://stripe.com/docs/api/payouts/object#payout_object-method
*/
const METHOD_STANDARD = 'standard';
const METHOD_INSTANT = 'instant';
/**
* Possible string representations of the status of the payout.
* @link https://stripe.com/docs/api/payouts/object#payout_object-status
*/
const STATUS_CANCELED = 'canceled';
const STATUS_IN_TRANSIT = 'in_transit';
const STATUS_FAILED = 'failed';
const STATUS_PAID = 'paid';
const STATUS_PENDING = 'pending';
/**
* Possible string representations of the type of payout.
* @link https://stripe.com/docs/api/payouts/object#payout_object-type
*/
const TYPE_BANK_ACCOUNT = 'bank_account';
const TYPE_CARD = 'card';
/**
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Payout The canceled payout.
*/
public function cancel()
{
$url = $this->instanceUrl() . '/cancel';
list($response, $opts) = $this->_request('post', $url);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -1,109 +0,0 @@
<?php
namespace Stripe;
/**
* Class Person
*
* @package Stripe
*
* @property string $id
* @property string $object
* @property string $account
* @property mixed $address
* @property mixed $address_kana
* @property mixed $address_kanji
* @property int $created
* @property bool $deleted
* @property mixed $dob
* @property string $email
* @property string $first_name
* @property string $first_name_kana
* @property string $first_name_kanji
* @property string $gender
* @property bool $id_number_provided
* @property string $last_name
* @property string $last_name_kana
* @property string $last_name_kanji
* @property string $maiden_name
* @property StripeObject $metadata
* @property string $phone
* @property mixed $relationship
* @property mixed $requirements
* @property bool $ssn_last_4_provided
* @property mixed $verification
*/
class Person extends ApiResource
{
const OBJECT_NAME = "person";
use ApiOperations\Delete;
use ApiOperations\Update;
/**
* Possible string representations of a person's gender.
* @link https://stripe.com/docs/api/persons/object#person_object-gender
*/
const GENDER_MALE = 'male';
const GENDER_FEMALE = 'female';
/**
* Possible string representations of a person's verification status.
* @link https://stripe.com/docs/api/persons/object#person_object-verification-status
*/
const VERIFICATION_STATUS_PENDING = 'pending';
const VERIFICATION_STATUS_UNVERIFIED = 'unverified';
const VERIFICATION_STATUS_VERIFIED = 'verified';
/**
* @return string The API URL for this Stripe account reversal.
*/
public function instanceUrl()
{
$id = $this['id'];
$account = $this['account'];
if (!$id) {
throw new Exception\UnexpectedValueException(
"Could not determine which URL to request: " .
"class instance has invalid ID: $id",
null
);
}
$id = Util\Util::utf8($id);
$account = Util\Util::utf8($account);
$base = Account::classUrl();
$accountExtn = urlencode($account);
$extn = urlencode($id);
return "$base/$accountExtn/persons/$extn";
}
/**
* @param array|string $_id
* @param array|string|null $_opts
*
* @throws \Stripe\Exception\BadMethodCallException
*/
public static function retrieve($_id, $_opts = null)
{
$msg = "Persons cannot be retrieved without an account ID. Retrieve " .
"a person using `Account::retrievePerson('account_id', " .
"'person_id')`.";
throw new Exception\BadMethodCallException($msg, null);
}
/**
* @param string $_id
* @param array|null $_params
* @param array|string|null $_options
*
* @throws \Stripe\Exception\BadMethodCallException
*/
public static function update($_id, $_params = null, $_options = null)
{
$msg = "Persons cannot be updated without an account ID. Update " .
"a person using `Account::updatePerson('account_id', " .
"'person_id', \$updateParams)`.";
throw new Exception\BadMethodCallException($msg, null);
}
}

View File

@@ -1,39 +0,0 @@
<?php
namespace Stripe;
/**
* Class Plan
*
* @package Stripe
*
* @property string $id
* @property string $object
* @property bool $active
* @property string $aggregate_usage
* @property int $amount
* @property string $billing_scheme
* @property int $created
* @property string $currency
* @property string $interval
* @property int $interval_count
* @property bool $livemode
* @property StripeObject $metadata
* @property string $nickname
* @property string $product
* @property mixed $tiers
* @property string $tiers_mode
* @property mixed $transform_usage
* @property int $trial_period_days
* @property string $usage_type
*/
class Plan extends ApiResource
{
const OBJECT_NAME = "plan";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Delete;
use ApiOperations\Retrieve;
use ApiOperations\Update;
}

View File

@@ -1,46 +0,0 @@
<?php
namespace Stripe;
/**
* Class Product
*
* @property string $id
* @property string $object
* @property bool $active
* @property string[] $attributes
* @property string $caption
* @property int $created
* @property string[] $deactivate_on
* @property string $description
* @property string[] $images
* @property bool $livemode
* @property StripeObject $metadata
* @property string $name
* @property mixed $package_dimensions
* @property bool $shippable
* @property string $statement_descriptor
* @property string $type
* @property string $unit_label
* @property int $updated
* @property string $url
*
* @package Stripe
*/
class Product extends ApiResource
{
const OBJECT_NAME = "product";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Delete;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* Possible string representations of the type of product.
* @link https://stripe.com/docs/api/service_products/object#service_product_object-type
*/
const TYPE_GOOD = 'good';
const TYPE_SERVICE = 'service';
}

View File

@@ -1,36 +0,0 @@
<?php
namespace Stripe\Radar;
/**
* Class EarlyFraudWarning
*
* @property string $id
* @property string $object
* @property bool $actionable
* @property string $charge
* @property int $created
* @property string $fraud_type
* @property bool $livemode
*
* @package Stripe\Radar
*/
class EarlyFraudWarning extends \Stripe\ApiResource
{
const OBJECT_NAME = "radar.early_fraud_warning";
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Retrieve;
/**
* Possible string representations of an early fraud warning's fraud type.
* @link https://stripe.com/docs/api/early_fraud_warnings/object#early_fraud_warning_object-fraud_type
*/
const FRAUD_TYPE_CARD_NEVER_RECEIVED = 'card_never_received';
const FRAUD_TYPE_FRAUDULENT_CARD_APPLICATION = 'fraudulent_card_application';
const FRAUD_TYPE_MADE_WITH_COUNTERFEIT_CARD = 'made_with_counterfeit_card';
const FRAUD_TYPE_MADE_WITH_LOST_CARD = 'made_with_lost_card';
const FRAUD_TYPE_MADE_WITH_STOLEN_CARD = 'made_with_stolen_card';
const FRAUD_TYPE_MISC = 'misc';
const FRAUD_TYPE_UNAUTHORIZED_USE_OF_CARD = 'unauthorized_use_of_card';
}

View File

@@ -1,32 +0,0 @@
<?php
namespace Stripe\Radar;
/**
* Class ValueList
*
* @property string $id
* @property string $object
* @property string $alias
* @property int $created
* @property string $created_by
* @property string $item_type
* @property Collection $list_items
* @property bool $livemode
* @property StripeObject $metadata
* @property mixed $name
* @property int $updated
* @property string $updated_by
*
* @package Stripe\Radar
*/
class ValueList extends \Stripe\ApiResource
{
const OBJECT_NAME = "radar.value_list";
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Delete;
use \Stripe\ApiOperations\Retrieve;
use \Stripe\ApiOperations\Update;
}

View File

@@ -1,26 +0,0 @@
<?php
namespace Stripe\Radar;
/**
* Class ValueListItem
*
* @property string $id
* @property string $object
* @property int $created
* @property string $created_by
* @property string $list
* @property bool $livemode
* @property string $value
*
* @package Stripe\Radar
*/
class ValueListItem extends \Stripe\ApiResource
{
const OBJECT_NAME = "radar.value_list_item";
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Delete;
use \Stripe\ApiOperations\Retrieve;
}

View File

@@ -1,34 +0,0 @@
<?php
namespace Stripe;
/**
* Class Recipient
*
* @package Stripe
*
* @property string $id
* @property string $object
* @property mixed $active_account
* @property Collection $cards
* @property int $created
* @property string $default_card
* @property string $description
* @property string $email
* @property bool $livemode
* @property StripeObject $metadata
* @property string $migrated_to
* @property string $name
* @property string $rolled_back_from
* @property string $type
*/
class Recipient extends ApiResource
{
const OBJECT_NAME = "recipient";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Delete;
use ApiOperations\Retrieve;
use ApiOperations\Update;
}

View File

@@ -1,60 +0,0 @@
<?php
namespace Stripe;
/**
* Class Refund
*
* @property string $id
* @property string $object
* @property int $amount
* @property string $balance_transaction
* @property string $charge
* @property int $created
* @property string $currency
* @property string $description
* @property string $failure_balance_transaction
* @property string $failure_reason
* @property StripeObject $metadata
* @property string $reason
* @property string $receipt_number
* @property string $source_transfer_reversal
* @property string $status
* @property string $transfer_reversal
*
* @package Stripe
*/
class Refund extends ApiResource
{
const OBJECT_NAME = "refund";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* Possible string representations of the failure reason.
* @link https://stripe.com/docs/api/refunds/object#refund_object-failure_reason
*/
const FAILURE_REASON = 'expired_or_canceled_card';
const FAILURE_REASON_LOST_OR_STOLEN_CARD = 'lost_or_stolen_card';
const FAILURE_REASON_UNKNOWN = 'unknown';
/**
* Possible string representations of the refund reason.
* @link https://stripe.com/docs/api/refunds/object#refund_object-reason
*/
const REASON_DUPLICATE = 'duplicate';
const REASON_FRAUDULENT = 'fraudulent';
const REASON_REQUESTED_BY_CUSTOMER = 'requested_by_customer';
/**
* Possible string representations of the refund status.
* @link https://stripe.com/docs/api/refunds/object#refund_object-status
*/
const STATUS_CANCELED = 'canceled';
const STATUS_FAILED = 'failed';
const STATUS_PENDING = 'pending';
const STATUS_SUCCEEDED = 'succeeded';
}

View File

@@ -1,28 +0,0 @@
<?php
namespace Stripe\Reporting;
/**
* Class ReportRun
*
* @property string $id
* @property string $object
* @property int $created
* @property string $error
* @property bool $livemode
* @property mixed $parameters
* @property string $report_type
* @property mixed $result
* @property string $status
* @property int $succeeded_at
*
* @package Stripe\Reporting
*/
class ReportRun extends \Stripe\ApiResource
{
const OBJECT_NAME = "reporting.report_run";
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Retrieve;
}

View File

@@ -1,24 +0,0 @@
<?php
namespace Stripe\Reporting;
/**
* Class ReportType
*
* @property string $id
* @property string $object
* @property int $data_available_end
* @property int $data_available_start
* @property string $name
* @property int $updated
* @property string $version
*
* @package Stripe\Reporting
*/
class ReportType extends \Stripe\ApiResource
{
const OBJECT_NAME = "reporting.report_type";
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Retrieve;
}

View File

@@ -1,59 +0,0 @@
<?php
namespace Stripe;
/**
* Class Review
*
* @property string $id
* @property string $object
* @property string $billing_zip
* @property string $charge
* @property string $closed_reason
* @property int $created
* @property string $ip_address
* @property mixed $ip_address_location
* @property bool $livemode
* @property bool $open
* @property string $opened_reason
* @property string $payment_intent
* @property string $reason
* @property mixed $session
*
* @package Stripe
*/
class Review extends ApiResource
{
const OBJECT_NAME = "review";
use ApiOperations\All;
use ApiOperations\Retrieve;
/**
* 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
* determine where these are apply.
* @link https://stripe.com/docs/api/radar/reviews/object
*/
const REASON_APPROVED = 'approved';
const REASON_DISPUTED = 'disputed';
const REASON_MANUAL = 'manual';
const REASON_REFUNDED = 'refunded';
const REASON_REFUNDED_AS_FRAUD = 'refunded_as_fraud';
const REASON_RULE = 'rule';
/**
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Review The approved review.
*/
public function approve($params = null, $options = null)
{
$url = $this->instanceUrl() . '/approve';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -1,34 +0,0 @@
<?php
namespace Stripe;
/**
* Class SKU
*
* @property string $id
* @property string $object
* @property bool $active
* @property mixed $attributes
* @property int $created
* @property string $currency
* @property string $image
* @property mixed $inventory
* @property bool $livemode
* @property StripeObject $metadata
* @property mixed $package_dimensions
* @property int $price
* @property string $product
* @property int $updated
*
* @package Stripe
*/
class SKU extends ApiResource
{
const OBJECT_NAME = "sku";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Delete;
use ApiOperations\Retrieve;
use ApiOperations\Update;
}

View File

@@ -1,78 +0,0 @@
<?php
namespace Stripe;
/**
* Class SetupIntent
*
* @property string $id
* @property string $object
* @property string $application
* @property string $client_secret
* @property int $created
* @property string $customer
* @property string $description
* @property mixed $last_setup_error
* @property bool $livemode
* @property StripeObject $metadata
* @property mixed $next_action
* @property string $on_behalf_of
* @property string $payment_method
* @property string[] $payment_method_types
* @property string $status
*
* @package Stripe
*/
class SetupIntent extends ApiResource
{
const OBJECT_NAME = "setup_intent";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* These constants are possible representations of the status field.
*
* @link https://stripe.com/docs/api/setup_intents/object#setup_intent_object-status
*/
const STATUS_CANCELED = 'canceled';
const STATUS_PROCESSING = 'processing';
const STATUS_REQUIRES_ACTION = 'requires_action';
const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation';
const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method';
const STATUS_SUCCEEDED = 'succeeded';
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return SetupIntent The canceled setup intent.
*/
public function cancel($params = null, $options = null)
{
$url = $this->instanceUrl() . '/cancel';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return SetupIntent The confirmed setup intent.
*/
public function confirm($params = null, $options = null)
{
$url = $this->instanceUrl() . '/confirm';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -1,33 +0,0 @@
<?php
namespace Stripe\Sigma;
/**
* Class Authorization
*
* @property string $id
* @property string $object
* @property int $created
* @property int $data_load_time
* @property string $error
* @property \Stripe\File $file
* @property bool $livemode
* @property int $result_available_until
* @property string $sql
* @property string $status
* @property string $title
*
* @package Stripe\Sigma
*/
class ScheduledQueryRun extends \Stripe\ApiResource
{
const OBJECT_NAME = "scheduled_query_run";
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Retrieve;
public static function classUrl()
{
return "/v1/sigma/scheduled_query_runs";
}
}

View File

@@ -1,147 +0,0 @@
<?php
namespace Stripe;
/**
* Class Source
*
* @property string $id
* @property string $object
* @property mixed $ach_credit_transfer
* @property mixed $ach_debit
* @property mixed $alipay
* @property int $amount
* @property mixed $bancontact
* @property mixed $card
* @property mixed $card_present
* @property string $client_secret
* @property mixed $code_verification
* @property int $created
* @property string $currency
* @property string $customer
* @property mixed $eps
* @property string $flow
* @property mixed $giropay
* @property mixed $ideal
* @property bool $livemode
* @property StripeObject $metadata
* @property mixed $multibanco
* @property mixed $owner
* @property mixed $p24
* @property mixed $receiver
* @property mixed $redirect
* @property mixed $sepa_debit
* @property mixed $sofort
* @property string $statement_descriptor
* @property string $status
* @property mixed $three_d_secure
* @property string $type
* @property string $usage
* @property mixed $wechat
* @package Stripe
*/
class Source extends ApiResource
{
const OBJECT_NAME = "source";
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* Possible string representations of source flows.
* @link https://stripe.com/docs/api#source_object-flow
*/
const FLOW_REDIRECT = 'redirect';
const FLOW_RECEIVER = 'receiver';
const FLOW_CODE_VERIFICATION = 'code_verification';
const FLOW_NONE = 'none';
/**
* Possible string representations of source statuses.
* @link https://stripe.com/docs/api#source_object-status
*/
const STATUS_CANCELED = 'canceled';
const STATUS_CHARGEABLE = 'chargeable';
const STATUS_CONSUMED = 'consumed';
const STATUS_FAILED = 'failed';
const STATUS_PENDING = 'pending';
/**
* Possible string representations of source usage.
* @link https://stripe.com/docs/api#source_object-usage
*/
const USAGE_REUSABLE = 'reusable';
const USAGE_SINGLE_USE = 'single_use';
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\UnexpectedValueException if the source is not attached to a customer
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Source The detached source.
*/
public function detach($params = null, $options = null)
{
self::_validateParams($params);
$id = $this['id'];
if (!$id) {
$class = get_class($this);
$msg = "Could not determine which URL to request: $class instance "
. "has invalid ID: $id";
throw new Exception\UnexpectedValueException($msg, null);
}
if ($this['customer']) {
$base = Customer::classUrl();
$parentExtn = urlencode(Util\Util::utf8($this['customer']));
$extn = urlencode(Util\Util::utf8($id));
$url = "$base/$parentExtn/sources/$extn";
list($response, $opts) = $this->_request('delete', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
} else {
$message = "This source object does not appear to be currently attached "
. "to a customer object.";
throw new Exception\UnexpectedValueException($message);
}
}
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Collection The list of source transactions.
*/
public function sourceTransactions($params = null, $options = null)
{
$url = $this->instanceUrl() . '/source_transactions';
list($response, $opts) = $this->_request('get', $url, $params, $options);
$obj = Util\Util::convertToStripeObject($response, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Source The verified source.
*/
public function verify($params = null, $options = null)
{
$url = $this->instanceUrl() . '/verify';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -1,103 +0,0 @@
<?php
namespace Stripe;
/**
* Class Subscription
*
* @property string $id
* @property string $object
* @property float $application_fee_percent
* @property string $billing
* @property int $billing_cycle_anchor
* @property mixed $billing_thresholds
* @property bool $cancel_at_period_end
* @property int $canceled_at
* @property string $collection_method
* @property int $created
* @property int $current_period_end
* @property int $current_period_start
* @property string $customer
* @property int $days_until_due
* @property string $default_payment_method
* @property string $default_source
* @property array $default_tax_rates
* @property Discount $discount
* @property int $ended_at
* @property Collection $items
* @property string $latest_invoice
* @property boolean $livemode
* @property StripeObject $metadata
* @property string $pending_setup_intent
* @property Plan $plan
* @property int $quantity
* @property SubscriptionSchedule $schedule
* @property int $start
* @property int $start_date
* @property string $status
* @property float $tax_percent
* @property int $trial_end
* @property int $trial_start
*
* @package Stripe
*/
class Subscription extends ApiResource
{
const OBJECT_NAME = "subscription";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Delete {
delete as protected _delete;
}
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* These constants are possible representations of the status field.
*
* @link https://stripe.com/docs/api#subscription_object-status
*/
const STATUS_ACTIVE = 'active';
const STATUS_CANCELED = 'canceled';
const STATUS_PAST_DUE = 'past_due';
const STATUS_TRIALING = 'trialing';
const STATUS_UNPAID = 'unpaid';
const STATUS_INCOMPLETE = 'incomplete';
const STATUS_INCOMPLETE_EXPIRED = 'incomplete_expired';
public static function getSavedNestedResources()
{
static $savedNestedResources = null;
if ($savedNestedResources === null) {
$savedNestedResources = new Util\Set([
'source',
]);
}
return $savedNestedResources;
}
/**
* @param array|null $params
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Subscription The deleted subscription.
*/
public function cancel($params = null, $opts = null)
{
return $this->_delete($params, $opts);
}
/**
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Subscription The updated subscription.
*/
public function deleteDiscount()
{
$url = $this->instanceUrl() . '/discount';
list($response, $opts) = $this->_request('delete', $url);
$this->refreshFrom(['discount' => null], $opts, true);
}
}

View File

@@ -1,63 +0,0 @@
<?php
namespace Stripe;
/**
* Class SubscriptionItem
*
* @property string $id
* @property string $object
* @property mixed $billing_thresholds
* @property int $created
* @property StripeObject $metadata
* @property Plan $plan
* @property int $quantity
* @property string $subscription
* @property array $tax_rates
*
* @package Stripe
*/
class SubscriptionItem extends ApiResource
{
const OBJECT_NAME = "subscription_item";
const PATH_USAGE_RECORDS = '/usage_records';
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Delete;
use ApiOperations\NestedResource;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* @param string|null $id The ID of the subscription item on which to create the usage record.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return ApiResource
*/
public static function createUsageRecord($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_USAGE_RECORDS, $params, $opts);
}
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Collection The list of usage record summaries.
*/
public function usageRecordSummaries($params = null, $options = null)
{
$url = $this->instanceUrl() . '/usage_record_summaries';
list($response, $opts) = $this->_request('get', $url, $params, $options);
$obj = Util\Util::convertToStripeObject($response, $opts);
$obj->setLastResponse($response);
return $obj;
}
}

View File

@@ -1,72 +0,0 @@
<?php
namespace Stripe;
/**
* Class SubscriptionSchedule
*
* @property string $id
* @property string $object
* @property string $billing
* @property mixed $billing_thresholds
* @property int $canceled_at
* @property int $completed_at
* @property int $created
* @property mixed $current_phase
* @property string $customer
* @property mixed $invoice_settings
* @property boolean $livemode
* @property StripeObject $metadata
* @property mixed $phases
* @property int $released_at
* @property string $released_subscription
* @property string $renewal_behavior
* @property mixed $renewal_interval
* @property string $revision
* @property string $status
* @property string $subscription
*
* @package Stripe
*/
class SubscriptionSchedule extends ApiResource
{
const OBJECT_NAME = "subscription_schedule";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
use ApiOperations\NestedResource;
/**
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return SubscriptionSchedule The canceled subscription schedule.
*/
public function cancel($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/cancel';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return SubscriptionSchedule The released subscription schedule.
*/
public function release($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/release';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -1,80 +0,0 @@
<?php
namespace Stripe;
/**
* Class TaxId
*
* @package Stripe
*
* @property string $id
* @property string $object
* @property string $country
* @property int $created
* @property string $customer
* @property bool $livemode
* @property string $type
* @property string $value
* @property mixed $verification
*/
class TaxId extends ApiResource
{
const OBJECT_NAME = "tax_id";
use ApiOperations\Delete;
/**
* Possible string representations of a tax id's type.
* @link https://stripe.com/docs/api/customer_tax_ids/object#tax_id_object-type
*/
const TYPE_AU_ABN = 'au_abn';
const TYPE_EU_VAT = 'eu_vat';
const TYPE_IN_GST = 'in_gst';
const TYPE_NO_VAT = 'no_vat';
const TYPE_NZ_GST = 'nz_gst';
const TYPE_UNKNOWN = 'unknown';
/**
* Possible string representations of the verification status.
* @link https://stripe.com/docs/api/customer_tax_ids/object#tax_id_object-verification
*/
const VERIFICATION_STATUS_PENDING = 'pending';
const VERIFICATION_STATUS_UNAVAILABLE = 'unavailable';
const VERIFICATION_STATUS_UNVERIFIED = 'unverified';
const VERIFICATION_STATUS_VERIFIED = 'verified';
/**
* @return string The API URL for this tax id.
*/
public function instanceUrl()
{
$id = $this['id'];
$customer = $this['customer'];
if (!$id) {
throw new Exception\UnexpectedValueException(
"Could not determine which URL to request: class instance has invalid ID: $id"
);
}
$id = Util\Util::utf8($id);
$customer = Util\Util::utf8($customer);
$base = Customer::classUrl();
$customerExtn = urlencode($customer);
$extn = urlencode($id);
return "$base/$customerExtn/tax_ids/$extn";
}
/**
* @param array|string $_id
* @param array|string|null $_opts
*
* @throws \Stripe\Exception\BadMethodCallException
*/
public static function retrieve($_id, $_opts = null)
{
$msg = "Tax IDs cannot be retrieved without a customer ID. Retrieve " .
"a tax ID using `Customer::retrieveTaxId('customer_id', " .
"'tax_id_id')`.";
throw new Exception\BadMethodCallException($msg);
}
}

View File

@@ -1,30 +0,0 @@
<?php
namespace Stripe;
/**
* Class TaxRate
*
* @property string $id
* @property string $object
* @property bool $active
* @property int $created
* @property string $description
* @property string $display_name
* @property bool $inclusive
* @property string $jurisdiction
* @property bool $livemode
* @property StripeObject $metadata
* @property float $percentage
*
* @package Stripe
*/
class TaxRate extends ApiResource
{
const OBJECT_NAME = "tax_rate";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
}

View File

@@ -1,17 +0,0 @@
<?php
namespace Stripe\Terminal;
/**
* Class ConnectionToken
*
* @property string $secret
*
* @package Stripe\Terminal
*/
class ConnectionToken extends \Stripe\ApiResource
{
const OBJECT_NAME = "terminal.connection_token";
use \Stripe\ApiOperations\Create;
}

View File

@@ -1,25 +0,0 @@
<?php
namespace Stripe\Terminal;
/**
* Class Location
*
* @property string $id
* @property string $object
* @property mixed $address
* @property bool $deleted
* @property string $display_name
*
* @package Stripe\Terminal
*/
class Location extends \Stripe\ApiResource
{
const OBJECT_NAME = "terminal.location";
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Delete;
use \Stripe\ApiOperations\Retrieve;
use \Stripe\ApiOperations\Update;
}

View File

@@ -1,30 +0,0 @@
<?php
namespace Stripe\Terminal;
/**
* Class Reader
*
* @property string $id
* @property string $object
* @property bool $deleted
* @property string $device_sw_version
* @property string $device_type
* @property string $ip_address
* @property string $label
* @property string $location
* @property string $serial_number
* @property string $status
*
* @package Stripe\Terminal
*/
class Reader extends \Stripe\ApiResource
{
const OBJECT_NAME = "terminal.reader";
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Delete;
use \Stripe\ApiOperations\Retrieve;
use \Stripe\ApiOperations\Update;
}

View File

@@ -1,19 +0,0 @@
<?php
namespace Stripe;
class ThreeDSecure extends ApiResource
{
const OBJECT_NAME = "three_d_secure";
use ApiOperations\Create;
use ApiOperations\Retrieve;
/**
* @return string The endpoint URL for the given class.
*/
public static function classUrl()
{
return "/v1/3d_secure";
}
}

View File

@@ -1,35 +0,0 @@
<?php
namespace Stripe;
/**
* Class Token
*
* @property string $id
* @property string $object
* @property BankAccount $bank_account
* @property Card $card
* @property string $client_ip
* @property int $created
* @property bool $livemode
* @property string $type
* @property bool $used
*
* @package Stripe
*/
class Token extends ApiResource
{
const OBJECT_NAME = "token";
use ApiOperations\Create;
use ApiOperations\Retrieve;
/**
* Possible string representations of the token type.
* @link https://stripe.com/docs/api/tokens/object#token_object-type
*/
const TYPE_ACCOUNT = 'account';
const TYPE_BANK_ACCOUNT = 'bank_account';
const TYPE_CARD = 'card';
const TYPE_PII = 'pii';
}

View File

@@ -1,61 +0,0 @@
<?php
namespace Stripe;
/**
* Class Topup
*
* @property string $id
* @property string $object
* @property int $amount
* @property string $balance_transaction
* @property int $created
* @property string $currency
* @property string $description
* @property int $expected_availability_date
* @property string $failure_code
* @property string $failure_message
* @property bool $livemode
* @property StripeObject $metadata
* @property mixed $source
* @property string $statement_descriptor
* @property string $status
* @property string $transfer_group
*
* @package Stripe
*/
class Topup extends ApiResource
{
const OBJECT_NAME = "topup";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
/**
* Possible string representations of the status of the top-up.
* @link https://stripe.com/docs/api/topups/object#topup_object-status
*/
const STATUS_CANCELED = 'canceled';
const STATUS_FAILED = 'failed';
const STATUS_PENDING = 'pending';
const STATUS_REVERSED = 'reversed';
const STATUS_SUCCEEDED = 'succeeded';
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Topup The canceled topup.
*/
public function cancel($params = null, $options = null)
{
$url = $this->instanceUrl() . '/cancel';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -1,117 +0,0 @@
<?php
namespace Stripe;
/**
* Class Transfer
*
* @property string $id
* @property string $object
* @property int $amount
* @property int $amount_reversed
* @property string $balance_transaction
* @property int $created
* @property string $currency
* @property string $description
* @property string $destination
* @property string $destination_payment
* @property bool $livemode
* @property StripeObject $metadata
* @property Collection $reversals
* @property bool $reversed
* @property string $source_transaction
* @property string $source_type
* @property string $transfer_group
*
* @package Stripe
*/
class Transfer extends ApiResource
{
const OBJECT_NAME = "transfer";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\NestedResource;
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
*/
const SOURCE_TYPE_ALIPAY_ACCOUNT = 'alipay_account';
const SOURCE_TYPE_BANK_ACCOUNT = 'bank_account';
const SOURCE_TYPE_CARD = 'card';
const SOURCE_TYPE_FINANCING = 'financing';
/**
* @return Transfer The canceled transfer.
*/
public function cancel()
{
$url = $this->instanceUrl() . '/cancel';
list($response, $opts) = $this->_request('post', $url);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param string|null $id The ID of the transfer on which to create the reversal.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return TransferReversal
*/
public static function createReversal($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_REVERSALS, $params, $opts);
}
/**
* @param string|null $id The ID of the transfer to which the reversal belongs.
* @param array|null $reversalId The ID of the reversal to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return TransferReversal
*/
public static function retrieveReversal($id, $reversalId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_REVERSALS, $reversalId, $params, $opts);
}
/**
* @param string|null $id The ID of the transfer to which the reversal belongs.
* @param array|null $reversalId The ID of the reversal to update.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return TransferReversal
*/
public static function updateReversal($id, $reversalId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_REVERSALS, $reversalId, $params, $opts);
}
/**
* @param string|null $id The ID of the transfer on which to retrieve the reversals.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Collection The list of reversals.
*/
public static function allReversals($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_REVERSALS, $params, $opts);
}
}

View File

@@ -1,63 +0,0 @@
<?php
namespace Stripe;
/**
* Class TransferReversal
*
* @property string $id
* @property string $object
* @property int $amount
* @property string $balance_transaction
* @property int $created
* @property string $currency
* @property string $destination_payment_refund
* @property StripeObject $metadata
* @property string $source_refund
* @property string $transfer
*
* @package Stripe
*/
class TransferReversal extends ApiResource
{
const OBJECT_NAME = "transfer_reversal";
use ApiOperations\Update {
save as protected _save;
}
/**
* @return string The API URL for this Stripe transfer reversal.
*/
public function instanceUrl()
{
$id = $this['id'];
$transfer = $this['transfer'];
if (!$id) {
throw new Exception\UnexpectedValueException(
"Could not determine which URL to request: " .
"class instance has invalid ID: $id",
null
);
}
$id = Util\Util::utf8($id);
$transfer = Util\Util::utf8($transfer);
$base = Transfer::classUrl();
$transferExtn = urlencode($transfer);
$extn = urlencode($id);
return "$base/$transferExtn/reversals/$extn";
}
/**
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return TransferReversal The saved reversal.
*/
public function save($opts = null)
{
return $this->_save($opts);
}
}

View File

@@ -1,20 +0,0 @@
<?php
namespace Stripe;
/**
* Class UsageRecord
*
* @package Stripe
*
* @property string $id
* @property string $object
* @property bool $livemode
* @property int $quantity
* @property string $subscription_item
* @property int $timestamp
*/
class UsageRecord extends ApiResource
{
const OBJECT_NAME = "usage_record";
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Stripe;
/**
* Class UsageRecord
*
* @package Stripe
*
* @property string $id
* @property string $object
* @property string $invoice
* @property bool $livemode
* @property mixed $period
* @property string $subscription_item
* @property int $total_usage
*/
class UsageRecordSummary extends ApiResource
{
const OBJECT_NAME = "usage_record_summary";
}

View File

@@ -1,108 +0,0 @@
<?php
namespace Stripe\Util;
use Stripe\Exception;
class RequestOptions
{
/**
* @var array A list of headers that should be persisted across requests.
*/
public static $HEADERS_TO_PERSIST = [
'Stripe-Account',
'Stripe-Version',
];
public $headers;
public $apiKey;
public $apiBase;
public function __construct($key = null, $headers = [], $base = null)
{
$this->apiKey = $key;
$this->headers = $headers;
$this->apiBase = $base;
}
/**
* Unpacks an options array and merges it into the existing RequestOptions
* object.
* @param array|string|null $options a key => value array
*
* @return RequestOptions
*/
public function merge($options)
{
$other_options = self::parse($options);
if ($other_options->apiKey === null) {
$other_options->apiKey = $this->apiKey;
}
if ($other_options->apiBase === null) {
$other_options->apiBase = $this->apiBase;
}
$other_options->headers = array_merge($this->headers, $other_options->headers);
return $other_options;
}
/**
* Discards all headers that we don't want to persist across requests.
*/
public function discardNonPersistentHeaders()
{
foreach ($this->headers as $k => $v) {
if (!in_array($k, self::$HEADERS_TO_PERSIST)) {
unset($this->headers[$k]);
}
}
}
/**
* Unpacks an options array into an RequestOptions object
* @param array|string|null $options a key => value array
*
* @return RequestOptions
*/
public static function parse($options)
{
if ($options instanceof self) {
return $options;
}
if (is_null($options)) {
return new RequestOptions(null, [], null);
}
if (is_string($options)) {
return new RequestOptions($options, [], null);
}
if (is_array($options)) {
$headers = [];
$key = null;
$base = null;
if (array_key_exists('api_key', $options)) {
$key = $options['api_key'];
}
if (array_key_exists('idempotency_key', $options)) {
$headers['Idempotency-Key'] = $options['idempotency_key'];
}
if (array_key_exists('stripe_account', $options)) {
$headers['Stripe-Account'] = $options['stripe_account'];
}
if (array_key_exists('stripe_version', $options)) {
$headers['Stripe-Version'] = $options['stripe_version'];
}
if (array_key_exists('api_base', $options)) {
$base = $options['api_base'];
}
return new RequestOptions($key, $headers, $base);
}
$message = 'The second argument to Stripe API method calls is an '
. 'optional per-request apiKey, which must be a string, or '
. 'per-request options, which must be an array. (HINT: you can set '
. 'a global apiKey by "Stripe::setApiKey(<apiKey>)")';
throw new Exception\InvalidArgumentException($message);
}
}

View File

@@ -1,334 +0,0 @@
<?php
namespace Stripe\Util;
use Stripe\StripeObject;
abstract class Util
{
private static $isMbstringAvailable = null;
private static $isHashEqualsAvailable = null;
/**
* Whether the provided array (or other) is a list rather than a dictionary.
* A list is defined as an array for which all the keys are consecutive
* integers starting at 0. Empty arrays are considered to be lists.
*
* @param array|mixed $array
* @return boolean true if the given object is a list.
*/
public static function isList($array)
{
if (!is_array($array)) {
return false;
}
if ($array === []) {
return true;
}
if (array_keys($array) !== range(0, count($array) - 1)) {
return false;
}
return true;
}
/**
* Converts a response from the Stripe API to the corresponding PHP object.
*
* @param array $resp The response from the Stripe API.
* @param array $opts
* @return StripeObject|array
*/
public static function convertToStripeObject($resp, $opts)
{
$types = [
// data structures
\Stripe\Collection::OBJECT_NAME => \Stripe\Collection::class,
// business objects
\Stripe\Account::OBJECT_NAME => \Stripe\Account::class,
\Stripe\AccountLink::OBJECT_NAME => \Stripe\AccountLink::class,
\Stripe\AlipayAccount::OBJECT_NAME => \Stripe\AlipayAccount::class,
\Stripe\ApplePayDomain::OBJECT_NAME => \Stripe\ApplePayDomain::class,
\Stripe\ApplicationFee::OBJECT_NAME => \Stripe\ApplicationFee::class,
\Stripe\ApplicationFeeRefund::OBJECT_NAME => \Stripe\ApplicationFeeRefund::class,
\Stripe\Balance::OBJECT_NAME => \Stripe\Balance::class,
\Stripe\BalanceTransaction::OBJECT_NAME => \Stripe\BalanceTransaction::class,
\Stripe\BankAccount::OBJECT_NAME => \Stripe\BankAccount::class,
\Stripe\BitcoinReceiver::OBJECT_NAME => \Stripe\BitcoinReceiver::class,
\Stripe\BitcoinTransaction::OBJECT_NAME => \Stripe\BitcoinTransaction::class,
\Stripe\Capability::OBJECT_NAME => \Stripe\Capability::class,
\Stripe\Card::OBJECT_NAME => \Stripe\Card::class,
\Stripe\Charge::OBJECT_NAME => \Stripe\Charge::class,
\Stripe\Checkout\Session::OBJECT_NAME => \Stripe\Checkout\Session::class,
\Stripe\CountrySpec::OBJECT_NAME => \Stripe\CountrySpec::class,
\Stripe\Coupon::OBJECT_NAME => \Stripe\Coupon::class,
\Stripe\CreditNote::OBJECT_NAME => \Stripe\CreditNote::class,
\Stripe\Customer::OBJECT_NAME => \Stripe\Customer::class,
\Stripe\CustomerBalanceTransaction::OBJECT_NAME => \Stripe\CustomerBalanceTransaction::class,
\Stripe\Discount::OBJECT_NAME => \Stripe\Discount::class,
\Stripe\Dispute::OBJECT_NAME => \Stripe\Dispute::class,
\Stripe\EphemeralKey::OBJECT_NAME => \Stripe\EphemeralKey::class,
\Stripe\Event::OBJECT_NAME => \Stripe\Event::class,
\Stripe\ExchangeRate::OBJECT_NAME => \Stripe\ExchangeRate::class,
\Stripe\File::OBJECT_NAME => \Stripe\File::class,
\Stripe\File::OBJECT_NAME_ALT => \Stripe\File::class,
\Stripe\FileLink::OBJECT_NAME => \Stripe\FileLink::class,
\Stripe\Invoice::OBJECT_NAME => \Stripe\Invoice::class,
\Stripe\InvoiceItem::OBJECT_NAME => \Stripe\InvoiceItem::class,
\Stripe\InvoiceLineItem::OBJECT_NAME => \Stripe\InvoiceLineItem::class,
\Stripe\Issuing\Authorization::OBJECT_NAME => \Stripe\Issuing\Authorization::class,
\Stripe\Issuing\Card::OBJECT_NAME => \Stripe\Issuing\Card::class,
\Stripe\Issuing\CardDetails::OBJECT_NAME => \Stripe\Issuing\CardDetails::class,
\Stripe\Issuing\Cardholder::OBJECT_NAME => \Stripe\Issuing\Cardholder::class,
\Stripe\Issuing\Dispute::OBJECT_NAME => \Stripe\Issuing\Dispute::class,
\Stripe\Issuing\Transaction::OBJECT_NAME => \Stripe\Issuing\Transaction::class,
\Stripe\LoginLink::OBJECT_NAME => \Stripe\LoginLink::class,
\Stripe\Order::OBJECT_NAME => \Stripe\Order::class,
\Stripe\OrderItem::OBJECT_NAME => \Stripe\OrderItem::class,
\Stripe\OrderReturn::OBJECT_NAME => \Stripe\OrderReturn::class,
\Stripe\PaymentIntent::OBJECT_NAME => \Stripe\PaymentIntent::class,
\Stripe\PaymentMethod::OBJECT_NAME => \Stripe\PaymentMethod::class,
\Stripe\Payout::OBJECT_NAME => \Stripe\Payout::class,
\Stripe\Person::OBJECT_NAME => \Stripe\Person::class,
\Stripe\Plan::OBJECT_NAME => \Stripe\Plan::class,
\Stripe\Product::OBJECT_NAME => \Stripe\Product::class,
\Stripe\Radar\EarlyFraudWarning::OBJECT_NAME => \Stripe\Radar\EarlyFraudWarning::class,
\Stripe\Radar\ValueList::OBJECT_NAME => \Stripe\Radar\ValueList::class,
\Stripe\Radar\ValueListItem::OBJECT_NAME => \Stripe\Radar\ValueListItem::class,
\Stripe\Recipient::OBJECT_NAME => \Stripe\Recipient::class,
\Stripe\RecipientTransfer::OBJECT_NAME => \Stripe\RecipientTransfer::class,
\Stripe\Refund::OBJECT_NAME => \Stripe\Refund::class,
\Stripe\Reporting\ReportRun::OBJECT_NAME => \Stripe\Reporting\ReportRun::class,
\Stripe\Reporting\ReportType::OBJECT_NAME => \Stripe\Reporting\ReportType::class,
\Stripe\Review::OBJECT_NAME => \Stripe\Review::class,
\Stripe\SetupIntent::OBJECT_NAME => \Stripe\SetupIntent::class,
\Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => \Stripe\Sigma\ScheduledQueryRun::class,
\Stripe\SKU::OBJECT_NAME => \Stripe\SKU::class,
\Stripe\Source::OBJECT_NAME => \Stripe\Source::class,
\Stripe\SourceTransaction::OBJECT_NAME => \Stripe\SourceTransaction::class,
\Stripe\Subscription::OBJECT_NAME => \Stripe\Subscription::class,
\Stripe\SubscriptionItem::OBJECT_NAME => \Stripe\SubscriptionItem::class,
\Stripe\SubscriptionSchedule::OBJECT_NAME => \Stripe\SubscriptionSchedule::class,
\Stripe\TaxId::OBJECT_NAME => \Stripe\TaxId::class,
\Stripe\TaxRate::OBJECT_NAME => \Stripe\TaxRate::class,
\Stripe\ThreeDSecure::OBJECT_NAME => \Stripe\ThreeDSecure::class,
\Stripe\Terminal\ConnectionToken::OBJECT_NAME => \Stripe\Terminal\ConnectionToken::class,
\Stripe\Terminal\Location::OBJECT_NAME => \Stripe\Terminal\Location::class,
\Stripe\Terminal\Reader::OBJECT_NAME => \Stripe\Terminal\Reader::class,
\Stripe\Token::OBJECT_NAME => \Stripe\Token::class,
\Stripe\Topup::OBJECT_NAME => \Stripe\Topup::class,
\Stripe\Transfer::OBJECT_NAME => \Stripe\Transfer::class,
\Stripe\TransferReversal::OBJECT_NAME => \Stripe\TransferReversal::class,
\Stripe\UsageRecord::OBJECT_NAME => \Stripe\UsageRecord::class,
\Stripe\UsageRecordSummary::OBJECT_NAME => \Stripe\UsageRecordSummary::class,
\Stripe\WebhookEndpoint::OBJECT_NAME => \Stripe\WebhookEndpoint::class,
];
if (self::isList($resp)) {
$mapped = [];
foreach ($resp as $i) {
array_push($mapped, self::convertToStripeObject($i, $opts));
}
return $mapped;
} elseif (is_array($resp)) {
if (isset($resp['object']) && is_string($resp['object']) && isset($types[$resp['object']])) {
$class = $types[$resp['object']];
} else {
$class = \Stripe\StripeObject::class;
}
return $class::constructFrom($resp, $opts);
} else {
return $resp;
}
}
/**
* @param string|mixed $value A string to UTF8-encode.
*
* @return string|mixed The UTF8-encoded string, or the object passed in if
* it wasn't a string.
*/
public static function utf8($value)
{
if (self::$isMbstringAvailable === null) {
self::$isMbstringAvailable = function_exists('mb_detect_encoding');
if (!self::$isMbstringAvailable) {
trigger_error("It looks like the mbstring extension is not enabled. " .
"UTF-8 strings will not properly be encoded. Ask your system " .
"administrator to enable the mbstring extension, or write to " .
"support@stripe.com if you have any questions.", E_USER_WARNING);
}
}
if (is_string($value) && self::$isMbstringAvailable && mb_detect_encoding($value, "UTF-8", true) != "UTF-8") {
return utf8_encode($value);
} else {
return $value;
}
}
/**
* Compares two strings for equality. The time taken is independent of the
* number of characters that match.
*
* @param string $a one of the strings to compare.
* @param string $b the other string to compare.
* @return bool true if the strings are equal, false otherwise.
*/
public static function secureCompare($a, $b)
{
if (self::$isHashEqualsAvailable === null) {
self::$isHashEqualsAvailable = function_exists('hash_equals');
}
if (self::$isHashEqualsAvailable) {
return hash_equals($a, $b);
} else {
if (strlen($a) != strlen($b)) {
return false;
}
$result = 0;
for ($i = 0; $i < strlen($a); $i++) {
$result |= ord($a[$i]) ^ ord($b[$i]);
}
return ($result == 0);
}
}
/**
* Recursively goes through an array of parameters. If a parameter is an instance of
* ApiResource, then it is replaced by the resource's ID.
* Also clears out null values.
*
* @param mixed $h
* @return mixed
*/
public static function objectsToIds($h)
{
if ($h instanceof \Stripe\ApiResource) {
return $h->id;
} elseif (static::isList($h)) {
$results = [];
foreach ($h as $v) {
array_push($results, static::objectsToIds($v));
}
return $results;
} elseif (is_array($h)) {
$results = [];
foreach ($h as $k => $v) {
if (is_null($v)) {
continue;
}
$results[$k] = static::objectsToIds($v);
}
return $results;
} else {
return $h;
}
}
/**
* @param array $params
*
* @return string
*/
public static function encodeParameters($params)
{
$flattenedParams = self::flattenParams($params);
$pieces = [];
foreach ($flattenedParams as $param) {
list($k, $v) = $param;
array_push($pieces, self::urlEncode($k) . '=' . self::urlEncode($v));
}
return implode('&', $pieces);
}
/**
* @param array $params
* @param string|null $parentKey
*
* @return array
*/
public static function flattenParams($params, $parentKey = null)
{
$result = [];
foreach ($params as $key => $value) {
$calculatedKey = $parentKey ? "{$parentKey}[{$key}]" : $key;
if (self::isList($value)) {
$result = array_merge($result, self::flattenParamsList($value, $calculatedKey));
} elseif (is_array($value)) {
$result = array_merge($result, self::flattenParams($value, $calculatedKey));
} else {
array_push($result, [$calculatedKey, $value]);
}
}
return $result;
}
/**
* @param array $value
* @param string $calculatedKey
*
* @return array
*/
public static function flattenParamsList($value, $calculatedKey)
{
$result = [];
foreach ($value as $i => $elem) {
if (self::isList($elem)) {
$result = array_merge($result, self::flattenParamsList($elem, $calculatedKey));
} elseif (is_array($elem)) {
$result = array_merge($result, self::flattenParams($elem, "{$calculatedKey}[{$i}]"));
} else {
array_push($result, ["{$calculatedKey}[{$i}]", $elem]);
}
}
return $result;
}
/**
* @param string $key A string to URL-encode.
*
* @return string The URL-encoded string.
*/
public static function urlEncode($key)
{
$s = urlencode($key);
// Don't use strict form encoding by changing the square bracket control
// characters back to their literals. This is fine by the server, and
// makes these parameter strings easier to read.
$s = str_replace('%5B', '[', $s);
$s = str_replace('%5D', ']', $s);
return $s;
}
public static function normalizeId($id)
{
if (is_array($id)) {
$params = $id;
$id = $params['id'];
unset($params['id']);
} else {
$params = [];
}
return [$id, $params];
}
/**
* Returns UNIX timestamp in milliseconds
*
* @return integer current time in millis
*/
public static function currentTimeMillis()
{
return (int) round(microtime(true) * 1000);
}
}

View File

@@ -1,28 +0,0 @@
<?php
namespace Stripe;
/**
* Class WebhookEndpoint
*
* @property string $id
* @property string $object
* @property int $created
* @property string[] $enabled_events
* @property bool $livemode
* @property string $secret
* @property string $status
* @property string $url
*
* @package Stripe
*/
class WebhookEndpoint extends ApiResource
{
const OBJECT_NAME = "webhook_endpoint";
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Delete;
use ApiOperations\Retrieve;
use ApiOperations\Update;
}

View File

@@ -1,19 +0,0 @@
#!/usr/bin/env php
<?php
chdir(dirname(__FILE__));
set_time_limit(0); // unlimited max execution time
$fp = fopen(dirname(__FILE__) . '/data/ca-certificates.crt', 'w+');
$options = array(
CURLOPT_FILE => $fp,
CURLOPT_TIMEOUT => 3600,
CURLOPT_URL => 'https://curl.haxx.se/ca/cacert.pem',
);
$ch = curl_init();
curl_setopt_array($ch, $options);
curl_exec($ch);
curl_close($ch);
fclose($fp);

View File

@@ -0,0 +1,3 @@
service_name: github-actions
coverage_clover: clover.xml
json_path: coveralls-upload.json

View File

@@ -12,3 +12,9 @@ charset = utf-8
[*.{json,yml}]
indent_size = 2
[*.neon]
indent_style = tab
[Makefile]
indent_style = tab

View File

@@ -1,3 +1,6 @@
# Ignore build files
build/*
# Mac OS X dumps these all over the place.
.DS_Store
@@ -16,5 +19,13 @@ clover.xml
# Ignore IDE's configuration files
.idea
# Ignore PHP CS Fixer cache
# Ignore PHP CS Fixer local config and cache
.php_cs
.php_cs.cache
# Ignore PHPStan local config
.phpstan.neon
# Ignore phpDocumentor's local config and artifacts
.phpdoc/*
phpdoc.xml

45
vendor/stripe-php-7.72.0/.php_cs.dist vendored Normal file
View File

@@ -0,0 +1,45 @@
<?php
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
// Rulesets
'@PSR2' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'@PHP56Migration:risky' => true,
'@PHPUnit57Migration:risky' => true,
// Additional rules
'fopen_flags' => true,
'linebreak_after_opening_tag' => true,
'native_constant_invocation' => true,
'native_function_invocation' => true,
// --- Diffs from @PhpCsFixer / @PhpCsFixer:risky ---
// This is the same as the default for the @PhpCsFixer ruleset, minus
// the following values: ['include', 'include_once', 'require',
// 'require_once']. We could enable them and remove this line after
// updating codegen for the `init.php` file to be compliant.
'blank_line_before_statement' => ['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'return', 'switch', 'throw', 'try']],
// This is just prettier / easier to read.
'concat_space' => ['spacing' => 'one'],
// This causes strange ordering with codegen'd classes. We might be
// able to enable this if we update codegen to output class elements
// in the correct order.
'ordered_class_elements' => false,
// Keep this disabled to avoid unnecessary diffs in PHPDoc comments of
// codegen'd classes.
'phpdoc_align' => false,
// This is a "risky" rule that causes a bug in our codebase.
// Specifically, in `StripeObject.updateAttributes` we construct new
// `StripeObject`s for metadata. We can't use `self` there because it
// needs to be a raw `StripeObject`.
'self_accessor' => false,
])
;

1338
vendor/stripe-php-7.72.0/CHANGELOG.md vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at conduct@stripe.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

36
vendor/stripe-php-7.72.0/Makefile vendored Normal file
View File

@@ -0,0 +1,36 @@
export PHPDOCUMENTOR_VERSION := v3.0.0
export PHPSTAN_VERSION := 0.12.59
vendor: composer.json
composer install
vendor/bin/phpstan: vendor
curl -sfL https://github.com/phpstan/phpstan/releases/download/$(PHPSTAN_VERSION)/phpstan.phar -o vendor/bin/phpstan
chmod +x vendor/bin/phpstan
vendor/bin/phpdoc: vendor
curl -sfL https://github.com/phpDocumentor/phpDocumentor/releases/download/$(PHPDOCUMENTOR_VERSION)/phpDocumentor.phar -o vendor/bin/phpdoc
chmod +x vendor/bin/phpdoc
test: vendor
vendor/bin/phpunit
.PHONY: test
fmt: vendor
vendor/bin/php-cs-fixer fix -v --using-cache=no .
.PHONY: fmt
fmtcheck: vendor
vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no .
.PHONY: fmtcheck
phpdoc: vendor/bin/phpdoc
vendor/bin/phpdoc
phpstan: vendor/bin/phpstan
php -d memory_limit=512M vendor/bin/phpstan analyse lib tests
.PHONY: phpstan
phpstan-baseline: vendor/bin/phpstan
php -d memory_limit=512M vendor/bin/phpstan analyse lib tests --generate-baseline
.PHONY: phpstan-baseline

View File

@@ -42,9 +42,9 @@ require_once('/path/to/stripe-php/init.php');
The bindings require the following extensions in order to work properly:
- [`curl`](https://secure.php.net/manual/en/book.curl.php), although you can use your own non-cURL client if you prefer
- [`json`](https://secure.php.net/manual/en/book.json.php)
- [`mbstring`](https://secure.php.net/manual/en/book.mbstring.php) (Multibyte String)
- [`curl`](https://secure.php.net/manual/en/book.curl.php), although you can use your own non-cURL client if you prefer
- [`json`](https://secure.php.net/manual/en/book.json.php)
- [`mbstring`](https://secure.php.net/manual/en/book.mbstring.php) (Multibyte String)
If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.
@@ -53,40 +53,39 @@ If you use Composer, these dependencies should be handled automatically. If you
Simple usage looks like:
```php
\Stripe\Stripe::setApiKey('sk_test_BQokikJOvBiI2HlWgH4olfQ2');
$charge = \Stripe\Charge::create(['amount' => 2000, 'currency' => 'usd', 'source' => 'tok_189fqt2eZvKYlo2CTGBeg6Uq']);
echo $charge;
$stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2');
$customer = $stripe->customers->create([
'description' => 'example customer',
'email' => 'email@example.com',
'payment_method' => 'pm_card_visa',
]);
echo $customer;
```
### Client/service patterns vs legacy patterns
You can continue to use the legacy integration patterns used prior to version [7.33.0](https://github.com/stripe/stripe-php/blob/master/CHANGELOG.md#7330---2020-05-14). Review the [migration guide](https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0) for the backwards-compatible client/services pattern changes.
## Documentation
See the [PHP API docs](https://stripe.com/docs/api/php#intro).
See [video demonstrations][youtube-playlist] covering how to use the library.
## Legacy Version Support
### PHP 5.4 & 5.5
If you are using PHP 5.4 or 5.5, you can download v6.21.1 ([zip](https://github.com/stripe/stripe-php/archive/v6.21.1.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
If you are using PHP 5.4 or 5.5, you can download v6.21.1 ([zip](https://github.com/stripe/stripe-php/archive/v6.21.1.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v6.21.1.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
### PHP 5.3
If you are using PHP 5.3, you can download v5.9.2 ([zip](https://github.com/stripe/stripe-php/archive/v5.9.2.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
### PHP 5.2
If you are using PHP 5.2, you can download v1.18.0 ([zip](https://github.com/stripe/stripe-php/archive/v1.18.0.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v1.18.0.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
This legacy version may be included via `require_once("/path/to/stripe-php/lib/Stripe.php");`, and used like:
```php
Stripe::setApiKey('d8e8fca2dc0f896fd7cb4cb0031ba249');
$charge = Stripe_Charge::create(array('source' => 'tok_XXXXXXXX', 'amount' => 2000, 'currency' => 'usd'));
echo $charge;
```
## Custom Request Timeouts
*NOTE:* We do not recommend decreasing the timeout for non-read-only calls (e.g. charge creation), since even if you locally timeout, the request on Stripe's side can still complete. If you are decreasing timeouts on these calls, make sure to use [idempotency tokens](https://stripe.com/docs/api/php#idempotent_requests) to avoid executing the same transaction twice as a result of timeout retry logic.
_NOTE:_ We do not recommend decreasing the timeout for non-read-only calls (e.g. charge creation), since even if you locally timeout, the request on Stripe's side can still complete. If you are decreasing timeouts on these calls, make sure to use [idempotency tokens](https://stripe.com/docs/api/php#idempotent_requests) to avoid executing the same transaction twice as a result of timeout retry logic.
To modify request timeouts (connect or total, in seconds) you'll need to tell the API client to use a CurlClient other than its default. You'll set the timeouts in that CurlClient.
@@ -133,8 +132,10 @@ end up there instead of `error_log`:
You can access the data from the last API response on any object via `getLastResponse()`.
```php
$charge = \Stripe\Charge::create(['amount' => 2000, 'currency' => 'usd', 'source' => 'tok_visa']);
echo $charge->getLastResponse()->headers['Request-Id'];
$customer = $stripe->customers->create([
'description' => 'example customer',
]);
echo $customer->getLastResponse()->headers['Request-Id'];
```
### SSL / TLS compatibility issues
@@ -155,12 +156,12 @@ one that uses [Stripe Connect][connect], it's also possible to set a
per-request key and/or account:
```php
\Stripe\Charge::all([], [
$customers = $stripe->customers->all([],[
'api_key' => 'sk_test_...',
'stripe_account' => 'acct_...'
]);
\Stripe\Charge::retrieve("ch_18atAXCdGbJFKhCuBAa4532Z", [
$stripe->customers->retrieve('cus_123456789', [], [
'api_key' => 'sk_test_...',
'stripe_account' => 'acct_...'
]);
@@ -266,3 +267,4 @@ See the "SSL / TLS compatibility issues" paragraph above for full context. If yo
[php-cs-fixer]: https://github.com/FriendsOfPHP/PHP-CS-Fixer
[psr3]: http://www.php-fig.org/psr/psr-3/
[stripe-mock]: https://github.com/stripe/stripe-mock
[youtube-playlist]: https://www.youtube.com/playlist?list=PLy1nL-pvL2M6cUbiHrfMkXxZ9j9SGBxFE

1
vendor/stripe-php-7.72.0/VERSION vendored Normal file
View File

@@ -0,0 +1 @@
7.72.0

25
vendor/stripe-php-7.72.0/build.php vendored Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env php
<?php
\chdir(__DIR__);
$autoload = (int) $argv[1];
$returnStatus = null;
if (!$autoload) {
// Modify composer to not autoload Stripe
$composer = \json_decode(\file_get_contents('composer.json'), true);
unset($composer['autoload'], $composer['autoload-dev']);
\file_put_contents('composer.json', \json_encode($composer, \JSON_PRETTY_PRINT));
}
\passthru('composer update', $returnStatus);
if (0 !== $returnStatus) {
exit(1);
}
$config = $autoload ? 'phpunit.xml' : 'phpunit.no_autoload.xml';
\passthru("./vendor/bin/phpunit -c {$config}", $returnStatus);
if (0 !== $returnStatus) {
exit(1);
}

View File

@@ -25,10 +25,20 @@
"php-coveralls/php-coveralls": "^2.1",
"squizlabs/php_codesniffer": "^3.3",
"symfony/process": "~3.4",
"friendsofphp/php-cs-fixer": "^2.15"
"friendsofphp/php-cs-fixer": "2.17.1"
},
"autoload": {
"psr-4": { "Stripe\\" : "lib/" }
"psr-4": {
"Stripe\\": "lib/"
}
},
"autoload-dev": {
"psr-4": {
"Stripe\\": [
"tests/",
"tests/Stripe/"
]
}
},
"extra": {
"branch-alias": {

238
vendor/stripe-php-7.72.0/init.php vendored Normal file
View File

@@ -0,0 +1,238 @@
<?php
// File generated from our OpenAPI spec
// Stripe singleton
require __DIR__ . '/lib/Stripe.php';
// Utilities
require __DIR__ . '/lib/Util/CaseInsensitiveArray.php';
require __DIR__ . '/lib/Util/LoggerInterface.php';
require __DIR__ . '/lib/Util/DefaultLogger.php';
require __DIR__ . '/lib/Util/RandomGenerator.php';
require __DIR__ . '/lib/Util/RequestOptions.php';
require __DIR__ . '/lib/Util/Set.php';
require __DIR__ . '/lib/Util/Util.php';
require __DIR__ . '/lib/Util/ObjectTypes.php';
// HttpClient
require __DIR__ . '/lib/HttpClient/ClientInterface.php';
require __DIR__ . '/lib/HttpClient/CurlClient.php';
// Exceptions
require __DIR__ . '/lib/Exception/ExceptionInterface.php';
require __DIR__ . '/lib/Exception/ApiErrorException.php';
require __DIR__ . '/lib/Exception/ApiConnectionException.php';
require __DIR__ . '/lib/Exception/AuthenticationException.php';
require __DIR__ . '/lib/Exception/BadMethodCallException.php';
require __DIR__ . '/lib/Exception/CardException.php';
require __DIR__ . '/lib/Exception/IdempotencyException.php';
require __DIR__ . '/lib/Exception/InvalidArgumentException.php';
require __DIR__ . '/lib/Exception/InvalidRequestException.php';
require __DIR__ . '/lib/Exception/PermissionException.php';
require __DIR__ . '/lib/Exception/RateLimitException.php';
require __DIR__ . '/lib/Exception/SignatureVerificationException.php';
require __DIR__ . '/lib/Exception/UnexpectedValueException.php';
require __DIR__ . '/lib/Exception/UnknownApiErrorException.php';
// OAuth exceptions
require __DIR__ . '/lib/Exception/OAuth/ExceptionInterface.php';
require __DIR__ . '/lib/Exception/OAuth/OAuthErrorException.php';
require __DIR__ . '/lib/Exception/OAuth/InvalidClientException.php';
require __DIR__ . '/lib/Exception/OAuth/InvalidGrantException.php';
require __DIR__ . '/lib/Exception/OAuth/InvalidRequestException.php';
require __DIR__ . '/lib/Exception/OAuth/InvalidScopeException.php';
require __DIR__ . '/lib/Exception/OAuth/UnknownOAuthErrorException.php';
require __DIR__ . '/lib/Exception/OAuth/UnsupportedGrantTypeException.php';
require __DIR__ . '/lib/Exception/OAuth/UnsupportedResponseTypeException.php';
// API operations
require __DIR__ . '/lib/ApiOperations/All.php';
require __DIR__ . '/lib/ApiOperations/Create.php';
require __DIR__ . '/lib/ApiOperations/Delete.php';
require __DIR__ . '/lib/ApiOperations/NestedResource.php';
require __DIR__ . '/lib/ApiOperations/Request.php';
require __DIR__ . '/lib/ApiOperations/Retrieve.php';
require __DIR__ . '/lib/ApiOperations/Update.php';
// Plumbing
require __DIR__ . '/lib/ApiResponse.php';
require __DIR__ . '/lib/RequestTelemetry.php';
require __DIR__ . '/lib/StripeObject.php';
require __DIR__ . '/lib/ApiRequestor.php';
require __DIR__ . '/lib/ApiResource.php';
require __DIR__ . '/lib/SingletonApiResource.php';
require __DIR__ . '/lib/Service/AbstractService.php';
require __DIR__ . '/lib/Service/AbstractServiceFactory.php';
// StripeClient
require __DIR__ . '/lib/StripeClientInterface.php';
require __DIR__ . '/lib/BaseStripeClient.php';
require __DIR__ . '/lib/StripeClient.php';
// Stripe API Resources
require __DIR__ . '/lib/Account.php';
require __DIR__ . '/lib/AccountLink.php';
require __DIR__ . '/lib/AlipayAccount.php';
require __DIR__ . '/lib/ApplePayDomain.php';
require __DIR__ . '/lib/ApplicationFee.php';
require __DIR__ . '/lib/ApplicationFeeRefund.php';
require __DIR__ . '/lib/Balance.php';
require __DIR__ . '/lib/BalanceTransaction.php';
require __DIR__ . '/lib/BankAccount.php';
require __DIR__ . '/lib/BillingPortal/Session.php';
require __DIR__ . '/lib/BitcoinReceiver.php';
require __DIR__ . '/lib/BitcoinTransaction.php';
require __DIR__ . '/lib/Capability.php';
require __DIR__ . '/lib/Card.php';
require __DIR__ . '/lib/Charge.php';
require __DIR__ . '/lib/Checkout/Session.php';
require __DIR__ . '/lib/Collection.php';
require __DIR__ . '/lib/CountrySpec.php';
require __DIR__ . '/lib/Coupon.php';
require __DIR__ . '/lib/CreditNote.php';
require __DIR__ . '/lib/CreditNoteLineItem.php';
require __DIR__ . '/lib/Customer.php';
require __DIR__ . '/lib/CustomerBalanceTransaction.php';
require __DIR__ . '/lib/Discount.php';
require __DIR__ . '/lib/Dispute.php';
require __DIR__ . '/lib/EphemeralKey.php';
require __DIR__ . '/lib/ErrorObject.php';
require __DIR__ . '/lib/Event.php';
require __DIR__ . '/lib/ExchangeRate.php';
require __DIR__ . '/lib/File.php';
require __DIR__ . '/lib/FileLink.php';
require __DIR__ . '/lib/Invoice.php';
require __DIR__ . '/lib/InvoiceItem.php';
require __DIR__ . '/lib/InvoiceLineItem.php';
require __DIR__ . '/lib/Issuing/Authorization.php';
require __DIR__ . '/lib/Issuing/Card.php';
require __DIR__ . '/lib/Issuing/CardDetails.php';
require __DIR__ . '/lib/Issuing/Cardholder.php';
require __DIR__ . '/lib/Issuing/Dispute.php';
require __DIR__ . '/lib/Issuing/Transaction.php';
require __DIR__ . '/lib/LineItem.php';
require __DIR__ . '/lib/LoginLink.php';
require __DIR__ . '/lib/Mandate.php';
require __DIR__ . '/lib/Order.php';
require __DIR__ . '/lib/OrderItem.php';
require __DIR__ . '/lib/OrderReturn.php';
require __DIR__ . '/lib/PaymentIntent.php';
require __DIR__ . '/lib/PaymentMethod.php';
require __DIR__ . '/lib/Payout.php';
require __DIR__ . '/lib/Person.php';
require __DIR__ . '/lib/Plan.php';
require __DIR__ . '/lib/Price.php';
require __DIR__ . '/lib/Product.php';
require __DIR__ . '/lib/PromotionCode.php';
require __DIR__ . '/lib/Radar/EarlyFraudWarning.php';
require __DIR__ . '/lib/Radar/ValueList.php';
require __DIR__ . '/lib/Radar/ValueListItem.php';
require __DIR__ . '/lib/Recipient.php';
require __DIR__ . '/lib/RecipientTransfer.php';
require __DIR__ . '/lib/Refund.php';
require __DIR__ . '/lib/Reporting/ReportRun.php';
require __DIR__ . '/lib/Reporting/ReportType.php';
require __DIR__ . '/lib/Review.php';
require __DIR__ . '/lib/SetupAttempt.php';
require __DIR__ . '/lib/SetupIntent.php';
require __DIR__ . '/lib/Sigma/ScheduledQueryRun.php';
require __DIR__ . '/lib/SKU.php';
require __DIR__ . '/lib/Source.php';
require __DIR__ . '/lib/SourceTransaction.php';
require __DIR__ . '/lib/Subscription.php';
require __DIR__ . '/lib/SubscriptionItem.php';
require __DIR__ . '/lib/SubscriptionSchedule.php';
require __DIR__ . '/lib/TaxId.php';
require __DIR__ . '/lib/TaxRate.php';
require __DIR__ . '/lib/Terminal/ConnectionToken.php';
require __DIR__ . '/lib/Terminal/Location.php';
require __DIR__ . '/lib/Terminal/Reader.php';
require __DIR__ . '/lib/ThreeDSecure.php';
require __DIR__ . '/lib/Token.php';
require __DIR__ . '/lib/Topup.php';
require __DIR__ . '/lib/Transfer.php';
require __DIR__ . '/lib/TransferReversal.php';
require __DIR__ . '/lib/UsageRecord.php';
require __DIR__ . '/lib/UsageRecordSummary.php';
require __DIR__ . '/lib/WebhookEndpoint.php';
// Services
require __DIR__ . '/lib/Service/AccountService.php';
require __DIR__ . '/lib/Service/AccountLinkService.php';
require __DIR__ . '/lib/Service/ApplePayDomainService.php';
require __DIR__ . '/lib/Service/ApplicationFeeService.php';
require __DIR__ . '/lib/Service/BalanceService.php';
require __DIR__ . '/lib/Service/BalanceTransactionService.php';
require __DIR__ . '/lib/Service/BillingPortal/SessionService.php';
require __DIR__ . '/lib/Service/ChargeService.php';
require __DIR__ . '/lib/Service/Checkout/SessionService.php';
require __DIR__ . '/lib/Service/CountrySpecService.php';
require __DIR__ . '/lib/Service/CouponService.php';
require __DIR__ . '/lib/Service/CreditNoteService.php';
require __DIR__ . '/lib/Service/CustomerService.php';
require __DIR__ . '/lib/Service/DisputeService.php';
require __DIR__ . '/lib/Service/EphemeralKeyService.php';
require __DIR__ . '/lib/Service/EventService.php';
require __DIR__ . '/lib/Service/ExchangeRateService.php';
require __DIR__ . '/lib/Service/FileService.php';
require __DIR__ . '/lib/Service/FileLinkService.php';
require __DIR__ . '/lib/Service/InvoiceService.php';
require __DIR__ . '/lib/Service/InvoiceItemService.php';
require __DIR__ . '/lib/Service/Issuing/AuthorizationService.php';
require __DIR__ . '/lib/Service/Issuing/CardService.php';
require __DIR__ . '/lib/Service/Issuing/CardholderService.php';
require __DIR__ . '/lib/Service/Issuing/DisputeService.php';
require __DIR__ . '/lib/Service/Issuing/TransactionService.php';
require __DIR__ . '/lib/Service/MandateService.php';
require __DIR__ . '/lib/Service/OrderService.php';
require __DIR__ . '/lib/Service/OrderReturnService.php';
require __DIR__ . '/lib/Service/PaymentIntentService.php';
require __DIR__ . '/lib/Service/PaymentMethodService.php';
require __DIR__ . '/lib/Service/PayoutService.php';
require __DIR__ . '/lib/Service/PlanService.php';
require __DIR__ . '/lib/Service/PriceService.php';
require __DIR__ . '/lib/Service/ProductService.php';
require __DIR__ . '/lib/Service/PromotionCodeService.php';
require __DIR__ . '/lib/Service/Radar/EarlyFraudWarningService.php';
require __DIR__ . '/lib/Service/Radar/ValueListService.php';
require __DIR__ . '/lib/Service/Radar/ValueListItemService.php';
require __DIR__ . '/lib/Service/RefundService.php';
require __DIR__ . '/lib/Service/Reporting/ReportRunService.php';
require __DIR__ . '/lib/Service/Reporting/ReportTypeService.php';
require __DIR__ . '/lib/Service/ReviewService.php';
require __DIR__ . '/lib/Service/SetupAttemptService.php';
require __DIR__ . '/lib/Service/SetupIntentService.php';
require __DIR__ . '/lib/Service/Sigma/ScheduledQueryRunService.php';
require __DIR__ . '/lib/Service/SkuService.php';
require __DIR__ . '/lib/Service/SourceService.php';
require __DIR__ . '/lib/Service/SubscriptionService.php';
require __DIR__ . '/lib/Service/SubscriptionItemService.php';
require __DIR__ . '/lib/Service/SubscriptionScheduleService.php';
require __DIR__ . '/lib/Service/TaxRateService.php';
require __DIR__ . '/lib/Service/Terminal/ConnectionTokenService.php';
require __DIR__ . '/lib/Service/Terminal/LocationService.php';
require __DIR__ . '/lib/Service/Terminal/ReaderService.php';
require __DIR__ . '/lib/Service/TokenService.php';
require __DIR__ . '/lib/Service/TopupService.php';
require __DIR__ . '/lib/Service/TransferService.php';
require __DIR__ . '/lib/Service/WebhookEndpointService.php';
// Service factories
require __DIR__ . '/lib/Service/CoreServiceFactory.php';
require __DIR__ . '/lib/Service/BillingPortal/BillingPortalServiceFactory.php';
require __DIR__ . '/lib/Service/Checkout/CheckoutServiceFactory.php';
require __DIR__ . '/lib/Service/Issuing/IssuingServiceFactory.php';
require __DIR__ . '/lib/Service/Radar/RadarServiceFactory.php';
require __DIR__ . '/lib/Service/Reporting/ReportingServiceFactory.php';
require __DIR__ . '/lib/Service/Sigma/SigmaServiceFactory.php';
require __DIR__ . '/lib/Service/Terminal/TerminalServiceFactory.php';
// OAuth
require __DIR__ . '/lib/OAuth.php';
require __DIR__ . '/lib/OAuthErrorObject.php';
require __DIR__ . '/lib/Service/OAuthService.php';
// Webhooks
require __DIR__ . '/lib/Webhook.php';
require __DIR__ . '/lib/WebhookSignature.php';

View File

@@ -1,378 +1,91 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe;
/**
* Class Account
* This is an object representing a Stripe account. You can retrieve it to see
* properties on the account like its current e-mail address or if the account is
* enabled yet to make live charges.
*
* @property string $id
* @property string $object
* @property mixed $business_profile
* @property string $business_type
* @property mixed $capabilities
* @property bool $charges_enabled
* @property mixed $company
* @property string $country
* @property int $created
* @property string $default_currency
* @property bool $details_submitted
* @property string $email
* @property Collection $external_accounts
* @property mixed $individual
* @property StripeObject $metadata
* @property bool $payouts_enabled
* @property mixed $requirements
* @property mixed $settings
* @property mixed $tos_acceptance
* @property string $type
* Some properties, marked below, are available only to platforms that want to <a
* href="https://stripe.com/docs/connect/accounts">create and manage Express or
* Custom accounts</a>.
*
* @package Stripe
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|\Stripe\StripeObject $business_profile Business information about the account.
* @property null|string $business_type The business type.
* @property \Stripe\StripeObject $capabilities
* @property bool $charges_enabled Whether the account can create live charges.
* @property \Stripe\StripeObject $company
* @property string $country The account's country.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $default_currency Three-letter ISO currency code representing the default currency for the account. This must be a currency that <a href="https://stripe.com/docs/payouts">Stripe supports in the account's country</a>.
* @property bool $details_submitted Whether account details have been submitted. Standard accounts cannot receive payouts before this is true.
* @property null|string $email The primary user's email address.
* @property \Stripe\Collection $external_accounts External accounts (bank accounts and debit cards) currently attached to this account
* @property \Stripe\Person $individual <p>This is an object representing a person associated with a Stripe account.</p><p>A platform cannot access a Standard or Express account's persons after the account starts onboarding, such as after generating an account link for the account. See the <a href="https://stripe.com/docs/connect/standard-accounts">Standard onboarding</a> or <a href="https://stripe.com/docs/connect/express-accounts">Express onboarding documentation</a> for information about platform pre-filling and account onboarding steps.</p><p>Related guide: <a href="https://stripe.com/docs/connect/identity-verification-api#person-information">Handling Identity Verification with the API</a>.</p>
* @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property bool $payouts_enabled Whether Stripe can send payouts to this account.
* @property \Stripe\StripeObject $requirements
* @property null|\Stripe\StripeObject $settings Options for customizing how the account functions within Stripe.
* @property \Stripe\StripeObject $tos_acceptance
* @property string $type The Stripe account type. Can be <code>standard</code>, <code>express</code>, or <code>custom</code>.
*/
class Account extends ApiResource
{
const OBJECT_NAME = "account";
const OBJECT_NAME = 'account';
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Delete;
use ApiOperations\NestedResource;
use ApiOperations\Update;
const BUSINESS_TYPE_COMPANY = 'company';
const BUSINESS_TYPE_GOVERNMENT_ENTITY = 'government_entity';
const BUSINESS_TYPE_INDIVIDUAL = 'individual';
const BUSINESS_TYPE_NON_PROFIT = 'non_profit';
const CAPABILITY_CARD_PAYMENTS = 'card_payments';
const CAPABILITY_LEGACY_PAYMENTS = 'legacy_payments';
const CAPABILITY_PLATFORM_PAYMENTS = 'platform_payments';
const CAPABILITY_TRANSFERS = 'transfers';
const CAPABILITY_STATUS_ACTIVE = 'active';
const CAPABILITY_STATUS_INACTIVE = 'inactive';
const CAPABILITY_STATUS_PENDING = 'pending';
const TYPE_CUSTOM = 'custom';
const TYPE_EXPRESS = 'express';
const TYPE_STANDARD = 'standard';
use ApiOperations\Retrieve {
retrieve as protected _retrieve;
}
use ApiOperations\Update;
/**
* Possible string representations of an account's business type.
* @link https://stripe.com/docs/api/accounts/object#account_object-business_type
*/
const BUSINESS_TYPE_COMPANY = 'company';
const BUSINESS_TYPE_INDIVIDUAL = 'individual';
/**
* Possible string representations of an account's capabilities.
* @link https://stripe.com/docs/api/accounts/object#account_object-capabilities
*/
const CAPABILITY_CARD_PAYMENTS = 'card_payments';
const CAPABILITY_LEGACY_PAYMENTS = 'legacy_payments';
const CAPABILITY_PLATFORM_PAYMENTS = 'platform_payments';
/**
* Possible string representations of an account's capability status.
* @link https://stripe.com/docs/api/accounts/object#account_object-capabilities
*/
const CAPABILITY_STATUS_ACTIVE = 'active';
const CAPABILITY_STATUS_INACTIVE = 'inactive';
const CAPABILITY_STATUS_PENDING = 'pending';
/**
* Possible string representations of an account's type.
* @link https://stripe.com/docs/api/accounts/object#account_object-type
*/
const TYPE_CUSTOM = 'custom';
const TYPE_EXPRESS = 'express';
const TYPE_STANDARD = 'standard';
public static function getSavedNestedResources()
{
static $savedNestedResources = null;
if ($savedNestedResources === null) {
if (null === $savedNestedResources) {
$savedNestedResources = new Util\Set([
'external_account',
'bank_account',
]);
}
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) {
if (null === $this['id']) {
return '/v1/account';
} else {
return parent::instanceUrl();
}
}
/**
* @param array|string|null $id The ID of the account to retrieve, or an
* options array containing an `id` key.
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Account
*/
public static function retrieve($id = null, $opts = null)
{
if (!$opts && is_string($id) && substr($id, 0, 3) === 'sk_') {
$opts = $id;
$id = 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
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return StripeObject Object containing the response from the API.
*/
public function deauthorize($clientId = null, $opts = null)
{
$params = [
'client_id' => $clientId,
'stripe_user_id' => $this->id,
];
return OAuth::deauthorize($params, $opts);
}
/*
* Capabilities methods
* We can not add the capabilities() method today as the Account object already has a
* capabilities property which is a hash and not the sub-list of capabilities.
*/
/**
* @param string $id The ID of the account to which the capability belongs.
* @param string $capabilityId The ID of the capability to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Capability
*/
public static function retrieveCapability($id, $capabilityId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts);
}
/**
* @param string $id The ID of the account to which the capability belongs.
* @param string $capabilityId The ID of the capability to update.
* @param array|null $params
* @param array|string|null $opts
*
* @return Capability
*/
public static function updateCapability($id, $capabilityId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts);
}
/**
* @param string $id The ID of the account on which to retrieve the capabilities.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Collection The list of capabilities.
*/
public static function allCapabilities($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_CAPABILITIES, $params, $opts);
}
/**
* @param string $id The ID of the account on which to create the external account.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return BankAccount|Card
*/
public static function createExternalAccount($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts);
}
/**
* @param string $id The ID of the account to which the external account belongs.
* @param string $externalAccountId The ID of the external account to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return BankAccount|Card
*/
public static function retrieveExternalAccount($id, $externalAccountId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
}
/**
* @param string $id The ID of the account to which the external account belongs.
* @param string $externalAccountId The ID of the external account to update.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return BankAccount|Card
*/
public static function updateExternalAccount($id, $externalAccountId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
}
/**
* @param string $id The ID of the account to which the external account belongs.
* @param string $externalAccountId The ID of the external account to delete.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return BankAccount|Card
*/
public static function deleteExternalAccount($id, $externalAccountId, $params = null, $opts = null)
{
return self::_deleteNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
}
/**
* @param string $id The ID of the account on which to retrieve the external accounts.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Collection The list of external accounts (BankAccount or Card).
*/
public static function allExternalAccounts($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts);
}
/**
* @param string $id The ID of the account on which to create the login link.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return LoginLink
*/
public static function createLoginLink($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_LOGIN_LINKS, $params, $opts);
}
/**
* @param array|null $params
* @param array|string|null $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Collection The list of persons.
*/
public function persons($params = null, $options = null)
{
$url = $this->instanceUrl() . '/persons';
list($response, $opts) = $this->_request('get', $url, $params, $options);
$obj = Util\Util::convertToStripeObject($response, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* @param string $id The ID of the account on which to create the person.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Person
*/
public static function createPerson($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_PERSONS, $params, $opts);
}
/**
* @param string $id The ID of the account to which the person belongs.
* @param string $personId The ID of the person to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Person
*/
public static function retrievePerson($id, $personId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
}
/**
* @param string $id The ID of the account to which the person belongs.
* @param string $personId The ID of the person to update.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Person
*/
public static function updatePerson($id, $personId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
}
/**
* @param string $id The ID of the account to which the person belongs.
* @param string $personId The ID of the person to delete.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Person
*/
public static function deletePerson($id, $personId, $params = null, $opts = null)
{
return self::_deleteNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
}
/**
* @param string $id The ID of the account on which to retrieve the persons.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return Collection The list of persons.
*/
public static function allPersons($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_PERSONS, $params, $opts);
return parent::instanceUrl();
}
public function serializeParameters($force = false)
@@ -393,6 +106,7 @@ class Account extends ApiResource
$update['individual'] = $individual->serializeParameters($force);
}
}
return $update;
}
@@ -403,9 +117,9 @@ class Account extends ApiResource
} else {
$originalValue = [];
}
if (($originalValue) && (count($originalValue) > count($additionalOwners))) {
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"
'You cannot delete an item from an array, you must instead set a new array'
);
}
@@ -413,14 +127,305 @@ class Account extends ApiResource
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))) {
if ([] !== $update) {
if (!$originalValue
|| !\array_key_exists($i, $originalValue)
|| ($update !== $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) {
$updateArr[$i] = $update;
}
}
}
return $updateArr;
}
/**
* @param null|array|string $id the ID of the account to retrieve, or an
* options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Account
*/
public static function retrieve($id = null, $opts = null)
{
if (!$opts && \is_string($id) && 'sk_' === \substr($id, 0, 3)) {
$opts = $id;
$id = null;
}
return self::_retrieve($id, $opts);
}
/**
* @param null|array $clientId
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\StripeObject object containing the response from the API
*/
public function deauthorize($clientId = null, $opts = null)
{
$params = [
'client_id' => $clientId,
'stripe_user_id' => $this->id,
];
return OAuth::deauthorize($params, $opts);
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of persons
*/
public function persons($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/persons';
list($response, $opts) = $this->_request('get', $url, $params, $opts);
$obj = Util\Util::convertToStripeObject($response, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* @param null|array $params
* @param null|array|string $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
* capabilities property which is a hash and not the sub-list of capabilities.
*/
const PATH_CAPABILITIES = '/capabilities';
/**
* @param string $id the ID of the account on which to retrieve the capabilities
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of capabilities
*/
public static function allCapabilities($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_CAPABILITIES, $params, $opts);
}
/**
* @param string $id the ID of the account to which the capability belongs
* @param string $capabilityId the ID of the capability to retrieve
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Capability
*/
public static function retrieveCapability($id, $capabilityId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts);
}
/**
* @param string $id the ID of the account to which the capability belongs
* @param string $capabilityId the ID of the capability to update
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Capability
*/
public static function updateCapability($id, $capabilityId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts);
}
const PATH_EXTERNAL_ACCOUNTS = '/external_accounts';
/**
* @param string $id the ID of the account on which to retrieve the external accounts
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of external accounts (BankAccount or Card)
*/
public static function allExternalAccounts($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts);
}
/**
* @param string $id the ID of the account on which to create the external account
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\BankAccount|\Stripe\Card
*/
public static function createExternalAccount($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts);
}
/**
* @param string $id the ID of the account to which the external account belongs
* @param string $externalAccountId the ID of the external account to delete
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\BankAccount|\Stripe\Card
*/
public static function deleteExternalAccount($id, $externalAccountId, $params = null, $opts = null)
{
return self::_deleteNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
}
/**
* @param string $id the ID of the account to which the external account belongs
* @param string $externalAccountId the ID of the external account to retrieve
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\BankAccount|\Stripe\Card
*/
public static function retrieveExternalAccount($id, $externalAccountId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
}
/**
* @param string $id the ID of the account to which the external account belongs
* @param string $externalAccountId the ID of the external account to update
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\BankAccount|\Stripe\Card
*/
public static function updateExternalAccount($id, $externalAccountId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
}
const PATH_LOGIN_LINKS = '/login_links';
/**
* @param string $id the ID of the account on which to create the login link
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\LoginLink
*/
public static function createLoginLink($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_LOGIN_LINKS, $params, $opts);
}
const PATH_PERSONS = '/persons';
/**
* @param string $id the ID of the account on which to retrieve the persons
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of persons
*/
public static function allPersons($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_PERSONS, $params, $opts);
}
/**
* @param string $id the ID of the account on which to create the person
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Person
*/
public static function createPerson($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_PERSONS, $params, $opts);
}
/**
* @param string $id the ID of the account to which the person belongs
* @param string $personId the ID of the person to delete
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Person
*/
public static function deletePerson($id, $personId, $params = null, $opts = null)
{
return self::_deleteNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
}
/**
* @param string $id the ID of the account to which the person belongs
* @param string $personId the ID of the person to retrieve
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Person
*/
public static function retrievePerson($id, $personId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
}
/**
* @param string $id the ID of the account to which the person belongs
* @param string $personId the ID of the person to update
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Person
*/
public static function updatePerson($id, $personId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
}
}

View File

@@ -0,0 +1,26 @@
<?php
// File generated from our OpenAPI spec
namespace Stripe;
/**
* Account Links are the means by which a Connect platform grants a connected
* account permission to access Stripe-hosted applications, such as Connect
* Onboarding.
*
* Related guide: <a
* href="https://stripe.com/docs/connect/connect-onboarding">Connect
* Onboarding</a>.
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property int $expires_at The timestamp at which this account link will expire.
* @property string $url The URL for the account link.
*/
class AccountLink extends ApiResource
{
const OBJECT_NAME = 'account_link';
use ApiOperations\Create;
}

View File

@@ -3,16 +3,14 @@
namespace Stripe;
/**
* Class AlipayAccount
*
* @package Stripe
* Class AlipayAccount.
*
* @deprecated Alipay accounts are deprecated. Please use the sources API instead.
* @link https://stripe.com/docs/sources/alipay
* @see https://stripe.com/docs/sources/alipay
*/
class AlipayAccount extends ApiResource
{
const OBJECT_NAME = "alipay_account";
const OBJECT_NAME = 'alipay_account';
use ApiOperations\Delete;
use ApiOperations\Update;
@@ -28,46 +26,50 @@ class AlipayAccount extends ApiResource
$parent = $this['customer'];
$path = 'sources';
} else {
$msg = "Alipay accounts cannot be accessed without a customer ID.";
$msg = 'Alipay accounts cannot be accessed without a customer ID.';
throw new Exception\UnexpectedValueException($msg);
}
$parentExtn = urlencode(Util\Util::utf8($parent));
$extn = urlencode(Util\Util::utf8($this['id']));
return "$base/$parentExtn/$path/$extn";
$parentExtn = \urlencode(Util\Util::utf8($parent));
$extn = \urlencode(Util\Util::utf8($this['id']));
return "{$base}/{$parentExtn}/{$path}/{$extn}";
}
/**
* @param array|string $_id
* @param array|string|null $_opts
* @param null|array|string $_opts
*
* @throws \Stripe\Exception\BadMethodCallException
*
* @deprecated Alipay accounts are deprecated. Please use the sources API instead.
* @link https://stripe.com/docs/sources/alipay
* @see https://stripe.com/docs/sources/alipay
*/
public static function retrieve($_id, $_opts = null)
{
$msg = "Alipay accounts cannot be retrieved without a customer ID. " .
"Retrieve an Alipay account using `Customer::retrieveSource(" .
$msg = 'Alipay accounts cannot be retrieved without a customer ID. ' .
'Retrieve an Alipay account using `Customer::retrieveSource(' .
"'customer_id', 'alipay_account_id')`.";
throw new Exception\BadMethodCallException($msg);
}
/**
* @param string $_id
* @param array|null $_params
* @param array|string|null $_options
* @param null|array $_params
* @param null|array|string $_options
*
* @throws \Stripe\Exception\BadMethodCallException
*
* @deprecated Alipay accounts are deprecated. Please use the sources API instead.
* @link https://stripe.com/docs/sources/alipay
* @see https://stripe.com/docs/sources/alipay
*/
public static function update($_id, $_params = null, $_options = null)
{
$msg = "Alipay accounts cannot be updated without a customer ID. " .
"Update an Alipay account using `Customer::updateSource(" .
$msg = 'Alipay accounts cannot be updated without a customer ID. ' .
'Update an Alipay account using `Customer::updateSource(' .
"'customer_id', 'alipay_account_id', \$updateParams)`.";
throw new Exception\BadMethodCallException($msg);
}
}

View File

@@ -10,8 +10,8 @@ namespace Stripe\ApiOperations;
trait All
{
/**
* @param array|null $params
* @param array|string|null $opts
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
@@ -26,11 +26,12 @@ trait All
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
if (!($obj instanceof \Stripe\Collection)) {
throw new \Stripe\Exception\UnexpectedValueException(
'Expected type ' . \Stripe\Collection::class . ', got "' . get_class($obj) . '" instead.'
'Expected type ' . \Stripe\Collection::class . ', got "' . \get_class($obj) . '" instead.'
);
}
$obj->setLastResponse($response);
$obj->setFilters($params);
return $obj;
}
}

View File

@@ -10,12 +10,12 @@ namespace Stripe\ApiOperations;
trait Create
{
/**
* @param array|null $params
* @param array|string|null $options
* @param null|array $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return static The created resource.
* @return static the created resource
*/
public static function create($params = null, $options = null)
{
@@ -25,6 +25,7 @@ trait Create
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
}

View File

@@ -10,12 +10,12 @@ namespace Stripe\ApiOperations;
trait Delete
{
/**
* @param array|null $params
* @param array|string|null $opts
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return static The deleted resource.
* @return static the deleted resource
*/
public function delete($params = null, $opts = null)
{
@@ -24,6 +24,7 @@ trait Delete
$url = $this->instanceUrl();
list($response, $opts) = $this->_request('delete', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
}

View File

@@ -12,8 +12,8 @@ trait NestedResource
/**
* @param string $method
* @param string $url
* @param array|null $params
* @param array|string|null $options
* @param null|array $params
* @param null|array|string $options
*
* @return \Stripe\StripeObject
*/
@@ -24,30 +24,32 @@ trait NestedResource
list($response, $opts) = static::_staticRequest($method, $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* @param string $id
* @param string $nestedPath
* @param string|null $nestedId
* @param null|string $nestedId
*
* @return string
*/
protected static function _nestedResourceUrl($id, $nestedPath, $nestedId = null)
{
$url = static::resourceUrl($id) . $nestedPath;
if ($nestedId !== null) {
$url .= "/$nestedId";
if (null !== $nestedId) {
$url .= "/{$nestedId}";
}
return $url;
}
/**
* @param string $id
* @param string $nestedPath
* @param array|null $params
* @param array|string|null $options
* @param null|array $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
@@ -56,15 +58,16 @@ trait NestedResource
protected static function _createNestedResource($id, $nestedPath, $params = null, $options = null)
{
$url = static::_nestedResourceUrl($id, $nestedPath);
return self::_nestedResourceOperation('post', $url, $params, $options);
}
/**
* @param string $id
* @param string $nestedPath
* @param string|null $nestedId
* @param array|null $params
* @param array|string|null $options
* @param null|string $nestedId
* @param null|array $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
@@ -73,15 +76,16 @@ trait NestedResource
protected static function _retrieveNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
{
$url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
return self::_nestedResourceOperation('get', $url, $params, $options);
}
/**
* @param string $id
* @param string $nestedPath
* @param string|null $nestedId
* @param array|null $params
* @param array|string|null $options
* @param null|string $nestedId
* @param null|array $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
@@ -90,15 +94,16 @@ trait NestedResource
protected static function _updateNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
{
$url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
return self::_nestedResourceOperation('post', $url, $params, $options);
}
/**
* @param string $id
* @param string $nestedPath
* @param string|null $nestedId
* @param array|null $params
* @param array|string|null $options
* @param null|string $nestedId
* @param null|array $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
@@ -107,14 +112,15 @@ trait NestedResource
protected static function _deleteNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
{
$url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
return self::_nestedResourceOperation('delete', $url, $params, $options);
}
/**
* @param string $id
* @param string $nestedPath
* @param array|null $params
* @param array|string|null $options
* @param null|array $params
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
@@ -123,6 +129,7 @@ trait NestedResource
protected static function _allNestedResources($id, $nestedPath, $params = null, $options = null)
{
$url = static::_nestedResourceUrl($id, $nestedPath);
return self::_nestedResourceOperation('get', $url, $params, $options);
}
}

View File

@@ -10,17 +10,18 @@ namespace Stripe\ApiOperations;
trait Request
{
/**
* @param array|null|mixed $params The list of parameters to validate
* @param null|array|mixed $params The list of parameters to validate
*
* @throws \Stripe\Exception\InvalidArgumentException if $params exists and is not an array
*/
protected static function _validateParams($params = null)
{
if ($params && !is_array($params)) {
$message = "You must pass an array as the first argument to Stripe API "
. "method calls. (HINT: an example call to create a charge "
if ($params && !\is_array($params)) {
$message = 'You must pass an array as the first argument to Stripe API '
. 'method calls. (HINT: an example call to create a charge '
. "would be: \"Stripe\\Charge::create(['amount' => 100, "
. "'currency' => 'usd', 'source' => 'tok_1234'])\")";
throw new \Stripe\Exception\InvalidArgumentException($message);
}
}
@@ -29,7 +30,7 @@ trait Request
* @param string $method HTTP method ('get', 'post', etc.)
* @param string $url URL for the request
* @param array $params list of parameters for the request
* @param array|string|null $options
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
@@ -40,6 +41,7 @@ trait Request
$opts = $this->_opts->merge($options);
list($resp, $options) = static::_staticRequest($method, $url, $params, $opts);
$this->setLastResponse($resp);
return [$resp->json, $options];
}
@@ -47,7 +49,7 @@ trait Request
* @param string $method HTTP method ('get', 'post', etc.)
* @param string $url URL for the request
* @param array $params list of parameters for the request
* @param array|string|null $options
* @param null|array|string $options
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
@@ -60,6 +62,7 @@ trait Request
$requestor = new \Stripe\ApiRequestor($opts->apiKey, $baseUrl);
list($response, $opts->apiKey) = $requestor->request($method, $url, $params, $opts->headers);
$opts->discardNonPersistentHeaders();
return [$response, $opts];
}
}

Some files were not shown because too many files have changed in this diff Show More