Exemple #1
0
 public function buildRequestForm(\Think\Pay\PayVo $vo)
 {
     $param = array('inputCharset' => '1', 'pageUrl' => $this->config['return_url'], 'bgUrl' => $this->config['notify_url'], 'version' => 'v2.0', 'language' => 1, 'signType' => 1, 'merchantAcctId' => $vo->config['partner'], 'orderId' => $vo->getOrderNo(), 'orderAmount' => $vo->getFee() * 100, 'orderTime' => date("Ymdhis"), 'productName' => $vo->getTitle(), 'productDesc' => $vo->getBody(), 'payType' => '00');
     $param['signMsg'] = $this->createSign($param);
     $sHtml = $this->_buildForm($param, $this->gateway);
     return $sHtml;
 }
 public function buildRequestForm(\Think\Pay\PayVo $vo)
 {
     $param = array('p0_Cmd' => 'Buy', 'p1_MerId' => $this->config['partner'], 'p4_Cur' => 'CNY', 'p8_Url' => $this->config['return_url'], 'p2_Order' => $vo->getOrderNo(), 'p5_Pid' => $this->toGbk($vo->getTitle()), 'p3_Amt' => $vo->getFee(), 'p7_Pdesc' => $this->toGbk($vo->getBody()), 'pr_NeedResponse' => 1);
     $param['hmac'] = $this->createSign($param);
     $sHtml = $this->_buildForm($param, $this->gateway, 'post', 'gbk');
     return $sHtml;
 }
Exemple #3
0
 public function buildRequestForm(\Think\Pay\PayVo $vo)
 {
     $param = array('input_charset' => "UTF-8", 'body' => $vo->getBody(), 'subject' => $vo->getTitle(), 'return_url' => $this->config['return_url'], 'notify_url' => $this->config['notify_url'], 'partner' => $this->config['partner'], 'out_trade_no' => $vo->getOrderNo(), 'total_fee' => $vo->getFee() * 100, 'spbill_create_ip' => get_client_ip());
     $param['sign'] = $this->createSign($param);
     $sHtml = $this->_buildForm($param, $this->gateway);
     return $sHtml;
 }
 public function buildRequestForm(\Think\Pay\PayVo $vo)
 {
     $param = array('version' => '1.0.0', 'charset' => 'UTF-8', 'merId' => $this->config['partner'], 'transType' => "01", 'orderAmount' => $vo->getFee() * 100, 'orderNumber' => $vo->getOrderNo(), 'orderTime' => date('YmdHis'), 'orderCurrency' => "156", 'customerIp' => get_client_ip(), 'frontEndUrl' => $this->config['return_url'], 'backEndUrl' => $this->config['notify_url'], 'merAbbr' => $vo->getTitle(), 'merReserved' => '');
     $param['signature'] = $this->createSign($param);
     $param['signMethod'] = "md5";
     $sHtml = $this->_buildForm($param, $this->gateway);
     return $sHtml;
 }
Exemple #5
0
 public function buildRequestForm(\Think\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;
 }
Exemple #6
0
 public function buildRequestForm(PayVo $vo)
 {
     $req_id = date('Ymdhis');
     //请求业务参数详细
     $req_data = '<direct_trade_create_req>' . '<notify_url>' . $this->config['notify_url'] . '</notify_url>' . '<call_back_url>' . $this->config['return_url'] . '</call_back_url>' . '<seller_account_name>' . $this->config['email'] . '</seller_account_name>' . '<out_trade_no>' . $vo->getOrderNo() . '</out_trade_no>' . '<subject>' . $vo->getTitle() . '</subject>' . '<total_fee>' . $vo->getFee() . '</total_fee>' . '<merchant_url></merchant_url>' . '</direct_trade_create_req>';
     $param = array("service" => "alipay.wap.trade.create.direct", "partner" => $this->config['partner'], "sec_id" => "MD5", "format" => "xml", "v" => "2.0", "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => 'utf-8');
     $param['sign'] = $this->createSign($param);
     $return_html = $this->fsockOpen($this->gateway, "", $param);
     $return_data = $this->parseResponse(urldecode($return_html));
     if (isset($return_data['res_error'])) {
         $doc = new \DOMDocument();
         $doc->loadXML($return_data['res_error']);
         E('[(' . $doc->getElementsByTagName('code')->item(0)->nodeValue . ')' . $doc->getElementsByTagName('msg')->item(0)->nodeValue . ']' . $doc->getElementsByTagName('detail')->item(0)->nodeValue);
     }
     //获取request_token
     $request_token = $return_data['request_token'];
     //业务详细
     $req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
     //构造要请求的参数数组
     $param = array("service" => "alipay.wap.auth.authAndExecute", "partner" => $this->config['partner'], "sec_id" => "MD5", "format" => "xml", "v" => "2.0", "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => 'utf-8');
     $param['sign'] = $this->createSign($param);
     $sHtml = $this->_buildForm($param, $this->gateway, 'get');
     return $sHtml;
 }
Exemple #7
0
 public function buildRequestForm(\Think\Pay\PayVo $vo, $type = 'direct')
 {
     if ($type == 'direct') {
         $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());
     }
     if ($type == 'dualfun') {
         $param = array('service' => 'trade_create_by_buyer', '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(), 'price' => $vo->getFee(), 'quantity' => "1", 'logistics_fee' => "0.00", 'logistics_type' => "EXPRESS", 'logistics_payment' => "SELLER_PAY", 'show_url' => getPageURl(), 'receive_name' => "会员", 'receive_address' => "北京", 'receive_zip' => "100000", 'receive_phone' => "010-88888888", 'receive_mobile' => "13800138000");
     }
     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;
 }
Exemple #8
0
 public function buildRequestForm(\Think\Pay\PayVo $vo)
 {
     $param = array('cmd' => '_xclick', 'charset' => 'utf-8', 'business' => $this->config['business'], 'currency_code' => 'USD', 'notify_url' => $this->config['notify_url'], 'return' => $this->config['return_url'], 'invoice' => $vo->getOrderNo(), 'item_name' => $vo->getTitle(), 'amount' => $vo->getFee(), 'no_note' => 1, 'no_shipping' => 1);
     $sHtml = $this->_buildForm($param, $this->gateway);
     return $sHtml;
 }