1 | <?php |
||
10 | class Mygento_Payture_Adminhtml_Payture_IndexController extends Mage_Adminhtml_Controller_Action |
||
11 | { |
||
12 | |||
13 | public function indexAction() |
||
17 | |||
18 | public function completeAction() |
||
19 | { |
||
20 | $order_inc_id = $this->getRequest()->getParam('order'); |
||
21 | $order = Mage::getModel('sales/order')->load($order_inc_id); |
||
22 | if ($order->getId()) { |
||
23 | $req = array( |
||
24 | 'Key' => Mage::helper('payture')->getKey(), |
||
25 | 'OrderId' => $order->getId(), |
||
26 | 'Password' => Mage::helper('payture')->getPassword(), |
||
27 | ); |
||
28 | $url = Mage::helper('payture')->getHost() . 'Charge?' . http_build_query($req); |
||
29 | Mage::helper('payture')->addLog($url); |
||
30 | $xml = Mage::helper('payture')->getData($url); |
||
31 | Mage::helper('payture')->addLog($xml); |
||
32 | if ($xml["Success"] == 'True') { |
||
33 | $collection = Mage::getModel('payture/keys')->getCollection(); |
||
34 | $collection->addFieldToFilter('orderid', $order->getId()); |
||
35 | $item = $collection->getFirstItem(); |
||
36 | $sess = Mage::getModel('payture/keys')->load($item->getId()); |
||
37 | $sess->setState('Complete'); |
||
38 | $sess->save(); |
||
39 | Mage::helper('payture')->addTransaction($order); |
||
40 | |||
41 | //Check the ticket |
||
42 | Mage::helper('payture')->checkTicket($item); |
||
43 | } |
||
44 | } |
||
45 | $url = Mage::helper("adminhtml")->getUrl("adminhtml/sales_order/view", array('_secure' => true, 'order_id' => $order->getId())); |
||
46 | Mage::app()->getResponse()->setRedirect($url); |
||
47 | } |
||
48 | |||
49 | public function unblockAction() |
||
67 | |||
68 | public function refundAction() |
||
74 | |||
75 | private function processOrder($type, $postData, $order_inc_id) |
||
93 | |||
94 | protected function _isAllowed() |
||
98 | } |
||
99 |