Raveinfosys_Sagepay - Version 1.0.0

Version Notes

Sagepay Payment Gateway Extension.

Download this release

Release Info

Developer Rave Infosys
Extension Raveinfosys_Sagepay
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (30) hide show
  1. app/code/community/Raveinfosys/Sagepay/Block/Adminhtml/Sagepay.php +13 -0
  2. app/code/community/Raveinfosys/Sagepay/Block/Adminhtml/Sagepay/Grid.php +121 -0
  3. app/code/community/Raveinfosys/Sagepay/Controller/Observer.php +11 -0
  4. app/code/community/Raveinfosys/Sagepay/Helper/Data.php +6 -0
  5. app/code/community/Raveinfosys/Sagepay/Model/Config.php +73 -0
  6. app/code/community/Raveinfosys/Sagepay/Model/Mysql4/Sagepay.php +9 -0
  7. app/code/community/Raveinfosys/Sagepay/Model/Mysql4/Sagepay/Collection.php +10 -0
  8. app/code/community/Raveinfosys/Sagepay/Model/Mysql4/Transaction.php +9 -0
  9. app/code/community/Raveinfosys/Sagepay/Model/Mysql4/Transaction/Collection.php +10 -0
  10. app/code/community/Raveinfosys/Sagepay/Model/Observer.php +29 -0
  11. app/code/community/Raveinfosys/Sagepay/Model/Payment.php +812 -0
  12. app/code/community/Raveinfosys/Sagepay/Model/Sagepay.php +126 -0
  13. app/code/community/Raveinfosys/Sagepay/Model/Status.php +15 -0
  14. app/code/community/Raveinfosys/Sagepay/Model/System/Config/Source/Dropdown/Values.php +22 -0
  15. app/code/community/Raveinfosys/Sagepay/Model/Transaction.php +34 -0
  16. app/code/community/Raveinfosys/Sagepay/controllers/Adminhtml/SagepayController.php +94 -0
  17. app/code/community/Raveinfosys/Sagepay/controllers/Checkout/OnepageController.php +107 -0
  18. app/code/community/Raveinfosys/Sagepay/etc/config.xml +195 -0
  19. app/code/community/Raveinfosys/Sagepay/etc/system.xml +159 -0
  20. app/code/community/Raveinfosys/Sagepay/sql/sagepay_setup/mysql4-install-0.1.0.php +54 -0
  21. app/design/adminhtml/default/default/layout/sagepay.xml +8 -0
  22. app/design/adminhtml/default/sagepay/template/sales/order/view/tab/info.phtml +146 -0
  23. app/design/frontend/base/default/layout/sagepay.xml +30 -0
  24. app/design/frontend/base/default/layout/sagepay_checkout2.xml +22 -0
  25. app/design/frontend/base/default/template/sagepay/checkout/3dredirect.phtml +50 -0
  26. app/design/frontend/base/default/template/sagepay/checkout/review/info.phtml +99 -0
  27. app/design/frontend/base/default/template/sagepay/sagepay.phtml +11 -0
  28. app/design/frontend/base/default/template/sagepay/threedsuccess.phtml +13 -0
  29. app/etc/modules/Raveinfosys_Sagepay.xml +9 -0
  30. package.xml +18 -0
