Litle_Payments - Version 8.13.0

Version Notes

This extension implements Litle XML version 8.13

Additional features include enhanced reporting on orders, transactions, and customers.

Download this release

Release Info

Developer Litle
Extension Litle_Payments
Version 8.13.0
Comparing to
See all releases


Code changes from version 8.10.2 to 8.13.0

Files changed (44) hide show
  1. app/code/local/Litle/CreditCard/Block/Adminhtml/Ordergrid.php +14 -0
  2. app/code/local/Litle/CreditCard/Block/Adminhtml/Orderview.php +103 -0
  3. app/code/local/Litle/CreditCard/Block/Form/CreditCard.php +178 -0
  4. app/code/local/Litle/CreditCard/Helper/Data.php +66 -0
  5. app/code/local/Litle/CreditCard/Model/Cctypes.php +43 -0
  6. app/code/local/Litle/CreditCard/Model/Lpayment.php +452 -0
  7. app/code/local/Litle/CreditCard/Model/Order/Payment.php +166 -0
  8. app/code/local/Litle/CreditCard/Model/PaymentLogic.php +378 -55
  9. app/code/local/Litle/CreditCard/Model/ValidateMerchantId.php +31 -0
  10. app/code/local/Litle/CreditCard/Model/Validatehttp.php +11 -1
  11. app/code/local/Litle/CreditCard/controllers/Adminhtml/OrderController.php +47 -0
  12. app/code/local/Litle/CreditCard/etc/config.xml +71 -16
  13. app/code/local/Litle/CreditCard/etc/system.xml +37 -10
  14. app/code/local/Litle/LEcheck/Model/PaymentLogic.php +56 -29
  15. app/code/local/Litle/LEcheck/etc/config.xml +1 -1
  16. app/code/local/Litle/LEcheck/etc/system.xml +1 -59
  17. app/code/local/Litle/LitleSDK/Checker.php +1 -1
  18. app/code/local/Litle/LitleSDK/LitleOnline.php +2 -1
  19. app/code/local/Litle/LitleSDK/LitleOnlineRequest.php +28 -7
  20. app/code/local/Litle/LitleSDK/Obj2xml.php +22 -8
  21. app/code/local/Litle/LitleSDK/Setup.php +5 -21
  22. app/code/local/Litle/LitleSDK/UrlMapper.php +42 -0
  23. app/code/local/Litle/LitleSDK/XmlFields.php +34 -6
  24. app/code/local/Litle/Palorus/Block/Adminhtml/Palorus/Insight/Tab.php +190 -0
  25. app/code/local/Litle/Palorus/Block/Adminhtml/Transaction.php +104 -0
  26. app/code/local/Litle/Palorus/Helper/Data.php +128 -0
  27. app/code/local/Litle/Palorus/Model/Insight.php +13 -0
  28. app/code/local/Litle/Palorus/Model/Mysql4/Insight.php +9 -0
  29. app/code/local/Litle/Palorus/Model/Mysql4/Insight/Collection.php +11 -0
  30. app/code/local/Litle/Palorus/Model/Mysql4/Vault.php +9 -0
  31. app/code/local/Litle/Palorus/Model/Mysql4/Vault/Collection.php +11 -0
  32. app/code/local/Litle/Palorus/Model/Vault.php +13 -0
  33. app/code/local/Litle/Palorus/controllers/Adminhtml/MyformController.php +77 -0
  34. app/code/local/Litle/Palorus/etc/config.xml +190 -0
  35. app/code/local/Litle/Palorus/sql/palorus_setup/mysql4-install-8.13.0.php +47 -0
  36. app/design/adminhtml/default/default/layout/litle.xml +19 -0
  37. app/design/adminhtml/default/default/template/payment/form/litlecc.phtml +138 -0
  38. app/design/adminhtml/default/default/template/payment/form/litleecheck.phtml +35 -0
  39. app/design/frontend/base/default/layout/litlecreditcard.xml +7 -0
  40. app/design/frontend/base/default/template/payment/form/litlecc.phtml +254 -0
  41. app/design/frontend/base/default/template/payment/form/litlejs.phtml +9 -0
  42. app/design/frontend/default/default/template/payment/form/litlecc.phtml +254 -0
  43. app/etc/modules/Litle_All.xml +7 -0
  44. package.xml +6 -7
app/code/local/Litle/CreditCard/Block/Adminhtml/Ordergrid.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_CreditCard_Block_Adminhtml_Ordergrid extends Mage_Adminhtml_Block_Sales_Order_Grid {
4
+
5
+ protected function _prepareMassaction()
6
+ {
7
+ parent::_prepareMassaction();
8
+
9
+ $this->getMassactionBlock()->addItem('Capture', array(
10
+ 'label' => Mage::helper('sales')->__('Capture'),
11
+ 'url' => $this->getUrl('creditcard/adminhtml_order/massCapture')
12
+ ));
13
+ }
14
+ }
app/code/local/Litle/CreditCard/Block/Adminhtml/Orderview.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Plieninger Editable Module
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-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
+ *
22
+ * @category Plieninger
23
+ * @package Plieninger_Editable
24
+ * @copyright Copyright (c) 2009 Andreas Plieninger
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
26
+ * @author Andreas Plieninger <aplieninger@gmx.de> www.plieninger.org
27
+ * @version 0.1.0
28
+ * @date 18.12.2009
29
+ */
30
+
31
+
32
+ class Litle_CreditCard_Block_Adminhtml_Orderview extends Mage_Adminhtml_Block_Sales_Order_View {
33
+
34
+ public function __construct() {
35
+ parent::__construct();
36
+
37
+
38
+ $order = $this->getOrder();
39
+ if(Mage::helper("creditcard")->isMOPLitle($order->getPayment()))
40
+ {
41
+ // check if Auth-Reversal needs to be shown
42
+ if( Mage::helper("creditcard")->isStateOfOrderEqualTo($order, Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH) &&
43
+ !(Mage::helper("creditcard")->isMOPLitleECheck($order->getPayment()->getData('method')))
44
+ )
45
+ {
46
+ $message = 'Are you sure you want to reverse the authorization?';
47
+ $this->_updateButton('void_payment', 'label','Auth-Reversal');
48
+ $this->_updateButton('void_payment', 'onclick', "confirmSetLocation('{$message}', '{$this->getVoidPaymentUrl()}')");
49
+ }
50
+ // check if Void-Refund needs to be shown
51
+ else if( Mage::helper("creditcard")->isStateOfOrderEqualTo($order, Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND))
52
+ {
53
+ $onclickJs = 'deleteConfirm(\''
54
+ . Mage::helper('sales')->__('Are you sure? The refund request will be canceled.')
55
+ . '\', \'' . $this->getVoidPaymentUrl() . '\');';
56
+
57
+ $this->_addButton('void_refund', array(
58
+ 'label' => 'Void Refund',
59
+ 'onclick' => $onclickJs,
60
+ ));
61
+ }
62
+ //check if void capture or void sale needs to be shown
63
+ else if(Mage::helper("creditcard")->isStateOfOrderEqualTo($order, Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE) &&
64
+ $this->wasLastTxnLessThan48HrsAgo($order->getPayment()))
65
+ {
66
+ $mop = $order->getPayment()->getData('method');
67
+ //check if paying with a credit card
68
+ if(Mage::helper("creditcard")->isMOPLitleCC($mop)){
69
+ $onclickJs = 'deleteConfirm(\''
70
+ . Mage::helper('sales')->__('Are you sure? If any previous partial captures were done on this order, or if capture was not done today then do a refund instead.')
71
+ . '\', \'' . $this->getVoidPaymentUrl() . '\');';
72
+
73
+ $this->_addButton('void_capture', array(
74
+ 'label' => 'Void Capture',
75
+ 'onclick' => $onclickJs,
76
+ ));
77
+ }
78
+ //check if paying with Litle echeck
79
+ elseif(Mage::helper("creditcard")->isMOPLitleECheck($mop)){
80
+ $onclickJs = 'deleteConfirm(\''
81
+ . Mage::helper('sales')->__('Are you sure? If any previous partial captures were done on this order, or if capture was not done today then do a refund instead.')
82
+ . '\', \'' . $this->getVoidPaymentUrl() . '\');';
83
+
84
+ $this->_addButton('void_sale', array(
85
+ 'label' => 'Void Sale',
86
+ 'onclick' => $onclickJs,
87
+ ));
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ public function wasLastTxnLessThan48HrsAgo(Varien_Object $payment)
94
+ {
95
+ $lastTxnId = $payment->getLastTransId();
96
+ $lastTxn = $payment->getTransaction($lastTxnId);
97
+ $timeOfLastTxn = $lastTxn->getData('created_at');
98
+
99
+ //check if last txn was less than 48 hrs ago (172800 seconds == 48 hrs)
100
+ return ((time()-strtotime($timeOfLastTxn)) < 172800);
101
+ }
102
+
103
+ }
app/code/local/Litle/CreditCard/Block/Form/CreditCard.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-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 Mage
22
+ * @package Mage_Payment
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ class Litle_CreditCard_Block_Form_CreditCard extends Mage_Payment_Block_Form
29
+ {
30
+ protected function _construct()
31
+ {
32
+ parent::_construct();
33
+ $this->setTemplate('payment/form/litlecc.phtml');
34
+ }
35
+
36
+ /**
37
+ * Retrieve payment configuration object
38
+ *
39
+ * @return Mage_Payment_Model_Config
40
+ */
41
+ protected function _getConfig()
42
+ {
43
+ return Mage::getSingleton('payment/config');
44
+ }
45
+
46
+ public function getCurrency()
47
+ {
48
+ return Mage::app()->getStore()->getCurrentCurrencyCode();
49
+ }
50
+
51
+ public function getMerchantIdMap()
52
+ {
53
+ return Mage::getStoreConfig('payment/CreditCard/merchant_id');
54
+ }
55
+
56
+ public function getReportGroup()
57
+ {
58
+ $string2Eval = 'return array' . $this->getMerchantIdMap() . ";";
59
+ $merchant_map = eval($string2Eval);
60
+ $reportGroup = $merchant_map[$this->getCurrency()];
61
+ return $reportGroup;
62
+ }
63
+
64
+ /**
65
+ * Retrieve availables credit card types
66
+ *
67
+ * @return array
68
+ */
69
+ public function getCcAvailableTypes()
70
+ {
71
+ $types = $this->_getConfig()->getCcTypes();
72
+ if ($method = $this->getMethod()) {
73
+ $availableTypes = $method->getConfigData('cctypes');
74
+ if ($availableTypes) {
75
+ $availableTypes = explode(',', $availableTypes);
76
+ foreach ($types as $code=>$name) {
77
+ if (!in_array($code, $availableTypes)) {
78
+ unset($types[$code]);
79
+ }
80
+ }
81
+ }
82
+ }
83
+ return $types;
84
+ }
85
+
86
+ /**
87
+ * Retrieve credit card expire months
88
+ *
89
+ * @return array
90
+ */
91
+ public function getCcMonths()
92
+ {
93
+ $months = $this->getData('cc_months');
94
+ if (is_null($months)) {
95
+ $months[0] = $this->__('Month');
96
+ $months = array_merge($months, $this->_getConfig()->getMonths());
97
+ $this->setData('cc_months', $months);
98
+ }
99
+ return $months;
100
+ }
101
+
102
+ /**
103
+ * Retrieve credit card expire years
104
+ *
105
+ * @return array
106
+ */
107
+ public function getCcYears()
108
+ {
109
+ $years = $this->getData('cc_years');
110
+ if (is_null($years)) {
111
+ $years = $this->_getConfig()->getYears();
112
+ $years = array(0=>$this->__('Year'))+$years;
113
+ $this->setData('cc_years', $years);
114
+ }
115
+ return $years;
116
+ }
117
+
118
+ /**
119
+ * Retrive has verification configuration
120
+ *
121
+ * @return boolean
122
+ */
123
+ public function hasVerification()
124
+ {
125
+ if ($this->getMethod()) {
126
+ $configData = $this->getMethod()->getConfigData('useccv');
127
+ if(is_null($configData)){
128
+ return true;
129
+ }
130
+ return (bool) $configData;
131
+ }
132
+ return true;
133
+ }
134
+
135
+ /*
136
+ * Whether switch/solo card type available
137
+ */
138
+ public function hasSsCardType()
139
+ {
140
+ $availableTypes = explode(',', $this->getMethod()->getConfigData('cctypes'));
141
+ $ssPresenations = array_intersect(array('SS', 'SM', 'SO'), $availableTypes);
142
+ if ($availableTypes && count($ssPresenations) > 0) {
143
+ return true;
144
+ }
145
+ return false;
146
+ }
147
+
148
+ /*
149
+ * solo/switch card start year
150
+ * @return array
151
+ */
152
+ public function getSsStartYears()
153
+ {
154
+ $years = array();
155
+ $first = date("Y");
156
+
157
+ for ($index=5; $index>=0; $index--) {
158
+ $year = $first - $index;
159
+ $years[$year] = $year;
160
+ }
161
+ $years = array(0=>$this->__('Year'))+$years;
162
+ return $years;
163
+ }
164
+
165
+ /**
166
+ * Render block HTML
167
+ *
168
+ * @return string
169
+ */
170
+ protected function _toHtml()
171
+ {
172
+ Mage::dispatchEvent('payment_form_block_to_html_before', array(
173
+ 'block' => $this
174
+ ));
175
+ return parent::_toHtml();
176
+ }
177
+ }
178
+
app/code/local/Litle/CreditCard/Helper/Data.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Litle_CreditCard_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ public function isStateOfOrderEqualTo($order, $inOrderState){
5
+ $payment = $order->getPayment();
6
+ $lastTxnId = $payment->getLastTransId();
7
+ $lastTxn = $payment->getTransaction($lastTxnId);
8
+
9
+ if( $lastTxn->getTxnType() === $inOrderState )
10
+ return true;
11
+ else
12
+ return false;
13
+ }
14
+
15
+ // TODO:: Needs to be implemented.
16
+ public function isMOPLitleCC($mop){
17
+ return ($mop === "creditcard");
18
+ }
19
+
20
+ // TODO:: Needs to be implemented.
21
+ public function isMOPLitleECheck($mop){
22
+ return ($mop === "lecheck");
23
+ }
24
+
25
+ public function isMOPLitle($payment){
26
+ $mop = $payment->getData('method');
27
+ return ($this->isMOPLitleCC($mop) || $this->isMOPLitleECheck($mop));
28
+ }
29
+
30
+ public function uniqueCreditCard($customerId) {
31
+ $collection = array();
32
+ $collection = Mage::getModel('palorus/vault')
33
+ ->getCollection()
34
+ ->addFieldToFilter('customer_id',$customerId);
35
+
36
+ $purchases = array();
37
+ $unique = array();
38
+ $i=0;
39
+ foreach ($collection as $purchase) {
40
+ $purchases[$i] = $purchase->getData();
41
+ $i++;
42
+ }
43
+
44
+ return $this->populateStoredCreditCard($purchases);
45
+ }
46
+
47
+ public function populateStoredCreditCard($purchases) {
48
+
49
+ $unique = array();
50
+ $unique[0] = $purchases[0];
51
+ for ($y=1; $y < count($purchases); $y++){
52
+ $setter = 0;
53
+ for ($x=0; $x <= count($unique); $x++){
54
+ if (($purchases[$y]['type'] === $unique[$x]['type']) && ($purchases[$y]['last4'] === $unique[$x]['last4']))
55
+ {
56
+ $setter = 1;
57
+ }
58
+ }
59
+ if ($setter === 0)
60
+ {
61
+ array_push($unique, $purchases[$y]);
62
+ }
63
+ }
64
+ return $unique;
65
+ }
66
+ }
app/code/local/Litle/CreditCard/Model/Cctypes.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-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 Mage
22
+ * @package Mage_Paygate
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Authorizenet Payment CC Types Source Model
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Paygate
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Litle_CreditCard_Model_Cctypes extends Mage_Payment_Model_Source_Cctype
35
+ {
36
+ public function getAllowedTypes()
37
+ {
38
+ return array('AE','MC','DI','JCB','DC','VI');
39
+ }
40
+
41
+
42
+
43
+ }
app/code/local/Litle/CreditCard/Model/Lpayment.php ADDED
@@ -0,0 +1,452 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_CreditCard_Model_Lpayment extends Mage_Sales_Model_Order_Payment
4
+ {
5
+
6
+ /**
7
+ * Cancel specified invoice: update self totals from it
8
+ *
9
+ * @param Mage_Sales_Model_Order_Invoice $invoice
10
+ * @return Mage_Sales_Model_Order_Payment
11
+ */
12
+ public function cancelInvoice($invoice)
13
+ {
14
+ $this->_updateTotals(array(
15
+ 'amount_paid' => -1 * $invoice->getGrandTotal(),
16
+ 'base_amount_paid' => -1 * $invoice->getBaseGrandTotal(),
17
+ 'shipping_captured' => -1 * $invoice->getShippingAmount(),
18
+ 'base_shipping_captured' => -1 * $invoice->getBaseShippingAmount(),
19
+ ));
20
+ Mage::dispatchEvent('sales_order_payment_cancel_invoice', array('payment' => $this, 'invoice' => $invoice));
21
+ return $this;
22
+ }
23
+
24
+ /**
25
+ * Void payment online
26
+ *
27
+ * @see self::_void()
28
+ * @param Varien_Object $document
29
+ * @return Mage_Sales_Model_Order_Payment
30
+ */
31
+ public function void(Varien_Object $document)
32
+ {
33
+ $this->_void(true);
34
+ Mage::dispatchEvent('sales_order_payment_void', array('payment' => $this, 'invoice' => $document));
35
+ return $this;
36
+ }
37
+
38
+ /**
39
+ * Cancel a creditmemo: substract its totals from the payment
40
+ *
41
+ * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
42
+ * @return Mage_Sales_Model_Order_Payment
43
+ */
44
+ public function cancelCreditmemo($creditmemo)
45
+ {
46
+ $this->_updateTotals(array(
47
+ 'amount_refunded' => -1 * $creditmemo->getGrandTotal(),
48
+ 'base_amount_refunded' => -1 * $creditmemo->getBaseGrandTotal(),
49
+ 'shipping_refunded' => -1 * $creditmemo->getShippingAmount(),
50
+ 'base_shipping_refunded' => -1 * $creditmemo->getBaseShippingAmount()
51
+ ));
52
+ Mage::dispatchEvent('sales_order_payment_cancel_creditmemo',
53
+ array('payment' => $this, 'creditmemo' => $creditmemo)
54
+ );
55
+ return $this;
56
+ }
57
+
58
+ /**
59
+ * Order cancellation hook for payment method instance
60
+ * Adds void transaction if needed
61
+ * @return Mage_Sales_Model_Order_Payment
62
+ */
63
+ public function cancel()
64
+ {
65
+ $isOnline = true;
66
+ if (!$this->canVoid(new Varien_Object())) {
67
+ $isOnline = false;
68
+ }
69
+
70
+ if (!$this->hasMessage()) {
71
+ $this->setMessage($isOnline ? Mage::helper('sales')->__('Canceled order online.')
72
+ : Mage::helper('sales')->__('Canceled order offline.')
73
+ );
74
+ }
75
+
76
+ if ($isOnline) {
77
+ $this->_void($isOnline, null, 'cancel');
78
+ }
79
+
80
+ Mage::dispatchEvent('sales_order_payment_cancel', array('payment' => $this));
81
+
82
+ return $this;
83
+ }
84
+
85
+ /**
86
+ * Authorize payment either online or offline (process auth notification)
87
+ * Updates transactions hierarchy, if required
88
+ * Prevents transaction double processing
89
+ * Updates payment totals, updates order status and adds proper comments
90
+ *
91
+ * @param bool $isOnline
92
+ * @param float $amount
93
+ * @return Mage_Sales_Model_Order_Payment
94
+ */
95
+ protected function _authorize($isOnline, $amount)
96
+ {
97
+ // update totals
98
+ $amount = $this->_formatAmount($amount, true);
99
+ $this->setBaseAmountAuthorized($amount);
100
+
101
+ // do authorization
102
+ $order = $this->getOrder();
103
+ $state = Mage_Sales_Model_Order::STATE_PROCESSING;
104
+ $status = true;
105
+ if ($isOnline) {
106
+ // invoke authorization on gateway
107
+ $this->getMethodInstance()->setStore($order->getStoreId())->authorize($this, $amount);
108
+ } else {
109
+ $message = Mage::helper('sales')->__(
110
+ 'Registered notification about authorized amount of %s.',
111
+ $this->_formatPrice($amount)
112
+ );
113
+ }
114
+
115
+ // similar logic of "payment review" order as in capturing
116
+ if ($this->getIsTransactionPending()) {
117
+ $message = Mage::helper('sales')->__('Authorizing amount of %s is pending approval on gateway.', $this->_formatPrice($amount));
118
+ $state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
119
+ if ($this->getIsFraudDetected()) {
120
+ $status = Mage_Sales_Model_Order::STATUS_FRAUD;
121
+ }
122
+ } else {
123
+ $message = Mage::helper('sales')->__('Authorized amount of %s.', $this->_formatPrice($amount));
124
+ }
125
+
126
+ // update transactions, order state and add comments
127
+ $transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
128
+ if ($order->isNominal()) {
129
+ $message = $this->_prependMessage(Mage::helper('sales')->__('Nominal order registered.'));
130
+ } else {
131
+ $message = $this->_prependMessage($message);
132
+ $message = $this->_appendTransactionToMessage($transaction, $message);
133
+ }
134
+ $order->setState($state, $status, $message);
135
+
136
+ return $this;
137
+ }
138
+
139
+ /**
140
+ * Public access to _authorize method
141
+ * @param bool $isOnline
142
+ * @param float $amount
143
+ */
144
+ public function authorize($isOnline, $amount)
145
+ {
146
+ return $this->_authorize($isOnline, $amount);
147
+ }
148
+
149
+ /**
150
+ * Void payment either online or offline (process void notification)
151
+ * NOTE: that in some cases authorization can be voided after a capture. In such case it makes sense to use
152
+ * the amount void amount, for informational purposes.
153
+ * Updates payment totals, updates order status and adds proper comments
154
+ *
155
+ * @param bool $isOnline
156
+ * @param float $amount
157
+ * @param string $gatewayCallback
158
+ * @return Mage_Sales_Model_Order_Payment
159
+ */
160
+ protected function _void($isOnline, $amount = null, $gatewayCallback = 'void')
161
+ {
162
+ $order = $this->getOrder();
163
+ $authTransaction = $this->getAuthorizationTransaction();
164
+ $this->_generateTransactionId(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID, $authTransaction);
165
+ $this->setShouldCloseParentTransaction(true);
166
+
167
+ // attempt to void
168
+ if ($isOnline) {
169
+ $this->getMethodInstance()->setStore($order->getStoreId())->$gatewayCallback($this);
170
+ }
171
+ if ($this->_isTransactionExists()) {
172
+ return $this;
173
+ }
174
+
175
+ // if the authorization was untouched, we may assume voided amount = order grand total
176
+ // but only if the payment auth amount equals to order grand total
177
+ if ($authTransaction && ($order->getBaseGrandTotal() == $this->getBaseAmountAuthorized())
178
+ && (0 == $this->getBaseAmountCanceled())) {
179
+ if ($authTransaction->canVoidAuthorizationCompletely()) {
180
+ $amount = (float)$order->getBaseGrandTotal();
181
+ }
182
+ }
183
+
184
+ if ($amount) {
185
+ $amount = $this->_formatAmount($amount);
186
+ }
187
+
188
+ // update transactions, order state and add comments
189
+ $transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID, null, true);
190
+ if(true) //if voided transaction was a refund
191
+ $message = $this->hasMessage() ? $this->getMessage() : Mage::helper('sales')->__('Voided refund.');
192
+ else //if voided transaction was an auth
193
+ $message = $this->hasMessage() ? $this->getMessage() : Mage::helper('sales')->__('Voided authorization.');
194
+ $message = $this->_prependMessage($message);
195
+ if ($amount) {
196
+ $message .= ' ' . Mage::helper('sales')->__('Amount: %s.', $this->_formatPrice($amount));
197
+ }
198
+ $message = $this->_appendTransactionToMessage($transaction, $message);
199
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $message);
200
+ return $this;
201
+ }
202
+
203
+ // /**
204
+ // * TODO: implement this
205
+ // * @param Mage_Sales_Model_Order_Invoice $invoice
206
+ // * @return Mage_Sales_Model_Order_Payment
207
+ // */
208
+ // public function cancelCapture($invoice = null)
209
+ // {
210
+ // }
211
+
212
+ /**
213
+ * Create transaction,
214
+ * prepare its insertion into hierarchy and add its information to payment and comments
215
+ *
216
+ * To add transactions and related information,
217
+ * the following information should be set to payment before processing:
218
+ * - transaction_id
219
+ * - is_transaction_closed (optional) - whether transaction should be closed or open (closed by default)
220
+ * - parent_transaction_id (optional)
221
+ * - should_close_parent_transaction (optional) - whether to close parent transaction (closed by default)
222
+ *
223
+ * If the sales document is specified, it will be linked to the transaction as related for future usage.
224
+ * Currently transaction ID is set into the sales object
225
+ * This method writes the added transaction ID into last_trans_id field of the payment object
226
+ *
227
+ * To make sure transaction object won't cause trouble before saving, use $failsafe = true
228
+ *
229
+ * @param string $type
230
+ * @param Mage_Sales_Model_Abstract $salesDocument
231
+ * @param bool $failsafe
232
+ * @return null|Mage_Sales_Model_Order_Payment_Transaction
233
+ */
234
+ protected function _addTransaction($type, $salesDocument = null, $failsafe = false)
235
+ {
236
+ if ($this->getSkipTransactionCreation()) {
237
+ $this->unsTransactionId();
238
+ return null;
239
+ }
240
+
241
+ // look for set transaction ids
242
+ $transactionId = $this->getTransactionId();
243
+ if (null !== $transactionId) {
244
+ // set transaction parameters
245
+ $transaction = false;
246
+ if ($this->getOrder()->getId()) {
247
+ $transaction = $this->_lookupTransaction($transactionId);
248
+ }
249
+ if (!$transaction) {
250
+ $transaction = Mage::getModel('sales/order_payment_transaction')->setTxnId($transactionId);
251
+ }
252
+ $transaction
253
+ ->setOrderPaymentObject($this)
254
+ ->setTxnType($type)
255
+ ->isFailsafe($failsafe);
256
+
257
+ if ($this->hasIsTransactionClosed()) {
258
+ $transaction->setIsClosed((int)$this->getIsTransactionClosed());
259
+ }
260
+
261
+ //set transaction addition information
262
+ if ($this->_transactionAdditionalInfo) {
263
+ foreach ($this->_transactionAdditionalInfo as $key => $value) {
264
+ $transaction->setAdditionalInformation($key, $value);
265
+ }
266
+ }
267
+
268
+ // link with sales entities
269
+ $this->setLastTransId($transactionId);
270
+ $this->setCreatedTransaction($transaction);
271
+ $this->getOrder()->addRelatedObject($transaction);
272
+ if ($salesDocument && $salesDocument instanceof Mage_Sales_Model_Abstract) {
273
+ $salesDocument->setTransactionId($transactionId);
274
+ // TODO: linking transaction with the sales document
275
+ }
276
+
277
+ // link with parent transaction
278
+ $parentTransactionId = $this->getParentTransactionId();
279
+
280
+ if ($parentTransactionId) {
281
+ $transaction->setParentTxnId($parentTransactionId);
282
+ if ($this->getShouldCloseParentTransaction()) {
283
+ $parentTransaction = $this->_lookupTransaction($parentTransactionId);
284
+ if ($parentTransaction) {
285
+ if (!$parentTransaction->getIsClosed()) {
286
+ $parentTransaction->isFailsafe($failsafe)->close(false);
287
+ }
288
+ $this->getOrder()->addRelatedObject($parentTransaction);
289
+ }
290
+ }
291
+ }
292
+ return $transaction;
293
+ }
294
+ }
295
+
296
+ /**
297
+ * Public acces to _addTransaction method
298
+ *
299
+ * @param string $type
300
+ * @param Mage_Sales_Model_Abstract $salesDocument
301
+ * @param bool $failsafe
302
+ * @param string $message
303
+ * @return null|Mage_Sales_Model_Order_Payment_Transaction
304
+ */
305
+ public function addTransaction($type, $salesDocument = null, $failsafe = false, $message = false)
306
+ {
307
+ $transaction = $this->_addTransaction($type, $salesDocument, $failsafe);
308
+
309
+ if ($message) {
310
+ $order = $this->getOrder();
311
+ $message = $this->_appendTransactionToMessage($transaction, $message);
312
+ $order->addStatusHistoryComment($message);
313
+ }
314
+
315
+ return $transaction;
316
+ }
317
+
318
+ /**
319
+ * Import details data of specified transaction
320
+ *
321
+ * @param Mage_Sales_Model_Order_Payment_Transaction $transactionTo
322
+ * @return Mage_Sales_Model_Order_Payment
323
+ */
324
+ public function importTransactionInfo(Mage_Sales_Model_Order_Payment_Transaction $transactionTo)
325
+ {
326
+ $data = $this->getMethodInstance()
327
+ ->setStore($this->getOrder()->getStoreId())
328
+ ->fetchTransactionInfo($this, $transactionTo->getTxnId());
329
+ if ($data) {
330
+ $transactionTo->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $data);
331
+ }
332
+ return $this;
333
+ }
334
+
335
+
336
+ /**
337
+ * Append transaction ID (if any) message to the specified message
338
+ *
339
+ * @param Mage_Sales_Model_Order_Payment_Transaction|null $transaction
340
+ * @param string $message
341
+ * @return string
342
+ */
343
+ protected function _appendTransactionToMessage($transaction, $message)
344
+ {
345
+ if ($transaction) {
346
+ $txnId = is_object($transaction) ? $transaction->getTxnId() : $transaction;
347
+ $message .= ' ' . Mage::helper('sales')->__('Transaction ID: "%s".', $txnId);
348
+ }
349
+ return $message;
350
+ }
351
+
352
+ /**
353
+ * Lookup an authorization transaction using parent transaction id, if set
354
+ * @return Mage_Sales_Model_Order_Payment_Transaction|false
355
+ */
356
+ public function getAuthorizationTransaction()
357
+ {
358
+ if ($this->getParentTransactionId()) {
359
+ $txn = $this->_lookupTransaction($this->getParentTransactionId());
360
+ } else {
361
+ $txn = false;
362
+ }
363
+
364
+ if (!$txn) {
365
+ $txn = $this->_lookupTransaction(false, Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
366
+ }
367
+ return $txn;
368
+ }
369
+
370
+ /**
371
+ * Update transaction ids for further processing
372
+ * If no transactions were set before invoking, may generate an "offline" transaction id
373
+ *
374
+ * @param string $type
375
+ * @param Mage_Sales_Model_Order_Payment_Transaction $transactionBasedOn
376
+ */
377
+ protected function _generateTransactionId($type, $transactionBasedOn = false)
378
+ {
379
+ if (!$this->getParentTransactionId() && !$this->getTransactionId() && $transactionBasedOn) {
380
+ $this->setParentTransactionId($transactionBasedOn->getTxnId());
381
+ }
382
+ // generate transaction id for an offline action or payment method that didn't set it
383
+ if (($parentTxnId = $this->getParentTransactionId()) && !$this->getTransactionId()) {
384
+ $this->setTransactionId("{$parentTxnId}-{$type}");
385
+ }
386
+ }
387
+
388
+ /**
389
+ * Additionnal transaction info setter
390
+ *
391
+ * @param sting $key
392
+ * @param string $value
393
+ */
394
+ public function setTransactionAdditionalInfo($key, $value)
395
+ {
396
+ if (is_array($key)) {
397
+ $this->_transactionAdditionalInfo = $key;
398
+ } else {
399
+ $this->_transactionAdditionalInfo[$key] = $value;
400
+ }
401
+ }
402
+
403
+ /**
404
+ * Additionnal transaction info getter
405
+ *
406
+ * @param sting $key
407
+ * @return mixed
408
+ */
409
+ public function getTransactionAdditionalInfo($key = null)
410
+ {
411
+ if (is_null($key)) {
412
+ return $this->_transactionAdditionalInfo;
413
+ }
414
+ return isset($this->_transactionAdditionalInfo[$key]) ? $this->_transactionAdditionalInfo[$key] : null;
415
+ }
416
+
417
+ /**
418
+ * Reset transaction additional info property
419
+ *
420
+ * @return Mage_Sales_Model_Order_Payment
421
+ */
422
+ public function resetTransactionAdditionalInfo()
423
+ {
424
+ $this->_transactionAdditionalInfo = array();
425
+ return $this;
426
+ }
427
+
428
+ /**
429
+ * Return invoice model for transaction
430
+ *
431
+ * @param string $transactionId
432
+ * @return Mage_Sales_Model_Order_Invoice
433
+ */
434
+ protected function _getInvoiceForTransactionId($transactionId)
435
+ {
436
+ foreach ($this->getOrder()->getInvoiceCollection() as $invoice) {
437
+ if ($invoice->getTransactionId() == $transactionId) {
438
+ $invoice->load($invoice->getId()); // to make sure all data will properly load (maybe not required)
439
+ return $invoice;
440
+ }
441
+ }
442
+ foreach ($this->getOrder()->getInvoiceCollection() as $invoice) {
443
+ if ($invoice->getState() == Mage_Sales_Model_Order_Invoice::STATE_OPEN
444
+ && $invoice->load($invoice->getId())
445
+ ) {
446
+ $invoice->setTransactionId($transactionId);
447
+ return $invoice;
448
+ }
449
+ }
450
+ return false;
451
+ }
452
+ }
app/code/local/Litle/CreditCard/Model/Order/Payment.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_CreditCard_Model_Order_Payment extends Mage_Sales_Model_Order_Payment
4
+ {
5
+ // /**
6
+ // * Cancel a creditmemo: substract its totals from the payment
7
+ // *
8
+ // * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
9
+ // * @return Mage_Sales_Model_Order_Payment
10
+ // */
11
+ // public function cancelCreditmemo($creditmemo)
12
+ // {
13
+ // $this->_updateTotals(array(
14
+ // 'amount_refunded' => -1 * $creditmemo->getGrandTotal(),
15
+ // 'base_amount_refunded' => -1 * $creditmemo->getBaseGrandTotal(),
16
+ // 'shipping_refunded' => -1 * $creditmemo->getShippingAmount(),
17
+ // 'base_shipping_refunded' => -1 * $creditmemo->getBaseShippingAmount()
18
+ // ));
19
+ // Mage::dispatchEvent('sales_order_payment_cancel_creditmemo',
20
+ // array('payment' => $this, 'creditmemo' => $creditmemo)
21
+ // );
22
+ // return $this;
23
+ // }
24
+
25
+ protected function _reverseRefund($isOnline, $amount = null, $gatewayCallback = 'void')
26
+ {
27
+ $order = $this->getOrder();
28
+ // attempt to void
29
+ if ($isOnline) {
30
+ $this->getMethodInstance()->setStore($order->getStoreId())->$gatewayCallback($this);
31
+ }
32
+ if ($this->_isTransactionExists()) {
33
+ return $this;
34
+ }
35
+
36
+ foreach($order->getItemsCollection() as $item){
37
+ if ($item->getQtyRefunded() > 0)
38
+ $item->setQtyRefunded(0)->save();
39
+ }
40
+
41
+ $order
42
+ ->setBaseDiscountRefunded(0)
43
+ ->setBaseShippingRefunded(0)
44
+ ->setBaseSubtotalRefunded(0)
45
+ ->setBaseTaxRefunded(0)
46
+ ->setBaseShippingTaxRefunded(0)
47
+ ->setBaseTotalOnlineRefunded(0)
48
+ ->setBaseTotalOfflineRefunded(0)
49
+ ->setBaseTotalRefunded(0)
50
+ ->setTotalOnlineRefunded(0)
51
+ ->setTotalOfflineRefunded(0)
52
+ ->setDiscountRefunded(0)
53
+ ->setShippingRefunded(0)
54
+ ->setShippingTaxRefunded(0)
55
+ ->setSubtotalRefunded(0)
56
+ ->setTaxRefunded(0)
57
+ ->setTotalRefunded(0)->save();
58
+
59
+ // update transactions, order state and add comments
60
+ $transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID, null, true);
61
+ $message = $this->hasMessage() ? $this->getMessage() : "Voided Refund.";
62
+ $message = $this->_prependMessage($message);
63
+ $message = $this->_appendTransactionToMessage($transaction, $message);
64
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $message);
65
+ }
66
+
67
+ protected function _voidCapture($isOnline, $amount = null, $gatewayCallback = 'void')
68
+ {
69
+ $order = $this->getOrder();
70
+ // attempt to void
71
+ if ($isOnline) {
72
+ $this->getMethodInstance()->setStore($order->getStoreId())->$gatewayCallback($this);
73
+ }
74
+ if ($this->_isTransactionExists()) {
75
+ return $this;
76
+ }
77
+
78
+ foreach($order->getItemsCollection() as $orderItem){
79
+ $orderItem->setQtyInvoiced(0);
80
+ $orderItem->setTaxInvoiced(0);
81
+ $orderItem->setBaseTaxInvoiced(0);
82
+ $orderItem->setHiddenTaxInvoiced(0);
83
+ $orderItem->setBaseHiddenTaxInvoiced(0);
84
+
85
+ $orderItem->setDiscountInvoiced(0);
86
+ $orderItem->setBaseDiscountInvoiced(0);
87
+
88
+ $orderItem->setRowInvoiced(0);
89
+ $orderItem->setBaseRowInvoiced(0);
90
+ }
91
+
92
+ $order
93
+ ->setBaseDiscountInvoiced(0)
94
+ ->setBaseShippingInvoiced(0)
95
+ ->setBaseSubtotalInvoiced(0)
96
+ ->setBaseTaxInvoiced(0)
97
+ ->setBaseTotalInvoiced(0)
98
+ ->setBaseTotalInvoicedCost(0)
99
+ ->setDiscountInvoiced(0)
100
+ ->setShippingInvoiced(0)
101
+ ->setSubtotalInvoiced(0)
102
+ ->setTaxInvoiced(0)
103
+ ->setTotalInvoiced(0)
104
+ ->setHiddenTaxInvoiced(0)
105
+ ->setBaseHiddenTaxInvoiced(0)
106
+ ->setShippingTaxInvoiced(0)
107
+ ->setBaseShippingTaxInvoiced(0)
108
+ ->setTotalPaid(0)
109
+ ->setBaseTotalPaid(0);
110
+
111
+ $this->setBaseShippingCaptured(0);
112
+ $this->setShippingCaptured(0);
113
+ $this->setAmountPaid(0);
114
+ $this->setBaseAmountPaid(0);
115
+ $this->setBaseAmountPaidOnline(0);
116
+
117
+ $order->setBaseGrandTotal($order->getGrandTotal());
118
+
119
+ foreach ($order->getInvoiceCollection() as $invoice) {
120
+ $invoice->setState("3")->save(); //3 means cancelled
121
+ }
122
+
123
+
124
+
125
+ // update transactions, order state and add comments
126
+ $transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH, null, true);
127
+ $message = $this->hasMessage() ? $this->getMessage() : "Voided Capture.";
128
+ $message = $this->_prependMessage($message);
129
+ $message = $this->_appendTransactionToMessage($transaction, $message);
130
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $message);
131
+ }
132
+
133
+
134
+ /**
135
+ * Void payment either online or offline (process void notification)
136
+ * NOTE: that in some cases authorization can be voided after a capture. In such case it makes sense to use
137
+ * the amount void amount, for informational purposes.
138
+ * Updates payment totals, updates order status and adds proper comments
139
+ *
140
+ * @param bool $isOnline
141
+ * @param float $amount
142
+ * @param string $gatewayCallback
143
+ * @return Mage_Sales_Model_Order_Payment
144
+ */
145
+ protected function _void($isOnline, $amount = null, $gatewayCallback = 'void')
146
+ {
147
+ if(Mage::helper("creditcard")->isMOPLitle($this))
148
+ {
149
+ $order = $this->getOrder();
150
+ if(Mage::helper("creditcard")->isStateOfOrderEqualTo($order, Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND))
151
+ {
152
+ $this->_reverseRefund($isOnline, $amount, $gatewayCallback);
153
+ } else if(Mage::helper("creditcard")->isStateOfOrderEqualTo($order, Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH)){
154
+ parent::_void($isOnline, $amount, $gatewayCallback);
155
+ } else if(Mage::helper("creditcard")->isStateOfOrderEqualTo($order, Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE)){
156
+ $this->_voidCapture($isOnline, $amount, $gatewayCallback);
157
+ } else {
158
+ parent::_void($isOnline, $amount, $gatewayCallback);
159
+ }
160
+ } else {
161
+ parent::_void($isOnline, $amount, $gatewayCallback);
162
+ }
163
+
164
+ return $this;
165
+ }
166
+ }
app/code/local/Litle/CreditCard/Model/PaymentLogic.php CHANGED
@@ -8,6 +8,7 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
8
  */
