Esempio n. 1
0
 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;
 }