public function testEncrypted()
 {
     $secret = "f5cd6a754f3ed64ea8697be6f662910fe7d7e9b0bee47a23214964a6a12db69f";
     $method = "post";
     $path = "/api/orders";
     $params = array("foo" => "bar", "xyz" => "123", "api_timestamp" => "1390928206");
     $json_body = array("orders" => array("id" => "1234"));
     $signature = new ShippingEasy_Signature($secret, $method, $path, $params, $json_body);
     $this->assertEqual($signature->encrypted(), "f01d4c9bb1dec1a5f46d2a3ba9dfbdc6f3c145604440fb145677eb7ef3af9731");
 }
 public function __construct($http_method = null, $path = null, $params = null, $json_body = null, $api_timestamp = null, $api_key = null, $api_secret = null)
 {
     $api_secret = isset($api_secret) ? $api_secret : ShippingEasy::$apiSecret;
     $params["api_key"] = isset($api_key) ? $api_key : ShippingEasy::$apiKey;
     $params["api_timestamp"] = isset($api_timestamp) ? $api_timestamp : time();
     $signature_object = new ShippingEasy_Signature($api_secret, $http_method, $path, $params, $json_body);
     $params["api_signature"] = $signature_object->encrypted();
     $this->params = $params;
     $this->path = $path;
 }
 public function testIsAuthenticated()
 {
     $secret = "f5cd6a754f3ed64ea8697be6f662910fe7d7e9b0bee47a23214964a6a12db69f";
     $method = "post";
     $path = "/api/orders";
     $params = array("foo" => "bar", "xyz" => "123", "api_timestamp" => "1390928206");
     $json_body = json_encode(array("orders" => array("id" => "1234")));
     $signature = new ShippingEasy_Signature($secret, $method, $path, $params, $json_body);
     $params["api_signature"] = $signature->encrypted();
     $authenticator = new ShippingEasy_Authenticator($method, $path, $params, $json_body, $secret);
     $this->assertTrue($authenticator->isAuthenticated());
     $authenticator = new ShippingEasy_Authenticator($method, $path, $params, null, $secret);
     $this->assertFalse($authenticator->isAuthenticated());
 }