Dispute.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace Stripe;
  3. /**
  4. * Class Dispute
  5. *
  6. * @property string $id
  7. * @property string $object
  8. * @property int $amount
  9. * @property BalanceTransaction[] $balance_transactions
  10. * @property string $charge
  11. * @property int $created
  12. * @property string $currency
  13. * @property mixed $evidence
  14. * @property mixed $evidence_details
  15. * @property bool $is_charge_refundable
  16. * @property bool $livemode
  17. * @property StripeObject $metadata
  18. * @property string $reason
  19. * @property string $status
  20. *
  21. * @package Stripe
  22. */
  23. class Dispute extends ApiResource
  24. {
  25. const OBJECT_NAME = "dispute";
  26. use ApiOperations\All;
  27. use ApiOperations\Retrieve;
  28. use ApiOperations\Update;
  29. /**
  30. * Possible string representations of dispute reasons.
  31. * @link https://stripe.com/docs/api#dispute_object
  32. */
  33. const REASON_BANK_CANNOT_PROCESS = 'bank_cannot_process';
  34. const REASON_CREDIT_NOT_PROCESSED = 'credit_not_processed';
  35. const REASON_CUSTOMER_INITIATED = 'customer_initiated';
  36. const REASON_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized';
  37. const REASON_DUPLICATE = 'duplicate';
  38. const REASON_FRAUDULENT = 'fraudulent';
  39. const REASON_GENERAL = 'general';
  40. const REASON_INCORRECT_ACCOUNT_DETAILS = 'incorrect_account_details';
  41. const REASON_INSUFFICIENT_FUNDS = 'insufficient_funds';
  42. const REASON_PRODUCT_NOT_RECEIVED = 'product_not_received';
  43. const REASON_PRODUCT_UNACCEPTABLE = 'product_unacceptable';
  44. const REASON_SUBSCRIPTION_CANCELED = 'subscription_canceled';
  45. const REASON_UNRECOGNIZED = 'unrecognized';
  46. /**
  47. * Possible string representations of dispute statuses.
  48. * @link https://stripe.com/docs/api#dispute_object
  49. */
  50. const STATUS_CHARGE_REFUNDED = 'charge_refunded';
  51. const STATUS_LOST = 'lost';
  52. const STATUS_NEEDS_RESPONSE = 'needs_response';
  53. const STATUS_UNDER_REVIEW = 'under_review';
  54. const STATUS_WARNING_CLOSED = 'warning_closed';
  55. const STATUS_WARNING_NEEDS_RESPONSE = 'warning_needs_response';
  56. const STATUS_WARNING_UNDER_REVIEW = 'warning_under_review';
  57. const STATUS_WON = 'won';
  58. /**
  59. * @param array|string|null $options
  60. *
  61. * @return Dispute The closed dispute.
  62. */
  63. public function close($options = null)
  64. {
  65. $url = $this->instanceUrl() . '/close';
  66. list($response, $opts) = $this->_request('post', $url, null, $options);
  67. $this->refreshFrom($response, $opts);
  68. return $this;
  69. }
  70. }