ApplicationFee.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. namespace Stripe;
  3. /**
  4. * Class ApplicationFee
  5. *
  6. * @property string $id
  7. * @property string $object
  8. * @property string $account
  9. * @property int $amount
  10. * @property int $amount_refunded
  11. * @property string $application
  12. * @property string $balance_transaction
  13. * @property string $charge
  14. * @property int $created
  15. * @property string $currency
  16. * @property bool $livemode
  17. * @property string $originating_transaction
  18. * @property bool $refunded
  19. * @property Collection $refunds
  20. *
  21. * @package Stripe
  22. */
  23. class ApplicationFee extends ApiResource
  24. {
  25. const OBJECT_NAME = "application_fee";
  26. use ApiOperations\All;
  27. use ApiOperations\NestedResource;
  28. use ApiOperations\Retrieve;
  29. const PATH_REFUNDS = '/refunds';
  30. /**
  31. * @param array|null $params
  32. * @param array|string|null $opts
  33. *
  34. * @return ApplicationFee The refunded application fee.
  35. */
  36. public function refund($params = null, $opts = null)
  37. {
  38. $this->refunds->create($params, $opts);
  39. $this->refresh();
  40. return $this;
  41. }
  42. /**
  43. * @param array|null $id The ID of the application fee on which to create the refund.
  44. * @param array|null $params
  45. * @param array|string|null $opts
  46. *
  47. * @return ApplicationFeeRefund
  48. */
  49. public static function createRefund($id, $params = null, $opts = null)
  50. {
  51. return self::_createNestedResource($id, static::PATH_REFUNDS, $params, $opts);
  52. }
  53. /**
  54. * @param array|null $id The ID of the application fee to which the refund belongs.
  55. * @param array|null $refundId The ID of the refund to retrieve.
  56. * @param array|null $params
  57. * @param array|string|null $opts
  58. *
  59. * @return ApplicationFeeRefund
  60. */
  61. public static function retrieveRefund($id, $refundId, $params = null, $opts = null)
  62. {
  63. return self::_retrieveNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $opts);
  64. }
  65. /**
  66. * @param array|null $id The ID of the application fee to which the refund belongs.
  67. * @param array|null $refundId The ID of the refund to update.
  68. * @param array|null $params
  69. * @param array|string|null $opts
  70. *
  71. * @return ApplicationFeeRefund
  72. */
  73. public static function updateRefund($id, $refundId, $params = null, $opts = null)
  74. {
  75. return self::_updateNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $opts);
  76. }
  77. /**
  78. * @param array|null $id The ID of the application fee on which to retrieve the refunds.
  79. * @param array|null $params
  80. * @param array|string|null $opts
  81. *
  82. * @return ApplicationFeeRefund
  83. */
  84. public static function allRefunds($id, $params = null, $opts = null)
  85. {
  86. return self::_allNestedResources($id, static::PATH_REFUNDS, $params, $opts);
  87. }
  88. }