public function asyncCallback($callbackData, &$paymentId, &$money, &$message, &$orderNo)
 {
     //使用通用通知接口
     $notify = new Notify_pub();
     $xml = $GLOBALS['HTTP_RAW_POST_DATA'];
     $notify->saveData($xml);
     //验证签名,并回应微信。
     //对后台通知交互时,如果微信收到商户的应答不是成功或超时,微信认为通知失败,
     //微信会通过一定的策略(如30分钟共8次)定期重新发起通知,
     //尽可能提高通知的成功率,但微信不保证通知最终能成功。
     $payment = new Payment($paymentId);
     $paymentInfo = $payment->getPayment();
     $paymentInfo['partner_key'];
     if ($notify->checkSign($paymentInfo['partner_key']) == FALSE) {
         $notify->setReturnParameter("return_code", "FAIL");
         //返回状态码
         $notify->setReturnParameter("return_msg", "签名失败");
         //返回信息
         echo $notify->returnXml();
     } else {
         $notify->setReturnParameter("return_code", "SUCCESS");
         //设置返回码
         $this->returnXml = $notify->returnXml();
     }
     if ($notify->checkSign($paymentInfo['partner_key']) == TRUE) {
         if ($notify->data["return_code"] == "SUCCESS" && $notify->data["return_code"] == "SUCCESS") {
             $orderNo = $notify->data['out_trade_no'];
             $money = $notify->data['total_fee'] / 100;
             return true;
         }
     }
     return false;
 }
 public function getPaymentPaid($projid = null)
 {
     if ($projid != null) {
         $payment = Payment::getPayment($projid);
         // possible user loading method
     } else {
         return "project id is null";
     }
     return $payment;
 }
 public function asyncCallback($callbackData, &$paymentId, &$money, &$message, &$orderNo)
 {
     //除去待签名参数数组中的空值和签名参数
     $filter_param = $this->filterParam($callbackData);
     //对待签名参数数组排序
     $para_sort = $this->argSort($filter_param);
     //生成签名结果
     $payment = new Payment($paymentId);
     $paymentInfo = $payment->getPayment();
     $mysign = $this->buildSign($para_sort, $paymentInfo['partner_key']);
     if ($callbackData['sign'] == $mysign) {
         //回传数据
         $orderNo = $callbackData['out_trade_no'];
         $money = $callbackData['total_fee'];
         if ($callbackData['trade_status'] == 'TRADE_FINISHED' || $callbackData['trade_status'] == 'TRADE_SUCCESS') {
             return true;
         }
     }
     return false;
 }
Exemple #4
0
 public function asyncCallback($callbackData, &$paymentId, &$money, &$message, &$orderNo)
 {
     //除去待签名参数数组中的空值和签名参数
     $filter_param = $this->filterParam($callbackData);
     //对待签名参数数组排序
     $para_sort = $this->argSort($filter_param);
     //生成签名结果
     $payment = new Payment($paymentId);
     $paymentInfo = $payment->getPayment();
     $mysign = $this->buildSign($para_sort, $paymentInfo['partner_key']);
     if ($callbackData['sign'] == strtoupper($mysign)) {
         //回传数据
         $orderNo = $callbackData['out_trade_no'];
         $money = $callbackData['total_fee'] / 100;
         $message = isset($callbackData['pay_info']) ? $callbackData['pay_info'] : '';
         if ($message == '' && $callbackData['trade_state'] == '0') {
             return true;
         }
     }
     return false;
 }
 public function callback($callbackData, &$paymentId, &$money, &$message, &$orderNo)
 {
     //除去待签名参数数组中的空值和签名参数
     $filter_param = $this->filterParam($callbackData);
     //对待签名参数数组排序
     $para_sort = $this->argSort($filter_param);
     //生成签名结果
     $payment = new Payment($paymentId);
     $paymentInfo = $payment->getPayment();
     $mysign = $this->buildSign($para_sort, $paymentInfo['partner_key']);
     if ($callbackData['sign'] == $mysign) {
         //回传数据
         $orderNo = $callbackData['order_no'];
         $money = $callbackData['total_fee'];
         if ($callbackData['order_status'] == 'TINY_SECCESS') {
             return true;
         }
         $message = '支付失败';
     } else {
         $message = '签名不正确';
     }
     return false;
 }
 public function afterAsync()
 {
     $payment = new Payment($this->paymentId);
     $paymentObj = $payment->getPayment();
     return new AlipayDelivery($paymentObj['partner_id'], $paymentObj['partner_key']);
 }
