Skip to content

Commit

Permalink
Merge pull request #1126 from stripe/latest-codegen
Browse files Browse the repository at this point in the history
API Updates
  • Loading branch information
seang-stripe authored May 19, 2021
2 parents 6ec33fa + 7b843cb commit 6cb0b9c
Show file tree
Hide file tree
Showing 17 changed files with 590 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
run: composer install --prefer-dist --no-progress --no-suggest

- name: Start stripe-mock
run: docker run -d -p 12111-12112:12111-12112 stripemock/stripe-mock && sleep 5
run: docker pull stripemock/stripe-mock && docker run -d -p 12111-12112:12111-12112 stripemock/stripe-mock && sleep 5

- name: Run test suite
run: |
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ matrix:

env:
global:
- STRIPE_MOCK_VERSION=0.103.0
- STRIPE_MOCK_VERSION=0.105.0
cache:
directories:
- $HOME/.composer/cache/files
Expand Down
5 changes: 5 additions & 0 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
require __DIR__ . '/lib/ExchangeRate.php';
require __DIR__ . '/lib/File.php';
require __DIR__ . '/lib/FileLink.php';
require __DIR__ . '/lib/Identity/VerificationReport.php';
require __DIR__ . '/lib/Identity/VerificationSession.php';
require __DIR__ . '/lib/Invoice.php';
require __DIR__ . '/lib/InvoiceItem.php';
require __DIR__ . '/lib/InvoiceLineItem.php';
Expand Down Expand Up @@ -179,6 +181,8 @@
require __DIR__ . '/lib/Service/ExchangeRateService.php';
require __DIR__ . '/lib/Service/FileService.php';
require __DIR__ . '/lib/Service/FileLinkService.php';
require __DIR__ . '/lib/Service/Identity/VerificationReportService.php';
require __DIR__ . '/lib/Service/Identity/VerificationSessionService.php';
require __DIR__ . '/lib/Service/InvoiceService.php';
require __DIR__ . '/lib/Service/InvoiceItemService.php';
require __DIR__ . '/lib/Service/Issuing/AuthorizationService.php';
Expand Down Expand Up @@ -224,6 +228,7 @@
require __DIR__ . '/lib/Service/CoreServiceFactory.php';
require __DIR__ . '/lib/Service/BillingPortal/BillingPortalServiceFactory.php';
require __DIR__ . '/lib/Service/Checkout/CheckoutServiceFactory.php';
require __DIR__ . '/lib/Service/Identity/IdentityServiceFactory.php';
require __DIR__ . '/lib/Service/Issuing/IssuingServiceFactory.php';
require __DIR__ . '/lib/Service/Radar/RadarServiceFactory.php';
require __DIR__ . '/lib/Service/Reporting/ReportingServiceFactory.php';
Expand Down
5 changes: 5 additions & 0 deletions lib/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ class File extends ApiResource
const PURPOSE_BUSINESS_LOGO = 'business_logo';
const PURPOSE_CUSTOMER_SIGNATURE = 'customer_signature';
const PURPOSE_DISPUTE_EVIDENCE = 'dispute_evidence';
const PURPOSE_DOCUMENT_PROVIDER_IDENTITY_DOCUMENT = 'document_provider_identity_document';
const PURPOSE_FINANCE_REPORT_RUN = 'finance_report_run';
const PURPOSE_IDENTITY_DOCUMENT = 'identity_document';
const PURPOSE_IDENTITY_DOCUMENT_DOWNLOADABLE = 'identity_document_downloadable';
const PURPOSE_PCI_DOCUMENT = 'pci_document';
const PURPOSE_SELFIE = 'selfie';
const PURPOSE_SIGMA_SCHEDULED_QUERY = 'sigma_scheduled_query';
const PURPOSE_TAX_DOCUMENT_USER_UPLOAD = 'tax_document_user_upload';

// This resource can have two different object names. In latter API
Expand Down
45 changes: 45 additions & 0 deletions lib/Identity/VerificationReport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Identity;

