Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

API Updates for beta branch #1368

Merged
merged 24 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9a84c3f
Codegen for openapi v184 (#1355)
dcr-stripe Aug 23, 2022
c2e998e
Bump version to 9.3.0
dcr-stripe Aug 23, 2022
8856f78
Add beta readme.md section (#1356)
pakrym-stripe Aug 24, 2022
2deb907
Add coveralls
anniel-stripe Aug 24, 2022
74322a8
Add badge to README
anniel-stripe Aug 24, 2022
4800ed1
Fix flag name
anniel-stripe Aug 24, 2022
f06b7a1
fix: Fix type hints for error objects. (#1361)
dcr-stripe Aug 25, 2022
7fc439c
Pass coveralls parameters directly
anniel-stripe Aug 25, 2022
216f604
Update parameters
anniel-stripe Aug 25, 2022
43be4c3
Merge branch 'master' into anniel-coveralls
anniel-stripe Aug 25, 2022
7540262
Merge pull request #1360 from stripe/anniel-coveralls
anniel-stripe Aug 25, 2022
2b4320c
API Updates (#1362)
dcr-stripe Aug 26, 2022
a759ccc
Bump version to 9.4.0
dcr-stripe Aug 26, 2022
aee3aad
chore: Update PHP tests to handle search methods. (#1363)
dcr-stripe Aug 31, 2022
8c56e7c
Codegen for openapi v189 (#1364)
yejia-stripe Sep 6, 2022
e3ea7f8
Bump version to 9.5.0
yejia-stripe Sep 6, 2022
60878c3
Codegen for openapi v193
kamil-stripe Sep 15, 2022
1b71c1a
Merge pull request #1365 from stripe/latest-codegen-master
kamil-stripe Sep 15, 2022
7c43066
Bump version to 9.6.0
kamil-stripe Sep 15, 2022
46ff921
Add SingletonRetrieve that can be used in generated code (#1369)
pakrym-stripe Sep 26, 2022
cf04c7b
Set version to 9.6.0 to simplify merge
pakrym-stripe Sep 26, 2022
67c3277
Include latest changes from the master branch
pakrym-stripe Sep 26, 2022
bde9616
Reset version to 9.4.0-beta.1
pakrym-stripe Sep 26, 2022
0ea12d0
Codegen for openapi v196
pakrym-stripe Sep 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,11 @@ jobs:
run: |
php --version
./build.php $env:AUTOLOAD

- name: Coveralls
run: vendor/bin/php-coveralls -v --coverage_clover='clover.xml' --json_path='coveralls-upload.json'
if: matrix.php-version == '8.1' && matrix.env == 'AUTOLOAD=1'
env:
COVERALLS_RUN_LOCALLY: 1
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_FLAG_NAME: php-${{ matrix.php-version }}-${{ matrix.env }}
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Changelog

## 9.6.0 - 2022-09-15
* [#1365](https://github.com/stripe/stripe-php/pull/1365) API Updates
* Add support for `from_invoice` and `latest_revision` on `Invoice`
* Add support for new value `pix` on enum `PaymentLink.payment_method_types[]`
* Add support for `pix` on `PaymentMethod`
* Add support for new value `pix` on enum `PaymentMethod.type`
* Add support for `created` on `Treasury.CreditReversal` and `Treasury.DebitReversal`

## 9.5.0 - 2022-09-06
* [#1364](https://github.com/stripe/stripe-php/pull/1364) API Updates
* Add support for new value `terminal_reader_splashscreen` on enum `File.purpose`
* [#1363](https://github.com/stripe/stripe-php/pull/1363) chore: Update PHP tests to handle search methods.

## 9.4.0 - 2022-08-26
* [#1362](https://github.com/stripe/stripe-php/pull/1362) API Updates
* Add support for `login_page` on `BillingPortal.Configuration`
* [#1360](https://github.com/stripe/stripe-php/pull/1360) Add test coverage using Coveralls
* [#1361](https://github.com/stripe/stripe-php/pull/1361) fix: Fix type hints for error objects.
* Update `Invoice.last_finalization_error`, `PaymentIntent.last_payment_error`, `SetupAttempt.setup_error` and `SetupIntent.setup_error` type to be `StripeObject`.
* Addresses https://github.com/stripe/stripe-php/issues/1353. The library today does not actually return a `ErrorObject` for these fields, so the type annotation was incorrect.
* [#1356](https://github.com/stripe/stripe-php/pull/1356) Add beta readme.md section

## 9.4.0-beta.1 - 2022-08-26
* [#1358](https://github.com/stripe/stripe-php/pull/1358) API Updates for beta branch
* Updated stable APIs to the latest version
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v185
v196
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[![Latest Stable Version](https://poser.pugx.org/stripe/stripe-php/v/stable.svg)](https://packagist.org/packages/stripe/stripe-php)
[![Total Downloads](https://poser.pugx.org/stripe/stripe-php/downloads.svg)](https://packagist.org/packages/stripe/stripe-php)
[![License](https://poser.pugx.org/stripe/stripe-php/license.svg)](https://packagist.org/packages/stripe/stripe-php)
[![Code Coverage](https://coveralls.io/repos/stripe/stripe-php/badge.svg?branch=master)](https://coveralls.io/r/stripe/stripe-php?branch=master)

The Stripe PHP library provides convenient access to the Stripe API from
applications written in the PHP language. It includes a pre-defined set of
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"phpunit/phpunit": "^5.7 || ^9.0",
"squizlabs/php_codesniffer": "^3.3",
"friendsofphp/php-cs-fixer": "3.5.0",
"phpstan/phpstan": "^1.2"
"phpstan/phpstan": "^1.2",
"php-coveralls/php-coveralls": "^2.5"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 8 additions & 0 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
require __DIR__ . '/lib/ApiOperations/Request.php';
require __DIR__ . '/lib/ApiOperations/Retrieve.php';
require __DIR__ . '/lib/ApiOperations/Search.php';
require __DIR__ . '/lib/ApiOperations/SingletonRetrieve.php';
require __DIR__ . '/lib/ApiOperations/Update.php';

// Plumbing
Expand Down Expand Up @@ -90,6 +91,9 @@
require __DIR__ . '/lib/BillingPortal/Configuration.php';
require __DIR__ . '/lib/BillingPortal/Session.php';
require __DIR__ . '/lib/Capability.php';
require __DIR__ . '/lib/Capital/FinancingOffer.php';
require __DIR__ . '/lib/Capital/FinancingSummary.php';
require __DIR__ . '/lib/Capital/FinancingTransaction.php';
require __DIR__ . '/lib/Card.php';
require __DIR__ . '/lib/CashBalance.php';
require __DIR__ . '/lib/Charge.php';
Expand Down Expand Up @@ -199,6 +203,9 @@
require __DIR__ . '/lib/Service/BalanceTransactionService.php';
require __DIR__ . '/lib/Service/BillingPortal/ConfigurationService.php';
require __DIR__ . '/lib/Service/BillingPortal/SessionService.php';
require __DIR__ . '/lib/Service/Capital/FinancingOfferService.php';
require __DIR__ . '/lib/Service/Capital/FinancingSummaryService.php';
require __DIR__ . '/lib/Service/Capital/FinancingTransactionService.php';
require __DIR__ . '/lib/Service/ChargeService.php';
require __DIR__ . '/lib/Service/Checkout/SessionService.php';
require __DIR__ . '/lib/Service/CountrySpecService.php';
Expand Down Expand Up @@ -286,6 +293,7 @@
// Service factories
require __DIR__ . '/lib/Service/Apps/AppsServiceFactory.php';
require __DIR__ . '/lib/Service/BillingPortal/BillingPortalServiceFactory.php';
require __DIR__ . '/lib/Service/Capital/CapitalServiceFactory.php';
require __DIR__ . '/lib/Service/Checkout/CheckoutServiceFactory.php';
require __DIR__ . '/lib/Service/CoreServiceFactory.php';
require __DIR__ . '/lib/Service/FinancialConnections/FinancialConnectionsServiceFactory.php';
Expand Down
6 changes: 3 additions & 3 deletions lib/AccountSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@

/**
* An AccountSession allows a Connect platform to grant access to a connected
* account in Connect Elements.
* account in Connect Embedded UIs.
*
* We recommend that you create an AccountSession each time you need to display an
* embedded UI to your user. Do not save AccountSessions to your database as they
* expire relatively quickly, and cannot be used more than once.
*
* Related guide: <a
* href="https://stripe.com/docs/connect/get-started-connect-elements">Connect
* Elements</a>.
* Embedded UIs</a>.
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property string $account The ID of the account the AccountSession was created for
* @property string $client_secret <p>The client secret of this AccountSession. Used on the client to set up secure access to the given <code>account</code>.</p><p>The client secret can be used to provide access to <code>account</code> from your frontend. It should not be stored, logged, or exposed to anyone other than the connected account. Make sure that you have TLS enabled on any page that includes the client secret.</p><p>Refer to our docs to <a href="https://stripe.com/docs/connect/get-started-connect-elements">setup Connect Elements</a> and learn about how <code>client_secret</code> should be handled.</p>
* @property string $client_secret <p>The client secret of this AccountSession. Used on the client to set up secure access to the given <code>account</code>.</p><p>The client secret can be used to provide access to <code>account</code> from your frontend. It should not be stored, logged, or exposed to anyone other than the connected account. Make sure that you have TLS enabled on any page that includes the client secret.</p><p>Refer to our docs to <a href="https://stripe.com/docs/connect/get-started-connect-elements">setup Connect Embedded UIs</a> and learn about how <code>client_secret</code> should be handled.</p>
* @property int $expires_at The timestamp at which this AccountSession will expire.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
*/
Expand Down
30 changes: 30 additions & 0 deletions lib/ApiOperations/SingletonRetrieve.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Stripe\ApiOperations;

/**
* Trait for retrievable singleton resources. Adds a `retrieve()` static method to the
* class.
*
* This trait should only be applied to classes that derive from SingletonApiResource.
*/
trait SingletonRetrieve
{
/**
* @param array|string $id 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
*
* @return static
*/
public static function retrieve($opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
$instance = new static(null, $opts);
$instance->refresh();

return $instance;
}
}
12 changes: 1 addition & 11 deletions lib/Balance.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,5 @@ class Balance extends SingletonApiResource
{
const OBJECT_NAME = 'balance';

/**
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Balance
*/
public static function retrieve($opts = null)
{
return self::_singletonRetrieve($opts);
}
use ApiOperations\SingletonRetrieve;
}
1 change: 1 addition & 0 deletions lib/BillingPortal/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @property \Stripe\StripeObject $features
* @property bool $is_default Whether the configuration is the default. If <code>true</code>, this configuration can be managed in the Dashboard and portal sessions will use this configuration unless it is overriden when creating the session.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject $login_page
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
*/
Expand Down
67 changes: 67 additions & 0 deletions lib/Capital/FinancingOffer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Capital;

/**
* This is an object representing an offer of financing from Stripe Capital to a
* Connect subaccount.
*
* @property string $id A unique identifier for the financing object.
* @property string $object The object type: financing_offer.
* @property \Stripe\StripeObject $accepted_terms This is an object representing the terms of an offer of financing from Stripe Capital to a Connected account. This resource represents the terms accepted by the Connected account, which may differ from those offered.
* @property string $account The ID of the merchant associated with this financing object.
* @property int $created Time at which the offer was created. Given in seconds since unix epoch.
* @property float $expires_after Time at which the offer expires. Given in seconds since unix epoch.
* @property string $financing_type The type of financing being offered.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property \Stripe\StripeObject $offered_terms This is an object representing the terms of an offer of financing from Stripe Capital to a Connected account. This resource represents both the terms offered to the Connected account.
* @property string $product_type Financing product identifier.
* @property string $status The current status of the offer.
* @property string $type See <a href="https://stripe.com/docs/api/capital/connect_financing_object#financing_offer_object-financing_type">financing_type</a>.
*/
class FinancingOffer extends \Stripe\ApiResource
{
const OBJECT_NAME = 'capital.financing_offer';

use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Retrieve;

const FINANCING_TYPE_CASH_ADVANCE = 'cash_advance';
const FINANCING_TYPE_FLEX_LOAN = 'flex_loan';

const PRODUCT_TYPE_REFILL = 'refill';
const PRODUCT_TYPE_STANDARD = 'standard';

const STATUS_ACCEPTED = 'accepted';
const STATUS_CANCELED = 'canceled';
const STATUS_COMPLETED = 'completed';
const STATUS_DELIVERED = 'delivered';
const STATUS_EXPIRED = 'expired';
const STATUS_FULLY_REPAID = 'fully_repaid';
const STATUS_PAID_OUT = 'paid_out';
const STATUS_REJECTED = 'rejected';
const STATUS_UNDELIVERED = 'undelivered';

const TYPE_CASH_ADVANCE = 'cash_advance';
const TYPE_FLEX_LOAN = 'flex_loan';

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

return $this;
}
}
25 changes: 25 additions & 0 deletions lib/Capital/FinancingSummary.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Capital;

/**
* A financing object describes an account's current financing state. Used by
* Connect platforms to read the state of Capital offered to their connected
* accounts.
*
* @property string $object The object type: financing_summary
* @property null|\Stripe\StripeObject $details Additional information about the financing summary. Describes currency, advance amount, fee amount, withhold rate, remaining amount, paid amount, current repayment interval, repayment start date, and advance payout date.
* @property null|string $status Status of the Connected Account's financing. <a href="https://stripe.com/docs/api/capital/financing_summary">/v1/capital/financing_summary</a> will only return <code>details</code> for <code>paid_out</code> financing.
*/
class FinancingSummary extends \Stripe\SingletonApiResource
{
const OBJECT_NAME = 'capital.financing_summary';

use \Stripe\ApiOperations\SingletonRetrieve;

const STATUS_ACCEPTED = 'accepted';
const STATUS_DELIVERED = 'delivered';
const STATUS_NONE = 'none';
}
32 changes: 32 additions & 0 deletions lib/Capital/FinancingTransaction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Capital;

/**
* This is an object representing the details of a transaction on a Capital
* financing object.
*
* @property string $id A unique identifier for the financing transaction object.
* @property string $object The object type: financing_transaction
* @property string $account The ID of the merchant associated with this financing transaction.
* @property int $created_at Time at which the financing transaction was created. Given in seconds since unix epoch.
* @property \Stripe\StripeObject $details This is an object representing a transaction on a Capital financing offer.
* @property null|string $financing_offer The Capital financing offer for this financing transaction.
* @property string $legacy_balance_transaction_source The Capital transaction object that predates the Financing Transactions API and corresponds with the balance transaction that was created as a result of this financing transaction.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property string $type The type of the financing transaction.
* @property null|string $user_facing_description A human-friendly description of the financing transaction.
*/
class FinancingTransaction extends \Stripe\ApiResource
{
const OBJECT_NAME = 'capital.financing_transaction';

use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Retrieve;

const TYPE_PAYMENT = 'payment';
const TYPE_PAYOUT = 'payout';
const TYPE_REVERSAL = 'reversal';
}
2 changes: 1 addition & 1 deletion lib/Checkout/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
* @property string $success_url The URL the customer will be directed to after the payment or subscription creation is successful.
* @property \Stripe\StripeObject $tax_id_collection
* @property null|\Stripe\StripeObject $total_details Tax and discount details for the computed total amount.
* @property null|string $url The URL to the Checkout Session. Redirect customers to this URL to take them to Checkout. If you’re using <a href="https://stripe.com/docs/payments/checkout/custom-domains">Custom Domains</a>, the URL will use your subdomain. Otherwise, it’ll use <code>checkout.stripe.com.</code>
* @property null|string $url The URL to the Checkout Session. Redirect customers to this URL to take them to Checkout. If you’re using <a href="https://stripe.com/docs/payments/checkout/custom-domains">Custom Domains</a>, the URL will use your subdomain. Otherwise, it’ll use <code>checkout.stripe.com.</code> This value is only present when the session is active.
*/
class Session extends \Stripe\ApiResource
{
Expand Down
1 change: 1 addition & 0 deletions lib/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class Event extends ApiResource
const BILLING_PORTAL_CONFIGURATION_UPDATED = 'billing_portal.configuration.updated';
const BILLING_PORTAL_SESSION_CREATED = 'billing_portal.session.created';
const CAPABILITY_UPDATED = 'capability.updated';
const CAPITAL_FINANCING_TRANSACTION_CREATED = 'capital.financing_transaction.created';
const CASH_BALANCE_FUNDS_AVAILABLE = 'cash_balance.funds_available';
const CHARGE_CAPTURED = 'charge.captured';
const CHARGE_DISPUTE_CLOSED = 'charge.dispute.closed';
Expand Down
1 change: 1 addition & 0 deletions lib/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class File extends ApiResource
const PURPOSE_SELFIE = 'selfie';
const PURPOSE_SIGMA_SCHEDULED_QUERY = 'sigma_scheduled_query';
const PURPOSE_TAX_DOCUMENT_USER_UPLOAD = 'tax_document_user_upload';
const PURPOSE_TERMINAL_READER_SPLASHSCREEN = 'terminal_reader_splashscreen';

// This resource can have two different object names. In latter API
// versions, only `file` is used, but since stripe-php may be used with
Expand Down
4 changes: 3 additions & 1 deletion lib/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@
* @property null|int $due_date The date on which payment for this invoice is due. This value will be <code>null</code> for invoices where <code>collection_method=charge_automatically</code>.
* @property null|int $ending_balance Ending customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null.
* @property null|string $footer Footer displayed on the invoice.
* @property null|\Stripe\StripeObject $from_invoice Details of the invoice that was cloned. See the <a href="https://stripe.com/docs/invoicing/invoice-revisions">revision documentation</a> for more details.
* @property null|string $hosted_invoice_url The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null.
* @property null|string $invoice_pdf The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null.
* @property null|\Stripe\ErrorObject $last_finalization_error The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized.
* @property null|\Stripe\StripeObject $last_finalization_error The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized.
* @property null|string|\Stripe\Invoice $latest_revision The ID of the most recent non-draft revision of this invoice
* @property \Stripe\Collection<\Stripe\InvoiceLineItem> $lines The individual line items that make up the invoice. <code>lines</code> is sorted as follows: invoice items in reverse chronological order, followed by the subscription, if any.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
Expand Down
Loading