9
  protected $_code = 'creditcard';
10
 
 
11
  /**
12
  * this should probably be true if you're using this
13
  * method to take payments
@@ -61,7 +62,6 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
61
  */
62
  protected $_canSaveCc = false;
63
 
64
-
65
  public function getConfigData($fieldToLookFor, $store = NULL)
66
  {
67
  $returnFromThisModel = Mage::getStoreConfig('payment/CreditCard/' . $fieldToLookFor);
@@ -71,10 +71,59 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
71
  return $returnFromThisModel;
72
  }
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  public function getCreditCardInfo(Varien_Object $payment)
75
  {
76
  $retArray = array();
77
- $retArray["type"] = ($payment->getCcType() == "AE")? "AX" : $payment->getCcType();
78
  $retArray["number"] = $payment->getCcNumber();
79
  preg_match("/\d\d(\d\d)/", $payment->getCcExpYear(), $expYear);
80
  $retArray["expDate"] = sprintf('%02d%02d', $payment->getCcExpMonth(), $expYear[1]);
@@ -83,6 +132,52 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
83
  return $retArray;
84
  }
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  public function getContactInformation($contactInfo)
87
  {
88
  if(!empty($contactInfo)){
@@ -129,13 +224,38 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
129
  return NULL;
130
  }
131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  public function merchantData(Varien_Object $payment)
133
  {
 
134
  $hash = array('user'=> $this->getConfigData("user"),
135
  'password'=> $this->getConfigData("password"),
136
- 'merchantId'=>$this->getConfigData("merchant_id"),
137
  'version'=>'8.10',
138
- 'reportGroup'=>$this->getConfigData("reportGroup"),
 
 
139
  'url'=>$this->getConfigData("url"),
140
  'proxy'=>$this->getConfigData("proxy"),
141
  'timeout'=>$this->getConfigData("timeout")
@@ -143,7 +263,147 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
143
  return $hash;
144
  }
145
 
146
- public function processResponse(Varien_Object $payment,$litleResponse){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  $message = XmlParser::getAttribute($litleResponse,'litleOnlineResponse','message');
148
  if ($message == "Valid Format"){
149
  $isSale = ($payment->getCcTransId() != NULL)? FALSE : TRUE;
@@ -152,18 +412,26 @@ public function processResponse(Varien_Object $payment,$litleResponse){
152
  $litleResponseCode = XMLParser::getNode($litleResponse,'response');
153
  if($litleResponseCode != "000")
154
  {
155
- $payment
156
- ->setStatus("Rejected")
157
- ->setCcTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
158
- ->setLastTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
159
- ->setTransactionId(XMLParser::getNode($litleResponse,'litleTxnId'))
160
- ->setIsTransactionClosed(0)
161
- ->setTransactionAdditionalInfo("additional_information", XMLParser::getNode($litleResponse,'message'));
162
-
163
- if($isSale)
164
- throw new Mage_Payment_Model_Info_Exception(Mage::helper('core')->__("Transaction was not approved. Contact us or try again later."));
165
  else
166
- throw new Mage_Payment_Model_Info_Exception(Mage::helper('core')->__("Transaction was not approved. Contact Litle or try again later."));
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  }
168
  else
169
  {
@@ -174,13 +442,16 @@ public function processResponse(Varien_Object $payment,$litleResponse){
174
  ->setTransactionId(XMLParser::getNode($litleResponse,'litleTxnId'))
175
  ->setIsTransactionClosed(0)
176
  ->setTransactionAdditionalInfo("additional_information", XMLParser::getNode($litleResponse,'message'));
 
177
  }
178
- return $this;
179
  }
180
  }
181
  else{
182
  Mage::throwException($message);
183
  }
 
 
184
  }
185
  /**
186
  * this method is called if we are just authorising
@@ -188,24 +459,41 @@ public function processResponse(Varien_Object $payment,$litleResponse){
188
  */
189
  public function authorize(Varien_Object $payment, $amount)
190
  {
191
- $order = $payment->getOrder();
192
- $orderId = $order->getIncrementId();
193
- $amountToPass = ($amount* 100);
194
-
195
- if (!empty($order)){
196
- $hash = array(
197
- 'orderId'=> $orderId,
198
- 'amount'=> $amountToPass,
199
- 'orderSource'=> "ecommerce",
200
- 'billToAddress'=> $this->getBillToAddress($payment),
201
- 'shipToAddress'=> $this->getAddressInfo($payment),
202
- 'card'=> $this->getCreditCardInfo($payment)
203
- );
204
- $merchantData = $this->merchantData($payment);
205
- $hash_in = array_merge($hash,$merchantData);
206
- $litleRequest = new LitleOnlineRequest();
207
- $litleResponse = $litleRequest->authorizationRequest($hash_in);
208
- $this->processResponse($payment,$litleResponse);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  }
210
  }
211
 
@@ -215,39 +503,56 @@ public function processResponse(Varien_Object $payment,$litleResponse){
215
  */
216
  public function capture (Varien_Object $payment, $amount)
217
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  $order = $payment->getOrder();
219
  if (!empty($order)){
220
-
221
  $orderId =$order->getIncrementId();
222
  $amountToPass = ($amount* 100);
223
  $isPartialCapture = ($amount < $order->getGrandTotal()) ? "true" : "false";
224
  $isSale = ($payment->getCcTransId() != NULL)? FALSE : TRUE;
225
-
226
  if( !$isSale )
227
  {
228
  $hash = array(
229
- 'litleTxnId' => $payment->getParentTransactionId(),//getCcTransId(),
230
  'amount' => $amountToPass,
231
  'partial' => $isPartialCapture
232
  );
233
  } else {
234
- $hash = array(
235
  'orderId'=> $orderId,
236
  'amount'=> $amountToPass,
237
  'orderSource'=> "ecommerce",
238
  'billToAddress'=> $this->getBillToAddress($payment),
239
  'shipToAddress'=> $this->getAddressInfo($payment),
240
- 'card'=> $this->getCreditCardInfo($payment)
241
  );
 
 
242
  }
243
-
244
  $merchantData = $this->merchantData($payment);
245
  $hash_in = array_merge($hash,$merchantData);
246
  $litleRequest = new LitleOnlineRequest();
247
-
248
  if( $isSale )
249
  {
250
  $litleResponse = $litleRequest->saleRequest($hash_in);
 
 
251
  } else {
252
  $litleResponse = $litleRequest->captureRequest($hash_in);
253
  }
@@ -260,19 +565,24 @@ public function processResponse(Varien_Object $payment,$litleResponse){
260
  */
261
  public function refund (Varien_Object $payment, $amount)
262
  {
 
 
263
  $order = $payment->getOrder();
264
- $amountToPass = ($amount* 100);
265
- if (!empty($order)){
266
- $hash = array(
267
- 'litleTxnId' => $payment->getCcTransId(),
268
- 'amount' => $amountToPass
269
- );
270
- $merchantData = $this->merchantData($payment);
271
- $hash_in = array_merge($hash,$merchantData);
272
- $litleRequest = new LitleOnlineRequest();
273
- $litleResponse = $litleRequest->creditRequest($hash_in);
274
- }
275
- $this->processResponse($payment,$litleResponse);
 
 
 
276
  return $this;
277
  }
278
 
@@ -281,6 +591,8 @@ public function processResponse(Varien_Object $payment,$litleResponse){
281
  */
282
  public function void (Varien_Object $payment)
283
  {
 
 
284
  $order = $payment->getOrder();
285
  if (!empty($order)){
286
  $hash = array(
@@ -289,8 +601,19 @@ public function processResponse(Varien_Object $payment,$litleResponse){
289
  $merchantData = $this->merchantData($payment);
290
  $hash_in = array_merge($hash,$merchantData);
291
  $litleRequest = new LitleOnlineRequest();
292
- $litleResponse = $litleRequest->voidRequest($hash_in);
 
 
 
 
 
293
  }
294
  $this->processResponse($payment,$litleResponse);
295
  }
 
 
 
 
 
 
296
  }
8
  */
9
  protected $_code = 'creditcard';
10
 
11
+ protected $_formBlockType = 'creditcard/form_creditCard';
12
  /**
13
  * this should probably be true if you're using this
14
  * method to take payments
62
  */
63
  protected $_canSaveCc = false;
64
 
 
65
  public function getConfigData($fieldToLookFor, $store = NULL)
66
  {
67
  $returnFromThisModel = Mage::getStoreConfig('payment/CreditCard/' . $fieldToLookFor);
71
  return $returnFromThisModel;
72
  }
73
 
74
+ public function isFromVT($payment, $txnType)
75
+ {
76
+ $parentTxnId = $payment->getParentTransactionId();
77
+ if( $parentTxnId == "Litle VT" )
78
+ {
79
+ Mage::throwException("This order was placed using Litle Virtual Terminal. Please process the $txnType by logging into Litle Virtual Terminal (https://vt.litle.com).");
80
+ }
81
+ }
82
+
83
+ public function assignData($data)
84
+ {
85
+ if( $this->getConfigData('paypage_enabled') == "1")
86
+ {
87
+ if (!($data instanceof Varien_Object)) {
88
+ $data = new Varien_Object($data);
89
+ }
90
+
91
+ $info = $this->getInfoInstance();
92
+ $info->setAdditionalInformation('paypage_enabled', $data->getPaypageEnabled());
93
+ $info->setAdditionalInformation('paypage_registration_id', $data->getPaypageRegistrationId());
94
+ $info->setAdditionalInformation('paypage_order_id', $data->getOrderId());
95
+ $info->setAdditionalInformation('cc_vaulted', $data->getCcVaulted());
96
+ }
97
+ return parent::assignData($data);
98
+ }
99
+
100
+
101
+
102
+ public function validate()
103
+ {
104
+ //no cc validation required.
105
+ return $this;
106
+ }
107
+
108
+ public function litleCcTypeEnum(Varien_Object $payment)
109
+ {
110
+ $typeEnum = "";
111
+ if ($payment->getCcType() == "AE"){
112
+ $typeEnum = "AX";
113
+ }
114
+ elseif ($payment->getCcType() == "JCB"){
115
+ $typeEnum = "JC";
116
+ }
117
+ else{
118
+ $typeEnum =$payment->getCcType();
119
+ }
120
+ return $typeEnum;
121
+ }
122
+
123
  public function getCreditCardInfo(Varien_Object $payment)
124
  {
125
  $retArray = array();
126
+ $retArray["type"] = $this->litleCcTypeEnum($payment);
127
  $retArray["number"] = $payment->getCcNumber();
128
  preg_match("/\d\d(\d\d)/", $payment->getCcExpYear(), $expYear);
129
  $retArray["expDate"] = sprintf('%02d%02d', $payment->getCcExpMonth(), $expYear[1]);
132
  return $retArray;
133
  }
134
 
135
+ public function getPaypageInfo($payment)
136
+ {
137
+ $info = $this->getInfoInstance();
138
+
139
+ $retArray = array();
140
+ $retArray["type"] = $this->litleCcTypeEnum($payment);
141
+ $retArray["paypageRegistrationId"] = $info->getAdditionalInformation('paypage_registration_id');
142
+ preg_match("/\d\d(\d\d)/", $payment->getCcExpYear(), $expYear);
143
+ $retArray["expDate"] = sprintf('%02d%02d', $payment->getCcExpMonth(), $expYear[1]);
144
+ $retArray["cardValidationNum"] = $payment->getCcCid();
145
+
146
+ return $retArray;
147
+ }
148
+
149
+ public function getTokenInfo($payment)
150
+ {
151
+ $info = $this->getInfoInstance();
152
+
153
+ $vaultIndex = $info->getAdditionalInformation('cc_vaulted');
154
+ $purchases = Mage::helper('creditcard')->uniqueCreditCard(Mage::helper('customer')->getCustomer()->getEntityId());
155
+
156
+ $retArray = array();
157
+ $retArray["type"] = $purchases[$vaultIndex - 1]['type'];
158
+ $retArray["litleToken"] = $purchases[$vaultIndex - 1]['token'];
159
+ $retArray["cardValidationNum"] = $payment->getCcCid();
160
+ $payment->setCcLast4(substr($retArray["litleToken"], -4));
161
+ $payment->setCcType($retArray["type"]);
162
+ return $retArray;
163
+ }
164
+
165
+ public function creditCardOrPaypageOrToken($payment){
166
+ $info = $this->getInfoInstance();
167
+ $vaultIndex = $info->getAdditionalInformation('cc_vaulted');
168
+ $payment_hash = array();
169
+ if ($vaultIndex > 0){
170
+ $payment_hash['token'] = $this->getTokenInfo($payment);
171
+ }
172
+ elseif ($info->getAdditionalInformation('paypage_enabled') == "1" ){
173
+ $payment_hash['paypage'] = $this->getPaypageInfo($payment);
174
+ }
175
+ else{
176
+ $payment_hash['card'] = $this->getCreditCardInfo($payment);
177
+ }
178
+ return $payment_hash;
179
+ }
180
+
181
  public function getContactInformation($contactInfo)
182
  {
183
  if(!empty($contactInfo)){
224
  return NULL;
225
  }
226
 
227
+
228
+ public function getIpAddress(Varien_Object $payment)
229
+ {
230
+ $order = $payment->getOrder();
231
+ if(!empty($order)){
232
+ return $order->getRemoteIp();
233
+ }
234
+ return NULL;
235
+ }
236
+
237
+
238
+
239
+ public function getMerchantId(Varien_Object $payment){
240
+ $order = $payment->getOrder();
241
+ $currency = $order->getOrderCurrencyCode();
242
+ $string2Eval = 'return array' . $this->getConfigData("merchant_id") . ';';
243
+ $merchant_map = eval($string2Eval);
244
+ $merchantId = $merchant_map[$currency];
245
+ return $merchantId;
246
+ }
247
+
248
+
249
  public function merchantData(Varien_Object $payment)
250
  {
251
+ $order = $payment->getOrder();
252
  $hash = array('user'=> $this->getConfigData("user"),
253
  'password'=> $this->getConfigData("password"),
254
+ 'merchantId'=> $this->getMerchantId($payment),
255
  'version'=>'8.10',
256
+ 'merchantSdk'=>'Magento;8.13.0',
257
+ 'reportGroup'=>$this->getMerchantId($payment),
258
+ 'customerId'=> $order->getCustomerEmail(),
259
  'url'=>$this->getConfigData("url"),
260
  'proxy'=>$this->getConfigData("proxy"),
261
  'timeout'=>$this->getConfigData("timeout")
263
  return $hash;
264
  }
265
 
266
+
267
+ public function getCustomBilling($url){
268
+ $retArray = array();
269
+
270
+ if (strlen($url)>13){
271
+ $url = str_replace('http://','',$url);
272
+ $url = str_replace('https://','',$url);
273
+ $url_temp = explode('/',$url);
274
+ $url = $url_temp['0'];
275
+ if (strlen($url)>13){
276
+ $url = str_replace('www.','',$url);
277
+ if (strlen($url)>13){
278
+ $url_temp2 = explode('.',$url);
279
+ $count = count($url_temp2);
280
+ }if($count < 3){
281
+ if (strlen($url_temp2['0'] . '.' . $url_temp2['1']) > 13){
282
+ $url = $url_temp2['0'];
283
+ }else{
284
+ $url = $url_temp2['0'] . '.' . $url_temp2['1'];
285
+ }
286
+ }
287
+ }
288
+ }
289
+
290
+ $url = substr($url,0,13);
291
+ if(substr($url,12) === '.'){
292
+ $url = substr($url,0,12);
293
+ }
294
+ elseif (substr($url,0) === '.'){
295
+ $url = substr($url,1,12);
296
+ }
297
+ $retArray['url'] = $url;
298
+
299
+ return $retArray;
300
+ }
301
+
302
+ public function getOrderDate(Varien_Object $payment){
303
+ $order = $payment->getOrder();
304
+ $date = $order->getCreatedAtFormated(short);
305
+ $date_temp = explode('/',$date);
306
+ $month = $date_temp['0'];
307
+ if ((int)$month < 10){
308
+ $month = '0' . $month;
309
+ }
310
+ $day=$date_temp['1'];
311
+ if ((int)$day < 10){
312
+ $day = '0' . $day;
313
+ }
314
+ $year_temp = explode(' ',$date_temp['2']);
315
+ $year = '20' . $year_temp['0'];
316
+ return $year . '-' . $month . '-' . $day;
317
+ }
318
+
319
+ public function getLineItemData(Varien_Object $payment){
320
+ $order = $payment->getOrder();
321
+ $items = $order->getAllItems();
322
+ $i = 0;
323
+ $lineItemArray = array();
324
+ foreach ($items as $itemId => $item)
325
+ {
326
+ $name = $item->getName();
327
+ $unitPrice=$item->getPrice();
328
+ $sku=$item->getSku();
329
+ $ids=$item->getProductId();
330
+ $qty=$item->getQtyToInvoice();
331
+
332
+ if( strlen($name) > 26 )
333
+ $name = substr($name,0,26);
334
+
335
+ $lineItemArray[$i] = array(
336
+ 'itemSequenceNumber'=>($i+1),
337
+ 'itemDescription'=>$name,
338
+ 'productCode'=>$ids,
339
+ 'quantity'=>$qty,
340
+ 'lineItemTotal'=>(($unitPrice*$qty)*100),
341
+ 'unitCost'=>($unitPrice * 100));
342
+ $i++;
343
+ }
344
+ return $lineItemArray;
345
+ }
346
+
347
+
348
+ public function getEnhancedData(Varien_Object $payment)
349
+ {
350
+ $order = $payment->getOrder();
351
+ $billing = $order->getBillingAddress();
352
+ $i = 0;
353
+ $hash = array('salesTax'=> $order->getTaxAmount()*100,
354
+ 'discountAmount'=>$order->getDiscountAmount(),
355
+ 'shippingAmount'=>$order->getShippingAmount(),
356
+ 'destinationPostalCode'=>$billing->getPostcode(),
357
+ 'destinationCountryCode'=>$billing->getCountry(),
358
+ 'orderDate'=>$this->getOrderDate($payment),
359
+ 'detailTax'=>array(array('taxAmount'=>$order->getTaxAmount()*100)),
360
+ 'lineItemData' => $this->getLineItemData($payment)
361
+ );
362
+ return $hash;
363
+ }
364
+
365
+ public function getFraudCheck(Varien_Object $payment)
366
+ {
367
+ $order = $payment->getOrder();
368
+ $hash = array('customerIpAddress'=> $order->getRemoteIp()
369
+ );
370
+ return $hash;
371
+ }
372
+
373
+ public function getUpdater($litleResponse, $parentNode, $childNode=NULL){
374
+
375
+ if($childNode === NULL){
376
+ $new = $litleResponse->getElementsByTagName($parentNode)->item(0);
377
+ }
378
+ else{
379
+ $new = $litleResponse->getElementsByTagName($parentNode)->item(0)->getElementsByTagName($childNode)->item(0)->nodeValue;
380
+ }
381
+
382
+ return $new;
383
+ }
384
+
385
+ public function accountUpdater(Varien_Object $payment,$litleResponse){
386
+
387
+ if($this->getUpdater($litleResponse, 'newCardInfo') !== NULL){
388
+
389
+ $payment->setCcLast4(substr($this->getUpdater($litleResponse, 'newCardInfo', 'number'), -4));
390
+ $payment->setCcType($this->getUpdater($litleResponse, 'newCardInfo','type'));
391
+ $payment->setCcExpDate($this->getUpdater($litleResponse, 'newCardInfo','expDate'));
392
+
393
+ }
394
+ elseif($this->getUpdater($litleResponse, 'newCardTokenInfo') !== NULL){
395
+
396
+ $payment->setCcNumber($this->getUpdater($litleResponse, 'newCardTokenInfo','litleToken'));
397
+ $payment->setCcLast4(substr($this->getUpdater($litleResponse, 'newCardTokenInfo', 'litleToken'), -4));
398
+ $payment->setCcType($this->getUpdater($litleResponse, 'newCardTokenInfo','type'));
399
+ $payment->setCcExpDate($this->getUpdater($litleResponse, 'newCardTokenInfo','expDate'));
400
+ }
401
+
402
+ }
403
+
404
+
405
+ public function processResponse(Varien_Object $payment,$litleResponse){
406
+ $this->accountUpdater($payment,$litleResponse);
407
  $message = XmlParser::getAttribute($litleResponse,'litleOnlineResponse','message');
408
  if ($message == "Valid Format"){
409
  $isSale = ($payment->getCcTransId() != NULL)? FALSE : TRUE;
412
  $litleResponseCode = XMLParser::getNode($litleResponse,'response');
413
  if($litleResponseCode != "000")
414
  {
415
+ //Mage::throwException('response code is: ' . $litleResponseCode . 'txn type is: ');
416
+ if(($litleResponseCode === "362") && Mage::helper("creditcard")->isStateOfOrderEqualTo($payment->getOrder(), Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE))
417
+ {
418
+ Mage::throwException("The void did not go through. Do a refund instead.");
419
+ }
 
 
 
 
 
420
  else
421
+ {
422
+ $payment
423
+ ->setStatus("Rejected")
424
+ ->setCcTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
425
+ ->setLastTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
426
+ ->setTransactionId(XMLParser::getNode($litleResponse,'litleTxnId'))
427
+ ->setIsTransactionClosed(0)
428
+ ->setTransactionAdditionalInfo("additional_information", XMLParser::getNode($litleResponse,'message'));
429
+
430
+ if($isSale)
431
+ throw new Mage_Payment_Model_Info_Exception(Mage::helper('core')->__("Transaction was not approved. Contact us or try again later."));
432
+ else
433
+ throw new Mage_Payment_Model_Info_Exception(Mage::helper('core')->__("Transaction was not approved. Contact Litle or try again later."));
434
+ }
435
  }
436
  else
437
  {
442
  ->setTransactionId(XMLParser::getNode($litleResponse,'litleTxnId'))
443
  ->setIsTransactionClosed(0)
444
  ->setTransactionAdditionalInfo("additional_information", XMLParser::getNode($litleResponse,'message'));
445
+
446
  }
447
+ return true;
448
  }
449
  }
450
  else{
451
  Mage::throwException($message);
452
  }
453
+
454
+
455
  }
456
  /**
457
  * this method is called if we are just authorising
459
  */
460
  public function authorize(Varien_Object $payment, $amount)
461
  {
462
+ if (preg_match("/sales_order_create/i", $_SERVER['REQUEST_URI']) && ($this->getConfigData('paypage_enable') == "1") )
463
+ {
464
+ $payment
465
+ ->setStatus("N/A")
466
+ ->setCcTransId("Litle VT")
467
+ ->setLastTransId("Litle VT")
468
+ ->setTransactionId("Litle VT")
469
+ ->setIsTransactionClosed(0)
470
+ ->setCcType("Litle VT");
471
+ }
472
+ else{
473
+ $order = $payment->getOrder();
474
+ $orderId = $order->getIncrementId();
475
+ $amountToPass = ($amount* 100);
476
+ if (!empty($order)){
477
+ $hash = array(
478
+ 'orderId'=> $orderId,
479
+ 'amount'=> $amountToPass,
480
+ 'orderSource'=> "ecommerce",
481
+ 'billToAddress'=> $this->getBillToAddress($payment),
482
+ 'shipToAddress'=> $this->getAddressInfo($payment),
483
+ 'cardholderAuthentication'=> $this->getFraudCheck($payment),
484
+ 'enhancedData'=>$this->getEnhancedData($payment),
485
+ 'customBilling'=>$this->getCustomBilling(Mage::app()->getStore()-> getBaseUrl())
486
+ );
487
+ $payment_hash = $this->creditCardOrPaypageOrToken($payment);
488
+ $hash_temp = array_merge($hash,$payment_hash);
489
+ $merchantData = $this->merchantData($payment);
490
+ $hash_in = array_merge($hash_temp,$merchantData);
491
+ $litleRequest = new LitleOnlineRequest();
492
+ $litleResponse = $litleRequest->authorizationRequest($hash_in);
493
+ $this->processResponse($payment,$litleResponse);
494
+ Mage::helper("palorus")->saveCustomerInsight($payment, $litleResponse);
495
+ Mage::helper("palorus")->saveVault($payment, $litleResponse);
496
+ }
497
  }
498
  }
499
 
503
  */
504
  public function capture (Varien_Object $payment, $amount)
505
  {
506
+ if (preg_match("/sales_order_create/i", $_SERVER['REQUEST_URI']) && ($this->getConfigData('paypage_enable') == "1") )
507
+ {
508
+ $payment
509
+ ->setStatus("N/A")
510
+ ->setCcTransId("Litle VT")
511
+ ->setLastTransId("Litle VT")
512
+ ->setTransactionId("Litle VT")
513
+ ->setIsTransactionClosed(0)
514
+ ->setCcType("Litle VT");
515
+
516
+ return;
517
+ }
518
+
519
+ $this->isFromVT($payment, "capture");
520
+
521
  $order = $payment->getOrder();
522
  if (!empty($order)){
523
+
524
  $orderId =$order->getIncrementId();
525
  $amountToPass = ($amount* 100);
526
  $isPartialCapture = ($amount < $order->getGrandTotal()) ? "true" : "false";
527
  $isSale = ($payment->getCcTransId() != NULL)? FALSE : TRUE;
528
+
529
  if( !$isSale )
530
  {
531
  $hash = array(
532
+ 'litleTxnId' => $payment->getParentTransactionId(),
533
  'amount' => $amountToPass,
534
  'partial' => $isPartialCapture
535
  );
536
  } else {
537
+ $hash_temp = array(
538
  'orderId'=> $orderId,
539
  'amount'=> $amountToPass,
540
  'orderSource'=> "ecommerce",
541
  'billToAddress'=> $this->getBillToAddress($payment),
542
  'shipToAddress'=> $this->getAddressInfo($payment),
 
543
  );
544
+ $payment_hash = $this->creditCardOrPaypageOrToken($payment);
545
+ $hash = array_merge($hash_temp,$payment_hash);
546
  }
 
547
  $merchantData = $this->merchantData($payment);
548
  $hash_in = array_merge($hash,$merchantData);
549
  $litleRequest = new LitleOnlineRequest();
550
+
551
  if( $isSale )
552
  {
553
  $litleResponse = $litleRequest->saleRequest($hash_in);
554
+ Mage::helper("palorus")->saveCustomerInsight($payment, $litleResponse);
555
+ Mage::helper("palorus")->saveVault($payment, $litleResponse);
556
  } else {
557
  $litleResponse = $litleRequest->captureRequest($hash_in);
558
  }
565
  */
566
  public function refund (Varien_Object $payment, $amount)
567
  {
568
+ $this->isFromVT($payment, "refund");
569
+
570
  $order = $payment->getOrder();
571
+ $isPartialRefund = ($amount < $order->getGrandTotal()) ? true : false;
572
+
573
+ $amountToPass = ($amount* 100);
574
+ if (!empty($order)){
575
+ $hash = array(
576
+ 'litleTxnId' => $payment->getCcTransId(),
577
+ 'amount' => $amountToPass
578
+ );
579
+ $merchantData = $this->merchantData($payment);
580
+ $hash_in = array_merge($hash,$merchantData);
581
+ $litleRequest = new LitleOnlineRequest();
582
+ $litleResponse = $litleRequest->creditRequest($hash_in);
583
+ }
584
+ $this->processResponse($payment,$litleResponse);
585
+
586
  return $this;
587
  }
588
 
591
  */
592
  public function void (Varien_Object $payment)
593
  {
594
+ $this->isFromVT($payment, "void");
595
+
596
  $order = $payment->getOrder();
597
  if (!empty($order)){
598
  $hash = array(
601
  $merchantData = $this->merchantData($payment);
602
  $hash_in = array_merge($hash,$merchantData);
603
  $litleRequest = new LitleOnlineRequest();
604
+
605
+ if(Mage::helper("creditcard")->isStateOfOrderEqualTo($order, Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH)){
606
+ $litleResponse = $litleRequest->authReversalRequest($hash_in);
607
+ } else {
608
+ $litleResponse = $litleRequest->voidRequest($hash_in);
609
+ }
610
  }
611
  $this->processResponse($payment,$litleResponse);
612
  }
613
+
614
+ public function cancel(Varien_Object $payment)
615
+ {
616
+ $this->void($payment);
617
+ }
618
+
619
  }
app/code/local/Litle/CreditCard/Model/ValidateMerchantId.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Litle_CreditCard_Model_ValidateMerchantId extends Mage_Core_Model_Config_Data
3
+ {
4
+ public function getFieldsetDataValue($key)
5
+ {
6
+ $data = $this->_getData('fieldset_data');
7
+ return (is_array($data) && isset($data[$key])) ? $data[$key] : null;
8
+ }
9
+
10
+ function save(){
11
+ if ($this->getFieldsetDataValue('active'))
12
+ {
13
+ $merchantId = $this->getFieldsetDataValue("merchant_id");
14
+ Litle_CreditCard_Model_ValidateMerchantId::validate($merchantId);
15
+ }
16
+ return parent::save();
17
+ }
18
+
19
+ public static function validate($merchantId) {
20
+ $string2Eval = 'return array' . $merchantId . ';';
21
+ $currency = "USD";//assumed that the base currency is USD
22
+ @$merchant_map = eval($string2Eval);
23
+
24
+ if(!is_array($merchant_map)){
25
+ Mage::throwException('Merchant ID must be of the form ("Currency" => "Code"), '. PHP_EOL . 'i.e. ("USD" => "101","GBP" => "102")');
26
+ }
27
+ if(empty($merchant_map[$currency])){
28
+ Mage::throwException('Please Make sure that the Base Currency: ' . $currency . ' is in the Merchant ID Array');
29
+ }
30
+ }
31
+ }
app/code/local/Litle/CreditCard/Model/Validatehttp.php CHANGED
@@ -6,8 +6,17 @@ class Litle_CreditCard_Model_Validatehttp extends Mage_Core_Model_Config_Data
6
  $data = $this->_getData('fieldset_data');
7
  return (is_array($data) && isset($data[$key])) ? $data[$key] : null;
8
  }
 
 
 
 
 
 
 
 
 
9
  function save(){
10
- if ($this->getFieldsetDataValue('active'))
11
  {
12
  $ch = curl_init();
13
  curl_setopt($ch, CURLOPT_PROXY, $this->getFieldsetDataValue('proxy'));
@@ -28,6 +37,7 @@ class Litle_CreditCard_Model_Validatehttp extends Mage_Core_Model_Config_Data
28
  {
29
  curl_close($ch);
30
  }
 
31
  return parent::save();
32
  }
33
  }
6
  $data = $this->_getData('fieldset_data');
7
  return (is_array($data) && isset($data[$key])) ? $data[$key] : null;
8
  }
9
+
10
+ public function getEcheckConfigData($fieldToLookFor, $store = NULL)
11
+ {
12
+ $returnFromThisModel = Mage::getStoreConfig('payment/LEcheck/' . $fieldToLookFor);
13
+ if( $returnFromThisModel == NULL )
14
+ $returnFromThisModel = parent::getConfigData($fieldToLookFor, $store);
15
+
16
+ return $returnFromThisModel;
17
+ }
18
  function save(){
19
+ if ($this->getFieldsetDataValue('active') || $this->getEcheckConfigData('active'))
20
  {
21
  $ch = curl_init();
22
  curl_setopt($ch, CURLOPT_PROXY, $this->getFieldsetDataValue('proxy'));
37
  {
38
  curl_close($ch);
39
  }
40
+
41
  return parent::save();
42
  }
43
  }
app/code/local/Litle/CreditCard/controllers/Adminhtml/OrderController.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Litle_CreditCard_Adminhtml_OrderController extends Mage_Adminhtml_Controller_Action{
3
+
4
+ public function massCaptureAction()
5
+ {
6
+ $orderIds = $this->getRequest()->getPost('order_ids', array());
7
+ $countCaptureOrder = 0;
8
+ foreach ($orderIds as $orderId) {
9
+ $order = Mage::getModel('sales/order')->load($orderId);
10
+ $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice(array());
11
+ if ($order->canInvoice()){
12
+ $invoice->register();
13
+ $this->captureInvoice($invoice);
14
+ $countCaptureOrder++;
15
+ } else {
16
+ $this->_getSession()->addError($this->__('The order #' . $invoice->getOrder()->getIncrementId() . ' cannot be Captured '));
17
+ }
18
+ }
19
+ if ($countCaptureOrder) {
20
+ $this->_getSession()->addSuccess($this->__('%s order(s) have been Captured', $countCaptureOrder));
21
+ }
22
+ $referrer = $_SERVER['HTTP_REFERER'];
23
+ $this->_redirectUrl($referrer);
24
+ }
25
+
26
+ private function captureInvoice($invoice)
27
+ {
28
+ try
29
+ {
30
+ $invoice->setRequestedCaptureCase('online');
31
+ $invoice->sendEmail(true);
32
+ $invoice->setEmailSent(true);
33
+ $invoice->getOrder()->setCustomerNoteNotify(true);
34
+ $invoice->getOrder()->setIsInProcess(true);
35
+ $invoice->capture();
36
+ $transactionSave = Mage::getModel('core/resource_transaction')
37
+ ->addObject($invoice)
38
+ ->addObject($invoice->getOrder());
39
+ $transactionSave->save();
40
+ }
41
+
42
+ catch (Exception $e)
43
+ {
44
+ Mage::logException($e);
45
+ }
46
+ }
47
+ }
app/code/local/Litle/CreditCard/etc/config.xml CHANGED
@@ -2,14 +2,43 @@
2
  <config>
3
  <modules>
4
  <Litle_CreditCard>
5
- <version>0.1.0</version>
6
  </Litle_CreditCard>
7
  </modules>
8
  <global>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  <models>
10
  <creditcard>
11
  <class>Litle_CreditCard_Model</class>
12
  </creditcard>
 
 
 
 
 
13
  </models>
14
  <resources>
15
  <creditcard_setup>
@@ -31,20 +60,46 @@
31
  </connection>
32
  </creditcard_read>
33
  </resources>
 
 
 
 
 
34
  </global>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  <default>
36
- <payment>
37
- <creditcard>
38
- <active>1</active>
39
- <timeout>65</timeout>
40
- <url>https://www.testlitle.com/sandbox/communicator/online</url>
41
- <model>creditcard/paymentLogic</model>
42
- <order_status>pending</order_status>
43
- <title>Credit Card (Litle Payment)</title>
44
- <cctypes>AE,VI,MC,DI</cctypes>
45
- <payment_action>authorize</payment_action>
46
- <allowspecific>0</allowspecific>
47
- </creditcard>
48
- </payment>
49
- </default>
50
- </config>
 
2
  <config>
3
  <modules>
4
  <Litle_CreditCard>
5
+ <version>8.13.0</version>
6
  </Litle_CreditCard>
7
  </modules>
8
  <global>
9
+ <payment>
10
+ <cc>
11
+ <types>
12
+ <DC>
13
+ <code>DC</code>
14
+ <name>Diners Club</name>
15
+ <order>1</order>
16
+ </DC>
17
+ </types>
18
+ </cc>
19
+ </payment>
20
+ <blocks>
21
+ <creditcard>
22
+ <class>Litle_CreditCard_Block</class>
23
+ </creditcard>
24
+ <adminhtml>
25
+ <rewrite>
26
+ <sales_order_view>Litle_CreditCard_Block_Adminhtml_Orderview</sales_order_view>
27
+ </rewrite>
28
+ <rewrite>
29
+ <sales_order_grid>Litle_CreditCard_Block_Adminhtml_Ordergrid</sales_order_grid>
30
+ </rewrite>
31
+ </adminhtml>
32
+ </blocks>
33
  <models>
34
  <creditcard>
35
  <class>Litle_CreditCard_Model</class>
36
  </creditcard>
37
+ <sales>
38
+ <rewrite>
39
+ <order_payment>Litle_CreditCard_Model_Order_Payment</order_payment>
40
+ </rewrite>
41
+ </sales>
42
  </models>
43
  <resources>
44
  <creditcard_setup>
60
  </connection>
61
  </creditcard_read>
62
  </resources>
63
+ <helpers>
64
+ <creditcard>
65
+ <class>Litle_CreditCard_Helper</class>
66
+ </creditcard>
67
+ </helpers>
68
  </global>
69
+ <admin>
70
+ <routers>
71
+ <creditcard>
72
+ <use>admin</use>
73
+ <args>
74
+ <module>Litle_CreditCard</module>
75
+ <frontName>creditcard</frontName>
76
+ </args>
77
+ </creditcard>
78
+ </routers>
79
+ </admin>
80
+ <frontend>
81
+ <layout>
82
+ <updates>
83
+ <creditcard>
84
+ <file>litlecreditcard.xml</file>
85
+ </creditcard>
86
+ </updates>
87
+ </layout>
88
+ </frontend>
89
  <default>
90
+ <payment>
91
+ <creditcard>
92
+ <active>1</active>
93
+ <timeout>65</timeout>
94
+ <url>https://www.testlitle.com/sandbox/communicator/online</url>
95
+ <model>creditcard/paymentLogic</model>
96
+ <order_status>pending</order_status>
97
+ <title>Credit Card (Litle Payment)</title>
98
+ <cctypes>AE,VI,MC,DI</cctypes>
99
+ <payment_action>authorize</payment_action>
100
+ <allowspecific>0</allowspecific>
101
+ <paypage_enabled>1</paypage_enabled>
102
+ </creditcard>
103
+ </payment>
104
+ </default>
105
+ </config>
app/code/local/Litle/CreditCard/etc/system.xml CHANGED
@@ -38,7 +38,7 @@
38
  </user>
39
  <password translate="label">
40
  <label>Password</label>
41
- <frontend_type>text</frontend_type>
42
  <sort_order>4</sort_order>
43
  <show_in_default>1</show_in_default>
44
  <show_in_website>1</show_in_website>
@@ -48,18 +48,20 @@
48
  <label>Merchant ID</label>
49
  <frontend_type>text</frontend_type>
50
  <sort_order>5</sort_order>
 
51
  <show_in_default>1</show_in_default>
52
  <show_in_website>1</show_in_website>
53
  <show_in_store>0</show_in_store>
54
  </merchant_id>
55
- <reportGroup translate="label">
56
- <label>Report Group</label>
57
- <frontend_type>text</frontend_type>
58
- <sort_order>6</sort_order>
59
- <show_in_default>1</show_in_default>
60
- <show_in_website>1</show_in_website>
61
- <show_in_store>0</show_in_store>
62
- </reportGroup>
 
63
  <proxy translate="label">
64
  <label>HTTP Proxy</label>
65
  <frontend_type>text</frontend_type>
@@ -99,13 +101,38 @@
99
  <order_status translate="label">
100
  <label>New Order Status</label>
101
  <frontend_type>select</frontend_type>
102
- <source_model>adminhtml/system_config_source_order_status_processing
103
  </source_model>
104
  <sort_order>7</sort_order>
105
  <show_in_default>1</show_in_default>
106
  <show_in_website>1</show_in_website>
107
  <show_in_store>0</show_in_store>
108
  </order_status>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  </fields>
110
  </CreditCard>
111
  </groups>
38
  </user>
39
  <password translate="label">
40
  <label>Password</label>
41
+ <frontend_type>Password</frontend_type>
42
  <sort_order>4</sort_order>
43
  <show_in_default>1</show_in_default>
44
  <show_in_website>1</show_in_website>
48
  <label>Merchant ID</label>
49
  <frontend_type>text</frontend_type>
50
  <sort_order>5</sort_order>
51
+ <backend_model>creditcard/validateMerchantId</backend_model>
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
  </merchant_id>
56
+ <cctypes translate="label">
57
+ <label>Credit Card Types</label>
58
+ <frontend_type>multiselect</frontend_type>
59
+ <source_model>creditcard/cctypes</source_model>
60
+ <sort_order>6</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>0</show_in_store>
64
+ </cctypes>
65
  <proxy translate="label">
66
  <label>HTTP Proxy</label>
67
  <frontend_type>text</frontend_type>
101
  <order_status translate="label">
102
  <label>New Order Status</label>
103
  <frontend_type>select</frontend_type>
104
+ <source_model>adminhtml/system_config_source_order_status_newprocessing
105
  </source_model>
106
  <sort_order>7</sort_order>
107
  <show_in_default>1</show_in_default>
108
  <show_in_website>1</show_in_website>
109
  <show_in_store>0</show_in_store>
110
  </order_status>
111
+ <paypage_id translate="label">
112
+ <label>Paypage Id</label>
113
+ <frontend_type>text</frontend_type>
114
+ <sort_order>10</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
+ </paypage_id>
119
+ <paypage_url translate="label">
120
+ <label>Paypage Merchant URL</label>
121
+ <frontend_type>text</frontend_type>
122
+ <sort_order>10</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
+ </paypage_url>
127
+ <paypage_enable translate="label">
128
+ <label>Paypage Enabled</label>
129
+ <frontend_type>select</frontend_type>
130
+ <source_model>adminhtml/system_config_source_yesno</source_model>
131
+ <sort_order>10</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
+ </paypage_enable>
136
  </fields>
137
  </CreditCard>
138
  </groups>
app/code/local/Litle/LEcheck/Model/PaymentLogic.php CHANGED
@@ -63,7 +63,6 @@ class Litle_LEcheck_Model_PaymentLogic extends Mage_Payment_Model_Method_Abstrac
63
  */
64
  protected $_canSaveCc = false;
65
 
66
-
67
  public function assignData($data)
68
  {
69
  if (!($data instanceof Varien_Object)) {
@@ -80,10 +79,19 @@ class Litle_LEcheck_Model_PaymentLogic extends Mage_Payment_Model_Method_Abstrac
80
 
81
  public function getConfigData($fieldToLookFor, $store = NULL)
82
  {
83
- $returnFromThisModel = Mage::getStoreConfig('payment/LEcheck/' . $fieldToLookFor);
84
- if( $returnFromThisModel == NULL )
85
- $returnFromThisModel = parent::getConfigData($fieldToLookFor, $store);
 
 
 
 
 
 
86
 
 
 
 
87
  return $returnFromThisModel;
88
  }
89
 
@@ -142,14 +150,24 @@ class Litle_LEcheck_Model_PaymentLogic extends Mage_Payment_Model_Method_Abstrac
142
  }
143
  return NULL;
144
  }
 
 
 
 
 
 
 
 
 
 
145
 
146
  public function merchantData(Varien_Object $payment)
147
  {
148
  $hash = array('user'=> $this->getConfigData("user"),
149
  'password'=> $this->getConfigData("password"),
150
- 'merchantId'=>$this->getConfigData("merchant_id"),
151
  'version'=>'8.10',
152
- 'reportGroup'=>$this->getConfigData("reportGroup"),
153
  'url'=>$this->getConfigData("url"),
154
  'proxy'=>$this->getConfigData("proxy"),
155
  'timeout'=>$this->getConfigData("timeout")
@@ -165,15 +183,22 @@ class Litle_LEcheck_Model_PaymentLogic extends Mage_Payment_Model_Method_Abstrac
165
  $litleResponseCode = XMLParser::getNode($litleResponse,'response');
166
  if($litleResponseCode != "000")
167
  {
168
- $payment
169
- ->setStatus("Rejected")
170
- ->setCcTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
171
- ->setLastTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
172
- ->setTransactionId(XMLParser::getNode($litleResponse,'litleTxnId'))
173
- ->setIsTransactionClosed(0)
174
- ->setTransactionAdditionalInfo("additional_information", XMLParser::getNode($litleResponse,'message'));
175
-
176
- throw new Mage_Payment_Model_Info_Exception(Mage::helper('core')->__("Transaction was not approved. Contact us or try again later."));
 
 
 
 
 
 
 
177
  }
178
  else
179
  {
@@ -254,20 +279,22 @@ class Litle_LEcheck_Model_PaymentLogic extends Mage_Payment_Model_Method_Abstrac
254
  public function refund (Varien_Object $payment, $amount)
255
  {
256
  $order = $payment->getOrder();
257
- $amountToPass = ($amount* 100);
258
- if (!empty($order)){
259
- $hash = array(
260
- 'litleTxnId' => $payment->getCcTransId(),
261
- 'amount' => $amountToPass
262
- );
263
-
264
- $merchantData = $this->merchantData($payment);
265
- $hash_in = array_merge($hash,$merchantData);
266
- $litleRequest = new LitleOnlineRequest();
267
- $litleResponse = $litleRequest->echeckCreditRequest($hash_in);
268
- }
269
-
270
- $this->processResponse($payment,$litleResponse);
 
 
271
  return $this;
272
  }
273
 
63
  */
64
  protected $_canSaveCc = false;
65
 
 
66
  public function assignData($data)
67
  {
68
  if (!($data instanceof Varien_Object)) {
79
 
80
  public function getConfigData($fieldToLookFor, $store = NULL)
81
  {
82
+ $returnFromThisModel = "";
83
+
84
+ if( $fieldToLookFor == "title" || $fieldToLookFor == "active" || $fieldToLookFor == "accounttypes"
85
+ || $fieldToLookFor == "payment_action" || $fieldToLookFor == "order_status"){
86
+ $returnFromThisModel = Mage::getStoreConfig('payment/LEcheck/' . $fieldToLookFor);
87
+ }
88
+ else{
89
+ $returnFromThisModel = Mage::getStoreConfig('payment/CreditCard/' . $fieldToLookFor);
90
+ }
91
 
92
+ if( $returnFromThisModel == NULL )
93
+ $returnFromThisModel = parent::getConfigData($fieldToLookFor, $store);
94
+
95
  return $returnFromThisModel;
96
  }
97
 
150
  }
151
  return NULL;
152
  }
153
+
154
+ public function getMerchantId(Varien_Object $payment){
155
+ $order = $payment->getOrder();
156
+ $currency = $order->getOrderCurrencyCode();
157
+ $string2Eval = 'return array' . $this->getConfigData("merchant_id") . ';';
158
+ $merchant_map = eval($string2Eval);
159
+ $merchantId = $merchant_map[$currency];
160
+ return $merchantId;
161
+ }
162
+
163
 
164
  public function merchantData(Varien_Object $payment)
165
  {
166
  $hash = array('user'=> $this->getConfigData("user"),
167
  'password'=> $this->getConfigData("password"),
168
+ 'merchantId'=>$this->getMerchantId($payment),
169
  'version'=>'8.10',
170
+ 'reportGroup'=>$this->getMerchantId($payment),
171
  'url'=>$this->getConfigData("url"),
172
  'proxy'=>$this->getConfigData("proxy"),
173
  'timeout'=>$this->getConfigData("timeout")
183
  $litleResponseCode = XMLParser::getNode($litleResponse,'response');
184
  if($litleResponseCode != "000")
185
  {
186
+ if(($litleResponseCode === "362") && Mage::helper("creditcard")->isStateOfOrderEqualTo($payment->getOrder(), Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE))
187
+ {
188
+ Mage::throwException("The void did not go through. Do a refund instead.");
189
+ }
190
+ else
191
+ {
192
+ $payment
193
+ ->setStatus("Rejected")
194
+ ->setCcTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
195
+ ->setLastTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
196
+ ->setTransactionId(XMLParser::getNode($litleResponse,'litleTxnId'))
197
+ ->setIsTransactionClosed(0)
198
+ ->setTransactionAdditionalInfo("additional_information", XMLParser::getNode($litleResponse,'message'));
199
+
200
+ throw new Mage_Payment_Model_Info_Exception(Mage::helper('core')->__("Transaction was not approved. Contact us or try again later."));
201
+ }
202
  }
203
  else
204
  {
279
  public function refund (Varien_Object $payment, $amount)
280
  {
281
  $order = $payment->getOrder();
282
+ $isPartialRefund = ($amount < $order->getGrandTotal()) ? true : false;
283
+
284
+ $amountToPass = ($amount* 100);
285
+ if (!empty($order)){
286
+ $hash = array(
287
+ 'litleTxnId' => $payment->getCcTransId(),
288
+ 'amount' => $amountToPass
289
+ );
290
+
291
+ $merchantData = $this->merchantData($payment);
292
+ $hash_in = array_merge($hash,$merchantData);
293
+ $litleRequest = new LitleOnlineRequest();
294
+ $litleResponse = $litleRequest->echeckCreditRequest($hash_in);
295
+ }
296
+
297
+ $this->processResponse($payment,$litleResponse);
298
  return $this;
299
  }
300
 
app/code/local/Litle/LEcheck/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Litle_LEcheck>
5
- <version>0.1.0</version>
6
  </Litle_LEcheck>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Litle_LEcheck>
5
+ <version>8.13.0</version>
6
  </Litle_LEcheck>
7
  </modules>
8
  <global>
app/code/local/Litle/LEcheck/etc/system.xml CHANGED
@@ -38,64 +38,6 @@
38
  <show_in_website>1</show_in_website>
39
  <show_in_store>0</show_in_store>
40
  </accounttypes>
41
- <user translate="label">
42
- <label>User</label>
43
- <frontend_type>text</frontend_type>
44
- <sort_order>3</sort_order>
45
- <show_in_default>1</show_in_default>
46
- <show_in_website>1</show_in_website>
47
- <show_in_store>0</show_in_store>
48
- </user>
49
- <password translate="label">
50
- <label>Password</label>
51
- <frontend_type>text</frontend_type>
52
- <sort_order>4</sort_order>
53
- <show_in_default>1</show_in_default>
54
- <show_in_website>1</show_in_website>
55
- <show_in_store>0</show_in_store>
56
- </password>
57
- <merchant_id translate="label">
58
- <label>Merchant ID</label>
59
- <frontend_type>text</frontend_type>
60
- <sort_order>5</sort_order>
61
- <show_in_default>1</show_in_default>
62
- <show_in_website>1</show_in_website>
63
- <show_in_store>0</show_in_store>
64
- </merchant_id>
65
- <reportGroup translate="label">
66
- <label>Report Group</label>
67
- <frontend_type>text</frontend_type>
68
- <sort_order>6</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
- </reportGroup>
73
- <proxy translate="label">
74
- <label>Http Proxy</label>
75
- <frontend_type>text</frontend_type>
76
- <sort_order>8</sort_order>
77
- <show_in_default>1</show_in_default>
78
- <show_in_website>1</show_in_website>
79
- <show_in_store>0</show_in_store>
80
- </proxy>
81
- <timeout translate="label">
82
- <label>HTTP Timeout</label>
83
- <frontend_type>text</frontend_type>
84
- <sort_order>9</sort_order>
85
- <show_in_default>1</show_in_default>
86
- <show_in_website>1</show_in_website>
87
- <show_in_store>0</show_in_store>
88
- </timeout>
89
- <url translate="label">
90
- <label>HTTP URL</label>
91
- <frontend_type>select</frontend_type>
92
- <source_model>lecheck/url</source_model>
93
- <backend_model>lecheck/validatehttp</backend_model>
94
- <sort_order>7</sort_order>
95
- <show_in_default>1</show_in_default>
96
- <show_in_website>1</show_in_website>
97
- <show_in_store>0</show_in_store>
98
- </url>
99
  <payment_action translate="label">
100
  <label>Payment Action</label>
101
  <frontend_type>select</frontend_type>
@@ -109,7 +51,7 @@
109
  <order_status translate="label">
110
  <label>New Order Status</label>
111
  <frontend_type>select</frontend_type>
112
- <source_model>adminhtml/system_config_source_order_status_processing
113
  </source_model>
114
  <sort_order>7</sort_order>
115
  <show_in_default>1</show_in_default>
38
  <show_in_website>1</show_in_website>
39
  <show_in_store>0</show_in_store>
40
  </accounttypes>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  <payment_action translate="label">
42
  <label>Payment Action</label>
43
  <frontend_type>select</frontend_type>
51
  <order_status translate="label">
52
  <label>New Order Status</label>
53
  <frontend_type>select</frontend_type>
54
+ <source_model>adminhtml/system_config_source_order_status_newprocessing
55
  </source_model>
56
  <sort_order>7</sort_order>
57
  <show_in_default>1</show_in_default>
app/code/local/Litle/LitleSDK/Checker.php CHANGED
@@ -46,7 +46,7 @@ class Checker
46
  }
47
  if ( $i > 1)
48
  {
49
- throw new Exception("Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!");
50
  }
51
  }
52
  }
46
  }
47
  if ( $i > 1)
48
  {
49
+ throw new InvalidArgumentException("Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!");
50
  }
51
  }
52
  }
app/code/local/Litle/LitleSDK/LitleOnline.php CHANGED
@@ -23,7 +23,7 @@
23
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
  * OTHER DEALINGS IN THE SOFTWARE.
25
  */
26
-
27
  error_reporting(E_ALL ^ E_NOTICE);
28
  //ini_set('display_errors', '1');
29
  require_once realpath(dirname(__FILE__)) . '/LitleXmlMapper.php';
@@ -33,3 +33,4 @@ require_once realpath(dirname(__FILE__)) . '/XmlParser.php';
33
  require_once realpath(dirname(__FILE__)) . '/Obj2xml.php';
34
  require_once realpath(dirname(__FILE__)) . '/Checker.php';
35
  require_once realpath(dirname(__FILE__)) . '/LitleOnlineRequest.php';
 
23
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
  * OTHER DEALINGS IN THE SOFTWARE.
25
  */
26
+ define('CURRENT_XML_VERSION', '8.13');
27
  error_reporting(E_ALL ^ E_NOTICE);
28
  //ini_set('display_errors', '1');
29
  require_once realpath(dirname(__FILE__)) . '/LitleXmlMapper.php';
33
  require_once realpath(dirname(__FILE__)) . '/Obj2xml.php';
34
  require_once realpath(dirname(__FILE__)) . '/Checker.php';
35
  require_once realpath(dirname(__FILE__)) . '/LitleOnlineRequest.php';
36
+ require_once realpath(dirname(__FILE__)) . '/UrlMapper.php';
app/code/local/Litle/LitleSDK/LitleOnlineRequest.php CHANGED
@@ -58,8 +58,9 @@ class LitleOnlineRequest
58
  'allowPartialAuth'=>$hash_in['allowPartialAuth'],
59
  'healthcareIIAS'=>(XmlFields::healthcareIIAS($hash_in['healthcareIIAS'])),
60
  'filtering'=>(XmlFields::filteringType($hash_in['filtering'])),
61
- 'merchantData'=>(XmlFields::filteringType($hash_in['merchantData'])),
62
- 'recyclingRequest'=>(XmlFields::recyclingRequestType($hash_in['recyclingRequest'])));
 
63
  }
64
 
65
  $choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
@@ -95,8 +96,9 @@ class LitleOnlineRequest
95
  'allowPartialAuth'=>$hash_in['allowPartialAuth'],
96
  'healthcareIIAS'=>XmlFields::healthcareIIAS($hash_in['healthcareIIAS']),
97
  'filtering'=>XmlFields::filteringType($hash_in['filtering']),
98
- 'merchantData'=>XmlFields::filteringType($hash_in['merchantData']),
99
- 'recyclingRequest'=>XmlFields::recyclingRequestType($hash_in['recyclingRequest']));
 
100
 
101
  $choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
102
  $choice2_hash= array($hash_out['fraudCheck'],$hash_out['cardholderAuthentication']);
@@ -134,7 +136,8 @@ class LitleOnlineRequest
134
  'processingInstructions'=>XmlFields::processingInstructions(XMLFields::returnArrayValue($hash_in, 'processingInstructions')),
135
  'pos'=>XmlFields::pos(XMLFields::returnArrayValue($hash_in, 'pos')),
136
  'amexAggregatorData'=>XmlFields::amexAggregatorData(XMLFields::returnArrayValue($hash_in, 'amexAggregatorData')),
137
- 'payPalNotes' =>XmlFields::returnArrayValue($hash_in, 'payPalNotes')
 
138
  );
139
 
140
  $choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
@@ -309,21 +312,39 @@ class LitleOnlineRequest
309
  'password'=>$hash_in['password'],
310
  'merchantId'=>$hash_in['merchantId'],
311
  'reportGroup'=>$hash_in['reportGroup'],
312
- 'id'=>$hash_in['id'],
313
  'version'=>$hash_in['version'],
314
  'url'=>$hash_in['url'],
315
  'timeout'=>$hash_in['timeout'],
316
  'proxy'=>$hash_in['proxy']);
317
  return $hash_out;
318
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
 
320
  private function processRequest($hash_out, $hash_in, $type, $choice1 = null, $choice2 = null)
321
  {
322
 
323
  $hash_config = LitleOnlineRequest::overideconfig($hash_in);
 
 
324
  Checker::choice($choice1);
325
  Checker::choice($choice2);
326
- $request = Obj2xml::toXml($hash_out,$hash_config, $type);
327
 
328
  $litleOnlineResponse = $this->newXML->request($request,$hash_config);
329
  return $litleOnlineResponse;
58
  'allowPartialAuth'=>$hash_in['allowPartialAuth'],
59
  'healthcareIIAS'=>(XmlFields::healthcareIIAS($hash_in['healthcareIIAS'])),
60
  'filtering'=>(XmlFields::filteringType($hash_in['filtering'])),
61
+ 'merchantData'=>(XmlFields::merchantData($hash_in['merchantData'])),
62
+ 'recyclingRequest'=>(XmlFields::recyclingRequestType($hash_in['recyclingRequest'])),
63
+ 'fraudFilterOverride'=> $hash_in['fraudFilterOverride']);
64
  }
65
 
66
  $choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
96
  'allowPartialAuth'=>$hash_in['allowPartialAuth'],
97
  'healthcareIIAS'=>XmlFields::healthcareIIAS($hash_in['healthcareIIAS']),
98
  'filtering'=>XmlFields::filteringType($hash_in['filtering']),
99
+ 'merchantData'=>XmlFields::merchantData($hash_in['merchantData']),
100
+ 'recyclingRequest'=>XmlFields::recyclingRequestType($hash_in['recyclingRequest']),
101
+ 'fraudFilterOverride'=> $hash_in['fraudFilterOverride']);
102
 
103
  $choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
104
  $choice2_hash= array($hash_out['fraudCheck'],$hash_out['cardholderAuthentication']);
136
  'processingInstructions'=>XmlFields::processingInstructions(XMLFields::returnArrayValue($hash_in, 'processingInstructions')),
137
  'pos'=>XmlFields::pos(XMLFields::returnArrayValue($hash_in, 'pos')),
138
  'amexAggregatorData'=>XmlFields::amexAggregatorData(XMLFields::returnArrayValue($hash_in, 'amexAggregatorData')),
139
+ 'payPalNotes' =>XmlFields::returnArrayValue($hash_in, 'payPalNotes'),
140
+ 'actionReason'=>XmlFields::returnArrayValue($hash_in, 'actionReason')
141
  );
142
 
143
  $choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
312
  'password'=>$hash_in['password'],
313
  'merchantId'=>$hash_in['merchantId'],
314
  'reportGroup'=>$hash_in['reportGroup'],
 
315
  'version'=>$hash_in['version'],
316
  'url'=>$hash_in['url'],
317
  'timeout'=>$hash_in['timeout'],
318
  'proxy'=>$hash_in['proxy']);
