TransferReversal.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 StripeObject $metadata
  13. * @property string $transfer
  14. *
  15. * @package Stripe
  16. */
  17. class TransferReversal extends ApiResource
  18. {
  19. const OBJECT_NAME = "transfer_reversal";
  20. use ApiOperations\Update {
  21. save as protected _save;
  22. }
  23. /**
  24. * @return string The API URL for this Stripe transfer reversal.
  25. */
  26. public function instanceUrl()
  27. {
  28. $id = $this['id'];
  29. $transfer = $this['transfer'];
  30. if (!$id) {
  31. throw new Error\InvalidRequest(
  32. "Could not determine which URL to request: " .
  33. "class instance has invalid ID: $id",
  34. null
  35. );
  36. }
  37. $id = Util\Util::utf8($id);
  38. $transfer = Util\Util::utf8($transfer);
  39. $base = Transfer::classUrl();
  40. $transferExtn = urlencode($transfer);
  41. $extn = urlencode($id);
  42. return "$base/$transferExtn/reversals/$extn";
  43. }
  44. /**
  45. * @param array|string|null $opts
  46. *
  47. * @return TransferReversal The saved reversal.
  48. */
  49. public function save($opts = null)
  50. {
  51. return $this->_save($opts);
  52. }
  53. }