Example #1
0
 $pvalue = $_POST['amount'];
 if (isset($_SESSION['shipping' . $blog_id]['tax'])) {
     $pvalue += $_SESSION['shipping' . $blog_id]['tax'];
 }
 //eShop own check for extra security
 $eshopemailbus = $eshopoptions['business'];
 if (isset($eshopoptions['business_sec']) && $eshopoptions['business_sec'] != '') {
     $eshopemailbus = $eshopoptions['business_sec'];
     $_POST['business'] = $eshopemailbus;
 }
 $checkid = md5($eshopemailbus . $token . number_format($pvalue, 2));
 //affiliates
 if (isset($_COOKIE['ap_id'])) {
     $_POST['affiliate'] = $_COOKIE['ap_id'];
 }
 orderhandle($_POST, $checkid);
 if (isset($_COOKIE['ap_id'])) {
     unset($_POST['affiliate']);
 }
 $_POST['custom'] = $token;
 $p = new eshop_paypal_class();
 if ($eshopoptions['status'] == 'live') {
     $p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';
     // paypal url
 } else {
     $p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
     // testing paypal url
 }
 if ('no' == $eshopoptions['paypal_noemail']) {
     unset($_POST['email']);
 }
 function returnurlWap()
 {
     $alipay_config = C('alipay_config');
     $alipayNotify = new AlipayNotify($alipay_config);
     //计算得出通知验证结果
     $verify_result = $alipayNotify->verifyReturn();
     //var_dump($_GET);
     if ($verify_result) {
         //验证成功
         //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
         $out_trade_no = $_GET['out_trade_no'];
         //商户订单号
         $trade_no = $_GET['trade_no'];
         //支付宝交易号
         $trade_status = $_GET['result'];
         //交易状态
         $parameter = array("out_trade_no" => $out_trade_no, "trade_no" => $trade_no, "trade_status" => $trade_status);
         //echo "<pre>";var_dump($parameter);echo "</pre>";die();
         if ($_GET['result'] == 'success') {
             if (!checkorderstatus($out_trade_no)) {
                 orderhandle($parameter);
                 //进行订单处理,并传送从支付宝返回的参数;
                 //die();
             }
             $this->redirect(C('alipay.successpage'));
             //跳转到配置项中配置的支付成功页面;
         } else {
             //echo "trade_status=".$_GET['trade_status'];
             $this->redirect(C('alipay.errorpage'));
             //跳转到配置项中配置的支付失败页面;
         }
     } else {
         //验证失败
         //如要调试,请看alipay_notify.php页面的verifyReturn函数
         echo "支付失败!";
     }
 }
Example #3
0
 function returnurl()
 {
     //头部的处理跟上面两个方法一样,这里不罗嗦了!
     $alipay_config = C('alipay_config');
     $alipayNotify = new \AlipayNotify($alipay_config);
     //计算得出通知验证结果
     $verify_result = $alipayNotify->verifyReturn();
     if ($verify_result) {
         //验证成功
         //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
         $out_trade_no = $_GET['out_trade_no'];
         //商户订单号
         $trade_no = $_GET['trade_no'];
         //支付宝交易号
         $trade_status = $_GET['trade_status'];
         //交易状态
         $total_fee = $_GET['total_fee'];
         //交易金额
         $notify_id = $_GET['notify_id'];
         //通知校验ID。
         $notify_time = $_GET['notify_time'];
         //通知的发送时间。
         $buyer_email = $_GET['buyer_email'];
         //买家支付宝帐号;
         $parameter = array("out_trade_no" => $out_trade_no, "trade_no" => $trade_no, "total_fee" => $total_fee, "trade_status" => $trade_status, "notify_id" => $notify_id, "notify_time" => $notify_time, "buyer_email" => $buyer_email);
         if ($_GET['trade_status'] == 'TRADE_FINISHED' || $_GET['trade_status'] == 'TRADE_SUCCESS') {
             if (!checkorderstatus($out_trade_no)) {
                 orderhandle($parameter);
                 //进行订单处理,并传送从支付宝返回的参数;
             }
             $this->redirect(C('alipay.successpage'));
             //跳转到配置项中配置的支付成功页面;
         } else {
             echo "trade_status=" . $_GET['trade_status'];
             $this->redirect(C('alipay.errorpage'));
             //跳转到配置项中配置的支付失败页面;
         }
     } else {
         //验证失败
         //如要调试,请看alipay_notify.php页面的verifyReturn函数
         echo "支付失败!";
     }
 }
