コード例 #1
0
ファイル: Client.php プロジェクト: ventsiwad/presta_addons
 /**
  * Get the singleton
  *
  * @return object
  */
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new GiveItSdkClient();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: SDK.php プロジェクト: ventsiwad/presta_addons
 public function verifyKeys()
 {
     $client = GiveItSdkClient::getInstance();
     $authenticated = $client->authenticate();
     if (!$authenticated) {
         $this->addError('unable to log in with private key');
         return false;
     }
     $result = $client->sendGET('/retailers/me');
     if (isset($result->errors)) {
         foreach ($result->errors as $error) {
             $this->addError($error);
         }
         return false;
     }
     // at this point we can assume that the private key is okay, verify the other two
     if ($result->public_api_key != $this->public_key) {
         $this->addError('incorrect public key');
         return false;
     }
     if ($result->data_key != $this->data_key) {
         $this->addError('incorrect data key');
         return false;
     }
     return true;
 }
コード例 #3
0
ファイル: Sale.php プロジェクト: ventsiwad/presta_addons
 public function setShipped()
 {
     $client = GiveItSdkClient::getInstance();
     $data = array('status' => 'retailer_shipped');
     $client->sendPUT("/sales/{$this->id}", $data);
 }
コード例 #4
0
 private function setupClient()
 {
     $this->client = GiveItSdkClient::getInstance();
 }