From 5a4acd34b20a12764e837ac4d9f2df2e79f1303b Mon Sep 17 00:00:00 2001
From: "stripe-openapi[bot]"
<105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Thu, 27 Apr 2023 08:46:51 -0700
Subject: [PATCH 01/25] Update generated code (#1483)
* Update generated code for v307
* Update generated code for v309
* Update generated code for v311
* Update generated code for v313
---------
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
---
OPENAPI_VERSION | 2 +-
lib/InvoiceLineItem.php | 6 +++---
lib/Service/PaymentIntentService.php | 2 +-
lib/TaxRate.php | 2 +-
tests/Stripe/GeneratedExamplesTest.php | 14 ++++++++++++++
5 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index 9010b7ef9..2b3b8788c 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v301
\ No newline at end of file
+v313
\ No newline at end of file
diff --git a/lib/InvoiceLineItem.php b/lib/InvoiceLineItem.php
index d70b18b10..411712190 100644
--- a/lib/InvoiceLineItem.php
+++ b/lib/InvoiceLineItem.php
@@ -14,7 +14,7 @@
* @property null|\Stripe\StripeObject[] $discount_amounts The amount of discount calculated per discount for this line item.
* @property bool $discountable If true, discounts will apply to this line item. Always false for prorations.
* @property null|(string|\Stripe\Discount)[] $discounts The discounts applied to the invoice line item. Line item discounts are applied before invoice discounts. Use expand[]=discounts
to expand each discount.
- * @property null|string $invoice_item The ID of the invoice item associated with this line item if any.
+ * @property null|string|\Stripe\InvoiceItem $invoice_item The ID of the invoice item associated with this line item if any.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Note that for line items with type=subscription
this will reflect the metadata of the subscription that caused the line item to be created.
* @property \Stripe\StripeObject $period
@@ -23,8 +23,8 @@
* @property bool $proration Whether this is a proration.
* @property null|\Stripe\StripeObject $proration_details Additional details for proration line items
* @property null|int $quantity The quantity of the subscription, if the line item is a subscription or a proration.
- * @property null|string $subscription The subscription that the invoice item pertains to, if any.
- * @property null|string $subscription_item The subscription item that generated this line item. Left empty if the line item is not an explicit result of a subscription.
+ * @property null|string|\Stripe\Subscription $subscription The subscription that the invoice item pertains to, if any.
+ * @property null|string|\Stripe\SubscriptionItem $subscription_item The subscription item that generated this line item. Left empty if the line item is not an explicit result of a subscription.
* @property null|\Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item
* @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item.
* @property string $type A string identifying the type of the source of this line item, either an invoiceitem
or a subscription
.
diff --git a/lib/Service/PaymentIntentService.php b/lib/Service/PaymentIntentService.php
index f3f81d5cf..787a873f5 100644
--- a/lib/Service/PaymentIntentService.php
+++ b/lib/Service/PaymentIntentService.php
@@ -45,7 +45,7 @@ public function applyCustomerBalance($id, $params = null, $opts = null)
*
* Once canceled, no additional charges will be made by the PaymentIntent and any
* operations on the PaymentIntent will fail with an error. For PaymentIntents with
- * status=’requires_capture’
, the remaining
+ * a status
of requires_capture
, the remaining
* amount_capturable
will automatically be refunded.
*
* You cannot cancel the PaymentIntent for a Checkout Session. true if the object exists in live mode or the value false
if the object exists in test mode.
* @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
- * @property float $percentage This represents the tax rate percent out of 100.
+ * @property float $percentage Tax rate percentage out of 100. For tax calculations with automatic_tax[enabled]=true, this percentage includes the statutory tax rate of non-taxable jurisdictions.
* @property null|string $state ISO 3166-2 subdivision code, without country prefix. For example, "NY" for New York, United States.
* @property null|string $tax_type The high-level tax type, such as vat
or sales_tax
.
*/
diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php
index 7f0ec38af..31852e455 100644
--- a/tests/Stripe/GeneratedExamplesTest.php
+++ b/tests/Stripe/GeneratedExamplesTest.php
@@ -2291,6 +2291,20 @@ public function testCreatePlan()
static::assertInstanceOf(\Stripe\Plan::class, $result);
}
+ public function testCreatePlan2()
+ {
+ $this->expectsRequest('post', '/v1/plans');
+ $result = $this->client->plans->create(
+ [
+ 'amount' => 2000,
+ 'currency' => 'usd',
+ 'interval' => 'month',
+ 'product' => ['name' => 'My product'],
+ ]
+ );
+ static::assertInstanceOf(\Stripe\Plan::class, $result);
+ }
+
public function testDeletePlan()
{
$this->expectsRequest('delete', '/v1/plans/price_xxxxxxxxxxxxx');
From eb00fae1087f7f4979fb591a884adcd2c6f0a3e8 Mon Sep 17 00:00:00 2001
From: Richard Marmorstein
Date: Thu, 27 Apr 2023 10:12:37 -0700
Subject: [PATCH 02/25] Increment phpstan level
---
phpstan.neon.dist | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
index fb066c682..983b38e60 100644
--- a/phpstan.neon.dist
+++ b/phpstan.neon.dist
@@ -2,7 +2,7 @@ includes:
- phpstan-baseline.neon
parameters:
- level: 1
+ level: 2
bootstrapFiles:
- tests/bootstrap.php
From 99b8fd215697748cc6c6b74ab448ec07838e5b36 Mon Sep 17 00:00:00 2001
From: Richard Marmorstein
Date: Thu, 27 Apr 2023 10:12:53 -0700
Subject: [PATCH 03/25] Fix incorrect docblock
---
lib/ApiOperations/SingletonRetrieve.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/ApiOperations/SingletonRetrieve.php b/lib/ApiOperations/SingletonRetrieve.php
index baae67e12..59c52c3ae 100644
--- a/lib/ApiOperations/SingletonRetrieve.php
+++ b/lib/ApiOperations/SingletonRetrieve.php
@@ -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
*
From df882202ff752fd0adebba19f251f681ad0a8989 Mon Sep 17 00:00:00 2001
From: Richard Marmorstein
Date: Thu, 27 Apr 2023 10:13:20 -0700
Subject: [PATCH 04/25] Add property annotation for $id (accessible via magic
method on StripeObject)
---
lib/ApiResource.php | 3 ++-
lib/StripeObject.php | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/ApiResource.php b/lib/ApiResource.php
index 25c6b84a0..c0765c80f 100644
--- a/lib/ApiResource.php
+++ b/lib/ApiResource.php
@@ -4,7 +4,8 @@
/**
* Class ApiResource.
- */
+ *
+ * */
abstract class ApiResource extends StripeObject
{
use ApiOperations\Request;
diff --git a/lib/StripeObject.php b/lib/StripeObject.php
index 844cfebd5..40b175323 100644
--- a/lib/StripeObject.php
+++ b/lib/StripeObject.php
@@ -4,6 +4,8 @@
/**
* Class StripeObject.
+ *
+ * @property null|string $id
*/
class StripeObject implements \ArrayAccess, \Countable, \JsonSerializable
{
From 6ef895a85b7abfee80c311e07e8649340ce191dd Mon Sep 17 00:00:00 2001
From: Richard Marmorstein
Date: Thu, 27 Apr 2023 10:22:34 -0700
Subject: [PATCH 05/25] Fix unsafe static:: references
---
lib/ApiRequestor.php | 4 ++--
lib/Service/AbstractService.php | 8 ++++----
lib/Util/CaseInsensitiveArray.php | 8 ++++----
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/lib/ApiRequestor.php b/lib/ApiRequestor.php
index 7162e33b5..6a9a9282a 100644
--- a/lib/ApiRequestor.php
+++ b/lib/ApiRequestor.php
@@ -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();
@@ -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);
}
diff --git a/lib/Service/AbstractService.php b/lib/Service/AbstractService.php
index 145af6759..05c180531 100644
--- a/lib/Service/AbstractService.php
+++ b/lib/Service/AbstractService.php
@@ -72,22 +72,22 @@ 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);
+ 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);
+ 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);
+ return $this->getClient()->requestSearchResult($method, $path, self::formatParams($params), $opts);
}
protected function buildPath($basePath, ...$ids)
diff --git a/lib/Util/CaseInsensitiveArray.php b/lib/Util/CaseInsensitiveArray.php
index 5e1ac7de9..262bca7ea 100644
--- a/lib/Util/CaseInsensitiveArray.php
+++ b/lib/Util/CaseInsensitiveArray.php
@@ -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 {
@@ -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]);
}
@@ -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]);
}
@@ -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;
}
From f20310d4c5e05d36c8a324e5b9fe16e9dfef24c4 Mon Sep 17 00:00:00 2001
From: Richard Marmorstein
Date: Thu, 27 Apr 2023 11:01:09 -0700
Subject: [PATCH 06/25] Suppress errors related to incomplete
StripeClientInterface
---
lib/Service/AbstractService.php | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/Service/AbstractService.php b/lib/Service/AbstractService.php
index 05c180531..44392c452 100644
--- a/lib/Service/AbstractService.php
+++ b/lib/Service/AbstractService.php
@@ -77,16 +77,22 @@ protected function request($method, $path, $params, $opts)
protected function requestStream($method, $path, $readBodyChunkCallable, $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)
{
+ // 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)
{
+ // TODO (MAJOR): Add this method to StripeClientInterface
+ // @phpstan-ignore-next-line
return $this->getClient()->requestSearchResult($method, $path, self::formatParams($params), $opts);
}
From 8313ac9cbd99ffcc21fe280e2ba90aabed056dd5 Mon Sep 17 00:00:00 2001
From: Richard Marmorstein
Date: Thu, 27 Apr 2023 11:01:41 -0700
Subject: [PATCH 07/25] Malformed docstring
---
lib/Service/AccountService.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Service/AccountService.php b/lib/Service/AccountService.php
index aad227268..a7ffbb38e 100644
--- a/lib/Service/AccountService.php
+++ b/lib/Service/AccountService.php
@@ -375,7 +375,7 @@ public function updatePerson($parentId, $id, $params = null, $opts = null)
*
* @param null|string $id
* @param null|array $params
- * @param null|array|StripeUtilRequestOptions $opts
+ * @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
From 8ca4a548dedca6fd71fe916acbc0bb751ba52ded Mon Sep 17 00:00:00 2001
From: Richard Marmorstein
Date: Thu, 27 Apr 2023 11:29:37 -0700
Subject: [PATCH 08/25] Add TODO to remove legal_entity logic
---
lib/Account.php | 3 +++
tests/Stripe/AccountTest.php | 1 +
2 files changed, 4 insertions(+)
diff --git a/lib/Account.php b/lib/Account.php
index 70978409f..1a8e63678 100644
--- a/lib/Account.php
+++ b/lib/Account.php
@@ -105,6 +105,8 @@ public static function retrieve($id = null, $opts = null)
return self::_retrieve($id, $opts);
}
+ // TODO (MAJOR): Remove legal_entity/additional_owners logic. These properties are not present in API versions
+ // after 2019-02-19, so we ought to deprecate them from new releases of the library.
public function serializeParameters($force = false)
{
$update = parent::serializeParameters($force);
@@ -127,6 +129,7 @@ public function serializeParameters($force = false)
return $update;
}
+ // TODO (MAJOR): Remove legal_entity/additional_owners logic.
private function serializeAdditionalOwners($legalEntity, $additionalOwners)
{
if (isset($legalEntity->_originalValues['additional_owners'])) {
diff --git a/tests/Stripe/AccountTest.php b/tests/Stripe/AccountTest.php
index 5e4e723cf..b854da26d 100644
--- a/tests/Stripe/AccountTest.php
+++ b/tests/Stripe/AccountTest.php
@@ -290,6 +290,7 @@ public function testCanListPersons()
static::compatAssertIsArray($resources->data);
}
+ // TODO (MAJOR): Remove legal_entity/additional_owners logic.
public function testSerializeNewAdditionalOwners()
{
$obj = Util\Util::convertToStripeObject([
From 71566705aef0f96611b3bdec9a8903db8eb77315 Mon Sep 17 00:00:00 2001
From: Richard Marmorstein
Date: Thu, 27 Apr 2023 11:36:12 -0700
Subject: [PATCH 09/25] AccountTest
---
tests/Stripe/AccountTest.php | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/tests/Stripe/AccountTest.php b/tests/Stripe/AccountTest.php
index b854da26d..61ae41317 100644
--- a/tests/Stripe/AccountTest.php
+++ b/tests/Stripe/AccountTest.php
@@ -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()
@@ -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()
@@ -293,11 +292,12 @@ public function testCanListPersons()
// 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'],
];
@@ -324,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' => [
@@ -347,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' => [
@@ -390,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.
@@ -415,7 +415,7 @@ public function testSerializeAdditionalOwnersDeletedItem()
],
],
], null);
- unset($obj->legal_entity->additional_owners[0]);
+ unset($obj['legal_entity']->additional_owners[0]);
$obj->serializeParameters();
}
@@ -425,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',
@@ -438,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',
@@ -463,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',
@@ -476,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',
@@ -498,6 +498,7 @@ public function testSerializeBankAccountHash()
public function testSerializeNewIndividual()
{
+ /** @var \Stripe\Account $obj */
$obj = Util\Util::convertToStripeObject([
'object' => 'account',
], null);
@@ -509,6 +510,7 @@ public function testSerializeNewIndividual()
public function testSerializePartiallyChangedIndividual()
{
+ /** @var \Stripe\Account $obj */
$obj = Util\Util::convertToStripeObject([
'object' => 'account',
'individual' => Util\Util::convertToStripeObject([
@@ -538,6 +540,7 @@ public function testSerializeUnchangedIndividual()
public function testSerializeUnsetIndividual()
{
+ /** @var \Stripe\Account $obj */
$obj = Util\Util::convertToStripeObject([
'object' => 'account',
'individual' => Util\Util::convertToStripeObject([
From e9ee21f9f407a5e8254aa2434c9f422a621837d5 Mon Sep 17 00:00:00 2001
From: Richard Marmorstein
Date: Thu, 27 Apr 2023 12:27:53 -0700
Subject: [PATCH 10/25] Fix tests
---
tests/Stripe/CustomerTest.php | 2 ++
tests/Stripe/OAuthTest.php | 4 +--
tests/Stripe/Service/OAuthServiceTest.php | 4 +--
tests/Stripe/SourceTest.php | 11 ++++---
tests/Stripe/StripeObjectTest.php | 37 +++++++++++++++++++++--
tests/Stripe/StripeTelemetryTest.php | 4 +--
tests/Stripe/SubscriptionTest.php | 1 +
7 files changed, 51 insertions(+), 12 deletions(-)
diff --git a/tests/Stripe/CustomerTest.php b/tests/Stripe/CustomerTest.php
index 8cf86e4a3..d5b4f5ae2 100644
--- a/tests/Stripe/CustomerTest.php
+++ b/tests/Stripe/CustomerTest.php
@@ -142,6 +142,7 @@ public function testCanListSources()
public function testSerializeSourceString()
{
+ /** @var mixed $obj */
$obj = Util\Util::convertToStripeObject([
'object' => 'customer',
], null);
@@ -155,6 +156,7 @@ public function testSerializeSourceString()
public function testSerializeSourceMap()
{
+ /** @var mixed $obj */
$obj = Util\Util::convertToStripeObject([
'object' => 'customer',
], null);
diff --git a/tests/Stripe/OAuthTest.php b/tests/Stripe/OAuthTest.php
index a5a45886e..e1245797b 100644
--- a/tests/Stripe/OAuthTest.php
+++ b/tests/Stripe/OAuthTest.php
@@ -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()
@@ -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']);
}
}
diff --git a/tests/Stripe/Service/OAuthServiceTest.php b/tests/Stripe/Service/OAuthServiceTest.php
index d20e471e5..951ea8176 100644
--- a/tests/Stripe/Service/OAuthServiceTest.php
+++ b/tests/Stripe/Service/OAuthServiceTest.php
@@ -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()
@@ -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']);
}
}
diff --git a/tests/Stripe/SourceTest.php b/tests/Stripe/SourceTest.php
index 9f34c9d95..7407e5fee 100644
--- a/tests/Stripe/SourceTest.php
+++ b/tests/Stripe/SourceTest.php
@@ -86,12 +86,15 @@ public function testCanSaveCardExpiryDate()
$response
);
- $source->card->exp_month = 12;
- $source->card->exp_year = 2022;
+ /** @var mixed $card */
+ $card = $source->card;
+
+ $card->exp_month = 12;
+ $card->exp_year = 2022;
$source->save();
- static::assertSame(12, $source->card->exp_month);
- static::assertSame(2022, $source->card->exp_year);
+ static::assertSame(12, $source['card']['exp_month']);
+ static::assertSame(2022, $source['card']['exp_year']);
}
public function testIsDetachableWhenAttached()
diff --git a/tests/Stripe/StripeObjectTest.php b/tests/Stripe/StripeObjectTest.php
index f07c47f1e..c8e0903dd 100644
--- a/tests/Stripe/StripeObjectTest.php
+++ b/tests/Stripe/StripeObjectTest.php
@@ -35,6 +35,7 @@ public function setUpReflectors()
public function testArrayAccessorsSemantics()
{
+ /** @var mixed $s */
$s = new StripeObject();
$s['foo'] = 'a';
static::assertSame($s['foo'], 'a');
@@ -45,6 +46,7 @@ public function testArrayAccessorsSemantics()
public function testNormalAccessorsSemantics()
{
+ /** @var mixed $s */
$s = new StripeObject();
$s->foo = 'a';
static::assertSame($s->foo, 'a');
@@ -55,6 +57,7 @@ public function testNormalAccessorsSemantics()
public function testArrayAccessorsMatchNormalAccessors()
{
+ /** @var mixed $s */
$s = new StripeObject();
$s->foo = 'a';
static::assertSame($s['foo'], 'a');
@@ -65,6 +68,7 @@ public function testArrayAccessorsMatchNormalAccessors()
public function testCount()
{
+ /** @var mixed $s */
$s = new StripeObject();
static::assertCount(0, $s);
@@ -80,6 +84,7 @@ public function testCount()
public function testKeys()
{
+ /** @var mixed $s */
$s = new StripeObject();
$s->foo = 'bar';
static::assertSame($s->keys(), ['foo']);
@@ -87,6 +92,7 @@ public function testKeys()
public function testValues()
{
+ /** @var mixed $s */
$s = new StripeObject();
$s->foo = 'bar';
static::assertSame($s->values(), ['bar']);
@@ -141,6 +147,7 @@ public function testNonexistentProperty()
$origErrorLog = \ini_set('error_log', \stream_get_meta_data($capture)['uri']);
try {
+ /** @var mixed $s */
$s = new StripeObject();
static::assertNull($s->nonexistent);
@@ -156,12 +163,14 @@ public function testNonexistentProperty()
public function testPropertyDoesNotExists()
{
+ /** @var mixed $s */
$s = new StripeObject();
static::assertNull($s['nonexistent']);
}
public function testJsonEncode()
{
+ /** @var mixed $s */
$s = new StripeObject();
$s->foo = 'a';
@@ -170,6 +179,7 @@ public function testJsonEncode()
public function testToString()
{
+ /** @var mixed $s */
$s = new StripeObject();
$s->foo = 'a';
@@ -184,6 +194,7 @@ public function testToString()
public function testReplaceNewNestedUpdatable()
{
+ /** @var mixed $s */
$s = new StripeObject();
$s->metadata = ['bar'];
@@ -196,6 +207,7 @@ public function testSetPermanentAttribute()
{
$this->expectException(\InvalidArgumentException::class);
+ /** @var mixed $s */
$s = new StripeObject();
$s->id = 'abc_123';
}
@@ -204,6 +216,7 @@ public function testSetEmptyStringValue()
{
$this->expectException(\InvalidArgumentException::class);
+ /** @var mixed $s */
$s = new StripeObject();
$s->foo = '';
}
@@ -216,6 +229,7 @@ public function testSerializeParametersOnEmptyObject()
public function testSerializeParametersOnNewObjectWithSubObject()
{
+ /** @var mixed $obj */
$obj = new StripeObject();
$obj->metadata = ['foo' => 'bar'];
static::assertSame(['metadata' => ['foo' => 'bar']], $obj->serializeParameters());
@@ -230,6 +244,7 @@ public function testSerializeParametersOnBasicObject()
public function testSerializeParametersOnMoreComplexObject()
{
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom([
'foo' => StripeObject::constructFrom([
'bar' => null,
@@ -242,6 +257,7 @@ public function testSerializeParametersOnMoreComplexObject()
public function testSerializeParametersOnArray()
{
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom([
'foo' => null,
]);
@@ -251,6 +267,7 @@ public function testSerializeParametersOnArray()
public function testSerializeParametersOnArrayThatShortens()
{
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom([
'foo' => ['0-index', '1-index', '2-index'],
]);
@@ -260,6 +277,7 @@ public function testSerializeParametersOnArrayThatShortens()
public function testSerializeParametersOnArrayThatLengthens()
{
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom([
'foo' => ['0-index', '1-index', '2-index'],
]);
@@ -269,17 +287,21 @@ public function testSerializeParametersOnArrayThatLengthens()
public function testSerializeParametersOnArrayOfHashes()
{
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom(['foo' => null]);
$obj->foo = [
StripeObject::constructFrom(['bar' => null]),
];
- $obj->foo[0]->bar = 'baz';
+ /** @var mixed $first */
+ $first = $obj->foo[0];
+ $first->bar = 'baz';
static::assertSame(['foo' => [['bar' => 'baz']]], $obj->serializeParameters());
}
public function testSerializeParametersDoesNotIncludeUnchangedValues()
{
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom([
'foo' => null,
]);
@@ -288,6 +310,7 @@ public function testSerializeParametersDoesNotIncludeUnchangedValues()
public function testSerializeParametersOnUnchangedArray()
{
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom([
'foo' => ['0-index', '1-index', '2-index'],
]);
@@ -297,6 +320,7 @@ public function testSerializeParametersOnUnchangedArray()
public function testSerializeParametersWithStripeObject()
{
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom([]);
$obj->metadata = StripeObject::constructFrom(['foo' => 'bar']);
@@ -306,6 +330,7 @@ public function testSerializeParametersWithStripeObject()
public function testSerializeParametersOnReplacedStripeObject()
{
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom([
'source' => StripeObject::constructFrom(['bar' => 'foo']),
]);
@@ -317,6 +342,7 @@ public function testSerializeParametersOnReplacedStripeObject()
public function testSerializeParametersOnReplacedStripeObjectWhichIsMetadata()
{
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom([
'metadata' => StripeObject::constructFrom(['bar' => 'foo']),
]);
@@ -328,6 +354,7 @@ public function testSerializeParametersOnReplacedStripeObjectWhichIsMetadata()
public function testSerializeParametersOnArrayOfStripeObjects()
{
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom([]);
$obj->metadata = [
StripeObject::constructFrom(['foo' => 'bar']),
@@ -340,6 +367,7 @@ public function testSerializeParametersOnArrayOfStripeObjects()
public function testSerializeParametersOnSetApiResource()
{
$customer = Customer::constructFrom(['id' => 'cus_123']);
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom([]);
// the key here is that the property is set explicitly (and therefore
@@ -377,6 +405,7 @@ public function testSerializeParametersRaisesExceotionOnOtherEmbeddedApiResource
// probably not what the user expected to happen.
$customer = Customer::constructFrom([]);
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom([]);
$obj->customer = $customer;
@@ -513,6 +542,7 @@ public function testIsDeleted()
public function testDeserializeEmptyMetadata()
{
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom([
'metadata' => [],
]);
@@ -522,11 +552,14 @@ public function testDeserializeEmptyMetadata()
public function testDeserializeMetadataWithKeyNamedMetadata()
{
+ /** @var mixed $obj */
$obj = StripeObject::constructFrom([
'metadata' => ['metadata' => 'value'],
]);
static::assertInstanceOf(\Stripe\StripeObject::class, $obj->metadata);
- static::assertSame('value', $obj->metadata->metadata);
+ /** @var mixed $inner */
+ $inner = $obj->metadata;
+ static::assertSame('value', $inner->metadata);
}
}
diff --git a/tests/Stripe/StripeTelemetryTest.php b/tests/Stripe/StripeTelemetryTest.php
index 3a27d2260..a76ab2483 100644
--- a/tests/Stripe/StripeTelemetryTest.php
+++ b/tests/Stripe/StripeTelemetryTest.php
@@ -37,7 +37,7 @@ public function testNoTelemetrySentIfNotEnabled()
$requestheaders = null;
$stub = $this
- ->getMockBuilder('HttpClient\\ClientInterface')
+ ->getMockBuilder('\\Stripe\\HttpClient\\ClientInterface')
->setMethods(['request'])
->getMock()
;
@@ -80,7 +80,7 @@ public function testTelemetrySetIfEnabled()
$requestheaders = null;
$stub = $this
- ->getMockBuilder('HttpClient\\ClientInterface')
+ ->getMockBuilder('\\Stripe\\HttpClient\\ClientInterface')
->setMethods(['request'])
->getMock()
;
diff --git a/tests/Stripe/SubscriptionTest.php b/tests/Stripe/SubscriptionTest.php
index c8d0cabf7..28dc66b1f 100644
--- a/tests/Stripe/SubscriptionTest.php
+++ b/tests/Stripe/SubscriptionTest.php
@@ -94,6 +94,7 @@ public function testCanDeleteDiscount()
public function testSerializeParametersItems()
{
+ /** @var \Stripe\Subscription */
$obj = Util\Util::convertToStripeObject([
'object' => 'subscription',
'items' => Util\Util::convertToStripeObject([
From ba8780da898bd3b88ab2085c2905f3cebb2d6643 Mon Sep 17 00:00:00 2001
From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Thu, 27 Apr 2023 23:29:36 +0000
Subject: [PATCH 11/25] Update generated code for v318
---
OPENAPI_VERSION | 2 +-
lib/Account.php | 3 ---
lib/Service/AccountService.php | 2 +-
3 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index 2b3b8788c..079f0e7ba 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v313
\ No newline at end of file
+v318
\ No newline at end of file
diff --git a/lib/Account.php b/lib/Account.php
index 1a8e63678..70978409f 100644
--- a/lib/Account.php
+++ b/lib/Account.php
@@ -105,8 +105,6 @@ public static function retrieve($id = null, $opts = null)
return self::_retrieve($id, $opts);
}
- // TODO (MAJOR): Remove legal_entity/additional_owners logic. These properties are not present in API versions
- // after 2019-02-19, so we ought to deprecate them from new releases of the library.
public function serializeParameters($force = false)
{
$update = parent::serializeParameters($force);
@@ -129,7 +127,6 @@ public function serializeParameters($force = false)
return $update;
}
- // TODO (MAJOR): Remove legal_entity/additional_owners logic.
private function serializeAdditionalOwners($legalEntity, $additionalOwners)
{
if (isset($legalEntity->_originalValues['additional_owners'])) {
diff --git a/lib/Service/AccountService.php b/lib/Service/AccountService.php
index a7ffbb38e..aad227268 100644
--- a/lib/Service/AccountService.php
+++ b/lib/Service/AccountService.php
@@ -375,7 +375,7 @@ public function updatePerson($parentId, $id, $params = null, $opts = null)
*
* @param null|string $id
* @param null|array $params
- * @param null|array|\Stripe\Util\RequestOptions $opts
+ * @param null|array|StripeUtilRequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
From cc673713133f6ec54e0ce25f66006e91d056c332 Mon Sep 17 00:00:00 2001
From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Fri, 28 Apr 2023 23:56:34 +0000
Subject: [PATCH 12/25] Update generated code for v319
---
OPENAPI_VERSION | 2 +-
lib/Service/AccountService.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index 079f0e7ba..2ddfeaaf7 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v318
\ No newline at end of file
+v319
\ No newline at end of file
diff --git a/lib/Service/AccountService.php b/lib/Service/AccountService.php
index aad227268..a7ffbb38e 100644
--- a/lib/Service/AccountService.php
+++ b/lib/Service/AccountService.php
@@ -375,7 +375,7 @@ public function updatePerson($parentId, $id, $params = null, $opts = null)
*
* @param null|string $id
* @param null|array $params
- * @param null|array|StripeUtilRequestOptions $opts
+ * @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
From 5f141886da2031c9989bfe5b8e41b58abf5309f6 Mon Sep 17 00:00:00 2001
From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Fri, 28 Apr 2023 23:56:50 +0000
Subject: [PATCH 13/25] Update generated code for v319
---
OPENAPI_VERSION | 2 +-
lib/Service/AccountService.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index 079f0e7ba..2ddfeaaf7 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v318
\ No newline at end of file
+v319
\ No newline at end of file
diff --git a/lib/Service/AccountService.php b/lib/Service/AccountService.php
index aad227268..a7ffbb38e 100644
--- a/lib/Service/AccountService.php
+++ b/lib/Service/AccountService.php
@@ -375,7 +375,7 @@ public function updatePerson($parentId, $id, $params = null, $opts = null)
*
* @param null|string $id
* @param null|array $params
- * @param null|array|StripeUtilRequestOptions $opts
+ * @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
From a30441818bf883aecd1a521d84fdb554f1a197b8 Mon Sep 17 00:00:00 2001
From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Mon, 8 May 2023 18:05:55 +0000
Subject: [PATCH 14/25] Update generated code for v328
---
OPENAPI_VERSION | 2 +-
tests/Stripe/GeneratedExamplesTest.php | 1078 ++++++++++++------------
2 files changed, 536 insertions(+), 544 deletions(-)
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index 2ddfeaaf7..892bbd994 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v319
\ No newline at end of file
+v328
\ No newline at end of file
diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php
index 31852e455..28f3cfc68 100644
--- a/tests/Stripe/GeneratedExamplesTest.php
+++ b/tests/Stripe/GeneratedExamplesTest.php
@@ -24,9 +24,10 @@ protected function setUpService()
public function testListSecret()
{
$this->expectsRequest('get', '/v1/apps/secrets');
- $result = $this->client->apps->secrets->all(
- ['scope' => ['type' => 'account'], 'limit' => 2]
- );
+ $result = $this->client->apps->secrets->all([
+ 'scope' => ['type' => 'account'],
+ 'limit' => 2,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Apps\Secret::class, $result->data[0]);
}
@@ -34,56 +35,60 @@ public function testListSecret()
public function testCreateSecret()
{
$this->expectsRequest('post', '/v1/apps/secrets');
- $result = $this->client->apps->secrets->create(
- [
- 'name' => 'sec_123',
- 'payload' => 'very secret string',
- 'scope' => ['type' => 'account'],
- ]
- );
+ $result = $this->client->apps->secrets->create([
+ 'name' => 'sec_123',
+ 'payload' => 'very secret string',
+ 'scope' => ['type' => 'account'],
+ ]);
static::assertInstanceOf(\Stripe\Apps\Secret::class, $result);
}
public function testDeleteWhereSecret()
{
$this->expectsRequest('post', '/v1/apps/secrets/delete');
- $result = $this->client->apps->secrets->deleteWhere(
- ['name' => 'my-api-key', 'scope' => ['type' => 'account']]
- );
+ $result = $this->client->apps->secrets->deleteWhere([
+ 'name' => 'my-api-key',
+ 'scope' => ['type' => 'account'],
+ ]);
static::assertInstanceOf(\Stripe\Apps\Secret::class, $result);
}
public function testFindSecret()
{
$this->expectsRequest('get', '/v1/apps/secrets/find');
- $result = $this->client->apps->secrets->find(
- ['name' => 'sec_123', 'scope' => ['type' => 'account']]
- );
+ $result = $this->client->apps->secrets->find([
+ 'name' => 'sec_123',
+ 'scope' => ['type' => 'account'],
+ ]);
static::assertInstanceOf(\Stripe\Apps\Secret::class, $result);
}
public function testCreateSession()
{
$this->expectsRequest('post', '/v1/checkout/sessions');
- $result = $this->client->checkout->sessions->create(
- [
- 'success_url' => 'https://example.com/success',
- 'cancel_url' => 'https://example.com/cancel',
- 'mode' => 'payment',
- 'shipping_options' => [
- ['shipping_rate' => 'shr_standard'],
- [
- 'shipping_rate_data' => [
- 'display_name' => 'Standard',
- 'delivery_estimate' => [
- 'minimum' => ['unit' => 'day', 'value' => 5],
- 'maximum' => ['unit' => 'day', 'value' => 7],
+ $result = $this->client->checkout->sessions->create([
+ 'success_url' => 'https://example.com/success',
+ 'cancel_url' => 'https://example.com/cancel',
+ 'mode' => 'payment',
+ 'shipping_options' => [
+ ['shipping_rate' => 'shr_standard'],
+ [
+ 'shipping_rate_data' => [
+ 'display_name' => 'Standard',
+ 'delivery_estimate' => [
+ 'minimum' => [
+ 'unit' => 'day',
+ 'value' => 5,
+ ],
+ 'maximum' => [
+ 'unit' => 'day',
+ 'value' => 7,
],
],
],
],
- ]
- );
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Checkout\Session::class, $result);
}
@@ -197,12 +202,13 @@ public function testRefreshAccount()
public function testCreateSession2()
{
$this->expectsRequest('post', '/v1/financial_connections/sessions');
- $result = $this->client->financialConnections->sessions->create(
- [
- 'account_holder' => ['type' => 'customer', 'customer' => 'cus_123'],
- 'permissions' => ['balances'],
- ]
- );
+ $result = $this->client->financialConnections->sessions->create([
+ 'account_holder' => [
+ 'type' => 'customer',
+ 'customer' => 'cus_123',
+ ],
+ 'permissions' => ['balances'],
+ ]);
static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result);
}
@@ -222,22 +228,20 @@ public function testRetrieveSession()
public function testUpcomingInvoice()
{
$this->expectsRequest('get', '/v1/invoices/upcoming');
- $result = $this->client->invoices->upcoming(
- ['customer' => 'cus_9utnxg47pWjV1e']
- );
+ $result = $this->client->invoices->upcoming([
+ 'customer' => 'cus_9utnxg47pWjV1e',
+ ]);
static::assertInstanceOf(\Stripe\Invoice::class, $result);
}
public function testCreatePaymentIntent()
{
$this->expectsRequest('post', '/v1/payment_intents');
- $result = $this->client->paymentIntents->create(
- [
- 'amount' => 1099,
- 'currency' => 'eur',
- 'automatic_payment_methods' => ['enabled' => true],
- ]
- );
+ $result = $this->client->paymentIntents->create([
+ 'amount' => 1099,
+ 'currency' => 'eur',
+ 'automatic_payment_methods' => ['enabled' => true],
+ ]);
static::assertInstanceOf(\Stripe\PaymentIntent::class, $result);
}
@@ -257,9 +261,14 @@ public function testVerifyMicrodepositsPaymentIntent()
public function testCreatePaymentLink()
{
$this->expectsRequest('post', '/v1/payment_links');
- $result = $this->client->paymentLinks->create(
- ['line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 1]]]
- );
+ $result = $this->client->paymentLinks->create([
+ 'line_items' => [
+ [
+ 'price' => 'price_xxxxxxxxxxxxx',
+ 'quantity' => 1,
+ ],
+ ],
+ ]);
static::assertInstanceOf(\Stripe\PaymentLink::class, $result);
}
@@ -281,27 +290,26 @@ public function testListLineItemsPaymentLink()
public function testCreatePrice()
{
$this->expectsRequest('post', '/v1/prices');
- $result = $this->client->prices->create(
- [
- 'unit_amount' => 2000,
- 'currency' => 'usd',
- 'currency_options' => [
- 'uah' => ['unit_amount' => 5000],
- 'eur' => ['unit_amount' => 1800],
- ],
- 'recurring' => ['interval' => 'month'],
- 'product' => 'prod_xxxxxxxxxxxxx',
- ]
- );
+ $result = $this->client->prices->create([
+ 'unit_amount' => 2000,
+ 'currency' => 'usd',
+ 'currency_options' => [
+ 'uah' => ['unit_amount' => 5000],
+ 'eur' => ['unit_amount' => 1800],
+ ],
+ 'recurring' => ['interval' => 'month'],
+ 'product' => 'prod_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Price::class, $result);
}
public function testListSetupAttempt()
{
$this->expectsRequest('get', '/v1/setup_attempts');
- $result = $this->client->setupAttempts->all(
- ['limit' => 3, 'setup_intent' => 'si_xyz']
- );
+ $result = $this->client->setupAttempts->all([
+ 'limit' => 3,
+ 'setup_intent' => 'si_xyz',
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\SetupAttempt::class, $result->data[0]);
}
@@ -330,13 +338,14 @@ public function testListShippingRate()
public function testCreateShippingRate()
{
$this->expectsRequest('post', '/v1/shipping_rates');
- $result = $this->client->shippingRates->create(
- [
- 'display_name' => 'Sample Shipper',
- 'fixed_amount' => ['currency' => 'usd', 'amount' => 400],
- 'type' => 'fixed_amount',
- ]
- );
+ $result = $this->client->shippingRates->create([
+ 'display_name' => 'Sample Shipper',
+ 'fixed_amount' => [
+ 'currency' => 'usd',
+ 'amount' => 400,
+ ],
+ 'type' => 'fixed_amount',
+ ]);
static::assertInstanceOf(\Stripe\ShippingRate::class, $result);
}
@@ -380,7 +389,10 @@ public function testFundCashBalanceCustomer()
);
$result = $this->client->testHelpers->customers->fundCashBalance(
'cus_123',
- ['amount' => 30, 'currency' => 'eur']
+ [
+ 'amount' => 30,
+ 'currency' => 'eur',
+ ]
);
static::assertInstanceOf(\Stripe\CustomerCashBalanceTransaction::class, $result);
}
@@ -455,9 +467,10 @@ public function testListTestClock()
public function testCreateTestClock()
{
$this->expectsRequest('post', '/v1/test_helpers/test_clocks');
- $result = $this->client->testHelpers->testClocks->create(
- ['frozen_time' => 123, 'name' => 'cogsworth']
- );
+ $result = $this->client->testHelpers->testClocks->create([
+ 'frozen_time' => 123,
+ 'name' => 'cogsworth',
+ ]);
static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result);
}
@@ -569,58 +582,50 @@ public function testReturnOutboundTransferOutboundTransfer()
public function testCreateReceivedCredit()
{
$this->expectsRequest('post', '/v1/test_helpers/treasury/received_credits');
- $result = $this->client->testHelpers->treasury->receivedCredits->create(
- [
- 'financial_account' => 'fa_123',
- 'network' => 'ach',
- 'amount' => 1234,
- 'currency' => 'usd',
- ]
- );
+ $result = $this->client->testHelpers->treasury->receivedCredits->create([
+ 'financial_account' => 'fa_123',
+ 'network' => 'ach',
+ 'amount' => 1234,
+ 'currency' => 'usd',
+ ]);
static::assertInstanceOf(\Stripe\Treasury\ReceivedCredit::class, $result);
}
public function testCreateReceivedDebit()
{
$this->expectsRequest('post', '/v1/test_helpers/treasury/received_debits');
- $result = $this->client->testHelpers->treasury->receivedDebits->create(
- [
- 'financial_account' => 'fa_123',
- 'network' => 'ach',
- 'amount' => 1234,
- 'currency' => 'usd',
- ]
- );
+ $result = $this->client->testHelpers->treasury->receivedDebits->create([
+ 'financial_account' => 'fa_123',
+ 'network' => 'ach',
+ 'amount' => 1234,
+ 'currency' => 'usd',
+ ]);
static::assertInstanceOf(\Stripe\Treasury\ReceivedDebit::class, $result);
}
public function testCreateToken()
{
$this->expectsRequest('post', '/v1/tokens');
- $result = $this->client->tokens->create(
- [
- 'card' => [
- 'number' => '4242424242424242',
- 'exp_month' => '5',
- 'exp_year' => '2023',
- 'cvc' => '314',
- ],
- ]
- );
+ $result = $this->client->tokens->create([
+ 'card' => [
+ 'number' => '4242424242424242',
+ 'exp_month' => '5',
+ 'exp_year' => '2023',
+ 'cvc' => '314',
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Token::class, $result);
}
public function testCreateAccountLink()
{
$this->expectsRequest('post', '/v1/account_links');
- $result = $this->client->accountLinks->create(
- [
- 'account' => 'acct_xxxxxxxxxxxxx',
- 'refresh_url' => 'https://example.com/reauth',
- 'return_url' => 'https://example.com/return',
- 'type' => 'account_onboarding',
- ]
- );
+ $result = $this->client->accountLinks->create([
+ 'account' => 'acct_xxxxxxxxxxxxx',
+ 'refresh_url' => 'https://example.com/reauth',
+ 'return_url' => 'https://example.com/return',
+ 'type' => 'account_onboarding',
+ ]);
static::assertInstanceOf(\Stripe\AccountLink::class, $result);
}
@@ -635,17 +640,15 @@ public function testListAccount2()
public function testCreateAccount()
{
$this->expectsRequest('post', '/v1/accounts');
- $result = $this->client->accounts->create(
- [
- 'type' => 'custom',
- 'country' => 'US',
- 'email' => 'jenny.rosen@example.com',
- 'capabilities' => [
- 'card_payments' => ['requested' => true],
- 'transfers' => ['requested' => true],
- ],
- ]
- );
+ $result = $this->client->accounts->create([
+ 'type' => 'custom',
+ 'country' => 'US',
+ 'email' => 'jenny.rosen@example.com',
+ 'capabilities' => [
+ 'card_payments' => ['requested' => true],
+ 'transfers' => ['requested' => true],
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Account::class, $result);
}
@@ -754,7 +757,10 @@ public function testCreatePerson()
$this->expectsRequest('post', '/v1/accounts/acct_xxxxxxxxxxxxx/persons');
$result = $this->client->accounts->createPerson(
'acct_xxxxxxxxxxxxx',
- ['first_name' => 'Jane', 'last_name' => 'Diaz']
+ [
+ 'first_name' => 'Jane',
+ 'last_name' => 'Diaz',
+ ]
);
static::assertInstanceOf(\Stripe\Person::class, $result);
}
@@ -874,9 +880,10 @@ public function testUpdateApplicationFeeRefund()
public function testListSecret2()
{
$this->expectsRequest('get', '/v1/apps/secrets');
- $result = $this->client->apps->secrets->all(
- ['scope' => ['type' => 'account'], 'limit' => 2]
- );
+ $result = $this->client->apps->secrets->all([
+ 'scope' => ['type' => 'account'],
+ 'limit' => 2,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Apps\Secret::class, $result->data[0]);
}
@@ -884,13 +891,11 @@ public function testListSecret2()
public function testCreateSecret2()
{
$this->expectsRequest('post', '/v1/apps/secrets');
- $result = $this->client->apps->secrets->create(
- [
- 'name' => 'my-api-key',
- 'payload' => 'secret_key_xxxxxx',
- 'scope' => ['type' => 'account'],
- ]
- );
+ $result = $this->client->apps->secrets->create([
+ 'name' => 'my-api-key',
+ 'payload' => 'secret_key_xxxxxx',
+ 'scope' => ['type' => 'account'],
+ ]);
static::assertInstanceOf(\Stripe\Apps\Secret::class, $result);
}
@@ -954,12 +959,10 @@ public function testUpdateConfiguration2()
public function testCreateSession3()
{
$this->expectsRequest('post', '/v1/billing_portal/sessions');
- $result = $this->client->billingPortal->sessions->create(
- [
- 'customer' => 'cus_xxxxxxxxxxxxx',
- 'return_url' => 'https://example.com/account',
- ]
- );
+ $result = $this->client->billingPortal->sessions->create([
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ 'return_url' => 'https://example.com/account',
+ ]);
static::assertInstanceOf(\Stripe\BillingPortal\Session::class, $result);
}
@@ -974,14 +977,12 @@ public function testListCharge()
public function testCreateCharge()
{
$this->expectsRequest('post', '/v1/charges');
- $result = $this->client->charges->create(
- [
- 'amount' => 2000,
- 'currency' => 'usd',
- 'source' => 'tok_xxxx',
- 'description' => 'My First Test Charge (created for API docs at https://www.stripe.com/docs/api)',
- ]
- );
+ $result = $this->client->charges->create([
+ 'amount' => 2000,
+ 'currency' => 'usd',
+ 'source' => 'tok_xxxx',
+ 'description' => 'My First Test Charge (created for API docs at https://www.stripe.com/docs/api)',
+ ]);
static::assertInstanceOf(\Stripe\Charge::class, $result);
}
@@ -1012,9 +1013,9 @@ public function testCaptureCharge()
public function testSearchCharge()
{
$this->expectsRequest('get', '/v1/charges/search');
- $result = $this->client->charges->search(
- ['query' => 'amount>999 AND metadata[\'order_id\']:\'6735\'']
- );
+ $result = $this->client->charges->search([
+ 'query' => 'amount>999 AND metadata[\'order_id\']:\'6735\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Charge::class, $result->data[0]);
}
@@ -1030,13 +1031,16 @@ public function testListSession()
public function testCreateSession4()
{
$this->expectsRequest('post', '/v1/checkout/sessions');
- $result = $this->client->checkout->sessions->create(
- [
- 'success_url' => 'https://example.com/success',
- 'line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 2]],
- 'mode' => 'payment',
- ]
- );
+ $result = $this->client->checkout->sessions->create([
+ 'success_url' => 'https://example.com/success',
+ 'line_items' => [
+ [
+ 'price' => 'price_xxxxxxxxxxxxx',
+ 'quantity' => 2,
+ ],
+ ],
+ 'mode' => 'payment',
+ ]);
static::assertInstanceOf(\Stripe\Checkout\Session::class, $result);
}
@@ -1089,13 +1093,11 @@ public function testListCoupon()
public function testCreateCoupon()
{
$this->expectsRequest('post', '/v1/coupons');
- $result = $this->client->coupons->create(
- [
- 'percent_off' => 25.5,
- 'duration' => 'repeating',
- 'duration_in_months' => 3,
- ]
- );
+ $result = $this->client->coupons->create([
+ 'percent_off' => 25.5,
+ 'duration' => 'repeating',
+ 'duration_in_months' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Coupon::class, $result);
}
@@ -1134,18 +1136,16 @@ public function testListCreditNote()
public function testCreateCreditNote()
{
$this->expectsRequest('post', '/v1/credit_notes');
- $result = $this->client->creditNotes->create(
- [
- 'invoice' => 'in_xxxxxxxxxxxxx',
- 'lines' => [
- [
- 'type' => 'invoice_line_item',
- 'invoice_line_item' => 'il_xxxxxxxxxxxxx',
- 'quantity' => 1,
- ],
+ $result = $this->client->creditNotes->create([
+ 'invoice' => 'in_xxxxxxxxxxxxx',
+ 'lines' => [
+ [
+ 'type' => 'invoice_line_item',
+ 'invoice_line_item' => 'il_xxxxxxxxxxxxx',
+ 'quantity' => 1,
],
- ]
- );
+ ],
+ ]);
static::assertInstanceOf(\Stripe\CreditNote::class, $result);
}
@@ -1173,18 +1173,16 @@ public function testListCreditNoteLineItem()
public function testPreviewCreditNote()
{
$this->expectsRequest('get', '/v1/credit_notes/preview');
- $result = $this->client->creditNotes->preview(
- [
- 'invoice' => 'in_xxxxxxxxxxxxx',
- 'lines' => [
- [
- 'type' => 'invoice_line_item',
- 'invoice_line_item' => 'il_xxxxxxxxxxxxx',
- 'quantity' => 1,
- ],
+ $result = $this->client->creditNotes->preview([
+ 'invoice' => 'in_xxxxxxxxxxxxx',
+ 'lines' => [
+ [
+ 'type' => 'invoice_line_item',
+ 'invoice_line_item' => 'il_xxxxxxxxxxxxx',
+ 'quantity' => 1,
],
- ]
- );
+ ],
+ ]);
static::assertInstanceOf(\Stripe\CreditNote::class, $result);
}
@@ -1207,11 +1205,9 @@ public function testListCustomer2()
public function testCreateCustomer()
{
$this->expectsRequest('post', '/v1/customers');
- $result = $this->client->customers->create(
- [
- 'description' => 'My First Test Customer (created for API docs at https://www.stripe.com/docs/api)',
- ]
- );
+ $result = $this->client->customers->create([
+ 'description' => 'My First Test Customer (created for API docs at https://www.stripe.com/docs/api)',
+ ]);
static::assertInstanceOf(\Stripe\Customer::class, $result);
}
@@ -1261,7 +1257,10 @@ public function testCreateCustomerBalanceTransaction()
);
$result = $this->client->customers->createBalanceTransaction(
'cus_xxxxxxxxxxxxx',
- ['amount' => -500, 'currency' => 'usd']
+ [
+ 'amount' => -500,
+ 'currency' => 'usd',
+ ]
);
static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result);
}
@@ -1310,7 +1309,10 @@ public function testCreateTaxId()
$this->expectsRequest('post', '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids');
$result = $this->client->customers->createTaxId(
'cus_xxxxxxxxxxxxx',
- ['type' => 'eu_vat', 'value' => 'DE123456789']
+ [
+ 'type' => 'eu_vat',
+ 'value' => 'DE123456789',
+ ]
);
static::assertInstanceOf(\Stripe\TaxId::class, $result);
}
@@ -1346,9 +1348,9 @@ public function testRetrieveTaxId()
public function testSearchCustomer()
{
$this->expectsRequest('get', '/v1/customers/search');
- $result = $this->client->customers->search(
- ['query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\'']
- );
+ $result = $this->client->customers->search([
+ 'query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]);
}
@@ -1356,9 +1358,9 @@ public function testSearchCustomer()
public function testSearchCustomer2()
{
$this->expectsRequest('get', '/v1/customers/search');
- $result = $this->client->customers->search(
- ['query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\'']
- );
+ $result = $this->client->customers->search([
+ 'query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]);
}
@@ -1421,9 +1423,9 @@ public function testListFileLink()
public function testCreateFileLink()
{
$this->expectsRequest('post', '/v1/file_links');
- $result = $this->client->fileLinks->create(
- ['file' => 'file_xxxxxxxxxxxxx']
- );
+ $result = $this->client->fileLinks->create([
+ 'file' => 'file_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\FileLink::class, $result);
}
@@ -1462,9 +1464,9 @@ public function testRetrieveFile()
public function testListAccount3()
{
$this->expectsRequest('get', '/v1/financial_connections/accounts');
- $result = $this->client->financialConnections->accounts->all(
- ['account_holder' => ['customer' => 'cus_xxxxxxxxxxxxx']]
- );
+ $result = $this->client->financialConnections->accounts->all([
+ 'account_holder' => ['customer' => 'cus_xxxxxxxxxxxxx'],
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result->data[0]);
}
@@ -1503,7 +1505,10 @@ public function testListOwnersAccount2()
);
$result = $this->client->financialConnections->accounts->allOwners(
'fca_xxxxxxxxxxxxx',
- ['limit' => 3, 'ownership' => 'fcaowns_xxxxxxxxxxxxx']
+ [
+ 'limit' => 3,
+ 'ownership' => 'fcaowns_xxxxxxxxxxxxx',
+ ]
);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\FinancialConnections\AccountOwner::class, $result->data[0]);
@@ -1512,16 +1517,14 @@ public function testListOwnersAccount2()
public function testCreateSession5()
{
$this->expectsRequest('post', '/v1/financial_connections/sessions');
- $result = $this->client->financialConnections->sessions->create(
- [
- 'account_holder' => [
- 'type' => 'customer',
- 'customer' => 'cus_xxxxxxxxxxxxx',
- ],
- 'permissions' => ['payment_method', 'balances'],
- 'filters' => ['countries' => ['US']],
- ]
- );
+ $result = $this->client->financialConnections->sessions->create([
+ 'account_holder' => [
+ 'type' => 'customer',
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ ],
+ 'permissions' => ['payment_method', 'balances'],
+ 'filters' => ['countries' => ['US']],
+ ]);
static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result);
}
@@ -1562,9 +1565,9 @@ public function testRetrieveVerificationReport()
public function testListVerificationSession()
{
$this->expectsRequest('get', '/v1/identity/verification_sessions');
- $result = $this->client->identity->verificationSessions->all(
- ['limit' => 3]
- );
+ $result = $this->client->identity->verificationSessions->all([
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result->data[0]);
}
@@ -1572,9 +1575,9 @@ public function testListVerificationSession()
public function testCreateVerificationSession()
{
$this->expectsRequest('post', '/v1/identity/verification_sessions');
- $result = $this->client->identity->verificationSessions->create(
- ['type' => 'document']
- );
+ $result = $this->client->identity->verificationSessions->create([
+ 'type' => 'document',
+ ]);
static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result);
}
@@ -1641,9 +1644,10 @@ public function testListInvoiceItem()
public function testCreateInvoiceItem()
{
$this->expectsRequest('post', '/v1/invoiceitems');
- $result = $this->client->invoiceItems->create(
- ['customer' => 'cus_xxxxxxxxxxxxx', 'price' => 'price_xxxxxxxxxxxxx']
- );
+ $result = $this->client->invoiceItems->create([
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ 'price' => 'price_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\InvoiceItem::class, $result);
}
@@ -1682,9 +1686,9 @@ public function testListInvoice()
public function testCreateInvoice()
{
$this->expectsRequest('post', '/v1/invoices');
- $result = $this->client->invoices->create(
- ['customer' => 'cus_xxxxxxxxxxxxx']
- );
+ $result = $this->client->invoices->create([
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Invoice::class, $result);
}
@@ -1766,9 +1770,9 @@ public function testVoidInvoiceInvoice()
public function testSearchInvoice()
{
$this->expectsRequest('get', '/v1/invoices/search');
- $result = $this->client->invoices->search(
- ['query' => 'total>999 AND metadata[\'order_id\']:\'6735\'']
- );
+ $result = $this->client->invoices->search([
+ 'query' => 'total>999 AND metadata[\'order_id\']:\'6735\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Invoice::class, $result->data[0]);
}
@@ -1844,23 +1848,21 @@ public function testListCardholder()
public function testCreateCardholder()
{
$this->expectsRequest('post', '/v1/issuing/cardholders');
- $result = $this->client->issuing->cardholders->create(
- [
- 'type' => 'individual',
- 'name' => 'Jenny Rosen',
- 'email' => 'jenny.rosen@example.com',
- 'phone_number' => '+18888675309',
- 'billing' => [
- 'address' => [
- 'line1' => '1234 Main Street',
- 'city' => 'San Francisco',
- 'state' => 'CA',
- 'country' => 'US',
- 'postal_code' => '94111',
- ],
+ $result = $this->client->issuing->cardholders->create([
+ 'type' => 'individual',
+ 'name' => 'Jenny Rosen',
+ 'email' => 'jenny.rosen@example.com',
+ 'phone_number' => '+18888675309',
+ 'billing' => [
+ 'address' => [
+ 'line1' => '1234 Main Street',
+ 'city' => 'San Francisco',
+ 'state' => 'CA',
+ 'country' => 'US',
+ 'postal_code' => '94111',
],
- ]
- );
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result);
}
@@ -1895,13 +1897,11 @@ public function testListCard()
public function testCreateCard()
{
$this->expectsRequest('post', '/v1/issuing/cards');
- $result = $this->client->issuing->cards->create(
- [
- 'cardholder' => 'ich_xxxxxxxxxxxxx',
- 'currency' => 'usd',
- 'type' => 'virtual',
- ]
- );
+ $result = $this->client->issuing->cards->create([
+ 'cardholder' => 'ich_xxxxxxxxxxxxx',
+ 'currency' => 'usd',
+ 'type' => 'virtual',
+ ]);
static::assertInstanceOf(\Stripe\Issuing\Card::class, $result);
}
@@ -1933,15 +1933,13 @@ public function testListDispute2()
public function testCreateDispute()
{
$this->expectsRequest('post', '/v1/issuing/disputes');
- $result = $this->client->issuing->disputes->create(
- [
- 'transaction' => 'ipi_xxxxxxxxxxxxx',
- 'evidence' => [
- 'reason' => 'fraudulent',
- 'fraudulent' => ['explanation' => 'Purchase was unrecognized.'],
- ],
- ]
- );
+ $result = $this->client->issuing->disputes->create([
+ 'transaction' => 'ipi_xxxxxxxxxxxxx',
+ 'evidence' => [
+ 'reason' => 'fraudulent',
+ 'fraudulent' => ['explanation' => 'Purchase was unrecognized.'],
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result);
}
@@ -2011,13 +2009,11 @@ public function testListPaymentIntent()
public function testCreatePaymentIntent2()
{
$this->expectsRequest('post', '/v1/payment_intents');
- $result = $this->client->paymentIntents->create(
- [
- 'amount' => 2000,
- 'currency' => 'usd',
- 'automatic_payment_methods' => ['enabled' => true],
- ]
- );
+ $result = $this->client->paymentIntents->create([
+ 'amount' => 2000,
+ 'currency' => 'usd',
+ 'automatic_payment_methods' => ['enabled' => true],
+ ]);
static::assertInstanceOf(\Stripe\PaymentIntent::class, $result);
}
@@ -2113,9 +2109,9 @@ public function testVerifyMicrodepositsPaymentIntent2()
public function testSearchPaymentIntent()
{
$this->expectsRequest('get', '/v1/payment_intents/search');
- $result = $this->client->paymentIntents->search(
- ['query' => 'status:\'succeeded\' AND metadata[\'order_id\']:\'6735\'']
- );
+ $result = $this->client->paymentIntents->search([
+ 'query' => 'status:\'succeeded\' AND metadata[\'order_id\']:\'6735\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\PaymentIntent::class, $result->data[0]);
}
@@ -2131,9 +2127,14 @@ public function testListPaymentLink()
public function testCreatePaymentLink2()
{
$this->expectsRequest('post', '/v1/payment_links');
- $result = $this->client->paymentLinks->create(
- ['line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 1]]]
- );
+ $result = $this->client->paymentLinks->create([
+ 'line_items' => [
+ [
+ 'price' => 'price_xxxxxxxxxxxxx',
+ 'quantity' => 1,
+ ],
+ ],
+ ]);
static::assertInstanceOf(\Stripe\PaymentLink::class, $result);
}
@@ -2157,9 +2158,10 @@ public function testUpdatePaymentLink()
public function testListPaymentMethod()
{
$this->expectsRequest('get', '/v1/payment_methods');
- $result = $this->client->paymentMethods->all(
- ['customer' => 'cus_xxxxxxxxxxxxx', 'type' => 'card']
- );
+ $result = $this->client->paymentMethods->all([
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ 'type' => 'card',
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\PaymentMethod::class, $result->data[0]);
}
@@ -2167,17 +2169,15 @@ public function testListPaymentMethod()
public function testCreatePaymentMethod()
{
$this->expectsRequest('post', '/v1/payment_methods');
- $result = $this->client->paymentMethods->create(
- [
- 'type' => 'card',
- 'card' => [
- 'number' => '4242424242424242',
- 'exp_month' => 8,
- 'exp_year' => 2024,
- 'cvc' => '314',
- ],
- ]
- );
+ $result = $this->client->paymentMethods->create([
+ 'type' => 'card',
+ 'card' => [
+ 'number' => '4242424242424242',
+ 'exp_month' => 8,
+ 'exp_year' => 2024,
+ 'cvc' => '314',
+ ],
+ ]);
static::assertInstanceOf(\Stripe\PaymentMethod::class, $result);
}
@@ -2232,9 +2232,10 @@ public function testListPayout()
public function testCreatePayout()
{
$this->expectsRequest('post', '/v1/payouts');
- $result = $this->client->payouts->create(
- ['amount' => 1100, 'currency' => 'usd']
- );
+ $result = $this->client->payouts->create([
+ 'amount' => 1100,
+ 'currency' => 'usd',
+ ]);
static::assertInstanceOf(\Stripe\Payout::class, $result);
}
@@ -2280,28 +2281,24 @@ public function testListPlan()
public function testCreatePlan()
{
$this->expectsRequest('post', '/v1/plans');
- $result = $this->client->plans->create(
- [
- 'amount' => 2000,
- 'currency' => 'usd',
- 'interval' => 'month',
- 'product' => 'prod_xxxxxxxxxxxxx',
- ]
- );
+ $result = $this->client->plans->create([
+ 'amount' => 2000,
+ 'currency' => 'usd',
+ 'interval' => 'month',
+ 'product' => 'prod_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Plan::class, $result);
}
public function testCreatePlan2()
{
$this->expectsRequest('post', '/v1/plans');
- $result = $this->client->plans->create(
- [
- 'amount' => 2000,
- 'currency' => 'usd',
- 'interval' => 'month',
- 'product' => ['name' => 'My product'],
- ]
- );
+ $result = $this->client->plans->create([
+ 'amount' => 2000,
+ 'currency' => 'usd',
+ 'interval' => 'month',
+ 'product' => ['name' => 'My product'],
+ ]);
static::assertInstanceOf(\Stripe\Plan::class, $result);
}
@@ -2340,14 +2337,12 @@ public function testListPrice()
public function testCreatePrice2()
{
$this->expectsRequest('post', '/v1/prices');
- $result = $this->client->prices->create(
- [
- 'unit_amount' => 2000,
- 'currency' => 'usd',
- 'recurring' => ['interval' => 'month'],
- 'product' => 'prod_xxxxxxxxxxxxx',
- ]
- );
+ $result = $this->client->prices->create([
+ 'unit_amount' => 2000,
+ 'currency' => 'usd',
+ 'recurring' => ['interval' => 'month'],
+ 'product' => 'prod_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Price::class, $result);
}
@@ -2371,9 +2366,9 @@ public function testUpdatePrice()
public function testSearchPrice()
{
$this->expectsRequest('get', '/v1/prices/search');
- $result = $this->client->prices->search(
- ['query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\'']
- );
+ $result = $this->client->prices->search([
+ 'query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Price::class, $result->data[0]);
}
@@ -2420,9 +2415,9 @@ public function testUpdateProduct()
public function testSearchProduct()
{
$this->expectsRequest('get', '/v1/products/search');
- $result = $this->client->products->search(
- ['query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\'']
- );
+ $result = $this->client->products->search([
+ 'query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Product::class, $result->data[0]);
}
@@ -2473,12 +2468,15 @@ public function testListQuote()
public function testCreateQuote()
{
$this->expectsRequest('post', '/v1/quotes');
- $result = $this->client->quotes->create(
- [
- 'customer' => 'cus_xxxxxxxxxxxxx',
- 'line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 2]],
- ]
- );
+ $result = $this->client->quotes->create([
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ 'line_items' => [
+ [
+ 'price' => 'price_xxxxxxxxxxxxx',
+ 'quantity' => 2,
+ ],
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Quote::class, $result);
}
@@ -2544,9 +2542,10 @@ public function testRetrieveEarlyFraudWarning()
public function testListValueListItem()
{
$this->expectsRequest('get', '/v1/radar/value_list_items');
- $result = $this->client->radar->valueListItems->all(
- ['limit' => 3, 'value_list' => 'rsl_xxxxxxxxxxxxx']
- );
+ $result = $this->client->radar->valueListItems->all([
+ 'limit' => 3,
+ 'value_list' => 'rsl_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result->data[0]);
}
@@ -2554,9 +2553,10 @@ public function testListValueListItem()
public function testCreateValueListItem()
{
$this->expectsRequest('post', '/v1/radar/value_list_items');
- $result = $this->client->radar->valueListItems->create(
- ['value_list' => 'rsl_xxxxxxxxxxxxx', 'value' => '1.2.3.4']
- );
+ $result = $this->client->radar->valueListItems->create([
+ 'value_list' => 'rsl_xxxxxxxxxxxxx',
+ 'value' => '1.2.3.4',
+ ]);
static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result);
}
@@ -2597,13 +2597,11 @@ public function testListValueList()
public function testCreateValueList()
{
$this->expectsRequest('post', '/v1/radar/value_lists');
- $result = $this->client->radar->valueLists->create(
- [
- 'alias' => 'custom_ip_xxxxxxxxxxxxx',
- 'name' => 'Custom IP Blocklist',
- 'item_type' => 'ip_address',
- ]
- );
+ $result = $this->client->radar->valueLists->create([
+ 'alias' => 'custom_ip_xxxxxxxxxxxxx',
+ 'name' => 'Custom IP Blocklist',
+ 'item_type' => 'ip_address',
+ ]);
static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result);
}
@@ -2684,15 +2682,13 @@ public function testListReportRun()
public function testCreateReportRun()
{
$this->expectsRequest('post', '/v1/reporting/report_runs');
- $result = $this->client->reporting->reportRuns->create(
- [
- 'report_type' => 'balance.summary.1',
- 'parameters' => [
- 'interval_start' => 1522540800,
- 'interval_end' => 1525132800,
- ],
- ]
- );
+ $result = $this->client->reporting->reportRuns->create([
+ 'report_type' => 'balance.summary.1',
+ 'parameters' => [
+ 'interval_start' => 1522540800,
+ 'interval_end' => 1525132800,
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Reporting\ReportRun::class, $result);
}
@@ -2760,9 +2756,9 @@ public function testListSetupIntent()
public function testCreateSetupIntent()
{
$this->expectsRequest('post', '/v1/setup_intents');
- $result = $this->client->setupIntents->create(
- ['payment_method_types' => ['card']]
- );
+ $result = $this->client->setupIntents->create([
+ 'payment_method_types' => ['card'],
+ ]);
static::assertInstanceOf(\Stripe\SetupIntent::class, $result);
}
@@ -2830,13 +2826,14 @@ public function testListShippingRate2()
public function testCreateShippingRate2()
{
$this->expectsRequest('post', '/v1/shipping_rates');
- $result = $this->client->shippingRates->create(
- [
- 'display_name' => 'Ground shipping',
- 'type' => 'fixed_amount',
- 'fixed_amount' => ['amount' => 500, 'currency' => 'usd'],
- ]
- );
+ $result = $this->client->shippingRates->create([
+ 'display_name' => 'Ground shipping',
+ 'type' => 'fixed_amount',
+ 'fixed_amount' => [
+ 'amount' => 500,
+ 'currency' => 'usd',
+ ],
+ ]);
static::assertInstanceOf(\Stripe\ShippingRate::class, $result);
}
@@ -2905,9 +2902,9 @@ public function testUpdateSource()
public function testListSubscriptionItem()
{
$this->expectsRequest('get', '/v1/subscription_items');
- $result = $this->client->subscriptionItems->all(
- ['subscription' => 'sub_xxxxxxxxxxxxx']
- );
+ $result = $this->client->subscriptionItems->all([
+ 'subscription' => 'sub_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result->data[0]);
}
@@ -2915,13 +2912,11 @@ public function testListSubscriptionItem()
public function testCreateSubscriptionItem()
{
$this->expectsRequest('post', '/v1/subscription_items');
- $result = $this->client->subscriptionItems->create(
- [
- 'subscription' => 'sub_xxxxxxxxxxxxx',
- 'price' => 'price_xxxxxxxxxxxxx',
- 'quantity' => 2,
- ]
- );
+ $result = $this->client->subscriptionItems->create([
+ 'subscription' => 'sub_xxxxxxxxxxxxx',
+ 'price' => 'price_xxxxxxxxxxxxx',
+ 'quantity' => 2,
+ ]);
static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result);
}
@@ -2974,7 +2969,10 @@ public function testCreateUsageRecord()
);
$result = $this->client->subscriptionItems->createUsageRecord(
'si_xxxxxxxxxxxxx',
- ['quantity' => 100, 'timestamp' => 1571252444]
+ [
+ 'quantity' => 100,
+ 'timestamp' => 1571252444,
+ ]
);
static::assertInstanceOf(\Stripe\UsageRecord::class, $result);
}
@@ -2990,19 +2988,22 @@ public function testListSubscriptionSchedule()
public function testCreateSubscriptionSchedule()
{
$this->expectsRequest('post', '/v1/subscription_schedules');
- $result = $this->client->subscriptionSchedules->create(
- [
- 'customer' => 'cus_xxxxxxxxxxxxx',
- 'start_date' => 1676070661,
- 'end_behavior' => 'release',
- 'phases' => [
- [
- 'items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 1]],
- 'iterations' => 12,
+ $result = $this->client->subscriptionSchedules->create([
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ 'start_date' => 1676070661,
+ 'end_behavior' => 'release',
+ 'phases' => [
+ [
+ 'items' => [
+ [
+ 'price' => 'price_xxxxxxxxxxxxx',
+ 'quantity' => 1,
+ ],
],
+ 'iterations' => 12,
],
- ]
- );
+ ],
+ ]);
static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result);
}
@@ -3069,12 +3070,10 @@ public function testListSubscription()
public function testCreateSubscription()
{
$this->expectsRequest('post', '/v1/subscriptions');
- $result = $this->client->subscriptions->create(
- [
- 'customer' => 'cus_xxxxxxxxxxxxx',
- 'items' => [['price' => 'price_xxxxxxxxxxxxx']],
- ]
- );
+ $result = $this->client->subscriptions->create([
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ 'items' => [['price' => 'price_xxxxxxxxxxxxx']],
+ ]);
static::assertInstanceOf(\Stripe\Subscription::class, $result);
}
@@ -3105,9 +3104,9 @@ public function testUpdateSubscription()
public function testSearchSubscription()
{
$this->expectsRequest('get', '/v1/subscriptions/search');
- $result = $this->client->subscriptions->search(
- ['query' => 'status:\'active\' AND metadata[\'order_id\']:\'6735\'']
- );
+ $result = $this->client->subscriptions->search([
+ 'query' => 'status:\'active\' AND metadata[\'order_id\']:\'6735\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Subscription::class, $result->data[0]);
}
@@ -3138,15 +3137,13 @@ public function testListTaxRate()
public function testCreateTaxRate()
{
$this->expectsRequest('post', '/v1/tax_rates');
- $result = $this->client->taxRates->create(
- [
- 'display_name' => 'VAT',
- 'description' => 'VAT Germany',
- 'jurisdiction' => 'DE',
- 'percentage' => 16,
- 'inclusive' => false,
- ]
- );
+ $result = $this->client->taxRates->create([
+ 'display_name' => 'VAT',
+ 'description' => 'VAT Germany',
+ 'jurisdiction' => 'DE',
+ 'percentage' => 16,
+ 'inclusive' => false,
+ ]);
static::assertInstanceOf(\Stripe\TaxRate::class, $result);
}
@@ -3232,18 +3229,16 @@ public function testListLocation()
public function testCreateLocation()
{
$this->expectsRequest('post', '/v1/terminal/locations');
- $result = $this->client->terminal->locations->create(
- [
- 'display_name' => 'My First Store',
- 'address' => [
- 'line1' => '1234 Main Street',
- 'city' => 'San Francisco',
- 'postal_code' => '94111',
- 'state' => 'CA',
- 'country' => 'US',
- ],
- ]
- );
+ $result = $this->client->terminal->locations->create([
+ 'display_name' => 'My First Store',
+ 'address' => [
+ 'line1' => '1234 Main Street',
+ 'city' => 'San Francisco',
+ 'postal_code' => '94111',
+ 'state' => 'CA',
+ 'country' => 'US',
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Terminal\Location::class, $result);
}
@@ -3288,13 +3283,11 @@ public function testListReader()
public function testCreateReader()
{
$this->expectsRequest('post', '/v1/terminal/readers');
- $result = $this->client->terminal->readers->create(
- [
- 'registration_code' => 'puppies-plug-could',
- 'label' => 'Blue Rabbit',
- 'location' => 'tml_1234',
- ]
- );
+ $result = $this->client->terminal->readers->create([
+ 'registration_code' => 'puppies-plug-could',
+ 'label' => 'Blue Rabbit',
+ 'location' => 'tml_1234',
+ ]);
static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result);
}
@@ -3378,9 +3371,9 @@ public function testListTestClock2()
public function testCreateTestClock2()
{
$this->expectsRequest('post', '/v1/test_helpers/test_clocks');
- $result = $this->client->testHelpers->testClocks->create(
- ['frozen_time' => 1577836800]
- );
+ $result = $this->client->testHelpers->testClocks->create([
+ 'frozen_time' => 1577836800,
+ ]);
static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result);
}
@@ -3426,56 +3419,53 @@ public function testAdvanceTestClock2()
public function testCreateToken2()
{
$this->expectsRequest('post', '/v1/tokens');
- $result = $this->client->tokens->create(
- [
- 'bank_account' => [
- 'country' => 'US',
- 'currency' => 'usd',
- 'account_holder_name' => 'Jenny Rosen',
- 'account_holder_type' => 'individual',
- 'routing_number' => '110000000',
- 'account_number' => '000123456789',
- ],
- ]
- );
+ $result = $this->client->tokens->create([
+ 'bank_account' => [
+ 'country' => 'US',
+ 'currency' => 'usd',
+ 'account_holder_name' => 'Jenny Rosen',
+ 'account_holder_type' => 'individual',
+ 'routing_number' => '110000000',
+ 'account_number' => '000123456789',
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Token::class, $result);
}
public function testCreateToken3()
{
$this->expectsRequest('post', '/v1/tokens');
- $result = $this->client->tokens->create(
- ['pii' => ['id_number' => '000000000']]
- );
+ $result = $this->client->tokens->create([
+ 'pii' => ['id_number' => '000000000'],
+ ]);
static::assertInstanceOf(\Stripe\Token::class, $result);
}
public function testCreateToken4()
{
$this->expectsRequest('post', '/v1/tokens');
- $result = $this->client->tokens->create(
- [
- 'account' => [
- 'individual' => ['first_name' => 'Jane', 'last_name' => 'Doe'],
- 'tos_shown_and_accepted' => true,
+ $result = $this->client->tokens->create([
+ 'account' => [
+ 'individual' => [
+ 'first_name' => 'Jane',
+ 'last_name' => 'Doe',
],
- ]
- );
+ 'tos_shown_and_accepted' => true,
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Token::class, $result);
}
public function testCreateToken5()
{
$this->expectsRequest('post', '/v1/tokens');
- $result = $this->client->tokens->create(
- [
- 'person' => [
- 'first_name' => 'Jane',
- 'last_name' => 'Doe',
- 'relationship' => ['owner' => true],
- ],
- ]
- );
+ $result = $this->client->tokens->create([
+ 'person' => [
+ 'first_name' => 'Jane',
+ 'last_name' => 'Doe',
+ 'relationship' => ['owner' => true],
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Token::class, $result);
}
@@ -3504,14 +3494,12 @@ public function testListTopup()
public function testCreateTopup()
{
$this->expectsRequest('post', '/v1/topups');
- $result = $this->client->topups->create(
- [
- 'amount' => 2000,
- 'currency' => 'usd',
- 'description' => 'Top-up for Jenny Rosen',
- 'statement_descriptor' => 'Top-up',
- ]
- );
+ $result = $this->client->topups->create([
+ 'amount' => 2000,
+ 'currency' => 'usd',
+ 'description' => 'Top-up for Jenny Rosen',
+ 'statement_descriptor' => 'Top-up',
+ ]);
static::assertInstanceOf(\Stripe\Topup::class, $result);
}
@@ -3550,14 +3538,12 @@ public function testListTransfer()
public function testCreateTransfer()
{
$this->expectsRequest('post', '/v1/transfers');
- $result = $this->client->transfers->create(
- [
- 'amount' => 400,
- 'currency' => 'usd',
- 'destination' => 'acct_xxxxxxxxxxxxx',
- 'transfer_group' => 'ORDER_95',
- ]
- );
+ $result = $this->client->transfers->create([
+ 'amount' => 400,
+ 'currency' => 'usd',
+ 'destination' => 'acct_xxxxxxxxxxxxx',
+ 'transfer_group' => 'ORDER_95',
+ ]);
static::assertInstanceOf(\Stripe\Transfer::class, $result);
}
@@ -3630,9 +3616,10 @@ public function testUpdateTransferReversal()
public function testListCreditReversal()
{
$this->expectsRequest('get', '/v1/treasury/credit_reversals');
- $result = $this->client->treasury->creditReversals->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->creditReversals->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\CreditReversal::class, $result->data[0]);
}
@@ -3640,9 +3627,9 @@ public function testListCreditReversal()
public function testCreateCreditReversal()
{
$this->expectsRequest('post', '/v1/treasury/credit_reversals');
- $result = $this->client->treasury->creditReversals->create(
- ['received_credit' => 'rc_xxxxxxxxxxxxx']
- );
+ $result = $this->client->treasury->creditReversals->create([
+ 'received_credit' => 'rc_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Treasury\CreditReversal::class, $result);
}
@@ -3662,9 +3649,10 @@ public function testRetrieveCreditReversal()
public function testListDebitReversal()
{
$this->expectsRequest('get', '/v1/treasury/debit_reversals');
- $result = $this->client->treasury->debitReversals->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->debitReversals->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\DebitReversal::class, $result->data[0]);
}
@@ -3672,9 +3660,9 @@ public function testListDebitReversal()
public function testCreateDebitReversal()
{
$this->expectsRequest('post', '/v1/treasury/debit_reversals');
- $result = $this->client->treasury->debitReversals->create(
- ['received_debit' => 'rd_xxxxxxxxxxxxx']
- );
+ $result = $this->client->treasury->debitReversals->create([
+ 'received_debit' => 'rd_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Treasury\DebitReversal::class, $result);
}
@@ -3702,9 +3690,10 @@ public function testListFinancialAccount()
public function testCreateFinancialAccount()
{
$this->expectsRequest('post', '/v1/treasury/financial_accounts');
- $result = $this->client->treasury->financialAccounts->create(
- ['supported_currencies' => ['usd'], 'features' => []]
- );
+ $result = $this->client->treasury->financialAccounts->create([
+ 'supported_currencies' => ['usd'],
+ 'features' => [],
+ ]);
static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result);
}
@@ -3750,9 +3739,10 @@ public function testRetrieveFeaturesFinancialAccount()
public function testListInboundTransfer()
{
$this->expectsRequest('get', '/v1/treasury/inbound_transfers');
- $result = $this->client->treasury->inboundTransfers->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->inboundTransfers->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result->data[0]);
}
@@ -3760,15 +3750,13 @@ public function testListInboundTransfer()
public function testCreateInboundTransfer()
{
$this->expectsRequest('post', '/v1/treasury/inbound_transfers');
- $result = $this->client->treasury->inboundTransfers->create(
- [
- 'financial_account' => 'fa_xxxxxxxxxxxxx',
- 'amount' => 10000,
- 'currency' => 'usd',
- 'origin_payment_method' => 'pm_xxxxxxxxxxxxx',
- 'description' => 'InboundTransfer from my bank account',
- ]
- );
+ $result = $this->client->treasury->inboundTransfers->create([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'amount' => 10000,
+ 'currency' => 'usd',
+ 'origin_payment_method' => 'pm_xxxxxxxxxxxxx',
+ 'description' => 'InboundTransfer from my bank account',
+ ]);
static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result);
}
@@ -3801,9 +3789,10 @@ public function testCancelInboundTransfer()
public function testListOutboundPayment()
{
$this->expectsRequest('get', '/v1/treasury/outbound_payments');
- $result = $this->client->treasury->outboundPayments->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->outboundPayments->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result->data[0]);
}
@@ -3811,16 +3800,14 @@ public function testListOutboundPayment()
public function testCreateOutboundPayment()
{
$this->expectsRequest('post', '/v1/treasury/outbound_payments');
- $result = $this->client->treasury->outboundPayments->create(
- [
- 'financial_account' => 'fa_xxxxxxxxxxxxx',
- 'amount' => 10000,
- 'currency' => 'usd',
- 'customer' => 'cus_xxxxxxxxxxxxx',
- 'destination_payment_method' => 'pm_xxxxxxxxxxxxx',
- 'description' => 'OutboundPayment to a 3rd party',
- ]
- );
+ $result = $this->client->treasury->outboundPayments->create([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'amount' => 10000,
+ 'currency' => 'usd',
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ 'destination_payment_method' => 'pm_xxxxxxxxxxxxx',
+ 'description' => 'OutboundPayment to a 3rd party',
+ ]);
static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result);
}
@@ -3853,9 +3840,10 @@ public function testCancelOutboundPayment()
public function testListOutboundTransfer()
{
$this->expectsRequest('get', '/v1/treasury/outbound_transfers');
- $result = $this->client->treasury->outboundTransfers->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->outboundTransfers->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result->data[0]);
}
@@ -3863,15 +3851,13 @@ public function testListOutboundTransfer()
public function testCreateOutboundTransfer()
{
$this->expectsRequest('post', '/v1/treasury/outbound_transfers');
- $result = $this->client->treasury->outboundTransfers->create(
- [
- 'financial_account' => 'fa_xxxxxxxxxxxxx',
- 'destination_payment_method' => 'pm_xxxxxxxxxxxxx',
- 'amount' => 500,
- 'currency' => 'usd',
- 'description' => 'OutboundTransfer to my external bank account',
- ]
- );
+ $result = $this->client->treasury->outboundTransfers->create([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'destination_payment_method' => 'pm_xxxxxxxxxxxxx',
+ 'amount' => 500,
+ 'currency' => 'usd',
+ 'description' => 'OutboundTransfer to my external bank account',
+ ]);
static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result);
}
@@ -3904,9 +3890,10 @@ public function testCancelOutboundTransfer()
public function testListReceivedCredit()
{
$this->expectsRequest('get', '/v1/treasury/received_credits');
- $result = $this->client->treasury->receivedCredits->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->receivedCredits->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\ReceivedCredit::class, $result->data[0]);
}
@@ -3927,9 +3914,10 @@ public function testRetrieveReceivedCredit()
public function testListReceivedDebit()
{
$this->expectsRequest('get', '/v1/treasury/received_debits');
- $result = $this->client->treasury->receivedDebits->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->receivedDebits->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\ReceivedDebit::class, $result->data[0]);
}
@@ -3950,9 +3938,10 @@ public function testRetrieveReceivedDebit()
public function testListTransactionEntry()
{
$this->expectsRequest('get', '/v1/treasury/transaction_entries');
- $result = $this->client->treasury->transactionEntries->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->transactionEntries->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\TransactionEntry::class, $result->data[0]);
}
@@ -3973,9 +3962,10 @@ public function testRetrieveTransactionEntry()
public function testListTransaction2()
{
$this->expectsRequest('get', '/v1/treasury/transactions');
- $result = $this->client->treasury->transactions->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->transactions->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\Transaction::class, $result->data[0]);
}
@@ -4031,9 +4021,10 @@ public function testCreateFromCalculationTransaction()
'post',
'/v1/tax/transactions/create_from_calculation'
);
- $result = $this->client->tax->transactions->createFromCalculation(
- ['calculation' => 'xxx', 'reference' => 'yyy']
- );
+ $result = $this->client->tax->transactions->createFromCalculation([
+ 'calculation' => 'xxx',
+ 'reference' => 'yyy',
+ ]);
static::assertInstanceOf(\Stripe\Tax\Transaction::class, $result);
}
@@ -4048,13 +4039,14 @@ public function testListLineItemsCalculation()
public function testCreatePaymentIntent3()
{
$this->expectsRequest('post', '/v1/payment_intents');
- $result = $this->client->paymentIntents->create(
- [
- 'amount' => 200,
- 'currency' => 'usd',
- 'payment_method_data' => ['type' => 'p24', 'p24' => ['bank' => 'blik']],
- ]
- );
+ $result = $this->client->paymentIntents->create([
+ 'amount' => 200,
+ 'currency' => 'usd',
+ 'payment_method_data' => [
+ 'type' => 'p24',
+ 'p24' => ['bank' => 'blik'],
+ ],
+ ]);
static::assertInstanceOf(\Stripe\PaymentIntent::class, $result);
}
}
From ee453038dda4dc7efbbd6326cf4e8f8cede1eb81 Mon Sep 17 00:00:00 2001
From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Mon, 8 May 2023 18:09:06 +0000
Subject: [PATCH 15/25] Update generated code for v328
---
OPENAPI_VERSION | 2 +-
tests/Stripe/GeneratedExamplesTest.php | 1078 ++++++++++++------------
2 files changed, 536 insertions(+), 544 deletions(-)
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index 2ddfeaaf7..892bbd994 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v319
\ No newline at end of file
+v328
\ No newline at end of file
diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php
index 3f2c3c5f1..b6c99c790 100644
--- a/tests/Stripe/GeneratedExamplesTest.php
+++ b/tests/Stripe/GeneratedExamplesTest.php
@@ -24,9 +24,10 @@ protected function setUpService()
public function testListSecret()
{
$this->expectsRequest('get', '/v1/apps/secrets');
- $result = $this->client->apps->secrets->all(
- ['scope' => ['type' => 'account'], 'limit' => 2]
- );
+ $result = $this->client->apps->secrets->all([
+ 'scope' => ['type' => 'account'],
+ 'limit' => 2,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Apps\Secret::class, $result->data[0]);
}
@@ -34,56 +35,60 @@ public function testListSecret()
public function testCreateSecret()
{
$this->expectsRequest('post', '/v1/apps/secrets');
- $result = $this->client->apps->secrets->create(
- [
- 'name' => 'sec_123',
- 'payload' => 'very secret string',
- 'scope' => ['type' => 'account'],
- ]
- );
+ $result = $this->client->apps->secrets->create([
+ 'name' => 'sec_123',
+ 'payload' => 'very secret string',
+ 'scope' => ['type' => 'account'],
+ ]);
static::assertInstanceOf(\Stripe\Apps\Secret::class, $result);
}
public function testDeleteWhereSecret()
{
$this->expectsRequest('post', '/v1/apps/secrets/delete');
- $result = $this->client->apps->secrets->deleteWhere(
- ['name' => 'my-api-key', 'scope' => ['type' => 'account']]
- );
+ $result = $this->client->apps->secrets->deleteWhere([
+ 'name' => 'my-api-key',
+ 'scope' => ['type' => 'account'],
+ ]);
static::assertInstanceOf(\Stripe\Apps\Secret::class, $result);
}
public function testFindSecret()
{
$this->expectsRequest('get', '/v1/apps/secrets/find');
- $result = $this->client->apps->secrets->find(
- ['name' => 'sec_123', 'scope' => ['type' => 'account']]
- );
+ $result = $this->client->apps->secrets->find([
+ 'name' => 'sec_123',
+ 'scope' => ['type' => 'account'],
+ ]);
static::assertInstanceOf(\Stripe\Apps\Secret::class, $result);
}
public function testCreateSession()
{
$this->expectsRequest('post', '/v1/checkout/sessions');
- $result = $this->client->checkout->sessions->create(
- [
- 'success_url' => 'https://example.com/success',
- 'cancel_url' => 'https://example.com/cancel',
- 'mode' => 'payment',
- 'shipping_options' => [
- ['shipping_rate' => 'shr_standard'],
- [
- 'shipping_rate_data' => [
- 'display_name' => 'Standard',
- 'delivery_estimate' => [
- 'minimum' => ['unit' => 'day', 'value' => 5],
- 'maximum' => ['unit' => 'day', 'value' => 7],
+ $result = $this->client->checkout->sessions->create([
+ 'success_url' => 'https://example.com/success',
+ 'cancel_url' => 'https://example.com/cancel',
+ 'mode' => 'payment',
+ 'shipping_options' => [
+ ['shipping_rate' => 'shr_standard'],
+ [
+ 'shipping_rate_data' => [
+ 'display_name' => 'Standard',
+ 'delivery_estimate' => [
+ 'minimum' => [
+ 'unit' => 'day',
+ 'value' => 5,
+ ],
+ 'maximum' => [
+ 'unit' => 'day',
+ 'value' => 7,
],
],
],
],
- ]
- );
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Checkout\Session::class, $result);
}
@@ -197,12 +202,13 @@ public function testRefreshAccount()
public function testCreateSession2()
{
$this->expectsRequest('post', '/v1/financial_connections/sessions');
- $result = $this->client->financialConnections->sessions->create(
- [
- 'account_holder' => ['type' => 'customer', 'customer' => 'cus_123'],
- 'permissions' => ['balances'],
- ]
- );
+ $result = $this->client->financialConnections->sessions->create([
+ 'account_holder' => [
+ 'type' => 'customer',
+ 'customer' => 'cus_123',
+ ],
+ 'permissions' => ['balances'],
+ ]);
static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result);
}
@@ -222,22 +228,20 @@ public function testRetrieveSession()
public function testUpcomingInvoice()
{
$this->expectsRequest('get', '/v1/invoices/upcoming');
- $result = $this->client->invoices->upcoming(
- ['customer' => 'cus_9utnxg47pWjV1e']
- );
+ $result = $this->client->invoices->upcoming([
+ 'customer' => 'cus_9utnxg47pWjV1e',
+ ]);
static::assertInstanceOf(\Stripe\Invoice::class, $result);
}
public function testCreatePaymentIntent()
{
$this->expectsRequest('post', '/v1/payment_intents');
- $result = $this->client->paymentIntents->create(
- [
- 'amount' => 1099,
- 'currency' => 'eur',
- 'automatic_payment_methods' => ['enabled' => true],
- ]
- );
+ $result = $this->client->paymentIntents->create([
+ 'amount' => 1099,
+ 'currency' => 'eur',
+ 'automatic_payment_methods' => ['enabled' => true],
+ ]);
static::assertInstanceOf(\Stripe\PaymentIntent::class, $result);
}
@@ -257,9 +261,14 @@ public function testVerifyMicrodepositsPaymentIntent()
public function testCreatePaymentLink()
{
$this->expectsRequest('post', '/v1/payment_links');
- $result = $this->client->paymentLinks->create(
- ['line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 1]]]
- );
+ $result = $this->client->paymentLinks->create([
+ 'line_items' => [
+ [
+ 'price' => 'price_xxxxxxxxxxxxx',
+ 'quantity' => 1,
+ ],
+ ],
+ ]);
static::assertInstanceOf(\Stripe\PaymentLink::class, $result);
}
@@ -281,27 +290,26 @@ public function testListLineItemsPaymentLink()
public function testCreatePrice()
{
$this->expectsRequest('post', '/v1/prices');
- $result = $this->client->prices->create(
- [
- 'unit_amount' => 2000,
- 'currency' => 'usd',
- 'currency_options' => [
- 'uah' => ['unit_amount' => 5000],
- 'eur' => ['unit_amount' => 1800],
- ],
- 'recurring' => ['interval' => 'month'],
- 'product' => 'prod_xxxxxxxxxxxxx',
- ]
- );
+ $result = $this->client->prices->create([
+ 'unit_amount' => 2000,
+ 'currency' => 'usd',
+ 'currency_options' => [
+ 'uah' => ['unit_amount' => 5000],
+ 'eur' => ['unit_amount' => 1800],
+ ],
+ 'recurring' => ['interval' => 'month'],
+ 'product' => 'prod_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Price::class, $result);
}
public function testListSetupAttempt()
{
$this->expectsRequest('get', '/v1/setup_attempts');
- $result = $this->client->setupAttempts->all(
- ['limit' => 3, 'setup_intent' => 'si_xyz']
- );
+ $result = $this->client->setupAttempts->all([
+ 'limit' => 3,
+ 'setup_intent' => 'si_xyz',
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\SetupAttempt::class, $result->data[0]);
}
@@ -330,13 +338,14 @@ public function testListShippingRate()
public function testCreateShippingRate()
{
$this->expectsRequest('post', '/v1/shipping_rates');
- $result = $this->client->shippingRates->create(
- [
- 'display_name' => 'Sample Shipper',
- 'fixed_amount' => ['currency' => 'usd', 'amount' => 400],
- 'type' => 'fixed_amount',
- ]
- );
+ $result = $this->client->shippingRates->create([
+ 'display_name' => 'Sample Shipper',
+ 'fixed_amount' => [
+ 'currency' => 'usd',
+ 'amount' => 400,
+ ],
+ 'type' => 'fixed_amount',
+ ]);
static::assertInstanceOf(\Stripe\ShippingRate::class, $result);
}
@@ -380,7 +389,10 @@ public function testFundCashBalanceCustomer()
);
$result = $this->client->testHelpers->customers->fundCashBalance(
'cus_123',
- ['amount' => 30, 'currency' => 'eur']
+ [
+ 'amount' => 30,
+ 'currency' => 'eur',
+ ]
);
static::assertInstanceOf(\Stripe\CustomerCashBalanceTransaction::class, $result);
}
@@ -455,9 +467,10 @@ public function testListTestClock()
public function testCreateTestClock()
{
$this->expectsRequest('post', '/v1/test_helpers/test_clocks');
- $result = $this->client->testHelpers->testClocks->create(
- ['frozen_time' => 123, 'name' => 'cogsworth']
- );
+ $result = $this->client->testHelpers->testClocks->create([
+ 'frozen_time' => 123,
+ 'name' => 'cogsworth',
+ ]);
static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result);
}
@@ -569,58 +582,50 @@ public function testReturnOutboundTransferOutboundTransfer()
public function testCreateReceivedCredit()
{
$this->expectsRequest('post', '/v1/test_helpers/treasury/received_credits');
- $result = $this->client->testHelpers->treasury->receivedCredits->create(
- [
- 'financial_account' => 'fa_123',
- 'network' => 'ach',
- 'amount' => 1234,
- 'currency' => 'usd',
- ]
- );
+ $result = $this->client->testHelpers->treasury->receivedCredits->create([
+ 'financial_account' => 'fa_123',
+ 'network' => 'ach',
+ 'amount' => 1234,
+ 'currency' => 'usd',
+ ]);
static::assertInstanceOf(\Stripe\Treasury\ReceivedCredit::class, $result);
}
public function testCreateReceivedDebit()
{
$this->expectsRequest('post', '/v1/test_helpers/treasury/received_debits');
- $result = $this->client->testHelpers->treasury->receivedDebits->create(
- [
- 'financial_account' => 'fa_123',
- 'network' => 'ach',
- 'amount' => 1234,
- 'currency' => 'usd',
- ]
- );
+ $result = $this->client->testHelpers->treasury->receivedDebits->create([
+ 'financial_account' => 'fa_123',
+ 'network' => 'ach',
+ 'amount' => 1234,
+ 'currency' => 'usd',
+ ]);
static::assertInstanceOf(\Stripe\Treasury\ReceivedDebit::class, $result);
}
public function testCreateToken()
{
$this->expectsRequest('post', '/v1/tokens');
- $result = $this->client->tokens->create(
- [
- 'card' => [
- 'number' => '4242424242424242',
- 'exp_month' => '5',
- 'exp_year' => '2023',
- 'cvc' => '314',
- ],
- ]
- );
+ $result = $this->client->tokens->create([
+ 'card' => [
+ 'number' => '4242424242424242',
+ 'exp_month' => '5',
+ 'exp_year' => '2023',
+ 'cvc' => '314',
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Token::class, $result);
}
public function testCreateAccountLink()
{
$this->expectsRequest('post', '/v1/account_links');
- $result = $this->client->accountLinks->create(
- [
- 'account' => 'acct_xxxxxxxxxxxxx',
- 'refresh_url' => 'https://example.com/reauth',
- 'return_url' => 'https://example.com/return',
- 'type' => 'account_onboarding',
- ]
- );
+ $result = $this->client->accountLinks->create([
+ 'account' => 'acct_xxxxxxxxxxxxx',
+ 'refresh_url' => 'https://example.com/reauth',
+ 'return_url' => 'https://example.com/return',
+ 'type' => 'account_onboarding',
+ ]);
static::assertInstanceOf(\Stripe\AccountLink::class, $result);
}
@@ -635,17 +640,15 @@ public function testListAccount2()
public function testCreateAccount()
{
$this->expectsRequest('post', '/v1/accounts');
- $result = $this->client->accounts->create(
- [
- 'type' => 'custom',
- 'country' => 'US',
- 'email' => 'jenny.rosen@example.com',
- 'capabilities' => [
- 'card_payments' => ['requested' => true],
- 'transfers' => ['requested' => true],
- ],
- ]
- );
+ $result = $this->client->accounts->create([
+ 'type' => 'custom',
+ 'country' => 'US',
+ 'email' => 'jenny.rosen@example.com',
+ 'capabilities' => [
+ 'card_payments' => ['requested' => true],
+ 'transfers' => ['requested' => true],
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Account::class, $result);
}
@@ -754,7 +757,10 @@ public function testCreatePerson()
$this->expectsRequest('post', '/v1/accounts/acct_xxxxxxxxxxxxx/persons');
$result = $this->client->accounts->createPerson(
'acct_xxxxxxxxxxxxx',
- ['first_name' => 'Jane', 'last_name' => 'Diaz']
+ [
+ 'first_name' => 'Jane',
+ 'last_name' => 'Diaz',
+ ]
);
static::assertInstanceOf(\Stripe\Person::class, $result);
}
@@ -874,9 +880,10 @@ public function testUpdateApplicationFeeRefund()
public function testListSecret2()
{
$this->expectsRequest('get', '/v1/apps/secrets');
- $result = $this->client->apps->secrets->all(
- ['scope' => ['type' => 'account'], 'limit' => 2]
- );
+ $result = $this->client->apps->secrets->all([
+ 'scope' => ['type' => 'account'],
+ 'limit' => 2,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Apps\Secret::class, $result->data[0]);
}
@@ -884,13 +891,11 @@ public function testListSecret2()
public function testCreateSecret2()
{
$this->expectsRequest('post', '/v1/apps/secrets');
- $result = $this->client->apps->secrets->create(
- [
- 'name' => 'my-api-key',
- 'payload' => 'secret_key_xxxxxx',
- 'scope' => ['type' => 'account'],
- ]
- );
+ $result = $this->client->apps->secrets->create([
+ 'name' => 'my-api-key',
+ 'payload' => 'secret_key_xxxxxx',
+ 'scope' => ['type' => 'account'],
+ ]);
static::assertInstanceOf(\Stripe\Apps\Secret::class, $result);
}
@@ -954,12 +959,10 @@ public function testUpdateConfiguration2()
public function testCreateSession3()
{
$this->expectsRequest('post', '/v1/billing_portal/sessions');
- $result = $this->client->billingPortal->sessions->create(
- [
- 'customer' => 'cus_xxxxxxxxxxxxx',
- 'return_url' => 'https://example.com/account',
- ]
- );
+ $result = $this->client->billingPortal->sessions->create([
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ 'return_url' => 'https://example.com/account',
+ ]);
static::assertInstanceOf(\Stripe\BillingPortal\Session::class, $result);
}
@@ -974,14 +977,12 @@ public function testListCharge()
public function testCreateCharge()
{
$this->expectsRequest('post', '/v1/charges');
- $result = $this->client->charges->create(
- [
- 'amount' => 2000,
- 'currency' => 'usd',
- 'source' => 'tok_xxxx',
- 'description' => 'My First Test Charge (created for API docs at https://www.stripe.com/docs/api)',
- ]
- );
+ $result = $this->client->charges->create([
+ 'amount' => 2000,
+ 'currency' => 'usd',
+ 'source' => 'tok_xxxx',
+ 'description' => 'My First Test Charge (created for API docs at https://www.stripe.com/docs/api)',
+ ]);
static::assertInstanceOf(\Stripe\Charge::class, $result);
}
@@ -1012,9 +1013,9 @@ public function testCaptureCharge()
public function testSearchCharge()
{
$this->expectsRequest('get', '/v1/charges/search');
- $result = $this->client->charges->search(
- ['query' => 'amount>999 AND metadata[\'order_id\']:\'6735\'']
- );
+ $result = $this->client->charges->search([
+ 'query' => 'amount>999 AND metadata[\'order_id\']:\'6735\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Charge::class, $result->data[0]);
}
@@ -1030,13 +1031,16 @@ public function testListSession()
public function testCreateSession4()
{
$this->expectsRequest('post', '/v1/checkout/sessions');
- $result = $this->client->checkout->sessions->create(
- [
- 'success_url' => 'https://example.com/success',
- 'line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 2]],
- 'mode' => 'payment',
- ]
- );
+ $result = $this->client->checkout->sessions->create([
+ 'success_url' => 'https://example.com/success',
+ 'line_items' => [
+ [
+ 'price' => 'price_xxxxxxxxxxxxx',
+ 'quantity' => 2,
+ ],
+ ],
+ 'mode' => 'payment',
+ ]);
static::assertInstanceOf(\Stripe\Checkout\Session::class, $result);
}
@@ -1089,13 +1093,11 @@ public function testListCoupon()
public function testCreateCoupon()
{
$this->expectsRequest('post', '/v1/coupons');
- $result = $this->client->coupons->create(
- [
- 'percent_off' => 25.5,
- 'duration' => 'repeating',
- 'duration_in_months' => 3,
- ]
- );
+ $result = $this->client->coupons->create([
+ 'percent_off' => 25.5,
+ 'duration' => 'repeating',
+ 'duration_in_months' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Coupon::class, $result);
}
@@ -1134,18 +1136,16 @@ public function testListCreditNote()
public function testCreateCreditNote()
{
$this->expectsRequest('post', '/v1/credit_notes');
- $result = $this->client->creditNotes->create(
- [
- 'invoice' => 'in_xxxxxxxxxxxxx',
- 'lines' => [
- [
- 'type' => 'invoice_line_item',
- 'invoice_line_item' => 'il_xxxxxxxxxxxxx',
- 'quantity' => 1,
- ],
+ $result = $this->client->creditNotes->create([
+ 'invoice' => 'in_xxxxxxxxxxxxx',
+ 'lines' => [
+ [
+ 'type' => 'invoice_line_item',
+ 'invoice_line_item' => 'il_xxxxxxxxxxxxx',
+ 'quantity' => 1,
],
- ]
- );
+ ],
+ ]);
static::assertInstanceOf(\Stripe\CreditNote::class, $result);
}
@@ -1173,18 +1173,16 @@ public function testListCreditNoteLineItem()
public function testPreviewCreditNote()
{
$this->expectsRequest('get', '/v1/credit_notes/preview');
- $result = $this->client->creditNotes->preview(
- [
- 'invoice' => 'in_xxxxxxxxxxxxx',
- 'lines' => [
- [
- 'type' => 'invoice_line_item',
- 'invoice_line_item' => 'il_xxxxxxxxxxxxx',
- 'quantity' => 1,
- ],
+ $result = $this->client->creditNotes->preview([
+ 'invoice' => 'in_xxxxxxxxxxxxx',
+ 'lines' => [
+ [
+ 'type' => 'invoice_line_item',
+ 'invoice_line_item' => 'il_xxxxxxxxxxxxx',
+ 'quantity' => 1,
],
- ]
- );
+ ],
+ ]);
static::assertInstanceOf(\Stripe\CreditNote::class, $result);
}
@@ -1207,11 +1205,9 @@ public function testListCustomer2()
public function testCreateCustomer()
{
$this->expectsRequest('post', '/v1/customers');
- $result = $this->client->customers->create(
- [
- 'description' => 'My First Test Customer (created for API docs at https://www.stripe.com/docs/api)',
- ]
- );
+ $result = $this->client->customers->create([
+ 'description' => 'My First Test Customer (created for API docs at https://www.stripe.com/docs/api)',
+ ]);
static::assertInstanceOf(\Stripe\Customer::class, $result);
}
@@ -1261,7 +1257,10 @@ public function testCreateCustomerBalanceTransaction()
);
$result = $this->client->customers->createBalanceTransaction(
'cus_xxxxxxxxxxxxx',
- ['amount' => -500, 'currency' => 'usd']
+ [
+ 'amount' => -500,
+ 'currency' => 'usd',
+ ]
);
static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result);
}
@@ -1310,7 +1309,10 @@ public function testCreateTaxId()
$this->expectsRequest('post', '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids');
$result = $this->client->customers->createTaxId(
'cus_xxxxxxxxxxxxx',
- ['type' => 'eu_vat', 'value' => 'DE123456789']
+ [
+ 'type' => 'eu_vat',
+ 'value' => 'DE123456789',
+ ]
);
static::assertInstanceOf(\Stripe\TaxId::class, $result);
}
@@ -1346,9 +1348,9 @@ public function testRetrieveTaxId()
public function testSearchCustomer()
{
$this->expectsRequest('get', '/v1/customers/search');
- $result = $this->client->customers->search(
- ['query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\'']
- );
+ $result = $this->client->customers->search([
+ 'query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]);
}
@@ -1356,9 +1358,9 @@ public function testSearchCustomer()
public function testSearchCustomer2()
{
$this->expectsRequest('get', '/v1/customers/search');
- $result = $this->client->customers->search(
- ['query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\'']
- );
+ $result = $this->client->customers->search([
+ 'query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]);
}
@@ -1421,9 +1423,9 @@ public function testListFileLink()
public function testCreateFileLink()
{
$this->expectsRequest('post', '/v1/file_links');
- $result = $this->client->fileLinks->create(
- ['file' => 'file_xxxxxxxxxxxxx']
- );
+ $result = $this->client->fileLinks->create([
+ 'file' => 'file_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\FileLink::class, $result);
}
@@ -1462,9 +1464,9 @@ public function testRetrieveFile()
public function testListAccount3()
{
$this->expectsRequest('get', '/v1/financial_connections/accounts');
- $result = $this->client->financialConnections->accounts->all(
- ['account_holder' => ['customer' => 'cus_xxxxxxxxxxxxx']]
- );
+ $result = $this->client->financialConnections->accounts->all([
+ 'account_holder' => ['customer' => 'cus_xxxxxxxxxxxxx'],
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result->data[0]);
}
@@ -1503,7 +1505,10 @@ public function testListOwnersAccount2()
);
$result = $this->client->financialConnections->accounts->allOwners(
'fca_xxxxxxxxxxxxx',
- ['limit' => 3, 'ownership' => 'fcaowns_xxxxxxxxxxxxx']
+ [
+ 'limit' => 3,
+ 'ownership' => 'fcaowns_xxxxxxxxxxxxx',
+ ]
);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\FinancialConnections\AccountOwner::class, $result->data[0]);
@@ -1512,16 +1517,14 @@ public function testListOwnersAccount2()
public function testCreateSession5()
{
$this->expectsRequest('post', '/v1/financial_connections/sessions');
- $result = $this->client->financialConnections->sessions->create(
- [
- 'account_holder' => [
- 'type' => 'customer',
- 'customer' => 'cus_xxxxxxxxxxxxx',
- ],
- 'permissions' => ['payment_method', 'balances'],
- 'filters' => ['countries' => ['US']],
- ]
- );
+ $result = $this->client->financialConnections->sessions->create([
+ 'account_holder' => [
+ 'type' => 'customer',
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ ],
+ 'permissions' => ['payment_method', 'balances'],
+ 'filters' => ['countries' => ['US']],
+ ]);
static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result);
}
@@ -1562,9 +1565,9 @@ public function testRetrieveVerificationReport()
public function testListVerificationSession()
{
$this->expectsRequest('get', '/v1/identity/verification_sessions');
- $result = $this->client->identity->verificationSessions->all(
- ['limit' => 3]
- );
+ $result = $this->client->identity->verificationSessions->all([
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result->data[0]);
}
@@ -1572,9 +1575,9 @@ public function testListVerificationSession()
public function testCreateVerificationSession()
{
$this->expectsRequest('post', '/v1/identity/verification_sessions');
- $result = $this->client->identity->verificationSessions->create(
- ['type' => 'document']
- );
+ $result = $this->client->identity->verificationSessions->create([
+ 'type' => 'document',
+ ]);
static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result);
}
@@ -1641,9 +1644,10 @@ public function testListInvoiceItem()
public function testCreateInvoiceItem()
{
$this->expectsRequest('post', '/v1/invoiceitems');
- $result = $this->client->invoiceItems->create(
- ['customer' => 'cus_xxxxxxxxxxxxx', 'price' => 'price_xxxxxxxxxxxxx']
- );
+ $result = $this->client->invoiceItems->create([
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ 'price' => 'price_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\InvoiceItem::class, $result);
}
@@ -1682,9 +1686,9 @@ public function testListInvoice()
public function testCreateInvoice()
{
$this->expectsRequest('post', '/v1/invoices');
- $result = $this->client->invoices->create(
- ['customer' => 'cus_xxxxxxxxxxxxx']
- );
+ $result = $this->client->invoices->create([
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Invoice::class, $result);
}
@@ -1766,9 +1770,9 @@ public function testVoidInvoiceInvoice()
public function testSearchInvoice()
{
$this->expectsRequest('get', '/v1/invoices/search');
- $result = $this->client->invoices->search(
- ['query' => 'total>999 AND metadata[\'order_id\']:\'6735\'']
- );
+ $result = $this->client->invoices->search([
+ 'query' => 'total>999 AND metadata[\'order_id\']:\'6735\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Invoice::class, $result->data[0]);
}
@@ -1844,23 +1848,21 @@ public function testListCardholder()
public function testCreateCardholder()
{
$this->expectsRequest('post', '/v1/issuing/cardholders');
- $result = $this->client->issuing->cardholders->create(
- [
- 'type' => 'individual',
- 'name' => 'Jenny Rosen',
- 'email' => 'jenny.rosen@example.com',
- 'phone_number' => '+18888675309',
- 'billing' => [
- 'address' => [
- 'line1' => '1234 Main Street',
- 'city' => 'San Francisco',
- 'state' => 'CA',
- 'country' => 'US',
- 'postal_code' => '94111',
- ],
+ $result = $this->client->issuing->cardholders->create([
+ 'type' => 'individual',
+ 'name' => 'Jenny Rosen',
+ 'email' => 'jenny.rosen@example.com',
+ 'phone_number' => '+18888675309',
+ 'billing' => [
+ 'address' => [
+ 'line1' => '1234 Main Street',
+ 'city' => 'San Francisco',
+ 'state' => 'CA',
+ 'country' => 'US',
+ 'postal_code' => '94111',
],
- ]
- );
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result);
}
@@ -1895,13 +1897,11 @@ public function testListCard()
public function testCreateCard()
{
$this->expectsRequest('post', '/v1/issuing/cards');
- $result = $this->client->issuing->cards->create(
- [
- 'cardholder' => 'ich_xxxxxxxxxxxxx',
- 'currency' => 'usd',
- 'type' => 'virtual',
- ]
- );
+ $result = $this->client->issuing->cards->create([
+ 'cardholder' => 'ich_xxxxxxxxxxxxx',
+ 'currency' => 'usd',
+ 'type' => 'virtual',
+ ]);
static::assertInstanceOf(\Stripe\Issuing\Card::class, $result);
}
@@ -1933,15 +1933,13 @@ public function testListDispute2()
public function testCreateDispute()
{
$this->expectsRequest('post', '/v1/issuing/disputes');
- $result = $this->client->issuing->disputes->create(
- [
- 'transaction' => 'ipi_xxxxxxxxxxxxx',
- 'evidence' => [
- 'reason' => 'fraudulent',
- 'fraudulent' => ['explanation' => 'Purchase was unrecognized.'],
- ],
- ]
- );
+ $result = $this->client->issuing->disputes->create([
+ 'transaction' => 'ipi_xxxxxxxxxxxxx',
+ 'evidence' => [
+ 'reason' => 'fraudulent',
+ 'fraudulent' => ['explanation' => 'Purchase was unrecognized.'],
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result);
}
@@ -2011,13 +2009,11 @@ public function testListPaymentIntent()
public function testCreatePaymentIntent2()
{
$this->expectsRequest('post', '/v1/payment_intents');
- $result = $this->client->paymentIntents->create(
- [
- 'amount' => 2000,
- 'currency' => 'usd',
- 'automatic_payment_methods' => ['enabled' => true],
- ]
- );
+ $result = $this->client->paymentIntents->create([
+ 'amount' => 2000,
+ 'currency' => 'usd',
+ 'automatic_payment_methods' => ['enabled' => true],
+ ]);
static::assertInstanceOf(\Stripe\PaymentIntent::class, $result);
}
@@ -2113,9 +2109,9 @@ public function testVerifyMicrodepositsPaymentIntent2()
public function testSearchPaymentIntent()
{
$this->expectsRequest('get', '/v1/payment_intents/search');
- $result = $this->client->paymentIntents->search(
- ['query' => 'status:\'succeeded\' AND metadata[\'order_id\']:\'6735\'']
- );
+ $result = $this->client->paymentIntents->search([
+ 'query' => 'status:\'succeeded\' AND metadata[\'order_id\']:\'6735\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\PaymentIntent::class, $result->data[0]);
}
@@ -2131,9 +2127,14 @@ public function testListPaymentLink()
public function testCreatePaymentLink2()
{
$this->expectsRequest('post', '/v1/payment_links');
- $result = $this->client->paymentLinks->create(
- ['line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 1]]]
- );
+ $result = $this->client->paymentLinks->create([
+ 'line_items' => [
+ [
+ 'price' => 'price_xxxxxxxxxxxxx',
+ 'quantity' => 1,
+ ],
+ ],
+ ]);
static::assertInstanceOf(\Stripe\PaymentLink::class, $result);
}
@@ -2157,9 +2158,10 @@ public function testUpdatePaymentLink()
public function testListPaymentMethod()
{
$this->expectsRequest('get', '/v1/payment_methods');
- $result = $this->client->paymentMethods->all(
- ['customer' => 'cus_xxxxxxxxxxxxx', 'type' => 'card']
- );
+ $result = $this->client->paymentMethods->all([
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ 'type' => 'card',
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\PaymentMethod::class, $result->data[0]);
}
@@ -2167,17 +2169,15 @@ public function testListPaymentMethod()
public function testCreatePaymentMethod()
{
$this->expectsRequest('post', '/v1/payment_methods');
- $result = $this->client->paymentMethods->create(
- [
- 'type' => 'card',
- 'card' => [
- 'number' => '4242424242424242',
- 'exp_month' => 8,
- 'exp_year' => 2024,
- 'cvc' => '314',
- ],
- ]
- );
+ $result = $this->client->paymentMethods->create([
+ 'type' => 'card',
+ 'card' => [
+ 'number' => '4242424242424242',
+ 'exp_month' => 8,
+ 'exp_year' => 2024,
+ 'cvc' => '314',
+ ],
+ ]);
static::assertInstanceOf(\Stripe\PaymentMethod::class, $result);
}
@@ -2232,9 +2232,10 @@ public function testListPayout()
public function testCreatePayout()
{
$this->expectsRequest('post', '/v1/payouts');
- $result = $this->client->payouts->create(
- ['amount' => 1100, 'currency' => 'usd']
- );
+ $result = $this->client->payouts->create([
+ 'amount' => 1100,
+ 'currency' => 'usd',
+ ]);
static::assertInstanceOf(\Stripe\Payout::class, $result);
}
@@ -2280,28 +2281,24 @@ public function testListPlan()
public function testCreatePlan()
{
$this->expectsRequest('post', '/v1/plans');
- $result = $this->client->plans->create(
- [
- 'amount' => 2000,
- 'currency' => 'usd',
- 'interval' => 'month',
- 'product' => 'prod_xxxxxxxxxxxxx',
- ]
- );
+ $result = $this->client->plans->create([
+ 'amount' => 2000,
+ 'currency' => 'usd',
+ 'interval' => 'month',
+ 'product' => 'prod_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Plan::class, $result);
}
public function testCreatePlan2()
{
$this->expectsRequest('post', '/v1/plans');
- $result = $this->client->plans->create(
- [
- 'amount' => 2000,
- 'currency' => 'usd',
- 'interval' => 'month',
- 'product' => ['name' => 'My product'],
- ]
- );
+ $result = $this->client->plans->create([
+ 'amount' => 2000,
+ 'currency' => 'usd',
+ 'interval' => 'month',
+ 'product' => ['name' => 'My product'],
+ ]);
static::assertInstanceOf(\Stripe\Plan::class, $result);
}
@@ -2340,14 +2337,12 @@ public function testListPrice()
public function testCreatePrice2()
{
$this->expectsRequest('post', '/v1/prices');
- $result = $this->client->prices->create(
- [
- 'unit_amount' => 2000,
- 'currency' => 'usd',
- 'recurring' => ['interval' => 'month'],
- 'product' => 'prod_xxxxxxxxxxxxx',
- ]
- );
+ $result = $this->client->prices->create([
+ 'unit_amount' => 2000,
+ 'currency' => 'usd',
+ 'recurring' => ['interval' => 'month'],
+ 'product' => 'prod_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Price::class, $result);
}
@@ -2371,9 +2366,9 @@ public function testUpdatePrice()
public function testSearchPrice()
{
$this->expectsRequest('get', '/v1/prices/search');
- $result = $this->client->prices->search(
- ['query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\'']
- );
+ $result = $this->client->prices->search([
+ 'query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Price::class, $result->data[0]);
}
@@ -2420,9 +2415,9 @@ public function testUpdateProduct()
public function testSearchProduct()
{
$this->expectsRequest('get', '/v1/products/search');
- $result = $this->client->products->search(
- ['query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\'']
- );
+ $result = $this->client->products->search([
+ 'query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Product::class, $result->data[0]);
}
@@ -2473,12 +2468,15 @@ public function testListQuote()
public function testCreateQuote()
{
$this->expectsRequest('post', '/v1/quotes');
- $result = $this->client->quotes->create(
- [
- 'customer' => 'cus_xxxxxxxxxxxxx',
- 'line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 2]],
- ]
- );
+ $result = $this->client->quotes->create([
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ 'line_items' => [
+ [
+ 'price' => 'price_xxxxxxxxxxxxx',
+ 'quantity' => 2,
+ ],
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Quote::class, $result);
}
@@ -2544,9 +2542,10 @@ public function testRetrieveEarlyFraudWarning()
public function testListValueListItem()
{
$this->expectsRequest('get', '/v1/radar/value_list_items');
- $result = $this->client->radar->valueListItems->all(
- ['limit' => 3, 'value_list' => 'rsl_xxxxxxxxxxxxx']
- );
+ $result = $this->client->radar->valueListItems->all([
+ 'limit' => 3,
+ 'value_list' => 'rsl_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result->data[0]);
}
@@ -2554,9 +2553,10 @@ public function testListValueListItem()
public function testCreateValueListItem()
{
$this->expectsRequest('post', '/v1/radar/value_list_items');
- $result = $this->client->radar->valueListItems->create(
- ['value_list' => 'rsl_xxxxxxxxxxxxx', 'value' => '1.2.3.4']
- );
+ $result = $this->client->radar->valueListItems->create([
+ 'value_list' => 'rsl_xxxxxxxxxxxxx',
+ 'value' => '1.2.3.4',
+ ]);
static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result);
}
@@ -2597,13 +2597,11 @@ public function testListValueList()
public function testCreateValueList()
{
$this->expectsRequest('post', '/v1/radar/value_lists');
- $result = $this->client->radar->valueLists->create(
- [
- 'alias' => 'custom_ip_xxxxxxxxxxxxx',
- 'name' => 'Custom IP Blocklist',
- 'item_type' => 'ip_address',
- ]
- );
+ $result = $this->client->radar->valueLists->create([
+ 'alias' => 'custom_ip_xxxxxxxxxxxxx',
+ 'name' => 'Custom IP Blocklist',
+ 'item_type' => 'ip_address',
+ ]);
static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result);
}
@@ -2684,15 +2682,13 @@ public function testListReportRun()
public function testCreateReportRun()
{
$this->expectsRequest('post', '/v1/reporting/report_runs');
- $result = $this->client->reporting->reportRuns->create(
- [
- 'report_type' => 'balance.summary.1',
- 'parameters' => [
- 'interval_start' => 1522540800,
- 'interval_end' => 1525132800,
- ],
- ]
- );
+ $result = $this->client->reporting->reportRuns->create([
+ 'report_type' => 'balance.summary.1',
+ 'parameters' => [
+ 'interval_start' => 1522540800,
+ 'interval_end' => 1525132800,
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Reporting\ReportRun::class, $result);
}
@@ -2760,9 +2756,9 @@ public function testListSetupIntent()
public function testCreateSetupIntent()
{
$this->expectsRequest('post', '/v1/setup_intents');
- $result = $this->client->setupIntents->create(
- ['payment_method_types' => ['card']]
- );
+ $result = $this->client->setupIntents->create([
+ 'payment_method_types' => ['card'],
+ ]);
static::assertInstanceOf(\Stripe\SetupIntent::class, $result);
}
@@ -2830,13 +2826,14 @@ public function testListShippingRate2()
public function testCreateShippingRate2()
{
$this->expectsRequest('post', '/v1/shipping_rates');
- $result = $this->client->shippingRates->create(
- [
- 'display_name' => 'Ground shipping',
- 'type' => 'fixed_amount',
- 'fixed_amount' => ['amount' => 500, 'currency' => 'usd'],
- ]
- );
+ $result = $this->client->shippingRates->create([
+ 'display_name' => 'Ground shipping',
+ 'type' => 'fixed_amount',
+ 'fixed_amount' => [
+ 'amount' => 500,
+ 'currency' => 'usd',
+ ],
+ ]);
static::assertInstanceOf(\Stripe\ShippingRate::class, $result);
}
@@ -2905,9 +2902,9 @@ public function testUpdateSource()
public function testListSubscriptionItem()
{
$this->expectsRequest('get', '/v1/subscription_items');
- $result = $this->client->subscriptionItems->all(
- ['subscription' => 'sub_xxxxxxxxxxxxx']
- );
+ $result = $this->client->subscriptionItems->all([
+ 'subscription' => 'sub_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result->data[0]);
}
@@ -2915,13 +2912,11 @@ public function testListSubscriptionItem()
public function testCreateSubscriptionItem()
{
$this->expectsRequest('post', '/v1/subscription_items');
- $result = $this->client->subscriptionItems->create(
- [
- 'subscription' => 'sub_xxxxxxxxxxxxx',
- 'price' => 'price_xxxxxxxxxxxxx',
- 'quantity' => 2,
- ]
- );
+ $result = $this->client->subscriptionItems->create([
+ 'subscription' => 'sub_xxxxxxxxxxxxx',
+ 'price' => 'price_xxxxxxxxxxxxx',
+ 'quantity' => 2,
+ ]);
static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result);
}
@@ -2974,7 +2969,10 @@ public function testCreateUsageRecord()
);
$result = $this->client->subscriptionItems->createUsageRecord(
'si_xxxxxxxxxxxxx',
- ['quantity' => 100, 'timestamp' => 1571252444]
+ [
+ 'quantity' => 100,
+ 'timestamp' => 1571252444,
+ ]
);
static::assertInstanceOf(\Stripe\UsageRecord::class, $result);
}
@@ -2990,19 +2988,22 @@ public function testListSubscriptionSchedule()
public function testCreateSubscriptionSchedule()
{
$this->expectsRequest('post', '/v1/subscription_schedules');
- $result = $this->client->subscriptionSchedules->create(
- [
- 'customer' => 'cus_xxxxxxxxxxxxx',
- 'start_date' => 1676070661,
- 'end_behavior' => 'release',
- 'phases' => [
- [
- 'items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 1]],
- 'iterations' => 12,
+ $result = $this->client->subscriptionSchedules->create([
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ 'start_date' => 1676070661,
+ 'end_behavior' => 'release',
+ 'phases' => [
+ [
+ 'items' => [
+ [
+ 'price' => 'price_xxxxxxxxxxxxx',
+ 'quantity' => 1,
+ ],
],
+ 'iterations' => 12,
],
- ]
- );
+ ],
+ ]);
static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result);
}
@@ -3069,12 +3070,10 @@ public function testListSubscription()
public function testCreateSubscription()
{
$this->expectsRequest('post', '/v1/subscriptions');
- $result = $this->client->subscriptions->create(
- [
- 'customer' => 'cus_xxxxxxxxxxxxx',
- 'items' => [['price' => 'price_xxxxxxxxxxxxx']],
- ]
- );
+ $result = $this->client->subscriptions->create([
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ 'items' => [['price' => 'price_xxxxxxxxxxxxx']],
+ ]);
static::assertInstanceOf(\Stripe\Subscription::class, $result);
}
@@ -3105,9 +3104,9 @@ public function testUpdateSubscription()
public function testSearchSubscription()
{
$this->expectsRequest('get', '/v1/subscriptions/search');
- $result = $this->client->subscriptions->search(
- ['query' => 'status:\'active\' AND metadata[\'order_id\']:\'6735\'']
- );
+ $result = $this->client->subscriptions->search([
+ 'query' => 'status:\'active\' AND metadata[\'order_id\']:\'6735\'',
+ ]);
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Subscription::class, $result->data[0]);
}
@@ -3138,15 +3137,13 @@ public function testListTaxRate()
public function testCreateTaxRate()
{
$this->expectsRequest('post', '/v1/tax_rates');
- $result = $this->client->taxRates->create(
- [
- 'display_name' => 'VAT',
- 'description' => 'VAT Germany',
- 'jurisdiction' => 'DE',
- 'percentage' => 16,
- 'inclusive' => false,
- ]
- );
+ $result = $this->client->taxRates->create([
+ 'display_name' => 'VAT',
+ 'description' => 'VAT Germany',
+ 'jurisdiction' => 'DE',
+ 'percentage' => 16,
+ 'inclusive' => false,
+ ]);
static::assertInstanceOf(\Stripe\TaxRate::class, $result);
}
@@ -3232,18 +3229,16 @@ public function testListLocation()
public function testCreateLocation()
{
$this->expectsRequest('post', '/v1/terminal/locations');
- $result = $this->client->terminal->locations->create(
- [
- 'display_name' => 'My First Store',
- 'address' => [
- 'line1' => '1234 Main Street',
- 'city' => 'San Francisco',
- 'postal_code' => '94111',
- 'state' => 'CA',
- 'country' => 'US',
- ],
- ]
- );
+ $result = $this->client->terminal->locations->create([
+ 'display_name' => 'My First Store',
+ 'address' => [
+ 'line1' => '1234 Main Street',
+ 'city' => 'San Francisco',
+ 'postal_code' => '94111',
+ 'state' => 'CA',
+ 'country' => 'US',
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Terminal\Location::class, $result);
}
@@ -3288,13 +3283,11 @@ public function testListReader()
public function testCreateReader()
{
$this->expectsRequest('post', '/v1/terminal/readers');
- $result = $this->client->terminal->readers->create(
- [
- 'registration_code' => 'puppies-plug-could',
- 'label' => 'Blue Rabbit',
- 'location' => 'tml_1234',
- ]
- );
+ $result = $this->client->terminal->readers->create([
+ 'registration_code' => 'puppies-plug-could',
+ 'label' => 'Blue Rabbit',
+ 'location' => 'tml_1234',
+ ]);
static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result);
}
@@ -3378,9 +3371,9 @@ public function testListTestClock2()
public function testCreateTestClock2()
{
$this->expectsRequest('post', '/v1/test_helpers/test_clocks');
- $result = $this->client->testHelpers->testClocks->create(
- ['frozen_time' => 1577836800]
- );
+ $result = $this->client->testHelpers->testClocks->create([
+ 'frozen_time' => 1577836800,
+ ]);
static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result);
}
@@ -3426,56 +3419,53 @@ public function testAdvanceTestClock2()
public function testCreateToken2()
{
$this->expectsRequest('post', '/v1/tokens');
- $result = $this->client->tokens->create(
- [
- 'bank_account' => [
- 'country' => 'US',
- 'currency' => 'usd',
- 'account_holder_name' => 'Jenny Rosen',
- 'account_holder_type' => 'individual',
- 'routing_number' => '110000000',
- 'account_number' => '000123456789',
- ],
- ]
- );
+ $result = $this->client->tokens->create([
+ 'bank_account' => [
+ 'country' => 'US',
+ 'currency' => 'usd',
+ 'account_holder_name' => 'Jenny Rosen',
+ 'account_holder_type' => 'individual',
+ 'routing_number' => '110000000',
+ 'account_number' => '000123456789',
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Token::class, $result);
}
public function testCreateToken3()
{
$this->expectsRequest('post', '/v1/tokens');
- $result = $this->client->tokens->create(
- ['pii' => ['id_number' => '000000000']]
- );
+ $result = $this->client->tokens->create([
+ 'pii' => ['id_number' => '000000000'],
+ ]);
static::assertInstanceOf(\Stripe\Token::class, $result);
}
public function testCreateToken4()
{
$this->expectsRequest('post', '/v1/tokens');
- $result = $this->client->tokens->create(
- [
- 'account' => [
- 'individual' => ['first_name' => 'Jane', 'last_name' => 'Doe'],
- 'tos_shown_and_accepted' => true,
+ $result = $this->client->tokens->create([
+ 'account' => [
+ 'individual' => [
+ 'first_name' => 'Jane',
+ 'last_name' => 'Doe',
],
- ]
- );
+ 'tos_shown_and_accepted' => true,
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Token::class, $result);
}
public function testCreateToken5()
{
$this->expectsRequest('post', '/v1/tokens');
- $result = $this->client->tokens->create(
- [
- 'person' => [
- 'first_name' => 'Jane',
- 'last_name' => 'Doe',
- 'relationship' => ['owner' => true],
- ],
- ]
- );
+ $result = $this->client->tokens->create([
+ 'person' => [
+ 'first_name' => 'Jane',
+ 'last_name' => 'Doe',
+ 'relationship' => ['owner' => true],
+ ],
+ ]);
static::assertInstanceOf(\Stripe\Token::class, $result);
}
@@ -3504,14 +3494,12 @@ public function testListTopup()
public function testCreateTopup()
{
$this->expectsRequest('post', '/v1/topups');
- $result = $this->client->topups->create(
- [
- 'amount' => 2000,
- 'currency' => 'usd',
- 'description' => 'Top-up for Jenny Rosen',
- 'statement_descriptor' => 'Top-up',
- ]
- );
+ $result = $this->client->topups->create([
+ 'amount' => 2000,
+ 'currency' => 'usd',
+ 'description' => 'Top-up for Jenny Rosen',
+ 'statement_descriptor' => 'Top-up',
+ ]);
static::assertInstanceOf(\Stripe\Topup::class, $result);
}
@@ -3550,14 +3538,12 @@ public function testListTransfer()
public function testCreateTransfer()
{
$this->expectsRequest('post', '/v1/transfers');
- $result = $this->client->transfers->create(
- [
- 'amount' => 400,
- 'currency' => 'usd',
- 'destination' => 'acct_xxxxxxxxxxxxx',
- 'transfer_group' => 'ORDER_95',
- ]
- );
+ $result = $this->client->transfers->create([
+ 'amount' => 400,
+ 'currency' => 'usd',
+ 'destination' => 'acct_xxxxxxxxxxxxx',
+ 'transfer_group' => 'ORDER_95',
+ ]);
static::assertInstanceOf(\Stripe\Transfer::class, $result);
}
@@ -3630,9 +3616,10 @@ public function testUpdateTransferReversal()
public function testListCreditReversal()
{
$this->expectsRequest('get', '/v1/treasury/credit_reversals');
- $result = $this->client->treasury->creditReversals->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->creditReversals->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\CreditReversal::class, $result->data[0]);
}
@@ -3640,9 +3627,9 @@ public function testListCreditReversal()
public function testCreateCreditReversal()
{
$this->expectsRequest('post', '/v1/treasury/credit_reversals');
- $result = $this->client->treasury->creditReversals->create(
- ['received_credit' => 'rc_xxxxxxxxxxxxx']
- );
+ $result = $this->client->treasury->creditReversals->create([
+ 'received_credit' => 'rc_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Treasury\CreditReversal::class, $result);
}
@@ -3662,9 +3649,10 @@ public function testRetrieveCreditReversal()
public function testListDebitReversal()
{
$this->expectsRequest('get', '/v1/treasury/debit_reversals');
- $result = $this->client->treasury->debitReversals->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->debitReversals->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\DebitReversal::class, $result->data[0]);
}
@@ -3672,9 +3660,9 @@ public function testListDebitReversal()
public function testCreateDebitReversal()
{
$this->expectsRequest('post', '/v1/treasury/debit_reversals');
- $result = $this->client->treasury->debitReversals->create(
- ['received_debit' => 'rd_xxxxxxxxxxxxx']
- );
+ $result = $this->client->treasury->debitReversals->create([
+ 'received_debit' => 'rd_xxxxxxxxxxxxx',
+ ]);
static::assertInstanceOf(\Stripe\Treasury\DebitReversal::class, $result);
}
@@ -3702,9 +3690,10 @@ public function testListFinancialAccount()
public function testCreateFinancialAccount()
{
$this->expectsRequest('post', '/v1/treasury/financial_accounts');
- $result = $this->client->treasury->financialAccounts->create(
- ['supported_currencies' => ['usd'], 'features' => []]
- );
+ $result = $this->client->treasury->financialAccounts->create([
+ 'supported_currencies' => ['usd'],
+ 'features' => [],
+ ]);
static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result);
}
@@ -3750,9 +3739,10 @@ public function testRetrieveFeaturesFinancialAccount()
public function testListInboundTransfer()
{
$this->expectsRequest('get', '/v1/treasury/inbound_transfers');
- $result = $this->client->treasury->inboundTransfers->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->inboundTransfers->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result->data[0]);
}
@@ -3760,15 +3750,13 @@ public function testListInboundTransfer()
public function testCreateInboundTransfer()
{
$this->expectsRequest('post', '/v1/treasury/inbound_transfers');
- $result = $this->client->treasury->inboundTransfers->create(
- [
- 'financial_account' => 'fa_xxxxxxxxxxxxx',
- 'amount' => 10000,
- 'currency' => 'usd',
- 'origin_payment_method' => 'pm_xxxxxxxxxxxxx',
- 'description' => 'InboundTransfer from my bank account',
- ]
- );
+ $result = $this->client->treasury->inboundTransfers->create([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'amount' => 10000,
+ 'currency' => 'usd',
+ 'origin_payment_method' => 'pm_xxxxxxxxxxxxx',
+ 'description' => 'InboundTransfer from my bank account',
+ ]);
static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result);
}
@@ -3801,9 +3789,10 @@ public function testCancelInboundTransfer()
public function testListOutboundPayment()
{
$this->expectsRequest('get', '/v1/treasury/outbound_payments');
- $result = $this->client->treasury->outboundPayments->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->outboundPayments->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result->data[0]);
}
@@ -3811,16 +3800,14 @@ public function testListOutboundPayment()
public function testCreateOutboundPayment()
{
$this->expectsRequest('post', '/v1/treasury/outbound_payments');
- $result = $this->client->treasury->outboundPayments->create(
- [
- 'financial_account' => 'fa_xxxxxxxxxxxxx',
- 'amount' => 10000,
- 'currency' => 'usd',
- 'customer' => 'cus_xxxxxxxxxxxxx',
- 'destination_payment_method' => 'pm_xxxxxxxxxxxxx',
- 'description' => 'OutboundPayment to a 3rd party',
- ]
- );
+ $result = $this->client->treasury->outboundPayments->create([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'amount' => 10000,
+ 'currency' => 'usd',
+ 'customer' => 'cus_xxxxxxxxxxxxx',
+ 'destination_payment_method' => 'pm_xxxxxxxxxxxxx',
+ 'description' => 'OutboundPayment to a 3rd party',
+ ]);
static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result);
}
@@ -3853,9 +3840,10 @@ public function testCancelOutboundPayment()
public function testListOutboundTransfer()
{
$this->expectsRequest('get', '/v1/treasury/outbound_transfers');
- $result = $this->client->treasury->outboundTransfers->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->outboundTransfers->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result->data[0]);
}
@@ -3863,15 +3851,13 @@ public function testListOutboundTransfer()
public function testCreateOutboundTransfer()
{
$this->expectsRequest('post', '/v1/treasury/outbound_transfers');
- $result = $this->client->treasury->outboundTransfers->create(
- [
- 'financial_account' => 'fa_xxxxxxxxxxxxx',
- 'destination_payment_method' => 'pm_xxxxxxxxxxxxx',
- 'amount' => 500,
- 'currency' => 'usd',
- 'description' => 'OutboundTransfer to my external bank account',
- ]
- );
+ $result = $this->client->treasury->outboundTransfers->create([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'destination_payment_method' => 'pm_xxxxxxxxxxxxx',
+ 'amount' => 500,
+ 'currency' => 'usd',
+ 'description' => 'OutboundTransfer to my external bank account',
+ ]);
static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result);
}
@@ -3904,9 +3890,10 @@ public function testCancelOutboundTransfer()
public function testListReceivedCredit()
{
$this->expectsRequest('get', '/v1/treasury/received_credits');
- $result = $this->client->treasury->receivedCredits->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->receivedCredits->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\ReceivedCredit::class, $result->data[0]);
}
@@ -3927,9 +3914,10 @@ public function testRetrieveReceivedCredit()
public function testListReceivedDebit()
{
$this->expectsRequest('get', '/v1/treasury/received_debits');
- $result = $this->client->treasury->receivedDebits->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->receivedDebits->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\ReceivedDebit::class, $result->data[0]);
}
@@ -3950,9 +3938,10 @@ public function testRetrieveReceivedDebit()
public function testListTransactionEntry()
{
$this->expectsRequest('get', '/v1/treasury/transaction_entries');
- $result = $this->client->treasury->transactionEntries->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->transactionEntries->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\TransactionEntry::class, $result->data[0]);
}
@@ -3973,9 +3962,10 @@ public function testRetrieveTransactionEntry()
public function testListTransaction2()
{
$this->expectsRequest('get', '/v1/treasury/transactions');
- $result = $this->client->treasury->transactions->all(
- ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3]
- );
+ $result = $this->client->treasury->transactions->all([
+ 'financial_account' => 'fa_xxxxxxxxxxxxx',
+ 'limit' => 3,
+ ]);
static::assertInstanceOf(\Stripe\Collection::class, $result);
static::assertInstanceOf(\Stripe\Treasury\Transaction::class, $result->data[0]);
}
@@ -4031,9 +4021,10 @@ public function testCreateFromCalculationTransaction()
'post',
'/v1/tax/transactions/create_from_calculation'
);
- $result = $this->client->tax->transactions->createFromCalculation(
- ['calculation' => 'xxx', 'reference' => 'yyy']
- );
+ $result = $this->client->tax->transactions->createFromCalculation([
+ 'calculation' => 'xxx',
+ 'reference' => 'yyy',
+ ]);
static::assertInstanceOf(\Stripe\Tax\Transaction::class, $result);
}
@@ -4063,13 +4054,14 @@ public function testPreviewInvoiceLinesQuote()
public function testCreatePaymentIntent3()
{
$this->expectsRequest('post', '/v1/payment_intents');
- $result = $this->client->paymentIntents->create(
- [
- 'amount' => 200,
- 'currency' => 'usd',
- 'payment_method_data' => ['type' => 'p24', 'p24' => ['bank' => 'blik']],
- ]
- );
+ $result = $this->client->paymentIntents->create([
+ 'amount' => 200,
+ 'currency' => 'usd',
+ 'payment_method_data' => [
+ 'type' => 'p24',
+ 'p24' => ['bank' => 'blik'],
+ ],
+ ]);
static::assertInstanceOf(\Stripe\PaymentIntent::class, $result);
}
}
From c3b1c8c16769cce67e6e6ca8609cdb9129c9ef1e Mon Sep 17 00:00:00 2001
From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Tue, 9 May 2023 16:22:07 +0000
Subject: [PATCH 16/25] Update generated code for v330
---
OPENAPI_VERSION | 2 +-
tests/Stripe/GeneratedExamplesTest.php | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index 892bbd994..6eaa6201f 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v328
\ No newline at end of file
+v330
\ No newline at end of file
diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php
index 28f3cfc68..e2b2038d8 100644
--- a/tests/Stripe/GeneratedExamplesTest.php
+++ b/tests/Stripe/GeneratedExamplesTest.php
@@ -4049,4 +4049,12 @@ public function testCreatePaymentIntent3()
]);
static::assertInstanceOf(\Stripe\PaymentIntent::class, $result);
}
+
+ public function testListLineItemsQuote()
+ {
+ $this->expectsRequest('get', '/v1/quotes/qt_xxxxxxxxxxxxx/line_items');
+ $result = $this->client->quotes->allLineItems('qt_xxxxxxxxxxxxx', []);
+ static::assertInstanceOf(\Stripe\Collection::class, $result);
+ static::assertInstanceOf(\Stripe\LineItem::class, $result->data[0]);
+ }
}
From 3fc4ee4e911e9b8a028e1233b11a06be5a82ff43 Mon Sep 17 00:00:00 2001
From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Tue, 9 May 2023 16:23:02 +0000
Subject: [PATCH 17/25] Update generated code for v330
---
OPENAPI_VERSION | 2 +-
tests/Stripe/GeneratedExamplesTest.php | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index 892bbd994..6eaa6201f 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v328
\ No newline at end of file
+v330
\ No newline at end of file
diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php
index b6c99c790..8b6448bf7 100644
--- a/tests/Stripe/GeneratedExamplesTest.php
+++ b/tests/Stripe/GeneratedExamplesTest.php
@@ -4064,4 +4064,12 @@ public function testCreatePaymentIntent3()
]);
static::assertInstanceOf(\Stripe\PaymentIntent::class, $result);
}
+
+ public function testListLineItemsQuote()
+ {
+ $this->expectsRequest('get', '/v1/quotes/qt_xxxxxxxxxxxxx/line_items');
+ $result = $this->client->quotes->allLineItems('qt_xxxxxxxxxxxxx', []);
+ static::assertInstanceOf(\Stripe\Collection::class, $result);
+ static::assertInstanceOf(\Stripe\LineItem::class, $result->data[0]);
+ }
}
From 73584f2bce0ec0fcab00f39a2ac26181108c8bab Mon Sep 17 00:00:00 2001
From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Tue, 9 May 2023 22:45:22 +0000
Subject: [PATCH 18/25] Update generated code for v331
---
OPENAPI_VERSION | 2 +-
lib/PaymentMethod.php | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index 6eaa6201f..b760b4deb 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v330
\ No newline at end of file
+v331
\ No newline at end of file
diff --git a/lib/PaymentMethod.php b/lib/PaymentMethod.php
index b0597a416..578d32f15 100644
--- a/lib/PaymentMethod.php
+++ b/lib/PaymentMethod.php
@@ -48,6 +48,7 @@
* @property null|\Stripe\StripeObject $oxxo
* @property null|\Stripe\StripeObject $p24
* @property null|\Stripe\StripeObject $paynow
+ * @property null|\Stripe\StripeObject $paypal
* @property null|\Stripe\StripeObject $pix
* @property null|\Stripe\StripeObject $promptpay
* @property null|\Stripe\StripeObject $radar_options Options to configure Radar. See Radar Session for more information.
From 1e03261513c1182dc22dc1b563b1b32394605eba Mon Sep 17 00:00:00 2001
From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Wed, 10 May 2023 20:26:47 +0000
Subject: [PATCH 19/25] Update generated code for v334
---
OPENAPI_VERSION | 2 +-
lib/Tax/Settings.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index 6eaa6201f..72a018d3d 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v330
\ No newline at end of file
+v334
\ No newline at end of file
diff --git a/lib/Tax/Settings.php b/lib/Tax/Settings.php
index a2d96b581..d124ce147 100644
--- a/lib/Tax/Settings.php
+++ b/lib/Tax/Settings.php
@@ -14,7 +14,7 @@
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property \Stripe\StripeObject $defaults
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
- * @property \Stripe\StripeObject[] $locations The places where your business is located.
+ * @property null|\Stripe\StripeObject[] $locations The places where your business is located.
*/
class Settings extends \Stripe\SingletonApiResource
{
From 4eb329f69a06ee81c92a3c930258ab72f2ca7b69 Mon Sep 17 00:00:00 2001
From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Thu, 11 May 2023 08:56:12 +0000
Subject: [PATCH 20/25] Update generated code for v335
---
OPENAPI_VERSION | 2 +-
lib/Tax/Registration.php | 3 +++
lib/Tax/Settings.php | 4 ++--
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index 72a018d3d..bbc67e417 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v334
\ No newline at end of file
+v335
\ No newline at end of file
diff --git a/lib/Tax/Registration.php b/lib/Tax/Registration.php
index e7be1c82c..ddf60d6ac 100644
--- a/lib/Tax/Registration.php
+++ b/lib/Tax/Registration.php
@@ -14,6 +14,9 @@
* register to collect tax, see our guide.
*
+ * Related guide: Using the
+ * Registrations API.
+ *
* @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.
diff --git a/lib/Tax/Settings.php b/lib/Tax/Settings.php
index d124ce147..693909a2c 100644
--- a/lib/Tax/Settings.php
+++ b/lib/Tax/Settings.php
@@ -8,8 +8,8 @@
* You can use Tax Settings
to manage configurations used by Stripe
* Tax calculations.
*
- * Related guide: Account
- * settings.
+ * Related guide: Using the
+ * Settings API.
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property \Stripe\StripeObject $defaults
From ae168383f53b7619a78496f397495bd26c1abe44 Mon Sep 17 00:00:00 2001
From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Thu, 11 May 2023 13:28:39 +0000
Subject: [PATCH 21/25] Update generated code for v336
---
OPENAPI_VERSION | 2 +-
lib/TaxRate.php | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index b760b4deb..ba4cb796c 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v331
\ No newline at end of file
+v336
\ No newline at end of file
diff --git a/lib/TaxRate.php b/lib/TaxRate.php
index acf7b9ba3..80947bbac 100644
--- a/lib/TaxRate.php
+++ b/lib/TaxRate.php
@@ -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 true
if the object exists in live mode or the value false
if the object exists in test mode.
From 8d9c96c738225c37381f001000a53fcc1585261f Mon Sep 17 00:00:00 2001
From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Thu, 11 May 2023 13:28:52 +0000
Subject: [PATCH 22/25] Update generated code for v336
---
OPENAPI_VERSION | 2 +-
lib/TaxRate.php | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index bbc67e417..ba4cb796c 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v335
\ No newline at end of file
+v336
\ No newline at end of file
diff --git a/lib/TaxRate.php b/lib/TaxRate.php
index acf7b9ba3..80947bbac 100644
--- a/lib/TaxRate.php
+++ b/lib/TaxRate.php
@@ -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 true
if the object exists in live mode or the value false
if the object exists in test mode.
From e975b893062e7212e8a2d041afe543e05802381c Mon Sep 17 00:00:00 2001
From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Thu, 11 May 2023 15:42:45 +0000
Subject: [PATCH 23/25] Update generated code for v337
---
OPENAPI_VERSION | 2 +-
lib/Tax/Settings.php | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index ba4cb796c..bac7661c9 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1 +1 @@
-v336
\ No newline at end of file
+v337
\ No newline at end of file
diff --git a/lib/Tax/Settings.php b/lib/Tax/Settings.php
index 693909a2c..a8bacb405 100644
--- a/lib/Tax/Settings.php
+++ b/lib/Tax/Settings.php
@@ -13,8 +13,9 @@
*
* @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 true
if the object exists in live mode or the value false
if the object exists in test mode.
- * @property null|\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
{
From 4ad20dd0a95b2761aecea3d2b2354cc3a99abf9b Mon Sep 17 00:00:00 2001
From: Annie Li
Date: Thu, 11 May 2023 12:07:49 -0700
Subject: [PATCH 24/25] Bump version to 10.13.0
---
CHANGELOG.md | 15 +++++++++++++++
VERSION | 2 +-
lib/Stripe.php | 2 +-
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3bc9b4ac2..420d36300 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,20 @@
# 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.12.1 - 2023-04-04
* [#1473](https://github.com/stripe/stripe-php/pull/1473) Update generated code
* Add back `deleted` from `Invoice.status`.
diff --git a/VERSION b/VERSION
index ef715b96c..db24ab967 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-10.12.1
+10.13.0
diff --git a/lib/Stripe.php b/lib/Stripe.php
index dce3b20a8..5dc35eb25 100644
--- a/lib/Stripe.php
+++ b/lib/Stripe.php
@@ -58,7 +58,7 @@ class Stripe
/** @var float Initial delay between retries, in seconds */
private static $initialNetworkRetryDelay = 0.5;
- const VERSION = '10.12.1';
+ const VERSION = '10.13.0';
/**
* @return string the API key used for requests
From 34b3ba127d61f64a537750bd213a611dcd4355a7 Mon Sep 17 00:00:00 2001
From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Date: Thu, 11 May 2023 21:54:18 +0000
Subject: [PATCH 25/25] Update generated code for v338
---
init.php | 1 +
lib/FinancialConnections/Account.php | 2 +-
lib/QuoteLine.php | 35 ++++++++++++++++++++++++++++
lib/Service/QuoteService.php | 2 +-
lib/Util/ObjectTypes.php | 1 +
5 files changed, 39 insertions(+), 2 deletions(-)
create mode 100644 lib/QuoteLine.php
diff --git a/init.php b/init.php
index 446610108..5e4ddba3d 100644
--- a/init.php
+++ b/init.php
@@ -150,6 +150,7 @@
require __DIR__ . '/lib/Product.php';
require __DIR__ . '/lib/PromotionCode.php';
require __DIR__ . '/lib/Quote.php';
+require __DIR__ . '/lib/QuoteLine.php';
require __DIR__ . '/lib/QuotePhase.php';
require __DIR__ . '/lib/Radar/EarlyFraudWarning.php';
require __DIR__ . '/lib/Radar/ValueList.php';
diff --git a/lib/FinancialConnections/Account.php b/lib/FinancialConnections/Account.php
index cac53e891..33081b87f 100644
--- a/lib/FinancialConnections/Account.php
+++ b/lib/FinancialConnections/Account.php
@@ -115,7 +115,7 @@ public function refreshAccount($params = null, $opts = null)
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
- * @return \Stripe\Collection<\Stripe\FinancialConnections\FinancialConnectionsAccountInferredBalance> the list of financial connections account inferred balances
+ * @return \Stripe\Collection<\Stripe\FinancialConnections\InferredBalance> the list of financial connections account inferred balances
*/
public static function allInferredBalances($id, $params = null, $opts = null)
{
diff --git a/lib/QuoteLine.php b/lib/QuoteLine.php
new file mode 100644
index 000000000..96cf95d94
--- /dev/null
+++ b/lib/QuoteLine.php
@@ -0,0 +1,35 @@
+starts_at timestamp.
+ * @property null|\Stripe\StripeObject $ends_at Details to identify the end of the time range modified by the proposed change. If not supplied, the quote line is considered a point-in-time operation that only affects the exact timestamp at starts_at
, and a restricted set of attributes is supported on the quote line.
+ * @property null|string $proration_behavior Changes to how Stripe handles prorations during the quote line's time span. Affects if and how prorations are created when a future phase starts.
+ * @property null|string $set_schedule_end Timestsamp helper to end the underlying schedule early, based on the acompanying line's start or end date.
+ * @property null|\Stripe\StripeObject $starts_at Details to identify the earliest timestamp where the proposed change should take effect.
+ * @property null|\Stripe\StripeObject $trial_settings Settings related to subscription trials.
+ */
+class QuoteLine extends ApiResource
+{
+ const OBJECT_NAME = 'quote_line';
+
+ const BILLING_CYCLE_ANCHOR_AUTOMATIC = 'automatic';
+ const BILLING_CYCLE_ANCHOR_LINE_STARTS_AT = 'line_starts_at';
+
+ const PRORATION_BEHAVIOR_ALWAYS_INVOICE = 'always_invoice';
+ const PRORATION_BEHAVIOR_CREATE_PRORATIONS = 'create_prorations';
+ const PRORATION_BEHAVIOR_NONE = 'none';
+
+ const SET_SCHEDULE_END_LINE_ENDS_AT = 'line_ends_at';
+ const SET_SCHEDULE_END_LINE_STARTS_AT = 'line_starts_at';
+}
diff --git a/lib/Service/QuoteService.php b/lib/Service/QuoteService.php
index 59e2ff209..446e34227 100644
--- a/lib/Service/QuoteService.php
+++ b/lib/Service/QuoteService.php
@@ -85,7 +85,7 @@ public function allLineItems($id, $params = null, $opts = null)
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
- * @return \Stripe\Collection<\Stripe\Quote>
+ * @return \Stripe\Collection<\Stripe\QuoteLine>
*/
public function allLines($id, $params = null, $opts = null)
{
diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php
index c81da1e56..c3beb853f 100644
--- a/lib/Util/ObjectTypes.php
+++ b/lib/Util/ObjectTypes.php
@@ -82,6 +82,7 @@ class ObjectTypes
\Stripe\Product::OBJECT_NAME => \Stripe\Product::class,
\Stripe\PromotionCode::OBJECT_NAME => \Stripe\PromotionCode::class,
\Stripe\Quote::OBJECT_NAME => \Stripe\Quote::class,
+ \Stripe\QuoteLine::OBJECT_NAME => \Stripe\QuoteLine::class,
\Stripe\QuotePhase::OBJECT_NAME => \Stripe\QuotePhase::class,
\Stripe\Radar\EarlyFraudWarning::OBJECT_NAME => \Stripe\Radar\EarlyFraudWarning::class,
\Stripe\Radar\ValueList::OBJECT_NAME => \Stripe\Radar\ValueList::class,