Cardholder.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Issuing;
  4. /**
  5. * An Issuing <code>Cardholder</code> object represents an individual or business entity who is <a href="https://stripe.com/docs/issuing">issued</a> cards.
  6. *
  7. * Related guide: <a href="https://stripe.com/docs/issuing/cards#create-cardholder">How to create a cardholder</a>
  8. *
  9. * @property string $id Unique identifier for the object.
  10. * @property string $object String representing the object's type. Objects of the same type share the same value.
  11. * @property \Stripe\StripeObject $billing
  12. * @property null|\Stripe\StripeObject $company Additional information about a <code>company</code> cardholder.
  13. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  14. * @property null|string $email The cardholder's email address.
  15. * @property null|\Stripe\StripeObject $individual Additional information about an <code>individual</code> cardholder.
  16. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
  17. * @property \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.
  18. * @property string $name The cardholder's name. This will be printed on cards issued to them.
  19. * @property null|string $phone_number The cardholder's phone number. This is required for all cardholders who will be creating EU cards. See the <a href="https://stripe.com/docs/issuing/3d-secure#when-is-3d-secure-applied">3D Secure documentation</a> for more details.
  20. * @property null|string[] $preferred_locales The cardholder’s preferred locales (languages), ordered by preference. Locales can be <code>de</code>, <code>en</code>, <code>es</code>, <code>fr</code>, or <code>it</code>. This changes the language of the <a href="https://stripe.com/docs/issuing/3d-secure">3D Secure flow</a> and one-time password messages sent to the cardholder.
  21. * @property \Stripe\StripeObject $requirements
  22. * @property null|\Stripe\StripeObject $spending_controls Rules that control spending across this cardholder's cards. Refer to our <a href="https://stripe.com/docs/issuing/controls/spending-controls">documentation</a> for more details.
  23. * @property string $status Specifies whether to permit authorizations on this cardholder's cards.
  24. * @property string $type One of <code>individual</code> or <code>company</code>. See <a href="https://stripe.com/docs/issuing/other/choose-cardholder">Choose a cardholder type</a> for more details.
  25. */
  26. class Cardholder extends \Stripe\ApiResource
  27. {
  28. const OBJECT_NAME = 'issuing.cardholder';
  29. use \Stripe\ApiOperations\Update;
  30. const STATUS_ACTIVE = 'active';
  31. const STATUS_BLOCKED = 'blocked';
  32. const STATUS_INACTIVE = 'inactive';
  33. const TYPE_COMPANY = 'company';
  34. const TYPE_INDIVIDUAL = 'individual';
  35. /**
  36. * Creates a new Issuing <code>Cardholder</code> object that can be issued cards.
  37. *
  38. * @param null|array $params
  39. * @param null|array|string $options
  40. *
  41. * @throws \Stripe\Exception\ApiErrorException if the request fails
  42. *
  43. * @return \Stripe\Issuing\Cardholder the created resource
  44. */
  45. public static function create($params = null, $options = null)
  46. {
  47. self::_validateParams($params);
  48. $url = static::classUrl();
  49. list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
  50. $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
  51. $obj->setLastResponse($response);
  52. return $obj;
  53. }
  54. /**
  55. * Returns a list of Issuing <code>Cardholder</code> objects. The objects are
  56. * sorted in descending order by creation date, with the most recently created
  57. * object appearing first.
  58. *
  59. * @param null|array $params
  60. * @param null|array|string $opts
  61. *
  62. * @throws \Stripe\Exception\ApiErrorException if the request fails
  63. *
  64. * @return \Stripe\Collection<\Stripe\Issuing\Cardholder> of ApiResources
  65. */
  66. public static function all($params = null, $opts = null)
  67. {
  68. $url = static::classUrl();
  69. return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
  70. }
  71. /**
  72. * Retrieves an Issuing <code>Cardholder</code> object.
  73. *
  74. * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
  75. * @param null|array|string $opts
  76. *
  77. * @throws \Stripe\Exception\ApiErrorException if the request fails
  78. *
  79. * @return \Stripe\Issuing\Cardholder
  80. */
  81. public static function retrieve($id, $opts = null)
  82. {
  83. $opts = \Stripe\Util\RequestOptions::parse($opts);
  84. $instance = new static($id, $opts);
  85. $instance->refresh();
  86. return $instance;
  87. }
  88. /**
  89. * Updates the specified Issuing <code>Cardholder</code> object by setting the
  90. * values of the parameters passed. Any parameters not provided will be left
  91. * unchanged.
  92. *
  93. * @param string $id the ID of the resource to update
  94. * @param null|array $params
  95. * @param null|array|string $opts
  96. *
  97. * @throws \Stripe\Exception\ApiErrorException if the request fails
  98. *
  99. * @return \Stripe\Issuing\Cardholder the updated resource
  100. */
  101. public static function update($id, $params = null, $opts = null)
  102. {
  103. self::_validateParams($params);
  104. $url = static::resourceUrl($id);
  105. list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
  106. $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
  107. $obj->setLastResponse($response);
  108. return $obj;
  109. }
  110. }