Account.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. namespace Stripe;
  3. /**
  4. * Class Account
  5. *
  6. * @property string $id
  7. * @property string $object
  8. * @property mixed $business_logo
  9. * @property string $business_name
  10. * @property mixed $business_url
  11. * @property bool $charges_enabled
  12. * @property string $country
  13. * @property bool $debit_negative_balances
  14. * @property mixed $decline_charge_on
  15. * @property string $default_currency
  16. * @property bool $details_submitted
  17. * @property string $display_name
  18. * @property string $email
  19. * @property mixed $external_accounts
  20. * @property mixed $legal_entity
  21. * @property bool $managed
  22. * @property mixed $product_description
  23. * @property mixed $statement_descriptor
  24. * @property mixed $support_email
  25. * @property mixed $support_phone
  26. * @property string $timezone
  27. * @property mixed $tos_acceptance
  28. * @property mixed $transfer_schedule
  29. * @property bool $transfers_enabled
  30. * @property mixed $verification
  31. * @property mixed $keys
  32. *
  33. * @package Stripe
  34. */
  35. class Account extends ApiResource
  36. {
  37. public function instanceUrl()
  38. {
  39. if ($this['id'] === null) {
  40. return '/v1/account';
  41. } else {
  42. return parent::instanceUrl();
  43. }
  44. }
  45. /**
  46. * @param string|null $id
  47. * @param array|string|null $opts
  48. *
  49. * @return Account
  50. */
  51. public static function retrieve($id = null, $opts = null)
  52. {
  53. if (!$opts && is_string($id) && substr($id, 0, 3) === 'sk_') {
  54. $opts = $id;
  55. $id = null;
  56. }
  57. return self::_retrieve($id, $opts);
  58. }
  59. /**
  60. * @param array|null $params
  61. * @param array|string|null $opts
  62. *
  63. * @return Account
  64. */
  65. public static function create($params = null, $opts = null)
  66. {
  67. return self::_create($params, $opts);
  68. }
  69. /**
  70. * @param string $id The ID of the account to update.
  71. * @param array|null $params
  72. * @param array|string|null $options
  73. *
  74. * @return Account The updated account.
  75. */
  76. public static function update($id, $params = null, $options = null)
  77. {
  78. return self::_update($id, $params, $options);
  79. }
  80. /**
  81. * @param array|string|null $opts
  82. *
  83. * @return Account
  84. */
  85. public function save($opts = null)
  86. {
  87. return $this->_save($opts);
  88. }
  89. /**
  90. * @param array|null $params
  91. * @param array|string|null $opts
  92. *
  93. * @return Account The deleted account.
  94. */
  95. public function delete($params = null, $opts = null)
  96. {
  97. return $this->_delete($params, $opts);
  98. }
  99. /**
  100. * @param array|null $params
  101. * @param array|string|null $opts
  102. *
  103. * @return Account The rejected account.
  104. */
  105. public function reject($params = null, $opts = null)
  106. {
  107. $url = $this->instanceUrl() . '/reject';
  108. list($response, $opts) = $this->_request('post', $url, $params, $opts);
  109. $this->refreshFrom($response, $opts);
  110. return $this;
  111. }
  112. /**
  113. * @param array|null $params
  114. * @param array|string|null $opts
  115. *
  116. * @return Collection of Accounts
  117. */
  118. public static function all($params = null, $opts = null)
  119. {
  120. return self::_all($params, $opts);
  121. }
  122. }