Пример #1
0
 function index_f()
 {
     $sn = $this->trans_lib->safe("sn");
     $paycode = "paypal";
     $pass = $this->trans_lib->safe("pass");
     $rs = $this->payment_m->get_one_code($paycode);
     if (!$rs) {
         error($this->lang["alipay_not_rs"], $this->url("checkout,info", "sn=" . $sn . "&pass="******"user_id"]) {
         if (!$pass || $pass != $order_rs["pass"]) {
             error($this->lang["alipay_not_popedom"], $this->url("index"));
         }
     } else {
         if ($_SESSION["user_id"] != $order_rs["uid"]) {
             error($this->lang["alipay_not_popedom"], $this->url("index"));
         }
     }
     $this->tpl->assign("order_rs", $order_rs);
     if ($order_rs["pay_status"]) {
         error($this->lang["alipay_paystatus_ok"], $this->url("checkout,info", "sn=" . $sn . "&pass="******"price"] < 0.001) {
         error($this->lang["alipay_free"], $this->url("checkout,info", "sn=" . $sn . "&pass="******"id"]);
     //判断是否是客
     //加载paypal付款类
     $paypal = new paypal_payment($f_rs["business"], $f_rs["at"]);
     $price = $f_rs["price_format"] ? sys_format_price($f_rs["price_format"] * $order_rs["price"]) : sys_format_price($order_rs["price"]);
     $paypal->set_value("amount", $price);
     $currency = $f_rs["currency_code"] ? $f_rs["currency_code"] : "USD";
     $paypal->set_value("currency", $currency);
     $paypal->set_value("ordersn", $order_rs["sn"]);
     $paypal->set_value("action_url", $f_rs["action_url"]);
     $return_url = $this->sys_config["siteurl"] . site_url("checkout,info", "sn=" . $sn . "&pass="******"pass"]);
     $paypal->set_value("return_url", $return_url);
     //成功返回
     $paypal->set_value("cancel_return", $return_url);
     //取消退出
     $notify_url = $this->sys_config["siteurl"] . site_url("paypal,notify", "sn=" . $sn . "&pass="******"pass"]);
     $paypal->set_value("notify_url", $notify_url);
     //订单成功后发送给网站的信息
     $htmlbutton = $paypal->create_button();
     $this->tpl->assign("htmlbutton", $htmlbutton);
     $this->tpl->display("payment/paypal." . $this->tpl->ext);
 }
Пример #2
0
 public function submit()
 {
     $notify_url = $this->baseurl . "payment/paypal/notify_url.php";
     if ($_SESSION['user_id']) {
         $return_url = $GLOBALS['app']->url('payment', 'notice', 'id=' . $this->order['id'], 'www', true);
         $cancel_url = $GLOBALS['app']->url('order', 'info', 'id=' . $this->order['id'], 'www', true);
     } else {
         $return_url = $GLOBALS['app']->url('payment', 'notice', 'sn=' . $this->order['sn'] . '&passwd=' . $this->order['passwd'], 'www', true);
         $cancel_url = $GLOBALS['app']->url('order', 'info', 'sn=' . $this->order['sn'] . '&passwd=' . $this->order['passwd'], 'www', true);
     }
     $paypal = new paypal_payment($this->param['param']["payid"], $this->param['param']["at"]);
     $price = price_format_val($this->order['price'], $this->order['currency_id'], $this->param['currency']['id']);
     $paypal->set_value("amount", $price);
     $currency = $this->param['currency']['code'];
     $paypal->set_value("currency", $currency);
     $paypal->set_value("ordersn", $this->order["sn"]);
     $paypal->set_value("action_url", $this->param['param']["action"]);
     $paypal->set_value("return_url", $return_url);
     //成功返回
     $paypal->set_value("cancel_return", $cancel_url);
     //取消退出
     $paypal->set_value("notify_url", $notify_url);
     //订单成功后发送给网站的信息
     $htmlbutton = $paypal->create_button();
     echo '<!DOCTYPE html>' . "\n";
     echo '<html>' . "\n";
     echo '<head>' . "\n\t";
     echo '<meta charset="utf-8" />' . "\n\t";
     echo '<title>付款中</title>' . "\n";
     echo '</head>' . "\n<body>\n";
     echo '<div class="div"><p>正在跳转至Paypal,请稍候...</p><input type="button" value="提交" onclick="go_paypal()"/></div>' . "\n";
     echo '<div style="display:none">' . $htmlbutton . "</div>\n";
     echo '<script type="text/javascript">' . "\n";
     echo 'function go_paypal(){' . "\n";
     echo 'document.getElementById("paypalform").submit();' . "\n";
     echo 'return true;' . "\n";
     echo '}' . "\n";
     echo 'go_paypal();' . "\n";
     echo '</script>' . "\n";
     echo "\n" . '</body>' . "\n</html>";
     exit;
 }