dolibarr/htdocs/includes/stripe/stripe-php/lib/Capability.php

89 lines
2.9 KiB
PHP
Raw Permalink Normal View History

2019-05-16 21:41:14 +02:00
<?php
2021-01-03 23:37:44 +01:00
// File generated from our OpenAPI spec
2019-05-16 21:41:14 +02:00
namespace Stripe;
/**
2021-01-03 23:37:44 +01:00
* This is an object representing a capability for a Stripe account.
2019-05-16 21:41:14 +02:00
*
2021-01-03 23:37:44 +01:00
* Related guide: <a
* href="https://stripe.com/docs/connect/account-capabilities">Account
* capabilities</a>.
2019-05-16 21:41:14 +02:00
*
2021-01-03 23:37:44 +01:00
* @property string $id The identifier for the capability.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property string|\Stripe\Account $account The account for which the capability enables functionality.
2023-04-24 18:42:04 +02:00
* @property null|\Stripe\StripeObject $future_requirements
2021-01-03 23:37:44 +01:00
* @property bool $requested Whether the capability has been requested.
* @property null|int $requested_at Time at which the capability was requested. Measured in seconds since the Unix epoch.
2023-04-24 18:42:04 +02:00
* @property null|\Stripe\StripeObject $requirements
2021-01-03 23:37:44 +01:00
* @property string $status The status of the capability. Can be <code>active</code>, <code>inactive</code>, <code>pending</code>, or <code>unrequested</code>.
2019-05-16 21:41:14 +02:00
*/
class Capability extends ApiResource
{
2021-01-03 23:37:44 +01:00
const OBJECT_NAME = 'capability';
2019-05-16 21:41:14 +02:00
use ApiOperations\Update;
2021-01-03 23:37:44 +01:00
const STATUS_ACTIVE = 'active';
const STATUS_INACTIVE = 'inactive';
const STATUS_PENDING = 'pending';
2019-05-16 21:41:14 +02:00
const STATUS_UNREQUESTED = 'unrequested';
/**
2021-01-03 23:37:44 +01:00
* @return string the API URL for this Stripe account reversal
2019-05-16 21:41:14 +02:00
*/
public function instanceUrl()
{
$id = $this['id'];
$account = $this['account'];
if (!$id) {
2021-01-03 23:37:44 +01:00
throw new Exception\UnexpectedValueException(
'Could not determine which URL to request: ' .
"class instance has invalid ID: {$id}",
2019-05-16 21:41:14 +02:00
null
);
}
$id = Util\Util::utf8($id);
$account = Util\Util::utf8($account);
$base = Account::classUrl();
2021-01-03 23:37:44 +01:00
$accountExtn = \urlencode($account);
$extn = \urlencode($id);
return "{$base}/{$accountExtn}/capabilities/{$extn}";
2019-05-16 21:41:14 +02:00
}
/**
* @param array|string $_id
2021-01-03 23:37:44 +01:00
* @param null|array|string $_opts
2019-05-16 21:41:14 +02:00
*
2021-01-03 23:37:44 +01:00
* @throws \Stripe\Exception\BadMethodCallException
2019-05-16 21:41:14 +02:00
*/
public static function retrieve($_id, $_opts = null)
{
2021-01-03 23:37:44 +01:00
$msg = 'Capabilities cannot be retrieved without an account ID. ' .
'Retrieve a capability using `Account::retrieveCapability(' .
"'account_id', 'capability_id')`.";
throw new Exception\BadMethodCallException($msg);
2019-05-16 21:41:14 +02:00
}
/**
* @param string $_id
2021-01-03 23:37:44 +01:00
* @param null|array $_params
* @param null|array|string $_options
2019-05-16 21:41:14 +02:00
*
2021-01-03 23:37:44 +01:00
* @throws \Stripe\Exception\BadMethodCallException
2019-05-16 21:41:14 +02:00
*/
public static function update($_id, $_params = null, $_options = null)
{
2021-01-03 23:37:44 +01:00
$msg = 'Capabilities cannot be updated without an account ID. ' .
'Update a capability using `Account::updateCapability(' .
"'account_id', 'capability_id', \$updateParams)`.";
throw new Exception\BadMethodCallException($msg);
2019-05-16 21:41:14 +02:00
}
}