Commit 607d3316 authored by mattwire's avatar mattwire

Update stripe-php from 6.19.5 to 6.30.4

parent 1212b577
......@@ -8,16 +8,16 @@
"packages": [
{
"name": "stripe/stripe-php",
"version": "v6.19.5",
"version": "v6.30.4",
"source": {
"type": "git",
"url": "https://github.com/stripe/stripe-php.git",
"reference": "1ab5c54fae4c16e9cc47d60c7454e6c3b6bbcb85"
"reference": "0d9e2773b1df27d4f0c590b15bed3a1433e0414c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/1ab5c54fae4c16e9cc47d60c7454e6c3b6bbcb85",
"reference": "1ab5c54fae4c16e9cc47d60c7454e6c3b6bbcb85",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/0d9e2773b1df27d4f0c590b15bed3a1433e0414c",
"reference": "0d9e2773b1df27d4f0c590b15bed3a1433e0414c",
"shasum": ""
},
"require": {
......@@ -29,7 +29,8 @@
"require-dev": {
"php-coveralls/php-coveralls": "1.*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.0"
"squizlabs/php_codesniffer": "~2.0",
"symfony/process": "~2.8"
},
"type": "library",
"extra": {
......@@ -59,7 +60,7 @@
"payment processing",
"stripe"
],
"time": "2018-10-17T14:58:41+00:00"
"time": "2019-02-27T18:07:30+00:00"
}
],
"packages-dev": [],
......
[
{
"name": "stripe/stripe-php",
"version": "v6.19.5",
"version_normalized": "6.19.5.0",
"version": "v6.30.4",
"version_normalized": "6.30.4.0",
"source": {
"type": "git",
"url": "https://github.com/stripe/stripe-php.git",
"reference": "1ab5c54fae4c16e9cc47d60c7454e6c3b6bbcb85"
"reference": "0d9e2773b1df27d4f0c590b15bed3a1433e0414c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/1ab5c54fae4c16e9cc47d60c7454e6c3b6bbcb85",
"reference": "1ab5c54fae4c16e9cc47d60c7454e6c3b6bbcb85",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/0d9e2773b1df27d4f0c590b15bed3a1433e0414c",
"reference": "0d9e2773b1df27d4f0c590b15bed3a1433e0414c",
"shasum": ""
},
"require": {
......@@ -23,9 +23,10 @@
"require-dev": {
"php-coveralls/php-coveralls": "1.*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.0"
"squizlabs/php_codesniffer": "~2.0",
"symfony/process": "~2.8"
},
"time": "2018-10-17T14:58:41+00:00",
"time": "2019-02-27T18:07:30+00:00",
"type": "library",
"extra": {
"branch-alias": {
......
service_name: travis-ci
coverage_clover: clover.xml
json_path: coveralls-upload.json
Please only file issues here that you believe represent actual bugs or feature requests for the Stripe PHP library.
If you're having general trouble with your Stripe integration, please reach out to support using the form at https://support.stripe.com/ (preferred) or via email to support@stripe.com.
If you are reporting a bug, please include your PHP version and the version of the Stripe PHP library you're using, as well as any other details that may be helpful in reproducing the problem.
sudo: false
language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- hhvm
env:
global:
- STRIPE_MOCK_VERSION=0.33.0
matrix:
- AUTOLOAD=1
- AUTOLOAD=0
cache:
directories:
- $HOME/.composer/cache/files
- stripe-mock
before_install:
# Install various build dependencies. We use `travis_retry` because Composer
# will occasionally fail intermittently.
- travis_retry composer install
# Unpack and start stripe-mock so that the test suite can talk to it
- |
if [ ! -d "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}" ]; then
mkdir -p stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/
curl -L "https://github.com/stripe/stripe-mock/releases/download/v${STRIPE_MOCK_VERSION}/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -o "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz"
tar -zxf "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -C "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/"
fi
- |
stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/stripe-mock > /dev/null &
STRIPE_MOCK_PID=$!
script: ./build.php ${AUTOLOAD}
after_script: ./vendor/bin/coveralls -v
{
"recommendations": [
"felixfbecker.php-intellisense",
"ikappas.phpcs",
"emallin.phpunit"
]
}
{
"editor.renderWhitespace": "all",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"[php]": {
"editor.detectIndentation": false,
"editor.insertSpaces": true,
"editor.rulers": [
100
],
"editor.tabSize": 4,
},
// Linting
"phpcs.enable": true,
"phpcs.standard": "PSR2"
}
# Changelog
## 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.
......
The MIT License
Copyright (c) 2010-2015 Stripe
Copyright (c) 2010-2019 Stripe, Inc. (https://stripe.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
......@@ -23,7 +23,8 @@
"require-dev": {
"phpunit/phpunit": "~4.0",
"php-coveralls/php-coveralls": "1.*",
"squizlabs/php_codesniffer": "~2.0"
"squizlabs/php_codesniffer": "~2.0",
"symfony/process": "~2.8"
},
"autoload": {
"psr-4": { "Stripe\\" : "lib/" }
......
<?php
require('../init.php');
\Stripe\Stripe::setApiKey(getenv('STRIPE_SECRET_KEY'));
\Stripe\Stripe::setClientId(getenv('STRIPE_CLIENT_ID'));
if (isset($_GET['code'])) {
// The user was redirected back from the OAuth form with an authorization code.
$code = $_GET['code'];
try {
$resp = \Stripe\OAuth::token([
'grant_type' => 'authorization_code',
'code' => $code,
]);
} catch (\Stripe\Error\OAuth\OAuthBase $e) {
exit("Error: " . $e->getMessage());
}
$accountId = $resp->stripe_user_id;
echo "<p>Success! Account <code>$accountId</code> is connected.</p>\n";
echo "<p>Click <a href=\"?deauth=$accountId\">here</a> to disconnect the account.</p>\n";
} elseif (isset($_GET['error'])) {
// The user was redirect back from the OAuth form with an error.
$error = $_GET['error'];
$error_description = $_GET['error_description'];
echo "<p>Error: code=" . htmlspecialchars($error, ENT_QUOTES) . ", description=" . htmlspecialchars($error_description, ENT_QUOTES) . "</p>\n";
echo "<p>Click <a href=\"?\">here</a> to restart the OAuth flow.</p>\n";
} elseif (isset($_GET['deauth'])) {
// Deauthorization request
$accountId = $_GET['deauth'];
try {
\Stripe\OAuth::deauthorize([
'stripe_user_id' => $accountId,
]);
} catch (\Stripe\Error\OAuth\OAuthBase $e) {
exit("Error: " . $e->getMessage());
}
echo "<p>Success! Account <code>" . htmlspecialchars($accountId, ENT_QUOTES) . "</code> is disconnected.</p>\n";
echo "<p>Click <a href=\"?\">here</a> to restart the OAuth flow.</p>\n";
} else {
$url = \Stripe\OAuth::authorizeUrl([
'scope' => 'read_only',
]);
echo "<a href=\"$url\">Connect with Stripe</a>\n";
}
......@@ -49,6 +49,7 @@ 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');
......@@ -56,6 +57,7 @@ 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');
......@@ -67,6 +69,7 @@ require(dirname(__FILE__) . '/lib/BitcoinReceiver.php');
require(dirname(__FILE__) . '/lib/BitcoinTransaction.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');
......@@ -95,19 +98,25 @@ require(dirname(__FILE__) . '/lib/OrderItem.php');
require(dirname(__FILE__) . '/lib/OrderReturn.php');
require(dirname(__FILE__) . '/lib/PaymentIntent.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/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/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/SubscriptionScheduleRevision.php');
require(dirname(__FILE__) . '/lib/Terminal/ConnectionToken.php');
require(dirname(__FILE__) . '/lib/Terminal/Location.php');
require(dirname(__FILE__) . '/lib/Terminal/Reader.php');
......@@ -124,4 +133,5 @@ require(dirname(__FILE__) . '/lib/OAuth.php');
// Webhooks
require(dirname(__FILE__) . '/lib/Webhook.php');
require(dirname(__FILE__) . '/lib/WebhookEndpoint.php');
require(dirname(__FILE__) . '/lib/WebhookSignature.php');
......@@ -7,35 +7,24 @@ namespace Stripe;
*
* @property string $id
* @property string $object
* @property string $business_logo
* @property string $business_name
* @property string $business_primary_color
* @property string $business_url
* @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 bool $debit_negative_balances
* @property mixed $decline_charge_on
* @property string $default_currency
* @property bool $details_submitted
* @property string $display_name
* @property string $email
* @property Collection $external_accounts
* @property mixed $legal_entity
* @property mixed $individual
* @property StripeObject $metadata
* @property mixed $payout_schedule
* @property string $payout_statement_descriptor
* @property bool $payouts_enabled
* @property string $product_description
* @property string $statement_descriptor
* @property mixed $support_address
* @property string $support_email
* @property string $support_phone
* @property string $support_url
* @property string $timezone
* @property mixed $requirements
* @property mixed $settings
* @property mixed $tos_acceptance
* @property string $type
* @property mixed $verification
*
* @package Stripe
*/
......@@ -67,6 +56,7 @@ class Account extends ApiResource
const PATH_EXTERNAL_ACCOUNTS = '/external_accounts';
const PATH_LOGIN_LINKS = '/login_links';
const PATH_PERSONS = '/persons';
public function instanceUrl()
{
......@@ -107,6 +97,21 @@ class Account extends ApiResource
return $this;
}
/**
* @param array|null $params
* @param array|string|null $options
*
* @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 array|null $clientId
* @param array|string|null $opts
......@@ -123,7 +128,7 @@ class Account extends ApiResource
}
/**
* @param array|null $id The ID of the account on which to create the external account.
* @param string|null $id The ID of the account on which to create the external account.
* @param array|null $params
* @param array|string|null $opts
*
......@@ -135,7 +140,7 @@ class Account extends ApiResource
}
/**
* @param array|null $id The ID of the account to which the external account belongs.
* @param string|null $id The ID of the account to which the external account belongs.
* @param array|null $externalAccountId The ID of the external account to retrieve.
* @param array|null $params
* @param array|string|null $opts
......@@ -148,7 +153,7 @@ class Account extends ApiResource
}
/**
* @param array|null $id The ID of the account to which the external account belongs.
* @param string|null $id The ID of the account to which the external account belongs.
* @param array|null $externalAccountId The ID of the external account to update.
* @param array|null $params
* @param array|string|null $opts
......@@ -161,7 +166,7 @@ class Account extends ApiResource
}
/**
* @param array|null $id The ID of the account to which the external account belongs.
* @param string|null $id The ID of the account to which the external account belongs.
* @param array|null $externalAccountId The ID of the external account to delete.
* @param array|null $params
* @param array|string|null $opts
......@@ -174,7 +179,7 @@ class Account extends ApiResource
}
/**
* @param array|null $id The ID of the account on which to retrieve the external accounts.
* @param string|null $id The ID of the account on which to retrieve the external accounts.
* @param array|null $params
* @param array|string|null $opts
*
......@@ -186,7 +191,7 @@ class Account extends ApiResource
}
/**
* @param array|null $id The ID of the account on which to create the login link.
* @param string|null $id The ID of the account on which to create the login link.
* @param array|null $params
* @param array|string|null $opts
*
......@@ -197,6 +202,69 @@ class Account extends ApiResource
return self::_createNestedResource($id, static::PATH_LOGIN_LINKS, $params, $opts);
}
/**
* @param string|null $id The ID of the account on which to create the person.
* @param array|null $params
* @param array|string|null $opts
*
* @return Person
*/
public static function createPerson($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_PERSONS, $params, $opts);
}
/**
* @param string|null $id The ID of the account to which the person belongs.
* @param array|null $personId The ID of the person to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
* @return Person
*/
public static function retrievePerson($id, $personId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
}
/**
* @param string|null $id The ID of the account to which the person belongs.
* @param array|null $personId The ID of the person to update.
* @param array|null $params
* @param array|string|null $opts
*
* @return Person
*/
public static function updatePerson($id, $personId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
}
/**
* @param string|null $id The ID of the account to which the person belongs.
* @param array|null $personId The ID of the person to delete.
* @param array|null $params
* @param array|string|null $opts
*
* @return Person
*/
public static function deletePerson($id, $personId, $params = null, $opts = null)
{
return self::_deleteNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
}
/**
* @param string|null $id The ID of the account on which to retrieve the persons.
* @param array|null $params
* @param array|string|null $opts
*
* @return Person
*/
public static function allPersons($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_PERSONS, $params, $opts);
}
public function serializeParameters($force = false)
{
$update = parent::serializeParameters($force);
......@@ -209,6 +277,12 @@ class Account extends ApiResource
$update['legal_entity'] = $entityUpdate;
}
}
if (isset($this->_values['individual'])) {
$individual = $this['individual'];
if (($individual instanceof Person) && !isset($update['individual'])) {
$update['individual'] = $individual->serializeParameters($force);
}
}
return $update;
}
......
<?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;
}
......@@ -60,6 +60,7 @@ trait NestedResource
/**
* @param string $id
* @param string $nestedPath
* @param string|null $nestedId
* @param array|null $params
* @param array|string|null $options
*
......@@ -74,6 +75,7 @@ trait NestedResource
/**
* @param string $id
* @param string $nestedPath
* @param string|null $nestedId
* @param array|null $params
* @param array|string|null $options
*
......@@ -88,6 +90,7 @@ trait NestedResource
/**
* @param string $id
* @param string $nestedPath
* @param string|null $nestedId
* @param array|null $params
* @param array|string|null $options
*
......
......@@ -24,6 +24,11 @@ class ApiRequestor
*/
private static $_httpClient;
/**
* @var RequestTelemetry
*/
private static $requestTelemetry;
/**
* ApiRequestor constructor.
*
......@@ -39,6 +44,30 @@ class ApiRequestor
$this->_apiBase = $apiBase;
}
/**
* Creates a telemetry json blob for use in 'X-Stripe-Client-Telemetry' headers
* @static
*
* @param RequestTelemetry $requestTelemetry
* @return string
*/
private static function _telemetryJson($requestTelemetry)
{
$payload = array(
'last_request_metrics' => array(
'request_id' => $requestTelemetry->requestId,
'request_duration_ms' => $requestTelemetry->requestDuration,
));
$result = json_encode($payload);
if ($result != false) {
return $result;
} else {
Stripe::getLogger()->error("Serializing telemetry payload failed!");
return "{}";
}
}
/**
* @static
*
......@@ -332,6 +361,10 @@ class ApiRequestor
$defaultHeaders['Stripe-Account'] = Stripe::$accountId;
}
if (Stripe::$enableTelemetry && self::$requestTelemetry != null) {
$defaultHeaders["X-Stripe-Client-Telemetry"] = self::_telemetryJson(self::$requestTelemetry);
}
$hasFile = false;
$hasCurlFile = class_exists('\CURLFile', false);
foreach ($params as $k => $v) {
......@@ -356,6 +389,8 @@ class ApiRequestor
$rawHeaders[] = $header . ': ' . $value;
}
$requestStartMs = Util\Util::currentTimeMillis();
list($rbody, $rcode, $rheaders) = $this->httpClient()->request(
$method,
$absUrl,
......@@ -363,6 +398,14 @@ class ApiRequestor
$params,
$hasFile
);