Transfer.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. namespace Stripe;
  3. /**
  4. * Class Transfer
  5. *
  6. * @property string $id
  7. * @property string $object
  8. * @property int $amount
  9. * @property int $amount_reversed
  10. * @property mixed $application_fee
  11. * @property string $balance_transaction
  12. * @property int $created
  13. * @property string $currency
  14. * @property int $date
  15. * @property mixed $description
  16. * @property mixed $destination
  17. * @property mixed $destination_payment
  18. * @property mixed $failure_code
  19. * @property mixed $failure_message
  20. * @property mixed $fraud_details
  21. * @property mixed $invoice
  22. * @property bool $livemode
  23. * @property mixed $metadata
  24. * @property mixed $recipient
  25. * @property mixed $reversals
  26. * @property bool $reversed
  27. * @property mixed $source_transaction
  28. * @property string $source_type
  29. * @property mixed $statement_descriptor
  30. * @property string $status
  31. * @property string $type
  32. *
  33. * @package Stripe
  34. */
  35. class Transfer extends ApiResource
  36. {
  37. /**
  38. * @param string $id The ID of the transfer to retrieve.
  39. * @param array|string|null $opts
  40. *
  41. * @return Transfer
  42. */
  43. public static function retrieve($id, $opts = null)
  44. {
  45. return self::_retrieve($id, $opts);
  46. }
  47. /**
  48. * @param array|null $params
  49. * @param array|string|null $opts
  50. *
  51. * @return Collection of Transfers
  52. */
  53. public static function all($params = null, $opts = null)
  54. {
  55. return self::_all($params, $opts);
  56. }
  57. /**
  58. * @param array|null $params
  59. * @param array|string|null $opts
  60. *
  61. * @return Transfer The created transfer.
  62. */
  63. public static function create($params = null, $opts = null)
  64. {
  65. return self::_create($params, $opts);
  66. }
  67. /**
  68. * @param string $id The ID of the transfer to update.
  69. * @param array|null $params
  70. * @param array|string|null $options
  71. *
  72. * @return Transfer The updated transfer.
  73. */
  74. public static function update($id, $params = null, $options = null)
  75. {
  76. return self::_update($id, $params, $options);
  77. }
  78. /**
  79. * @return TransferReversal The created transfer reversal.
  80. */
  81. public function reverse($params = null, $opts = null)
  82. {
  83. $url = $this->instanceUrl() . '/reversals';
  84. list($response, $opts) = $this->_request('post', $url, $params, $opts);
  85. $this->refreshFrom($response, $opts);
  86. return $this;
  87. }
  88. /**
  89. * @return Transfer The canceled transfer.
  90. */
  91. public function cancel()
  92. {
  93. $url = $this->instanceUrl() . '/cancel';
  94. list($response, $opts) = $this->_request('post', $url);
  95. $this->refreshFrom($response, $opts);
  96. return $this;
  97. }
  98. /**
  99. * @param array|string|null $opts
  100. *
  101. * @return Transfer The saved transfer.
  102. */
  103. public function save($opts = null)
  104. {
  105. return $this->_save($opts);
  106. }
  107. }