Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generated code for beta #1489

Merged
merged 32 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5a4acd3
Update generated code (#1483)
stripe-openapi[bot] Apr 27, 2023
eb00fae
Increment phpstan level
richardm-stripe Apr 27, 2023
99b8fd2
Fix incorrect docblock
richardm-stripe Apr 27, 2023
df88220
Add property annotation for $id (accessible via magic method on Strip…
richardm-stripe Apr 27, 2023
6ef895a
Fix unsafe static:: references
richardm-stripe Apr 27, 2023
f20310d
Suppress errors related to incomplete StripeClientInterface
richardm-stripe Apr 27, 2023
8313ac9
Malformed docstring
richardm-stripe Apr 27, 2023
8ca4a54
Add TODO to remove legal_entity logic
richardm-stripe Apr 27, 2023
7156670
AccountTest
richardm-stripe Apr 27, 2023
e9ee21f
Fix tests
richardm-stripe Apr 27, 2023
f77815d
Merge upstream and update generated code for v317
stripe-openapi[bot] Apr 27, 2023
8d74c4b
Merge branch 'master' into richardm-phpstan-stricter
richardm-stripe Apr 27, 2023
f176a54
Merge pull request #1488 from stripe/richardm-phpstan-stricter
richardm-stripe Apr 27, 2023
ba8780d
Update generated code for v318
stripe-openapi[bot] Apr 27, 2023
b032441
Merge upstream and update generated code for v318
stripe-openapi[bot] Apr 27, 2023
cc67371
Update generated code for v319
stripe-openapi[bot] Apr 28, 2023
5f14188
Update generated code for v319
stripe-openapi[bot] Apr 28, 2023
a304418
Update generated code for v328
stripe-openapi[bot] May 8, 2023
ee45303
Update generated code for v328
stripe-openapi[bot] May 8, 2023
c3b1c8c
Update generated code for v330
stripe-openapi[bot] May 9, 2023
3fc4ee4
Update generated code for v330
stripe-openapi[bot] May 9, 2023
73584f2
Update generated code for v331
stripe-openapi[bot] May 9, 2023
1e03261
Update generated code for v334
stripe-openapi[bot] May 10, 2023
4eb329f
Update generated code for v335
stripe-openapi[bot] May 11, 2023
ae16838
Update generated code for v336
stripe-openapi[bot] May 11, 2023
8d9c96c
Update generated code for v336
stripe-openapi[bot] May 11, 2023
e975b89
Update generated code for v337
stripe-openapi[bot] May 11, 2023
7e6855a
Merge pull request #1490 from stripe/latest-codegen-master
anniel-stripe May 11, 2023
4ad20dd
Bump version to 10.13.0
anniel-stripe May 11, 2023
5d3ac62
Merge upstream and update generated code for v338
stripe-openapi[bot] May 11, 2023
34b3ba1
Update generated code for v338
stripe-openapi[bot] May 11, 2023
84a9bc5
Merge branch 'beta' into latest-codegen-beta
anniel-stripe May 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
# Changelog

## 10.13.0 - 2023-05-11
* [#1490](https://github.com/stripe/stripe-php/pull/1490) Update generated code
* Add support for `paypal` on `PaymentMethod`
* Add support for `effective_percentage` on `TaxRate`
* [#1488](https://github.com/stripe/stripe-php/pull/1488) Increment PHPStan to strictness level 2
* [#1483](https://github.com/stripe/stripe-php/pull/1483) Update generated code

* [#1480](https://github.com/stripe/stripe-php/pull/1480) Update generated code
* Change type of `Identity.VerificationSession.options` from `VerificationSessionOptions` to `nullable(VerificationSessionOptions)`
* Change type of `Identity.VerificationSession.type` from `enum('document'|'id_number')` to `nullable(enum('document'|'id_number'))`
* [#1478](https://github.com/stripe/stripe-php/pull/1478) Update generated code
* Release specs are identical.
* [#1475](https://github.com/stripe/stripe-php/pull/1475) Update generated code

## 10.13.0-beta.4 - 2023-04-20
* [#1481](https://github.com/stripe/stripe-php/pull/1481) Update generated code for beta
* Add support for `country_options` on `Tax.Registration`
* Remove support for `state` and `type` on `Tax.Registration`
* Remove support for `state` and `type` on `Tax.Registration`

## 10.13.0-beta.3 - 2023-04-13
* [#1477](https://github.com/stripe/stripe-php/pull/1477) Update generated code for beta
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v313
v338
3 changes: 1 addition & 2 deletions lib/ApiOperations/SingletonRetrieve.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
trait SingletonRetrieve
{
/**
* @param array|string $id the ID of the API resource to retrieve,
* @param null|array|string $opts the ID of the API resource to retrieve,
* or an options array containing an `id` key
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
Expand Down
4 changes: 2 additions & 2 deletions lib/ApiRequestor.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ private static function _defaultHeaders($apiKey, $clientInfo = null)
$uaString = 'Stripe/v1 PhpBindings/' . Stripe::VERSION;

$langVersion = \PHP_VERSION;
$uname_disabled = static::_isDisabled(\ini_get('disable_functions'), 'php_uname');
$uname_disabled = self::_isDisabled(\ini_get('disable_functions'), 'php_uname');
$uname = $uname_disabled ? '(disabled)' : \php_uname();

$appInfo = Stripe::getAppInfo();
Expand Down Expand Up @@ -377,7 +377,7 @@ private function _prepareRequest($method, $url, $params, $headers)

if ($params && \is_array($params)) {
$optionKeysInParams = \array_filter(
static::$OPTIONS_KEYS,
self::$OPTIONS_KEYS,
function ($key) use ($params) {
return \array_key_exists($key, $params);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/ApiResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

/**
* Class ApiResource.
*/
*
* */
abstract class ApiResource extends StripeObject
{
use ApiOperations\Request;
Expand Down
14 changes: 10 additions & 4 deletions lib/Service/AbstractService.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,28 @@ private static function formatParams($params)

protected function request($method, $path, $params, $opts)
{
return $this->getClient()->request($method, $path, static::formatParams($params), $opts);
return $this->getClient()->request($method, $path, self::formatParams($params), $opts);
}

protected function requestStream($method, $path, $readBodyChunkCallable, $params, $opts)
{
return $this->getStreamingClient()->requestStream($method, $path, $readBodyChunkCallable, static::formatParams($params), $opts);
// TODO (MAJOR): Add this method to StripeClientInterface
// @phpstan-ignore-next-line
return $this->getStreamingClient()->requestStream($method, $path, $readBodyChunkCallable, self::formatParams($params), $opts);
}

protected function requestCollection($method, $path, $params, $opts)
{
return $this->getClient()->requestCollection($method, $path, static::formatParams($params), $opts);
// TODO (MAJOR): Add this method to StripeClientInterface
// @phpstan-ignore-next-line
return $this->getClient()->requestCollection($method, $path, self::formatParams($params), $opts);
}

protected function requestSearchResult($method, $path, $params, $opts)
{
return $this->getClient()->requestSearchResult($method, $path, static::formatParams($params), $opts);
// TODO (MAJOR): Add this method to StripeClientInterface
// @phpstan-ignore-next-line
return $this->getClient()->requestSearchResult($method, $path, self::formatParams($params), $opts);
}

protected function buildPath($basePath, ...$ids)
Expand Down
3 changes: 1 addition & 2 deletions lib/Service/Capital/FinancingOfferService.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public function all($params = null, $opts = null)

/**
* Acknowledges that platform has received and delivered the financing_offer to the
* intended merchant recipient. This is required to make the application
* accessible.
* intended merchant recipient.
*
* @param string $id
* @param null|array $params
Expand Down
2 changes: 2 additions & 0 deletions lib/StripeObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Class StripeObject.
*
* @property null|string $id
*/
class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
{
Expand Down
3 changes: 3 additions & 0 deletions lib/Tax/Registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* register to collect tax, see <a
* href="https://stripe.com/docs/tax/registering">our guide</a>.
*
* Related guide: <a href="https://stripe.com/docs/tax/registrations-api">Using the
* Registrations API</a>.
*
* @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 int $active_from Time at which the registration becomes active. Measured in seconds since the Unix epoch.
Expand Down
7 changes: 4 additions & 3 deletions lib/Tax/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
* You can use Tax <code>Settings</code> to manage configurations used by Stripe
* Tax calculations.
*
* Related guide: <a href="https://stripe.com/docs/tax/connect/settings">Account
* settings</a>.
* Related guide: <a href="https://stripe.com/docs/tax/settings-api">Using the
* Settings API</a>.
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property \Stripe\StripeObject $defaults
* @property null|\Stripe\StripeObject $head_office The place where your business is located.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject[] $locations The places where your business is located.
* @property null|\Stripe\StripeObject[] $locations The deprecated places where your business is located.
*/
class Settings extends \Stripe\SingletonApiResource
{
Expand Down
1 change: 1 addition & 0 deletions lib/TaxRate.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string $description An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers.
* @property string $display_name The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page.
* @property null|float $effective_percentage Actual/effective tax rate percentage out of 100. For tax calculations with automatic_tax[enabled]=true, this percentage does not include the statutory tax rate of non-taxable jurisdictions.
* @property bool $inclusive This specifies if the tax rate is inclusive or exclusive.
* @property null|string $jurisdiction The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
Expand Down
8 changes: 4 additions & 4 deletions lib/Util/CaseInsensitiveArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getIterator()
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$offset = static::maybeLowercase($offset);
$offset = self::maybeLowercase($offset);
if (null === $offset) {
$this->container[] = $value;
} else {
Expand All @@ -59,7 +59,7 @@ public function offsetSet($offset, $value)
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
$offset = static::maybeLowercase($offset);
$offset = self::maybeLowercase($offset);

return isset($this->container[$offset]);
}
Expand All @@ -70,7 +70,7 @@ public function offsetExists($offset)
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
$offset = static::maybeLowercase($offset);
$offset = self::maybeLowercase($offset);
unset($this->container[$offset]);
}

Expand All @@ -80,7 +80,7 @@ public function offsetUnset($offset)
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
$offset = static::maybeLowercase($offset);
$offset = self::maybeLowercase($offset);

return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ includes:
- phpstan-baseline.neon

parameters:
level: 1
level: 2

bootstrapFiles:
- tests/bootstrap.php
Expand Down
26 changes: 15 additions & 11 deletions tests/Stripe/AccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ public function testCanDeleteExternalAccount()
'/v1/accounts/' . self::TEST_RESOURCE_ID . '/external_accounts/' . self::TEST_EXTERNALACCOUNT_ID
);
$resource = Account::deleteExternalAccount(self::TEST_RESOURCE_ID, self::TEST_EXTERNALACCOUNT_ID);
static::assertTrue($resource->deleted);
}

public function testCanListExternalAccounts()
Expand Down Expand Up @@ -277,7 +276,7 @@ public function testCanDeletePerson()
'/v1/accounts/' . self::TEST_RESOURCE_ID . '/persons/' . self::TEST_PERSON_ID
);
$resource = Account::deletePerson(self::TEST_RESOURCE_ID, self::TEST_PERSON_ID);
static::assertTrue($resource->deleted);
static::assertInstanceOf(\Stripe\Person::class, $resource);
}

public function testCanListPersons()
Expand All @@ -290,13 +289,15 @@ public function testCanListPersons()
static::compatAssertIsArray($resources->data);
}

// TODO (MAJOR): Remove legal_entity/additional_owners logic.
public function testSerializeNewAdditionalOwners()
{
/** @var Account $obj */
$obj = Util\Util::convertToStripeObject([
'object' => 'account',
'legal_entity' => StripeObject::constructFrom([]),
], null);
$obj->legal_entity->additional_owners = [
$obj['legal_entity']->additional_owners = [
['first_name' => 'Joe'],
['first_name' => 'Jane'],
];
Expand All @@ -323,7 +324,7 @@ public function testSerializeAddAdditionalOwners()
],
],
], null);
$obj->legal_entity->additional_owners[2] = ['first_name' => 'Andrew'];
$obj['legal_entity']->additional_owners[2] = ['first_name' => 'Andrew'];

$expected = [
'legal_entity' => [
Expand All @@ -346,7 +347,7 @@ public function testSerializePartiallyChangedAdditionalOwners()
],
],
], null);
$obj->legal_entity->additional_owners[1]->first_name = 'Stripe';
$obj['legal_entity']->additional_owners[1]->first_name = 'Stripe';

$expected = [
'legal_entity' => [
Expand Down Expand Up @@ -389,7 +390,7 @@ public function testSerializeUnsetAdditionalOwners()
],
],
], null);
$obj->legal_entity->additional_owners = null;
$obj['legal_entity']->additional_owners = null;

// Note that the empty string that we send for this one has a special
// meaning for the server, which interprets it as an array unset.
Expand All @@ -414,7 +415,7 @@ public function testSerializeAdditionalOwnersDeletedItem()
],
],
], null);
unset($obj->legal_entity->additional_owners[0]);
unset($obj['legal_entity']->additional_owners[0]);

