CreditReversalService.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Service\Treasury;
  4. /**
  5. * @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
  6. * @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
  7. */
  8. class CreditReversalService extends \Stripe\Service\AbstractService
  9. {
  10. /**
  11. * Returns a list of CreditReversals.
  12. *
  13. * @param null|array $params
  14. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  15. *
  16. * @throws \Stripe\Exception\ApiErrorException if the request fails
  17. *
  18. * @return \Stripe\Collection<\Stripe\Treasury\CreditReversal>
  19. */
  20. public function all($params = null, $opts = null)
  21. {
  22. return $this->requestCollection('get', '/v1/treasury/credit_reversals', $params, $opts);
  23. }
  24. /**
  25. * Reverses a ReceivedCredit and creates a CreditReversal object.
  26. *
  27. * @param null|array $params
  28. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  29. *
  30. * @throws \Stripe\Exception\ApiErrorException if the request fails
  31. *
  32. * @return \Stripe\Treasury\CreditReversal
  33. */
  34. public function create($params = null, $opts = null)
  35. {
  36. return $this->request('post', '/v1/treasury/credit_reversals', $params, $opts);
  37. }
  38. /**
  39. * Retrieves the details of an existing CreditReversal by passing the unique
  40. * CreditReversal ID from either the CreditReversal creation request or
  41. * CreditReversal list.
  42. *
  43. * @param string $id
  44. * @param null|array $params
  45. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  46. *
  47. * @throws \Stripe\Exception\ApiErrorException if the request fails
  48. *
  49. * @return \Stripe\Treasury\CreditReversal
  50. */
  51. public function retrieve($id, $params = null, $opts = null)
  52. {
  53. return $this->request('get', $this->buildPath('/v1/treasury/credit_reversals/%s', $id), $params, $opts);
  54. }
  55. }