319
  return $hash_out;
320
  }
321
+
322
+ private function getOptionalAttributes($hash_in,$hash_out)
323
+ {
324
+ if(isset($hash_in['merchantSdk'])) {
325
+ $hash_out['merchantSdk'] = $hash_in['merchantSdk'];
326
+ }
327
+ else {
328
+ $hash_out['merchantSdk'] = 'PHP;8.13.0';
329
+ }
330
+ if(isset($hash_in['id'])) {
331
+ $hash_out['id'] = $hash_in['id'];
332
+ }
333
+ if(isset($hash_in['customerId'])) {
334
+ $hash_out['customerId'] = $hash_in['customerId'];
335
+ }
336
+ return $hash_out;
337
+ }
338
 
339
  private function processRequest($hash_out, $hash_in, $type, $choice1 = null, $choice2 = null)
340
  {
341
 
342
  $hash_config = LitleOnlineRequest::overideconfig($hash_in);
343
+
344
+ $hash = LitleOnlineRequest::getOptionalAttributes($hash_in,$hash_out);
345
  Checker::choice($choice1);
346
  Checker::choice($choice2);
347
+ $request = Obj2xml::toXml($hash,$hash_config, $type);
348
 
349
  $litleOnlineResponse = $this->newXML->request($request,$hash_config);
350
  return $litleOnlineResponse;
app/code/local/Litle/LitleSDK/Obj2xml.php CHANGED
@@ -22,6 +22,7 @@
22
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
  * OTHER DEALINGS IN THE SOFTWARE.
24
  */
 
25
  class Obj2xml {
26
 
27
  public static function toXml($data, $hash_config, $type, $rootNodeName = 'litleOnlineRequest', $xml=null)
@@ -30,6 +31,8 @@ class Obj2xml {
30
  $xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$rootNodeName />");
31
  $xml-> addAttribute('merchantId',$config["merchantId"]);
32
  $xml-> addAttribute('version',$config["version"]);
 
 
33
  $xml-> addAttribute('xmlns:xmlns','http://www.litle.com/schema');// does not show up on browser docs
34
  $authentication = $xml->addChild('authentication');
35
  $authentication->addChild('user',$config["user"]);
@@ -39,16 +42,17 @@ class Obj2xml {
39
  ($transacType-> addAttribute('partial',$data["partial"]));
40
  };
41
  unset($data['partial']);
42
- #merchant SDK attribute $transacType-> addAttribute('partial',$data["partial"])
43
- if(isset($config['customerId'])) {
44
- ($transacType-> addAttribute('customerId',$config["customerId"]));
45
  };
 
46
  if(isset($config['reportGroup'])) {
47
  ($transacType-> addAttribute('reportGroup',$config["reportGroup"]));
48
  };
49
- if(isset($config['id'])) {
50
- ($transacType-> addAttribute('id',$config["id"]));
51
  };
 
52
  Obj2xml::iterateChildren($data,$transacType);
53
  return $xml->asXML();
54
  }
@@ -56,8 +60,14 @@ class Obj2xml {
56
  private function iterateChildren($data,$transacType){
57
  foreach($data as $key => $value)
58
  {
59
- if ($value == "REQUIRED"){
60
- throw new Exception("Missing Required Field: /$key/");
 
 
 
 
 
 
61
  }elseif (((is_string($value)) || is_numeric($value))) {
62
  $transacType->addChild($key,$value);
63
  }elseif(is_array($value))
@@ -82,9 +92,13 @@ class Obj2xml {
82
  }else{
83
  if ($name == 'merchantId'){
84
  $config['merchantId'] = $config_array['currency_merchant_map']['DEFAULT'];
 
 
 
 
85
  }else {
86
  if ((!isset($config_array[$name])) and ($name != 'proxy')){
87
- throw new Exception("Missing Field /$name/");
88
  }
89
  $config[$name] = $config_array[$name];
90
  }
22
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
  * OTHER DEALINGS IN THE SOFTWARE.
24
  */
25
+ require_once realpath(dirname(__FILE__)) . '/LitleOnline.php';
26
  class Obj2xml {
27
 
28
  public static function toXml($data, $hash_config, $type, $rootNodeName = 'litleOnlineRequest', $xml=null)
31
  $xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$rootNodeName />");
32
  $xml-> addAttribute('merchantId',$config["merchantId"]);
33
  $xml-> addAttribute('version',$config["version"]);
34
+ $xml-> addAttribute('merchantSdk',$data['merchantSdk']);
35
+ unset($data['merchantSdk']);
36
  $xml-> addAttribute('xmlns:xmlns','http://www.litle.com/schema');// does not show up on browser docs
37
  $authentication = $xml->addChild('authentication');
38
  $authentication->addChild('user',$config["user"]);
42
  ($transacType-> addAttribute('partial',$data["partial"]));
43
  };
44
  unset($data['partial']);
45
+ if(isset($data['customerId'])) {
46
+ ($transacType-> addAttribute('customerId',$data["customerId"]));
 
47
  };
48
+ unset($data['customerId']);
49
  if(isset($config['reportGroup'])) {
50
  ($transacType-> addAttribute('reportGroup',$config["reportGroup"]));
51
  };
52
+ if(isset($data['id'])) {
53
+ ($transacType-> addAttribute('id',$data["id"]));
54
  };
55
+ unset($data['id']);
56
  Obj2xml::iterateChildren($data,$transacType);
57
  return $xml->asXML();
58
  }
60
  private function iterateChildren($data,$transacType){
61
  foreach($data as $key => $value)
62
  {
63
+ if ($value === "REQUIRED"){
64
+ throw new InvalidArgumentException("Missing Required Field: /$key/");
65
+ }elseif (substr($key,0,-1) == 'lineItemData'){
66
+ $temp_node = $transacType->addChild('lineItemData');
67
+ Obj2xml::iterateChildren($value,$temp_node);
68
+ }elseif (substr($key,0,-1) == 'detailTax'){
69
+ $temp_node = $transacType->addChild('detailTax');
70
+ Obj2xml::iterateChildren($value,$temp_node);
71
  }elseif (((is_string($value)) || is_numeric($value))) {
72
  $transacType->addChild($key,$value);
73
  }elseif(is_array($value))
92
  }else{
93
  if ($name == 'merchantId'){
94
  $config['merchantId'] = $config_array['currency_merchant_map']['DEFAULT'];
95
+ }else if ($name == 'version'){
96
+ $config['version'] = isset($config_array['version'])? $config_array['version']:CURRENT_XML_VERSION;
97
+ }else if ($name == 'timeout'){
98
+ $config['timeout'] = isset($config_array['timeout'])? $config_array['timeout']:'65';
99
  }else {
100
  if ((!isset($config_array[$name])) and ($name != 'proxy')){
101
+ throw new InvalidArgumentException("Missing Field /$name/");
102
  }
103
  $config[$name] = $config_array[$name];
104
  }
app/code/local/Litle/LitleSDK/Setup.php CHANGED
@@ -22,6 +22,8 @@
22
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
  * OTHER DEALINGS IN THE SOFTWARE.
24
  */
 
 
25
  function writeConfig($line,$handle){
26
  foreach ($line as $keys => $values){
27
  fwrite($handle, $keys. '');
@@ -50,36 +52,18 @@ function initialize(){
50
  print "Please input your merchantId: ";
51
  $line['currency_merchant_map ']['DEFAULT'] = trim(fgets(STDIN));
52
  print "Please choose Litle url from the following list (example: 'cert') or directly input another URL: \nsandbox => https://www.testlitle.com/sandbox/communicator/online \ncert => https://cert.litle.com/vap/communicator/online \nprecert => https://precert.litle.com/vap/communicator/online \nproduction1 => https://payments.litle.com/vap/communicator/online \nproduction2 => https://payments2.litle.com/vap/communicator/online" . PHP_EOL;
53
- $url = urlMapper(trim(fgets(STDIN)));
54
  $line['url'] = $url;
55
  print "Please input the proxy, if no proxy hit enter key: ";
56
  $line['proxy'] = trim(fgets(STDIN));
57
  writeConfig($line,$handle);
58
- fwrite($handle, "version = 8.10" . PHP_EOL);
59
  fwrite($handle, "timeout = 65". PHP_EOL);
60
- fwrite($handle, "reportGroup = planets". PHP_EOL);
61
  }
62
  fclose($handle);
63
  print "The Litle configuration file has been generated, the file is located in the lib directory". PHP_EOL;
64
  }
65
 
66
-
67
-
68
- function urlMapper($litleEnv){
69
- $litleOnlineCtx = 'vap/communicator/online';
70
- if ($litleEnv == "sandbox")
71
- return 'https://www.testlitle.com/sandbox/communicator/online';
72
- elseif ($litleEnv == "cert")
73
- return 'https://cert.litle.com/' . $litleOnlineCtx;
74
- elseif ($litleEnv == "precert")
75
- return 'https://precert.litle.com/' . $litleOnlineCtx;
76
- elseif ($litleEnv == "production1")
77
- return 'https://payments.litle.com/' . $litleOnlineCtx;
78
- elseif ($litleEnv == "production2")
79
- return 'https://payments2.litle.com/' . $litleOnlineCtx;
80
- else
81
- return 'https://www.testlitle.com/sandbox/communicator/online';
82
- }
83
-
84
  initialize();
85
 
22
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
  * OTHER DEALINGS IN THE SOFTWARE.
24
  */
25
+ require_once realpath(dirname(__FILE__)) . '/LitleOnline.php';
26
+
27
  function writeConfig($line,$handle){
28
  foreach ($line as $keys => $values){
29
  fwrite($handle, $keys. '');
52
  print "Please input your merchantId: ";
53
  $line['currency_merchant_map ']['DEFAULT'] = trim(fgets(STDIN));
54
  print "Please choose Litle url from the following list (example: 'cert') or directly input another URL: \nsandbox => https://www.testlitle.com/sandbox/communicator/online \ncert => https://cert.litle.com/vap/communicator/online \nprecert => https://precert.litle.com/vap/communicator/online \nproduction1 => https://payments.litle.com/vap/communicator/online \nproduction2 => https://payments2.litle.com/vap/communicator/online" . PHP_EOL;
55
+ $url = UrlMapper::getUrl(trim(fgets(STDIN)));
56
  $line['url'] = $url;
57
  print "Please input the proxy, if no proxy hit enter key: ";
58
  $line['proxy'] = trim(fgets(STDIN));
59
  writeConfig($line,$handle);
60
+ fwrite($handle, "version = 8.13" . PHP_EOL);
61
  fwrite($handle, "timeout = 65". PHP_EOL);
62
+ fwrite($handle, "reportGroup = Default Report Group". PHP_EOL);
63
  }
64
  fclose($handle);
65
  print "The Litle configuration file has been generated, the file is located in the lib directory". PHP_EOL;
66
  }
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  initialize();
69
 
app/code/local/Litle/LitleSDK/UrlMapper.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2011 Litle & Co.
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person
6
+ * obtaining a copy of this software and associated documentation
7
+ * files (the "Software"), to deal in the Software without
8
+ * restriction, including without limitation the rights to use,
9
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following
12
+ * conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be
15
+ * included in all copies or substantial portions of the Software.
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
17
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
+ * OTHER DEALINGS IN THE SOFTWARE.
24
+ */
25
+ class UrlMapper
26
+ {
27
+ public static function getUrl($litleEnv){
28
+ $litleOnlineCtx = 'vap/communicator/online';
29
+ if ($litleEnv == "sandbox")
30
+ return 'https://www.testlitle.com/sandbox/communicator/online';
31
+ elseif ($litleEnv == "cert")
32
+ return 'https://cert.litle.com/' . $litleOnlineCtx;
33
+ elseif ($litleEnv == "precert")
34
+ return 'https://precert.litle.com/' . $litleOnlineCtx;
35
+ elseif ($litleEnv == "production1")
36
+ return 'https://payments.litle.com/' . $litleOnlineCtx;
37
+ elseif ($litleEnv == "production2")
38
+ return 'https://payments2.litle.com/' . $litleOnlineCtx;
39
+ else
40
+ return 'https://www.testlitle.com/sandbox/communicator/online';
41
+ }
42
+ }
app/code/local/Litle/LitleSDK/XmlFields.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- * Copyright (c) 2011 Litle & Co.
4
  *
5
  * Permission is hereby granted, free of charge, to any person
6
  * obtaining a copy of this software and associated documentation
@@ -116,6 +116,20 @@ class XmlFields
116
  }
117
  }
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  public static function authInformation($hash_in)
120
  {
121
  if (isset($hash_in))
@@ -237,10 +251,23 @@ class XmlFields
237
  "destinationPostalCode"=>XmlFields::returnArrayValue($hash_in, "destinationPostalCode"),
238
  "destinationCountryCode"=>XmlFields::returnArrayValue($hash_in, "destinationCountryCode"),
239
  "invoiceReferenceNumber"=>XmlFields::returnArrayValue($hash_in, "invoiceReferenceNumber"),
240
- "orderDate"=>XmlFields::returnArrayValue($hash_in, "orderDate"),
241
- "detailTax"=>(XmlFields::detailTax(XmlFields::returnArrayValue($hash_in, "detailTax"))),
242
- "lineItemData"=>(XmlFields::lineItemData(XmlFields::returnArrayValue($hash_in, "lineItemData")))
243
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  return $hash_out;
245
  }
246
  }
@@ -279,7 +306,7 @@ class XmlFields
279
  $hash_out = array(
280
  "litleToken"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "litleToken"))),
281
  "expDate"=>XmlFields::returnArrayValue($hash_in, "expDate"),
282
- "cardValidationNum"=>XmlFields::returnArrayValue($hash_in, "cardValidationNumber"),
283
  "type"=>XmlFields::returnArrayValue($hash_in, "type")
284
  );
285
  return $hash_out;
@@ -293,7 +320,7 @@ class XmlFields
293
  $hash_out = array(
294
  "paypageRegistrationId"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "paypageRegistrationId"))),