/**
* A VerificationReport is the result of an attempt to collect and verify data from
* a user. The collection of verification checks performed is determined from the
* <code>type</code> and <code>options</code> parameters used. You can find the
* result of each verification check performed in the appropriate sub-resource:
* <code>document</code>, <code>id_number</code>, <code>selfie</code>.
*
* Each VerificationReport contains a copy of any data collected by the user as
* well as reference IDs which can be used to access collected images through the
* <a href="https://stripe.com/docs/api/files">FileUpload</a> API. To configure and
* create VerificationReports, use the <a
* href="https://stripe.com/docs/api/identity/verification_sessions">VerificationSession</a>
* API.
*
* Related guides: <a
* href="https://stripe.com/docs/identity/verification-sessions#results">Accessing
* verification results</a>.
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property \Stripe\StripeObject $document Result from a document check
* @property \Stripe\StripeObject $id_number Result from an id_number check
* @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 $options
* @property \Stripe\StripeObject $selfie Result from a selfie check
* @property string $type Type of report.
* @property null|string $verification_session ID of the VerificationSession that created this report.
*/
class VerificationReport extends \Stripe\ApiResource
{
const OBJECT_NAME = 'identity.verification_report';

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

const TYPE_DOCUMENT = 'document';
const TYPE_ID_NUMBER = 'id_number';
}
80 changes: 80 additions & 0 deletions lib/Identity/VerificationSession.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Identity;

/**
* A VerificationSession is the starting-point for a verification flow that will
* collect and verify data on your users. Each VerificationSesssion has a URL which
* provides access to Stripe’s hosted identity verification UI. When you direct
* your users to the link, Stripe will collect personal information and verify it.
* You can retrieve the VerificationSession later to see the status of the checks
* performed and access any data collected from your users.
*
* @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 string $client_secret This string value can be passed to stripe.js to embed a verification flow directly into your app.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|\Stripe\StripeObject $last_error Hash of details on the last error encountered in the verification process.
* @property null|string|\Stripe\Identity\VerificationReport $last_verification_report Link to the most recent completed VerificationReport for this 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 $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 $options
* @property null|\Stripe\StripeObject $redaction Redaction status of this VerificationSession. If the VerificationSession is not redacted, this field will be null.
* @property string $status Status of this VerificationSession. Read more about each <a href="https://stripe.com/docs/identity/how-sessions-work">VerificationSession status</a>.
* @property string $type Type of report requested.
* @property null|string $url Link to the Stripe-hosted identity verification portal that you can send a user to for verification.
* @property null|\Stripe\StripeObject $verified_outputs Hash of verified data about this person that results from a successful verification report.
*/
class VerificationSession extends \Stripe\ApiResource
{
const OBJECT_NAME = 'identity.verification_session';

use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Retrieve;
use \Stripe\ApiOperations\Update;

const STATUS_CANCELED = 'canceled';
const STATUS_PROCESSING = 'processing';
const STATUS_REQUIRES_INPUT = 'requires_input';
const STATUS_VERIFIED = 'verified';

const TYPE_DOCUMENT = 'document';
const TYPE_ID_NUMBER = 'id_number';

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

return $this;
}

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

return $this;
}
}
2 changes: 2 additions & 0 deletions lib/Service/CoreServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* @property ExchangeRateService $exchangeRates
* @property FileLinkService $fileLinks
* @property FileService $files
* @property Identity\IdentityServiceFactory $identity
* @property InvoiceItemService $invoiceItems
* @property InvoiceService $invoices
* @property Issuing\IssuingServiceFactory $issuing
Expand Down Expand Up @@ -84,6 +85,7 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory
'exchangeRates' => ExchangeRateService::class,
'fileLinks' => FileLinkService::class,
'files' => FileService::class,
'identity' => Identity\IdentityServiceFactory::class,
'invoiceItems' => InvoiceItemService::class,
'invoices' => InvoiceService::class,
'issuing' => Issuing\IssuingServiceFactory::class,
Expand Down
27 changes: 27 additions & 0 deletions lib/Service/Identity/IdentityServiceFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Service\Identity;

/**
* Service factory class for API resources in the Identity namespace.
*
* @property VerificationReportService $verificationReports
* @property VerificationSessionService $verificationSessions
*/
class IdentityServiceFactory extends \Stripe\Service\AbstractServiceFactory
{
/**
* @var array<string, string>
*/
private static $classMap = [
'verificationReports' => VerificationReportService::class,
'verificationSessions' => VerificationSessionService::class,
];

protected function getServiceClass($name)
{
return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
}
}
39 changes: 39 additions & 0 deletions lib/Service/Identity/VerificationReportService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Service\Identity;

class VerificationReportService extends \Stripe\Service\AbstractService
{
/**
* List all verification reports.
*
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/identity/verification_reports', $params, $opts);
}

/**
* Retrieves an existing VerificationReport.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Identity\VerificationReport
*/
public function retrieve($id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/identity/verification_reports/%s', $id), $params, $opts);
}
}
Loading

0 comments on commit 6cb0b9c

Please sign in to comment.