public function buildRequestForm(\Org\Util\Pay\PayVo $vo) { $param = array('service' => 'create_direct_pay_by_user', 'payment_type' => '1', '_input_charset' => 'utf-8', 'seller_email' => $this->config['email'], 'partner' => $this->config['partner'], 'notify_url' => $this->config['notify_url'], 'return_url' => $this->config['return_url'], 'out_trade_no' => $vo->getOrderNo(), 'subject' => $vo->getTitle(), 'body' => $vo->getBody(), 'total_fee' => $vo->getFee()); ksort($param); reset($param); $arg = ''; foreach ($param as $key => $value) { if ($value) { $arg .= "{$key}={$value}&"; } } $param['sign'] = md5(substr($arg, 0, -1) . $this->config['key']); $param['sign_type'] = 'MD5'; $sHtml = $this->_buildForm($param, $this->gateway, 'get'); return $sHtml; }
public function buildRequestForm(\Org\Util\Pay\PayVo $vo) { $param = array('nonce_str' => (string) mt_rand(), 'spbill_create_ip' => get_client_ip(), 'device_info' => 'WEB', 'appid' => $this->config['appid'], 'mch_id' => $this->config['mch_id'], 'notify_url' => $this->config['notify_url'], 'out_trade_no' => $vo->getOrderNo(), 'body' => $vo->getTitle(), 'detail' => $vo->getBody(), 'total_fee' => $vo->getFee(), 'trade_type' => $vo->getType(), 'product_id' => $vo->getId(), 'openid' => $vo->getOpenid()); \Think\Log::write("11111" . $this->config['notify_url']); $param['sign'] = $this->signatureArithmetic($param); $param = $this->xml_encode($param); $order = $this->fsockOpen($this->gateway, 0, $param); return (array) simplexml_load_string($order, 'SimpleXMLElement', LIBXML_NOCDATA); }