Exemplo n.º 1
0
 /**
  * This method checks if the information passed
  * to the method is valid and if it is indeed
  * one of our partners. If so return true.
  *
  * @param  string $partnerID   The partner ID
  * @param  string $partnerKey  The partner Key
  * @return bool   If it is a valid partner or not.
  */
 public function isPartner($partnerID, $partnerKey)
 {
     // IP Validation should happen here.
     $model = Frapi_Model_Partner::isPartner($partnerID, $partnerKey);
     header('WWW-Authenticate: Basic realm="API Authentication"');
     if ($model === false) {
         throw new Frapi_Error(Frapi_Error::ERROR_INVALID_PARTNER_ID_NAME, Frapi_Error::ERROR_INVALID_PARTNER_ID_MSG, Frapi_Error::ERROR_INVALID_PARTNER_ID_NO);
     }
     return true;
 }
Exemplo n.º 2
0
 public function testIsPartnerExpectFalse()
 {
     $partner = Frapi_Model_Partner::isPartner('email', 'key');
     $this->assertFalse($partner);
 }