Skip to content

Commit

Permalink
Merge pull request #1420 from stripe/latest-codegen-beta
Browse files Browse the repository at this point in the history
API Updates for beta branch
  • Loading branch information
anniel-stripe authored Jan 5, 2023
2 parents c8b7a08 + 1e12f5c commit 5d3bfc5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v216
v217
2 changes: 1 addition & 1 deletion lib/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* @property null|string $statement_descriptor Extra information about a product which will appear on your customer's credit card statement. In the case that multiple products are billed at once, the first statement descriptor will be used.
* @property null|string|\Stripe\TaxCode $tax_code A <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID.
* @property string $type The type of the product. The product is either of type <code>good</code>, which is eligible for use with Orders and SKUs, or <code>service</code>, which is eligible for use with Subscriptions and Plans.
* @property null|string $unit_label A label that represents units of this product in Stripe and on customers’ receipts and invoices. When set, this will be included in associated invoice line item descriptions.
* @property null|string $unit_label A label that represents units of this product. When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal.
* @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
* @property null|string $url A URL of a publicly-accessible webpage for this product.
*/
Expand Down
17 changes: 17 additions & 0 deletions lib/Quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,23 @@ public static function allLines($id, $params = null, $opts = null)
return $obj;
}

/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Quote the marked quote
*/
public function markStaleQuote($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/mark_stale';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);

return $this;
}

/**
* @param string $id
* @param null|array $params
Expand Down
16 changes: 16 additions & 0 deletions lib/Service/QuoteService.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,22 @@ public function finalizeQuote($id, $params = null, $opts = null)
return $this->request('post', $this->buildPath('/v1/quotes/%s/finalize', $id), $params, $opts);
}

/**
* Converts a draft or open quote to stale.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Quote
*/
public function markStaleQuote($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/quotes/%s/mark_stale', $id), $params, $opts);
}

/**
* Preview the invoice line items that would be generated by accepting the quote.
*
Expand Down
4 changes: 2 additions & 2 deletions lib/Util/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static function convertToStripeObject($resp, $opts)
public static function utf8($value)
{
if (null === self::$isMbstringAvailable) {
self::$isMbstringAvailable = \function_exists('mb_detect_encoding');
self::$isMbstringAvailable = \function_exists('mb_detect_encoding') && \function_exists('mb_convert_encoding');

if (!self::$isMbstringAvailable) {
\trigger_error('It looks like the mbstring extension is not enabled. ' .
Expand All @@ -85,7 +85,7 @@ public static function utf8($value)
}

if (\is_string($value) && self::$isMbstringAvailable && 'UTF-8' !== \mb_detect_encoding($value, 'UTF-8', true)) {
return \utf8_encode($value);
return mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1');
}

return $value;
Expand Down

0 comments on commit 5d3bfc5

Please sign in to comment.