ApplePayDomain.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe;
  4. /**
  5. * @property string $id Unique identifier for the object.
  6. * @property string $object String representing the object's type. Objects of the same type share the same value.
  7. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  8. * @property string $domain_name
  9. * @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.
  10. */
  11. class ApplePayDomain extends ApiResource
  12. {
  13. const OBJECT_NAME = 'apple_pay_domain';
  14. /**
  15. * Create an apple pay domain.
  16. *
  17. * @param null|array $params
  18. * @param null|array|string $options
  19. *
  20. * @throws \Stripe\Exception\ApiErrorException if the request fails
  21. *
  22. * @return \Stripe\ApplePayDomain the created resource
  23. */
  24. public static function create($params = null, $options = null)
  25. {
  26. self::_validateParams($params);
  27. $url = static::classUrl();
  28. list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
  29. $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
  30. $obj->setLastResponse($response);
  31. return $obj;
  32. }
  33. /**
  34. * Delete an apple pay domain.
  35. *
  36. * @param null|array $params
  37. * @param null|array|string $opts
  38. *
  39. * @throws \Stripe\Exception\ApiErrorException if the request fails
  40. *
  41. * @return \Stripe\ApplePayDomain the deleted resource
  42. */
  43. public function delete($params = null, $opts = null)
  44. {
  45. self::_validateParams($params);
  46. $url = $this->instanceUrl();
  47. list($response, $opts) = $this->_request('delete', $url, $params, $opts);
  48. $this->refreshFrom($response, $opts);
  49. return $this;
  50. }
  51. /**
  52. * List apple pay domains.
  53. *
  54. * @param null|array $params
  55. * @param null|array|string $opts
  56. *
  57. * @throws \Stripe\Exception\ApiErrorException if the request fails
  58. *
  59. * @return \Stripe\Collection<\Stripe\ApplePayDomain> of ApiResources
  60. */
  61. public static function all($params = null, $opts = null)
  62. {
  63. $url = static::classUrl();
  64. return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
  65. }
  66. /**
  67. * Retrieve an apple pay domain.
  68. *
  69. * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
  70. * @param null|array|string $opts
  71. *
  72. * @throws \Stripe\Exception\ApiErrorException if the request fails
  73. *
  74. * @return \Stripe\ApplePayDomain
  75. */
  76. public static function retrieve($id, $opts = null)
  77. {
  78. $opts = \Stripe\Util\RequestOptions::parse($opts);
  79. $instance = new static($id, $opts);
  80. $instance->refresh();
  81. return $instance;
  82. }
  83. /**
  84. * @return string The class URL for this resource. It needs to be special
  85. * cased because it doesn't fit into the standard resource pattern.
  86. */
  87. public static function classUrl()
  88. {
  89. return '/v1/apple_pay/domains';
  90. }
  91. }