Exemple #7
0
 public function callback()
 {
     //从URL中获取支付方式
     $payment_id = Filter::int(Req::get('payment_id'));
     $payment = new Payment($payment_id);
     $paymentPlugin = $payment->getPaymentPlugin();
     if (!is_object($paymentPlugin)) {
         $msg = array('type' => 'fail', 'msg' => '支付方式不存在!');
         $this->redirect('/index/msg', false, $msg);
         exit;
     }
     //初始化参数
     $money = '';
     $message = '支付失败';
     $orderNo = '';
     //执行接口回调函数
     $callbackData = Req::args();
     //array_merge($_POST,$_GET);
     unset($callbackData['con']);
     unset($callbackData['act']);
     unset($callbackData['payment_id']);
     unset($callbackData['tiny_token_redirect']);
     $return = $paymentPlugin->callback($callbackData, $payment_id, $money, $message, $orderNo);
     //支付成功
     if ($return == 1) {
         // 海关发送报文位置  待定
         //充值方式
         if (stripos($orderNo, 'recharge_') !== false) {
             $tradenoArray = explode('_', $orderNo);
             $recharge_no = isset($tradenoArray[1]) ? $tradenoArray[1] : 0;
             $recharge_id = Order::recharge($recharge_no, $payment_id, $callbackData);
             if ($recharge_id) {
                 //$this->redirect("/ucenter/account/$recharge_id");
                 $model = new Model('recharge');
                 $obj = $model->where("id=" . $recharge_id . ' and status=1')->find();
                 if ($obj) {
                     $msg = array('type' => 'success', 'msg' => '充值成功!', 'content' => '充值编号:' . $recharge_no . ',充值方式:' . $obj['payment_name'], 'redirect' => '/ucenter/account');
                     $this->redirect('/index/msg', true, $msg);
                 }
                 exit;
             }
             $msg = array('type' => 'fail', 'msg' => '支充值失败!');
             $this->redirect('/index/msg', false, $msg);
             exit;
         } else {
             $payment_plugin = $payment->getPayment();
             //货到付款的处理
             if ($payment_plugin['class_name'] == 'received') {
                 $model = new Model("order");
                 $order = $model->where("order_no='" . $orderNo . "'")->find();
                 if (!empty($order)) {
                     $model->where("order_no='" . $orderNo . "'")->data(array('payment' => $payment_id))->update();
                     $this->redirect("/simple/order_completed/order_id/" . $order['id']);
                     exit;
                 }
             } else {
                 // 海关发送报文位置  待定
                 // todo SKM 海关发送报文位置  待定
                 // todo 更新订单表中数据  尤其是状态
                 // $strXML
                 $order_id = Order::updateStatus($orderNo, $payment_id, $callbackData);
                 if ($order_id) {
                     $erpmsg = ApiToErp::callerporder($orderNo);
                     //SKM-SMS 支付成功  发送支付完成信息  在Order.php 里面的方法处理 updateStatus
                     //SKM-CUSTOMS  支付完成 把订单信息发送给 海关一步达系统  下面代码仅用于国际支付宝业务
                     $orderNo = $callbackData['out_trade_no'];
                     //$money   = $callbackData['total_fee'];
                     $trade_no = $callbackData['trade_no'];
                     $conf = array('payNumber' => $trade_no);
                     // 交易号
                     //$orderNo = "88"; //订单编号 callbackData 中的out_trade_no
                     // 导出订单数据,以XML文件格式
                     $order_export_inst = new OrderExport();
                     $ret = $order_export_inst->toXML($orderNo, $conf);
                     if (isset($ret['status']) && $ret['status'] == 1) {
                         $strXML = $ret['data'];
                         // TEST-LOG
                         //$strDate = date("Y-m-d-h-i-s");
                         //file_put_contents("/var/www/html/quanpin/logs/gateway_$strDate.xml", $strXML);
                         // 发送XML数据到海关
                         $gateway_inst = new GatewayModel();
                         $gateway_inst->callWebService($strXML, "IMPORTORDER");
                         //Tiny::log(__FILE__.__LINE__."---ALIPAY----".$strXML);
                         $data = array('tax_api_status' => 1);
                         Order::updateStatusByNo($orderNo, $data);
                     } else {
                         $message = '支付成功, 发送海关数据失败,请从新发送';
                         // 这部分信息保存到数据库中
                         $data = array('tax_api_status' => 0);
                         Order::updateStatusByNo($orderNo, $data);
                     }
                     //E SKM-CUSTOMS
                     $this->redirect("/simple/order_completed/order_id/" . $order_id);
                     exit;
                 }
                 $msg = array('type' => 'fail', 'msg' => '订单修改失败!');
                 $this->redirect('/index/msg', false, $msg);
                 exit;
             }
         }
     } else {
         $message = $message ? $message : '支付失败';
         $msg = array('type' => 'fail', 'msg' => $message);
         $this->redirect('/index/msg', false, $msg);
         exit;
     }
 }
Exemple #8
0
										<td class="tdname">Пожелания к заказу</td>
										<td><?php 
echo nl2br($message);
?>
</td>
									</tr>
								</table>
							</li>
							<li class="edit_form_section edit_form_section_info plugin_orders_info">
								<?php 
Delivery::getDelivery();
?>
							</li>
							<li class="edit_form_section edit_form_section_info plugin_orders_info">
								<?php 
Payment::getPayment();
?>
							</li>
							<li class="edit_form_section edit_form_section_description">
								<header class="edit_form_section_header">
									<strong>Дополнительная информация</strong>
								</header>
								<div class="ckeditor_layout">
									<textarea class="ckeditor_textarea input_text" id="info" name=info><?php 
echo $info;
?>
</textarea>
									<script language="javascript">
										$(document).ready( function(){	
											initEditor($("#info"));
										});