Example #4
0
 function notifyurl()
 {
     /*
      同理去掉以下两句代码;
     */
     //require_once("alipay.config.php");
     //require_once("lib/alipay_notify.class.php");
     //这里还是通过C函数来读取配置项,赋值给$alipay_config
     $alipay_config = C('alipay_config');
     //计算得出通知验证结果
     $alipayNotify = new AlipayNotify($alipay_config);
     $verify_result = $alipayNotify->verifyNotify();
     if ($verify_result) {
         //验证成功
         //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表
         $out_trade_no = $_POST['out_trade_no'];
         //商户订单号
         $trade_no = $_POST['trade_no'];
         //支付宝交易号
         $trade_status = $_POST['trade_status'];
         //交易状态
         $total_fee = $_POST['total_fee'];
         //交易金额
         $notify_id = $_POST['notify_id'];
         //通知校验ID。
         $notify_time = $_POST['notify_time'];
         //通知的发送时间。格式为yyyy-MM-dd HH:mm:ss。
         $buyer_email = $_POST['buyer_email'];
         //买家支付宝帐号;
         $parameter = array("out_trade_no" => $out_trade_no, "trade_no" => $trade_no, "total_fee" => $total_fee, "trade_status" => $trade_status, "notify_id" => $notify_id, "notify_time" => $notify_time, "buyer_email" => $buyer_email);
         if ($_POST['trade_status'] == 'TRADE_FINISHED') {
             //判断该笔订单是否在商户网站中已经做过处理
             //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
             //请务必判断请求时的total_fee、seller_id与通知时获取的total_fee、seller_id为一致的
             //如果有做过处理,不执行商户的业务程序
             //注意:
             //退款日期超过可退款期限后(如三个月可退款),支付宝系统发送该交易状态通知
             //调试用,写文本函数记录程序运行情况是否正常
             //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
         } else {
             if ($_POST['trade_status'] == 'TRADE_SUCCESS') {
                 //判断该笔订单是否在商户网站中已经做过处理
                 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                 //请务必判断请求时的total_fee、seller_id与通知时获取的total_fee、seller_id为一致的
                 //如果有做过处理,不执行商户的业务程序
                 //注意:
                 //付款完成后,支付宝系统发送该交易状态通知
                 //调试用,写文本函数记录程序运行情况是否正常
                 //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
                 if (!checkorderstatus($out_trade_no)) {
                     orderhandle($parameter);
                     //进行订单处理,并传送从支付宝返回的参数;
                 }
             }
         }
         echo "success";
         //请不要修改或删除
     } else {
         //验证失败
         echo "fail";
     }
 }
Example #5
0
 function notify_url()
 {
     /*
     同理去掉以下两句代码;
     */
     //require_once("alipay.config.php");
     //require_once("lib/alipay_notify.class.php");
     //这里还是通过C函数来读取配置项,赋值给$alipay_config
     $alipay_config = C('alipay_config');
     //计算得出通知验证结果
     $alipayNotify = new \AlipayNotify($alipay_config);
     $verify_result = $alipayNotify->verifyNotify();
     if ($verify_result) {
         //验证成功
         //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表
         $out_trade_no = $_POST['out_trade_no'];
         //商户订单号
         $trade_no = $_POST['trade_no'];
         //支付宝交易号
         $trade_status = $_POST['trade_status'];
         //交易状态
         $total_fee = $_POST['total_fee'];
         //交易金额
         $notify_id = $_POST['notify_id'];
         //通知校验ID。
         $notify_time = $_POST['notify_time'];
         //通知的发送时间。格式为yyyy-MM-dd HH:mm:ss。
         $buyer_email = $_POST['buyer_email'];
         //买家支付宝帐号;
         $parameter = array("out_trade_no" => $out_trade_no, "trade_no" => $trade_no, "total_fee" => $total_fee, "trade_status" => $trade_status, "notify_id" => $notify_id, "notify_time" => $notify_time, "buyer_email" => $buyer_email);
         if ($_POST['trade_status'] == 'TRADE_FINISHED') {
             //
         } else {
             if ($_POST['trade_status'] == 'TRADE_SUCCESS') {
                 if (!checkorderstatus($out_trade_no)) {
                     orderhandle($parameter);
                     //进行订单处理,并传送从支付宝返回的参数;
                 }
             }
         }
         echo "success";
         //请不要修改或删除
     } else {
         //验证失败
         echo "fail";
     }
 }
