Skip to content

Commit

Permalink
Merge pull request #1600 from stripe/latest-codegen-beta
Browse files Browse the repository at this point in the history
Update generated code for beta
  • Loading branch information
stripe-openapi[bot] authored Nov 10, 2023
2 parents d2b3ad0 + 737bcc0 commit 0d9b7a8
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 13.3.0 - 2023-11-09
* [#1603](https://github.com/stripe/stripe-php/pull/1603) Update generated code
* Add support for new value `terminal_reader_hardware_fault` on enum `StripeError.code`

## 13.3.0-beta.1 - 2023-11-02
* [#1598](https://github.com/stripe/stripe-php/pull/1598) Update generated code for beta
* Add support for `attach_payment_intent` method on resource `Invoice`
Expand All @@ -8,6 +12,9 @@
* Add support for `amounts_due` and `payments` on `Invoice`
* Add support for `created` on `Issuing.PersonalizationDesign`

## 13.2.1 - 2023-11-06
* [#1602](https://github.com/stripe/stripe-php/pull/1602) Fix error when "id" is not a string.

## 13.2.0 - 2023-11-02
* [#1599](https://github.com/stripe/stripe-php/pull/1599) Update generated code
* Add support for new resource `Tax.Registration`
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v645
v655
1 change: 1 addition & 0 deletions lib/ErrorObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ class ErrorObject extends StripeObject
const CODE_TAXES_CALCULATION_FAILED = 'taxes_calculation_failed';
const CODE_TERMINAL_LOCATION_COUNTRY_UNSUPPORTED = 'terminal_location_country_unsupported';
const CODE_TERMINAL_READER_BUSY = 'terminal_reader_busy';
const CODE_TERMINAL_READER_HARDWARE_FAULT = 'terminal_reader_hardware_fault';
const CODE_TERMINAL_READER_OFFLINE = 'terminal_reader_offline';
const CODE_TERMINAL_READER_TIMEOUT = 'terminal_reader_timeout';
const CODE_TESTMODE_CHARGES_ONLY = 'testmode_charges_only';
Expand Down
2 changes: 2 additions & 0 deletions lib/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ class Event extends ApiResource
const QUOTE_DRAFT = 'quote.draft';
const QUOTE_FINALIZED = 'quote.finalized';
const QUOTE_REESTIMATED = 'quote.reestimated';
const QUOTE_REESTIMATE_FAILED = 'quote.reestimate_failed';
const QUOTE_STALE = 'quote.stale';
const RADAR_EARLY_FRAUD_WARNING_CREATED = 'radar.early_fraud_warning.created';
const RADAR_EARLY_FRAUD_WARNING_UPDATED = 'radar.early_fraud_warning.updated';
Expand Down Expand Up @@ -485,6 +486,7 @@ class Event extends ApiResource
const TYPE_QUOTE_DRAFT = 'quote.draft';
const TYPE_QUOTE_FINALIZED = 'quote.finalized';
const TYPE_QUOTE_REESTIMATED = 'quote.reestimated';
const TYPE_QUOTE_REESTIMATE_FAILED = 'quote.reestimate_failed';
const TYPE_QUOTE_STALE = 'quote.stale';
const TYPE_RADAR_EARLY_FRAUD_WARNING_CREATED = 'radar.early_fraud_warning.created';
const TYPE_RADAR_EARLY_FRAUD_WARNING_UPDATED = 'radar.early_fraud_warning.updated';
Expand Down
1 change: 1 addition & 0 deletions lib/QuotePhase.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* @property null|\Stripe\StripeObject $invoice_settings The invoice settings applicable during this phase.
* @property null|int $iterations Integer representing the multiplier applied to the price interval. For example, <code>iterations=2</code> applied to a price with <code>interval=month</code> and <code>interval_count=3</code> results in a phase of duration <code>2 * 3 months = 6 months</code>.
* @property null|\Stripe\Collection<\Stripe\LineItem> $line_items A list of items the customer is being quoted for.
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that will declaratively set metadata on the subscription schedule's phases when the quote is accepted.
* @property string $proration_behavior If the quote will prorate when transitioning to this phase. Possible values are <code>create_prorations</code> and <code>none</code>.
* @property \Stripe\StripeObject $total_details
* @property null|bool $trial If set to true the entire phase is counted as a trial and the customer will not be charged for any recurring fees.
Expand Down
4 changes: 4 additions & 0 deletions lib/Util/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ public static function urlEncode($key)
public static function normalizeId($id)
{
if (\is_array($id)) {
// see https://github.com/stripe/stripe-php/pull/1602
if (!isset($id['id'])) {
return [null, $id];
}
$params = $id;
$id = $params['id'];
unset($params['id']);
Expand Down
34 changes: 34 additions & 0 deletions tests/Stripe/StripeObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ final class StripeObjectTest extends \Stripe\TestCase
/** @var \ReflectionProperty */
private $optsReflector;

/** @var \ReflectionProperty */
private $retrieveOptionsReflector;

/**
* @before
*/
Expand All @@ -31,6 +34,10 @@ public function setUpReflectors()
// This is used to access the `_opts` protected variable
$this->optsReflector = new \ReflectionProperty(\Stripe\StripeObject::class, '_opts');
$this->optsReflector->setAccessible(true);

// This is used to access the `_retrieveOptions` protected variable
$this->retrieveOptionsReflector = new \ReflectionProperty(\Stripe\StripeObject::class, '_retrieveOptions');
$this->retrieveOptionsReflector->setAccessible(true);
}

public function testArrayAccessorsSemantics()
Expand Down Expand Up @@ -540,6 +547,33 @@ public function testIsDeleted()
static::assertTrue($obj->isDeleted());
}

public function testConstructorIdPassing()
{
$obj = new StripeObject(['id' => 'id_foo', 'other' => 'bar']);
static::assertSame('id_foo', $obj->id);
static::assertSame(['other' => 'bar'], $this->retrieveOptionsReflector->getValue($obj));

$obj = new StripeObject('id_foo');
static::assertSame('id_foo', $obj->id);
static::assertSame([], $this->retrieveOptionsReflector->getValue($obj));

$obj = new StripeObject(['id' => 'id_foo']);
static::assertSame('id_foo', $obj->id);
static::assertSame([], $this->retrieveOptionsReflector->getValue($obj));

$obj = new StripeObject(['id' => ['foo' => 'bar']]);
static::assertSame(['foo' => 'bar'], $obj->id);
static::assertSame([], $this->retrieveOptionsReflector->getValue($obj));
}

public function testConstructFromIdPassing()
{
$obj = StripeObject::constructFrom(['inner' => ['id' => ['foo' => 'bar']]]);

static::assertSame(['foo' => 'bar'], $obj['inner']->id->toArray());
static::assertSame([], $this->retrieveOptionsReflector->getValue($obj));
}

public function testDeserializeEmptyMetadata()
{
/** @var mixed $obj */
Expand Down

0 comments on commit 0d9b7a8

Please sign in to comment.