Capability.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 bool $requested Whether the capability has been requested.
  15. * @property null|int $requested_at Time at which the capability was requested. Measured in seconds since the Unix epoch.
  16. * @property \Stripe\StripeObject $requirements
  17. * @property string $status The status of the capability. Can be <code>active</code>, <code>inactive</code>, <code>pending</code>, or <code>unrequested</code>.
  18. */
  19. class Capability extends ApiResource
  20. {
  21. const OBJECT_NAME = 'capability';
  22. use ApiOperations\Update;
  23. const STATUS_ACTIVE = 'active';
  24. const STATUS_INACTIVE = 'inactive';
  25. const STATUS_PENDING = 'pending';
  26. const STATUS_UNREQUESTED = 'unrequested';
  27. /**
  28. * @return string the API URL for this Stripe account reversal
  29. */
  30. public function instanceUrl()
  31. {
  32. $id = $this['id'];
  33. $account = $this['account'];
  34. if (!$id) {
  35. throw new Exception\UnexpectedValueException(
  36. 'Could not determine which URL to request: ' .
  37. "class instance has invalid ID: {$id}",
  38. null
  39. );
  40. }
  41. $id = Util\Util::utf8($id);
  42. $account = Util\Util::utf8($account);
  43. $base = Account::classUrl();
  44. $accountExtn = \urlencode($account);
  45. $extn = \urlencode($id);
  46. return "{$base}/{$accountExtn}/capabilities/{$extn}";
  47. }
  48. /**
  49. * @param array|string $_id
  50. * @param null|array|string $_opts
  51. *
  52. * @throws \Stripe\Exception\BadMethodCallException
  53. */
  54. public static function retrieve($_id, $_opts = null)
  55. {
  56. $msg = 'Capabilities cannot be retrieved without an account ID. ' .
  57. 'Retrieve a capability using `Account::retrieveCapability(' .
  58. "'account_id', 'capability_id')`.";
  59. throw new Exception\BadMethodCallException($msg);
  60. }
  61. /**
  62. * @param string $_id
  63. * @param null|array $_params
  64. * @param null|array|string $_options
  65. *
  66. * @throws \Stripe\Exception\BadMethodCallException
  67. */
  68. public static function update($_id, $_params = null, $_options = null)
  69. {
  70. $msg = 'Capabilities cannot be updated without an account ID. ' .
  71. 'Update a capability using `Account::updateCapability(' .
  72. "'account_id', 'capability_id', \$updateParams)`.";
  73. throw new Exception\BadMethodCallException($msg);
  74. }
  75. }