TestClockService.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Service\TestHelpers;
  4. /**
  5. * @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
  6. * @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
  7. */
  8. class TestClockService extends \Stripe\Service\AbstractService
  9. {
  10. /**
  11. * Starts advancing a test clock to a specified time in the future. Advancement is
  12. * done when status changes to <code>Ready</code>.
  13. *
  14. * @param string $id
  15. * @param null|array $params
  16. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  17. *
  18. * @throws \Stripe\Exception\ApiErrorException if the request fails
  19. *
  20. * @return \Stripe\TestHelpers\TestClock
  21. */
  22. public function advance($id, $params = null, $opts = null)
  23. {
  24. return $this->request('post', $this->buildPath('/v1/test_helpers/test_clocks/%s/advance', $id), $params, $opts);
  25. }
  26. /**
  27. * Returns a list of your test clocks.
  28. *
  29. * @param null|array $params
  30. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  31. *
  32. * @throws \Stripe\Exception\ApiErrorException if the request fails
  33. *
  34. * @return \Stripe\Collection<\Stripe\TestHelpers\TestClock>
  35. */
  36. public function all($params = null, $opts = null)
  37. {
  38. return $this->requestCollection('get', '/v1/test_helpers/test_clocks', $params, $opts);
  39. }
  40. /**
  41. * Creates a new test clock that can be attached to new customers and quotes.
  42. *
  43. * @param null|array $params
  44. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  45. *
  46. * @throws \Stripe\Exception\ApiErrorException if the request fails
  47. *
  48. * @return \Stripe\TestHelpers\TestClock
  49. */
  50. public function create($params = null, $opts = null)
  51. {
  52. return $this->request('post', '/v1/test_helpers/test_clocks', $params, $opts);
  53. }
  54. /**
  55. * Deletes a test clock.
  56. *
  57. * @param string $id
  58. * @param null|array $params
  59. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  60. *
  61. * @throws \Stripe\Exception\ApiErrorException if the request fails
  62. *
  63. * @return \Stripe\TestHelpers\TestClock
  64. */
  65. public function delete($id, $params = null, $opts = null)
  66. {
  67. return $this->request('delete', $this->buildPath('/v1/test_helpers/test_clocks/%s', $id), $params, $opts);
  68. }
  69. /**
  70. * Retrieves a test clock.
  71. *
  72. * @param string $id
  73. * @param null|array $params
  74. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  75. *
  76. * @throws \Stripe\Exception\ApiErrorException if the request fails
  77. *
  78. * @return \Stripe\TestHelpers\TestClock
  79. */
  80. public function retrieve($id, $params = null, $opts = null)
  81. {
  82. return $this->request('get', $this->buildPath('/v1/test_helpers/test_clocks/%s', $id), $params, $opts);
  83. }
  84. }