4
0

Capability.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe;
  4. /**
  5. * This is an object representing a capability for a Stripe account.
  6. *
  7. * Related guide: <a
  8. * href="https://stripe.com/docs/connect/account-capabilities">Account
  9. * capabilities</a>.
  10. *
  11. * @property string $id The identifier for the capability.
  12. * @property string $object String representing the object's type. Objects of the same type share the same value.
  13. * @property string|\Stripe\Account $account The account for which the capability enables functionality.
  14. * @property \Stripe\StripeObject $future_requirements
  15. * @property bool $requested Whether the capability has been requested.
  16. * @property null|int $requested_at Time at which the capability was requested. Measured in seconds since the Unix epoch.
  17. * @property \Stripe\StripeObject $requirements
  18. * @property string $status The status of the capability. Can be <code>active</code>, <code>inactive</code>, <code>pending</code>, or <code>unrequested</code>.
  19. */
  20. class Capability extends ApiResource
  21. {
  22. const OBJECT_NAME = 'capability';
  23. use ApiOperations\Update;
  24. const STATUS_ACTIVE = 'active';
  25. const STATUS_INACTIVE = 'inactive';
  26. const STATUS_PENDING = 'pending';
  27. const STATUS_UNREQUESTED = 'unrequested';
  28. /**
  29. * @return string the API URL for this Stripe account reversal
  30. */
  31. public function instanceUrl()
  32. {
  33. $id = $this['id'];
  34. $account = $this['account'];
  35. if (!$id) {
  36. throw new Exception\UnexpectedValueException(
  37. 'Could not determine which URL to request: ' .
  38. "class instance has invalid ID: {$id}",
  39. null
  40. );
  41. }
  42. $id = Util\Util::utf8($id);
  43. $account = Util\Util::utf8($account);
  44. $base = Account::classUrl();
  45. $accountExtn = \urlencode($account);
  46. $extn = \urlencode($id);
  47. return "{$base}/{$accountExtn}/capabilities/{$extn}";
  48. }
  49. /**
  50. * @param array|string $_id
  51. * @param null|array|string $_opts
  52. *
  53. * @throws \Stripe\Exception\BadMethodCallException
  54. */
  55. public static function retrieve($_id, $_opts = null)
  56. {
  57. $msg = 'Capabilities cannot be retrieved without an account ID. ' .
  58. 'Retrieve a capability using `Account::retrieveCapability(' .
  59. "'account_id', 'capability_id')`.";
  60. throw new Exception\BadMethodCallException($msg);
  61. }
  62. /**
  63. * @param string $_id
  64. * @param null|array $_params
  65. * @param null|array|string $_options
  66. *
  67. * @throws \Stripe\Exception\BadMethodCallException
  68. */
  69. public static function update($_id, $_params = null, $_options = null)
  70. {
  71. $msg = 'Capabilities cannot be updated without an account ID. ' .
  72. 'Update a capability using `Account::updateCapability(' .
  73. "'account_id', 'capability_id', \$updateParams)`.";
  74. throw new Exception\BadMethodCallException($msg);
  75. }
  76. }