DebitReversal.php 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Treasury;
  4. /**
  5. * You can reverse some <a href="https://stripe.com/docs/api#received_debits">ReceivedDebits</a> depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a new object known as a DebitReversal.
  6. *
  7. * @property string $id Unique identifier for the object.
  8. * @property string $object String representing the object's type. Objects of the same type share the same value.
  9. * @property int $amount Amount (in cents) transferred.
  10. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  11. * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
  12. * @property null|string $financial_account The FinancialAccount to reverse funds from.
  13. * @property null|string $hosted_regulatory_receipt_url A <a href="https://stripe.com/docs/treasury/moving-money/regulatory-receipts">hosted transaction receipt</a> URL that is provided when money movement is considered regulated under Stripe's money transmission licenses.
  14. * @property null|\Stripe\StripeObject $linked_flows Other flows linked to a DebitReversal.
  15. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
  16. * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
  17. * @property string $network The rails used to reverse the funds.
  18. * @property string $received_debit The ReceivedDebit being reversed.
  19. * @property string $status Status of the DebitReversal
  20. * @property \Stripe\StripeObject $status_transitions
  21. * @property null|string|\Stripe\Treasury\Transaction $transaction The Transaction associated with this object.
  22. */
  23. class DebitReversal extends \Stripe\ApiResource
  24. {
  25. const OBJECT_NAME = 'treasury.debit_reversal';
  26. const NETWORK_ACH = 'ach';
  27. const NETWORK_CARD = 'card';
  28. const STATUS_FAILED = 'failed';
  29. const STATUS_PROCESSING = 'processing';
  30. const STATUS_SUCCEEDED = 'succeeded';
  31. /**
  32. * Reverses a ReceivedDebit and creates a DebitReversal object.
  33. *
  34. * @param null|array $params
  35. * @param null|array|string $options
  36. *
  37. * @throws \Stripe\Exception\ApiErrorException if the request fails
  38. *
  39. * @return \Stripe\Treasury\DebitReversal the created resource
  40. */
  41. public static function create($params = null, $options = null)
  42. {
  43. self::_validateParams($params);
  44. $url = static::classUrl();
  45. list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
  46. $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
  47. $obj->setLastResponse($response);
  48. return $obj;
  49. }
  50. /**
  51. * Returns a list of DebitReversals.
  52. *
  53. * @param null|array $params
  54. * @param null|array|string $opts
  55. *
  56. * @throws \Stripe\Exception\ApiErrorException if the request fails
  57. *
  58. * @return \Stripe\Collection<\Stripe\Treasury\DebitReversal> of ApiResources
  59. */
  60. public static function all($params = null, $opts = null)
  61. {
  62. $url = static::classUrl();
  63. return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
  64. }
  65. /**
  66. * Retrieves a DebitReversal object.
  67. *
  68. * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
  69. * @param null|array|string $opts
  70. *
  71. * @throws \Stripe\Exception\ApiErrorException if the request fails
  72. *
  73. * @return \Stripe\Treasury\DebitReversal
  74. */
  75. public static function retrieve($id, $opts = null)
  76. {
  77. $opts = \Stripe\Util\RequestOptions::parse($opts);
  78. $instance = new static($id, $opts);
  79. $instance->refresh();
  80. return $instance;
  81. }
  82. }