예제 #1
0
 public function buildParam(BaseParam $param, $result_type = 'array')
 {
     $param->filter();
     $param->sort();
     $param->setSign(EncryptionFactory::create($this->config)->sign($param->getParamString()));
     $param->setSignType($this->config->sign_type);
     if ($result_type == 'array') {
         return $param->getParams();
     } else {
         return $param->getParamString();
     }
 }
예제 #2
0
 public function buildParamArray(BaseParam $param)
 {
     $param->filter();
     $param->sort();
     $param->setSign(EncryptionFactory::create($this->config)->sign($param->getParamString()));
     $param->setSignType($this->config->sign_type);
     return $param->getParams();
 }
예제 #3
0
 /**
  * 获取返回时签名验证结果
  *
  * @param BaseParam $param
  * @param             $sign
  *
  * @return bool
  */
 public function getSignVerify(BaseParam $param, $sign)
 {
     $param->filter();
     $param->sort();
     $param_str = $param->getParamString();
     $isSign = EncryptionFactory::create($this->config)->verify($param_str, $sign);
     return $isSign;
 }
예제 #4
0
 /**
  * @param $sign
  * @param $sign_type
  *
  * @dataProvider doubleParamProvider
  */
 public function testGetParamString($sign, $sign_type)
 {
     $this->base_param->setSign($sign);
     $this->base_param->setSignType($sign_type);
     $this->assertEquals("sign={$sign}&sign_type={$sign_type}", $this->base_param->getParamString());
 }