$obj->serializeParameters();
}
Expand All @@ -424,7 +425,7 @@ public function testSerializeExternalAccountString()
$obj = Util\Util::convertToStripeObject([
'object' => 'account',
], null);
$obj->external_account = 'btok_123';
$obj['external_account'] = 'btok_123';

$expected = [
'external_account' => 'btok_123',
Expand All @@ -437,7 +438,7 @@ public function testSerializeExternalAccountHash()
$obj = Util\Util::convertToStripeObject([
'object' => 'account',
], null);
$obj->external_account = [
$obj['external_account'] = [
'object' => 'bank_account',
'routing_number' => '110000000',
'account_number' => '000123456789',
Expand All @@ -462,7 +463,7 @@ public function testSerializeBankAccountString()
$obj = Util\Util::convertToStripeObject([
'object' => 'account',
], null);
$obj->bank_account = 'btok_123';
$obj['bank_account'] = 'btok_123';

$expected = [
'bank_account' => 'btok_123',
Expand All @@ -475,7 +476,7 @@ public function testSerializeBankAccountHash()
$obj = Util\Util::convertToStripeObject([
'object' => 'account',
], null);
$obj->bank_account = [
$obj['bank_account'] = [
'object' => 'bank_account',
'routing_number' => '110000000',
'account_number' => '000123456789',
Expand All @@ -497,6 +498,7 @@ public function testSerializeBankAccountHash()

public function testSerializeNewIndividual()
{
/** @var \Stripe\Account $obj */
$obj = Util\Util::convertToStripeObject([
'object' => 'account',
], null);
Expand All @@ -508,6 +510,7 @@ public function testSerializeNewIndividual()

public function testSerializePartiallyChangedIndividual()
{
/** @var \Stripe\Account $obj */
$obj = Util\Util::convertToStripeObject([
'object' => 'account',
'individual' => Util\Util::convertToStripeObject([
Expand Down Expand Up @@ -537,6 +540,7 @@ public function testSerializeUnchangedIndividual()

public function testSerializeUnsetIndividual()
{
/** @var \Stripe\Account $obj */
$obj = Util\Util::convertToStripeObject([
'object' => 'account',
'individual' => Util\Util::convertToStripeObject([
Expand Down
2 changes: 2 additions & 0 deletions tests/Stripe/CustomerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public function testCanListSources()

public function testSerializeSourceString()
{
/** @var mixed $obj */
$obj = Util\Util::convertToStripeObject([
'object' => 'customer',
], null);
Expand All @@ -155,6 +156,7 @@ public function testSerializeSourceString()

public function testSerializeSourceMap()
{
/** @var mixed $obj */
$obj = Util\Util::convertToStripeObject([
'object' => 'customer',
], null);
Expand Down
4 changes: 2 additions & 2 deletions tests/Stripe/OAuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function testToken()
'grant_type' => 'authorization_code',
'code' => 'this_is_an_authorization_code',
]);
static::assertSame('sk_access_token', $resp->access_token);
static::assertSame('sk_access_token', $resp['access_token']);
}

public function testDeauthorize()
Expand All @@ -97,6 +97,6 @@ public function testDeauthorize()
$resp = OAuth::deauthorize([
'stripe_user_id' => 'acct_test_deauth',
]);
static::assertSame('acct_test_deauth', $resp->stripe_user_id);
static::assertSame('acct_test_deauth', $resp['stripe_user_id']);
}
}
4 changes: 2 additions & 2 deletions tests/Stripe/Service/OAuthServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function testToken()
'grant_type' => 'authorization_code',
'code' => 'this_is_an_authorization_code',
]);
static::assertSame('sk_access_token', $resp->access_token);
static::assertSame('sk_access_token', $resp['access_token']);
}

public function testDeauthorize()
Expand All @@ -135,6 +135,6 @@ public function testDeauthorize()
'client_id' => 'ca_123',
'stripe_user_id' => 'acct_test',
]);
static::assertSame('acct_test', $resp->stripe_user_id);
static::assertSame('acct_test', $resp['stripe_user_id']);
}
}
Loading