TaxRateService.php 2.0 KB

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