public function getPayUrl($sn, $type, $price, $callBackUrl, $name, $description = "", $frontUrl = "", $defaultbank) { /*{{{*/ $sn = Pay::makeSN($sn, $type); //构造要请求的参数数组 $parameter = array("service" => "create_direct_pay_by_user", "partner" => $this->partner, "payment_type" => "1", "notify_url" => $callBackUrl, "return_url" => $frontUrl, "seller_email" => $this->seller_email, "out_trade_no" => $sn, "subject" => $name . "-订单号({$sn})", "total_fee" => $price, "body" => $description, "paymethod" => 'bankPay', "defaultbank" => $defaultbank, "show_url" => $this->show_url, "anti_phishing_key" => '', "exter_invoke_ip" => '', "_input_charset" => $this->input_charset); $alipay_config = $this->getInitData(); //建立请求 $alipaySubmit = new GatewayAlipaySubmit($alipay_config); $html_text = $alipaySubmit->buildRequestForm($parameter, "get", "确认"); return $html_text; }
public function getPayUrl($sn, $type, $price, $callBackUrl, $name, $description = "", $frontUrl = "") { /*{{{*/ //if(strpos($callBackUrl,'haodf.com') === false) //{ // $price = 0.01; //这里用于测试,价格是0.01元,上线后取上一行 //} $sn = Pay::makeSN($sn, $type); $parameter = array("service" => "create_direct_pay_by_user", "partner" => $this->partner, "return_url" => $frontUrl, "notify_url" => $callBackUrl, "_input_charset" => $this->_input_charset, "subject" => $name . "-订单号({$sn})", "body" => $description, "out_trade_no" => $sn, "total_fee" => $price, "payment_type" => "1", "show_url" => $this->show_url, "seller_email" => $this->seller_email); $alipay = new alipay_service($parameter, $this->security_code, $this->sign_type); $url = $alipay->create_url(); return $url; }
public function setOrderInfo($orderArr, $type) { /*{{{*/ DBC::requireNotEmpty($orderArr, '设置订单产品信息数组不可为空'); foreach ($orderArr as $key => $val) { if (isset($this->configs[$key])) { $this->configs[$key] = $val; } } //这里用于测试,价格是0.01元,上线后取上一行 //if(strpos($this->configs['bgUrl'],'haodf.com') === false) //{ // $this->configs['orderAmount'] = 0.01; //} /*测试结束*/ $this->configs['orderAmount'] = 100 * $this->configs['orderAmount']; $this->configs['orderId'] = Pay::makeSN($this->configs['orderId'], $type); }
public function encryptOrderInfo($sn, $type, $price, $callBackUrl, $name, $description = '') { /*{{{*/ $callBackUrl = urlencode($callBackUrl); $sn = Pay::makeSN($sn, $type); $partner = $this->partner; $seller = $this->seller; $out_trade_no = $sn; $subject = $name . "-订单号({$sn})"; $body = $description; $total_fee = number_format($price, 2, '.', ''); $notifyurl = $callBackUrl; //异步返回 $waitSign = 'partner="' . $partner . '"&seller="' . $seller . '"&out_trade_no="' . $out_trade_no . '"&subject="' . $subject . '"&body="' . $body . '"&total_fee="' . $total_fee . '"¬ify_url="' . $notifyurl . '"'; // $waitSignArr = array('partner' => $partner, 'seller' => $seller, 'out_trade_no' => $out_trade_no, 'subject' => $subject, 'body' => $body, 'total_fee' => $total_fee, 'notify_url' => $notifyurl, 'signType' => 'RSA'); // $waitSign = $this->create_linkstring($waitSignArr); $waitSign_utf8 = XString::convertToUnicode($waitSign); //utf-8 $sign = $this->sign($waitSign_utf8); $sign = urlencode($sign); $string = $waitSign . '&sign_type="RSA"' . '&sign="' . $sign . '"'; return $string; }
public function getHdfPayArr($sn, $type, $price, $name, $description = "") { $id = ""; //$description = ''; $amount = number_format($price, 2, '.', ''); $subsn = Pay::makeSN($sn, $type); $subject = $name . "-订单号({$sn})"; //商品名称,必填 $out_trade_no = $subsn; $total_fee = $amount; $seller_email = $this->seller_email; $notify_url = $this->notify_url; $out_user = $this->out_user; //??外部商号?? $merchant_url = $this->merchant_url; $call_back_url = $this->call_back_url; $Service1 = $this->Service1; $sec_id = $this->sec_id; $partner = $this->partner; $format = $this->format; $v = $this->v; //构造要请求的参数数组,无需改动 $pms1 = array("req_data" => '<direct_trade_create_req><subject>' . $subject . '</subject><out_trade_no>' . $out_trade_no . '</out_trade_no><total_fee>' . $total_fee . "</total_fee><seller_account_name>" . $seller_email . "</seller_account_name><notify_url>" . $notify_url . "</notify_url><out_user>" . $out_user . "</out_user><merchant_url>" . $merchant_url . "</merchant_url><cashier_code>" . $id . "</cashier_code>" . "<call_back_url>" . $call_back_url . "</call_back_url></direct_trade_create_req>", "service" => $Service1, "sec_id" => $sec_id, "partner" => $partner, "req_id" => date("Ymdhms"), "format" => $format, "v" => $v); return $pms1; }