Person.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe;
  4. /**
  5. * This is an object representing a person associated with a Stripe account.
  6. *
  7. * A platform cannot access a person for an account where <a href="/api/accounts/object#account_object-controller-requirement_collection">account.controller.requirement_collection</a> is <code>stripe</code>, which includes Standard and Express accounts, after creating an Account Link or Account Session to start Connect onboarding.
  8. *
  9. * See the <a href="/connect/standard-accounts">Standard onboarding</a> or <a href="/connect/express-accounts">Express onboarding</a> documentation for information about prefilling information and account onboarding steps. Learn more about <a href="/connect/handling-api-verification#person-information">handling identity verification with the API</a>.
  10. *
  11. * @property string $id Unique identifier for the object.
  12. * @property string $object String representing the object's type. Objects of the same type share the same value.
  13. * @property null|string $account The account the person is associated with.
  14. * @property null|\Stripe\StripeObject $additional_tos_acceptances
  15. * @property null|\Stripe\StripeObject $address
  16. * @property null|\Stripe\StripeObject $address_kana The Kana variation of the person's address (Japan only).
  17. * @property null|\Stripe\StripeObject $address_kanji The Kanji variation of the person's address (Japan only).
  18. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  19. * @property null|\Stripe\StripeObject $dob
  20. * @property null|string $email The person's email address.
  21. * @property null|string $first_name The person's first name.
  22. * @property null|string $first_name_kana The Kana variation of the person's first name (Japan only).
  23. * @property null|string $first_name_kanji The Kanji variation of the person's first name (Japan only).
  24. * @property null|string[] $full_name_aliases A list of alternate names or aliases that the person is known by.
  25. * @property null|\Stripe\StripeObject $future_requirements Information about the <a href="https://stripe.com/docs/connect/custom-accounts/future-requirements">upcoming new requirements for this person</a>, including what information needs to be collected, and by when.
  26. * @property null|string $gender The person's gender (International regulations require either &quot;male&quot; or &quot;female&quot;).
  27. * @property null|bool $id_number_provided Whether the person's <code>id_number</code> was provided. True if either the full ID number was provided or if only the required part of the ID number was provided (ex. last four of an individual's SSN for the US indicated by <code>ssn_last_4_provided</code>).
  28. * @property null|bool $id_number_secondary_provided Whether the person's <code>id_number_secondary</code> was provided.
  29. * @property null|string $last_name The person's last name.
  30. * @property null|string $last_name_kana The Kana variation of the person's last name (Japan only).
  31. * @property null|string $last_name_kanji The Kanji variation of the person's last name (Japan only).
  32. * @property null|string $maiden_name The person's maiden name.
  33. * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
  34. * @property null|string $nationality The country where the person is a national.
  35. * @property null|string $phone The person's phone number.
  36. * @property null|string $political_exposure Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction.
  37. * @property null|\Stripe\StripeObject $registered_address
  38. * @property null|\Stripe\StripeObject $relationship
  39. * @property null|\Stripe\StripeObject $requirements Information about the requirements for this person, including what information needs to be collected, and by when.
  40. * @property null|bool $ssn_last_4_provided Whether the last four digits of the person's Social Security number have been provided (U.S. only).
  41. * @property null|\Stripe\StripeObject $verification
  42. */
  43. class Person extends ApiResource
  44. {
  45. const OBJECT_NAME = 'person';
  46. const GENDER_FEMALE = 'female';
  47. const GENDER_MALE = 'male';
  48. const POLITICAL_EXPOSURE_EXISTING = 'existing';
  49. const POLITICAL_EXPOSURE_NONE = 'none';
  50. const VERIFICATION_STATUS_PENDING = 'pending';
  51. const VERIFICATION_STATUS_UNVERIFIED = 'unverified';
  52. const VERIFICATION_STATUS_VERIFIED = 'verified';
  53. use ApiOperations\Delete;
  54. /**
  55. * @return string the API URL for this Stripe account reversal
  56. */
  57. public function instanceUrl()
  58. {
  59. $id = $this['id'];
  60. $account = $this['account'];
  61. if (!$id) {
  62. throw new Exception\UnexpectedValueException(
  63. 'Could not determine which URL to request: ' .
  64. "class instance has invalid ID: {$id}",
  65. null
  66. );
  67. }
  68. $id = Util\Util::utf8($id);
  69. $account = Util\Util::utf8($account);
  70. $base = Account::classUrl();
  71. $accountExtn = \urlencode($account);
  72. $extn = \urlencode($id);
  73. return "{$base}/{$accountExtn}/persons/{$extn}";
  74. }
  75. /**
  76. * @param array|string $_id
  77. * @param null|array|string $_opts
  78. *
  79. * @throws \Stripe\Exception\BadMethodCallException
  80. */
  81. public static function retrieve($_id, $_opts = null)
  82. {
  83. $msg = 'Persons cannot be retrieved without an account ID. Retrieve ' .
  84. "a person using `Account::retrievePerson('account_id', " .
  85. "'person_id')`.";
  86. throw new Exception\BadMethodCallException($msg);
  87. }
  88. /**
  89. * @param string $_id
  90. * @param null|array $_params
  91. * @param null|array|string $_options
  92. *
  93. * @throws \Stripe\Exception\BadMethodCallException
  94. */
  95. public static function update($_id, $_params = null, $_options = null)
  96. {
  97. $msg = 'Persons cannot be updated without an account ID. Update ' .
  98. "a person using `Account::updatePerson('account_id', " .
  99. "'person_id', \$updateParams)`.";
  100. throw new Exception\BadMethodCallException($msg);
  101. }
  102. /**
  103. * @param null|array|string $opts
  104. *
  105. * @throws \Stripe\Exception\ApiErrorException if the request fails
  106. *
  107. * @return static the saved resource
  108. *
  109. * @deprecated The `save` method is deprecated and will be removed in a
  110. * future major version of the library. Use the static method `update`
  111. * on the resource instead.
  112. */
  113. public function save($opts = null)
  114. {
  115. $params = $this->serializeParameters();
  116. if (\count($params) > 0) {
  117. $url = $this->instanceUrl();
  118. list($response, $opts) = $this->_request('post', $url, $params, $opts, ['save']);
  119. $this->refreshFrom($response, $opts);
  120. }
  121. return $this;
  122. }
  123. }