1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* |
5
|
|
|
* |
6
|
|
|
* @category Mygento |
7
|
|
|
* @package Mygento_Payture |
8
|
|
|
* @copyright Copyright © 2016 NKS LLC. (http://www.mygento.ru) |
9
|
|
|
*/ |
10
|
|
|
class Mygento_Payture_Model_Checkout extends Mage_Payment_Model_Method_Abstract |
11
|
|
|
{ |
12
|
|
|
|
13
|
|
|
protected $_code = 'payture'; |
14
|
|
|
protected $_formBlockType = 'payture/form'; |
15
|
|
|
protected $_infoBlockType = 'payture/info'; |
16
|
|
|
protected $_canUseForMultishipping = false; |
17
|
|
|
protected $_isInitializeNeeded = true; |
18
|
|
|
protected $_canRefund = true; |
19
|
|
|
protected $_isGateway = true; |
20
|
|
|
protected $_canCapturePartial = true; |
21
|
|
|
|
22
|
|
|
public function getOrderPlaceRedirectUrl() |
23
|
|
|
{ |
24
|
|
|
return Mage::getUrl('payture/payment/process', array('_secure' => true)); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* |
29
|
|
|
* @param Varien_Data_Form_Element_Abstract $element |
30
|
|
|
* @return string |
31
|
|
|
* |
32
|
|
|
* @SuppressWarnings("unused") |
33
|
|
|
*/ |
34
|
|
|
public function initialize($action, $stateObject) |
35
|
|
|
{ |
36
|
|
|
if ($status = $this->getConfigData('order_status')) { |
37
|
|
|
$stateObject->setStatus($status); |
38
|
|
|
$state = $this->_getAssignedState($status); |
39
|
|
|
$stateObject->setState($state); |
40
|
|
|
$stateObject->setIsNotified(true); |
41
|
|
|
} |
42
|
|
|
return $this; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
protected function _getAssignedState($status) |
46
|
|
|
{ |
47
|
|
|
$item = Mage::getResourceModel('sales/order_status_collection') |
48
|
|
|
->joinStates() |
49
|
|
|
->addFieldToFilter('main_table.status', $status) |
50
|
|
|
->getFirstItem(); |
51
|
|
|
return $item->getState(); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function getMethodTitle() |
55
|
|
|
{ |
56
|
|
|
return Mage::getStoreConfig('payment/payture/title'); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|