Source.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace Stripe;
  3. /**
  4. * Class Source
  5. *
  6. * @package Stripe
  7. */
  8. class Source extends ApiResource
  9. {
  10. /**
  11. * @param string $id The ID of the Source to retrieve.
  12. * @param array|string|null $opts
  13. *
  14. * @return Source
  15. */
  16. public static function retrieve($id, $opts = null)
  17. {
  18. return self::_retrieve($id, $opts);
  19. }
  20. /**
  21. * @param array|null $params
  22. * @param array|string|null $opts
  23. *
  24. * @return Collection of Sources
  25. */
  26. public static function all($params = null, $opts = null)
  27. {
  28. return self::_all($params, $opts);
  29. }
  30. /**
  31. * @param array|null $params
  32. * @param array|string|null $opts
  33. *
  34. * @return Source The created Source.
  35. */
  36. public static function create($params = null, $opts = null)
  37. {
  38. return self::_create($params, $opts);
  39. }
  40. /**
  41. * @param string $id The ID of the source to update.
  42. * @param array|null $params
  43. * @param array|string|null $options
  44. *
  45. * @return Source The updated source.
  46. */
  47. public static function update($id, $params = null, $options = null)
  48. {
  49. return self::_update($id, $params, $options);
  50. }
  51. /**
  52. * @param array|string|null $opts
  53. *
  54. * @return Source The saved source.
  55. */
  56. public function save($opts = null)
  57. {
  58. return $this->_save($opts);
  59. }
  60. /**
  61. * @param array|null $params
  62. * @param array|string|null $options
  63. *
  64. * @return BankAccount The verified bank account.
  65. */
  66. public function verify($params = null, $options = null)
  67. {
  68. $url = $this->instanceUrl() . '/verify';
  69. list($response, $opts) = $this->_request('post', $url, $params, $options);
  70. $this->refreshFrom($response, $opts);
  71. return $this;
  72. }
  73. }