コード例 #1
0
 /**
  * @param $method
  * @param $uri
  * @param array $nameValuePairs either headers or request params in format [ key => value ]
  * @param string $body
  * @throws Exception
  */
 public function validateSignature($method, $uri, array $nameValuePairs, $body = "")
 {
     $expectedSignature = $nameValuePairs["signature"];
     $actualSignature = $this->createSignature($method, $uri, PaymentHighwayUtility::parseSphParameters($nameValuePairs), $body);
     if ($expectedSignature != $actualSignature) {
         throw new Exception("Response signature mismatch!");
     }
 }
コード例 #2
0
 /**
  * @param string $uri
  * @param array $sphNameValuePairs
  * @return string formatted signature
  */
 private function createSecureSign($uri, $sphNameValuePairs = array())
 {
     $parsedSphParameters = PaymentHighwayUtility::parseSphParameters($sphNameValuePairs);
     $secureSigner = new SecureSigner($this->signatureKeyId, $this->signatureSecret);
     return $secureSigner->createSignature($this->method, $uri, $parsedSphParameters);
 }
コード例 #3
0
 /**
  * @dataProvider provider
  * @test
  * @param array $values
  */
 public function arrayFilteringIsWorkingCorrectly($values, $expectedRows)
 {
     $filtered = PaymentHighwayUtility::parseSphParameters($values);
     $this->assertCount($expectedRows, $filtered);
 }