295
  "expDate"=>XmlFields::returnArrayValue($hash_in, "expDate"),
296
- "cardValidationNum"=>XmlFields::returnArrayValue($hash_in, "cardValidationNumber"),
297
  "type"=>XmlFields::returnArrayValue($hash_in, "type")
298
  );
299
  return $hash_out;
@@ -326,6 +353,7 @@ class XmlFields
326
  }
327
  }
328
 
 
329
  public static function customBilling($hash_in)
330
  {
331
  if (isset($hash_in))
1
  <?php
2
  /*
3
+ * Copyright (c) 2011 Litle & Co.
4
  *
5
  * Permission is hereby granted, free of charge, to any person
6
  * obtaining a copy of this software and associated documentation
116
  }
117
  }
118
 
119
+ public static function merchantData($hash_in)
120
+ {
121
+ if (isset($hash_in))
122
+ {
123
+ $hash_out = array(
124
+ "campaign"=>XmlFields::returnArrayValue($hash_in, "campaign"),
125
+ "affiliate"=>XmlFields::returnArrayValue($hash_in, "affiliate"),
126
+ "merchantGroupingId"=>XmlFields::returnArrayValue($hash_in, "merchantGroupingId")
127
+ );
128
+ return $hash_out;
129
+ }
130
+ }
131
+
132
+
133
  public static function authInformation($hash_in)
134
  {
135
  if (isset($hash_in))
251
  "destinationPostalCode"=>XmlFields::returnArrayValue($hash_in, "destinationPostalCode"),
252
  "destinationCountryCode"=>XmlFields::returnArrayValue($hash_in, "destinationCountryCode"),
253
  "invoiceReferenceNumber"=>XmlFields::returnArrayValue($hash_in, "invoiceReferenceNumber"),
254
+ "orderDate"=>XmlFields::returnArrayValue($hash_in, "orderDate")
 
 
255
  );
256
+ foreach ($hash_in as $key => $value){
257
+ if ($key == 'lineItemData' && $key != NULL){
258
+ $lineItem = array();
259
+ for($j=0; $j<count($value); $j++){
260
+ $hash_out[('lineItemData' . (string)$j)] = XmlFields::lineItemData($value[$j]);
261
+ }
262
+ }
263
+ elseif ($key == 'detailTax' & $key != NULL){
264
+ $detailtax = array();
265
+ for($j=0; $j<count($value); $j++){
266
+ $hash_out[('detailTax' . (string)$j)] = XmlFields::detailTax($value[$j]);
267
+ }
268
+ }
269
+ }
270
+
271
  return $hash_out;
272
  }
273
  }
306
  $hash_out = array(
307
  "litleToken"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "litleToken"))),
308
  "expDate"=>XmlFields::returnArrayValue($hash_in, "expDate"),
309
+ "cardValidationNum"=>XmlFields::returnArrayValue($hash_in, "cardValidationNum"),
310
  "type"=>XmlFields::returnArrayValue($hash_in, "type")
311
  );
312
  return $hash_out;
320
  $hash_out = array(
321
  "paypageRegistrationId"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "paypageRegistrationId"))),
322
  "expDate"=>XmlFields::returnArrayValue($hash_in, "expDate"),
323
+ "cardValidationNum"=>XmlFields::returnArrayValue($hash_in, "cardValidationNum"),
324
  "type"=>XmlFields::returnArrayValue($hash_in, "type")
325
  );
326
  return $hash_out;
353
  }
354
  }
355
 
356
+
357
  public static function customBilling($hash_in)
358
  {
359
  if (isset($hash_in))
app/code/local/Litle/Palorus/Block/Adminhtml/Palorus/Insight/Tab.php ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_Palorus_Block_Adminhtml_Palorus_Insight_Tab
4
+ extends Mage_Adminhtml_Block_Widget_Grid
5
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface {
6
+
7
+ /**
8
+ * Set the template for the block
9
+ *
10
+ */
11
+ public function _construct()
12
+ {
13
+ parent::_construct();
14
+ $this->setId('litle_customer_orders_grid');
15
+ $this->setDefaultSort('order_number', 'desc');
16
+ $this->setUseAjax(true);
17
+ $this->setPagerVisibility(false);
18
+ $this->setFilterVisibility(false);
19
+ }
20
+
21
+ protected function _prepareCollection()
22
+ {
23
+ $customerId = Mage::registry('current_customer')->getId();
24
+ $collection = Mage::getModel('palorus/insight')
25
+ ->getCollection()
26
+ ->addFieldToFilter('customer_id',$customerId);
27
+
28
+ $this->setCollection($collection);
29
+ return parent::_prepareCollection();
30
+ }
31
+
32
+ protected function _prepareColumns()
33
+ {
34
+ $this->addColumn('order_number', array(
35
+ 'header' => 'Order Number',
36
+ 'width' => '100',
37
+ 'index' => 'order_number',
38
+ 'sortable' => false,
39
+ ));
40
+ $this->addColumn('last', array(
41
+ 'header' => 'Last 4',
42
+ 'width' => '100',
43
+ 'index' => 'last',
44
+ 'sortable' => false,
45
+ ));
46
+ $this->addColumn('order_amount', array(
47
+ 'header' => 'Order Amount',
48
+ 'width' => '100',
49
+ 'index' => 'order_amount',
50
+ 'sortable' => false,
51
+ ));
52
+ $this->addColumn('affluence', array(
53
+ 'header' => 'Affluence',
54
+ 'width' => '100',
55
+ 'index' => 'affluence',
56
+ 'sortable' => false,
57
+ ));
58
+ $this->addColumn('issuing_country', array(
59
+ 'header' => 'Issuing Country',
60
+ 'width' => '100',
61
+ 'index' => 'issuing_country',
62
+ 'sortable' => false,
63
+ ));
64
+ $this->addColumn('prepaid_card_type', array(
65
+ 'header' => 'Prepaid Card Type',
66
+ 'width' => '100',
67
+ 'index' => 'prepaid_card_type',
68
+ 'sortable' => false,
69
+ ));
70
+ $this->addColumn('funding_source', array(
71
+ 'header' => 'Funding Source',
72
+ 'width' => '100',
73
+ 'index' => 'funding_source',
74
+ 'sortable' => false,
75
+ ));
76
+ $this->addColumn('available_balance', array(
77
+ 'header' => 'Available Balance',
78
+ 'width' => '100',
79
+ 'index' => 'available_balance',
80
+ 'sortable' => false,
81
+ ));
82
+ $this->addColumn('reloadable', array(
83
+ 'header' => 'Reloadable',
84
+ 'width' => '100',
85
+ 'index' => 'reloadable',
86
+ 'sortable' => false,
87
+ ));
88
+ return parent::_prepareColumns();
89
+ }
90
+
91
+ public function getRowUrl($row)
92
+ {
93
+ return $this->getUrl('*/sales_order/view', array('order_id' => $row->getOrderId()));
94
+ }
95
+
96
+ public function getGridUrl()
97
+ {
98
+ // Mage::log("Get grid url");
99
+ // return $this->getUrl('*/*/orders', array('_current' => true));
100
+ }
101
+
102
+ /**
103
+ * Retrieve the label used for the tab relating to this block
104
+ *
105
+ * @return string
106
+ */
107
+ public function getTabLabel()
108
+ {
109
+ return $this->__('Litle & Co. Customer Insight');
110
+ }
111
+
112
+ /**
113
+ * Retrieve the title used by this tab
114
+ *
115
+ * @return string
116
+ */
117
+ public function getTabTitle()
118
+ {
119
+ return $this->__('Click here to view Litle & Co. Customer Insight');
120
+ }
121
+
122
+ /**
123
+ * Determines whether to display the tab
124
+ * Add logic here to decide whether you want the tab to display
125
+ *
126
+ * @return bool
127
+ */
128
+ public function canShowTab()
129
+ {
130
+ return true;
131
+ }
132
+
133
+ /**
134
+ * Stops the tab being hidden
135
+ *
136
+ * @return bool
137
+ */
138
+ public function isHidden()
139
+ {
140
+ return false;
141
+ }
142
+
143
+ /**
144
+ * AJAX TAB's
145
+ * If you want to use an AJAX tab, uncomment the following functions
146
+ * Please note that you will need to setup a controller to recieve
147
+ * the tab content request
148
+ *
149
+ */
150
+ /**
151
+ * Retrieve the class name of the tab
152
+ * Return 'ajax' here if you want the tab to be loaded via Ajax
153
+ *
154
+ * return string
155
+ */
156
+ // public function getTabClass()
157
+ // {
158
+ // return 'ajax';
159
+ // }
160
+
161
+ // /**
162
+ // * Determine whether to generate content on load or via AJAX
163
+ // * If true, the tab's content won't be loaded until the tab is clicked
164
+ // * You will need to setup a controller to handle the tab request
165
+ // *
166
+ // * @return bool
167
+ // */
168
+ // public function getSkipGenerateContent()
169
+ // {
170
+ // //return true;
171
+ // return false;
172
+ // }
173
+
174
+ // /**
175
+ // * Retrieve the URL used to load the tab content
176
+ // * Return the URL here used to load the content by Ajax
177
+ // * see self::getSkipGenerateContent & self::getTabClass
178
+ // *
179
+ // * @return string
180
+ // */
181
+ // public function getTabUrl()
182
+ // {
183
+ // return null;
184
+ // //http://127.0.0.1/magento/index.php/palrous/adminhtml_myform/insight/
185
+ // //http://127.0.0.1/magento/index.php/palorus/adminhtml_myform/activity/
186
+ // //return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . 'palrous/adminhtml_myform/';
187
+ // //return 'http://127.0.0.1/magento/index.php/palorus/adminhtml_myform/activity/';
188
+ // }
189
+
190
+ }
app/code/local/Litle/Palorus/Block/Adminhtml/Transaction.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Plieninger Editable Module
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-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
+ *
22
+ * @category Plieninger
23
+ * @package Plieninger_Editable
24
+ * @copyright Copyright (c) 2009 Andreas Plieninger
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
26
+ * @author Andreas Plieninger <aplieninger@gmx.de> www.plieninger.org
27
+ * @version 0.1.0
28
+ * @date 18.12.2009
29
+ */
30
+
31
+
32
+ class Litle_Palorus_Block_Adminhtml_Transaction extends Mage_Adminhtml_Block_Sales_Transactions_Detail {
33
+ public function __construct() {
34
+ parent::__construct();
35
+ }
36
+
37
+ protected function _beforeToHtml() {
38
+ parent::_beforeToHtml();
39
+ }
40
+
41
+ public function getTxnIdHtml() {
42
+
43
+ $litle = new Litle_CreditCard_Model_PaymentLogic();
44
+ $url = $litle->getConfigData("url");
45
+ $litleTxnId = $this->_txn->getTxnId();
46
+ $txnType = $this->_txn->getTxnType();
47
+ $method = $this->_txn->getOrderPaymentObject()->getMethod();
48
+
49
+ Mage::log("Litle_Palorus_Block_Adminhtml_Transaction:getTxnIdHtml - method: $method; txnType: $txnType; url: $url; litleTxnId: $litleTxnId", Zend_Log::DEBUG);
50
+ $html = Litle_Palorus_Block_Adminhtml_Transaction::_getTxnIdHtml($txnType, $method, $url, $litleTxnId);
51
+ if($html == NULL) {
52
+ return parent::getTxnIdHtml();
53
+ }
54
+ else {
55
+ return $html;
56
+ }
57
+ }
58
+
59
+ static function _getTxnIdHtml($txnType, $method, $url, $litleTxnId) {
60
+ $litleTxnIdOrig = $litleTxnId;
61
+ if($method != 'creditcard' && $method != 'lecheck') {
62
+ return null;
63
+ }
64
+ if($txnType == 'authorization') {
65
+ if($method == 'lecheck'){
66
+ $litleTxnType = 'echeck/verification';
67
+ }
68
+ else{
69
+ $litleTxnType = 'authorization';
70
+ }
71
+ }
72
+ else if($txnType == 'capture') {
73
+ if($method == 'lecheck'){
74
+ $litleTxnType = 'echeck/deposit';
75
+ }
76
+ else{
77
+ $litleTxnType = 'deposit';
78
+ }
79
+ }
80
+ else if($txnType == 'refund') {
81
+ if($method == 'lecheck'){
82
+ $litleTxnType = 'echeck/refund';
83
+ }
84
+ else{
85
+ $litleTxnType = 'refund';
86
+ }
87
+ }
88
+ else if($txnType == 'void') {
89
+ if(preg_match("/(\d{18})-void/",$litleTxnId,$matches)) {
90
+ $litleTxnId = $matches[1];
91
+ $litleTxnType = 'authorization/reversal';
92
+ }
93
+ else {
94
+ return null;
95
+ }
96
+ }
97
+
98
+ //$baseUrl = Mage::helper("palorus")->getBaseUrl($url);
99
+ $helper = new Litle_Palorus_Helper_Data();
100
+ $baseUrl = $helper->getBaseUrlFrom($url);
101
+ return "<a href='$baseUrl/ui/reports/payments/$litleTxnType/$litleTxnId'>$litleTxnIdOrig</a>";
102
+ }
103
+
104
+ }
app/code/local/Litle/Palorus/Helper/Data.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Litle_Palorus_Helper_Data extends Mage_Core_Helper_Abstract
5
+ {
6
+
7
+ public function saveCustomerInsight($payment, $litleResponse) {
8
+ preg_match('/.*(\d\d\d\d)/', $payment->getCcNumber(), $matches);
9
+ $last4 = $matches[1];
10
+ $data = array(
11
+ 'customer_id' => $payment->getOrder()->getCustomerId(),
12
+ 'order_number' => XMLParser::getNode($litleResponse, 'orderId'),
13
+ 'order_id' => $payment->getOrder()->getId(),
14
+ 'affluence' => Litle_Palorus_Helper_Data::formatAffluence(XMLParser::getNode($litleResponse,"affluence")),
15
+ 'last' => $last4,
16
+ 'order_amount' => Litle_Palorus_Helper_Data::formatAvailableBalance($amountToPass),
17
+ 'affluence' => Litle_Palorus_Helper_Data::formatAffluence(XMLParser::getNode($litleResponse,"affluence")),
18
+ 'issuing_country' => XMLParser::getNode($litleResponse, 'issuerCountry'),
19
+ 'prepaid_card_type' => Litle_Palorus_Helper_Data::formatPrepaidCardType(XMLParser::getNode($litleResponse, 'prepaidCardType')),
20
+ 'funding_source'=> Litle_Palorus_Helper_Data::formatFundingSource(XMLParser::getNode($litleResponse, 'type')),
21
+ 'available_balance' => Litle_Palorus_Helper_Data::formatAvailableBalance(XMLParser::getNode($litleResponse, 'availableBalance')),
22
+ 'reloadable' => Litle_Palorus_Helper_Data::formatReloadable(XMLParser::getNode($litleResponse, 'reloadable')),
23
+ );
24
+ Mage::getModel('palorus/insight')->setData($data)->save();
25
+ }
26
+
27
+ public function saveVault($payment, $litleResponse) {
28
+ preg_match('/.*(\d\d\d\d)/', $payment->getCcNumber(), $matches);
29
+ $last4 = $matches[1];
30
+ $token = XMLParser::getNode($litleResponse, 'litleToken');
31
+ if($token == NULL) {
32
+ return;
33
+ }
34
+ $data = array(
35
+ 'customer_id' => $payment->getOrder()->getCustomerId(),
36
+ 'order_id' => $payment->getOrder()->getId(),
37
+ 'last4' => $last4,
38
+ 'token'=> XMLParser::getNode($litleResponse, 'litleToken'),
39
+ 'type' => XMLParser::getNode($litleResponse, 'type'),
40
+ 'bin' => XMLParser::getNode($litleResponse, 'bin')
41
+ );
42
+ Mage::getModel('palorus/vault')->setData($data)->save();
43
+ }
44
+
45
+ public function getBaseUrl() {
46
+ $litle = new Litle_CreditCard_Model_PaymentLogic();
47
+ $url = $litle->getConfigData("url");
48
+ return Litle_Palorus_Helper_Data::getBaseUrlFrom($url);
49
+ }
50
+
51
+ static public function getBaseUrlFrom($url) {
52
+ if(preg_match("/payments/",$url)) {
53
+ $baseUrl = "https://reports.litle.com";
54
+ }
55
+ else if(preg_match("/sandbox/",$url)) {
56
+ $baseUrl = "https://www.testlitle.com/sandbox";
57
+ }
58
+ else if(preg_match("/precert/",$url)) {
59
+ $baseUrl = "https://reports.precert.litle.com";
60
+ }
61
+ else if(preg_match("/cert/",$url)) {
62
+ $baseUrl = "https://reports.cert.litle.com";
63
+ }
64
+ else {
65
+ $baseUrl = "http://localhost:2190";
66
+ }
67
+ return $baseUrl;
68
+ }
69
+
70
+
71
+ static public function formatAvailableBalance ($balance)
72
+ {
73
+ return Litle_Palorus_Helper_Data::formatMoney($balance);
74
+ }
75
+
76
+ static public function formatAffluence($affluence) {
77
+ if($affluence === '' || $affluence === NULL) {
78
+ return '';
79
+ }
80
+ else if($affluence == 'AFFLUENT') {
81
+ return 'Affluent';
82
+ }
83
+ else if($affluence == 'MASS AFFLUENT') {
84
+ return 'Mass Affluent';
85
+ }
86
+ else {
87
+ return $affluence;
88
+ }
89
+ }
90
+
91
+ static public function formatFundingSource($prepaid) {
92
+ if($prepaid == 'FSA') {
93
+ return "FSA";
94
+ }
95
+ return Litle_Palorus_Helper_Data::capitalize($prepaid);
96
+ }
97
+
98
+ static public function formatPrepaidCardType($prepaidCardType) {
99
+ return Litle_Palorus_Helper_Data::capitalize($prepaidCardType);
100
+ }
101
+
102
+ static public function formatReloadable($reloadable) {
103
+ return Litle_Palorus_Helper_Data::capitalize($reloadable);
104
+ }
105
+
106
+ static private function capitalize($original) {
107
+ if($original === '' || $original === NULL) {
108
+ return '';
109
+ }
110
+ $lower = strtolower($original);
111
+ return ucfirst($lower);
112
+ }
113
+
114
+ static private function formatMoney($balance) {
115
+ if ($balance === '' || $balance === NULL){
116
+ $available_balance = '';
117
+ }
118
+ else{
119
+ $balance = str_pad($balance, 3, '0', STR_PAD_LEFT);
120
+ $available_balance = substr_replace($balance, '.', -2, 0);
121
+ $available_balance = '$' . $available_balance;
122
+ }
123
+
124
+ return $available_balance;
125
+ }
126
+
127
+
128
+ }
app/code/local/Litle/Palorus/Model/Insight.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_Palorus_Model_Insight extends Mage_Core_Model_Abstract
4
+ {
5
+ protected $_model = NULL;
6
+
7
+ protected function _construct()
8
+ {
9
+ $this->_model = 'palorus/insight';
10
+ $this->_init($this->_model);
11
+ }
12
+
13
+ }
app/code/local/Litle/Palorus/Model/Mysql4/Insight.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_Palorus_Model_Mysql4_Insight extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('palorus/insight', 'customer_insight_id');
8
+ }
9
+ }
app/code/local/Litle/Palorus/Model/Mysql4/Insight/Collection.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_Palorus_Model_Mysql4_Insight_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('palorus/insight');
9
+ }
10
+
11
+ }
app/code/local/Litle/Palorus/Model/Mysql4/Vault.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_Palorus_Model_Mysql4_Vault extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('palorus/vault', 'vault_id');
8
+ }
9
+ }
app/code/local/Litle/Palorus/Model/Mysql4/Vault/Collection.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_Palorus_Model_Mysql4_Vault_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('palorus/vault');
9
+ }
10
+
11
+ }
app/code/local/Litle/Palorus/Model/Vault.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_Palorus_Model_Vault extends Mage_Core_Model_Abstract
4
+ {
5
+ protected $_model = NULL;
6
+
7
+ protected function _construct()
8
+ {
9
+ $this->_model = 'palorus/vault';
10
+ $this->_init($this->_model);
11
+ }
12
+
13
+ }
app/code/local/Litle/Palorus/controllers/Adminhtml/MyformController.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_Palorus_Adminhtml_MyformController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function activityAction()
6
+ {
7
+ $this->_redirectUrl(Mage::helper('palorus')->getBaseUrl() . '/ui/reports/activity');
8
+ }
9
+
10
+ public function authorizationAction()
11
+ {
12
+ $this->_redirectUrl(Mage::helper('palorus')->getBaseUrl() . '/ui/reports/authorization');
13
+ }
14
+
15
+ public function exchangeAction()
16
+ {
17
+ $this->_redirectUrl(Mage::helper('palorus')->getBaseUrl() . '/ui/reports/exchange');
18
+ }
19
+
20
+ public function binlookupAction()
21
+ {
22
+ $this->_redirectUrl(Mage::helper('palorus')->getBaseUrl() . '/ui/reports/binlookup');
23
+ }
24
+
25
+ public function sessionAction()
26
+ {
27
+ $this->_redirectUrl(Mage::helper('palorus')->getBaseUrl() . '/ui/reports/operator/PresenterSessions.cgi?reportAction=LoadDefault');
28
+ }
29
+
30
+ public function settlementAction()
31
+ {
32
+ $this->_redirectUrl(Mage::helper('palorus')->getBaseUrl() . '/ui/reports/settlement');
33
+ }
34
+
35
+ public function searchAction()
36
+ {
37
+ $this->_redirectUrl(Mage::helper('palorus')->getBaseUrl() . '/ui/transactions/search');
38
+ }
39
+
40
+ public function summaryAction()
41
+ {
42
+ $this->_redirectUrl(Mage::helper('palorus')->getBaseUrl() . '/ui/reports/transactions/summary');
43
+ }
44
+
45
+ public function dashboardauthorizationAction()
46
+ {
47
+ $this->_redirectUrl(Mage::helper('palorus')->getBaseUrl() . '/ui/dashboards/authorization');
48
+ }
49
+
50
+ public function dashboardfrauddetectionAction()
51
+ {
52
+ $this->_redirectUrl(Mage::helper('palorus')->getBaseUrl() . '/ui/dashboards/fraudDetection');
53
+ }
54
+
55
+ public function dashboardpostdepositfraudimpactAction()
56
+ {
57
+ $this->_redirectUrl(Mage::helper('palorus')->getBaseUrl() . '/ui/dashboards/postDepositFraud');
58
+ }
59
+
60
+ public function chargebackSearchAction()
61
+ {
62
+ $this->_redirectUrl(Mage::helper('palorus')->getBaseUrl() . '/ui/chargebacks/search');
63
+ }
64
+
65
+ public function chargebackReportAction()
66
+ {
67
+ $this->_redirectUrl(Mage::helper('palorus')->getBaseUrl() . '/ui/reports/chargebacks/compliance');
68
+ }
69
+
70
+ public function postAction()
71
+ {
72
+ Mage::log("insightAction");
73
+ echo "hi from insight";
74
+ }
75
+
76
+
77
+ }
app/code/local/Litle/Palorus/etc/config.xml ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Litle_Palorus>
5
+ <version>8.13.0</version>
6
+ </Litle_Palorus>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <palorus>
11
+ <class>Litle_Palorus_Model</class>
12
+ <resourceModel>palorus_mysql4</resourceModel>
13
+ </palorus>
14
+ <palorus_mysql4>
15
+ <class>Litle_Palorus_Model_Mysql4</class>
16
+ <entities>
17
+ <insight>
18
+ <table>litle_customer_insight</table>
19
+ </insight>
20
+ <vault>
21
+ <table>litle_vault</table>
22
+ </vault>
23
+ </entities>
24
+ </palorus_mysql4>
25
+ </models>
26
+
27
+ <blocks>
28
+ <palorus>
29
+ <class>Litle_Palorus_Block</class>
30
+ </palorus>
31
+ <adminhtml>
32
+ <rewrite>
33
+ <sales_transactions_detail>Litle_Palorus_Block_Adminhtml_Transaction</sales_transactions_detail>
34
+ </rewrite>
35
+ </adminhtml>
36
+ </blocks>
37
+ <!-- turn on database connections -->
38
+ <resources>
39
+ <!-- setup is needed for automatic installation -->
40
+ <palorus_setup>
41
+ <setup>
42
+ <module>Litle_Palorus</module>
43
+ <class>Mage_Core_Model_Resource_Setup</class>
44
+ </setup>
45
+ <connection>
46
+ <use>core_setup</use>
47
+ </connection>
48
+ </palorus_setup>
49
+ <palorus_write>
50
+ <connection>
51
+ <use>core_write</use>
52
+ </connection>
53
+ </palorus_write>
54
+ <palorus_read>
55
+ <connection>
56
+ <use>core_read</use>
57
+ </connection>
58
+ </palorus_read>
59
+ </resources>
60
+
61
+ <helpers>
62
+ <palorus>
63
+ <class>Litle_Palorus_Helper</class>
64
+ </palorus>
65
+ </helpers>
66
+ </global>
67
+
68
+ <admin>
69
+ <routers>
70
+ <palorus>
71
+ <use>admin</use>
72
+ <args>
73
+ <module>Litle_Palorus</module>
74
+ <frontName>palorus</frontName>
75
+ </args>
76
+ </palorus>
77
+ </routers>
78
+ </admin>
79
+
80
+ <adminhtml>
81
+ <menu>
82
+ <dashboard>
83
+ <children>
84
+ <palorus_adminform translate="title" module="palorus">
85
+ <title>Litle &amp; Co</title>
86
+ <children>
87
+ <dashboardauthorization translate="title" module="palorus">
88
+ <title>Authorization Dashboard</title>
89
+ <action>palorus/adminhtml_myform/dashboardauthorization</action>
90
+ </dashboardauthorization>
91
+ <dashboardfrauddetection translate="title" module="palorus">
92
+ <title>Fraud Detection</title>
93
+ <action>palorus/adminhtml_myform/dashboardfrauddetection</action>
94
+ </dashboardfrauddetection>
95
+ <dashboardpostdepositfraudimpact translate="title" module="palorus">
96
+ <title>Post-Deposit Fraud Impact</title>
97
+ <action>palorus/adminhtml_myform/dashboardpostdepositfraudimpact</action>
98
+ </dashboardpostdepositfraudimpact>
99
+ </children>
100
+ </palorus_adminform>
101
+ </children>
102
+ </dashboard>
103
+
104
+ <sales>
105
+ <children>
106
+ <palorus_adminform translate="title" module="palorus">
107
+ <title>Litle &amp; Co</title>
108
+ <children>
109
+ <search translate="title" module="palorus">
110
+ <title>Transaction Search</title>
111
+ <action>palorus/adminhtml_myform/search</action>
112
+ </search>
113
+ <summary translate="title" module="palorus">
114
+ <title>Transaction Summary</title>
115
+ <action>palorus/adminhtml_myform/summary</action>
116
+ </summary>
117
+ <chargebacks translate="title" module="palorus">
118
+ <title>Chargebacks</title>
119
+ <action>palorus/adminhtml_myform/chargebacksearch</action>
120
+ </chargebacks>
121
+ </children>
122
+ </palorus_adminform>
123
+ </children>
124
+ </sales>
125
+
126
+ <report>
127
+ <children>
128
+ <palorus_adminform translate="title" module="palorus">
129
+ <title>Litle &amp; Co</title>
130
+ <children>
131
+ <activity translate="title" module="palorus">
132
+ <title>Activity</title>
133
+ <action>palorus/adminhtml_myform/activity</action>
134
+ </activity>
135
+ <authorization translate="title" module="palorus">
136
+ <title>Authorization Report</title>
137
+ <action>palorus/adminhtml_myform/authorization</action>
138
+ </authorization>
139
+ <exchange translate="title" module="palorus">
140
+ <title>Exchange</title>
141
+ <action>palorus/adminhtml_myform/exchange</action>
142
+ </exchange>
143
+ <binlookup translate="title" module="palorus">
144
+ <title>BIN Lookup</title>
145
+ <action>palorus/adminhtml_myform/binlookup</action>
146
+ </binlookup>
147
+ <session translate="title" module="palorus">
148
+ <title>Session</title>
149
+ <action>palorus/adminhtml_myform/session</action>
150
+ </session>
151
+ <settlement translate="title" module="palorus">
152
+ <title>Settlement</title>
153
+ <action>palorus/adminhtml_myform/settlement</action>
154
+ </settlement>
155
+ <chargebackreport translate="title" module="palorus">
156
+ <title>Chargeback Report</title>
157
+ <action>palorus/adminhtml_myform/chargebackreport</action>
158
+ </chargebackreport>
159
+ </children>
160
+ </palorus_adminform>
161
+ </children>
162
+ </report>
163
+ </menu>
164
+
165
+ <acl>
166
+ <resources>
167
+ <admin>
168
+ <children>
169
+ <catalog>
170
+ <children>
171
+ <sintax_adminform>
172
+ <title>My Form</title>
173
+ </sintax_adminform>
174
+ </children>
175
+ </catalog>
176
+ </children>
177
+ </admin>
178
+ </resources>
179
+ </acl>
180
+ <layout>
181
+ <updates>
182
+ <customtabs>
183
+ <file>litle.xml</file>
184
+ </customtabs>
185
+ </updates>
186
+ </layout>
187
+ </adminhtml>
188
+
189
+
190
+ </config>
app/code/local/Litle/Palorus/sql/palorus_setup/mysql4-install-8.13.0.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+ DROP TABLE IF EXISTS {$installer->getTable('palorus/insight')};
9
+ ");
10
+
11
+ $installer->run("
12
+ CREATE TABLE {$installer->getTable('palorus/insight')} (
13
+ customer_insight_id integer(10) unsigned NOT NULL auto_increment,
14
+ customer_id integer(10) unsigned NOT NULL default 0,
15
+ order_number integer(10) unsigned NOT NULL default 0,
16
+ order_id integer(10) unsigned NOT NULL default 0,
17
+ last varchar(20) NULL,
18
+ order_amount varchar(20) NULL,
19
+ affluence varchar(15) NULL,
20
+ issuing_country varchar(20) NULL,
21
+ prepaid_card_type varchar(20) NULL,
22
+ funding_source varchar(20) NULL,
23
+ available_balance varchar(20) NULL,
24
+ reloadable varchar(20) NULL,
25
+ PRIMARY KEY (customer_insight_id)
26
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Litle customer insight for an account';
27
+ ");
28
+
29
+ $installer->run("
30
+ DROP TABLE IF EXISTS {$installer->getTable('palorus/vault')};
31
+ ");
32
+
33
+ $installer->run("
34
+ CREATE TABLE {$installer->getTable('palorus/vault')} (
35
+ vault_id integer(10) unsigned NOT NULL auto_increment,
36
+ order_id integer(10) unsigned NOT NULL default 0,
37
+ customer_id integer(10) unsigned NOT NULL default 0,
38
+ last4 varchar(4) NULL,
39
+ token varchar(25) NULL,
40
+ type varchar(2) NULL,
41
+ bin varchar(6) NULL,
42
+ PRIMARY KEY (vault_id)
43
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Litle vaulted credit cards for an account';
44
+ ");
45
+
46
+
47
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/litle.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <adminhtml_customer_edit>
4
+ <reference name="customer_edit_tabs">
5
+ <action method="addTab">
6
+ <name>my_custom_tab</name>
7
+ <block>palorus/adminhtml_palorus_insight_tab</block>
8
+ </action>
9
+ </reference>
10
+ </adminhtml_customer_edit>
11
+
12
+ <palorus_adminhtml_myform_index>
13
+ <update handle="palorus_myform_index"/>
14
+ <reference name="content">
15
+ <block type="adminhtml/template" name="myform" template="palorus/myform.phtml"/>
16
+ </reference>
17
+ </palorus_adminhtml_myform_index>
18
+
19
+ </layout>
app/design/adminhtml/default/default/template/payment/form/litlecc.phtml ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2010 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
28
+
29
+ //$customerId = Mage::getSingleton('adminhtml/session_quote')->getCustomer()->getData("entity_id");
30
+ $purchases = Mage::helper('creditcard')->uniqueCreditCard(Mage::getSingleton('adminhtml/session_quote')->getCustomer()->getData("entity_id"));
31
+ $_paypageEnabled = Mage::getModel('Litle_CreditCard_Model_PaymentLogic')->getConfigData("paypage_enable");
32
+ $_code=$this->getMethodCode();
33
+ ?>
34
+
35
+ <?php if($_paypageEnabled == 1):?>
36
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none;">
37
+ <a href="https://vt.litle.com" target="_blank">Litle Virtual Terminal</a>
38
+ <br>
39
+ <br>
40
+ <?php if ($purchases[0]['last4'] !== NULL): ?>
41
+ <li>
42
+ <label for="<?php echo $_code ?>_cc_vaulted" class=""><?php echo $this->__('Stored Credit Cards') ?></label>
43
+ <div class="input-box">
44
+ <select id="<?php echo $_code ?>_cc_vaulted" name="payment[cc_vaulted]">
45
+ <option value><?php echo $this->__('--Please Select A Stored Credit Card--')?></option>
46
+ <?php $i = 1; ?>
47
+ <?php foreach ($purchases as $key => $value): ?>
48
+ <option value ="<?php echo ($i)?>"><?php echo 'Stored ' . $purchases[$i-1]['type'] . ' Ending in: ' . $purchases[$i-1]['last4'] ?></option>
49
+ <?php $i++ ?>
50
+ <?php endforeach ?>
51
+ </select>
52
+ </div>
53
+ </li>
54
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
55
+ <label id = "creditcard_cc_cid_label" for="<?php echo $_code ?>_cc_cid" class=""><?php echo $this->__('Card Verification Number') ?></label>
56
+ <div class="input-box">
57
+ <div class="v-fix">
58
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text " id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
59
+ </div>
60
+ </div>
61
+ </li>
62
+ </ul>
63
+ <script type="text/javascript">
64
+ $('creditcard_cc_cid').hide();
65
+ $('creditcard_cc_cid_label').hide();
66
+
67
+ var selectmenu=document.getElementById("<?php echo $_code ?>_cc_vaulted");
68
+ selectmenu.onchange=function(){
69
+ var chosenoption=this.options[this.selectedIndex]
70
+ if (chosenoption.value!= 0){
71
+ $('creditcard_cc_cid').show();
72
+ $('creditcard_cc_cid_label').show();
73
+ $('creditcard_cc_cid').value="";
74
+
75
+ }
76
+ if (chosenoption.value == 0){
77
+ $('creditcard_cc_cid').hide();
78
+ $('creditcard_cc_cid_label').hide();
79
+ }
80
+ }
81
+ </script>
82
+
83
+ <?php endif; ?><?php endif; ?>
84
+ <?php if($_paypageEnabled != 1):?>
85
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
86
+ <li>
87
+ <label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
88
+ <div class="input-box">
89
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
90
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
91
+ <?php $_ccType = $this->getInfoData('cc_type') ?>
92
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
93
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
94
+ <?php endforeach ?>
95
+ </select>
96
+ </div>
97
+ </li>
98
+ <li>
99
+ <label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
100
+ <div class="input-box">
101
+ <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
102
+ </div>
103
+ </li>
104
+ <li id="<?php echo $_code ?>_cc_type_exp_div">
105
+ <label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
106
+ <div class="input-box">
107
+ <div class="v-fix">
108
+ <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
109
+ <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
110
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
111
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
112
+ <?php endforeach ?>
113
+ </select>
114
+ </div>
115
+ <div class="v-fix">
116
+ <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
117
+ <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
118
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
119
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
120
+ <?php endforeach ?>
121
+ </select>
122
+ </div>
123
+ </div>
124
+ </li>
125
+ <?php echo $this->getChildHtml() ?>
126
+ <?php if($this->hasVerification()): ?>
127
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
128
+ <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
129
+ <div class="input-box">
130
+ <div class="v-fix">
131
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
132
+ </div>
133
+ <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
134
+ </div>
135
+ </li>
136
+ <?php endif; ?>
137
+ <?php endif; ?>
138
+ </ul>
app/design/adminhtml/default/default/template/payment/form/litleecheck.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <fieldset class="form-list">
2
+ <?php $_code=$this->getMethodCode() ?>
3
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
4
+ <li>
5
+ <div class="input-box">
6
+ <label for="<?php echo $_code ?>_echeck_routing_number"><?php echo $this->__('Bank routing number') ?> <span class="required">*</span></label><br />
7
+ <input id="<?php echo $_code ?>_echeck_routing_number" name="payment[echeck_routing_number]" class="input-text required-entry">
8
+ </div>
9
+ </li>
10
+ <li>
11
+ <div class="input-box">
12
+ <label for="<?php echo $_code ?>_echeck_bank_acct_num"><?php echo $this->__('Bank account number') ?> <span class="required">*</span></label><br />
13
+ <input id="<?php echo $_code ?>_echeck_bank_acct_num" name="payment[echeck_bank_acct_num]" class="input-text required-entry">
14
+ </div>
15
+ </li>
16
+ <li>
17
+ <div class="input-box">
18
+ <label for="<?php echo $_code ?>_echeck_account_type"><?php echo $this->__('Account type') ?> <span class="required">*</span></label><br />
19
+ <select id="<?php echo $_code ?>_echeck_account_type" name="payment[echeck_account_type]" class="input-text required-entry">
20
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
21
+ <?php $_accountType = $this->getInfoData('account_type') ?>
22
+ <?php foreach ($this->getAccountAvailableTypes() as $_typeCode => $_typeName): ?>
23
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_accountType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
24
+ <?php endforeach ?>
25
+ </select>
26
+ </div>
27
+ </li>
28
+ <!-- li>
29
+ <div class="input-box">
30
+ <label for="<?php echo $_code ?>_echeck_type"><?php echo $this->__('Echeck type') ?> <span class="required">*</span></label><br />
31
+ <input id="<?php echo $_code ?>_echeck_type" name="payment[echeck_type]" class="required-entry">
32
+ </div>
33
+ </li-->
34
+ </ul>
35
+ </fieldset>
app/design/frontend/base/default/layout/litlecreditcard.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <layout version="0.1.0">
2
+ <checkout_onepage_index>
3
+ <reference name="head">
4
+ <block type="page/html" name="litle3.js" output="toHtml" template="payment/form/litlejs.phtml"/>
5
+ </reference>
6
+ </checkout_onepage_index>
7
+ </layout>
app/design/frontend/base/default/template/payment/form/litlecc.phtml ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2010 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
28
+ $purchases = Mage::helper('creditcard')->uniqueCreditCard(Mage::helper('customer')->getCustomer()->getEntityId());
29
+ $_reportGroup = $this->getReportGroup();
30
+ $_paypageId = Mage::getModel('Litle_CreditCard_Model_PaymentLogic')->getConfigData("paypage_id");
31
+ $_paypageUrl = Mage::getModel('Litle_CreditCard_Model_PaymentLogic')->getConfigData("paypage_url");
32
+ $_paypageEnabled = Mage::getModel('Litle_CreditCard_Model_PaymentLogic')->getConfigData("paypage_enable");
33
+ ?>
34
+
35
+ <script type="text/javascript">
36
+ Validation.creditCartTypes.set('DC', [new RegExp('^3(?:0[0-5]|[68][0-9])[0-9]{11}$'), new RegExp('^[0-9]{3}$'), true]);
37
+ </script>
38
+
39
+ <?php
40
+ $_time = date('ymdHis');
41
+ $_session = Mage::getModel("core/session")->getEncryptedSessionId();
42
+ $_id = $_time . substr($_session,13);
43
+
44
+ ?>
45
+ <?php $_code=$this->getMethodCode() ?>
46
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>"
47
+ style="display: none;">
48
+
49
+ <?php if($_paypageEnabled == 1):?>
50
+ <?php if ($purchases[0]['last4'] !== NULL): ?>
51
+ <li>
52
+ <label for="<?php echo $_code ?>_cc_vaulted" class="required"><?php echo $this->__('Stored Credit Cards') ?></label>
53
+ <div class="input-box">
54
+ <select id="<?php echo $_code ?>_cc_vaulted" name="payment[cc_vaulted]">
55
+ <option value><?php echo $this->__('--Please Select A Stored Credit Card--')?></option>
56
+ <?php $i = 1; ?>
57
+ <option value ="0">New Credit Card</option>
58
+ <?php foreach ($purchases as $key => $value): ?>
59
+ <option value ="<?php echo ($i)?>"><?php echo 'Stored ' . $purchases[$i-1]['type'] . ' Ending in: ' . $purchases[$i-1]['last4'] ?></option>
60
+ <?php $i++ ?>
61
+ <?php endforeach ?>
62
+ </select>
63
+ </div>
64
+ </li>
65
+ <?php endif; ?>
66
+ <?php if ($purchases[0]['last4'] !== NULL): ?>
67
+ <script type="text/javascript">
68
+
69
+ var selectmenu=document.getElementById("<?php echo $_code ?>_cc_vaulted");
70
+ selectmenu.onchange=function(){
71
+ var chosenoption=this.options[this.selectedIndex]
72
+ if (chosenoption.value!= 0){
73
+ $('creditcard_cc_type_label').hide();
74
+ $('creditcard_cc_number_label').hide();
75
+ $('creditcard_cc_expDate_label').hide();
76
+ $('creditcard_cc_type').hide();
77
+ $('creditcard_cc_number').hide();
78
+ $('creditcard_expiration').hide();
79
+ $('creditcard_expiration_yr').hide();
80
+ $('creditcard_cc_cid').value="";
81
+ }
82
+ if (chosenoption.value == 0){
83
+ $('creditcard_cc_type_label').show();
84
+ $('creditcard_cc_number_label').show();
85
+ $('creditcard_cc_expDate_label').show();
86
+ $('creditcard_cc_type').show();
87
+ $('creditcard_cc_number').show();
88
+ $('creditcard_expiration').show();
89
+ $('creditcard_expiration_yr').show();
90
+ $('creditcard_cc_cid').value="";
91
+ $('creditcard_cc_type').value = "";
92
+ $('creditcard_expiration').value = "";
93
+ $('creditcard_expiration_yr').value = "";
94
+ }
95
+ }
96
+ </script>
97
+ <?php endif; ?>
98
+ <?php endif; ?>
99
+ <li>
100
+ <label id = "creditcard_cc_type_label" for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
101
+ <div class="input-box">
102
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
103
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
104
+ <?php $_ccType = $this->getInfoData('cc_type') ?>
105
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
106
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
107
+ <?php endforeach ?>
108
+ </select>
109
+ </div>
110
+ </li>
111
+ <li>
112
+ <label id = "creditcard_cc_number_label" for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
113
+ <div class="input-box">
114
+ <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
115
+ </div>
116
+ </li>
117
+ <li id="<?php echo $_code ?>_cc_type_exp_div">
118
+ <label id = "creditcard_cc_expDate_label" for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
119
+ <div class="input-box">
120
+ <div class="v-fix">
121
+ <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
122
+ <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
123
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
124
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
125
+ <?php endforeach ?>
126
+ </select>
127
+ </div>
128
+ <div class="v-fix">
129
+ <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
130
+ <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
131
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
132
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
133
+ <?php endforeach ?>
134
+ </select>
135
+ </div>
136
+ </div>
137
+ </li>
138
+ <?php echo $this->getChildHtml() ?>
139
+ <?php if($this->hasVerification()): ?>
140
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
141
+ <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
142
+ <div class="input-box">
143
+ <div class="v-fix">
144
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry " id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
145
+ </div>
146
+ <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
147
+ </div>
148
+ </li>
149
+ <?php endif; ?>
150
+
151
+ <?php if($_paypageEnabled == 1):?>
152
+ <input type="hidden" id="<?php echo $_code ?>_paypage_id" name="payment[paypage_id]" value="<?php echo $_paypageId; ?>"/>
153
+ <input type="hidden" id="<?php echo $_code ?>_merchant_txn_id" name="payment[merchant_txn_id]" value="<?php echo $_id; ?>"/>
154
+ <input type="hidden" id="<?php echo $_code ?>_paypage_url" name="payment[paypage_url]" value="<?php echo $_paypageUrl; ?>"/>
155
+ <input type="hidden" id="<?php echo $_code ?>_order_id" name="payment[order_id]" value="<?php echo $_id; ?>"/>
156
+ <input type="hidden" id="<?php echo $_code ?>_report_group" name="payment[report_group]" value="<?php echo $_reportGroup; ?>"/>
157
+ <input type="hidden" id="<?php echo $_code ?>_paypage_enabled" name="payment[paypage_enabled]" value="<?php echo $_paypageEnabled; ?>"/>
158
+ <input type="hidden" id="<?php echo $_code ?>_paypage_registration_id" name="payment[paypage_registration_id]" value=""/>
159
+ <input type="hidden" id="<?php echo $_code ?>_bin" name="payment[bin]"/>
160
+ <input type="hidden" id="<?php echo $_code ?>_code" name="payment[code]"/>
161
+ <input type="hidden" id="<?php echo $_code ?>_message" name="payment[message]"/>
162
+ <input type="hidden" id="<?php echo $_code ?>_response_time" name="payment[response_time]"/>
163
+ <input type="hidden" id="<?php echo $_code ?>_type" name="payment[type]"/>
164
+ <input type="hidden" id="<?php echo $_code ?>_litle_txn_id" name="payment[litle_txn_id]"/>
165
+ <input type="hidden" id="<?php echo $_code ?>_vault_id" name="payment[paypage_id]" value="<?php echo $purchase['token']; ?>"/>
166
+ <?php endif; ?>
167
+ </ul>
168
+
169
+ <?php if($_paypageEnabled == 1):?>
170
+ <script type="text/javascript">
171
+
172
+ Payment.prototype.save = function() {
173
+
174
+ var _saveUrl = this.saveUrl;
175
+ var _onComplete = this.onComplete;
176
+ var _onSave = this.onSave;
177
+ var _currentMethod = this.currentMethod;
178
+ var _form = this.form;
179
+
180
+ if (checkout.loadWaiting!=false) return;
181
+ var validator = new Validation(this.form);
182
+ if (this.validate() && validator.validate()) {
183
+ checkout.setLoadWaiting('payment');
184
+
185
+ // Litle Page Stuff//
186
+ function setLitleResponseFields(response) {
187
+ document.getElementById(<?php echo "'" . $_code . "_code" . "'" ?>).value = response.response;
188
+ document.getElementById(<?php echo "'" . $_code . "_message" . "'" ?>).value = response.message;
189
+ document.getElementById(<?php echo "'" . $_code . "_response_time" . "'" ?>).value = response.responseTime;
190
+ document.getElementById(<?php echo "'" . $_code . "_litle_txn_id" . "'" ?>).value = response.litleTxnId;
191
+ document.getElementById(<?php echo "'" . $_code . "_type" . "'" ?>).value = response.type;
192
+ }
193
+
194
+ function submitAfterLitle() {
195
+ var request = new Ajax.Request(
196
+ _saveUrl,
197
+ {
198
+ method:'post',
199
+ onComplete: _onComplete,
200
+ onSuccess: _onSave,
201
+ onFailure: checkout.ajaxFailure.bind(checkout),
202
+ parameters: Form.serialize(_form)
203
+ }
204
+ );
205
+ }
206
+
207
+ function timeoutOnLitle() {
208
+ setLitleResponseFields();
209
+ alert('timeout error');
210
+ return false;
211
+ }
212
+
213
+ function onErrorAfterLitle(response) {
214
+ setLitleResponseFields(response);
215
+ alert('There was an error. Re-enter your payment information, or contact us for further assistance.');
216
+ return false;
217
+ }
218
+
219
+ var formFields = {
220
+ "accountNum" : document.getElementById(<?php echo "'" . $_code . "_cc_number" . "'" ?>),
221
+ "paypageRegistrationId" : document.getElementById(<?php echo "'" . $_code . "_paypage_registration_id" . "'" ?>),
222
+ "bin" : document.getElementById(<?php echo "'" . $_code . "_bin" . "'" ?>)
223
+ };
224
+
225
+ var litleRequest = {
226
+ "paypageId" : document.getElementById(<?php echo "'" . $_code . "_paypage_id" . "'" ?>).value,
227
+ "reportGroup" : document.getElementById(<?php echo "'" . $_code . "_report_group" . "'" ?>).value,
228
+ "orderId" : document.getElementById(<?php echo "'" . $_code . "_order_id" . "'" ?>).value,
229
+ "id" : document.getElementById(<?php echo "'" . $_code . "_merchant_txn_id" . "'" ?>).value,
230
+ "url" : (document.getElementById(<?php echo "'" . $_code . "_paypage_url" . "'" ?>).value)
231
+ };
232
+
233
+ var selectmenu=document.getElementById("<?php echo $_code ?>_cc_vaulted");
234
+
235
+ if(selectmenu){
236
+ var chosenoption=selectmenu.options[selectmenu.selectedIndex]
237
+ if (chosenoption.value == 0){
238
+ if( _currentMethod == "creditcard" ){
239
+ sendToLitle(litleRequest, formFields, setLitleResponseFields, onErrorAfterLitle);
240
+ }
241
+ }
242
+ }
243
+ else
244
+ {
245
+ if( _currentMethod == "creditcard" ){
246
+ sendToLitle(litleRequest, formFields, setLitleResponseFields, onErrorAfterLitle);
247
+ }
248
+ }
249
+ submitAfterLitle();
250
+ // End of Paypage
251
+ }
252
+ }
253
+ </script>
254
+ <?php endif; ?>
app/design/frontend/base/default/template/payment/form/litlejs.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_paypageUrl = Mage::getModel('Litle_CreditCard_Model_PaymentLogic')->getConfigData("paypage_url");
3
+ $_paypageEnabled = Mage::getModel('Litle_CreditCard_Model_PaymentLogic')->getConfigData("paypage_enable");
4
+ ?>
5
+ <?php if($_paypageEnabled == 1):?>
6
+
7
+ <script type="text/javascript" src="<?php echo $_paypageUrl?>/LitlePayPage/litle-api.js"></script>
8
+ <script type="text/javascript"> $.noConflict();</script>
9
+ <?php endif; ?>
app/design/frontend/default/default/template/payment/form/litlecc.phtml ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2010 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
28
+ $purchases = Mage::helper('creditcard')->uniqueCreditCard(Mage::helper('customer')->getCustomer()->getEntityId());
29
+ $_reportGroup = $this->getReportGroup();
30
+ $_paypageId = Mage::getModel('Litle_CreditCard_Model_PaymentLogic')->getConfigData("paypage_id");
31
+ $_paypageUrl = Mage::getModel('Litle_CreditCard_Model_PaymentLogic')->getConfigData("paypage_url");
32
+ $_paypageEnabled = Mage::getModel('Litle_CreditCard_Model_PaymentLogic')->getConfigData("paypage_enable");
33
+ ?>
34
+
35
+ <script type="text/javascript">
36
+ Validation.creditCartTypes.set('DC', [new RegExp('^3(?:0[0-5]|[68][0-9])[0-9]{11}$'), new RegExp('^[0-9]{3}$'), true]);
37
+ </script>
38
+
39
+ <?php
40
+ $_time = date('ymdHis');
41
+ $_session = Mage::getModel("core/session")->getEncryptedSessionId();
42
+ $_id = $_time . substr($_session,13);
43
+
44
+ ?>
45
+ <?php $_code=$this->getMethodCode() ?>
46
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>"
47
+ style="display: none;">
48
+
49
+ <?php if($_paypageEnabled == 1):?>
50
+ <?php if ($purchases[0]['last4'] !== NULL): ?>
51
+ <li>
52
+ <label for="<?php echo $_code ?>_cc_vaulted" class="required"><?php echo $this->__('Stored Credit Cards') ?></label>
53
+ <div class="input-box">
54
+ <select id="<?php echo $_code ?>_cc_vaulted" name="payment[cc_vaulted]">
55
+ <option value><?php echo $this->__('--Please Select A Stored Credit Card--')?></option>
56
+ <?php $i = 1; ?>
57
+ <option value ="0">New Credit Card</option>
58
+ <?php foreach ($purchases as $key => $value): ?>
59
+ <option value ="<?php echo ($i)?>"><?php echo 'Stored ' . $purchases[$i-1]['type'] . ' Ending in: ' . $purchases[$i-1]['last4'] ?></option>
60
+ <?php $i++ ?>
61
+ <?php endforeach ?>
62
+ </select>
63
+ </div>
64
+ </li>
65
+ <?php endif; ?>
66
+ <?php if ($purchases[0]['last4'] !== NULL): ?>
67
+ <script type="text/javascript">
68
+
69
+ var selectmenu=document.getElementById("<?php echo $_code ?>_cc_vaulted");
70
+ selectmenu.onchange=function(){
71
+ var chosenoption=this.options[this.selectedIndex]
72
+ if (chosenoption.value!= 0){
73
+ $('creditcard_cc_type_label').hide();
74
+ $('creditcard_cc_number_label').hide();
75
+ $('creditcard_cc_expDate_label').hide();
76
+ $('creditcard_cc_type').hide();
77
+ $('creditcard_cc_number').hide();
78
+ $('creditcard_expiration').hide();
79
+ $('creditcard_expiration_yr').hide();
80
+ $('creditcard_cc_cid').value="";
81
+ }
82
+ if (chosenoption.value == 0){
83
+ $('creditcard_cc_type_label').show();
84
+ $('creditcard_cc_number_label').show();
85
+ $('creditcard_cc_expDate_label').show();
86
+ $('creditcard_cc_type').show();
87
+ $('creditcard_cc_number').show();
88
+ $('creditcard_expiration').show();
89
+ $('creditcard_expiration_yr').show();
90
+ $('creditcard_cc_cid').value="";
91
+ $('creditcard_cc_type').value = "";
92
+ $('creditcard_expiration').value = "";
93
+ $('creditcard_expiration_yr').value = "";
94
+ }
95
+ }
96
+ </script>
97
+ <?php endif; ?>
98
+ <?php endif; ?>
99
+ <li>
100
+ <label id = "creditcard_cc_type_label" for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
101
+ <div class="input-box">
102
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
103
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
104
+ <?php $_ccType = $this->getInfoData('cc_type') ?>
105
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
106
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
107
+ <?php endforeach ?>
108
+ </select>
109
+ </div>
110
+ </li>
111
+ <li>
112
+ <label id = "creditcard_cc_number_label" for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
113
+ <div class="input-box">
114
+ <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
115
+ </div>
116
+ </li>
117
+ <li id="<?php echo $_code ?>_cc_type_exp_div">
118
+ <label id = "creditcard_cc_expDate_label" for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
119
+ <div class="input-box">
120
+ <div class="v-fix">
121
+ <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
122
+ <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
123
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
124
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
125
+ <?php endforeach ?>
126
+ </select>
127
+ </div>
128
+ <div class="v-fix">
129
+ <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
130
+ <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
131
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
132
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
133
+ <?php endforeach ?>
134
+ </select>
135
+ </div>
136
+ </div>
137
+ </li>
138
+ <?php echo $this->getChildHtml() ?>
139
+ <?php if($this->hasVerification()): ?>
140
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
141
+ <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
142
+ <div class="input-box">
143
+ <div class="v-fix">
144
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry " id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
145
+ </div>
146
+ <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
147
+ </div>
148
+ </li>
149
+ <?php endif; ?>
150
+
151
+ <?php if($_paypageEnabled == 1):?>
152
+ <input type="hidden" id="<?php echo $_code ?>_paypage_id" name="payment[paypage_id]" value="<?php echo $_paypageId; ?>"/>
153
+ <input type="hidden" id="<?php echo $_code ?>_merchant_txn_id" name="payment[merchant_txn_id]" value="<?php echo $_id; ?>"/>
154
+ <input type="hidden" id="<?php echo $_code ?>_paypage_url" name="payment[paypage_url]" value="<?php echo $_paypageUrl; ?>"/>
155
+ <input type="hidden" id="<?php echo $_code ?>_order_id" name="payment[order_id]" value="<?php echo $_id; ?>"/>
156
+ <input type="hidden" id="<?php echo $_code ?>_report_group" name="payment[report_group]" value="<?php echo $_reportGroup; ?>"/>
157
+ <input type="hidden" id="<?php echo $_code ?>_paypage_enabled" name="payment[paypage_enabled]" value="<?php echo $_paypageEnabled; ?>"/>
158
+ <input type="hidden" id="<?php echo $_code ?>_paypage_registration_id" name="payment[paypage_registration_id]" value=""/>
159
+ <input type="hidden" id="<?php echo $_code ?>_bin" name="payment[bin]"/>
160
+ <input type="hidden" id="<?php echo $_code ?>_code" name="payment[code]"/>
161
+ <input type="hidden" id="<?php echo $_code ?>_message" name="payment[message]"/>
162
+ <input type="hidden" id="<?php echo $_code ?>_response_time" name="payment[response_time]"/>
163
+ <input type="hidden" id="<?php echo $_code ?>_type" name="payment[type]"/>
164
+ <input type="hidden" id="<?php echo $_code ?>_litle_txn_id" name="payment[litle_txn_id]"/>
165
+ <input type="hidden" id="<?php echo $_code ?>_vault_id" name="payment[paypage_id]" value="<?php echo $purchase['token']; ?>"/>
166
+ <?php endif; ?>
167
+ </ul>
168
+
169
+ <?php if($_paypageEnabled == 1):?>
170
+ <script type="text/javascript">
171
+
172
+ Payment.prototype.save = function() {
173
+
174
+ var _saveUrl = this.saveUrl;
175
+ var _onComplete = this.onComplete;
176
+ var _onSave = this.onSave;
177
+ var _currentMethod = this.currentMethod;
178
+ var _form = this.form;
179
+
180
+ if (checkout.loadWaiting!=false) return;
181
+ var validator = new Validation(this.form);
182
+ if (this.validate() && validator.validate()) {
183
+ checkout.setLoadWaiting('payment');
184
+
185
+ // Litle Page Stuff//
186
+ function setLitleResponseFields(response) {
187
+ document.getElementById(<?php echo "'" . $_code . "_code" . "'" ?>).value = response.response;
188
+ document.getElementById(<?php echo "'" . $_code . "_message" . "'" ?>).value = response.message;
189
+ document.getElementById(<?php echo "'" . $_code . "_response_time" . "'" ?>).value = response.responseTime;
190
+ document.getElementById(<?php echo "'" . $_code . "_litle_txn_id" . "'" ?>).value = response.litleTxnId;
191
+ document.getElementById(<?php echo "'" . $_code . "_type" . "'" ?>).value = response.type;
192
+ }
193
+
194
+ function submitAfterLitle() {
195
+ var request = new Ajax.Request(
196
+ _saveUrl,
197
+ {
198
+ method:'post',
199
+ onComplete: _onComplete,
200
+ onSuccess: _onSave,
201
+ onFailure: checkout.ajaxFailure.bind(checkout),
202
+ parameters: Form.serialize(_form)
203
+ }
204
+ );
205
+ }
206
+
207
+ function timeoutOnLitle() {
208
+ setLitleResponseFields();
209
+ alert('timeout error');
210
+ return false;
211
+ }
212
+
213
+ function onErrorAfterLitle(response) {
214
+ setLitleResponseFields(response);
215
+ alert('There was an error. Re-enter your payment information, or contact us for further assistance.');
216
+ return false;
217
+ }
218
+
219
+ var formFields = {
220
+ "accountNum" : document.getElementById(<?php echo "'" . $_code . "_cc_number" . "'" ?>),
221
+ "paypageRegistrationId" : document.getElementById(<?php echo "'" . $_code . "_paypage_registration_id" . "'" ?>),
222
+ "bin" : document.getElementById(<?php echo "'" . $_code . "_bin" . "'" ?>)
223
+ };
224
+
225
+ var litleRequest = {
226
+ "paypageId" : document.getElementById(<?php echo "'" . $_code . "_paypage_id" . "'" ?>).value,
227
+ "reportGroup" : document.getElementById(<?php echo "'" . $_code . "_report_group" . "'" ?>).value,
228
+ "orderId" : document.getElementById(<?php echo "'" . $_code . "_order_id" . "'" ?>).value,
229
+ "id" : document.getElementById(<?php echo "'" . $_code . "_merchant_txn_id" . "'" ?>).value,
230
+ "url" : (document.getElementById(<?php echo "'" . $_code . "_paypage_url" . "'" ?>).value)
231
+ };
232
+
233
+ var selectmenu=document.getElementById("<?php echo $_code ?>_cc_vaulted");
234
+
235
+ if(selectmenu){
236
+ var chosenoption=selectmenu.options[selectmenu.selectedIndex]
237
+ if (chosenoption.value == 0){
238
+ if( _currentMethod == "creditcard" ){
239
+ sendToLitle(litleRequest, formFields, setLitleResponseFields, onErrorAfterLitle);
240
+ }
241
+ }
242
+ }
243
+ else
244
+ {
245
+ if( _currentMethod == "creditcard" ){
246
+ sendToLitle(litleRequest, formFields, setLitleResponseFields, onErrorAfterLitle);
247
+ }
248
+ }
249
+ submitAfterLitle();
250
+ // End of Paypage
251
+ }
252
+ }
253
+ </script>
254
+ <?php endif; ?>
app/etc/modules/Litle_All.xml CHANGED
@@ -12,4 +12,11 @@
12
  <codePool>local</codePool>
13
  </Litle_LEcheck>
14
  </modules>
 
 
 
 
 
 
 
15
  </config>
12
  <codePool>local</codePool>
13
  </Litle_LEcheck>
14
  </modules>
15
+ <modules>
16
+ <Litle_Palorus>
17
+ <active>true</active>
18
+ <codePool>local</codePool>
19
+ </Litle_Palorus>
20
+ </modules>
21
+
22
  </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Litle_Payments</name>
4
- <version>8.10.2</version>
5
  <stability>stable</stability>
6
  <license>MIT</license>
7
  <channel>community</channel>
@@ -17,14 +17,13 @@ Why Litle?&#xD;
17
  &#xD;
18
  We deliver the most efficient and effective core processing available to digital and direct merchants. Relevant, value-added solutions help you drive more lasting and profitable customer relationships. We&#x2019;ll also show you how payments intelligence can power your business and your relationships to greater success. We support you with the best customer experience in the business.&#xD;
19
  </description>
20
- <notes>This extension implements Litle XML version 8.10&#xD;
21
  &#xD;
22
- Fixes in this version:&#xD;
23
- - American Express card transactions are now handled correctly.</notes>
24
  <authors><author><name>Litle </name><user>Litle</user><email>sdksupport@litle.com</email></author></authors>
25
- <date>2012-04-12</date>
26
- <time>17:16:51</time>
27
- <contents><target name="magelocal"><dir name="Litle"><dir><dir name="CreditCard"><dir name="Model"><file name="PaymentLogic.php" hash="18fe9db17ec4fad2017a62b435b4bc00"/><file name="Url.php" hash="ce0ca23963d9eb05552528eb440d19fe"/><file name="Validatehttp.php" hash="79dac70cf02fc3e005c9bb8ef0f3e0e0"/></dir><dir name="etc"><file name="config.xml" hash="be5172f7d2ec1a5d16c64f313487be82"/><file name="system.xml" hash="bd072a42ff569bbb7bd5530c0366ee60"/></dir></dir><dir name="LEcheck"><dir name="Block"><dir name="Form"><file name="LEcheck.php" hash="ba7cc807aa5e227bb936a196985476a0"/></dir></dir><dir name="Helper"><file name="Data.php" hash="2c2664ab694e0ba70e45157061a01436"/></dir><dir name="Model"><file name="Accounttypes.php" hash="6628bf9982d0d35341975d0bb83be5e1"/><file name="Config.php" hash="fe64d24b39251551b71e37937792b418"/><file name="PaymentLogic.php" hash="6fef54215e9915497f43efe74ca666e8"/><file name="Transactiontypes.php" hash="1aa3e3e77c044e77154f9c24afcfc436"/><file name="Url.php" hash="9e3d8ba06bcb9045abc82f20f18d5ef3"/><file name="Validatehttp.php" hash="6a8d4d6f043976ad272c87a885d937f4"/></dir><dir name="etc"><file name="config.xml" hash="0150e3b72ffd8b8fd08891390d02178e"/><file name="system.xml" hash="1721d5468396eaae10987be8423e0ff8"/></dir></dir><dir name="LitleSDK"><file name="Checker.php" hash="e38d02c1fc3d54faa5d2ba0302bff5ec"/><file name="Communication.php" hash="f78ab9b5497554ae47181053f5f20ac8"/><file name="LitleOnline.php" hash="f2561f12f4e47d6c1d1ae60c835e9f4f"/><file name="LitleOnlineRequest.php" hash="609062240175f4827399b81543b11ec8"/><file name="LitleXmlMapper.php" hash="17c64c7f34e5c84ab3461b92268ede46"/><file name="Obj2xml.php" hash="63f36945e7bd1dc0ae2392ea3ad7560d"/><file name="Setup.php" hash="d726bbc909f3f4754c3e73b8915f8706"/><file name="XmlFields.php" hash="d84c23fbddcb4829cddf77470ecd1191"/><file name="XmlParser.php" hash="9fb83575223778fad8eaee1bef16ab36"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="payment"><dir name="form"><file name="litleecheck.phtml" hash="a92047f43e72f60fea75dd536bba0552"/></dir></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="payment"><dir name="form"><file name="litleecheck.phtml" hash="a92047f43e72f60fea75dd536bba0552"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Litle_All.xml" hash="57f8967136923914e7a0a04f0432b821"/></dir></target></contents>
28
  <compatible/>
29
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
30
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Litle_Payments</name>
4
+ <version>8.13.0</version>
5
  <stability>stable</stability>
6
  <license>MIT</license>
7
  <channel>community</channel>
17
  &#xD;
18
  We deliver the most efficient and effective core processing available to digital and direct merchants. Relevant, value-added solutions help you drive more lasting and profitable customer relationships. We&#x2019;ll also show you how payments intelligence can power your business and your relationships to greater success. We support you with the best customer experience in the business.&#xD;
19
  </description>
20
+ <notes>This extension implements Litle XML version 8.13&#xD;
21
  &#xD;
22
+ Additional features include enhanced reporting on orders, transactions, and customers.</notes>
 
23
  <authors><author><name>Litle </name><user>Litle</user><email>sdksupport@litle.com</email></author></authors>
24
+ <date>2012-05-25</date>
25
+ <time>20:40:59</time>
26
+ <contents><target name="magelocal"><dir name="Litle"><dir><dir name="CreditCard"><dir name="Block"><dir name="Adminhtml"><file name="Ordergrid.php" hash="c01fb8a142a89562c41a1a315f8f1529"/><file name="Orderview.php" hash="a60e3bb449e9001cab70968c0ee9373d"/></dir><dir name="Form"><file name="CreditCard.php" hash="b6300b9c6906aefe4fb1265f6e611a28"/></dir></dir><dir name="Helper"><file name="Data.php" hash="22486958c37955f4d87d052de53cfecd"/></dir><dir name="Model"><file name="Cctypes.php" hash="cf8f9d91ac8bf313aa8d97b865d719de"/><file name="Lpayment.php" hash="2ed8491cef39c7c17638e02b03b334b4"/><dir name="Order"><file name="Payment.php" hash="a3364b0df34829475e913e53507888ea"/></dir><file name="PaymentLogic.php" hash="2332dd84293da66eb949cf74d569dd87"/><file name="Url.php" hash="ce0ca23963d9eb05552528eb440d19fe"/><file name="ValidateMerchantId.php" hash="00b1fdb98ecd344b76581fc98242c4e3"/><file name="Validatehttp.php" hash="3e6ffb4a267fac166bd8e882fc27b39f"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="OrderController.php" hash="ca1347dcfd4dc19b311b31e75c23891e"/></dir></dir><dir name="etc"><file name="config.xml" hash="74c7465ed3eef35e0e6e2b36e9417f45"/><file name="system.xml" hash="82c4b9c1ece8485e97613c9ebc5ca8ee"/></dir></dir><dir name="LEcheck"><dir name="Block"><dir name="Form"><file name="LEcheck.php" hash="ba7cc807aa5e227bb936a196985476a0"/></dir></dir><dir name="Helper"><file name="Data.php" hash="2c2664ab694e0ba70e45157061a01436"/></dir><dir name="Model"><file name="Accounttypes.php" hash="6628bf9982d0d35341975d0bb83be5e1"/><file name="Config.php" hash="fe64d24b39251551b71e37937792b418"/><file name="PaymentLogic.php" hash="cfc4ab4deb96affb632b7d6caf2b8b15"/><file name="Transactiontypes.php" hash="1aa3e3e77c044e77154f9c24afcfc436"/><file name="Url.php" hash="9e3d8ba06bcb9045abc82f20f18d5ef3"/><file name="Validatehttp.php" hash="6a8d4d6f043976ad272c87a885d937f4"/></dir><dir name="etc"><file name="config.xml" hash="43f4cdc1045e0c990cdda6d249121f02"/><file name="system.xml" hash="daaf81623ceca045d3a3e56e296a29fc"/></dir></dir><dir name="LitleSDK"><file name="Checker.php" hash="505ca6afdfbe3fd521848ea6f23b8d07"/><file name="Communication.php" hash="f78ab9b5497554ae47181053f5f20ac8"/><file name="LitleOnline.php" hash="c7253201309ce7e91a41735410cb4f2d"/><file name="LitleOnlineRequest.php" hash="a53ca9120a21af679a09d43f2c0dfd0a"/><file name="LitleXmlMapper.php" hash="17c64c7f34e5c84ab3461b92268ede46"/><file name="Obj2xml.php" hash="7613e168c5d16af1fe2c623041f4012f"/><file name="Setup.php" hash="7344e369d0b1a639dc5cd26b9a1fdbea"/><file name="UrlMapper.php" hash="f7951fbf0fc218eaa041f0265b358499"/><file name="XmlFields.php" hash="fb4806e06412b72ed5a6b96fc20cb18f"/><file name="XmlParser.php" hash="9fb83575223778fad8eaee1bef16ab36"/></dir><dir name="Palorus"><dir name="Block"><dir name="Adminhtml"><dir name="Palorus"><dir name="Insight"><file name="Tab.php" hash="092a1b895aa092a8c19b83578697af5e"/></dir></dir><file name="Transaction.php" hash="d09244a9d0616ffcb1230a4323cd23cf"/></dir></dir><dir name="Helper"><file name="Data.php" hash="a00cb4f2aa593a036f80b8faf5795ab1"/></dir><dir name="Model"><file name="Insight.php" hash="837fd9a46dc1d2a9362742299818aa9f"/><dir name="Mysql4"><dir name="Insight"><file name="Collection.php" hash="ce93a4bc5c69a69967a5a48b8f6a0a6f"/></dir><file name="Insight.php" hash="b8faca9944ba3ccd28505b36a8485e50"/><dir name="Vault"><file name="Collection.php" hash="433f5fee8c86fd2bd73282a7c3f7c1fb"/></dir><file name="Vault.php" hash="6a94ddb1a9d46873d83cc3c71b2828a6"/></dir><file name="Vault.php" hash="0e33db7cfdbae8e9b2a7de77aff12e98"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MyformController.php" hash="0d5c7c9d70f513f5428bee0bf7b5bbaf"/></dir></dir><dir name="etc"><file name="config.xml" hash="f323cc70b36722de292eb2885ec17188"/></dir><dir name="sql"><dir name="palorus_setup"><file name="mysql4-install-8.13.0.php" hash="65e2cda8318d2e986c5644a802e66bf3"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Litle_All.xml" hash="09fb485ff33fb8680e38742182d6d0ba"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="payment"><dir name="form"><file name="litleecheck.phtml" hash="a92047f43e72f60fea75dd536bba0552"/><file name="litlecc.phtml" hash="1d7afe36a27031ca5d4b0ba4c00a956e"/><file name="litlejs.phtml" hash="775224833051c1b7df7c32a626994ec0"/></dir></dir></dir><dir name="layout"><file name="litlecreditcard.xml" hash="4ed33c73b8c2edd3d57e140997a73ca8"/></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="payment"><dir name="form"><file name="litlecc.phtml" hash="1d7afe36a27031ca5d4b0ba4c00a956e"/><file name="litleecheck.phtml" hash="a92047f43e72f60fea75dd536bba0552"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="litle.xml" hash="c0e6321907f69c20502fd079188fbba4"/></dir><dir name="template"><dir name="payment"><dir name="form"><file name="litlecc.phtml" hash="8abb799e1cf936411912fe996b17cfa7"/><file name="litleecheck.phtml" hash="b9921c8126c2eab4a77bd4f120935753"/></dir></dir></dir></dir></dir></dir></target></contents>
27
  <compatible/>
28
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
29
  </package>