Refund.php 901 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Pingpp;
  3. class Refund extends ApiResource
  4. {
  5. /**
  6. * @return string The API URL for this Pingpp refund.
  7. */
  8. public function instanceUrl()
  9. {
  10. $id = $this['id'];
  11. $charge = $this['charge'];
  12. if (!$id) {
  13. throw new Error\InvalidRequest(
  14. "Could not determine which URL to request: " .
  15. "class instance has invalid ID: $id",
  16. null
  17. );
  18. }
  19. $id = Util\Util::utf8($id);
  20. $charge = Util\Util::utf8($charge);
  21. $base = Charge::classUrl();
  22. $chargeExtn = urlencode($charge);
  23. $extn = urlencode($id);
  24. return "$base/$chargeExtn/refunds/$extn";
  25. }
  26. /**
  27. * @param array|string|null $opts
  28. *
  29. * @return Refund The saved refund.
  30. */
  31. public function save($opts = null)
  32. {
  33. return $this->_save($opts);
  34. }
  35. }