PersonalizationDesign.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Issuing;
  4. /**
  5. * A Personalization Design is a logical grouping of a Physical Bundle, card logo, and carrier text that represents a product line.
  6. *
  7. * @property string $id Unique identifier for the object.
  8. * @property string $object String representing the object's type. Objects of the same type share the same value.
  9. * @property null|string|\Stripe\File $card_logo The file for the card logo to use with physical bundles that support card logos. Must have a <code>purpose</code> value of <code>issuing_logo</code>.
  10. * @property null|\Stripe\StripeObject $carrier_text Hash containing carrier text, for use with physical bundles that support carrier text.
  11. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  12. * @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.
  13. * @property null|string $lookup_key A lookup key used to retrieve personalization designs dynamically from a static string. This may be up to 200 characters.
  14. * @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.
  15. * @property null|string $name Friendly display name.
  16. * @property string|\Stripe\Issuing\PhysicalBundle $physical_bundle The physical bundle object belonging to this personalization design.
  17. * @property \Stripe\StripeObject $preferences
  18. * @property \Stripe\StripeObject $rejection_reasons
  19. * @property string $status Whether this personalization design can be used to create cards.
  20. */
  21. class PersonalizationDesign extends \Stripe\ApiResource
  22. {
  23. const OBJECT_NAME = 'issuing.personalization_design';
  24. use \Stripe\ApiOperations\Update;
  25. const STATUS_ACTIVE = 'active';
  26. const STATUS_INACTIVE = 'inactive';
  27. const STATUS_REJECTED = 'rejected';
  28. const STATUS_REVIEW = 'review';
  29. /**
  30. * Creates a personalization design object.
  31. *
  32. * @param null|array $params
  33. * @param null|array|string $options
  34. *
  35. * @throws \Stripe\Exception\ApiErrorException if the request fails
  36. *
  37. * @return \Stripe\Issuing\PersonalizationDesign the created resource
  38. */
  39. public static function create($params = null, $options = null)
  40. {
  41. self::_validateParams($params);
  42. $url = static::classUrl();
  43. list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
  44. $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
  45. $obj->setLastResponse($response);
  46. return $obj;
  47. }
  48. /**
  49. * Returns a list of personalization design objects. The objects are sorted in
  50. * descending order by creation date, with the most recently created object
  51. * appearing first.
  52. *
  53. * @param null|array $params
  54. * @param null|array|string $opts
  55. *
  56. * @throws \Stripe\Exception\ApiErrorException if the request fails
  57. *
  58. * @return \Stripe\Collection<\Stripe\Issuing\PersonalizationDesign> of ApiResources
  59. */
  60. public static function all($params = null, $opts = null)
  61. {
  62. $url = static::classUrl();
  63. return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
  64. }
  65. /**
  66. * Retrieves a personalization design object.
  67. *
  68. * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
  69. * @param null|array|string $opts
  70. *
  71. * @throws \Stripe\Exception\ApiErrorException if the request fails
  72. *
  73. * @return \Stripe\Issuing\PersonalizationDesign
  74. */
  75. public static function retrieve($id, $opts = null)
  76. {
  77. $opts = \Stripe\Util\RequestOptions::parse($opts);
  78. $instance = new static($id, $opts);
  79. $instance->refresh();
  80. return $instance;
  81. }
  82. /**
  83. * Updates a card personalization object.
  84. *
  85. * @param string $id the ID of the resource to update
  86. * @param null|array $params
  87. * @param null|array|string $opts
  88. *
  89. * @throws \Stripe\Exception\ApiErrorException if the request fails
  90. *
  91. * @return \Stripe\Issuing\PersonalizationDesign the updated resource
  92. */
  93. public static function update($id, $params = null, $opts = null)
  94. {
  95. self::_validateParams($params);
  96. $url = static::resourceUrl($id);
  97. list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
  98. $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
  99. $obj->setLastResponse($response);
  100. return $obj;
  101. }
  102. }