Charges.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace Culqi;
  3. /**
  4. * Class Charges
  5. *
  6. * @package Culqi
  7. */
  8. class Charges extends Resource {
  9. const URL_CHARGES = "/charges/";
  10. /**
  11. * @param array|null $options
  12. *
  13. * @return all Charges.
  14. */
  15. public function all($options = NULL) {
  16. return $this->request("GET", self::URL_CHARGES, $api_key = $this->culqi->api_key, $options);
  17. }
  18. /**
  19. * @param array|null $options
  20. *
  21. * @return create Charge response.
  22. */
  23. public function create($options = NULL) {
  24. return $this->request("POST", self::URL_CHARGES, $api_key = $this->culqi->api_key, $options);
  25. }
  26. /**
  27. * @param string|null $id
  28. *
  29. * @return get a Charge.
  30. */
  31. public function get($id = NULL) {
  32. return $this->request("GET", self::URL_CHARGES . $id . "/", $api_key = $this->culqi->api_key);
  33. }
  34. /**
  35. * @param string|null $id
  36. *
  37. * @return get a capture of Charge.
  38. */
  39. public function capture($id = NULL) {
  40. return $this->request("POST", self::URL_CHARGES . $id . "/capture/", $api_key = $this->culqi->api_key);
  41. }
  42. /**
  43. * @param string|null $id
  44. * @param array|null $options
  45. *
  46. * @return update Charge response.
  47. */
  48. public function update($id = NULL, $options = NULL) {
  49. return $this->request("PATCH", self::URL_CHARGES . $id . "/", $api_key = $this->culqi->api_key, $options);
  50. }
  51. }