TransferReversal.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace Stripe;
  3. /**
  4. * Class TransferReversal
  5. *
  6. * @property string $id
  7. * @property string $object
  8. * @property int $amount
  9. * @property string $balance_transaction
  10. * @property int $created
  11. * @property string $currency
  12. * @property mixed $metadata
  13. * @property string $transfer
  14. *
  15. * @package Stripe
  16. */
  17. class TransferReversal extends ApiResource
  18. {
  19. /**
  20. * @return string The API URL for this Stripe transfer reversal.
  21. */
  22. public function instanceUrl()
  23. {
  24. $id = $this['id'];
  25. $transfer = $this['transfer'];
  26. if (!$id) {
  27. throw new Error\InvalidRequest(
  28. "Could not determine which URL to request: " .
  29. "class instance has invalid ID: $id",
  30. null
  31. );
  32. }
  33. $id = Util\Util::utf8($id);
  34. $transfer = Util\Util::utf8($transfer);
  35. $base = Transfer::classUrl();
  36. $transferExtn = urlencode($transfer);
  37. $extn = urlencode($id);
  38. return "$base/$transferExtn/reversals/$extn";
  39. }
  40. /**
  41. * @param array|string|null $opts
  42. *
  43. * @return TransferReversal The saved reversal.
  44. */
  45. public function save($opts = null)
  46. {
  47. return $this->_save($opts);
  48. }
  49. }