ExchangeRateService.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 ExchangeRateService extends \Stripe\Service\AbstractService
  9. {
  10. /**
  11. * Returns a list of objects that contain the rates at which foreign currencies are
  12. * converted to one another. Only shows the currencies for which Stripe supports.
  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\ExchangeRate>
  20. */
  21. public function all($params = null, $opts = null)
  22. {
  23. return $this->requestCollection('get', '/v1/exchange_rates', $params, $opts);
  24. }
  25. /**
  26. * Retrieves the exchange rates from the given currency to every supported
  27. * currency.
  28. *
  29. * @param string $id
  30. * @param null|array $params
  31. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  32. *
  33. * @throws \Stripe\Exception\ApiErrorException if the request fails
  34. *
  35. * @return \Stripe\ExchangeRate
  36. */
  37. public function retrieve($id, $params = null, $opts = null)
  38. {
  39. return $this->request('get', $this->buildPath('/v1/exchange_rates/%s', $id), $params, $opts);
  40. }
  41. }