public function finalDoPay($unitePayID = null, $price) { include __DIR__ . '/lib/Union/unionpay.php'; $config = $this->sm->get("Config"); $unionPay = new \Unionpay($config[getenv('APP_ENV')]['unionPayConfig']); $payDetail = array('unitePayID' => $unitePayID, 'payMoney' => $price); $payForm = $unionPay->goPay($payDetail); return $payForm; }
/** * 从银联下载优惠券 * @param $uid * @param $mobile * @param $unionUid * @param unknown_type $unionCouponId * @param unknown_type $transSeq * @return 成功返回data数组, 失败返回respCd */ public function download_union_coupon($uid, $mobile, $unionUid, $unionCouponId, $transSeq) { $data['chnlUsrId'] = $uid; $data['chnlUsrMobile'] = $mobile; $data['couponId'] = $unionCouponId; $data['couponNum'] = '1'; $data['couponSceneId'] = '000'; $data['transSeq'] = $transSeq; $data['userId'] = $unionUid; // print_r($data); $response = $this->unionpay->couponDwnById($data); $response = json_decode($response, true); $respCd = $response['respCd']; if ($respCd == '000000') { return $response['data']; } else { return $respCd; } }
function test() { // $url = HOST."/users?keys=phone,username"; // echo $this->avoslibrary->get($url); // $data = array('shop'=>avosPointer('Shop', '53bbece4e4b0dea5ac1c8907')); // // echo $this->updateObject('Coupon','539e8dfce4b023daacbd6fa3',json_encode($data)); // echo $this->addShopBranchesToShop(array('539e8c51e4b0c92f1847dc23','539e8c52e4b0c92f1847dc24'), '539e8c52e4b0c92f1847dc25'); // echo $this->addCouponToShop('539d8cd9e4b0a98c8733f8dc', '539d8817e4b0a98c8733f287'); // echo decodeUnicode($this->coupon_m->addInShop('539d8cd9e4b0a98c8733f8dc', '539d8817e4b0a98c8733f287')) ; header('Content-Type:text/html;charset=utf-8'); // header( 'Content-Type:application/json;charset=utf-8'); // $mobile = '15166412996'; if (empty($mobile)) { $mobile = '13166361023'; // $mobile = '15166412996'; } $response = $this->unionpay->getUserByMobile2($mobile); echo $response; echo $this->unionpay->test(); }
public function unionSpecialNotifyAction() { include LIB . '/COM/Service/PayMod/lib/Union/unionpay.php'; $config = $this->sm->get('Config'); $unionPay = new \Unionpay($config['unionPayConfig']); if ($unionPay->Verify($this->request->getPost())) { try { $paidMoney = $this->request->getPost('txnAmt') / 100; $payDetail = $this->specialModel->select(array('unitePayID' => $this->request->getPost('orderId')))->current(); if ($this->siteSettings['specialMoney'] != $this->request->getPost('total_fee') || $payDetail['isPaid']) { throw new \Exception('fail'); } $this->sm->get('COM\\Service\\PayMod\\UnionPay')->specialNotify($this->request->getPost('orderId')); $requestUri = $_SERVER['REQUEST_URI']; $data = array('money' => $paidMoney, 'payNotifyInfo' => $requestUri, 'postData' => json_encode($this->request->getPost()), 'unitePayID' => $this->request->getPost('orderId'), 'payType' => 3, 'type' => 3); $this->payNotifyLogModel->insert($data); $this->response->setContent('success'); } catch (\Exception $e) { $this->response->setContent('fail'); } } else { $this->response->setContent('fail'); } return $this->response; }