Example #6
0
     $theamount = str_replace(',', '', $espost['amount']);
     if (isset($espost['tax'])) {
         $theamount += str_replace(',', '', $espost['tax']);
     }
     if (isset($_SESSION['shipping' . $blog_id]['tax'])) {
         $theamount += $_SESSION['shipping' . $blog_id]['tax'];
     }
     $Cost = $theamount - $espost['shipping_1'];
     $ExtraCost = $espost['shipping_1'];
     //webtopay uses comma not decimal point
     $checkid = $token = time() . rand(0, 100);
     $espost['RefNr'] = $checkid;
     if (isset($_COOKIE['ap_id'])) {
         $espost['affiliate'] = $_COOKIE['ap_id'];
     }
     orderhandle($espost, $checkid);
     if (isset($_COOKIE['ap_id'])) {
         unset($espost['affiliate']);
     }
     /*
     		//necessary evil fix
     		$_SESSION['orderhandle']=true;
     */
     $p = new webtopay_class();
     $p->webtopay_url = 'https://www.webtopay.com/pay/';
     // webtopay url
     $echoit .= $p->eshop_submit_webtopay_post($espost);
     break;
 case 'process':
     // Process and order...
     // There should be no output at this point.  To process the POST data,
Example #7
0
 function returnurl()
 {
     //头部的处理跟上面两个方法一样,这里不罗嗦了!
     $alipay_config = C('alipay_config');
     $system = session("system");
     $runUrl = session("runUrl");
     $alipayNotify = new \AlipayNotify($alipay_config);
     //计算得出通知验证结果
     $verify_result = $alipayNotify->verifyReturn();
     if ($verify_result) {
         //验证成功
         //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
         $out_trade_no = $_GET['out_trade_no'];
         //商户订单号
         $trade_no = $_GET['trade_no'];
         //支付宝交易号
         $trade_status = $_GET['trade_status'];
         //交易状态
         $total_fee = $_GET['total_fee'];
         //交易金额
         $notify_id = $_GET['notify_id'];
         //通知校验ID。
         $notify_time = $_GET['notify_time'];
         //通知的发送时间。
         $buyer_email = $_GET['buyer_email'];
         //买家支付宝帐号;
         $parameter = array("out_trade_no" => $out_trade_no, "trade_no" => $trade_no, "total_fee" => $total_fee, "trade_status" => $trade_status, "notify_id" => $notify_id, "notify_time" => $notify_time, "buyer_email" => $buyer_email);
         if ($_GET['trade_status'] == 'TRADE_FINISHED' || $_GET['trade_status'] == 'TRADE_SUCCESS') {
             if (!checkorderstatus($out_trade_no)) {
                 orderhandle($parameter);
                 //进行订单处理,并传送从支付宝返回的参数;
             }
             $this->success("恭喜您支付宝支付成功,订单号为【{$out_trade_no}】,我们将在一个工作日内与您联系!谢谢!", "/{$runUrl}", 10);
             //跳转到配置项中配置的支付成功页面;
         } else {
             echo "trade_status=" . $_GET['trade_status'];
             $this->error("抱歉支付宝支付失败!若有疑问请拨打,首页下方的联系电话,谢谢合作!1", "{$runUrl}", 6);
             //跳转到配置项中配置的支付失败页面;
         }
     } else {
         //验证失败
         //如要调试,请看alipay_notify.php页面的verifyReturn函数
         alipayFaild($out_trade_no);
         $this->error("抱歉支付宝支付失败!若有疑问请拨打,首页下方的联系电话,谢谢合作!2", "{$runUrl}", 6);
         //跳转到配置项中配置的支付失败页面;
     }
 }
 function eshop_bank_redirect($espost)
 {
     global $blog_id, $eshopoptions, $wpdb, $wp_query;
     if ($espost['eshop_payment'] != 'bank') {
         return;
     }
     //enters all the data into the database
     $cash = $eshopoptions['bank'];
     if (!isset($espost['RefNr'])) {
         $espost['RefNr'] = uniqid(rand());
     }
     $checkid = md5($espost['RefNr']);
     //affiliate
     if (isset($_COOKIE['ap_id'])) {
         $espost['affiliate'] = $_COOKIE['ap_id'];
     }
     orderhandle($espost, $checkid);
     if (isset($_COOKIE['ap_id'])) {
         unset($espost['affiliate']);
     }
     $_SESSION['espost' . $blog_id] = $espost;
     return $espost;
 }