app/code/community/Raveinfosys/Sagepay/Block/Adminhtml/Sagepay.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Raveinfosys_Sagepay_Block_Adminhtml_Sagepay extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_sagepay';
7
+ $this->_blockGroup = 'sagepay';
8
+ $this->_headerText = Mage::helper('sagepay')->__('Sagepay Transaction Details');
9
+ $this->_addButtonLabel = Mage::helper('sagepay')->__('Add Item');
10
+ parent::__construct();
11
+ $this->_removeButton('add');
12
+ }
13
+ }
app/code/community/Raveinfosys/Sagepay/Block/Adminhtml/Sagepay/Grid.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Block_Adminhtml_Sagepay_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('sagepayGrid');
9
+ $this->setDefaultSort('transaction_id');
10
+ $this->setDefaultDir('ASC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('sagepay/transaction')->getCollection();
17
+ $this->setCollection($collection);
18
+ return parent::_prepareCollection();
19
+ }
20
+
21
+ protected function _prepareColumns()
22
+ {
23
+
24
+ $this->addColumn('order_id', array(
25
+ 'header' => Mage::helper('sagepay')->__('Order Id'),
26
+ 'align' =>'right',
27
+ 'width' => '50px',
28
+ 'index' => 'order_id',
29
+ ));
30
+
31
+ $this->addColumn('vendor_tx_code', array(
32
+ 'header' => Mage::helper('sagepay')->__('Vendor Tx Code'),
33
+ 'align' =>'right',
34
+ 'width' => '50px',
35
+ 'index' => 'vendor_tx_code',
36
+ ));
37
+
38
+ /* $this->addColumn('security_key', array(
39
+ 'header' => Mage::helper('sagepay')->__('Security Key'),
40
+ 'align' =>'right',
41
+ 'width' => '50px',
42
+ 'index' => 'security_key',
43
+ )); */
44
+
45
+ $this->addColumn('order_status', array(
46
+ 'header' => Mage::helper('sagepay')->__('Status'),
47
+ 'align' =>'right',
48
+ 'width' => '50px',
49
+ 'index' => 'order_status',
50
+ ));
51
+
52
+ $this->addColumn('customer_name', array(
53
+ 'header' => Mage::helper('sagepay')->__('Customer Name'),
54
+ 'align' =>'right',
55
+ 'width' => '50px',
56
+ 'index' => 'customer_name',
57
+ ));
58
+
59
+ $this->addColumn('mode', array(
60
+ 'header' => Mage::helper('sagepay')->__('Transaction Type'),
61
+ 'align' =>'right',
62
+ 'width' => '50px',
63
+ 'index' => 'mode',
64
+ ));
65
+
66
+ $this->addColumn('customer_email', array(
67
+ 'header' => Mage::helper('sagepay')->__('Email'),
68
+ 'align' =>'right',
69
+ 'width' => '50px',
70
+ 'index' => 'customer_email',
71
+ ));
72
+
73
+ $this->addColumn('threed_secure', array(
74
+ 'header' => Mage::helper('sagepay')->__('3D Auth'),
75
+ 'align' =>'right',
76
+ 'width' => '50px',
77
+ 'index' => 'threed_secure',
78
+ ));
79
+
80
+ $this->addColumn('card_holder_name', array(
81
+ 'header' => Mage::helper('sagepay')->__('Card Holder Name'),
82
+ 'align' =>'right',
83
+ 'width' => '50px',
84
+ 'index' => 'card_holder_name',
85
+ ));
86
+
87
+ $this->addColumn('card_type', array(
88
+ 'header' => Mage::helper('sagepay')->__('Card Type'),
89
+ 'align' =>'right',
90
+ 'width' => '50px',
91
+ 'index' => 'card_type',
92
+ ));
93
+
94
+
95
+ $this->addExportType('*/*/exportCsv', Mage::helper('sagepay')->__('CSV'));
96
+ $this->addExportType('*/*/exportXml', Mage::helper('sagepay')->__('XML'));
97
+
98
+ return parent::_prepareColumns();
99
+ }
100
+
101
+ protected function _prepareMassaction()
102
+ {
103
+ $this->setMassactionIdField('sagepay_id');
104
+ $this->getMassactionBlock()->setFormFieldName('sagepay');
105
+
106
+ $this->getMassactionBlock()->addItem('delete', array(
107
+ 'label' => Mage::helper('sagepay')->__('Delete'),
108
+ 'url' => $this->getUrl('*/*/massDelete'),
109
+ 'confirm' => Mage::helper('sagepay')->__('Are you sure?')
110
+ ));
111
+
112
+
113
+ return $this;
114
+ }
115
+
116
+ public function getRowUrl($row)
117
+ {
118
+ return '';
119
+ }
120
+
121
+ }
app/code/community/Raveinfosys/Sagepay/Controller/Observer.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Controller_Observer
4
+ {
5
+ //Event: adminhtml_controller_action_predispatch_start
6
+ public function overrideTheme()
7
+ {
8
+ Mage::getDesign()->setArea('adminhtml')
9
+ ->setTheme('sagepay');
10
+ }
11
+ }
app/code/community/Raveinfosys/Sagepay/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/Raveinfosys/Sagepay/Model/Config.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Model_Config extends Mage_Core_Model_Abstract {
4
+ private $config = array();
5
+
6
+ public function _construct(){
7
+ $sage_pay_urls = array(
8
+ 'live' => array(
9
+ 'register' => 'https://live.sagepay.com/gateway/service/vspdirect-register.vsp',
10
+ 'refund' => 'https://live.sagepay.com/gateway/service/refund.vsp',
11
+ 'void' => 'https://live.sagepay.com/gateway/service/void.vsp',
12
+ 'cancel' => 'https://live.sagepay.com/gateway/service/cancel.vsp',
13
+ 'authorise' => 'https://live.sagepay.com/gateway/service/authorise.vsp',
14
+ '3dsecure' => 'https://live.sagepay.com/gateway/service/direct3dcallback.vsp'
15
+ ),
16
+ 'test' => array(
17
+ 'register' => 'https://test.sagepay.com/gateway/service/vspdirect-register.vsp',
18
+ 'refund' => 'https://test.sagepay.com/gateway/service/refund.vsp',
19
+ 'void' => 'https://test.sagepay.com/gateway/service/void.vsp',
20
+ 'cancel' => 'https://test.sagepay.com/gateway/service/cancel.vsp',
21
+ 'authorise' => 'https://test.sagepay.com/gateway/service/authorise.vsp',
22
+ '3dsecure' => 'https://test.sagepay.com/gateway/service/direct3dcallback.vsp'
23
+ ),
24
+ 'simulator' => array(
25
+ 'register' => 'https://test.sagepay.com/Simulator/VSPDirectGateway.asp',
26
+ 'refund' => 'https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorRefundTx',
27
+ 'void' => 'https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorVoidTx',
28
+ 'cancel' => 'https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorCancelTx',
29
+ 'release' => 'https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorReleaseTx',
30
+ 'authorise' => 'https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorAuthoriseTx',
31
+ '3dsecure' => 'https://test.sagepay.com/Simulator/VSPDirectCallback.asp'
32
+ )
33
+ );
34
+ $this->config = $sage_pay_urls;
35
+ }
36
+
37
+ public function getVendor(){
38
+ return Mage::getStoreConfig('payment/sagepay/vendor_name');
39
+ }
40
+
41
+ public function getGatewayURL(){
42
+ $mode = Mage::getStoreConfig('payment/sagepay/mode');
43
+ if(in_array($mode, array('live', 'test', 'simulator')))
44
+ return $this->config[$mode] ;
45
+ else
46
+ return $this->config['test'] ;
47
+ }
48
+
49
+ public function getExpectedError(){
50
+ return array('INVALID', 'MALFORMED', 'REJECTED', 'NOTAUTHED', 'ERROR', 'FAIL');
51
+ }
52
+
53
+ public function getExpectedSuccess(){
54
+ return array('OK','AUTHENTICATED','REGISTERED');
55
+ }
56
+
57
+ public function getCcCode($code){
58
+ $data = array(
59
+ 'VI'=> 'VISA',
60
+ 'AE'=> 'AMEX',
61
+ 'MC'=> 'MC',
62
+ 'DI'=> 'DC',
63
+ 'JCB'=> 'JCB',
64
+ 'SM'=> 'MAESTRO',
65
+ 'SO'=> 'SOLO',
66
+ 'OT'=> 'Other',
67
+ );
68
+ return $data[$code];
69
+ }
70
+
71
+
72
+ }
73
+ ?>
app/code/community/Raveinfosys/Sagepay/Model/Mysql4/Sagepay.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Model_Mysql4_Sagepay extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('sagepay/sagepay', 'sagepay_id');
8
+ }
9
+ }
app/code/community/Raveinfosys/Sagepay/Model/Mysql4/Sagepay/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Model_Mysql4_Sagepay_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('sagepay/sagepay');
9
+ }
10
+ }
app/code/community/Raveinfosys/Sagepay/Model/Mysql4/Transaction.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Model_Mysql4_Transaction extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('sagepay/transaction', 'transaction_id');
8
+ }
9
+ }
app/code/community/Raveinfosys/Sagepay/Model/Mysql4/Transaction/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Model_Mysql4_Transaction_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('sagepay/transaction');
9
+ }
10
+ }
app/code/community/Raveinfosys/Sagepay/Model/Observer.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Model_Observer {
4
+ public function disableMethod(Varien_Event_Observer $observer){
5
+ $moduleName="Raveinfosys_Sagepay";
6
+ if('sagepay'==$observer->getMethodInstance()->getCode()){
7
+ if(!Mage::getStoreConfigFlag('advanced/modules_disable_output/'.$moduleName)) {
8
+ //nothing here, as module is ENABLE
9
+ } else {
10
+ $observer->getResult()->isAvailable=false;
11
+ }
12
+
13
+ }
14
+ }
15
+
16
+ public function layoutUpdate($observer)
17
+ {
18
+ if(!Mage::getStoreConfigFlag('advanced/modules_disable_output/'.$moduleName) && !Mage::getStoreConfigFlag('payment/sagepay/active')){
19
+ return $observer;
20
+ }
21
+ $quote = Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getData();
22
+ if($quote['method']=='sagepay'){
23
+ $updates = $observer->getEvent()->getUpdates();
24
+ $updates->addChild('sagepay_checkout_review')
25
+ ->file = 'sagepay_checkout2.xml';
26
+ }
27
+ }
28
+ }
29
+ ?>
app/code/community/Raveinfosys/Sagepay/Model/Payment.php ADDED
@@ -0,0 +1,812 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Model_Payment extends Mage_Payment_Model_Method_Ccsave {
4
+
5
+ protected $_code = 'sagepay';
6
+ protected $_isGateway = true; //Is this payment method a gateway (online auth/charge) ?
7
+ protected $_canAuthorize = true; //Can authorize online?
8
+ protected $_canCapture = true; //Can capture funds online?
9
+ protected $_canCapturePartial = true; //Can capture partial amounts online?
10
+ protected $_canRefund = true; //Can refund online?
11
+ protected $_canRefundInvoicePartial = true; //Can refund invoices partially?
12
+ protected $_canVoid = true; //Can void transactions online?
13
+ protected $_canUseInternal = true; //Can use this payment method in administration panel?
14
+ protected $_canUseCheckout = true; //Can show this payment method as an option on checkout payment page?
15
+ protected $_canUseForMultishipping = true; //Is this payment method suitable for multi-shipping checkout?
16
+ protected $_canFetchTransactionInfo = false;
17
+ protected $_canReviewPayment = true;
18
+ protected $_infoBlockType = 'payment/info_cc';
19
+ protected $_canSaveCc = false;
20
+
21
+ const ACTION_PAYMENT = 'PAYMENT';
22
+ const ACTION_VOID = 'VOID';
23
+ const ACTION_AUTHORISE = 'AUTHORISE';
24
+ const ACTION_AUTHENTICATE = 'AUTHENTICATE';
25
+ const ACTION_REFUND = 'REFUND';
26
+ const ACTION_CANCEL = 'CANCEL';
27
+
28
+ private $urls;
29
+ private $Vendor;
30
+ private $Basket = array();
31
+
32
+ public $AccountType = 'E';
33
+ public $GiftAidPayment = 0;
34
+ public $ApplyAVSCV2 = 0;
35
+ public $Apply3DSecure = 0;
36
+ public $Description = "Sagepay Direct Transaction.";
37
+
38
+ public $VendorTxCode;
39
+ public $TxType;
40
+ public $Amount;
41
+ public $Currency;
42
+ public $CardHolder;
43
+ public $CardNumber;
44
+ public $StartDate;
45
+ public $ExpiryDate;
46
+ public $IssueNumber;
47
+ public $CV2;
48
+ public $CardType;
49
+ public $BillingSurname;
50
+ public $BillingFirstnames;
51
+ public $BillingAddress1;
52
+ public $BillingAddress2;
53
+ public $BillingCity;
54
+ public $BillingPostCode;
55
+ public $BillingCountry;
56
+ public $BillingState;
57
+ public $BillingPhone;
58
+ public $DeliverySurname;
59
+ public $DeliveryFirstnames;
60
+ public $DeliveryAddress1;
61
+ public $DeliveryAddress2;
62
+ public $DeliveryCity;
63
+ public $DeliveryPostCode;
64
+ public $DeliveryCountry;
65
+ public $DeliveryState;
66
+ public $DeliveryPhone;
67
+ public $CustomerEmail;
68
+ public $OrderIncrementId;
69
+
70
+ public $result = array('Status' => 'BEGIN');
71
+
72
+ public function __construct($vendor , $mode ) {
73
+
74
+ $this->urls = $this->getConfigModel()->getGatewayURL();
75
+ $this->Vendor = $this->getConfigModel()->getVendor();
76
+ }
77
+
78
+ public function isMsOnOverview() {
79
+ return ($this->_getQuote()->getIsMultiShipping() && $this->getMsActiveStep() == 'multishipping_overview');
80
+ }
81
+
82
+ public function getMsActiveStep() {
83
+ return Mage::getSingleton('checkout/type_multishipping_state')->getActiveStep();
84
+ }
85
+
86
+ protected function _getReservedOid() {
87
+
88
+ if ($this->isMsOnOverview() && ($this->_getQuote()->getPayment()->getMethod() == 'sagepay')) {
89
+ return null;
90
+ }
91
+
92
+ $orderId = $this->getSagepayModel()->getReservedId();
93
+
94
+ if (!$orderId) {
95
+
96
+ if (!$this->_getQuote()->getReservedOrderId() || $this->_orderIdAlreadyUsed($this->_getQuote()->getReservedOrderId())) {
97
+ $this->_getQuote()->unsReservedOrderId();
98
+ $this->_getQuote()->reserveOrderId()->save();
99
+ }
100
+ $orderId = $this->_getQuote()->getReservedOrderId();
101
+ $this->getSagepayModel()->setReservedId($orderId);
102
+ }
103
+
104
+ if ($this->isMsOnOverview()) {
105
+ $this->getSagepayModel()->setReservedId(null);
106
+ }
107
+ return $orderId;
108
+ }
109
+
110
+ protected function _orderIdAlreadyUsed($orderId) {
111
+ if (!$orderId)
112
+ return false;
113
+
114
+ $existingOrder = Mage::getModel("sales/order")->loadByIncrementId($orderId);
115
+
116
+ if (!$existingOrder->getId()) {
117
+ return false;
118
+ }
119
+ return true;
120
+ }
121
+
122
+ protected function _getQuote() {
123
+
124
+ $opQuote = Mage::getSingleton('checkout/type_onepage')->getQuote();
125
+ $adminQuote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
126
+
127
+ $rqQuoteId = Mage::app()->getRequest()->getParam('qid');
128
+ if ($adminQuote->hasItems() === false && (int) $rqQuoteId) {
129
+ $opQuote->setQuote(Mage::getModel('sales/quote')->loadActive($rqQuoteId));
130
+ }
131
+ return ($adminQuote->hasItems() === true) ? $adminQuote : $opQuote;
132
+ }
133
+
134
+
135
+ protected function _getTrnVendorTxCode() {
136
+ return $this->_getReservedOid();
137
+ }
138
+
139
+
140
+ public function validate() {
141
+ $info = $this->getInfoInstance();
142
+ $order_amount=0;
143
+ if ($info instanceof Mage_Sales_Model_Quote_Payment) {
144
+ $order_amount=(double)$info->getQuote()->getBaseGrandTotal();
145
+ } elseif ($info instanceof Mage_Sales_Model_Order_Payment) {
146
+ $order_amount=(double)$info->getOrder()->getQuoteBaseGrandTotal();
147
+ }
148
+
149
+ $order_min=$this->getConfigData('min_order_total');
150
+ $order_max=$this->getConfigData('max_order_total');
151
+ if(!empty($order_max) && (double)$order_max<$order_amount) {
152
+ Mage::throwException("Order amount greater than permissible Maximum order amount.");
153
+ }
154
+ if(!empty($order_min) && (double)$order_min>$order_amount) {
155
+ Mage::throwException("Order amount less than required Minimum order amount.");
156
+ }
157
+
158
+ parent::validate();
159
+ }
160
+
161
+ public function authorize(Varien_Object $payment, $amount) {
162
+ if(Mage::app()->getStore()->isAdmin()){
163
+ if ($amount <= 0) {
164
+ Mage::throwException(Mage::helper('paygate')->__('Invalid amount for transaction.'));
165
+ }
166
+
167
+ $this->Amount = number_format($amount, 2, '.', '');
168
+ $this->TxType = self::ACTION_AUTHENTICATE;
169
+ $this->AccountType = 'M';
170
+ $this->Apply3DSecure = 2;
171
+ $result = $this->__processPayment($payment);
172
+
173
+ if (in_array($this->result['Status'],$this->getConfigModel()->getExpectedSuccess())) {
174
+ $payment->setAdditionalInformation('payment_type', $this->getConfigData('payment_action'));
175
+ $orderId = $payment->getOrder()->getIncrementId();
176
+ $this->result['CustomerEmail'] = $this->CustomerEmail;
177
+ $this->result['CustomerName'] = $this->BillingFirstnames.' '.$this->BillingSurname;
178
+ $this->result['CardType'] = $this->CardType;
179
+ $this->result['CardHolderName'] = $this->CardHolder;
180
+ $this->result['CustomerContact'] = $this->BillingPhone;
181
+ $this->result['VendorTxCode'] = $this->VendorTxCode;
182
+ $sagepay_id = $this->getSagepayModel()->saveAuthDetail($this->result,$orderId);
183
+ $this->getSagepayModel()->saveCardDetail($sagepay_id,$this->result);
184
+ $this->getTransactionModel()->saveTransactionDetail($orderId ,$this->result, $this->VendorTxCode, self::ACTION_AUTHENTICATE, $sagepay_id);
185
+ $this->_addTransaction(
186
+ $payment,
187
+ $this->VendorTxCode,
188
+ Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH,
189
+ array('is_transaction_closed' => 0));
190
+
191
+ $payment->setSkipTransactionCreation(true);
192
+ return $this;
193
+ }
194
+ else{
195
+ $payment->setSkipTransactionCreation(true);
196
+ if($result=='ERROR'){
197
+ $error = $this->result;
198
+ Mage::throwException($error['Errors'][0]);
199
+ }
200
+ else if(in_array($this->result['Status'], $this->getConfigModel()->getExpectedError())) {
201
+ Mage::throwException("Gateway error : {".(string)$this->result['Errors'][0]."}");
202
+ }
203
+ }
204
+ }
205
+ else{
206
+ $session = Mage::getSingleton('core/session');
207
+ if ($data = $session->getGatewayResult()) {
208
+ $payment->setAdditionalInformation('payment_type', $this->getConfigData('payment_action'));
209
+ $orderId = $payment->getOrder()->getIncrementId();
210
+ $sagepay_id = $this->getSagepayModel()->saveAuthDetail($data,$orderId);
211
+ $this->getSagepayModel()->saveCardDetail($sagepay_id,$data);
212
+ $this->getTransactionModel()->saveTransactionDetail($orderId ,$data, $data['VendorTxCode'], self::ACTION_AUTHENTICATE, $sagepay_id);
213
+ $this->_addTransaction(
214
+ $payment,
215
+ $data['VendorTxCode'],
216
+ Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH,
217
+ array('is_transaction_closed' => 0));
218
+ $session->unsGatewayResult()->unsPaymentdata();
219
+ $payment->setSkipTransactionCreation(true);
220
+ }
221
+ return $this;
222
+
223
+ }
224
+
225
+ }
226
+
227
+ public function capture(Varien_Object $payment, $amount) {
228
+ if(Mage::app()->getStore()->isAdmin()){
229
+ if ($amount <= 0) {
230
+ Mage::throwException(Mage::helper('paygate')->__('Invalid amount for transaction.'));
231
+ }
232
+
233
+ $data = $this->getSagepayModel()->getCollection()->addFieldToFilter('order_id',$payment->getOrder()->getIncrementId())->getFirstItem();
234
+
235
+ if($data->getOrderId() == $payment->getOrder()->getIncrementId()){
236
+ $this->authorizePayment($payment, number_format($amount, 2, '.', ''),$data);
237
+
238
+ if(in_array($this->result['Status'],$this->getConfigModel()->getExpectedSuccess())){
239
+ $orderId = $payment->getOrder()->getIncrementId();
240
+ $sagepay_id = $this->getSagepayModel()->saveAuthorisedDetail($this->result,$this->VendorTxCode,$data, $payment->getOrder()->getIncrementId());
241
+ $this->getTransactionModel()->saveTransactionDetail($orderId ,$this->result, $this->VendorTxCode, self::ACTION_PAYMENT, $sagepay_id);
242
+ $payment->setStatus(self::STATUS_APPROVED);
243
+ $payment->setLastTransId((string)$this->VendorTxCode);
244
+ if (!$payment->getParentTransactionId() || (string)$this->VendorTxCode != $payment->getParentTransactionId()) {
245
+ $payment->setTransactionId((string)$this->VendorTxCode);
246
+ }
247
+ return $this;
248
+ }
249
+ else{
250
+ $payment->setSkipTransactionCreation(true);
251
+ if(in_array($this->result['Status'], $this->getConfigModel()->getExpectedError())){
252
+ $error = $this->result;
253
+ Mage::throwException($error['Errors'][0]);
254
+ }
255
+ }
256
+
257
+ }
258
+ $this->Amount = number_format($amount, 2, '.', '');
259
+ $this->TxType = self::ACTION_PAYMENT;
260
+ $this->AccountType = 'M';
261
+ $this->Apply3DSecure = 2;
262
+ $result = $this->__processPayment($payment);
263
+
264
+ if (in_array($this->result['Status'],$this->getConfigModel()->getExpectedSuccess())) {
265
+ $orderId = $payment->getOrder()->getIncrementId();
266
+ $this->result['CustomerEmail'] = $this->CustomerEmail;
267
+ $this->result['CustomerName'] = $this->BillingFirstnames.' '.$this->BillingSurname;
268
+ $this->result['CardType'] = $this->CardType;
269
+ $this->result['CardHolderName'] = $this->CardHolder;
270
+ $this->result['CustomerContact'] = $this->BillingPhone;
271
+ $this->result['VendorTxCode'] = $this->VendorTxCode;
272
+ $sagepay_id = $this->getSagepayModel()->saveOrderDetail($this->result,$orderId);
273
+ $this->getSagepayModel()->saveCardDetail($sagepay_id,$this->result);
274
+ $this->getTransactionModel()->saveTransactionDetail($orderId ,$this->result, $this->VendorTxCode, self::ACTION_PAYMENT, $sagepay_id);
275
+ $payment->setStatus(self::STATUS_APPROVED);
276
+ $payment->setLastTransId((string)$this->VendorTxCode);
277
+ if (!$payment->getParentTransactionId() || (string)$this->VendorTxCode != $payment->getParentTransactionId()) {
278
+ $payment->setTransactionId((string)$this->VendorTxCode);
279
+ }
280
+ return $this;
281
+ }
282
+ else{
283
+ $payment->setSkipTransactionCreation(true);
284
+ if($result=='ERROR'){
285
+ $error = $this->result;
286
+ Mage::throwException($error['Errors'][0]);
287
+ }
288
+ else if(in_array($this->result['Status'], $this->getConfigModel()->getExpectedError())) {
289
+ Mage::throwException("Gateway error : {".(string)$this->result['Errors'][0]."}");
290
+ }
291
+ }
292
+ }
293
+ else{
294
+ $session = Mage::getSingleton('core/session');
295
+ if ($data = $session->getGatewayResult()) {
296
+ $payment->setAdditionalInformation('payment_type', $this->getConfigData('payment_action'));
297
+ $orderId = $payment->getOrder()->getIncrementId();
298
+ $sagepay_id = $this->getSagepayModel()->saveOrderDetail($data,$orderId);
299
+ $this->getSagepayModel()->saveCardDetail($sagepay_id,$data);
300
+ $this->getTransactionModel()->saveTransactionDetail($orderId ,$data, $data['VendorTxCode'], $data['TxType'], $sagepay_id);
301
+ $payment->setStatus(self::STATUS_APPROVED);
302
+ $payment->setLastTransId((string)$data['VendorTxCode']);
303
+ if (!$payment->getParentTransactionId() || (string)$data['VendorTxCode'] != $payment->getParentTransactionId()) {
304
+ $payment->setTransactionId((string)$data['VendorTxCode']);
305
+ }
306
+ $session->unsGatewayResult()->unsPaymentdata();
307
+ }
308
+ return $this;
309
+ }
310
+ }
311
+
312
+ public function authorizePayment(Varien_Object $payment, $amount, $data) {
313
+ $params = array();
314
+ $params['VPSProtocol'] = urlencode('2.23');
315
+ $params['TxType'] = self::ACTION_AUTHORISE;
316
+ $params['Vendor'] = urlencode(Mage::getStoreConfig('payment/sagepay/vendor_name'));
317
+ $params['VendorTxCode'] = time() . rand(0, 9999).'-'.$payment->getOrder()->getIncrementId();
318
+ $this->VendorTxCode = $params['VendorTxCode'];
319
+ $params['Amount'] = urlencode($amount);
320
+ $params['Description'] = $this->Description;
321
+ $params['RelatedVPSTxId'] = $data->getVpsTxId(); //VPSTxId of main transaction
322
+ $params['RelatedVendorTxCode'] = urlencode($data->getVendorTxCode()); //VendorTxCode of main transaction
323
+ $params['RelatedSecurityKey'] = urlencode($data->getSecurityKey()); //securitykey of main transaction
324
+
325
+ $this->result = $this->requestPost($this->urls['authorise'], $params);
326
+ if (in_array($this->result['Status'], $this->getConfigModel()->getExpectedError())) {
327
+ $this->result['Errors'] = array();
328
+ foreach(split("\n", $this->result['StatusDetail']) as $error) {
329
+ $this->result['Errors'] = array_merge($this->result['Errors'], $this->getError($error));
330
+ }
331
+ }
332
+ }
333
+
334
+ public function refund(Varien_Object $payment, $amount) {
335
+ if ($payment->getRefundTransactionId() && $amount > 0) {
336
+ $data = $this->getSagepayModel()->getCollection()->addFieldToFilter('vendor_tx_code',trim($payment->getRefundTransactionId()))->getFirstItem();
337
+
338
+ $params = array();
339
+ $params['VPSProtocol'] = urlencode('2.23');
340
+ $params['TxType'] = self::ACTION_REFUND;
341
+ $params['Vendor'] = urlencode(Mage::getStoreConfig('payment/sagepay/vendor_name'));
342
+ $params['VendorTxCode'] = time() . rand(0, 9999).'-'.$payment->getOrder()->getIncrementId();
343
+ $params['Amount'] = urlencode(number_format($amount, 2, '.', ''));
344
+ $params['Currency'] = urlencode(Mage::app()->getStore()->getCurrentCurrencyCode());
345
+ $params['Description'] = $this->Description;
346
+ $params['RelatedVPSTxId'] = $data->getVpsTxId();
347
+ $params['RelatedVendorTxCode'] = urlencode($data->getVendorTxCode());
348
+ $params['RelatedSecurityKey'] = urlencode($data->getSecurityKey());
349
+ $params['RelatedTxAuthNo'] = urlencode($data->getTxAuthNo());
350
+
351
+ $this->result = $this->requestPost($this->urls['refund'], $params);
352
+
353
+ if (in_array($this->result['Status'], $this->getConfigModel()->getExpectedError())) {
354
+ $this->result['Errors'] = array();
355
+ foreach(split("\n", $this->result['StatusDetail']) as $error) {
356
+ $this->result['Errors'] = array_merge($this->result['Errors'], $this->getError($error));
357
+ }
358
+ }
359
+ if (in_array($this->result['Status'],$this->getConfigModel()->getExpectedSuccess())){
360
+ $orderId = $payment->getOrder()->getIncrementId();
361
+ $this->getSagepayModel()->saveRefundDetail($this->result,$data->getSagepayId());
362
+ $this->getTransactionModel()->saveTransactionDetail($orderId ,$this->result, $params['VendorTxCode'], self::ACTION_REFUND, $data->getSagepayId());
363
+ $payment->setStatus(Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND);
364
+ $payment->setLastTransId((string)$params['VendorTxCode']);
365
+ if (!$payment->getParentTransactionId() || (string)$params['VendorTxCode'] != $payment->getParentTransactionId()) {
366
+ $payment->setTransactionId((string)$params['VendorTxCode']);
367
+ }
368
+ return $this;
369
+ }
370
+ else{
371
+ if($result=='ERROR'){
372
+ $error = $this->result;
373
+ Mage::throwException($error['Errors'][0]);
374
+ }
375
+ else if(in_array($result, $this->getConfigModel()->getExpectedError())) {
376
+ Mage::throwException("Gateway error : {".(string)$this->result['Errors'][0]."}");
377
+ }
378
+ }
379
+ }
380
+ Mage::throwException(Mage::helper('paygate')->__('Error in refunding the payment.'));
381
+
382
+ }
383
+
384
+ public function void(Varien_Object $payment) {
385
+
386
+ $orderId = $payment->getOrder()->getIncrementId();
387
+ $data = $this->getSagepayModel()->getCollection()->addFieldToFilter('order_id',$orderId)->getFirstItem();
388
+ $params = array();
389
+ $params['VPSProtocol'] = urlencode('2.23');
390
+ $params['TxType'] = self::ACTION_VOID;
391
+ $params['Vendor'] = urlencode(Mage::getStoreConfig('payment/sagepay/vendor_name'));
392
+ $params['VendorTxCode'] = urlencode($data->getVendorTxCode());
393
+ $params['VPSTxId'] = $data->getVpsTxId();
394
+ $params['SecurityKey'] = urlencode($data->getSecurityKey());
395
+ $params['TxAuthNo'] = urlencode($data->getTxAuthNo());
396
+
397
+ $this->result = $this->requestPost($this->urls['void'], $params);
398
+ if (in_array($this->result['Status'], $this->getConfigModel()->getExpectedError())) {
399
+ $this->result['Errors'] = array();
400
+ foreach(split("\n", $this->result['StatusDetail']) as $error) {
401
+ $this->result['Errors'] = array_merge($this->result['Errors'], $this->getError($error));
402
+ }
403
+ }
404
+
405
+ if (in_array($this->result['Status'],$this->getConfigModel()->getExpectedSuccess())){
406
+ $this->getSagepayModel()->saveVoidDetail($this->result,$data->getSagepayId());
407
+ $this->getTransactionModel()->saveTransactionDetail($orderId ,$this->result, $params['VendorTxCode'], self::ACTION_VOID, $data->getSagepayId());
408
+ $payment->setStatus(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
409
+ $payment->setLastTransId((string)$params['VendorTxCode']);
410
+ if (!$payment->getParentTransactionId() || (string)$params['VendorTxCode'] != $payment->getParentTransactionId()) {
411
+ $payment->setTransactionId((string)$params['VendorTxCode']);
412
+ }
413
+ return $this;
414
+ }
415
+ else{
416
+ if($result=='ERROR'){
417
+ $error = $this->result;
418
+ Mage::throwException($error['Errors'][0]);
419
+ }
420
+ else if(in_array($result, $this->getConfigModel()->getExpectedError())) {
421
+ Mage::throwException("Gateway error : {".(string)$this->result['Errors'][0]."}");
422
+ }
423
+ }
424
+ return $this;
425
+ }
426
+
427
+ public function cancel(Varien_Object $payment) {
428
+ $orderId = $payment->getOrder()->getIncrementId();
429
+ $data = $this->getSagepayModel()->getCollection()->addFieldToFilter('order_id',$orderId)->getFirstItem();
430
+ $params = array();
431
+ $params['VPSProtocol'] = urlencode('2.23');
432
+ $params['TxType'] = self::ACTION_CANCEL;
433
+ $params['Vendor'] = urlencode(Mage::getStoreConfig('payment/sagepay/vendor_name'));
434
+ $params['VendorTxCode'] = urlencode($data->getVendorTxCode());
435
+ $params['VPSTxId'] = $data->getVpsTxId();
436
+ $params['SecurityKey'] = urlencode($data->getSecurityKey());
437
+ $params['TxAuthNo'] = urlencode($data->getTxAuthNo());
438
+
439
+ $this->result = $this->requestPost($this->urls['cancel'], $params);
440
+ if (in_array($this->result['Status'], $this->getConfigModel()->getExpectedError())) {
441
+ $this->result['Errors'] = array();
442
+ foreach(split("\n", $this->result['StatusDetail']) as $error) {
443
+ $this->result['Errors'] = array_merge($this->result['Errors'], $this->getError($error));
444
+ }
445
+ }
446
+
447
+ if (in_array($this->result['Status'],$this->getConfigModel()->getExpectedSuccess())){
448
+ $this->getSagepayModel()->saveVoidDetail($this->result,$data->getSagepayId());
449
+ $this->getTransactionModel()->saveTransactionDetail($orderId ,$this->result, $params['VendorTxCode'], self::ACTION_CANCEL, $data->getSagepayId());
450
+ $payment->setStatus(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
451
+ $payment->setLastTransId((string)$params['VendorTxCode']);
452
+ if (!$payment->getParentTransactionId() || (string)$params['VendorTxCode'] != $payment->getParentTransactionId()) {
453
+ $payment->setTransactionId((string)$params['VendorTxCode']);
454
+ }
455
+ return $this;
456
+ }
457
+ else{
458
+ if($result=='ERROR'){
459
+ $error = $this->result;
460
+ Mage::throwException($error['Errors'][0]);
461
+ }
462
+ else if(in_array($result, $this->getConfigModel()->getExpectedError())) {
463
+ Mage::throwException("Gateway error : {".(string)$this->result['Errors'][0]."}");
464
+ }
465
+ }
466
+ return $this;
467
+ }
468
+
469
+ public function __processPayment(Varien_Object $payment){
470
+
471
+ $this->Currency = Mage::app()->getStore()->getCurrentCurrencyCode();
472
+ $payment->setAmount($amount);
473
+ $this->CardHolder = $payment->getCcOwner();
474
+ $this->CardNumber = $payment->getCcNumber();
475
+ $this->ExpiryDate = date("my",strtotime('01-'.$payment->getCcExpMonth().'-'.$payment->getCcExpYear()));
476
+ $this->IssueNumber = $payment->getCcSsIssue();
477
+ $this->CV2 = $payment->getCcCid();
478
+ $this->CardType = $this->getConfigModel()->getCcCode($payment->getCcType());
479
+ $order = $this->_getQuote();
480
+ $this->setGatewayOrderData($order);
481
+ return $this->register();
482
+ }
483
+
484
+ public function setGatewayOrderData($order){
485
+
486
+ if (!empty($order)) {
487
+ $BillingAddress = $order->getBillingAddress();
488
+ $this->BillingSurname = $BillingAddress->getLastname();
489
+ $this->BillingFirstnames = $BillingAddress->getFirstname();
490
+ $this->BillingAddress1 = $BillingAddress->getStreet(1);
491
+ $this->BillingAddress2;
492
+ $this->BillingCity = $BillingAddress->getCity();
493
+ $this->BillingPostCode = $BillingAddress->getPostcode();
494
+ $this->BillingCountry = $BillingAddress->getCountry();
495
+ $this->BillingState = Mage::getModel('directory/region')->load($BillingAddress->getRegionId())->getCode();
496
+ $this->BillingPhone = $BillingAddress->getTelephone();
497
+ if(!$order->getIsVirtual())
498
+ $ShippingAddress = $order->getShippingAddress();
499
+ else
500
+ $ShippingAddress = $order->getBillingAddress();
501
+ $this->DeliverySurname = $ShippingAddress->getLastname();
502
+ $this->DeliveryFirstnames = $ShippingAddress->getFirstname();
503
+ $this->DeliveryAddress1 = $ShippingAddress->getStreet(1);
504
+ $this->DeliveryAddress2;
505
+ $this->DeliveryCity = $ShippingAddress->getCity();
506
+ $this->DeliveryPostCode = $ShippingAddress->getPostcode();
507
+ $this->DeliveryCountry = $ShippingAddress->getCountry();
508
+ $this->DeliveryState = Mage::getModel('directory/region')->load($ShippingAddress->getRegionId())->getCode();
509
+ $this->DeliveryPhone = $ShippingAddress->getTelephone();
510
+
511
+ $this->CustomerEmail = $order->getCustomerEmail();
512
+ $this->VendorTxCode = time() . rand(0, 9999) .'-'. $this->_getTrnVendorTxCode();//$this->_getQuote()->getReservedOrderId();
513
+ $product_array = array();
514
+ foreach ($order->getAllItems() as $item) {
515
+ if(!$item->getParentItemId())
516
+ $this->addLine($item->getName(), $item->getQty(), $item->getPrice(), $item->getTaxAmount());
517
+ }
518
+ foreach ($order->getAllAddresses() as $address) {
519
+ //Add shipping amount
520
+ if($ship_amount = $address->getData('shipping_amount'))
521
+ $this->addLine($address->getData('shipping_description'), 1, $ship_amount, 0);
522
+
523
+ //Add discount amount
524
+ if($address->getData('discount_amount')<0)
525
+ $this->addLine('Discount', 1, $address->getData('discount_amount'), 0);
526
+ }
527
+
528
+
529
+ }
530
+ }
531
+
532
+ public function register() {
533
+
534
+ $errors = array();
535
+ if (!$this->Vendor) $errors[] = 'The Vendor must be provided';
536
+ if (!$this->VendorTxCode) $errors[] = 'The VendorTxCode must be provided';
537
+ if (!is_numeric($this->Amount)) $errors[] = 'The Amount field must be specified, and must be numeric.';
538
+ if (!$this->Currency) $errors[] = 'Currency must be specified, eg GBP.';
539
+ if (!$this->CardHolder) $errors[] = 'CardHolder must be specified.';
540
+ if (!$this->CardNumber) $errors[] = 'CardNumber must be specified.';
541
+ if (!$this->ExpiryDate) $errors[] = 'ExpiryDate must be specified.';
542
+ if ($this->IssueNumber and !preg_match("/^\d{1,2}$/", $this->IssueNumber)) $errors[] = 'IssueNumber is invalid.';
543
+ if ($this->CardType=='AMEX' and !preg_match("/^\d{4}$/", $this->CV2)) $errors[] = 'CV2 must be 4 numbers long.';
544
+ if ($this->CardType!='AMEX' and !preg_match("/^\d{3}$/", $this->CV2)) $errors[] = 'CV2 must be 3 numbers long.';
545
+ if (!in_array($this->CardType, array('VISA', 'MC', 'DELTA', 'SOLO', 'MAESTRO', 'UKE', 'AMEX', 'DC', 'JCB', 'LASER'))) $errors[] = 'CardType must be one of VISA, MC, DELTA, SOLO, MAESTRO, UKE, AMEX, DC, JCB, LASER';
546
+ if (!$this->BillingSurname) $errors[] = 'BillingSurname must be specified.';
547
+ if (!$this->BillingFirstnames) $errors[] = 'BillingFirstnames must be specified.';
548
+ if (!$this->BillingAddress1) $errors[] = 'BillingAddress1 must be specified.';
549
+ if (!$this->BillingCity) $errors[] = 'BillingCity must be specified.';
550
+ if (!$this->BillingPostCode) $errors[] = 'BillingPostCode must be specified.';
551
+ if (!$this->BillingCountry) $errors[] = 'BillingCountry must be specified.';
552
+ if ($this->BillingCountry == 'US' and !$this->BillingState) $errors['BillingState'] = 'BillingState mut be specified.';
553
+ if (!$this->DeliverySurname) $errors[] = 'DeliverySurname must be specified.';
554
+ if (!$this->DeliveryFirstnames) $errors[] = 'DeliveryFirstnames must be specified.';
555
+ if (!$this->DeliveryAddress1) $errors[] = 'DeliveryAddress1 must be specified.';
556
+ if (!$this->DeliveryCity) $errors[] = 'DeliveryCity must be specified.';
557
+ if (!$this->DeliveryPostCode) $errors[] = 'DeliveryPostCode must be specified.';
558
+ if (!$this->DeliveryCountry) $errors[] = 'DeliveryCountry must be specified.';
559
+ if ($this->DeliveryCountry == 'US' and !$this->DeliveryState) $errors[] = 'DeliveryState mut be specified.';
560
+ if ($this->CustomerEmail and !preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+\.([a-zA-Z0-9\._-]+)+$/", $this->CustomerEmail)) $errors[] = 'CustomerEmail is invalid.';
561
+
562
+ if (count($errors)) {
563
+ $this->result = array('Status' => 'ERRORCHECKFAIL', 'Errors' => $errors);
564
+ return 'ERROR';
565
+ }
566
+
567
+ $data = array(
568
+ 'VPSProtocol' => 2.23,
569
+ 'TxType' => $this->TxType,
570
+ 'Vendor' => $this->Vendor,
571
+ 'VendorTxCode' => $this->VendorTxCode,
572
+ 'Amount' => number_format($this->Amount, 2, '.', ''),
573
+ 'Currency' => $this->Currency,
574
+ 'Description' => $this->Description,
575
+ 'CardHolder' => $this->CardHolder,
576
+ 'CardNumber' => $this->CardNumber,
577
+ 'ExpiryDate' => $this->ExpiryDate,
578
+ 'IssueNumber' => $this->IssueNumber,
579
+ 'CV2' => $this->CV2,
580
+ 'CardType' => $this->CardType,
581
+ 'BillingSurname' => $this->BillingSurname,
582
+ 'BillingFirstnames' => $this->BillingFirstnames,
583
+ 'BillingAddress1' => $this->BillingAddress1,
584
+ 'BillingAddress2' => $this->BillingAddress2,
585
+ 'BillingCity' => $this->BillingCity,
586
+ 'BillingPostCode' => $this->BillingPostCode,
587
+ 'BillingCountry' => $this->BillingCountry,
588
+ 'BillingState' => $this->BillingCountry == 'US' ? $this->BillingState : '',
589
+ 'BillingPhone' => $this->BillingPhone,
590
+ 'DeliverySurname' => $this->DeliverySurname,
591
+ 'DeliveryFirstnames' => $this->DeliveryFirstnames,
592
+ 'DeliveryAddress1' => $this->DeliveryAddress1,
593
+ 'DeliveryAddress2' => $this->DeliveryAddress2,
594
+ 'DeliveryCity' => $this->DeliveryCity,
595
+ 'DeliveryPostCode' => $this->DeliveryPostCode,
596
+ 'DeliveryCountry' => $this->DeliveryCountry,
597
+ 'DeliveryState' => $this->DeliveryCountry == 'US' ? $this->DeliveryState : '',
598
+ 'DeliveryPhone' => $this->DeliveryPhone,
599
+ 'CustomerEmail' => $this->CustomerEmail,
600
+ 'GiftAidPayment' => $this->GiftAidPayment,
601
+ 'AccountType' => $this->AccountType,
602
+ 'ClientIPAddress' => $_SERVER['REMOTE_ADDR'],
603
+ 'ApplyAVSCV2' => $this->ApplyAVSCV2,
604
+ 'Apply3DSecure' => $this->Apply3DSecure
605
+ );
606
+
607
+ if (sizeof($this->Basket)) {
608
+ $data['Basket'] = count($this->Basket);
609
+ foreach($this->Basket as $line) {
610
+ $data['Basket'] .= ':' . $line['description'];
611
+ $data['Basket'] .= ':' . $line['quantity'];
612
+ $data['Basket'] .= ':' . number_format($line['value'], 2, '.', '');
613
+ $data['Basket'] .= ':' . number_format($line['tax'], 2, '.', '');
614
+ $data['Basket'] .= ':' . number_format(($line['value'] + $line['tax']), 2, '.', '');
615
+ $data['Basket'] .= ':' . number_format(($line['quantity'] * ($line['value'] + $line['tax'])), 2, '.', '');
616
+ }
617
+ }
618
+
619
+ $this->result = $this->requestPost($this->urls['register'], $data);
620
+
621
+ if (in_array($this->result['Status'], $this->getConfigModel()->getExpectedError())) {
622
+ $this->result['Errors'] = array();
623
+ foreach(split("\n", $this->result['StatusDetail']) as $error) {
624
+ $this->result['Errors'] = array_merge($this->result['Errors'], $this->getError($error));
625
+ }
626
+ }
627
+ if ($this->result['Status'] == '3DAUTH') {
628
+
629
+ $this->result['VendorTxCode'] = $this->VendorTxCode;
630
+ return $this->result;
631
+ }
632
+ return $this->result;
633
+ }
634
+
635
+ public function addLine($description, $quantity, $value, $tax=0) {
636
+ $this->Basket[] = array(
637
+ 'description' => $description,
638
+ 'quantity' => $quantity,
639
+ 'value' => $value,
640
+ 'tax' => $tax
641
+ );
642
+ }
643
+
644
+ public static function recover3d() {
645
+ $sagepay = unserialize($_SESSION['sagepay_obj']);
646
+ unset($_SESSION['sagepay_obj']);
647
+ return $sagepay;
648
+ }
649
+
650
+ public static function is3dResponse() {
651
+ if (isset($_REQUEST['PaRes']) and isset($_REQUEST['MD']) and isset($_SESSION['sagepay_obj'])) {
652
+ return true;
653
+ } else {
654
+ return false;
655
+ }
656
+ }
657
+
658
+ public function complete3d($post_data) {
659
+ $session = Mage::getSingleton('core/session');
660
+ $data = array(
661
+ 'PARes' => $post_data['PaRes'],
662
+ 'MD' => $post_data['MD']
663
+ );
664
+
665
+ $result = $this->requestPost($this->urls['3dsecure'], $data);
666
+ $vendor = $session->getGatewayResult($gateway_result);
667
+ $result['VendorTxCode'] = $vendor['VendorTxCode'];
668
+ $result['CustomerEmail'] = $vendor['CustomerEmail'];
669
+ $result['CustomerName'] = $vendor['CustomerName'];
670
+ $result['CardType'] = $vendor['CardType'];
671
+ $result['CardHolderName'] = $vendor['CardHolderName'];
672
+ $result['CustomerContact'] = $vendor['CustomerContact'];
673
+ $result['TxType'] = $vendor['TxType'];
674
+ return $result;
675
+
676
+ }
677
+
678
+ public function status() {
679
+ return $this->result['Status'];
680
+ }
681
+
682
+ private function getError($message) {
683
+ $chunks = split(' : ', $message, 2);
684
+ if ($chunks[0] == '3048') { return array('CardNumber' => 'The card number is invalid.'); }
685
+ if ($chunks[0] == '4022') { return array('CardNumber' => 'The card number is not valid for the card type selected.'); }
686
+ if ($chunks[0] == '4023') { return array('CardNumber' => 'The issue number must be provided.'); }
687
+ return array($message);
688
+ }
689
+
690
+ private function requestPost($url, $data){
691
+ $fields_string = http_build_query($data);
692
+ $log['request'] = $data;
693
+ set_time_limit(60);
694
+ $output = array();
695
+ $curlSession = curl_init();
696
+ curl_setopt ($curlSession, CURLOPT_URL, $url);
697
+ curl_setopt ($curlSession, CURLOPT_HEADER, 0);
698
+ curl_setopt ($curlSession, CURLOPT_POST, 1);
699
+ curl_setopt ($curlSession, CURLOPT_POSTFIELDS, $fields_string);
700
+ curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, 1);
701
+ curl_setopt($curlSession, CURLOPT_TIMEOUT, 30);
702
+ curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, FALSE);
703
+ curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 2);
704
+ $response = explode(chr(10), curl_exec($curlSession));
705
+ $log['response'] = $response;
706
+ $this->getSagepayModel()->logTransaction($log);
707
+ unset($this->CardNumber);
708
+ unset($this->ExpiryDate);
709
+ unset($this->CV2);
710
+
711
+ if (curl_error($curlSession)){
712
+ $output['Status'] = "FAIL";
713
+ $output['StatusDetail'] = curl_error($curlSession);
714
+ }
715
+ curl_close ($curlSession);
716
+ for ($i=0; $i<count($response); $i++){
717
+ $splitAt = strpos($response[$i], "=");
718
+ $output[trim(substr($response[$i], 0, $splitAt))] = trim(substr($response[$i], ($splitAt+1)));
719
+ }
720
+ return $output;
721
+ }
722
+
723
+ public static function country($code) {
724
+ $countries = $this->getSagepayModel()->countries();
725
+ return $countries[$code];
726
+ }
727
+
728
+ public function registerTransaction($data){
729
+ if(Mage::getStoreConfig('payment/sagepay/payment_action')=='authorize'){
730
+ $this->TxType = self::ACTION_AUTHENTICATE;
731
+ }
732
+ elseif(Mage::getStoreConfig('payment/sagepay/payment_action')=='authorize_capture'){
733
+ $this->TxType = self::ACTION_PAYMENT;
734
+ }
735
+ return $this->sagePayRegisterPayment($data);
736
+ }
737
+
738
+ public function sagePayRegisterPayment($data) {
739
+
740
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
741
+ $amount = $quote->getData('grand_total');
742
+
743
+ if ($amount <= 0) {
744
+ Mage::throwException(Mage::helper('paygate')->__('Invalid amount for transaction.'));
745
+ }
746
+
747
+ $this->Currency = Mage::app()->getStore()->getCurrentCurrencyCode();
748
+ $this->Amount = $amount;
749
+ $this->CardHolder = $data['cc_owner'];
750
+ $this->CardNumber = $data['cc_number'];
751
+ $this->ExpiryDate = date("my",strtotime('01-'.$data['cc_exp_month'].'-'.$data['cc_exp_year']));
752
+ $this->CV2 = $data['cc_cid'];
753
+ $this->CardType = $this->getConfigModel()->getCcCode($data['cc_type']);
754
+
755
+ $this->setGatewayOrderData($quote);
756
+ $result = $this->register();
757
+ if($result=='ERROR'){
758
+ $error = $this->result;
759
+ Mage::throwException($error['Errors'][0]);
760
+ }
761
+ elseif(in_array($this->result['Status'], $this->getConfigModel()->getExpectedError())) {
762
+ if(!$this->result['Errors'][0])
763
+ Mage::throwException("Gateway error : {".(string)$this->result['StatusDetail']."}");
764
+ else
765
+ Mage::throwException("Gateway error : {".(string)$this->result['Errors'][0]."}");
766
+ }
767
+ else{
768
+ $result['CustomerEmail'] = $this->CustomerEmail;
769
+ $result['CustomerName'] = $this->BillingFirstnames.' '.$this->BillingSurname;
770
+ $result['CardType'] = $this->CardType;
771
+ $result['CardHolderName'] = $this->CardHolder;
772
+ $result['CustomerContact'] = $this->BillingPhone;
773
+ $result['TxType'] = $this->TxType;
774
+ $result['VendorTxCode'] = $this->VendorTxCode;
775
+ }
776
+ return $result;
777
+ }
778
+
779
+ protected function _addTransaction(Mage_Sales_Model_Order_Payment $payment, $transactionId, $transactionType,
780
+ array $transactionDetails = array(), $message = false ) {
781
+
782
+ $payment->setTransactionId($transactionId);
783
+ $payment->resetTransactionAdditionalInfo();
784
+ foreach ($transactionDetails as $key => $value) {
785
+ $payment->setData($key, $value);
786
+ }
787
+
788
+ $transaction = $payment->addTransaction($transactionType, null, false , $message);
789
+ foreach ($transactionDetails as $key => $value) {
790
+ $payment->unsetData($key);
791
+ }
792
+ $payment->unsLastTransId();
793
+
794
+ $transaction->setMessage($message);
795
+
796
+ return $transaction;
797
+ }
798
+
799
+ public function getConfigModel(){
800
+ return Mage::getSingleton('sagepay/config');
801
+ }
802
+
803
+ public function getSagepayModel(){
804
+ return Mage::getSingleton('sagepay/sagepay');
805
+ }
806
+
807
+ public function getTransactionModel(){
808
+ return Mage::getSingleton('sagepay/transaction');
809
+ }
810
+
811
+ }
812
+ ?>
app/code/community/Raveinfosys/Sagepay/Model/Sagepay.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Model_Sagepay extends Mage_Core_Model_Abstract {
4
+
5
+ public function _construct(){
6
+
7
+ parent::_construct();
8
+ $this->_init('sagepay/sagepay');
9
+ }
10
+
11
+ public function saveOrderDetail($result,$order_id){
12
+ $data['order_id'] = $order_id;
13
+ $data['vps_tx_id'] = $result['VPSTxId'];
14
+ $data['vendor_tx_code'] = $result['VendorTxCode'];
15
+ $data['security_key'] = $result['SecurityKey'];
16
+ $data['tx_auth_no'] = $result['TxAuthNo'];
17
+ $data['order_status'] = $result['StatusDetail'];
18
+ $data['threed_auth'] = $result['3DSecureStatus'];
19
+ $data['payment_type'] = 1;
20
+ $data['authorised'] = 1;
21
+ $data['customer_email'] = $result['CustomerEmail'];
22
+ $model = Mage::getModel('sagepay/sagepay');
23
+ $model->setData($data)
24
+ ->save();
25
+ return $model->getId();
26
+
27
+ }
28
+
29
+ public function saveCardDetail($id,$data){
30
+ $model = Mage::getModel('sagepay/sagepay')->load($id);
31
+ $model->setCustomerName($data['CustomerName'])
32
+ ->setCardType($data['CardType'])
33
+ ->setCardHolderName($data['CardHolderName'])
34
+ ->setCustomerContact($data['CustomerContact'])
35
+ ->save();
36
+
37
+ }
38
+
39
+ public function saveAuthDetail($result,$order_id){
40
+ $data['order_id'] = $order_id;
41
+ $data['vps_tx_id'] = $result['VPSTxId'];
42
+ $data['vendor_tx_code'] = $result['VendorTxCode'];
43
+ $data['security_key'] = $result['SecurityKey'];
44
+ if($result['TxAuthNo'])
45
+ $data['tx_auth_no'] = $result['TxAuthNo'];
46
+ else
47
+ $data['tx_auth_no'] = '0';
48
+ $data['order_status'] = $result['StatusDetail'];
49
+ $data['threed_auth'] = $result['3DSecureStatus'];
50
+ $data['payment_type'] = 2;
51
+ $data['customer_email'] = $result['CustomerEmail'];
52
+ $model = Mage::getModel('sagepay/sagepay');
53
+ $model->setData($data)
54
+ ->save();
55
+ return $model->getId();
56
+
57
+ }
58
+
59
+ public function saveAuthorisedDetail($result,$vendor_tx_code,$parent_data,$order_id){
60
+
61
+ $parent_model = Mage::getModel('sagepay/sagepay')->load($parent_data->getSagepayId());
62
+ $parent_model->setAuthorised(1)
63
+ ->save()->unsetData();
64
+
65
+ $data['order_id'] = $order_id;
66
+ $data['parent_id'] = $parent_data->getSagepayId();
67
+ $data['vps_tx_id'] = $result['VPSTxId'];
68
+ $data['vendor_tx_code'] = $vendor_tx_code;
69
+ $data['security_key'] = $result['SecurityKey'];
70
+ $data['tx_auth_no'] = $result['TxAuthNo'];
71
+ $data['order_status'] = $result['StatusDetail'];
72
+ $data['threed_auth'] = $result['3DSecureStatus'];
73
+ $data['authorised'] = 1;
74
+ $data['customer_email'] = $parent_data->getCustomerEmail();
75
+ $data['customer_name'] = $parent_data->getCustomerName();
76
+ $data['card_type'] = $parent_data->getCardType();
77
+ $data['card_holder_name'] = $parent_data->getCardHolderName();
78
+ $data['customer_contact'] = $parent_data->getCustomerContact();
79
+
80
+ $model = Mage::getModel('sagepay/sagepay');
81
+ $model->setData($data)
82
+ ->save();
83
+
84
+ return $model->getId();
85
+
86
+ }
87
+
88
+ public function saveRefundDetail($result,$id){
89
+ $model = Mage::getModel('sagepay/sagepay')->load($id);
90
+ $model->setIsRefund(1)
91
+ ->setRefundStatus($result['StatusDetail'])
92
+ ->save();
93
+ }
94
+
95
+ public function saveVoidDetail($result,$id){
96
+ $model = Mage::getModel('sagepay/sagepay')->load($id);
97
+ $model->setIsVoid(1)
98
+ ->setVoidStatus($result['StatusDetail'])
99
+ ->save();
100
+ }
101
+
102
+ public function canVoid($order){
103
+ $data = $this->getCollection()->addFieldToFilter('order_id',$order->getIncrementId())->getFirstItem();
104
+ if($data->getPaymentType()==2 && $data->getIsVoid()!=1 && $data->getAuthorised() !=1)
105
+ return true;
106
+ else
107
+ return false;
108
+ }
109
+
110
+ public function logTransaction($data){
111
+ if(Mage::getStoreConfig('payment/sagepay/debug')){
112
+ if($data["request"]["CardNumber"]!=''){
113
+ $data["request"]["CardNumber"] = '****';
114
+ $data["request"]["IssueNumber"] = '****';
115
+ $data["request"]["CV2"] = '****';
116
+ $data["request"]["CardType"] = '****';
117
+ $data["request"]["CardHolder"] = '****';
118
+ }
119
+ $data["request"]["Vendor"] = '****';
120
+ Mage::log($data, null, 'raveinfosys_sagepay.log',1);
121
+ }
122
+ }
123
+
124
+
125
+ }
126
+ ?>
app/code/community/Raveinfosys/Sagepay/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('sagepay')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('sagepay')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/community/Raveinfosys/Sagepay/Model/System/Config/Source/Dropdown/Values.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Model_System_Config_Source_Dropdown_Values
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array(
9
+ 'value' => 'simulator',
10
+ 'label' => 'Simulator',
11
+ ),
12
+ array(
13
+ 'value' => 'test',
14
+ 'label' => 'Test',
15
+ ),
16
+ array(
17
+ 'value' => 'live',
18
+ 'label' => 'Live',
19
+ ),
20
+ );
21
+ }
22
+ }
app/code/community/Raveinfosys/Sagepay/Model/Transaction.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Model_Transaction extends Mage_Core_Model_Abstract {
4
+
5
+ public function _construct(){
6
+
7
+ parent::_construct();
8
+ $this->_init('sagepay/transaction');
9
+ }
10
+
11
+ public function saveTransactionDetail($order_id ,$result, $vendor_tx_code, $mode, $sagepay_id)
12
+ {
13
+ $transaction_detail = array();
14
+ $card_detail = Mage::getModel('sagepay/sagepay')->load($sagepay_id);
15
+ $transaction_detail['order_id'] = $order_id;
16
+ $transaction_detail['vendor_tx_code'] = $vendor_tx_code;
17
+ $transaction_detail['vps_tx_id'] = $result['VPSTxId'];
18
+ $transaction_detail['security_key'] = $result['SecurityKey'];
19
+ $transaction_detail['tx_auth_no'] = $result['TxAuthNo'];
20
+ $transaction_detail['order_status'] = $result['Status'];
21
+ $transaction_detail['customer_name'] = $card_detail['customer_name'];
22
+ $transaction_detail['customer_email'] = $card_detail['customer_email'];
23
+ $transaction_detail['customer_contact'] = $card_detail['customer_contact'];
24
+ $transaction_detail['card_holder_name'] = $card_detail['card_holder_name'];
25
+ $transaction_detail['card_type'] = $card_detail['card_type'];
26
+ $transaction_detail['mode'] = $mode;
27
+ $transaction_detail['threed_secure'] = $result['3DSecureStatus'];
28
+ $this->setData($transaction_detail)->save();
29
+ }
30
+
31
+
32
+
33
+ }
34
+ ?>
app/code/community/Raveinfosys/Sagepay/controllers/Adminhtml/SagepayController.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Sagepay_Adminhtml_SagepayController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('sagepay/items')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+
20
+ public function deleteAction() {
21
+ if( $this->getRequest()->getParam('id') > 0 ) {
22
+ try {
23
+ $model = Mage::getModel('sagepay/sagepay');
24
+
25
+ $model->setId($this->getRequest()->getParam('id'))
26
+ ->delete();
27
+
28
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
29
+ $this->_redirect('*/*/');
30
+ } catch (Exception $e) {
31
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
32
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
33
+ }
34
+ }
35
+ $this->_redirect('*/*/');
36
+ }
37
+
38
+ public function massDeleteAction() {
39
+ $sagepayIds = $this->getRequest()->getParam('sagepay');
40
+ if(!is_array($sagepayIds)) {
41
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
42
+ } else {
43
+ try {
44
+ foreach ($sagepayIds as $sagepayId) {
45
+ $sagepay = Mage::getModel('sagepay/transaction')->load($sagepayId);
46
+ $sagepay->delete();
47
+ }
48
+ Mage::getSingleton('adminhtml/session')->addSuccess(
49
+ Mage::helper('adminhtml')->__(
50
+ 'Total of %d record(s) were successfully deleted', count($sagepayIds)
51
+ )
52
+ );
53
+ } catch (Exception $e) {
54
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
55
+ }
56
+ }
57
+ $this->_redirect('*/*/index');
58
+ }
59
+
60
+
61
+ public function exportCsvAction()
62
+ {
63
+ $fileName = 'sagepay.csv';
64
+ $content = $this->getLayout()->createBlock('sagepay/adminhtml_sagepay_grid')
65
+ ->getCsv();
66
+
67
+ $this->_sendUploadResponse($fileName, $content);
68
+ }
69
+
70
+ public function exportXmlAction()
71
+ {
72
+ $fileName = 'sagepay.xml';
73
+ $content = $this->getLayout()->createBlock('sagepay/adminhtml_sagepay_grid')
74
+ ->getXml();
75
+
76
+ $this->_sendUploadResponse($fileName, $content);
77
+ }
78
+
79
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
80
+ {
81
+ $response = $this->getResponse();
82
+ $response->setHeader('HTTP/1.1 200 OK','');
83
+ $response->setHeader('Pragma', 'public', true);
84
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
85
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
86
+ $response->setHeader('Last-Modified', date('r'));
87
+ $response->setHeader('Accept-Ranges', 'bytes');
88
+ $response->setHeader('Content-Length', strlen($content));
89
+ $response->setHeader('Content-type', $contentType);
90
+ $response->setBody($content);
91
+ $response->sendResponse();
92
+ die;
93
+ }
94
+ }
app/code/community/Raveinfosys/Sagepay/controllers/Checkout/OnepageController.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'Mage/Checkout/controllers/OnepageController.php';
3
+ class Raveinfosys_Sagepay_Checkout_OnepageController extends Mage_Checkout_OnepageController
4
+ {
5
+
6
+ public function threedsecureAction(){
7
+ if ($this->_expireAjax()) {
8
+ return;
9
+ }
10
+
11
+ $result = array();
12
+ try {
13
+ if ($requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds()) {
14
+ $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
15
+ if ($diff = array_diff($requiredAgreements, $postedAgreements)) {
16
+ $result['success'] = false;
17
+ $result['error'] = true;
18
+ $result['error_messages'] = $this->__('Please agree to all the terms and conditions before placing the order.');
19
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
20
+ return;
21
+ }
22
+ }
23
+ if ($data = $this->getRequest()->getPost('payment', false)) {
24
+ $this->getOnepage()->getQuote()->getPayment()->importData($data);
25
+ }
26
+ $gateway_result = Mage::getModel('sagepay/payment')->registerTransaction($data);
27
+ $session = Mage::getSingleton('core/session');
28
+ $session->setGatewayResult($gateway_result)->setPaymentdata($data);
29
+ if($gateway_result['Status'] == '3DAUTH' && $gateway_result["PAReq"]!='' && $gateway_result["MD"]!=''){
30
+ $redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
31
+ $url = Mage::getUrl('checkout/onepage/sagepay3dCheck');
32
+ Mage::register('url',$url);
33
+
34
+ if (!isset($result['error'])) {
35
+ $result['goto_section'] = 'threedsecure';
36
+ $html = Mage::app()->getLayout()->createBlock('checkout/onepage')->setTemplate('sagepay/checkout/3dredirect.phtml')->toHtml();
37
+ $result['update_section'] = array(
38
+ 'name' => 'threedsecure',
39
+ 'html' => $html
40
+ #'html' => "<script>alert('hello');window.open('".$url."','mypopup','status=1,width=500,height=500,scrollbars=1');</script>"
41
+ );
42
+
43
+ }
44
+ }
45
+ elseif(in_array($gateway_result['Status'],Mage::getSingleton('sagepay/config')->getExpectedSuccess())) {
46
+ $this->_forward('saveOrder');
47
+ }
48
+
49
+ } catch (Exception $e) {
50
+ Mage::logException($e);
51
+ $result['success'] = false;
52
+ $result['error'] = true;
53
+ $result['error_messages'] = $e->getMessage();
54
+ }
55
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
56
+ }
57
+
58
+ public function sagepay3dcheckAction(){
59
+
60
+ $this->loadLayout();
61
+ $block = $this->getLayout()->createBlock('Mage_Core_Block_Template','sagepay_3d_form',array('template' => 'sagepay/sagepay.phtml'));
62
+ $this->getLayout()->getBlock('content')->append($block);
63
+ $this->renderLayout();
64
+
65
+ }
66
+
67
+ public function threedsuccessAction(){
68
+ $this->loadLayout();
69
+ try {
70
+ $result = Mage::getModel('sagepay/payment')->complete3d($_POST);
71
+ if (in_array($result['Status'],Mage::getSingleton('sagepay/config')->getExpectedSuccess())) {
72
+ $session = Mage::getSingleton('core/session');
73
+ $session->setGatewayResult($result);
74
+ Mage::register('status',1);
75
+ Mage::register('url',Mage::getUrl('checkout/onepage/savesagepayorder'));
76
+ }
77
+ } catch (Exception $e) {
78
+ Mage::logException($e);
79
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
80
+ $result['success'] = false;
81
+ $result['error'] = true;
82
+ $result['error_messages'] = $this->__('There was an error processing your order. Please contact us or try again later.');
83
+ }
84
+
85
+ $this->renderLayout();
86
+
87
+ }
88
+
89
+ public function saveSagePayOrderAction(){
90
+ try {
91
+ $session = Mage::getSingleton('core/session');
92
+ if ($data = $session->getPaymentdata()) {
93
+ $this->getOnepage()->getQuote()->getPayment()->importData($data);
94
+ }
95
+ $this->getOnepage()->saveOrder();
96
+ $this->getOnepage()->getQuote()->save();
97
+ } catch (Exception $e) {
98
+ Mage::logException($e);
99
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
100
+
101
+ }
102
+ $this->_redirect('checkout/onepage/success');
103
+
104
+ }
105
+
106
+
107
+ }
app/code/community/Raveinfosys/Sagepay/etc/config.xml ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * which is available through the world-wide-web at this URL:
8
+ * http://opensource.org/licenses/osl-3.0.php
9
+ * If you are unable to obtain it through the world-wide-web,
10
+ * please send an email to magento@raveinfosys.com
11
+ * so we can send you a copy immediately.
12
+ *
13
+ * @category Raveinfosys
14
+ * @package Raveinfosys_Sagepay
15
+ * @author RaveInfosys, Inc.
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Raveinfosys_Sagepay>
22
+ <version>0.1.0</version>
23
+ </Raveinfosys_Sagepay>
24
+ </modules>
25
+ <frontend>
26
+
27
+ <routers>
28
+
29
+ <checkout>
30
+ <args>
31
+ <modules>
32
+ <Raveinfosys_Sagepay before="Mage_Checkout">Raveinfosys_Sagepay_Checkout</Raveinfosys_Sagepay>
33
+ </modules>
34
+ </args>
35
+ </checkout>
36
+ </routers>
37
+ <layout>
38
+ <updates>
39
+ <sagepay>
40
+ <file>sagepay.xml</file>
41
+ </sagepay>
42
+ </updates>
43
+ </layout>
44
+
45
+ <events>
46
+ <payment_method_is_active>
47
+ <observers>
48
+ <sagepay>
49
+ <type>singleton</type>
50
+ <class>Raveinfosys_Sagepay_Model_Observer</class>
51
+ <method>disableMethod</method>
52
+ </sagepay>
53
+ </observers>
54
+ </payment_method_is_active>
55
+ <core_layout_update_updates_get_after>
56
+ <observers>
57
+ <sagepay_core_layout_update_updates_get_after>
58
+ <type>singleton</type>
59
+ <class>Raveinfosys_Sagepay_Model_Observer</class>
60
+ <method>layoutUpdate</method>
61
+ </sagepay_core_layout_update_updates_get_after>
62
+ </observers>
63
+ </core_layout_update_updates_get_after>
64
+ </events>
65
+ </frontend>
66
+ <admin>
67
+ <routers>
68
+ <sagepay>
69
+ <use>admin</use>
70
+ <args>
71
+ <module>Raveinfosys_Sagepay</module>
72
+ <frontName>sagepay</frontName>
73
+ </args>
74
+ </sagepay>
75
+ </routers>
76
+ </admin>
77
+ <adminhtml>
78
+ <menu>
79
+ <sagepay module="sagepay">
80
+ <title>Sagepay</title>
81
+ <sort_order>71</sort_order>
82
+ <children>
83
+ <items module="sagepay">
84
+ <title>Transaction Details</title>
85
+ <sort_order>0</sort_order>
86
+ <action>sagepay/adminhtml_sagepay</action>
87
+ </items>
88
+ </children>
89
+ </sagepay>
90
+ </menu>
91
+ <acl>
92
+ <resources>
93
+ <all>
94
+ <title>Allow Everything</title>
95
+ </all>
96
+ <admin>
97
+ <children>
98
+ <Raveinfosys_Sagepay>
99
+ <title>Sagepay Module</title>
100
+ <sort_order>10</sort_order>
101
+ </Raveinfosys_Sagepay>
102
+ </children>
103
+ </admin>
104
+ </resources>
105
+ </acl>
106
+ <layout>
107
+ <updates>
108
+ <sagepay>
109
+ <file>sagepay.xml</file>
110
+ </sagepay>
111
+ </updates>
112
+ </layout>
113
+ </adminhtml>
114
+ <global>
115
+ <models>
116
+
117
+ <sagepay>
118
+ <class>Raveinfosys_Sagepay_Model</class>
119
+ <resourceModel>sagepay_mysql4</resourceModel>
120
+ </sagepay>
121
+ <sagepay_mysql4>
122
+ <class>Raveinfosys_Sagepay_Model_Mysql4</class>
123
+ <entities>
124
+ <sagepay>
125
+ <table>sagepay</table>
126
+ </sagepay>
127
+ <transaction>
128
+ <table>sagepay_transaction_detail</table>
129
+ </transaction>
130
+ </entities>
131
+ </sagepay_mysql4>
132
+ </models>
133
+ <resources>
134
+ <sagepay_setup>
135
+ <setup>
136
+ <module>Raveinfosys_Sagepay</module>
137
+ </setup>
138
+ <connection>
139
+ <use>core_setup</use>
140
+ </connection>
141
+ </sagepay_setup>
142
+ <sagepay_write>
143
+ <connection>
144
+ <use>core_write</use>
145
+ </connection>
146
+ </sagepay_write>
147
+ <sagepay_read>
148
+ <connection>
149
+ <use>core_read</use>
150
+ </connection>
151
+ </sagepay_read>
152
+ </resources>
153
+ <blocks>
154
+ <sagepay>
155
+ <class>Raveinfosys_Sagepay_Block</class>
156
+ </sagepay>
157
+
158
+ </blocks>
159
+ <helpers>
160
+ <sagepay>
161
+ <class>Raveinfosys_Sagepay_Helper</class>
162
+ </sagepay>
163
+ </helpers>
164
+
165
+ <events>
166
+ <!-- START Adds the Admin theme switcher, enables to avoid modify admin themes -->
167
+ <adminhtml_controller_action_predispatch_start>
168
+ <observers>
169
+ <raveinfosys_themeoverride_observer>
170
+ <type>singleton</type>
171
+ <class>Raveinfosys_Sagepay_Controller_Observer</class>
172
+ <method>overrideTheme</method>
173
+ </raveinfosys_themeoverride_observer>
174
+ </observers>
175
+ </adminhtml_controller_action_predispatch_start>
176
+ <!-- END Adds the Admin theme switcher, enables to avoid modify admin themes -->
177
+ </events>
178
+
179
+ </global>
180
+ <default>
181
+ <payment>
182
+ <sagepay>
183
+ <active>0</active>
184
+ <title>SagePay Payment Gateway</title>
185
+ <order_status>pending</order_status>
186
+ <cctypes>AE,VI,MC</cctypes>
187
+ <useccv>1</useccv>
188
+ <allowspecific>0</allowspecific>
189
+ <test>1</test>
190
+ <payment_action>authorize_capture</payment_action>
191
+ <model>sagepay/payment</model>
192
+ </sagepay>
193
+ </payment>
194
+ </default>
195
+ </config>
app/code/community/Raveinfosys/Sagepay/etc/system.xml ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * which is available through the world-wide-web at this URL:
8
+ * http://opensource.org/licenses/osl-3.0.php
9
+ * If you are unable to obtain it through the world-wide-web,
10
+ * please send an email to magento@raveinfosys.com
11
+ * so we can send you a copy immediately.
12
+ *
13
+ * @category Raveinfosys
14
+ * @package Raveinfosys_Sagepay
15
+ * @author RaveInfosys, Inc.
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ -->
19
+ <config>
20
+ <sections>
21
+ <payment>
22
+ <groups>
23
+ <sagepay translate="label">
24
+ <label>SagePay Payment Gateway</label>
25
+ <frontend_type>text</frontend_type>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ <fields>
30
+ <active translate="label">
31
+ <label>Enabled</label>
32
+ <frontend_type>select</frontend_type>
33
+ <source_model>adminhtml/system_config_source_yesno</source_model>
34
+ <sort_order>1</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>0</show_in_store>
38
+ </active>
39
+ <title translate="label">
40
+ <label>Title</label>
41
+ <frontend_type>text</frontend_type>
42
+ <sort_order>3</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </title>
47
+ <order_status translate="label">
48
+ <label>New Order Status</label>
49
+ <frontend_type>select</frontend_type>
50
+ <source_model>adminhtml/system_config_source_order_status_newprocessing</source_model>
51
+ <sort_order>4</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>0</show_in_store>
55
+ </order_status>
56
+ <vendor_name translate="label">
57
+ <label>Vendor</label>
58
+ <frontend_type>text</frontend_type>
59
+ <sort_order>5</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>0</show_in_store>
63
+ </vendor_name>
64
+ <payment_action translate="label">
65
+ <label>Payment Action</label>
66
+ <frontend_type>select</frontend_type>
67
+ <source_model>paygate/authorizenet_source_paymentAction</source_model>
68
+ <sort_order>2</sort_order>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>0</show_in_store>
72
+ </payment_action>
73
+ <cctypes translate="label">
74
+ <label>Credit Card Types</label>
75
+ <frontend_type>multiselect</frontend_type>
76
+ <source_model>adminhtml/system_config_source_payment_cctype</source_model>
77
+ <sort_order>5</sort_order>
78
+ <show_in_default>1</show_in_default>
79
+ <show_in_website>1</show_in_website>
80
+ <show_in_store>0</show_in_store>
81
+ <can_be_empty>1</can_be_empty>
82
+ </cctypes>
83
+ <useccv translate="label">
84
+ <label>Request Card Security Code</label>
85
+ <frontend_type>select</frontend_type>
86
+ <source_model>adminhtml/system_config_source_yesno</source_model>
87
+ <sort_order>6</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>0</show_in_store>
91
+ </useccv>
92
+ <allowspecific translate="label">
93
+ <label>Payment from Applicable Countries</label>
94
+ <frontend_type>allowspecific</frontend_type>
95
+ <sort_order>50</sort_order>
96
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>0</show_in_store>
100
+ </allowspecific>
101
+ <specificcountry translate="label">
102
+ <label>Payment from Specific Countries</label>
103
+ <frontend_type>multiselect</frontend_type>
104
+ <sort_order>51</sort_order>
105
+ <source_model>adminhtml/system_config_source_country</source_model>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>1</show_in_website>
108
+ <show_in_store>0</show_in_store>
109
+ <can_be_empty>1</can_be_empty>
110
+ </specificcountry>
111
+ <min_order_total translate="label">
112
+ <label>Minimum Order Total</label>
113
+ <frontend_type>text</frontend_type>
114
+ <sort_order>98</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>0</show_in_store>
118
+ </min_order_total>
119
+ <max_order_total translate="label">
120
+ <label>Maximum Order Total</label>
121
+ <frontend_type>text</frontend_type>
122
+ <sort_order>99</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>0</show_in_store>
126
+ </max_order_total>
127
+ <debug translate="label">
128
+ <label>Debug</label>
129
+ <frontend_type>select</frontend_type>
130
+ <source_model>adminhtml/system_config_source_yesno</source_model>
131
+ <sort_order>55</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>0</show_in_store>
135
+ </debug>
136
+ <mode translate="label">
137
+ <label>Payment Mode</label>
138
+ <frontend_type>select</frontend_type>
139
+ <source_model>sagepay/system_config_source_dropdown_values</source_model>
140
+ <sort_order>60</sort_order>
141
+ <show_in_default>1</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <show_in_store>0</show_in_store>
144
+ </mode>
145
+
146
+ <sort_order translate="label">
147
+ <label>Sort Order</label>
148
+ <frontend_type>text</frontend_type>
149
+ <sort_order>100</sort_order>
150
+ <show_in_default>1</show_in_default>
151
+ <show_in_website>1</show_in_website>
152
+ <show_in_store>0</show_in_store>
153
+ </sort_order>
154
+ </fields>
155
+ </sagepay>
156
+ </groups>
157
+ </payment>
158
+ </sections>
159
+ </config>
app/code/community/Raveinfosys/Sagepay/sql/sagepay_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ -- DROP TABLE IF EXISTS {$this->getTable('sagepay')};
10
+ CREATE TABLE {$this->getTable('sagepay')} (
11
+ `sagepay_id` int(11) NOT NULL auto_increment,
12
+ `parent_id` int(11),
13
+ `order_id` int(11) NOT NULL default 0,
14
+ `vps_tx_id` varchar(200) NOT NULL default '',
15
+ `vendor_tx_code` varchar(200) NOT NULL default '',
16
+ `security_key` varchar(200) NOT NULL default '',
17
+ `threed_auth` varchar(200) NOT NULL default '',
18
+ `tx_auth_no` varchar(200) NOT NULL default 0,
19
+ `order_status` text NOT NULL default '',
20
+ `payment_type` int(2) NOT NULL default 0,
21
+ `authorised` int(2) NOT NULL default 0,
22
+ `is_refund` int(2) NOT NULL default 0,
23
+ `refund_status` text NOT NULL default '',
24
+ `is_void` int(2) NOT NULL default 0,
25
+ `void_status` text NOT NULL default '',
26
+ `customer_name` varchar(200) NOT NULL default '',
27
+ `customer_email` varchar(200) NOT NULL default '',
28
+ `card_type` varchar(200) NOT NULL default '',
29
+ `cv2` varchar(50) NOT NULL default '',
30
+ `card_holder_name` varchar(200) NOT NULL default '',
31
+ `customer_contact` varchar(200) NOT NULL default '',
32
+ PRIMARY KEY (`sagepay_id`)
33
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
34
+
35
+ -- DROP TABLE IF EXISTS {$this->getTable('sagepay_transaction_detail')};
36
+ CREATE TABLE {$this->getTable('sagepay_transaction_detail')} (
37
+ `transaction_id` int(11) NOT NULL auto_increment,
38
+ `sagepay_id` int(11) NOT NULL default 0,
39
+ `order_id` int(11) NOT NULL default 0,
40
+ `vps_tx_id` varchar(200) NOT NULL default '',
41
+ `vendor_tx_code` varchar(200) NOT NULL default '',
42
+ `security_key` varchar(200) NOT NULL default '',
43
+ `order_status` text NOT NULL default '',
44
+ `customer_name` varchar(200) NOT NULL default '',
45
+ `customer_email` varchar(200) NOT NULL default '',
46
+ `card_type` varchar(200) NOT NULL default '',
47
+ `mode` varchar(50) NOT NULL default '',
48
+ `card_holder_name` varchar(200) NOT NULL default '',
49
+ `threed_secure` varchar(50) NOT NULL default '',
50
+ PRIMARY KEY (`transaction_id`)
51
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
52
+ ");
53
+
54
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/sagepay.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <sagepay_adminhtml_sagepay_index>
4
+ <reference name="content">
5
+ <block type="sagepay/adminhtml_sagepay" name="sagepay" />
6
+ </reference>
7
+ </sagepay_adminhtml_sagepay_index>
8
+ </layout>
app/design/adminhtml/default/sagepay/template/sales/order/view/tab/info.phtml ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php /** @var $this Mage_Adminhtml_Block_Sales_Order_View_Tab_Info */ ?>
28
+ <?php $_order = $this->getOrder() ?>
29
+ <?php $sagepay_detail = Mage::getModel('sagepay/sagepay')->getCollection()->addFieldToFilter('order_id',$_order->getIncrementId())->getFirstItem();?>
30
+ <div>
31
+ <div id="order-messages">
32
+ <?php echo $this->getChildHtml('order_messages') ?>
33
+ </div>
34
+ <?php echo $this->getChildHtml('order_info') ?>
35
+ <input type="hidden" name="order_id" value="<?php echo $_order->getId() ?>"/>
36
+ <?php if ($_order->getIsVirtual()): ?>
37
+ <div class="box-right">
38
+ <?php else: ?>
39
+ <div class="box-left">
40
+ <?php endif; ?>
41
+ <!--Payment Method-->
42
+ <div class="entry-edit">
43
+ <div class="entry-edit-head">
44
+ <h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
45
+ </div>
46
+ <fieldset>
47
+ <?php echo $this->getPaymentHtml() ?>
48
+ <div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
49
+ <?php if($sagepay_detail->getData()):?>
50
+ <br/>
51
+ <ul style="border:1px solid #ccc;margin-bottom:10px;padding:10px;">
52
+ <li><strong>Vendor TX Code</strong>: <?php echo $sagepay_detail->getData('vendor_tx_code');?></li>
53
+ <li><strong>VPSTxId</strong>: <?php echo $sagepay_detail->getData('vps_tx_id');?></li>
54
+ <?php if($threed = $sagepay_detail->getData('threed_auth')):?>
55
+ <li><strong>3D Status</strong>: <?php echo $threed;?></li>
56
+ <?php endif;?>
57
+ </ul>
58
+ <?php endif;?>
59
+ </fieldset>
60
+ </div>
61
+ </div>
62
+ <?php if (!$_order->getIsVirtual()): ?>
63
+ <div class="box-right">
64
+ <!--Shipping Method-->
65
+ <div class="entry-edit">
66
+ <div class="entry-edit-head">
67
+ <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping &amp; Handling Information') ?></h4>
68
+ </div>
69
+ <fieldset>
70
+ <?php if ($_order->getTracksCollection()->count()) : ?>
71
+ <a href="#" id="linkId" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_order) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')" title="<?php echo $this->__('Track Order') ?>"><?php echo $this->__('Track Order') ?></a>
72
+ <br/>
73
+ <?php endif; ?>
74
+ <?php if ($_order->getShippingDescription()): ?>
75
+ <strong><?php echo $this->escapeHtml($_order->getShippingDescription()) ?></strong>
76
+
77
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
78
+ <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
79
+ <?php else: ?>
80
+ <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
81
+ <?php endif; ?>
82
+ <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
83
+
84
+ <?php echo $_excl; ?>
85
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
86
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
87
+ <?php endif; ?>
88
+ <?php else: ?>
89
+ <?php echo $this->helper('sales')->__('No shipping information available'); ?>
90
+ <?php endif; ?>
91
+ </fieldset>
92
+ </div>
93
+ </div>
94
+ <?php endif; ?>
95
+ <div class="clear"></div>
96
+ <?php echo $this->getGiftOptionsHtml() ?>
97
+ <div class="clear"></div>
98
+ <div class="entry-edit">
99
+ <div class="entry-edit-head">
100
+ <h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items Ordered') ?></h4>
101
+ </div>
102
+ </div>
103
+ <?php echo $this->getItemsHtml() ?>
104
+ <div class="clear"></div>
105
+
106
+ <div class="box-left">
107
+ <div class="entry-edit">
108
+ <div class="entry-edit-head">
109
+ <h4><?php echo Mage::helper('sales')->__('Comments History') ?></h4>
110
+ </div>
111
+ <fieldset><?php echo $this->getChildHtml('order_history') ?></fieldset>
112
+ </div>
113
+ </div>
114
+ <div class="box-right entry-edit">
115
+ <div class="entry-edit-head"><h4><?php echo Mage::helper('sales')->__('Order Totals') ?></h4></div>
116
+ <div class="order-totals"><?php echo $this->getChildHtml('order_totals') ?></div>
117
+ </div>
118
+ <div class="clear"></div>
119
+ </div>
120
+
121
+ <?php echo $this->getChildHtml('popup_window');?>
122
+ <script type="text/javascript">
123
+ //<![CDATA[
124
+ /**
125
+ * Retrieve gift options tooltip content
126
+ */
127
+ function getGiftOptionsTooltipContent(itemId) {
128
+ var contentLines = [];
129
+ var headerLine = null;
130
+ var contentLine = null;
131
+
132
+ $$('#gift_options_data_' + itemId + ' .gift-options-tooltip-content').each(function (element) {
133
+ if (element.down(0)) {
134
+ headerLine = element.down(0).innerHTML;
135
+ contentLine = element.down(0).next().innerHTML;
136
+ if (contentLine.length > 30) {
137
+ contentLine = contentLine.slice(0,30) + '...';
138
+ }
139
+ contentLines.push(headerLine + ' ' + contentLine);
140
+ }
141
+ });
142
+ return contentLines.join('<br/>');
143
+ }
144
+ giftOptionsTooltip.setTooltipContentLoaderFunction(getGiftOptionsTooltipContent);
145
+ //]]>
146
+ </script>
app/design/frontend/base/default/layout/sagepay.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <sagepay_index_index>
6
+ <reference name="content">
7
+ <block type="sagepay/sagepay" name="sagepay" template="sagepay/sagepay.phtml" />
8
+ </reference>
9
+ </sagepay_index_index>
10
+
11
+ <checkout_onepage_sagepay3dcheck>
12
+ <remove name="top.links"/>
13
+ <remove name="top.menu"/>
14
+ <remove name="top.search"/>
15
+ <reference name="content">
16
+ <block type="sagepay/sagepay" name="sagepay_3d_form" template="sagepay/sagepay.phtml" />
17
+ </reference>
18
+
19
+ </checkout_onepage_sagepay3dcheck>
20
+
21
+ <checkout_onepage_threedsuccess>
22
+ <remove name="top.links"/>
23
+ <remove name="top.menu"/>
24
+ <remove name="top.search"/>
25
+ <reference name="content">
26
+ <block type="sagepay/sagepay" name="sagepay_success" template="sagepay/threedsuccess.phtml" />
27
+ </reference>
28
+
29
+ </checkout_onepage_threedsuccess>
30
+ </layout>
app/design/frontend/base/default/layout/sagepay_checkout2.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+
4
+ <checkout_onepage_review>
5
+ <reference name="root">
6
+ <action method="setTemplate">
7
+ <template>sagepay/checkout/review/info.phtml</template>
8
+ </action>
9
+ </reference>
10
+ </checkout_onepage_review>
11
+
12
+ <checkout_onepage_threedsuccess>
13
+
14
+ <reference name="root">
15
+ <action method="setTemplate">
16
+ <template>sagepay/threedsuccess.phtml</template>
17
+ </action>
18
+ </reference>
19
+
20
+ </checkout_onepage_threedsuccess>
21
+
22
+ </layout>
app/design/frontend/base/default/template/sagepay/checkout/3dredirect.phtml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ <style>
4
+ #threedIframe {
5
+ width:100%;
6
+ height:100%;
7
+ opacity:.95;
8
+ top:0;
9
+ left:0;
10
+ display:none;
11
+ position:fixed;
12
+ background-color:#313131;
13
+ overflow:auto
14
+ }
15
+
16
+ div#popupContact {
17
+ position:absolute;
18
+ left:40%;
19
+ top:13%;
20
+ margin-left:-202px;
21
+ font-family:'Raleway',sans-serif
22
+ }
23
+
24
+ </style>
25
+ <!-- Body Starts Here -->
26
+
27
+ <body id="body" style="overflow:hidden;">
28
+ <div id="threedIframe">
29
+ <!-- Popup Div Starts Here -->
30
+ <div id="popupContact">
31
+ <!-- Contact Us Form -->
32
+ <iframe id="sagepaydirectpro-iframe-post" src="<?php echo Mage::registry('url'); ?>" width='700' , height='500'></iframe>
33
+ </div>
34
+ <!-- Popup Div Ends Here -->
35
+ </div>
36
+
37
+ <!-- Body Ends Here -->
38
+
39
+ <script>
40
+ //Function To Display Popup
41
+ function div_show() {
42
+ document.getElementById('threedIframe').style.display = "block";
43
+ }
44
+ //Function to Hide Popup
45
+ function div_hide(){
46
+ document.getElementById('threedIframe').style.display = "none";
47
+ }
48
+
49
+ div_show();
50
+ </script>
app/design/frontend/base/default/template/sagepay/checkout/review/info.phtml ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php echo $this->getChildHtml('items_before'); ?>
28
+ <div id="checkout-review-table-wrapper">
29
+ <table class="data-table" id="checkout-review-table">
30
+ <?php if ($this->helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?>
31
+ <col />
32
+ <col width="1" />
33
+ <col width="1" />
34
+ <col width="1" />
35
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
36
+ <col width="1" />
37
+ <col width="1" />
38
+ <?php endif; ?>
39
+ <thead>
40
+ <tr>
41
+ <th rowspan="<?php echo $rowspan ?>"><?php echo $this->__('Product Name') ?></th>
42
+ <th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Price') ?></th>
43
+ <th rowspan="<?php echo $rowspan ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
44
+ <th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Subtotal') ?></th>
45
+ </tr>
46
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
47
+ <tr>
48
+ <th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
49
+ <th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
50
+ <th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
51
+ <th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
52
+ </tr>
53
+ <?php endif; ?>
54
+ </thead>
55
+ <?php echo $this->getChildHtml('totals'); ?>
56
+ <tbody>
57
+ <?php foreach($this->getItems() as $_item): ?>
58
+ <?php echo $this->getItemHtml($_item)?>
59
+ <?php endforeach ?>
60
+ </tbody>
61
+ </table>
62
+ </div>
63
+ <?php echo $this->getChildHtml('items_after'); ?>
64
+ <script type="text/javascript">
65
+ //<![CDATA[
66
+ decorateTable('checkout-review-table');
67
+ truncateOptions();
68
+ //]]>
69
+ </script>
70
+ <div id="checkout-review-submit">
71
+ <?php echo $this->getChildHtml('agreements') ?>
72
+ <div class="buttons-set" id="review-buttons-container">
73
+ <p class="f-left"><?php echo $this->__('Forgot an Item?') ?> <a href="<?php echo $this->getUrl('checkout/cart') ?>"><?php echo $this->__('Edit Your Cart') ?></a></p>
74
+ <?php echo $this->getChildHtml('button') ?>
75
+ <span class="please-wait" id="review-please-wait" style="display:none;">
76
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Submitting order information...') ?>" title="<?php echo $this->__('Submitting order information...') ?>" class="v-middle" /> <?php echo $this->__('Submitting order information...') ?>
77
+ </span>
78
+ </div>
79
+ <script type="text/javascript">
80
+ //<![CDATA[
81
+ review = new Review('<?php echo $this->getUrl('checkout/onepage/threedsecure', array('form_key' => Mage::getSingleton('core/session')->getFormKey())) ?>', '<?php echo $this->getUrl('checkout/onepage/success') ?>', $('checkout-agreements'));
82
+ //]]>
83
+ </script>
84
+ </div>
85
+
86
+ <div id="checkout-threedsecure-load"></div>
87
+
88
+ <script language="javascript" type="text/javascript">
89
+ <!--
90
+ function popitup(url) {alert('aaa');
91
+ newwindow=window.open(url,'name','height=500,width=550');
92
+ if (window.focus) {newwindow.focus()}
93
+ return false;
94
+ }
95
+
96
+ // -->
97
+ </script>
98
+
99
+
app/design/frontend/base/default/template/sagepay/sagepay.phtml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $session = Mage::getSingleton('core/session');
2
+ $data = $session->getGatewayResult();?>
3
+
4
+ <form name="form" action="<?php echo $data['ACSURL'];?>" method="POST">
5
+ <input type="hidden" name="PaReq" value="<?php echo $data['PAReq'];?>" />
6
+ <input type="hidden" name="TermUrl" value="<?php echo Mage::getUrl('checkout/onepage/threedSuccess');?>?VendorTxCode='<?php echo $data['VendorTxCode'];?>'" />
7
+ <input type="hidden" name="MD" value="<?php echo $data['MD'];?>" />
8
+ <input type="submit" value="Proceed to 3D secure authentication" />
9
+ </form>
10
+ <script type="text/javascript">document.form.submit();</script>
11
+
app/design/frontend/base/default/template/sagepay/threedsuccess.phtml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <script>
3
+
4
+ <?php if(Mage::registry('status')!=1):?>
5
+ alert('ERROR. Direct 3D-Secure transaction from Simulator');
6
+ parent.document.getElementById('threedIframe').style.display = "none";
7
+
8
+ <?php else:?>
9
+ parent.document.getElementById('threedIframe').style.display = "none";
10
+ parent.window.location.href = "<?php echo Mage::registry('url');?>";
11
+ <?php endif;?>
12
+ </script>
13
+
app/etc/modules/Raveinfosys_Sagepay.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Raveinfosys_Sagepay>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Raveinfosys_Sagepay>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Raveinfosys_Sagepay</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Sagepay Payment Gateway Extension.</summary>
10
+ <description>Sagepay Payment Gateway Extension.</description>
11
+ <notes>Sagepay Payment Gateway Extension.</notes>
12
+ <authors><author><name>Raveinfosys</name><user>raveinfo</user><email>magento@raveinfosys.com</email></author></authors>
13
+ <date>2015-01-20</date>
14
+ <time>14:11:31</time>
15
+ <contents><target name="magecommunity"><dir name="Raveinfosys"><dir name="Sagepay"><dir name="Block"><dir name="Adminhtml"><dir name="Sagepay"><file name="Grid.php" hash="0db3367183d7a7fe8cae22603d554109"/></dir><file name="Sagepay.php" hash="388092e2215094c2b4290c2ef665451b"/></dir></dir><dir name="Controller"><file name="Observer.php" hash="a8f23ad01b720298539da718bd411579"/></dir><dir name="Helper"><file name="Data.php" hash="82d35f0afe82ce647662b580d280d42b"/></dir><dir name="Model"><file name="Config.php" hash="c3f8ce937d1861c8f516cb6584a07045"/><dir name="Mysql4"><dir name="Sagepay"><file name="Collection.php" hash="a34bc048d96c80c5aefad7611c814889"/></dir><file name="Sagepay.php" hash="4543355ccce2bb8416ae1b54710a5b1b"/><dir name="Transaction"><file name="Collection.php" hash="f254735999990aff4feb7f8f8c7894d5"/></dir><file name="Transaction.php" hash="6c2c64d04a006c8758f7f6a308678cd2"/></dir><file name="Observer.php" hash="aaea8b89460d22512d2a404119eb7448"/><file name="Payment.php" hash="7335959594e4937f4ce66ef3313683f4"/><file name="Sagepay.php" hash="b4fc9d2512d0f3380791a3bd30a32a7e"/><file name="Status.php" hash="efe219eb960f30999b6cc34714e02e4b"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Dropdown"><file name="Values.php" hash="c9ee28285f0c4e25edb61d26e350c425"/></dir></dir></dir></dir><file name="Transaction.php" hash="6de8d7dbcd024fa40cdbf945cd179fca"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SagepayController.php" hash="b929dc68f87b61a8f83831cf4b326aac"/></dir><dir name="Checkout"><file name="OnepageController.php" hash="497f7e4dfc9c7247f21c9918353b71a9"/></dir></dir><dir name="etc"><file name="config.xml" hash="f3065d6578a6fb1c3bcf8f3612fc6c12"/><file name="system.xml" hash="4f6cb32581acbf3d8741e2b15a6afe54"/></dir><dir name="sql"><dir name="sagepay_setup"><file name="mysql4-install-0.1.0.php" hash="c8b85994156863722912f98595ce8466"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="sagepay.xml" hash="1353d5cfbf553b1b8898c21650156f2b"/><file name="sagepay_checkout2.xml" hash="b71174f80025cd269f6e78d5899d3310"/></dir><dir name="template"><dir name="sagepay"><dir name="checkout"><file name="3dredirect.phtml" hash="bc7dbec38d65fb797d41d09e814338ab"/><dir name="review"><file name="info.phtml" hash="3589f7035de266a0215b21c429add040"/></dir></dir><file name="sagepay.phtml" hash="a58ed0d6297e62b457035fb51c7a4955"/><file name="threedsuccess.phtml" hash="83347f1b11211582fe8daa5fcd3dd5df"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="sagepay.xml" hash="befac7554e8892b1e06d5b1d68fae32e"/></dir></dir><dir name="sagepay"><dir name="template"><dir name="sales"><dir name="order"><dir name="view"><dir name="tab"><file name="info.phtml" hash="2a503acd3054293d7259440435d40eaf"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Raveinfosys_Sagepay.xml" hash="e5cad5273f64c357723fbb14be5e12ee"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.0.0</min><max>5.6.3</max></php></required></dependencies>
18
+ </package>