Пример #1
0
 public static function sign($params)
 {
     ksort($params);
     $sourceSignString = SignUtil::signString($params, SignUtil::$unSignKeyListForWap);
     LogUtil::log($sourceSignString, LogUtil::OTHER);
     $sha256SourceSignString = hash("sha256", $sourceSignString);
     //LogUtil::log( $sha256SourceSignString, LogUtil::OTHER );
     return RSAUtils::encryptByPrivateKey($sha256SourceSignString);
 }
Пример #2
0
 /**
  * 封装支付表单参数
  *
  * @param array $formData
  *
  * @return array
  */
 public static function filterWapPayFormData(array $formData)
 {
     $param = array();
     $param["currency"] = 'CNY';
     // 交易币种
     $param['merchantNum'] = self::$_merchant;
     // 商户号
     $param["merchantRemark"] = isset($formData["merchantRemark"]) ? $formData["merchantRemark"] : "";
     // 请输入商户备注
     $param["notifyUrl"] = self::$_pay_syn_url;
     $param["successCallbackUrl"] = self::$_pay_asyn_url;
     $param["failCallbackUrl"] = self::$_fail_pay_syn_url;
     $param["tradeAmount"] = isset($formData["tradeAmount"]) ? $formData["tradeAmount"] : 0;
     // 交易金额
     $param["tradeDescription"] = isset($formData["tradeDescription"]) ? $formData["tradeDescription"] : "";
     // 交易描述
     $param["tradeName"] = isset($formData["tradeName"]) ? $formData["tradeName"] : "";
     // 商品名称
     $param["tradeNum"] = isset($formData["tradeNum"]) ? $formData["tradeNum"] : "";
     // 用户订单号
     $param["tradeTime"] = date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']);
     $param["version"] = '3.0';
     $param["token"] = isset($formData["token"]) ? $formData["token"] : "";
     // 用户交易令牌 记录用户身份的标识
     $deUtils = new DesUtils();
     if (isset($formData["specBankCardNo"]) && !empty($formData["specBankCardNo"]) && isset($formData["specIdCard"]) && !empty($formData["specIdCard"]) && isset($formData["specName"]) && !empty($formData["specName"])) {
         // 卡前置不为空
         $specialJson = array();
         $specialJson["specBankCardNo"] = isset($formData["specBankCardNo"]) ? $formData["specBankCardNo"] : "";
         // 卡号
         $specialJson["specIdCard"] = isset($formData["specIdCard"]) ? $formData["specIdCard"] : "";
         // 身份证号
         $specialJson["specName"] = isset($formData["specName"]) ? $formData["specName"] : "";
         // 姓名
         $param["specifyInfoJson"] = json_encode($specialJson);
     }
     $param["merchantSign"] = SignUtil::sign($param);
     $param["merchantRemark"] = $deUtils->encrypt($param["merchantRemark"], self::$_DES);
     $param["tradeNum"] = $deUtils->encrypt($param["tradeNum"], self::$_DES);
     $param["tradeName"] = $deUtils->encrypt($param["tradeName"], self::$_DES);
     $param["tradeDescription"] = $deUtils->encrypt($param["tradeDescription"], self::$_DES);
     $param["tradeTime"] = $deUtils->encrypt($param["tradeTime"], self::$_DES);
     $param["tradeAmount"] = $deUtils->encrypt($param["tradeAmount"], self::$_DES);
     $param["currency"] = $deUtils->encrypt($param["currency"], self::$_DES);
     $param["notifyUrl"] = $deUtils->encrypt($param["notifyUrl"], self::$_DES);
     $param["successCallbackUrl"] = $deUtils->encrypt($param["successCallbackUrl"], self::$_DES);
     $param["failCallbackUrl"] = $deUtils->encrypt($param["failCallbackUrl"], self::$_DES);
     if (isset($formData["specBankCardNo"]) && !empty($formData["specBankCardNo"]) && isset($formData["specIdCard"]) && !empty($formData["specIdCard"]) && isset($formData["specName"]) && !empty($formData["specName"])) {
         $param["specifyInfoJson"] = $deUtils->encrypt($param["specifyInfoJson"], self::$_DES);
     }
     return $param;
 }