コード例 #1
0
ファイル: notice.php プロジェクト: renlong567/43168
 function submit()
 {
     if ($_SESSION['user_id']) {
         $url = $GLOBALS['app']->url('order', 'info', 'id=' . $_GET['id']);
         unset($_GET['id']);
     } else {
         $url = $GLOBALS['app']->url('order', 'info', 'sn=' . $_GET['sn'] . '&passwd=' . $_GET['passwd']);
         unset($_GET['sn'], $_GET['passwd']);
     }
     $paypal = new paypal_payment($this->param['param']["payid"], $this->param['param']["at"]);
     $paypal->set_value("action_url", $this->param['param']["action"]);
     $price = $GLOBALS['app']->get('mc_gross');
     $sn = $GLOBALS['app']->get('invoice');
     $checkcode = $GLOBALS['app']->get('custom');
     if (!$checkcode || !$price || !$sn) {
         error(P_Lang('支付返回异常,请检查'), $url, 'notice');
     }
     $chk = $paypal->check($price, $sn, $checkcode);
     if (!$chk) {
         error(P_Lang('数据验证不通过,请检查'), $url, 'notice');
     }
     $ext = $this->order['ext'];
     if ($ext && is_string($ext)) {
         $ext = unserialize($this->order['ext']);
     }
     if ($ext && is_array($ext)) {
         if ($ext['txn_id'] && $ext['txn_id'] == $GLOBALS['app']->get('txn_id')) {
             error(P_Lang('订单支付成功'), $url, 'ok');
         }
     }
     $payment_status = $GLOBALS['app']->get('payment_status');
     if ($payment_status != 'Completed') {
         error(P_Lang('支付不确定是否完成,请联系商家确认'), $url, 'notice');
     }
     $price = $GLOBALS['app']->get('mc_gross');
     $array = array('pay_status' => "付款完成", 'pay_date' => $pay_date, 'pay_price' => $price, 'pay_end' => 1);
     $array['status'] = '付款完成';
     $exchange_rate = $GLOBALS['app']->get('exchange_rate');
     if ($exchange_rate) {
         $array['pay_currency_rate'] = $exchange_rate;
     }
     $p_array = array();
     $p_array['txn_id'] = $GLOBALS['app']->get('txn_id');
     $p_array['txn_type'] = $GLOBALS['app']->get('txn_type');
     $p_array['mc_fee'] = $GLOBALS['app']->get('mc_fee');
     $p_array['mc_currency'] = $GLOBALS['app']->get('mc_currency');
     $p_array['payer_email'] = $GLOBALS['app']->get('payer_email');
     $p_array['first_name'] = $GLOBALS['app']->get('first_name');
     $p_array['last_name'] = $GLOBALS['app']->get('last_name');
     $p_array['payer_business_name'] = $GLOBALS['app']->get('payer_business_name');
     $p_array['payer_status'] = $GLOBALS['app']->get('payer_status');
     $array['ext'] = serialize($p_array);
     $GLOBALS['app']->model('order')->save($array, $this->order['id']);
     return true;
 }
コード例 #2
0
ファイル: notify.php プロジェクト: renlong567/43168
 public function submit()
 {
     $paypal = new paypal_payment($this->param['param']["payid"], $this->param['param']["at"]);
     $paypal->set_value("action_url", $this->param['param']["action"]);
     $price = $GLOBALS['app']->get('mc_gross');
     $sn = $GLOBALS['app']->get('invoice');
     $checkcode = $GLOBALS['app']->get('custom');
     if (!$checkcode) {
         phpok_log(P_Lang('异步传输:没有自定义验证串'));
         exit('error');
     }
     if (!$price || !$sn) {
         phpok_log(P_Lang('数据异步'));
         exit('error');
     }
     $chk = $paypal->check($price, $sn, $checkcode);
     if (!$chk) {
         phpok_log(P_Lang('异步传输:验证不能过'));
         exit('error');
     }
     $payment_status = $GLOBALS['app']->get('payment_status');
     if ($payment_status != 'Completed') {
         phpok_log(P_Lang('异步传输:支付状态是' . $payment_status));
         exit('error');
     }
     $pay_date = $GLOBALS['app']->get('payment_date');
     if ($pay_date) {
         $pay_date = strtotime($pay_date);
         if (!$pay_date) {
             $pay_date = $GLOBALS['app']->time;
         }
     } else {
         $pay_date = $GLOBALS['app']->time;
     }
     $price = $GLOBALS['app']->get('mc_gross');
     $array = array('pay_status' => "付款完成", 'pay_date' => $pay_date, 'pay_price' => $price, 'pay_end' => 1);
     $array['status'] = '付款完成';
     $exchange_rate = $GLOBALS['app']->get('exchange_rate');
     if ($exchange_rate) {
         $array['pay_currency_rate'] = $exchange_rate;
     }
     $p_array = array();
     $p_array['txn_id'] = $GLOBALS['app']->get('txn_id');
     $p_array['txn_type'] = $GLOBALS['app']->get('txn_type');
     $p_array['mc_fee'] = $GLOBALS['app']->get('mc_fee');
     $p_array['mc_currency'] = $GLOBALS['app']->get('mc_currency');
     $p_array['payer_email'] = $GLOBALS['app']->get('payer_email');
     $p_array['first_name'] = $GLOBALS['app']->get('first_name');
     $p_array['last_name'] = $GLOBALS['app']->get('last_name');
     $p_array['payer_business_name'] = $GLOBALS['app']->get('payer_business_name');
     $p_array['payer_status'] = $GLOBALS['app']->get('payer_status');
     $array['ext'] = serialize($p_array);
     $GLOBALS['app']->model('order')->save($array, $this->order['id']);
     exit('SUCCESS');
 }
コード例 #3
0
ファイル: paypal.php プロジェクト: ahmatjan/yida
 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);
 }
コード例 #4
0
ファイル: submit.php プロジェクト: renlong567/43168
 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;
 }