mirror of
https://github.com/itflow-org/itflow
synced 2026-08-07 16:17:15 +00:00
Rename plugins to libs and update all file references
This commit is contained in:
21
libs/stripe-php/lib/V2/Billing/MeterEvent.php
Normal file
21
libs/stripe-php/lib/V2/Billing/MeterEvent.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// File generated from our OpenAPI spec
|
||||
|
||||
namespace Stripe\V2\Billing;
|
||||
|
||||
/**
|
||||
* A Meter Event is a usage record that captures billable activity for usage-based billing. Meter Events contain an event name, timestamp, and payload with customer mapping and usage value, enabling accurate usage tracking and billing.
|
||||
*
|
||||
* @property string $object String representing the object's type. Objects of the same type share the same value of the object field.
|
||||
* @property int $created The creation time of this meter event.
|
||||
* @property string $event_name The name of the meter event. Corresponds with the <code>event_name</code> field on a meter.
|
||||
* @property string $identifier A unique identifier for the event. If not provided, one will be generated. We recommend using a globally unique identifier for this. We’ll enforce uniqueness within a rolling 24 hour period.
|
||||
* @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 $payload The payload of the event. This must contain the fields corresponding to a meter’s <code>customer_mapping.event_payload_key</code> (default is <code>stripe_customer_id</code>) and <code>value_settings.event_payload_key</code> (default is <code>value</code>). Read more about the <a href="https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#payload-key-overrides">payload</a>..
|
||||
* @property int $timestamp The time of the event. Must be within the past 35 calendar days or up to 5 minutes in the future. Defaults to current timestamp if not specified.
|
||||
*/
|
||||
class MeterEvent extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = 'v2.billing.meter_event';
|
||||
}
|
||||
25
libs/stripe-php/lib/V2/Billing/MeterEventAdjustment.php
Normal file
25
libs/stripe-php/lib/V2/Billing/MeterEventAdjustment.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
// File generated from our OpenAPI spec
|
||||
|
||||
namespace Stripe\V2\Billing;
|
||||
|
||||
/**
|
||||
* A Meter Event Adjustment is used to cancel or modify previously recorded meter events. Meter Event Adjustments allow you to correct billing data by canceling individual events or event ranges, with tracking of adjustment status and creation time.
|
||||
*
|
||||
* @property string $id The unique id of this meter event adjustment.
|
||||
* @property string $object String representing the object's type. Objects of the same type share the same value of the object field.
|
||||
* @property (object{identifier: string}&\Stripe\StripeObject) $cancel Specifies which event to cancel.
|
||||
* @property int $created The time the adjustment was created.
|
||||
* @property string $event_name The name of the meter event. Corresponds with the <code>event_name</code> field on a meter.
|
||||
* @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 $status Open Enum. The meter event adjustment’s status.
|
||||
* @property string $type Open Enum. Specifies whether to cancel a single event or a range of events for a time period. Time period cancellation is not supported yet.
|
||||
*/
|
||||
class MeterEventAdjustment extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = 'v2.billing.meter_event_adjustment';
|
||||
|
||||
const STATUS_COMPLETE = 'complete';
|
||||
const STATUS_PENDING = 'pending';
|
||||
}
|
||||
20
libs/stripe-php/lib/V2/Billing/MeterEventSession.php
Normal file
20
libs/stripe-php/lib/V2/Billing/MeterEventSession.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
// File generated from our OpenAPI spec
|
||||
|
||||
namespace Stripe\V2\Billing;
|
||||
|
||||
/**
|
||||
* A Meter Event Session is an authentication session for the high-throughput meter event API. Meter Event Sessions provide temporary authentication tokens with expiration times, enabling secure and efficient bulk submission of usage events.
|
||||
*
|
||||
* @property string $id The unique id of this auth session.
|
||||
* @property string $object String representing the object's type. Objects of the same type share the same value of the object field.
|
||||
* @property string $authentication_token The authentication token for this session. Use this token when calling the high-throughput meter event API.
|
||||
* @property int $created The creation time of this session.
|
||||
* @property int $expires_at The time at which this session 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.
|
||||
*/
|
||||
class MeterEventSession extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = 'v2.billing.meter_event_session';
|
||||
}
|
||||
111
libs/stripe-php/lib/V2/Collection.php
Normal file
111
libs/stripe-php/lib/V2/Collection.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe\V2;
|
||||
|
||||
/**
|
||||
* Class V2 Collection.
|
||||
*
|
||||
* @template TStripeObject of \Stripe\StripeObject
|
||||
*
|
||||
* @template-implements \IteratorAggregate<TStripeObject>
|
||||
*
|
||||
* @property null|string $next_page_url
|
||||
* @property null|string $previous_page_url
|
||||
* @property TStripeObject[] $data
|
||||
*/
|
||||
class Collection extends \Stripe\StripeObject implements \Countable, \IteratorAggregate
|
||||
{
|
||||
const OBJECT_NAME = 'list';
|
||||
|
||||
use \Stripe\ApiOperations\Request;
|
||||
|
||||
/**
|
||||
* @return string the base URL for the given class
|
||||
*/
|
||||
public static function baseUrl()
|
||||
{
|
||||
return \Stripe\Stripe::$apiBase;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($k)
|
||||
{
|
||||
if (\is_string($k)) {
|
||||
return parent::offsetGet($k);
|
||||
}
|
||||
$msg = "You tried to access the {$k} index, but V2Collection "
|
||||
. 'types only support string keys. (HINT: List calls '
|
||||
. 'return an object with a `data` (which is the data '
|
||||
. "array). You likely want to call ->data[{$k}])";
|
||||
|
||||
throw new \Stripe\Exception\InvalidArgumentException($msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int the number of objects in the current page
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return \count($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \ArrayIterator an iterator that can be used to iterate
|
||||
* across objects in the current page
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \ArrayIterator an iterator that can be used to iterate
|
||||
* backwards across objects in the current page
|
||||
*/
|
||||
public function getReverseIterator()
|
||||
{
|
||||
return new \ArrayIterator(\array_reverse($this->data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Generator|TStripeObject[] A generator that can be used to
|
||||
* iterate across all objects across all pages. As page boundaries are
|
||||
* encountered, the next page will be fetched automatically for
|
||||
* continued iteration.
|
||||
*
|
||||
* @throws \Stripe\Exception\ApiErrorException
|
||||
*/
|
||||
public function autoPagingIterator()
|
||||
{
|
||||
$page = $this->data;
|
||||
$next_page_url = $this->next_page_url;
|
||||
|
||||
while (true) {
|
||||
foreach ($page as $item) {
|
||||
yield $item;
|
||||
}
|
||||
if (null === $next_page_url) {
|
||||
break;
|
||||
}
|
||||
|
||||
list($response, $opts) = $this->_request(
|
||||
'get',
|
||||
$next_page_url,
|
||||
null,
|
||||
null,
|
||||
[],
|
||||
'v2'
|
||||
);
|
||||
$obj = \Stripe\Util\Util::convertToStripeObject($response, $opts, 'v2');
|
||||
/** @phpstan-ignore-next-line */
|
||||
$page = $obj->data;
|
||||
/** @phpstan-ignore-next-line */
|
||||
$next_page_url = $obj->next_page_url;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
libs/stripe-php/lib/V2/Core/Account.php
Normal file
36
libs/stripe-php/lib/V2/Core/Account.php
Normal file
File diff suppressed because one or more lines are too long
21
libs/stripe-php/lib/V2/Core/AccountLink.php
Normal file
21
libs/stripe-php/lib/V2/Core/AccountLink.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// File generated from our OpenAPI spec
|
||||
|
||||
namespace Stripe\V2\Core;
|
||||
|
||||
/**
|
||||
* Account Links let a platform create a temporary, single-use URL that an account can use to access a Stripe-hosted flow for collecting or updating required information.
|
||||
*
|
||||
* @property string $object String representing the object's type. Objects of the same type share the same value of the object field.
|
||||
* @property string $account The ID of the connected account this Account Link applies to.
|
||||
* @property int $created The timestamp at which this Account Link was created.
|
||||
* @property int $expires_at The timestamp at which this Account Link 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.
|
||||
* @property string $url The URL at which the account can access the Stripe-hosted flow.
|
||||
* @property (object{type: string, account_onboarding?: (object{collection_options?: (object{fields?: string, future_requirements?: string}&\Stripe\StripeObject), configurations: string[], refresh_url: string, return_url?: string}&\Stripe\StripeObject), account_update?: (object{collection_options?: (object{fields?: string, future_requirements?: string}&\Stripe\StripeObject), configurations: string[], refresh_url: string, return_url?: string}&\Stripe\StripeObject)}&\Stripe\StripeObject) $use_case Hash containing usage options.
|
||||
*/
|
||||
class AccountLink extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = 'v2.core.account_link';
|
||||
}
|
||||
44
libs/stripe-php/lib/V2/Core/AccountPerson.php
Normal file
44
libs/stripe-php/lib/V2/Core/AccountPerson.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
// File generated from our OpenAPI spec
|
||||
|
||||
namespace Stripe\V2\Core;
|
||||
|
||||
/**
|
||||
* A Person represents an individual associated with an Account's identity (for example, an owner, director, executive, or representative). Use Persons to provide and update identity information for verification and compliance.
|
||||
*
|
||||
* @property string $id Unique identifier for the Person.
|
||||
* @property string $object String representing the object's type. Objects of the same type share the same value of the object field.
|
||||
* @property string $account The account ID which the individual belongs to.
|
||||
* @property null|(object{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, purpose: string, state?: string, town?: string}&\Stripe\StripeObject)[] $additional_addresses Additional addresses associated with the person.
|
||||
* @property null|(object{full_name?: string, given_name?: string, purpose: string, surname?: string}&\Stripe\StripeObject)[] $additional_names Additional names (e.g. aliases) associated with the person.
|
||||
* @property null|(object{account?: (object{date?: int, ip?: string, user_agent?: string}&\Stripe\StripeObject)}&\Stripe\StripeObject) $additional_terms_of_service Attestations of accepted terms of service agreements.
|
||||
* @property null|(object{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string, town?: string}&\Stripe\StripeObject) $address The person's residential address.
|
||||
* @property int $created Time at which the object was created. Represented as a RFC 3339 date & time UTC value in millisecond precision, for example: 2022-09-18T13:22:18.123Z.
|
||||
* @property null|(object{day: int, month: int, year: int}&\Stripe\StripeObject) $date_of_birth The person's date of birth.
|
||||
* @property null|(object{company_authorization?: (object{files: string[], type: string}&\Stripe\StripeObject), passport?: (object{files: string[], type: string}&\Stripe\StripeObject), primary_verification?: (object{front_back: (object{back?: string, front: string}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject), secondary_verification?: (object{front_back: (object{back?: string, front: string}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject), visa?: (object{files: string[], type: string}&\Stripe\StripeObject)}&\Stripe\StripeObject) $documents Documents that may be submitted to satisfy various informational requests.
|
||||
* @property null|string $email The person's email address.
|
||||
* @property null|string $given_name The person's first name.
|
||||
* @property null|(object{type: string}&\Stripe\StripeObject)[] $id_numbers The identification numbers (e.g., SSN) associated with the person.
|
||||
* @property null|string $legal_gender The person's gender (International regulations require either "male" or "female").
|
||||
* @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 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 null|string[] $nationalities The countries where the person is a national. Two-letter country code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>).
|
||||
* @property null|string $phone The person's phone number.
|
||||
* @property null|string $political_exposure The person's political exposure.
|
||||
* @property null|(object{authorizer?: bool, director?: bool, executive?: bool, legal_guardian?: bool, owner?: bool, percent_ownership?: string, representative?: bool, title?: string}&\Stripe\StripeObject) $relationship The relationship that this person has with the Account's business or legal entity.
|
||||
* @property null|(object{kana?: (object{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string, town?: string}&\Stripe\StripeObject), kanji?: (object{city?: string, country?: string, line1?: string, line2?: string, postal_code?: string, state?: string, town?: string}&\Stripe\StripeObject)}&\Stripe\StripeObject) $script_addresses The script addresses (e.g., non-Latin characters) associated with the person.
|
||||
* @property null|(object{kana?: (object{given_name?: string, surname?: string}&\Stripe\StripeObject), kanji?: (object{given_name?: string, surname?: string}&\Stripe\StripeObject)}&\Stripe\StripeObject) $script_names The script names (e.g. non-Latin characters) associated with the person.
|
||||
* @property null|string $surname The person's last name.
|
||||
* @property int $updated Time at which the object was last updated. Represented as a RFC 3339 date & time UTC value in millisecond precision, for example: 2022-09-18T13:22:18.123Z.
|
||||
*/
|
||||
class AccountPerson extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = 'v2.core.account_person';
|
||||
|
||||
const LEGAL_GENDER_FEMALE = 'female';
|
||||
const LEGAL_GENDER_MALE = 'male';
|
||||
|
||||
const POLITICAL_EXPOSURE_EXISTING = 'existing';
|
||||
const POLITICAL_EXPOSURE_NONE = 'none';
|
||||
}
|
||||
20
libs/stripe-php/lib/V2/Core/AccountPersonToken.php
Normal file
20
libs/stripe-php/lib/V2/Core/AccountPersonToken.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
// File generated from our OpenAPI spec
|
||||
|
||||
namespace Stripe\V2\Core;
|
||||
|
||||
/**
|
||||
* Person Tokens are single-use tokens which tokenize person information, and are used for creating or updating a Person.
|
||||
*
|
||||
* @property string $id Unique identifier for the token.
|
||||
* @property string $object String representing the object's type. Objects of the same type share the same value of the object field.
|
||||
* @property int $created Time at which the token was created. Represented as a RFC 3339 date & time UTC value in millisecond precision, for example: 2022-09-18T13:22:18.123Z.
|
||||
* @property int $expires_at Time at which the token will expire.
|
||||
* @property bool $livemode Has the value <code>true</code> if the token exists in live mode or the value <code>false</code> if the object exists in test mode.
|
||||
* @property bool $used Determines if the token has already been used (tokens can only be used once).
|
||||
*/
|
||||
class AccountPersonToken extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = 'v2.core.account_person_token';
|
||||
}
|
||||
20
libs/stripe-php/lib/V2/Core/AccountToken.php
Normal file
20
libs/stripe-php/lib/V2/Core/AccountToken.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
// File generated from our OpenAPI spec
|
||||
|
||||
namespace Stripe\V2\Core;
|
||||
|
||||
/**
|
||||
* Account tokens are single-use tokens which tokenize company/individual/business information, and are used for creating or updating an Account.
|
||||
*
|
||||
* @property string $id Unique identifier for the token.
|
||||
* @property string $object String representing the object's type. Objects of the same type share the same value of the object field.
|
||||
* @property int $created Time at which the token was created. Represented as a RFC 3339 date & time UTC value in millisecond precision, for example: 2022-09-18T13:22:18.123Z.
|
||||
* @property int $expires_at Time at which the token will expire.
|
||||
* @property bool $livemode Has the value <code>true</code> if the token exists in live mode or the value <code>false</code> if the object exists in test mode.
|
||||
* @property bool $used Determines if the token has already been used (tokens can only be used once).
|
||||
*/
|
||||
class AccountToken extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = 'v2.core.account_token';
|
||||
}
|
||||
21
libs/stripe-php/lib/V2/Core/Event.php
Normal file
21
libs/stripe-php/lib/V2/Core/Event.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe\V2\Core;
|
||||
|
||||
/**
|
||||
* Base class for V2 events.
|
||||
*
|
||||
* This is concrete for use in our generated tests. Events returned from the \Stripe\V2\Core\EventService
|
||||
* will be a subtype of \Stripe\V2\Core\Event.
|
||||
*
|
||||
* @property string $id Unique identifier for the event.
|
||||
* @property string $object String representing the object's type. Objects of the same type share the same value of the object field.
|
||||
* @property int $created Time at which the object was created.
|
||||
* @property \Stripe\StripeObject $reason Reason for the event.
|
||||
* @property string $type The type of the event.
|
||||
* @property null|string $context The Stripe account of the event
|
||||
*/
|
||||
class Event extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = 'v2.core.event';
|
||||
}
|
||||
40
libs/stripe-php/lib/V2/Core/EventDestination.php
Normal file
40
libs/stripe-php/lib/V2/Core/EventDestination.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
// File generated from our OpenAPI spec
|
||||
|
||||
namespace Stripe\V2\Core;
|
||||
|
||||
/**
|
||||
* Set up an event destination to receive events from Stripe across multiple destination types, including <a href="https://docs.stripe.com/webhooks">webhook endpoints</a> and <a href="https://docs.stripe.com/event-destinations/eventbridge">Amazon EventBridge</a>. Event destinations support receiving <a href="https://docs.stripe.com/api/v2/events">thin events</a> and <a href="https://docs.stripe.com/api/events">snapshot events</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 of the object field.
|
||||
* @property null|(object{aws_account_id: string, aws_event_source_arn: string, aws_event_source_status: string}&\Stripe\StripeObject) $amazon_eventbridge Amazon EventBridge configuration.
|
||||
* @property int $created Time at which the object was created.
|
||||
* @property string $description An optional description of what the event destination is used for.
|
||||
* @property string[] $enabled_events The list of events to enable for this endpoint.
|
||||
* @property string $event_payload Payload type of events being subscribed to.
|
||||
* @property null|string[] $events_from Where events should be routed from.
|
||||
* @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 Metadata.
|
||||
* @property string $name Event destination name.
|
||||
* @property null|string $snapshot_api_version If using the snapshot event payload, the API version events are rendered as.
|
||||
* @property string $status Status. It can be set to either enabled or disabled.
|
||||
* @property null|(object{disabled?: (object{reason: string}&\Stripe\StripeObject)}&\Stripe\StripeObject) $status_details Additional information about event destination status.
|
||||
* @property string $type Event destination type.
|
||||
* @property int $updated Time at which the object was last updated.
|
||||
* @property null|(object{signing_secret?: string, url?: string}&\Stripe\StripeObject) $webhook_endpoint Webhook endpoint configuration.
|
||||
*/
|
||||
class EventDestination extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = 'v2.core.event_destination';
|
||||
|
||||
const EVENT_PAYLOAD_SNAPSHOT = 'snapshot';
|
||||
const EVENT_PAYLOAD_THIN = 'thin';
|
||||
|
||||
const STATUS_DISABLED = 'disabled';
|
||||
const STATUS_ENABLED = 'enabled';
|
||||
|
||||
const TYPE_AMAZON_EVENTBRIDGE = 'amazon_eventbridge';
|
||||
const TYPE_WEBHOOK_ENDPOINT = 'webhook_endpoint';
|
||||
}
|
||||
136
libs/stripe-php/lib/V2/Core/EventNotification.php
Normal file
136
libs/stripe-php/lib/V2/Core/EventNotification.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe\V2\Core;
|
||||
|
||||
use Stripe\Events\UnknownEventNotification;
|
||||
use Stripe\Reason;
|
||||
use Stripe\RelatedObject;
|
||||
use Stripe\Util\EventNotificationTypes;
|
||||
|
||||
/**
|
||||
* EventNotification represents the json that's delivered from an Event Destination.
|
||||
* It's a basic class with no additional methods or properties. Use it to check basic information about a delivered event.
|
||||
* If you want more details, use `$stripeClient->v2->core->events->retrieve(thin_event.id)` to fetch the full event object.
|
||||
*
|
||||
* @property string $id Unique identifier for the event.
|
||||
* @property string $type The type of the event.
|
||||
* @property string $created Time at which the object was created.
|
||||
* @property null|\Stripe\StripeContext $context Authentication context needed to fetch the event or related object.
|
||||
* @property null|Reason $reason Reason for the event.
|
||||
* @property bool $livemode Livemode indicates if the event is from a production(true) or test(false) account.
|
||||
*/
|
||||
abstract class EventNotification
|
||||
{
|
||||
public $id;
|
||||
public $type;
|
||||
public $created;
|
||||
public $context;
|
||||
public $reason;
|
||||
public $livemode;
|
||||
|
||||
protected $client;
|
||||
// only available on children
|
||||
protected $related_object;
|
||||
|
||||
/**
|
||||
* @param array $json the raw json body
|
||||
* @param \Stripe\StripeClient $client a StripeClient instance that this can use to make requests
|
||||
*/
|
||||
public function __construct($json, $client)
|
||||
{
|
||||
$this->client = $client;
|
||||
|
||||
if (\array_key_exists('id', $json)) {
|
||||
$this->id = $json['id'];
|
||||
}
|
||||
if (\array_key_exists('type', $json)) {
|
||||
$this->type = $json['type'];
|
||||
}
|
||||
if (\array_key_exists('created', $json)) {
|
||||
$this->created = $json['created'];
|
||||
}
|
||||
if (\array_key_exists('context', $json) && null !== $json['context']) {
|
||||
$this->context = \Stripe\StripeContext::parse($json['context']);
|
||||
}
|
||||
if (\array_key_exists('livemode', $json)) {
|
||||
$this->livemode = $json['livemode'];
|
||||
}
|
||||
if (\array_key_exists('related_object', $json)) {
|
||||
$this->related_object = new RelatedObject($json['related_object']);
|
||||
}
|
||||
if (\array_key_exists('reason', $json)) {
|
||||
$this->reason = new Reason($json['reason']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for constructing an Event Notification. Doesn't perform signature validation, so you
|
||||
* should use \Stripe\BaseStripeClient#parseEventNotification instead for
|
||||
* initial handling. This is useful in unit tests and working with EventNotifications that you've
|
||||
* already validated the authenticity of.
|
||||
*
|
||||
* @param string $jsonStr the raw json payload
|
||||
* @param \Stripe\StripeClient $client a StripeClient instance that this can use to make requests
|
||||
*
|
||||
* @return EventNotification
|
||||
*/
|
||||
public static function fromJson($jsonStr, $client)
|
||||
{
|
||||
$json = json_decode($jsonStr, true);
|
||||
|
||||
$class = UnknownEventNotification::class;
|
||||
$eventNotificationTypes = EventNotificationTypes::v2EventMapping;
|
||||
if (\array_key_exists($json['type'], $eventNotificationTypes)) {
|
||||
$class = $eventNotificationTypes[$json['type']];
|
||||
}
|
||||
|
||||
return new $class($json, $client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the full Event from the Stripe API.
|
||||
*
|
||||
* @return Event
|
||||
*/
|
||||
public function fetchEvent()
|
||||
{
|
||||
$response = $this->client->rawRequest(
|
||||
'get',
|
||||
"/v2/core/events/{$this->id}",
|
||||
null,
|
||||
[
|
||||
'stripe_context' => $this->context,
|
||||
'headers' => ['Stripe-Request-Trigger' => 'event=' . $this->id],
|
||||
],
|
||||
null,
|
||||
['fetch_event']
|
||||
);
|
||||
|
||||
return $this->client->deserialize($response->body, 'v2');
|
||||
}
|
||||
|
||||
protected function fetchRelatedObject()
|
||||
{
|
||||
if (null === $this->related_object) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$options = [
|
||||
'headers' => ['Stripe-Request-Trigger' => 'event=' . $this->id],
|
||||
];
|
||||
if (null !== $this->context) {
|
||||
$options['stripe_context'] = $this->context;
|
||||
}
|
||||
|
||||
$response = $this->client->rawRequest(
|
||||
'get',
|
||||
$this->related_object->url,
|
||||
null,
|
||||
$options,
|
||||
null,
|
||||
['fetch_related_object']
|
||||
);
|
||||
|
||||
return $this->client->deserialize($response->body, \Stripe\Util\Util::getApiMode($this->related_object->url));
|
||||
}
|
||||
}
|
||||
14
libs/stripe-php/lib/V2/DeletedObject.php
Normal file
14
libs/stripe-php/lib/V2/DeletedObject.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
// File generated from our OpenAPI spec
|
||||
|
||||
namespace Stripe\V2;
|
||||
|
||||
/**
|
||||
* @property string $id The ID of the object that's being deleted.
|
||||
* @property null|string $object String representing the type of the object that has been deleted. Objects of the same type share the same value of the object field.
|
||||
*/
|
||||
class DeletedObject extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = '';
|
||||
}
|
||||
Reference in New Issue
Block a user