getApiKey() публичный статический Метод

public static getApiKey ( )
Пример #1
0
 public function run()
 {
     if (!parent::getApiKey()) {
         throw new PagarMe_Exception("You need to configure API key before performing requests.");
     }
     $this->parameters = array_merge($this->parameters, array("api_key" => parent::getApiKey()));
     // var_dump($this->parameters);
     // $this->headers = (PagarMe::live) ? array("X-Live" => 1) : array();
     $client = new RestClient(array("method" => $this->method, "url" => $this->full_api_url($this->path), "headers" => $this->headers, "parameters" => $this->parameters));
     $response = $client->run();
     $decode = json_decode($response["body"], true);
     if ($decode === NULL) {
         throw new Exception("Failed to decode json from response.\n\n Response: " . $response);
     } else {
         if ($response["code"] == 200) {
             return $decode;
         } else {
             throw PagarMe_Exception::buildWithFullMessage($decode);
         }
     }
 }
Пример #2
0
 public function testFingerprint()
 {
     $this->assertTrue(PagarMe::validateFingerprint('13', sha1('13' . '#' . PagarMe::getApiKey())));
 }