public function alipayCallBack4ReturnTouchRecharge() {/*{{{*/ $waperAlipay = WaperAlipay::getInstance(); $verify_result = $waperAlipay->getResponse4return($_GET); if (!$verify_result) { echo '无效访问'; exit; } $orderId = substr($_GET['out_trade_no'], 0, strpos($_GET['out_trade_no'], '_')); $url = "http://".URL_PREFIX."m.haodf.com/touch/useraccount/payresult?orderid=".$orderId; header("Location: $url"); exit; }/*}}}*/
public function getAccountByUserIdAndOrderId($orderId, $userId) {/*{{{*/ $user = DAL::get()->find('user', $userId); if ($user->isNull()) { $this->setErrorCode(107); return 0; } $source = DAL::get()->find('intention', $orderId); if ($source->isNull()) { // $proposal = DAL::get()->find('proposal', $orderId); $proposal = $this->getRightObj($orderId); if($proposal->isNull()) { $this->setErrorCode(313); return 0; } $source = DAL::get()->find_by_source('serviceorder', $proposal); if($source->isNull()) { $this->setErrorCode(313); return 0; } } if($source->user->id != $user->id) { $this->setErrorCode(322); return 0; } $isToAlipay = 1; if($user->getCashAccount()->amount >= $source->getSalePrice()) { $isToAlipay = 0; } $info = array(); $info['orderId'] = $source->id; $info['userId'] = $user->id; $info['banlance'] = $user->getCashAccount()->amount; $info['price'] = $source instanceof Intention ? $source->getSalePrice() : $source->price; $info['isToAlipay'] = $isToAlipay; $waperAlipay = WaperAlipay::getInstance(); $info['showUrl'] = $waperAlipay->merchant_url; $this->content = $info; }/*}}}*/
public function getResponse4notify($data, $name) { /*{{{*/ $waperAlipay = $this; $alipay = new wap_alipay_notify($waperAlipay->partner, $waperAlipay->key, $waperAlipay->sec_id, $waperAlipay->_input_charset); $waperAlipayFunction = wap_alipay_function::getInstance(); $verify_result = $alipay->notify_verify($data); if ($verify_result) { $status = $waperAlipayFunction->getDataForXML($data['notify_data'], '/notify/trade_status'); $status = (array) $status; $status = $status[0]; if ($status == 'TRADE_FINISHED' || $status == 'TRADE_SUCCESS') { $waperAlipay = WaperAlipay::getInstance()->initCallBackData($data, $name); if ($waperAlipay->isValid()) { return true; } } } return false; }