Omnipay\Alipay\Requests\AbstractLegacyRequest::sign PHP Method

sign() protected method

protected sign ( $params, $signType )
    protected function sign($params, $signType)
    {
        $signer = new Signer($params);
        $signType = strtoupper($signType);
        if ($signType == 'MD5') {
            if (!$this->getKey()) {
                throw new InvalidRequestException('The `key` is required for `MD5` sign_type');
            }
            $sign = $signer->signWithMD5($this->getKey());
        } elseif ($signType == 'RSA') {
            if (!$this->getPrivateKey()) {
                throw new InvalidRequestException('The `private_key` is required for `RSA` sign_type');
            }
            $sign = $signer->signWithRSA($this->getPrivateKey());
        } else {
            throw new InvalidRequestException('The signType is not allowed');
        }
        return $sign;
    }