TaxRateService.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Service;
  4. /**
  5. * @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
  6. * @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
  7. */
  8. class TaxRateService extends \Stripe\Service\AbstractService
  9. {
  10. /**
  11. * Returns a list of your tax rates. Tax rates are returned sorted by creation
  12. * date, with the most recently created tax rates appearing first.
  13. *
  14. * @param null|array $params
  15. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  16. *
  17. * @throws \Stripe\Exception\ApiErrorException if the request fails
  18. *
  19. * @return \Stripe\Collection<\Stripe\TaxRate>
  20. */
  21. public function all($params = null, $opts = null)
  22. {
  23. return $this->requestCollection('get', '/v1/tax_rates', $params, $opts);
  24. }
  25. /**
  26. * Creates a new tax rate.
  27. *
  28. * @param null|array $params
  29. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  30. *
  31. * @throws \Stripe\Exception\ApiErrorException if the request fails
  32. *
  33. * @return \Stripe\TaxRate
  34. */
  35. public function create($params = null, $opts = null)
  36. {
  37. return $this->request('post', '/v1/tax_rates', $params, $opts);
  38. }
  39. /**
  40. * Retrieves a tax rate with the given ID.
  41. *
  42. * @param string $id
  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\TaxRate
  49. */
  50. public function retrieve($id, $params = null, $opts = null)
  51. {
  52. return $this->request('get', $this->buildPath('/v1/tax_rates/%s', $id), $params, $opts);
  53. }
  54. /**
  55. * Updates an existing tax rate.
  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\TaxRate
  64. */
  65. public function update($id, $params = null, $opts = null)
  66. {
  67. return $this->request('post', $this->buildPath('/v1/tax_rates/%s', $id), $params, $opts);
  68. }
  69. }