Culqi.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace Culqi;
  3. use Culqi\Error as Errors;
  4. /**
  5. * Class Culqi
  6. *
  7. * @package Culqi
  8. */
  9. class Culqi
  10. {
  11. public $api_key;
  12. /**
  13. * La versión de API usada
  14. */
  15. const API_VERSION = "v2.0";
  16. /**
  17. * La URL Base por defecto
  18. */
  19. const BASE_URL = "https://api.culqi.com/v2";
  20. /**
  21. * Constructor.
  22. *
  23. * @param array|null $options
  24. *
  25. * @throws Error\InvalidApiKey
  26. *
  27. * @example array('api_key' => "{api_key}")
  28. *
  29. */
  30. public function __construct($options)
  31. {
  32. $this->api_key = $options["api_key"];
  33. if (!$this->api_key) {
  34. throw new Errors\InvalidApiKey();
  35. }
  36. $this->Tokens = new Tokens($this);
  37. $this->Charges = new Charges($this);
  38. $this->Subscriptions = new Subscriptions($this);
  39. $this->Refunds = new Refunds($this);
  40. $this->Plans = new Plans($this);
  41. $this->Transfers = new Transfers($this);
  42. $this->Iins = new Iins($this);
  43. $this->Cards = new Cards($this);
  44. $this->Events = new Events($this);
  45. $this->Customers = new Customers($this);
  46. $this->Orders = new Orders($this);
  47. }
  48. }