Litle_Payments - Version 8.13.3

Version Notes

This extension implements Litle XML

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

Download this release

Release Info

Developer Litle
Extension Litle_Payments
Version 8.13.3
Comparing to
See all releases


Code changes from version 8.13.2 to 8.13.3

Files changed (33) hide show
  1. app/code/local/Litle/CreditCard/Block/Form/CreditCard.php +203 -166
  2. app/code/local/Litle/CreditCard/Helper/Data.php +24 -33
  3. app/code/local/Litle/CreditCard/Model/Order/Payment.php +10 -10
  4. app/code/local/Litle/CreditCard/Model/PaymentLogic.php +404 -322
  5. app/code/local/Litle/CreditCard/etc/config.xml +1 -1
  6. app/code/local/Litle/CreditCard/etc/system.xml +15 -4
  7. app/code/local/Litle/LEcheck/Block/Form/LEcheck.php +2 -2
  8. app/code/local/Litle/LEcheck/etc/config.xml +1 -1
  9. app/code/local/Litle/LitleSDK/Obj2xml.php +2 -2
  10. app/code/local/Litle/Palorus/Block/Adminhtml/Customer/Edit/Tab/Vault.php +94 -0
  11. app/code/local/Litle/Palorus/Block/Vault.php +105 -0
  12. app/code/local/Litle/Palorus/Block/Vault/List.php +64 -0
  13. app/code/local/Litle/Palorus/Helper/Data.php +210 -128
  14. app/code/local/Litle/Palorus/Model/Mysql4/Vault.php +24 -7
  15. app/code/local/Litle/Palorus/Model/Mysql4/Vault/Collection.php +12 -1
  16. app/code/local/Litle/Palorus/Model/Vault.php +146 -1
  17. app/code/local/Litle/Palorus/controllers/Adminhtml/VaultController.php +59 -0
  18. app/code/local/Litle/Palorus/controllers/VaultController.php +88 -0
  19. app/code/local/Litle/Palorus/etc/config.xml +41 -8
  20. app/code/local/Litle/Palorus/sql/palorus_setup/mysql4-upgrade-8.13.2-8.13.3.php +49 -0
  21. app/design/adminhtml/default/default/layout/litle.xml +6 -2
  22. app/design/adminhtml/default/default/template/litle/customer/tab/vault.phtml +33 -0
  23. app/design/adminhtml/default/default/template/litle/form/litlecc.phtml +158 -0
  24. app/design/adminhtml/default/default/template/{payment → litle}/form/litleecheck.phtml +0 -0
  25. app/design/adminhtml/default/default/template/payment/form/litlecc.phtml +0 -138
  26. app/design/frontend/base/default/layout/litlecreditcard.xml +27 -2
  27. app/design/frontend/{default/default/template/payment → base/default/template/litle}/form/litlecc.phtml +115 -119
  28. app/design/frontend/{default/default/template/payment → base/default/template/litle}/form/litleecheck.phtml +3 -3
  29. app/design/frontend/base/default/template/{payment → litle}/form/litlejs.phtml +0 -0
  30. app/design/frontend/base/default/template/litle/vault/list.phtml +49 -0
  31. app/design/frontend/base/default/template/payment/form/litlecc.phtml +0 -254
  32. app/design/frontend/base/default/template/payment/form/litleecheck.phtml +0 -35
  33. package.xml +2 -2
app/code/local/Litle/CreditCard/Block/Form/CreditCard.php CHANGED
@@ -1,178 +1,215 @@
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
 
1
  <?php
2
+
3
  /**
4
  * Magento
 
5
  * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0) that is
7
+ * bundled with this package in the file LICENSE.txt. It is also available
8
+ * through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php If you did not receive a copy of
10
+ * the license and are unable to obtain it through the world-wide-web, please
11
+ * send an email to license@magentocommerce.com so we can send you a copy
12
+ * immediately.
 
 
13
  * DISCLAIMER
 
14
  * Do not edit or add to this file if you wish to upgrade Magento to newer
15
+ * versions in the future. If you wish to customize Magento for your needs
16
+ * please refer to http://www.magentocommerce.com for more information.
17
  *
18
+ * @category Mage
19
+ * @package Mage_Payment
20
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License
22
+ * (OSL 3.0)
23
  */
 
 
24
  class Litle_CreditCard_Block_Form_CreditCard extends Mage_Payment_Block_Form
25
  {
26
+
27
+ /**
28
+ *
29
+ * @var array
30
+ */
31
+ protected $_storedCards = null;
32
+
33
+ protected function _construct()
34
+ {
35
+ parent::_construct();
36
+ $this->setTemplate('litle/form/litlecc.phtml');
37
+ }
38
+
39
+ /**
40
+ * Retrieve payment configuration object
41
+ *
42
+ * @return Mage_Payment_Model_Config
43
+ */
44
+ protected function _getConfig()
45
+ {
46
+ return Mage::getSingleton('payment/config');
47
+ }
48
+
49
+
50
+ public function getCurrency()
51
+ {
52
+ return Mage::app()->getStore()->getCurrentCurrencyCode();
53
+ }
54
+
55
+ public function getMerchantIdMap()
56
+ {
57
+ return Mage::getStoreConfig('payment/CreditCard/merchant_id');
58
+ }
59
+
60
+ public function getReportGroup()
61
+ {
62
+ $string2Eval = 'return array' . $this->getMerchantIdMap() . ";";
63
+ $merchant_map = eval($string2Eval);
64
+ $reportGroup = $merchant_map[$this->getCurrency()];
65
+ return $reportGroup;
66
+ }
67
+
68
+ /**
69
+ * Retrieve availables credit card types
70
+ *
71
+ * @return array
72
+ */
73
+ public function getCcAvailableTypes()
74
+ {
75
+ $types = $this->_getConfig()->getCcTypes();
76
+ if ($method = $this->getMethod()) {
77
+ $availableTypes = $method->getConfigData('cctypes');
78
+ if ($availableTypes) {
79
+ $availableTypes = explode(',', $availableTypes);
80
+ foreach ($types as $code => $name) {
81
+ if (! in_array($code, $availableTypes)) {
82
+ unset($types[$code]);
83
+ }
84
+ }
85
+ }
86
+ }
87
+ return $types;
88
+ }
89
+
90
+ /**
91
+ * Retrieve credit card expire months
92
+ *
93
+ * @return array
94
+ */
95
+ public function getCcMonths()
96
+ {
97
+ $months = $this->getData('cc_months');
98
+ if (is_null($months)) {
99
+ $months[0] = $this->__('Month');
100
+ $months = array_merge($months, $this->_getConfig()->getMonths());
101
+ $this->setData('cc_months', $months);
102
+ }
103
+ return $months;
104
+ }
105
+
106
+ /**
107
+ * Retrieve credit card expire years
108
+ *
109
+ * @return array
110
+ */
111
+ public function getCcYears()
112
+ {
113
+ $years = $this->getData('cc_years');
114
+ if (is_null($years)) {
115
+ $years = $this->_getConfig()->getYears();
116
+ $years = array(
117
+ 0 => $this->__('Year')
118
+ ) + $years;
119
+ $this->setData('cc_years', $years);
120
+ }
121
+ return $years;
122
+ }
123
+
124
+ /**
125
+ * Retrive has verification configuration
126
+ *
127
+ * @return boolean
128
+ */
129
+ public function hasVerification()
130
+ {
131
+ if ($this->getMethod()) {
132
+ $configData = $this->getMethod()->getConfigData('useccv');
133
+ if (is_null($configData)) {
134
+ return true;
135
+ }
136
+ return (bool) $configData;
137
+ }
138
+ return true;
139
+ }
140
+
141
+ /* Whether switch/solo card type available */
142
+ public function hasSsCardType()
143
+ {
144
+ $availableTypes = explode(',', $this->getMethod()->getConfigData('cctypes'));
145
+ $ssPresenations = array_intersect(array(
146
+ 'SS',
147
+ 'SM',
148
+ 'SO'
149
+ ), $availableTypes);
150
+ if ($availableTypes && count($ssPresenations) > 0) {
151
+ return true;
152
+ }
153
+ return false;
154
+ }
155
+
156
+ /* solo/switch card start year @return array */
157
+ public function getSsStartYears()
158
+ {
159
+ $years = array();
160
+ $first = date("Y");
161
+
162
+ for ($index = 5; $index >= 0; $index --) {
163
+ $year = $first - $index;
164
+ $years[$year] = $year;
165
+ }
166
+ $years = array(
167
+ 0 => $this->__('Year')
168
+ ) + $years;
169
+ return $years;
170
+ }
171
+
172
+ public function getPaypageEnabled()
173
+ {
174
+ return Mage::getStoreConfig('payment/CreditCard/paypage_enable');
175
+ }
176
+
177
+ public function getVaultEnabled()
178
+ {
179
+ return Mage::helper('palorus')->isVaultEnabled();
180
+ }
181
+
182
+ /**
183
+ *
184
+ * @return Litle_Palorus_Model_Mysql4_Vault_Collection
185
+ */
186
+ public function getStoredCards()
187
+ {
188
+ if (is_null($this->_storedCards)) {
189
+ $this->_storedCards = Mage::getModel('palorus/vault')->getCollection()->addCustomerFilter(Mage::helper('palorus')->getCustomer());
190
+ }
191
+ return $this->_storedCards;
192
+ }
193
+
194
+ public function hasStoredCards()
195
+ {
196
+ if (count($this->getStoredCards())) {
197
+ return true;
198
+ }
199
+ return false;
200
+ }
201
+
202
+ /**
203
+ * Render block HTML
204
+ *
205
+ * @return string
206
+ */
207
+ protected function _toHtml()
208
+ {
209
+ Mage::dispatchEvent('payment_form_block_to_html_before', array(
210
+ 'block' => $this
211
+ ));
212
+ return parent::_toHtml();
213
+ }
214
  }
215
 
app/code/local/Litle/CreditCard/Helper/Data.php CHANGED
@@ -27,40 +27,31 @@ class Litle_CreditCard_Helper_Data extends Mage_Core_Helper_Abstract
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
  }
27
  return ($this->isMOPLitleCC($mop) || $this->isMOPLitleECheck($mop));
28
  }
29
 
30
+ // This method converts dollars to cents, and takes care of trailing decimals if any.
31
+ public function formatAmount($amountInDecimal, $roundUp) {
32
+ if( empty($amountInDecimal) || $amountInDecimal === "" )
33
+ return $amountInDecimal;
34
+
35
+ $amountInCents = ((double)$amountInDecimal) * 100;
36
+ $amountToReturn = (int)$amountInCents;
37
+
38
+ // check to see if we have left over decimals -- i.e. the incoming amount had more than 2 decimals
39
+ if( $amountInCents != (double)$amountToReturn)
40
+ {
41
+ // yes, more decimals than needed indeed!
42
+ $amountToReturn = ($roundUp) ? ($amountToReturn + 1) : ($amountToReturn);
43
  }
44
+ return $amountToReturn;
 
45
  }
46
+
47
+ /**
48
+ * Are we using the sandbox?
49
+ *
50
+ * @return boolean
51
+ */
52
+ public function isSandbox()
53
+ {
54
+ $url = Mage::getStoreConfig('payment/CreditCard/url');
55
+ return (stristr($url, '.testlitle.com/sandbox') !== false);
 
 
 
 
 
 
 
 
 
56
  }
57
  }
app/code/local/Litle/CreditCard/Model/Order/Payment.php CHANGED
@@ -32,12 +32,12 @@ class Litle_CreditCard_Model_Order_Payment extends Mage_Sales_Model_Order_Paymen
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)
@@ -55,7 +55,7 @@ class Litle_CreditCard_Model_Order_Payment extends Mage_Sales_Model_Order_Paymen
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.";
@@ -88,7 +88,7 @@ class Litle_CreditCard_Model_Order_Payment extends Mage_Sales_Model_Order_Paymen
88
  $orderItem->setRowInvoiced(0);
89
  $orderItem->setBaseRowInvoiced(0);
90
  }
91
-
92
  $order
93
  ->setBaseDiscountInvoiced(0)
94
  ->setBaseShippingInvoiced(0)
@@ -107,19 +107,19 @@ class Litle_CreditCard_Model_Order_Payment extends Mage_Sales_Model_Order_Paymen
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
@@ -129,7 +129,7 @@ class Litle_CreditCard_Model_Order_Payment extends Mage_Sales_Model_Order_Paymen
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)
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)
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.";
88
  $orderItem->setRowInvoiced(0);
89
  $orderItem->setBaseRowInvoiced(0);
90
  }
91
+
92
  $order
93
  ->setBaseDiscountInvoiced(0)
94
  ->setBaseShippingInvoiced(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(Mage_Sales_Model_Order_Invoice::STATE_CANCELED)->save();
121
  }
122
+
123
 
124
 
125
  // update transactions, order state and add comments
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)
app/code/local/Litle/CreditCard/Model/PaymentLogic.php CHANGED
@@ -1,72 +1,74 @@
1
  <?php
2
- require_once('Litle/LitleSDK/LitleOnline.php');
3
 
4
  class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
5
  {
 
6
  /**
7
  * unique internal payment method identifier
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
15
  */
16
- protected $_isGateway = true;
17
 
18
  /**
19
  * can this method authorise?
20
  */
21
- protected $_canAuthorize = true;
22
 
23
  /**
24
  * can this method capture funds?
25
  */
26
- protected $_canCapture = true;
27
 
28
  /**
29
  * can we capture only partial amounts?
30
  */
31
- protected $_canCapturePartial = true;
32
 
33
  /**
34
  * can this method refund?
35
  */
36
- protected $_canRefund = true;
37
 
38
- protected $_canRefundInvoicePartial = true;
39
 
40
  /**
41
  * can this method void transactions?
42
  */
43
- protected $_canVoid = true;
44
 
45
  /**
46
  * can admins use this payment method?
47
  */
48
- protected $_canUseInternal = true;
49
 
50
  /**
51
  * show this method on the checkout page
52
  */
53
- protected $_canUseCheckout = true;
54
 
55
  /**
56
  * available for multi shipping checkouts?
57
  */
58
- protected $_canUseForMultishipping = true;
59
 
60
  /**
61
  * can this method save cc info for later use?
62
  */
63
  protected $_canSaveCc = false;
64
 
65
- public function getConfigData($fieldToLookFor, $store = NULL)
66
  {
67
  $returnFromThisModel = Mage::getStoreConfig('payment/CreditCard/' . $fieldToLookFor);
68
- if( $returnFromThisModel == NULL )
69
- $returnFromThisModel = parent::getConfigData($fieldToLookFor, $store);
 
70
 
71
  return $returnFromThisModel;
72
  }
@@ -74,48 +76,50 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
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
  }
@@ -123,56 +127,67 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
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]);
130
- $retArray["cardValidationNum"] = $payment->getCcCid();
131
 
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;
@@ -180,184 +195,187 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
180
 
181
  public function getContactInformation($contactInfo)
182
  {
183
- if(!empty($contactInfo)){
184
  $retArray = array();
185
- $retArray["firstName"] =$contactInfo->getFirstname();
186
- $retArray["lastName"] = $contactInfo->getLastname();
187
- $retArray["companyName"] = $contactInfo->getCompany();
188
- $retArray["addressLine1"] = $contactInfo->getStreet(1);
189
- $retArray["addressLine2"] = $contactInfo->getStreet(2);
190
- $retArray["addressLine3"] = $contactInfo->getStreet(3);
191
- $retArray["city"] = $contactInfo->getCity();
192
- $retArray["state"] = $contactInfo->getRegion();
193
- $retArray["zip"] = $contactInfo->getPostcode();
194
- $retArray["country"] = $contactInfo->getCountry();
195
- $retArray["email"] = $contactInfo->getCustomerEmail();
196
- $retArray["phone"] = $contactInfo->getTelephone();
197
  return $retArray;
198
  }
199
- return NULL;
200
  }
201
 
202
-
203
  public function getBillToAddress(Varien_Object $payment)
204
  {
205
  $order = $payment->getOrder();
206
- if(!empty($order)){
207
- $billing = $order ->getBillingAddress();
208
- if(!empty($billing)){
209
  return $this->getContactInformation($billing);
210
  }
211
  }
212
- return NULL;
213
  }
214
 
215
  public function getShipToAddress(Varien_Object $payment)
216
  {
217
  $order = $payment->getOrder();
218
- if(!empty($order)){
219
  $shipping = $order->getShippingAddress();
220
- if(!empty($shipping)){
221
  return $this->getContactInformation($shipping);
222
  }
223
  }
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.2',
257
- 'reportGroup'=>$this->getMerchantId($payment),
258
- 'customerId'=> $order->getCustomerEmail(),
259
- 'url'=>$this->getConfigData("url"),
260
- 'proxy'=>$this->getConfigData("proxy"),
261
- 'timeout'=>$this->getConfigData("timeout")
 
262
  );
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()*100,
355
- 'shippingAmount'=>$order->getShippingAmount()*100,
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
  }
@@ -365,255 +383,319 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
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;
410
- if( isset($litleResponse))
411
- {
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
- {
438
- $payment
439
- ->setStatus("Approved")
440
- ->setCcTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
441
- ->setLastTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
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
458
- * a transaction
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
 
500
  /**
501
- * this method is called if we are authorising AND
502
- * capturing a transaction
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
  }
 
 
 
 
559
  }
560
- $this->processResponse($payment,$litleResponse);
 
 
561
  }
562
 
563
  /**
564
  * called if refunding
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
 
589
  /**
590
  * called if voiding a payment
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(
599
- 'litleTxnId' => $payment->getCcTransId()
600
  );
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
  }
1
  <?php
2
+ require_once ('Litle/LitleSDK/LitleOnline.php');
3
 
4
  class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
5
  {
6
+
7
  /**
8
  * unique internal payment method identifier
9
  */
10
  protected $_code = 'creditcard';
11
 
12
  protected $_formBlockType = 'creditcard/form_creditCard';
13
+
14
  /**
15
+ * this should probably be true if you're using this method to take payments
 
16
  */
17
+ protected $_isGateway = true;
18
 
19
  /**
20
  * can this method authorise?
21
  */
22
+ protected $_canAuthorize = true;
23
 
24
  /**
25
  * can this method capture funds?
26
  */
27
+ protected $_canCapture = true;
28
 
29
  /**
30
  * can we capture only partial amounts?
31
  */
32
+ protected $_canCapturePartial = true;
33
 
34
  /**
35
  * can this method refund?
36
  */
37
+ protected $_canRefund = true;
38
 
39
+ protected $_canRefundInvoicePartial = true;
40
 
41
  /**
42
  * can this method void transactions?
43
  */
44
+ protected $_canVoid = true;
45
 
46
  /**
47
  * can admins use this payment method?
48
  */
49
+ protected $_canUseInternal = true;
50
 
51
  /**
52
  * show this method on the checkout page
53
  */
54
+ protected $_canUseCheckout = true;
55
 
56
  /**
57
  * available for multi shipping checkouts?
58
  */
59
+ protected $_canUseForMultishipping = true;
60
 
61
  /**
62
  * can this method save cc info for later use?
63
  */
64
  protected $_canSaveCc = false;
65
 
66
+ public function getConfigData($fieldToLookFor, $store = null)
67
  {
68
  $returnFromThisModel = Mage::getStoreConfig('payment/CreditCard/' . $fieldToLookFor);
69
+ if (is_null($returnFromThisModel)) {
70
+ $returnFromThisModel = parent::getConfigData($fieldToLookFor, $store);
71
+ }
72
 
73
  return $returnFromThisModel;
74
  }
76
  public function isFromVT($payment, $txnType)
77
  {
78
  $parentTxnId = $payment->getParentTransactionId();
79
+ if ($parentTxnId == 'Litle VT') {
80
+ Mage::throwException(
81
+ "This order was placed using Litle Virtual Terminal. Please process the $txnType by logging into Litle Virtual Terminal (https://vt.litle.com).");
82
  }
83
  }
84
 
85
  public function assignData($data)
86
  {
87
+ if (! ($data instanceof Varien_Object)) {
88
+ $data = new Varien_Object($data);
89
+ }
 
 
90
 
91
+ if ($this->getConfigData('paypage_enabled')) {
92
  $info = $this->getInfoInstance();
93
  $info->setAdditionalInformation('paypage_enabled', $data->getPaypageEnabled());
94
  $info->setAdditionalInformation('paypage_registration_id', $data->getPaypageRegistrationId());
95
  $info->setAdditionalInformation('paypage_order_id', $data->getOrderId());
96
  $info->setAdditionalInformation('cc_vaulted', $data->getCcVaulted());
97
+ $info->setAdditionalInformation('cc_should_save', $data->getCcShouldSave());
98
  }
 
 
99
 
100
+ if ($this->getConfigData('vault_enable')) {
101
+ $info->setAdditionalInformation('cc_vaulted', $data->getCcVaulted());
102
+ $info->setAdditionalInformation('cc_should_save', $data->getCcShouldSave());
103
+ }
104
 
105
+ return parent::assignData($data);
106
+ }
107
 
108
  public function validate()
109
  {
110
+ // no cc validation required.
111
  return $this;
112
  }
113
 
114
  public function litleCcTypeEnum(Varien_Object $payment)
115
  {
116
+ $typeEnum = '';
117
+ if ($payment->getCcType() == 'AE') {
118
+ $typeEnum = 'AX';
119
+ } elseif ($payment->getCcType() == 'JCB') {
120
+ $typeEnum = 'JC';
121
+ } else {
122
+ $typeEnum = $payment->getCcType();
 
 
123
  }
124
  return $typeEnum;
125
  }
127
  public function getCreditCardInfo(Varien_Object $payment)
128
  {
129
  $retArray = array();
130
+ $retArray['type'] = $this->litleCcTypeEnum($payment);
131
+ $retArray['number'] = $payment->getCcNumber();
132
+ preg_match('/\d\d(\d\d)/', $payment->getCcExpYear(), $expYear);
133
+ $retArray['expDate'] = sprintf('%02d%02d', $payment->getCcExpMonth(), $expYear[1]);
134
+ $retArray['cardValidationNum'] = $payment->getCcCid();
135
 
136
  return $retArray;
137
  }
138
 
139
+ /**
140
+ * Return the last 4 digits of the card number.
141
+ *
142
+ * @param Varien_Object $payment
143
+ * @return string
144
+ */
145
+ public function getCcLast4($payment)
146
+ {
147
+ $numbersOnly = preg_replace('/[^0-9]*/', '', $payment->getCcNumber());
148
+ return substr($numbersOnly, - 4, 4);
149
+ }
150
+
151
  public function getPaypageInfo($payment)
152
  {
153
  $info = $this->getInfoInstance();
154
 
155
  $retArray = array();
156
+ $retArray['type'] = $this->litleCcTypeEnum($payment);
157
+ $retArray['paypageRegistrationId'] = $info->getAdditionalInformation('paypage_registration_id');
158
+ preg_match('/\d\d(\d\d)/', $payment->getCcExpYear(), $expYear);
159
+ $retArray['expDate'] = sprintf('%02d%02d', $payment->getCcExpMonth(), $expYear[1]);
160
+ $retArray['cardValidationNum'] = $payment->getCcCid();
161
 
162
  return $retArray;
163
  }
164
 
165
  public function getTokenInfo($payment)
166
  {
167
+ $vaultIndex = $this->getInfoInstance()->getAdditionalInformation('cc_vaulted');
168
+ $vaultCard = Mage::getModel('palorus/vault')->load($vaultIndex);
 
 
169
 
170
  $retArray = array();
171
+ $retArray['type'] = $vaultCard->getType();
172
+ $retArray['litleToken'] = $vaultCard->getToken();
173
+ $retArray['cardValidationNum'] = $payment->getCcCid();
174
+
175
+ $payment->setCcLast4($vaultCard->getLast4());
176
+ $payment->setCcType($vaultCard->getType());
177
+
178
  return $retArray;
179
  }
180
+
181
+ public function creditCardOrPaypageOrToken($payment)
182
+ {
183
  $info = $this->getInfoInstance();
184
  $vaultIndex = $info->getAdditionalInformation('cc_vaulted');
185
  $payment_hash = array();
186
+ if ($vaultIndex > 0) {
187
  $payment_hash['token'] = $this->getTokenInfo($payment);
188
+ } elseif ($info->getAdditionalInformation('paypage_enabled') == '1') {
 
189
  $payment_hash['paypage'] = $this->getPaypageInfo($payment);
190
+ } else {
 
191
  $payment_hash['card'] = $this->getCreditCardInfo($payment);
192
  }
193
  return $payment_hash;
195
 
196
  public function getContactInformation($contactInfo)
197
  {
198
+ if (! empty($contactInfo)) {
199
  $retArray = array();
200
+ $retArray['firstName'] = $contactInfo->getFirstname();
201
+ $retArray['lastName'] = $contactInfo->getLastname();
202
+ $retArray['companyName'] = $contactInfo->getCompany();
203
+ $retArray['addressLine1'] = $contactInfo->getStreet(1);
204
+ $retArray['addressLine2'] = $contactInfo->getStreet(2);
205
+ $retArray['addressLine3'] = $contactInfo->getStreet(3);
206
+ $retArray['city'] = $contactInfo->getCity();
207
+ $retArray['state'] = $contactInfo->getRegion();
208
+ $retArray['zip'] = $contactInfo->getPostcode();
209
+ $retArray['country'] = $contactInfo->getCountry();
210
+ $retArray['email'] = $contactInfo->getCustomerEmail();
211
+ $retArray['phone'] = $contactInfo->getTelephone();
212
  return $retArray;
213
  }
214
+ return null;
215
  }
216
 
 
217
  public function getBillToAddress(Varien_Object $payment)
218
  {
219
  $order = $payment->getOrder();
220
+ if (! empty($order)) {
221
+ $billing = $order->getBillingAddress();
222
+ if (! empty($billing)) {
223
  return $this->getContactInformation($billing);
224
  }
225
  }
226
+ return null;
227
  }
228
 
229
  public function getShipToAddress(Varien_Object $payment)
230
  {
231
  $order = $payment->getOrder();
232
+ if (! empty($order)) {
233
  $shipping = $order->getShippingAddress();
234
+ if (! empty($shipping)) {
235
  return $this->getContactInformation($shipping);
236
  }
237
  }
238
+ return null;
239
  }
240
 
 
241
  public function getIpAddress(Varien_Object $payment)
242
  {
243
  $order = $payment->getOrder();
244
+ if (! empty($order)) {
245
  return $order->getRemoteIp();
246
  }
247
+ return null;
248
  }
249
 
250
+ public function getMerchantId(Varien_Object $payment)
251
+ {
 
252
  $order = $payment->getOrder();
253
  $currency = $order->getOrderCurrencyCode();
254
+ $string2Eval = 'return array' . $this->getConfigData('merchant_id') . ';';
255
  $merchant_map = eval($string2Eval);
256
  $merchantId = $merchant_map[$currency];
257
  return $merchantId;
258
  }
259
 
 
260
  public function merchantData(Varien_Object $payment)
261
  {
262
  $order = $payment->getOrder();
263
+ $hash = array(
264
+ 'user' => $this->getConfigData('user'),
265
+ 'password' => $this->getConfigData('password'),
266
+ 'merchantId' => $this->getMerchantId($payment),
267
+ 'version' => '8.10',
268
+ 'merchantSdk' => 'Magento;8.13.2',
269
+ 'reportGroup' => $this->getMerchantId($payment),
270
+ 'customerId' => $order->getCustomerEmail(),
271
+ 'url' => $this->getConfigData('url'),
272
+ 'proxy' => $this->getConfigData('proxy'),
273
+ 'timeout' => $this->getConfigData('timeout')
274
  );
275
  return $hash;
276
  }
277
 
278
+ public function getCustomBilling($url)
279
+ {
280
  $retArray = array();
281
 
282
+ if (strlen($url) > 13) {
283
+ $url = str_replace('http://', '', $url);
284
+ $url = str_replace('https://', '', $url);
285
+ $url_temp = explode('/', $url);
286
  $url = $url_temp['0'];
287
+ if (strlen($url) > 13) {
288
+ $url = str_replace('www.', '', $url);
289
+ if (strlen($url) > 13) {
290
+ $url_temp2 = explode('.', $url);
291
  $count = count($url_temp2);
292
+ }
293
+ if ($count < 3) {
294
+ if (strlen($url_temp2['0'] . '.' . $url_temp2['1']) > 13) {
295
  $url = $url_temp2['0'];
296
+ } else {
297
  $url = $url_temp2['0'] . '.' . $url_temp2['1'];
298
  }
299
  }
300
  }
301
  }
302
+
303
+ $url = substr($url, 0, 13);
304
+ if (substr($url, 12) === '.') {
305
+ $url = substr($url, 0, 12);
306
+ } elseif (substr($url, 0) === '.') {
307
+ $url = substr($url, 1, 12);
 
308
  }
309
  $retArray['url'] = $url;
310
 
311
  return $retArray;
312
  }
313
 
314
+ public function getOrderDate(Varien_Object $payment)
315
+ {
316
  $order = $payment->getOrder();
317
  $date = $order->getCreatedAtFormated(short);
318
+ $date_temp = explode('/', $date);
319
  $month = $date_temp['0'];
320
+ if ((int) $month < 10) {
321
  $month = '0' . $month;
322
  }
323
+ $day = $date_temp['1'];
324
+ if ((int) $day < 10) {
325
  $day = '0' . $day;
326
  }
327
+ $year_temp = explode(' ', $date_temp['2']);
328
  $year = '20' . $year_temp['0'];
329
  return $year . '-' . $month . '-' . $day;
330
  }
331
 
332
+ public function getLineItemData(Varien_Object $payment)
333
+ {
334
  $order = $payment->getOrder();
335
  $items = $order->getAllItems();
336
  $i = 0;
337
  $lineItemArray = array();
338
+ foreach ($items as $itemId => $item) {
 
339
  $name = $item->getName();
340
+ $unitPrice = $item->getPrice();
341
+ $sku = $item->getSku();
342
+ $ids = $item->getProductId();
343
+ $qty = $item->getQtyToInvoice();
344
+
345
+ if (strlen($name) > 26)
346
+ $name = substr($name, 0, 26);
347
+
348
  $lineItemArray[$i] = array(
349
+ 'itemSequenceNumber' => ($i + 1),
350
+ 'itemDescription' => $name,
351
+ 'productCode' => $ids,
352
+ 'quantity' => $qty,
353
+ 'lineItemTotal' => Mage::helper('creditcard')->formatAmount(($unitPrice * $qty), true),
354
+ 'unitCost' => Mage::helper('creditcard')->formatAmount(($unitPrice), true)
355
+ );
356
+ $i ++;
357
  }
358
  return $lineItemArray;
359
  }
360
 
 
361
  public function getEnhancedData(Varien_Object $payment)
362
  {
363
  $order = $payment->getOrder();
364
  $billing = $order->getBillingAddress();
365
+
366
+ $hash = array(
367
+ 'salesTax' => Mage::helper('creditcard')->formatAmount($order->getTaxAmount(), true),
368
+ 'discountAmount' => Mage::helper('creditcard')->formatAmount($order->getDiscountAmount(), true),
369
+ 'shippingAmount' => Mage::helper('creditcard')->formatAmount($order->getShippingAmount(), true),
370
+ 'destinationPostalCode' => $billing->getPostcode(),
371
+ 'destinationCountryCode' => $billing->getCountry(),
372
+ 'orderDate' => $this->getOrderDate($payment),
373
+ 'detailTax' => array(
374
+ array(
375
+ 'taxAmount' => Mage::helper('creditcard')->formatAmount($order->getTaxAmount(), true)
376
+ )
377
+ ),
378
+ 'lineItemData' => $this->getLineItemData($payment)
379
  );
380
  return $hash;
381
  }
383
  public function getFraudCheck(Varien_Object $payment)
384
  {
385
  $order = $payment->getOrder();
386
+ $hash = array(
387
+ 'customerIpAddress' => $order->getRemoteIp()
388
  );
389
  return $hash;
390
  }
391
+
392
+ /**
393
+ * Parses Litle response to obtain update customer information.
394
+ *
395
+ * @param DOMDocument $litleResponse
396
+ * @param string $parentNode
397
+ * @param string $childNode
398
+ * @return DOMNode
399
+ */
400
+ public function getUpdater($litleResponse, $parentNode, $childNode = null)
401
+ {
402
+ if (is_null($childNode)) {
403
  $new = $litleResponse->getElementsByTagName($parentNode)->item(0);
404
+ } else {
405
+ $new = $litleResponse->getElementsByTagName($parentNode)
406
+ ->item(0)
407
+ ->getElementsByTagName($childNode)
408
+ ->item(0)->nodeValue;
409
  }
410
+
 
 
 
411
  return $new;
412
  }
413
+
414
+ /**
415
+ * Updates customer account information with most current from Litle.
416
+ *
417
+ * @param Varien_Object $payment
418
+ * @param DOMDocument $litleResponse
419
+ */
420
+ public function accountUpdater(Varien_Object $payment, $litleResponse)
421
+ {
422
+ if ($this->getUpdater($litleResponse, 'newCardInfo') !== null) {
423
+ $payment->setCcLast4(
424
+ substr($this->getUpdater($litleResponse, 'newCardInfo', 'number'), - 4));
425
+ $payment->setCcType($this->getUpdater($litleResponse, 'newCardInfo', 'type'));
426
+ $payment->setCcExpDate($this->getUpdater($litleResponse, 'newCardInfo', 'expDate'));
427
+ } elseif ($this->getUpdater($litleResponse, 'newCardTokenInfo') !== null) {
428
+ $payment->setCcNumber($this->getUpdater($litleResponse, 'newCardTokenInfo', 'litleToken'));
429
+ $payment->setCcLast4(
430
+ substr($this->getUpdater($litleResponse, 'newCardTokenInfo', 'litleToken'), - 4));
431
+ $payment->setCcType($this->getUpdater($litleResponse, 'newCardTokenInfo', 'type'));
432
+ $payment->setCcExpDate($this->getUpdater($litleResponse, 'newCardTokenInfo', 'expDate'));
433
+ }
434
  }
435
+
436
+ /**
437
+ * Update Vaulted card information.
438
+ *
439
+ * @param Varien_Object $payment
440
+ * @param DOMDocument $litleResponse
441
+ */
442
+ protected function _saveToken(Varien_Object $payment, DOMDocument $litleResponse)
443
+ {
444
+ if (!is_null($this->getUpdater($litleResponse, 'tokenResponse')) &&
445
+ !is_null($this->getUpdater($litleResponse, 'tokenResponse', 'litleToken'))) {
446
+
447
+ $vault = Mage::getModel('palorus/vault')->setTokenFromPayment(
448
+ $payment,
449
+ $this->getUpdater($litleResponse, 'tokenResponse', 'litleToken'),
450
+ $this->getUpdater($litleResponse, 'tokenResponse', 'bin'));
451
+
452
+ $this->getInfoInstance()->setAdditionalInformation('vault_id', $vault->getId());
453
+ }
454
+ }
455
+
456
+ /**
457
+ *
458
+ * @param Varien_Object $payment
459
+ * @param DOMDocument $litleResponse
460
+ * @throws Mage_Payment_Model_Info_Exception
461
+ * @return boolean
462
+ */
463
+ public function processResponse(Varien_Object $payment, $litleResponse)
464
+ {
465
+ $this->accountUpdater($payment, $litleResponse);
466
+
467
+ $message = XmlParser::getAttribute($litleResponse, 'litleOnlineResponse', 'message');
468
+ if ($message == 'Valid Format') {
469
+ $isSale = ($payment->getCcTransId() != null) ? false : true;
470
+ if (isset($litleResponse)) {
471
+ $litleResponseCode = XMLParser::getNode($litleResponse, 'response');
472
+ if ($litleResponseCode != '000') {
473
+ // Mage::throwException('response code is: ' .
474
+ // $litleResponseCode . 'txn type is: ');
475
+ if (($litleResponseCode === '362') && Mage::helper('creditcard')->isStateOfOrderEqualTo(
476
+ $payment->getOrder(), Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE)) {
477
+ Mage::throwException('The void did not go through. Do a refund instead.');
478
+ } else {
479
+ $payment->setStatus('Rejected')
480
+ ->setCcTransId(XMLParser::getNode($litleResponse, 'litleTxnId'))
481
+ ->setLastTransId(XMLParser::getNode($litleResponse, 'litleTxnId'))
482
+ ->setTransactionId(XMLParser::getNode($litleResponse, 'litleTxnId'))
483
+ ->setIsTransactionClosed(0)
484
+ ->setTransactionAdditionalInfo('additional_information',
485
+ XMLParser::getNode($litleResponse, 'message'));
486
+
487
+ if ($isSale)
488
+ throw new Mage_Payment_Model_Info_Exception(
489
+ Mage::helper('core')->__(
490
+ 'Transaction was not approved. Contact us or try again later.'));
491
  else
492
+ throw new Mage_Payment_Model_Info_Exception(
493
+ Mage::helper('core')->__(
494
+ 'Transaction was not approved. Contact Litle or try again later.'));
495
  }
496
+ } else {
497
+ $payment->setStatus('Approved')
498
+ ->setCcTransId(XMLParser::getNode($litleResponse, 'litleTxnId'))
499
+ ->setLastTransId(XMLParser::getNode($litleResponse, 'litleTxnId'))
500
+ ->setTransactionId(XMLParser::getNode($litleResponse, 'litleTxnId'))
501
+ ->setIsTransactionClosed(0)
502
+ ->setTransactionAdditionalInfo('additional_information',
503
+ XMLParser::getNode($litleResponse, 'message'));
 
 
 
504
  }
505
  return true;
506
  }
507
+ } else {
 
508
  Mage::throwException($message);
509
  }
 
 
510
  }
511
+
512
  /**
513
+ * this method is called if we are just authorising a transaction
 
514
  */
515
  public function authorize(Varien_Object $payment, $amount)
516
  {
517
+ // @TODO This is the wrong way to do this.
518
+ if (preg_match('/sales_order_create/i', $_SERVER['REQUEST_URI']) &&
519
+ ($this->getConfigData('paypage_enable') == '1')) {
520
+ $payment->setStatus('N/A')
521
+ ->setCcTransId('Litle VT')
522
+ ->setLastTransId('Litle VT')
523
+ ->setTransactionId('Litle VT')
524
+ ->setIsTransactionClosed(0)
525
+ ->setCcType('Litle VT');
526
+ } else {
 
527
  $order = $payment->getOrder();
528
+ $orderId = $order->getIncrementId();
529
+ $amountToPass = Mage::helper('creditcard')->formatAmount($amount, true);
530
+
531
+ if (! empty($order)) {
532
+ $info = $this->getInfoInstance();
533
+ if (!$info->getAdditionalInformation('orderSource')) {
534
+ $info->setAdditionalInformation('orderSource', 'ecommerce');
535
+ }
536
+
537
  $hash = array(
538
+ 'orderId' => $orderId,
539
+ 'amount' => $amountToPass,
540
+ 'orderSource' => $info->getAdditionalInformation('orderSource'),
541
+ 'billToAddress' => $this->getBillToAddress($payment),
542
+ 'shipToAddress' => $this->getAddressInfo($payment),
543
+ 'cardholderAuthentication' => $this->getFraudCheck($payment),
544
+ 'enhancedData' => $this->getEnhancedData($payment),
545
+ 'customBilling' => $this->getCustomBilling(
546
+ Mage::app()->getStore()
547
+ ->getBaseUrl())
548
  );
549
+
550
+
551
+
552
  $payment_hash = $this->creditCardOrPaypageOrToken($payment);
553
+ $hash_temp = array_merge($hash, $payment_hash);
554
  $merchantData = $this->merchantData($payment);
555
+ $hash_in = array_merge($hash_temp, $merchantData);
556
+
557
  $litleRequest = new LitleOnlineRequest();
558
  $litleResponse = $litleRequest->authorizationRequest($hash_in);
559
+ $this->processResponse($payment, $litleResponse);
560
+
561
+ Mage::helper('palorus')->saveCustomerInsight($payment, $litleResponse);
562
+ if (!is_null($info->getAdditionalInformation('cc_should_save'))) {
563
+ $this->_saveToken($payment, $litleResponse);
564
+ }
565
  }
566
  }
567
+
568
+ return $this;
569
  }
570
 
571
  /**
572
+ * this method is called if we are authorising AND capturing a transaction
 
573
  */
574
+ public function capture(Varien_Object $payment, $amount)
575
  {
576
+ if (preg_match('/sales_order_create/i', $_SERVER['REQUEST_URI']) &&
577
+ ($this->getConfigData('paypage_enable') == '1')) {
578
+ $payment->setStatus('N/A')
579
+ ->setCcTransId('Litle VT')
580
+ ->setLastTransId('Litle VT')
581
+ ->setTransactionId('Litle VT')
582
+ ->setIsTransactionClosed(0)
583
+ ->setCcType('Litle VT');
 
584
 
585
  return;
586
  }
587
 
588
+ $this->isFromVT($payment, 'capture');
589
 
590
  $order = $payment->getOrder();
591
+ if (! empty($order)) {
592
+ $info = $this->getInfoInstance();
593
+ if (!$info->getAdditionalInformation('orderSource')) {
594
+ $info->setAdditionalInformation('orderSource', 'ecommerce');
595
+ }
596
 
597
+ $orderId = $order->getIncrementId();
598
+ $amountToPass = Mage::helper('creditcard')->formatAmount($amount, true);
599
+ $isPartialCapture = ($amount < $order->getGrandTotal()) ? 'true' : 'false';
600
+ $isSale = ($payment->getCcTransId() != null) ? false : true;
601
 
602
+ if (! $isSale) {
 
603
  $hash = array(
604
+ 'litleTxnId' => $payment->getParentTransactionId(),
605
+ 'amount' => $amountToPass,
606
+ 'partial' => $isPartialCapture
607
  );
608
  } else {
609
  $hash_temp = array(
610
+ 'orderId' => $orderId,
611
+ 'amount' => $amountToPass,
612
+ 'orderSource' => $info->getAdditionalInformation('orderSource'),
613
+ 'billToAddress' => $this->getBillToAddress($payment),
614
+ 'shipToAddress' => $this->getAddressInfo($payment),
615
+ 'enhancedData' => $this->getEnhancedData($payment)
616
  );
617
  $payment_hash = $this->creditCardOrPaypageOrToken($payment);
618
+ $hash = array_merge($hash_temp, $payment_hash);
619
  }
620
  $merchantData = $this->merchantData($payment);
621
+ $hash_in = array_merge($hash, $merchantData);
622
  $litleRequest = new LitleOnlineRequest();
623
 
624
+ if ($isSale) {
 
625
  $litleResponse = $litleRequest->saleRequest($hash_in);
626
+ Mage::helper('palorus')->saveCustomerInsight($payment, $litleResponse);
 
627
  } else {
628
  $litleResponse = $litleRequest->captureRequest($hash_in);
629
  }
630
+
631
+ if (! is_null($info->getAdditionalInformation('cc_should_save'))) {
632
+ $this->_saveToken($payment, $litleResponse);
633
+ }
634
  }
635
+ $this->processResponse($payment, $litleResponse);
636
+
637
+ return $this;
638
  }
639
 
640
  /**
641
  * called if refunding
642
  */
643
+ public function refund(Varien_Object $payment, $amount)
644
  {
645
+ $this->isFromVT($payment, 'refund');
646
+
647
  $order = $payment->getOrder();
648
  $isPartialRefund = ($amount < $order->getGrandTotal()) ? true : false;
649
+
650
+ $amountToPass = Mage::helper('creditcard')->formatAmount($amount, true);
651
+ if (! empty($order)) {
652
+ $hash = array(
653
+ 'litleTxnId' => $payment->getCcTransId(),
654
+ 'amount' => $amountToPass
655
+ );
656
+ $merchantData = $this->merchantData($payment);
657
+ $hash_in = array_merge($hash, $merchantData);
658
+ $litleRequest = new LitleOnlineRequest();
659
+ $litleResponse = $litleRequest->creditRequest($hash_in);
660
+ }
661
+ $this->processResponse($payment, $litleResponse);
662
+
663
  return $this;
664
  }
665
 
666
  /**
667
  * called if voiding a payment
668
  */
669
+ public function void(Varien_Object $payment)
670
  {
671
+ $this->isFromVT($payment, 'void');
672
 
673
  $order = $payment->getOrder();
674
+ if (! empty($order)) {
675
  $hash = array(
676
+ 'litleTxnId' => $payment->getCcTransId()
677
  );
678
  $merchantData = $this->merchantData($payment);
679
+ $hash_in = array_merge($hash, $merchantData);
680
  $litleRequest = new LitleOnlineRequest();
681
+
682
+ if (Mage::helper('creditcard')->isStateOfOrderEqualTo($order,
683
+ Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH)) {
684
  $litleResponse = $litleRequest->authReversalRequest($hash_in);
685
+ } else {
686
+ $litleResponse = $litleRequest->voidRequest($hash_in);
687
+ }
688
  }
689
+ $this->processResponse($payment, $litleResponse);
690
+
691
+ return $this;
692
  }
693
+
694
  public function cancel(Varien_Object $payment)
695
  {
696
  $this->void($payment);
 
697
 
698
+
699
+ return $this;
700
+ }
701
  }
app/code/local/Litle/CreditCard/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Litle_CreditCard>
5
- <version>8.13.2</version>
6
  </Litle_CreditCard>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Litle_CreditCard>
5
+ <version>8.13.3</version>
6
  </Litle_CreditCard>
7
  </modules>
8
  <global>
app/code/local/Litle/CreditCard/etc/system.xml CHANGED
@@ -111,31 +111,42 @@
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>
139
  </payment>
140
  </sections>
141
- </config>
111
  <paypage_id translate="label">
112
  <label>Paypage Id</label>
113
  <frontend_type>text</frontend_type>
114
+ <sort_order>101</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
+ <depends><paypage_enable>1</paypage_enable></depends>
119
  </paypage_id>
120
  <paypage_url translate="label">
121
  <label>Paypage Merchant URL</label>
122
  <frontend_type>text</frontend_type>
123
+ <sort_order>101</sort_order>
124
  <show_in_default>1</show_in_default>
125
  <show_in_website>1</show_in_website>
126
  <show_in_store>0</show_in_store>
127
+ <depends><paypage_enable>1</paypage_enable></depends>
128
  </paypage_url>
129
  <paypage_enable translate="label">
130
  <label>Paypage Enabled</label>
131
  <frontend_type>select</frontend_type>
132
  <source_model>adminhtml/system_config_source_yesno</source_model>
133
+ <sort_order>100</sort_order>
134
  <show_in_default>1</show_in_default>
135
  <show_in_website>1</show_in_website>
136
  <show_in_store>0</show_in_store>
137
  </paypage_enable>
138
+ <vault_enable translate="label">
139
+ <label>Vault Enabled</label>
140
+ <frontend_type>select</frontend_type>
141
+ <source_model>adminhtml/system_config_source_yesno</source_model>
142
+ <sort_order>110</sort_order>
143
+ <show_in_default>1</show_in_default>
144
+ <show_in_website>1</show_in_website>
145
+ <show_in_store>0</show_in_store>
146
+ </vault_enable>
147
  </fields>
148
  </CreditCard>
149
  </groups>
150
  </payment>
151
  </sections>
152
+ </config>
app/code/local/Litle/LEcheck/Block/Form/LEcheck.php CHANGED
@@ -4,7 +4,7 @@ class Litle_LEcheck_Block_Form_LEcheck extends Mage_Payment_Block_Form
4
  protected function _construct()
5
  {
6
  parent::_construct();
7
- $this->setTemplate('payment/form/litleecheck.phtml');
8
  }
9
 
10
  public function getAccountAvailableTypes()
@@ -23,4 +23,4 @@ class Litle_LEcheck_Block_Form_LEcheck extends Mage_Payment_Block_Form
23
  }
24
  return $types;
25
  }
26
- }
4
  protected function _construct()
5
  {
6
  parent::_construct();
7
+ $this->setTemplate('litle/form/litleecheck.phtml');
8
  }
9
 
10
  public function getAccountAvailableTypes()
23
  }
24
  return $types;
25
  }
26
+ }
app/code/local/Litle/LEcheck/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Litle_LEcheck>
5
- <version>8.13.2</version>
6
  </Litle_LEcheck>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Litle_LEcheck>
5
+ <version>8.13.3</version>
6
  </Litle_LEcheck>
7
  </modules>
8
  <global>
app/code/local/Litle/LitleSDK/Obj2xml.php CHANGED
@@ -62,14 +62,14 @@ class Obj2xml {
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))
74
  {
75
  $node = $transacType->addChild($key);
62
  {
63
  if ($value === "REQUIRED"){
64
  throw new InvalidArgumentException("Missing Required Field: /$key/");
65
+ }elseif (substr($key, 0, 12) === '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,str_replace('&','&amp;',$value));
73
  }elseif(is_array($value))
74
  {
75
  $node = $transacType->addChild($key);
app/code/local/Litle/Palorus/Block/Adminhtml/Customer/Edit/Tab/Vault.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Litle Vault Info block
5
+ *
6
+ * @author jholden
7
+ */
8
+ class Litle_Palorus_Block_Adminhtml_Customer_Edit_Tab_Vault
9
+ extends Mage_Adminhtml_Block_Template
10
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
11
+ {
12
+
13
+ protected function _construct()
14
+ {
15
+ parent::_construct();
16
+ $this->setTemplate('litle/customer/tab/vault.phtml');
17
+ }
18
+
19
+ /**
20
+ * Returns the registry customer.
21
+ *
22
+ * @return Mage_Customer_Model_Customer
23
+ */
24
+ public function getCustomer()
25
+ {
26
+ return Mage::registry('current_customer');
27
+ }
28
+
29
+ /**
30
+ * Returns a collection of vaulted cards for the registry customer.
31
+ *
32
+ * @return Litle_Palorus_Model_Mysql4_Vault_Collection
33
+ */
34
+ public function getStoredCards()
35
+ {
36
+ return Mage::getModel('palorus/vault')->getCollection()->addCustomerFilter($this->getCustomer());
37
+ }
38
+
39
+ /**
40
+ * URL to delete a stored card.
41
+ *
42
+ * @param Litle_Palorus_Model_Vault $card
43
+ * @return string
44
+ */
45
+ public function getCardDeleteUrl(Litle_Palorus_Model_Vault $card)
46
+ {
47
+ $params = array(
48
+ 'customer_id' => $this->getCustomer()->getId(),
49
+ 'vault_id' => $card->getId()
50
+ );
51
+ return $this->getUrl('palorus/adminhtml_vault/deleteCard', $params);
52
+ }
53
+
54
+ /**
55
+ * Retrieve the label used for the tab relating to this block
56
+ *
57
+ * @return string
58
+ */
59
+ public function getTabLabel()
60
+ {
61
+ return $this->__('Litle Stored Cards');
62
+ }
63
+
64
+ /**
65
+ * Retrieve the title used by this tab
66
+ *
67
+ * @return string
68
+ */
69
+ public function getTabTitle()
70
+ {
71
+ return $this->__('Click here to view stored cards for this customer');
72
+ }
73
+
74
+ /**
75
+ * Determines whether to display the tab
76
+ * Add logic here to decide whether you want the tab to display
77
+ *
78
+ * @return bool
79
+ */
80
+ public function canShowTab()
81
+ {
82
+ return true;
83
+ }
84
+
85
+ /**
86
+ * Stops the tab being hidden
87
+ *
88
+ * @return bool
89
+ */
90
+ public function isHidden()
91
+ {
92
+ return false;
93
+ }
94
+ }
app/code/local/Litle/Palorus/Block/Vault.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Stored card rendering block
4
+ */
5
+ class Litle_Palorus_Block_Vault extends Mage_Core_Block_Abstract
6
+ {
7
+ /**
8
+ * @var array
9
+ */
10
+ protected $_params = array();
11
+
12
+ /**
13
+ * Renders the block.
14
+ *
15
+ * @return string
16
+ */
17
+ protected function _toHtml ()
18
+ {
19
+ if ($this->getPaymentProfile() && $this->getType()) {
20
+ switch ($this->getType()) {
21
+ case 'oneline':
22
+ return $this->_getOneline();
23
+ case 'json':
24
+ return $this->_getJson();
25
+ case 'html':
26
+ return $this->_getHtml();
27
+ }
28
+ }
29
+ return '';
30
+ }
31
+
32
+ /**
33
+ * Sets rendering params.
34
+ *
35
+ * Supported params:
36
+ * show_exp_date
37
+ * container_tag
38
+ *
39
+ * @param array $params
40
+ * @return Litle_Palorus_Block_Vault
41
+ */
42
+ public function setParams (array $params)
43
+ {
44
+ $this->_params = $params;
45
+ return $this;
46
+ }
47
+
48
+ /**
49
+ * Param getter.
50
+ *
51
+ * @param string $param
52
+ * @return mixed
53
+ */
54
+ public function getParam ($param)
55
+ {
56
+ return isset($this->_params[$param]) ? $this->_params[$param] : false;
57
+ }
58
+
59
+ /**
60
+ * @return string
61
+ */
62
+ protected function _getOneline ()
63
+ {
64
+ $profile = $this->getPaymentProfile();
65
+ $str = Mage::helper('palorus')->__(
66
+ 'Card Type: %s, xxxx-%s, Exp: %s/%s',
67
+ $profile->getType(),
68
+ $profile->getLast4(),
69
+ $profile->getExpirationMonth(),
70
+ $profile->getExpirationYear()
71
+ );
72
+ return $str;
73
+ }
74
+
75
+ /**
76
+ * @return string
77
+ */
78
+ protected function _getJson ()
79
+ {
80
+ $profile = $this->getPaymentProfile();
81
+ return Mage::helper('core')->jsonEncode($profile->getData());
82
+ }
83
+
84
+ /**
85
+ * @return string
86
+ */
87
+ protected function _getHtml ()
88
+ {
89
+ $profile = $this->getPaymentProfile();
90
+ $tag = $this->getParam('container_tag') ? $this->getParam('container_tag') : 'address';
91
+
92
+ $str = '<' . $tag . '>';
93
+ if ($profile->getCardType()) {
94
+ $str .= Mage::helper('palorus')->__('Card Type: %s<br />', $profile->getType());
95
+ }
96
+ $str .= Mage::helper('palorus')->__('Card Number: XXXX-%s<br />', $profile->getLast4());
97
+
98
+ if ($this->getParam('show_exp_date')) {
99
+ $str .= Mage::helper('palorus')->__('Expiration: %s/%s<br />', $profile->getExpirationMonth(), $profile->getExpirationYear());
100
+ }
101
+ $str = $str . '</' . $tag . '>';
102
+
103
+ return $str;
104
+ }
105
+ }
app/code/local/Litle/Palorus/Block/Vault/List.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_Palorus_Block_Vault_List extends Mage_Core_Block_Template
4
+ {
5
+
6
+ /**
7
+ * Retrieve customer model
8
+ *
9
+ * @return Mage_Customer_Model_Customer
10
+ */
11
+ public function getCustomer()
12
+ {
13
+ return Mage::getSingleton('customer/session')->getCustomer();
14
+ }
15
+
16
+ /**
17
+ * Returns an array of stored cards.
18
+ *
19
+ * @return array
20
+ */
21
+ public function getStoredCards()
22
+ {
23
+ if (!$this->hasData('stored_cards')) {
24
+ $cards = Mage::getModel('palorus/vault')->visibleStoredCards($this->getCustomer()
25
+ ->getId());
26
+
27
+ $this->setStoredCards($cards);
28
+ }
29
+ return $this->getData('stored_cards');
30
+ }
31
+
32
+ /**
33
+ *
34
+ * @return string
35
+ */
36
+ public function getDeleteUrl()
37
+ {
38
+ return $this->getUrl('*/*/delete');
39
+ }
40
+
41
+ /**
42
+ *
43
+ * @todo New card url
44
+ * @return string
45
+ */
46
+ // public function getAddUrl()
47
+ // {
48
+ // return $this->getUrl('*/*/new');
49
+ // }
50
+
51
+ /**
52
+ *
53
+ * @todo Edit card url
54
+ * @param OnePica_AuthnetCim_Model_PaymentProfile $profile
55
+ * @return string
56
+ */
57
+ // public function getEditUrl(OnePica_AuthnetCim_Model_PaymentProfile
58
+ // $profile)
59
+ // {
60
+ // return $this->getUrl('*/*/edit', array(
61
+ // 'profile_id' => $profile->getId()
62
+ // ));
63
+ // }
64
+ }
app/code/local/Litle/Palorus/Helper/Data.php CHANGED
@@ -1,128 +1,210 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_Palorus_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ /**
7
+ *
8
+ * @param Mage_Payment_Model_Abstract $payment
9
+ * @param unknown_type $litleResponse
10
+ */
11
+ public function saveCustomerInsight($payment, $litleResponse)
12
+ {
13
+ preg_match('/.*(\d\d\d\d)/', $payment->getCcNumber(), $matches);
14
+ $last4 = $matches[1];
15
+ $data = array(
16
+ 'customer_id' => $payment->getOrder()->getCustomerId(),
17
+ 'order_number' => XMLParser::getNode($litleResponse, 'orderId'),
18
+ 'order_id' => $payment->getOrder()->getId(),
19
+ 'affluence' => self::formatAffluence(XMLParser::getNode($litleResponse, 'affluence')),
20
+ 'last' => $last4,
21
+ 'order_amount' => self::formatAvailableBalance($payment->getAmountAuthorized()),
22
+ 'affluence' => self::formatAffluence(XMLParser::getNode($litleResponse, 'affluence')),
23
+ 'issuing_country' => XMLParser::getNode($litleResponse, 'issuerCountry'),
24
+ 'prepaid_card_type' => self::formatPrepaidCardType(
25
+ XMLParser::getNode($litleResponse, 'prepaidCardType')),
26
+ 'funding_source' => self::formatFundingSource(XMLParser::getNode($litleResponse, 'type')),
27
+ 'available_balance' => self::formatAvailableBalance(
28
+ XMLParser::getNode($litleResponse, 'availableBalance')),
29
+ 'reloadable' => self::formatReloadable(XMLParser::getNode($litleResponse, 'reloadable'))
30
+ );
31
+ Mage::getModel('palorus/insight')->setData($data)->save();
32
+ }
33
+
34
+ public function isVaultEnabled()
35
+ {
36
+ return Mage::getStoreConfig('payment/CreditCard/vault_enable');
37
+ }
38
+
39
+ public function getBaseUrl()
40
+ {
41
+ $litle = new Litle_CreditCard_Model_PaymentLogic();
42
+ $url = $litle->getConfigData("url");
43
+ return self::getBaseUrlFrom($url);
44
+ }
45
+
46
+
47
+ static public function getBaseUrlFrom($url)
48
+ {
49
+ if (preg_match('/payments/', $url)) {
50
+ $baseUrl = 'https://reports.litle.com';
51
+ } else
52
+ if (preg_match('/sandbox/', $url)) {
53
+ $baseUrl = 'https://www.testlitle.com/sandbox';
54
+ } else
55
+ if (preg_match('/precert/', $url)) {
56
+ $baseUrl = 'https://reports.precert.litle.com';
57
+ } else
58
+ if (preg_match('/cert/', $url)) {
59
+ $baseUrl = 'https://reports.cert.litle.com';
60
+ } else {
61
+ $baseUrl = 'http://localhost:2190';
62
+ }
63
+ return $baseUrl;
64
+ }
65
+
66
+ /**
67
+ * Convert from Magento card types to Litle
68
+ *
69
+ * @deprecated
70
+ *
71
+ * @param Varien_Object $payment
72
+ * @return string
73
+ */
74
+ public function litleCcTypeEnum(Varien_Object $payment)
75
+ {
76
+ return $this->litleCcType($payment->getCcType());
77
+ }
78
+
79
+ /**
80
+ * Convert from Magento card type to Litle
81
+ *
82
+ * @param unknown_type $type
83
+ * @return Ambigous <string, unknown>
84
+ */
85
+ public function litleCcType($type)
86
+ {
87
+ $typeEnum = $type;
88
+ if ($type == 'AE') {
89
+ $typeEnum = 'AX';
90
+ } elseif ($type == 'JCB') {
91
+ $typeEnum = 'JC';
92
+ }
93
+ return $typeEnum;
94
+ }
95
+
96
+ /**
97
+ * Convert from Litle card types to Magento card types
98
+ *
99
+ * @param string $type
100
+ * @return string
101
+ */
102
+ public function mageCcTypeLitle($type)
103
+ {
104
+ $typeEnum = $type;
105
+
106
+ if ($type == 'AX') {
107
+ $typeEnum = 'AE';
108
+ } elseif ($type == 'JC') {
109
+ $typeEnum = 'JCB';
110
+ }
111
+
112
+ return $typeEnum;
113
+ }
114
+
115
+ static public function formatAvailableBalance($balance)
116
+ {
117
+ return self::formatMoney($balance);
118
+ }
119
+
120
+ static public function formatAffluence($affluence)
121
+ {
122
+ if ($affluence === '' || $affluence === NULL) {
123
+ return '';
124
+ } else
125
+ if ($affluence == 'AFFLUENT') {
126
+ return 'Affluent';
127
+ } else
128
+ if ($affluence == 'MASS AFFLUENT') {
129
+ return 'Mass Affluent';
130
+ } else {
131
+ return $affluence;
132
+ }
133
+ }
134
+
135
+ static public function formatFundingSource($prepaid)
136
+ {
137
+ if ($prepaid == 'FSA') {
138
+ return 'FSA';
139
+ }
140
+ return self::capitalize($prepaid);
141
+ }
142
+
143
+ static public function formatPrepaidCardType($prepaidCardType)
144
+ {
145
+ return self::capitalize($prepaidCardType);
146
+ }
147
+
148
+ static public function formatReloadable($reloadable)
149
+ {
150
+ return self::capitalize($reloadable);
151
+ }
152
+
153
+ static private function capitalize($original)
154
+ {
155
+ if ($original === '' || $original === NULL) {
156
+ return '';
157
+ }
158
+ $lower = strtolower($original);
159
+ return ucfirst($lower);
160
+ }
161
+
162
+ static private function formatMoney($balance)
163
+ {
164
+ if ($balance === '' || $balance === NULL){
165
+ $available_balance = '';
166
+ }
167
+ else{
168
+ $balance = str_pad($balance, 3, '0', STR_PAD_LEFT);
169
+ $available_balance = substr_replace($balance, '.', -2, 0);
170
+ $available_balance = '$' . $available_balance;
171
+ }
172
+
173
+ return $available_balance;
174
+ }
175
+
176
+
177
+ /**
178
+ * Returns the checkout session.
179
+ *
180
+ * @return Mage_Core_Model_Session_Abstract
181
+ */
182
+ public function getCheckout()
183
+ {
184
+ if (Mage::app()->getStore()->isAdmin()) {
185
+ return Mage::getSingleton('adminhtml/session_quote');
186
+ } else {
187
+ return Mage::getSingleton('checkout/session');
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Returns the quote.
193
+ *
194
+ * @return Mage_Sales_Model_Quote
195
+ */
196
+ public function getQuote()
197
+ {
198
+ return $this->getCheckout()->getQuote();
199
+ }
200
+
201
+ /**
202
+ * Returns the logged in user.
203
+ *
204
+ * @return Mage_Customer_Model_Customer
205
+ */
206
+ public function getCustomer()
207
+ {
208
+ return $this->getQuote()->getCustomer();
209
+ }
210
+ }
app/code/local/Litle/Palorus/Model/Mysql4/Vault.php CHANGED
@@ -1,9 +1,26 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
3
+ class Litle_Palorus_Model_Mysql4_Vault extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+
6
+ protected function _construct()
7
+ {
8
+ $this->_init('palorus/vault', 'vault_id');
9
+ }
10
+
11
+ /**
12
+ * Sets the created and modified date attributes.
13
+ *
14
+ * @param Mage_Core_Model_Abstract $object
15
+ * @return Litle_Palorus_Model_Mysql4_Vault
16
+ */
17
+ protected function _beforeSave(Mage_Core_Model_Abstract $object)
18
+ {
19
+ if (! $object->getId()) {
20
+ $object->setCreated(now());
21
+ }
22
+ $object->setUpdated(now());
23
+
24
+ return parent::_beforeSave($object);
25
+ }
26
+ }
app/code/local/Litle/Palorus/Model/Mysql4/Vault/Collection.php CHANGED
@@ -8,4 +8,15 @@ class Litle_Palorus_Model_Mysql4_Vault_Collection extends Mage_Core_Model_Mysql4
8
  $this->_init('palorus/vault');
9
  }
10
 
11
- }
 
 
 
 
 
 
 
 
 
 
 
8
  $this->_init('palorus/vault');
9
  }
10
 
11
+ /**
12
+ * Get vault records filtered by customer object
13
+ *
14
+ * @param Mage_Customer_Model_Customer $customer
15
+ * @return Litle_Palorus_Model_Mysql4_Vault_Collection
16
+ */
17
+ public function addCustomerFilter(Mage_Customer_Model_Customer $customer)
18
+ {
19
+ $this->addFieldToFilter('customer_id', $customer->getId());
20
+ return $this;
21
+ }
22
+ }
app/code/local/Litle/Palorus/Model/Vault.php CHANGED
@@ -10,4 +10,149 @@ class Litle_Palorus_Model_Vault extends Mage_Core_Model_Abstract
10
  $this->_init($this->_model);
11
  }
12
 
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  $this->_init($this->_model);
11
  }
12
 
13
+ /**
14
+ * Get unique credit cards for customer
15
+ *
16
+ * @param int $customerId
17
+ * @return Litle_Palorus_Model_Mysql4_Vault_Collection
18
+ */
19
+ public function visibleStoredCards($customerId)
20
+ {
21
+ /* @var $collection Litle_Palorus_Model_Mysql4_Vault_Collection */
22
+ return Mage::getModel('palorus/vault')
23
+ ->getCollection()
24
+ ->addFieldToFilter('is_visible', 1)
25
+ ->addFieldToFilter('customer_id', $customerId);
26
+ }
27
+
28
+ /**
29
+ * Get a matching customer vault item.
30
+ *
31
+ * @param Mage_Customer_Model_Customer $customer
32
+ * @param string $token
33
+ * @return Litle_Palorus_Model_Vault
34
+ */
35
+ public function getCustomerToken(Mage_Customer_Model_Customer $customer, $token)
36
+ {
37
+ $c = $this->getCollection()->addCustomerFilter($customer)
38
+ ->addFieldToFilter('token', $token);
39
+
40
+ if ($c->count()) {
41
+ return $c->getFirstItem();
42
+ }
43
+ return null;
44
+ }
45
+
46
+ /**
47
+ * Create or update a token from a payment object
48
+ *
49
+ * @param Varien_Object $payment
50
+ * @param string $vault
51
+ * @param string $bin
52
+ * @return Litle_Palorus_Model_Vault
53
+ */
54
+ public function setTokenFromPayment(Varien_Object $payment, $token, $bin)
55
+ {
56
+ if (!$payment->getCcNumber() || !$token) {
57
+ return false;
58
+ }
59
+
60
+ $vault = $this->getCustomerToken($payment->getOrder()->getCustomer(), $token);
61
+ if (!$vault) {
62
+ $vault = Mage::getModel('palorus/vault');
63
+ }
64
+
65
+ $order = $payment->getOrder();
66
+ Mage::helper('core')->copyFieldset('palorus_vault_order', 'to_vault', $order, $vault);
67
+ Mage::helper('core')->copyFieldset('palorus_vault_payment', 'to_vault', $payment, $vault);
68
+
69
+
70
+ $last4 = substr($payment->getCcNumber(), -4);
71
+ $ccType = $payment->getCcType();
72
+
73
+
74
+
75
+ $vault->setLast4(substr($payment->getCcNumber(), -4))
76
+ ->setLitleCcType($payment->getCcType())
77
+ ->setToken($token)
78
+ ->setBin($bin);
79
+
80
+ $vault->save();
81
+
82
+ $order->setLitleVaultId($vault->getId());
83
+
84
+ return $vault;
85
+ }
86
+
87
+ /**
88
+ * Create a token with the minimum information.
89
+ *
90
+ * @param Mage_Customer_Model_Customer $customer
91
+ * @param string $token
92
+ * @param string $bin
93
+ * @param string $type
94
+ * @param int $expMonth
95
+ * @param int $expYear
96
+ * @param boolean $isVisible
97
+ * @return Litle_Palorus_Model_Vault
98
+ */
99
+ public function createBasicToken(Mage_Customer_Model_Customer $customer, $token, $bin, $type, $expMonth, $expYear, $isVisible = true)
100
+ {
101
+ $vault = $this->getCustomerToken($customer, $token);
102
+ if (!$vault) {
103
+ $vault = Mage::getModel('palorus/vault');
104
+ }
105
+
106
+ $vault->setCustomerId($customer->getId())
107
+ ->setToken($token)
108
+ ->setBin($bin)
109
+ ->setCcType($type)
110
+ ->setExpirationMonth($expMonth)
111
+ ->setExpirationYear($expYear)
112
+ ->setIsVisible($isVisible)
113
+ ->save();
114
+
115
+ return $vault;
116
+ }
117
+
118
+ public function setLitleCcType($code)
119
+ {
120
+ $this->setType($code);
121
+ return $this;
122
+ }
123
+
124
+ public function setCcType($code)
125
+ {
126
+ $this->setType(Mage::helper('palorus')->litleCcType($code));
127
+ return $this;
128
+ }
129
+
130
+ public function getCcType()
131
+ {
132
+ return Mage::helper('palorus')->mageCcTypeLitle($this->getType());
133
+ }
134
+
135
+ public function getLitleCcType()
136
+ {
137
+ return $this->getType();
138
+ }
139
+
140
+ /**
141
+ * Get the human-friendly card type
142
+ *
143
+ * @return string
144
+ */
145
+ public function getTypeName()
146
+ {
147
+ if ($this->getType()) {
148
+ $type = $this->getCcType();
149
+ $types = Mage::getSingleton('payment/config')->getCcTypes();
150
+
151
+ if (array_key_exists($type, $types)) {
152
+ return $types[$type];
153
+ }
154
+ return $type;
155
+ }
156
+ return '';
157
+ }
158
+ }
app/code/local/Litle/Palorus/controllers/Adminhtml/VaultController.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_Palorus_Adminhtml_VaultController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ /**
7
+ * Inits the customer from the request.
8
+ *
9
+ * @return boolean|Mage_Customer_Model_Customer
10
+ */
11
+ protected function _initCustomer()
12
+ {
13
+ $customerId = $this->getRequest()->getParam('customer_id');
14
+ if ($customerId) {
15
+ $customer = Mage::getModel('customer/customer')->load($customerId);
16
+ if ($customer->getId()) {
17
+ return $customer;
18
+ }
19
+ }
20
+ return false;
21
+ }
22
+
23
+ /**
24
+ * Deletes a stored crard.
25
+ */
26
+ public function deleteCardAction ()
27
+ {
28
+ $customer = $this->_initCustomer();
29
+ if ($customer) {
30
+ $vaultId = $this->getRequest()->getParam('vault_id');
31
+ $vault = Mage::getModel('palorus/vault')->load($vaultId);
32
+ if ($vault->getId()) {
33
+ try {
34
+ $vault->delete();
35
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('palorus')->__('Stored card successfully deleted.'));
36
+ } catch (Exception $e) {
37
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
38
+ }
39
+ }
40
+ else {
41
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('palorus')->__('Stored card not found.'));
42
+ }
43
+ $this->_redirect('adminhtml/customer/edit', array('id' => $customer->getId(), 'tab' => 'litle_vault_tab'));
44
+ return;
45
+ }
46
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('palorus')->__('Customer not found.'));
47
+ $this->_redirect('adminhtml/customer');
48
+ }
49
+
50
+ /**
51
+ * ACL check.
52
+ *
53
+ * @return bool
54
+ */
55
+ protected function _isAllowed()
56
+ {
57
+ return Mage::getSingleton('admin/session')->isAllowed('customer/manage');
58
+ }
59
+ }
app/code/local/Litle/Palorus/controllers/VaultController.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Vault front end controller
4
+ *
5
+ * @author jholden
6
+ *
7
+ */
8
+ class Litle_Palorus_VaultController extends Mage_Core_Controller_Front_Action
9
+ {
10
+ public function preDispatch()
11
+ {
12
+ parent::preDispatch();
13
+ if (!$this->_getSession()->authenticate($this) || !Mage::helper('palorus')->isVaultEnabled()) {
14
+ $this->setFlag('', 'no-dispatch', true);
15
+ }
16
+ }
17
+
18
+ /**
19
+ * List vaulted cards
20
+ */
21
+ public function indexAction()
22
+ {
23
+ $this->loadLayout();
24
+ $this->_initLayoutMessages('customer/session');
25
+ $this->renderLayout();
26
+ }
27
+
28
+ /**
29
+ * @todo Display the edit form
30
+ *
31
+ */
32
+ // public function editAction()
33
+ // {
34
+ // $this->loadLayout();
35
+ // $this->_initLayoutMessages('customer/session');
36
+
37
+ // $navigationBlock = $this->getLayout()->getBlock('customer_account_navigation');
38
+ // if ($navigationBlock) {
39
+ // $navigationBlock->setActive('palorus/vault');
40
+ // }
41
+
42
+ // $this->renderLayout();
43
+ // }
44
+
45
+ /**
46
+ * @todo Save the edit form
47
+ *
48
+ */
49
+ // public function editPostAction()
50
+ // {
51
+
52
+ // }
53
+
54
+ /**
55
+ * Delete the card from our database
56
+ */
57
+ public function deleteAction()
58
+ {
59
+ $vaultId = $this->getRequest()->getParam('vault_id');
60
+ if ($vaultId) {
61
+ $vault = Mage::getModel('palorus/vault')->load($vaultId);
62
+ if ($vault->getCustomerId() != $this->_getSession()->getCustomer()->getId()) {
63
+ $this->_getSession()->addError($this->__('The card does not belong to this customer.'));
64
+ $this->getResponse()->setRedirect(Mage::getUrl('*/*/index'));
65
+ return;
66
+ }
67
+
68
+ try {
69
+ $vault->delete();
70
+ $this->_getSession()->addSuccess($this->__('The card has been deleted.'));
71
+ } catch (Exception $e) {
72
+ $this->_getSession()->addException($e, $this->__('An error occurred while deleting the card.'));
73
+ Mage::logException($e);
74
+ }
75
+ }
76
+ $this->_redirect('*/*/index');
77
+ }
78
+
79
+ /**
80
+ * Retrieve customer session object
81
+ *
82
+ * @return Mage_Customer_Model_Session
83
+ */
84
+ protected function _getSession()
85
+ {
86
+ return Mage::getSingleton('customer/session');
87
+ }
88
+ }
app/code/local/Litle/Palorus/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Litle_Palorus>
5
- <version>8.13.2</version>
6
  </Litle_Palorus>
7
  </modules>
8
  <global>
@@ -62,9 +62,42 @@
62
  <palorus>
63
  <class>Litle_Palorus_Helper</class>
64
  </palorus>
65
- </helpers>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  </global>
67
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  <admin>
69
  <routers>
70
  <palorus>
@@ -76,7 +109,7 @@
76
  </palorus>
77
  </routers>
78
  </admin>
79
-
80
  <adminhtml>
81
  <menu>
82
  <dashboard>
@@ -100,7 +133,7 @@
100
  </palorus_adminform>
101
  </children>
102
  </dashboard>
103
-
104
  <sales>
105
  <children>
106
  <palorus_adminform translate="title" module="palorus">
@@ -122,7 +155,7 @@
122
  </palorus_adminform>
123
  </children>
124
  </sales>
125
-
126
  <report>
127
  <children>
128
  <palorus_adminform translate="title" module="palorus">
@@ -161,7 +194,7 @@
161
  </children>
162
  </report>
163
  </menu>
164
-
165
  <acl>
166
  <resources>
167
  <admin>
@@ -187,4 +220,4 @@
187
  </adminhtml>
188
 
189
 
190
- </config>
2
  <config>
3
  <modules>
4
  <Litle_Palorus>
5
+ <version>8.13.3</version>
6
  </Litle_Palorus>
7
  </modules>
8
  <global>
62
  <palorus>
63
  <class>Litle_Palorus_Helper</class>
64
  </palorus>
65
+ </helpers>
66
+
67
+ <fieldsets>
68
+ <sales_convert_quote_payment>
69
+ <litle_vault_id><to_order_payment>*</to_order_payment></litle_vault_id>
70
+ <is_visible><to_order_payment>*</to_order_payment></is_visible>
71
+ </sales_convert_quote_payment>
72
+
73
+ <palorus_vault_order>
74
+ <id><to_vault>order_id</to_vault></id>
75
+ <increment_id><to_vault>order_number</to_vault></increment_id>
76
+ <customer_id><to_vault>*</to_vault></customer_id>
77
+ </palorus_vault_order>
78
+
79
+ <palorus_vault_payment>
80
+ <cc_exp_month><to_vault>expiration_month</to_vault></cc_exp_month>
81
+ <cc_exp_year><to_vault>expiration_year</to_vault></cc_exp_year>
82
+ </palorus_vault_payment>
83
+ </fieldsets>
84
  </global>
85
+
86
+ <frontend>
87
+ <routers>
88
+ <palorus>
89
+ <use>standard</use>
90
+ <args>
91
+ <module>Litle_Palorus</module>
92
+ <frontName>palorus</frontName>
93
+ </args>
94
+ </palorus>
95
+ </routers>
96
+ <secure_url>
97
+ <palorus_vault>/palorus/vault/</palorus_vault>
98
+ </secure_url>
99
+ </frontend>
100
+
101
  <admin>
102
  <routers>
103
  <palorus>
109
  </palorus>
110
  </routers>
111
  </admin>
112
+
113
  <adminhtml>
114
  <menu>
115
  <dashboard>
133
  </palorus_adminform>
134
  </children>
135
  </dashboard>
136
+
137
  <sales>
138
  <children>
139
  <palorus_adminform translate="title" module="palorus">
155
  </palorus_adminform>
156
  </children>
157
  </sales>
158
+
159
  <report>
160
  <children>
161
  <palorus_adminform translate="title" module="palorus">
194
  </children>
195
  </report>
196
  </menu>
197
+
198
  <acl>
199
  <resources>
200
  <admin>
220
  </adminhtml>
221
 
222
 
223
+ </config>
app/code/local/Litle/Palorus/sql/palorus_setup/mysql4-upgrade-8.13.2-8.13.3.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ Mage::log("Starting upgrade SQL 8.13.2 to 8.14.0");
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_payment'), 'litle_vault_id', 'int(10)');
8
+ $installer->getConnection()->addColumn($installer->getTable('sales/order_payment'), 'litle_vault_id', 'int(10)');
9
+
10
+ $installer->run("
11
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('palorus/vault')}_tmp` (
12
+ `vault_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
13
+ `order_id` int(10) unsigned DEFAULT NULL,
14
+ `customer_id` int(10) unsigned NOT NULL DEFAULT '0',
15
+ `last4` varchar(4) DEFAULT NULL,
16
+ `token` varchar(25) DEFAULT NULL,
17
+ `type` varchar(2) DEFAULT NULL,
18
+ `bin` varchar(6) DEFAULT NULL,
19
+ `expiration_month` tinyint(2) DEFAULT NULL,
20
+ `expiration_year` smallint(4) DEFAULT NULL,
21
+ `updated` datetime DEFAULT NULL,
22
+ `created` datetime DEFAULT NULL,
23
+ `is_visible` tinyint(1) NOT NULL DEFAULT '1',
24
+ PRIMARY KEY (`vault_id`),
25
+ UNIQUE KEY `customer_token` (`customer_id`, `token`)
26
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
27
+ ");
28
+
29
+ $installer->run("
30
+ INSERT INTO `{$installer->getTable('palorus/vault')}_tmp` (vault_id,order_id,customer_id,last4,token,type,bin,updated,created) SELECT v.vault_id, v.order_id, customer_id,last4,v.token,type,bin,NOW(), NOW() FROM `{$installer->getTable('palorus/vault')}` v JOIN ( SELECT MAX(vault_id) vault_id,token FROM `{$installer->getTable('palorus/vault')}` GROUP BY token ) v2 ON v.vault_id = v2.vault_id;
31
+ ");
32
+
33
+ $installer->run("TRUNCATE TABLE `{$installer->getTable('palorus/vault')}`");
34
+
35
+ $installer->run("
36
+ ALTER TABLE `{$installer->getTable('palorus/vault')}` ADD `expiration_month` TINYINT( 2 ) NULL DEFAULT NULL, ADD `expiration_year` SMALLINT( 4 ) NULL DEFAULT NULL, ADD `updated` DATETIME NULL DEFAULT NULL, ADD `created` DATETIME NULL DEFAULT NULL, ADD `is_visible` TINYINT( 1 ) NOT NULL DEFAULT '1', ADD UNIQUE (`customer_id`, `token`)
37
+ ");
38
+
39
+ // $installer->run("
40
+ // ALTER TABLE `{$installer->getTable('palorus/vault')}`
41
+ // DROP `order_id`
42
+ // ");
43
+
44
+ $installer->run("INSERT INTO `{$installer->getTable('palorus/vault')}` SELECT * FROM `{$installer->getTable('palorus/vault')}_tmp`;");
45
+
46
+
47
+ $installer->run("DROP TABLE `{$installer->getTable('palorus/vault')}_tmp`;");
48
+
49
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/litle.xml CHANGED
@@ -6,9 +6,13 @@
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">
@@ -16,4 +20,4 @@
16
  </reference>
17
  </palorus_adminhtml_myform_index>
18
 
19
- </layout>
6
  <name>my_custom_tab</name>
7
  <block>palorus/adminhtml_palorus_insight_tab</block>
8
  </action>
9
+ <action method="addTab">
10
+ <name>litle_vault_tab</name>
11
+ <block>palorus/adminhtml_customer_edit_tab_vault</block>
12
+ </action>
13
  </reference>
14
  </adminhtml_customer_edit>
15
+
16
  <palorus_adminhtml_myform_index>
17
  <update handle="palorus_myform_index"/>
18
  <reference name="content">
20
  </reference>
21
  </palorus_adminhtml_myform_index>
22
 
23
+ </layout>
app/design/adminhtml/default/default/template/litle/customer/tab/vault.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /* @var $this Litle_Palorus_Block_Adminhtml_Customer_Edit_Tab_Vault */ ?>
2
+ <div class="entry-edit">
3
+ <div class="entry-edit-head"><h4 class="icon-head">Litle Vault Stored Cards</h4></div>
4
+ <fieldset>
5
+ <?php $cards = $this->getStoredCards() ?>
6
+ <?php if (count($cards)) { ?>
7
+ <?php $count = 1; ?>
8
+ <?php foreach ($cards as $card) { ?>
9
+ <div class="<?php echo ($count % 2 == 1 ? 'box-left' : 'box-right') ?>">
10
+ <button type="button" style="float: right;" class="scalable delete" onclick="deleteConfirm('Are you sure?', '<?php echo $this->getCardDeleteUrl($card) ?>')"><span><?php echo $this->__('Delete Stored Card') ?></span></button>
11
+ <strong><?php echo $this->__('Litle Vault token:') ?></strong> <?php echo $card->getToken() ?>
12
+ <?php if ($card->getIsDefault()) { ?>
13
+ <br /><em><?php echo $this->__('Default') ?></em>
14
+ <?php } ?>
15
+ <?php if (!$card->getIsVisible()) { ?>
16
+ <br /><em><?php echo $this->__('Not visible') ?></em>
17
+ <?php } ?>
18
+ <div style="margin-top: 5px;">
19
+ <strong>Card Number Ending in:</strong> <?php echo $card->getLast4() ?><br />
20
+ <strong>Card Exp:</strong> <?php echo $card->getExpirationMonth()?>/<?php echo $card->getExpirationYear()?>
21
+ </div>
22
+ </div>
23
+ <?php if ($count % 2 == 0) { ?>
24
+ <div style="height: 10px; clear: both;"></div>
25
+ <?php } ?>
26
+ <?php $count++; ?>
27
+ <?php } ?>
28
+ <?php } else { ?>
29
+ <em><?php echo $this->__('No Vaulted cards registered.') ?></em>
30
+ <?php } ?>
31
+ </fieldset>
32
+ </div>
33
+
app/design/adminhtml/default/default/template/litle/form/litlecc.phtml ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ /* @var $this Litle_CreditCard_Block_Form_CreditCard */
29
+ $_code = $this->getMethodCode();
30
+ $_reportGroup = $this->getReportGroup();
31
+ $_paypageId = Mage::getModel('Litle_CreditCard_Model_PaymentLogic')->getConfigData("paypage_id");
32
+ $_paypageUrl = Mage::getModel('Litle_CreditCard_Model_PaymentLogic')->getConfigData("paypage_url");
33
+ ?>
34
+
35
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none;">
36
+
37
+ <?php if ($this->getVaultEnabled() && $this->hasStoredCards()): ?>
38
+ <li>
39
+ <label for="<?php echo $_code ?>_cc_vaulted" class=""><?php echo $this->__('Stored Credit Cards') ?></label>
40
+ <div class="input-box">
41
+ <?php $_ccVault = $this->getInfoData('cc_vaulted') ?>
42
+ <select id="<?php echo $_code ?>_cc_vaulted" name="payment[cc_vaulted]">
43
+ <option value=""<?php if($_ccVault==''): ?> selected="selected"<?php endif ?>><?php echo $this->__('--Please Select a Stored Credit Card--')?></option>
44
+ <option value="0"<?php if($_ccVault=='0'): ?> selected="selected"<?php endif ?>>New Credit Card</option>
45
+
46
+ <?php foreach ($this->getStoredCards() as $card): ?>
47
+ <option value="<?php echo $card->getVaultId() ?>"<?php if($_ccVault==$card->getVaultId()): ?> selected="selected"<?php endif ?>><?php echo 'Stored ' . $card->getTypeName() . ' Ending in: ' . $card->getLast4() ?></option>
48
+ <?php endforeach ?>
49
+ </select>
50
+ </div>
51
+ </li>
52
+
53
+ <script type="text/javascript">
54
+ function toggleLitleCardFields(index, changed) {
55
+ if (index !== '0' && index !== '') {
56
+ $$('.new-card').invoke('hide');
57
+ $$('.new-card input, .new-card select').invoke('disable');
58
+ $('<?php echo $_code ?>_cc_cid').removeClassName('validate-cc-cvn');
59
+ } else {
60
+ $$('.new-card').invoke('show');
61
+ $$('.new-card input, .new-card select').invoke('enable');
62
+ $('<?php echo $_code ?>_cc_cid').addClassName('validate-cc-cvn');
63
+ }
64
+ }
65
+ Event.observe($("<?php echo $_code ?>_cc_vaulted"), 'change', function() {
66
+ toggleLitleCardFields($F(this));
67
+ $('<?php echo $_code ?>_cc_cid').value="";
68
+ });
69
+ Event.observe($('p_method_<?php echo $_code ?>'), 'click', function() {
70
+ toggleLitleCardFields($F("<?php echo $_code ?>_cc_vaulted"));
71
+ });
72
+ setTimeout(function () {
73
+ toggleLitleCardFields($F("<?php echo $_code ?>_cc_vaulted"));
74
+ }.bind(this), 500);
75
+ </script>
76
+ <?php endif; ?>
77
+
78
+ <?php if ($this->getPaypageEnabled()):?>
79
+
80
+ <?php if($this->hasVerification() && $this->getVaultEnabled() && $this->hasStoredCards()): ?>
81
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
82
+ <label for="<?php echo $_code ?>_cc_cid"><span class="required">*</span><?php echo $this->__('Card Verification Number') ?></label>
83
+ <div class="input-box">
84
+ <div class="v-fix">
85
+ <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="<?php echo $this->getInfoData('cc_cid')?>" />
86
+ </div>
87
+ </div>
88
+ </li>
89
+ <?php endif; ?>
90
+
91
+ <a href="https://vt.litle.com" target="_blank">Litle Virtual Terminal</a>
92
+ <br/><br/>
93
+
94
+ <?php else: ?>
95
+
96
+ <li class="new-card">
97
+ <label for="<?php echo $_code ?>_cc_type"><?php echo $this->__('Credit Card Type') ?> <span class="required">*</span></label>
98
+ <div class="input-box">
99
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
100
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
101
+ <?php $_ccType = $this->getInfoData('cc_type') ?>
102
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
103
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
104
+ <?php endforeach ?>
105
+ </select>
106
+ </div>
107
+ </li>
108
+ <li class="new-card">
109
+ <label for="<?php echo $_code ?>_cc_number"><?php echo $this->__('Credit Card Number') ?> <span class="required">*</span></label>
110
+ <div class="input-box">
111
+ <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-type <?php if (!Mage::helper('creditcard')->isSandbox()): ?>validate-cc-number<?php endif ?>" value="<?php echo $this->getInfoData('cc_number')?>" />
112
+ </div>
113
+ </li>
114
+ <li class="new-card" id="<?php echo $_code ?>_cc_type_exp_div">
115
+ <label for="<?php echo $_code ?>_expiration"><?php echo $this->__('Expiration Date') ?> <span class="required">*</span></label>
116
+ <div class="input-box">
117
+ <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
118
+ <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
119
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
120
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
121
+ <?php endforeach ?>
122
+ </select>
123
+ <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
124
+ <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
125
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
126
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
127
+ <?php endforeach ?>
128
+ </select>
129
+ </div>
130
+ </li>
131
+
132
+ <?php if($this->hasVerification()): ?>
133
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
134
+ <label for="<?php echo $_code ?>_cc_cid"><?php echo $this->__('Card Verification Number') ?> <span class="required">*</span></label>
135
+ <div class="input-box">
136
+ <div class="v-fix">
137
+ <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="<?php echo $this->getInfoData('cc_cid')?>" />
138
+ </div>
139
+ </div>
140
+ </li>
141
+ <?php endif; ?>
142
+
143
+ <?php if($this->getVaultEnabled()):?>
144
+ <li id="<?php echo $_code ?>_cc_type_should_save_div" class="new-card">
145
+ <label for="<?php echo $_code ?>_cc_should_save"><?php echo $this->__('Save Card In Customer Account') ?></label>
146
+ <div class="input-box">
147
+ <div class="v-fix">
148
+ <input type="checkbox" title="<?php echo $this->__('Save Card In Customer Account') ?>" class="input-checkbox" id="<?php echo $_code ?>_cc_should_save" name="payment[cc_should_save]" <?php if ($this->getInfoData('cc_should_save')): ?>checked="checked"<?php endif ?>/>
149
+ </div>
150
+ </div>
151
+ </li>
152
+ <?php endif; ?>
153
+
154
+ <?php endif; ?>
155
+
156
+ <?php echo $this->getChildHtml() ?>
157
+
158
+ </ul>
app/design/adminhtml/default/default/template/{payment → litle}/form/litleecheck.phtml RENAMED
File without changes
app/design/adminhtml/default/default/template/payment/form/litlecc.phtml DELETED
@@ -1,138 +0,0 @@
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/frontend/base/default/layout/litlecreditcard.xml CHANGED
@@ -1,7 +1,32 @@
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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <layout version="0.1.0">
2
+
3
+ <!-- One page checkout -->
4
  <checkout_onepage_index>
5
  <reference name="head">
6
+ <block type="page/html" name="litle3.js" output="toHtml" template="litle/form/litlejs.phtml"/>
7
  </reference>
8
  </checkout_onepage_index>
9
+
10
+
11
+ <!-- Customer Account handles -->
12
+ <customer_account>
13
+ <reference name="customer_account_navigation">
14
+ <action method="addLink" translate="label" module="palorus" ifconfig="payment/CreditCard/vault_enable">
15
+ <name>litle_vault</name>
16
+ <path>palorus/vault</path>
17
+ <label>Stored Credit Cards</label>
18
+ </action>
19
+ </reference>
20
+ </customer_account>
21
+
22
+ <palorus_vault_index>
23
+ <update handle="customer_account" />
24
+ <reference name="my.account.wrapper">
25
+ <block type="palorus/vault_list" name="vault.stored_cards.list" template="litle/vault/list.phtml" />
26
+ </reference>
27
+ <reference name="head">
28
+ <action method="setTitle"><title>Stored Credit Cards</title></action>
29
+ </reference>
30
+ </palorus_vault_index>
31
+
32
+ </layout>
app/design/frontend/{default/default/template/payment → base/default/template/litle}/form/litlecc.phtml RENAMED
@@ -23,13 +23,13 @@
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">
@@ -46,58 +46,43 @@ $_id = $_time . substr($_session,13);
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>
@@ -108,14 +93,14 @@ selectmenu.onchange=function(){
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">
@@ -137,7 +122,7 @@ selectmenu.onchange=function(){
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">
@@ -146,15 +131,27 @@ selectmenu.onchange=function(){
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]"/>
@@ -166,33 +163,33 @@ selectmenu.onchange=function(){
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',
@@ -201,54 +198,53 @@ Payment.prototype.save = function() {
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; ?>
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
+ /* @var $this Litle_CreditCard_Block_Form_CreditCard */
27
  ?>
28
  <?php
 
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
+ $_isLoggedIn = Mage::helper('customer')->isLoggedIn();
33
  ?>
34
 
35
  <script type="text/javascript">
46
  <ul class="form-list" id="payment_form_<?php echo $_code ?>"
47
  style="display: none;">
48
 
49
+ <?php if ($this->getVaultEnabled()): ?>
50
+ <?php if ($this->hasStoredCards()): ?>
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
+ <option value="0">New Credit Card</option>
57
+
58
+ <?php foreach ($this->getStoredCards() as $card): ?>
59
+ <option value="<?php echo $card->getVaultId() ?>"><?php echo 'Stored ' . $card->getTypeName() . ' Ending in: ' . $card->getLast4() ?></option>
60
+ <?php endforeach ?>
 
61
  </select>
62
  </div>
63
  </li>
 
 
 
64
 
65
+ <script type="text/javascript">
66
+ Event.observe($("<?php echo $_code ?>_cc_vaulted"), 'change', function() {
67
+ if ($F(this) != '0') {
68
+ $$('.new-card').invoke('hide');
69
+ $('<?php echo $_code ?>_cc_cid').value="";
70
+ $$('.cid-class').invoke('show');
71
+ } else {
72
+ $$('.new-card').invoke('show');
73
+ $('<?php echo $_code ?>_cc_cid').value="";
74
+ $('<?php echo $_code ?>_cc_type').value = "";
75
+ $('<?php echo $_code ?>_expiration').value = "";
76
+ $('<?php echo $_code ?>_expiration_yr').value = "";
77
+ $('<?php echo $_code ?>_cc_should_save').setValue(false);
78
+ $$('.cid-class').invoke('show');
79
+ }
80
+ });
81
+ </script>
82
+ <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
83
  <?php endif; ?>
84
+ <li class="new-card">
85
+ <label id="creditcard_cc_type_label" for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
86
  <div class="input-box">
87
  <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
88
  <option value=""><?php echo $this->__('--Please Select--')?></option>
93
  </select>
94
  </div>
95
  </li>
96
+ <li class="new-card">
97
+ <label id="creditcard_cc_number_label" for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
98
  <div class="input-box">
99
+ <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-type <?php if (!Mage::helper('creditcard')->isSandbox()): ?>validate-cc-number<?php endif ?>" value="" />
100
  </div>
101
  </li>
102
+ <li id="<?php echo $_code ?>_cc_type_exp_div" class="new-card">
103
+ <label id="creditcard_cc_expDate_label" for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
104
  <div class="input-box">
105
  <div class="v-fix">
106
  <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
122
  </li>
123
  <?php echo $this->getChildHtml() ?>
124
  <?php if($this->hasVerification()): ?>
125
+ <li id="<?php echo $_code ?>_cc_type_cvv_div" class="cid-class">
126
  <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
127
  <div class="input-box">
128
  <div class="v-fix">
131
  <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
132
  </div>
133
  </li>
134
+
135
+ <?php endif; ?>
136
+
137
+ <?php if($_isLoggedIn && $this->getVaultEnabled()):?>
138
+ <li id="<?php echo $_code ?>_cc_type_should_save_div" class="new-card">
139
+ <label for="<?php echo $_code ?>_cc_should_save"><?php echo $this->__('Save Card In My Account') ?></label>
140
+ <div class="input-box">
141
+ <div class="v-fix">
142
+ <input type="checkbox" title="<?php echo $this->__('Save Card In My Account') ?>" class="input-checkbox" id="<?php echo $_code ?>_cc_should_save" name="payment[cc_should_save]" />
143
+ </div>
144
+ </div>
145
+ </li>
146
  <?php endif; ?>
147
 
148
+ <?php if($this->getPaypageEnabled()):?>
149
  <input type="hidden" id="<?php echo $_code ?>_paypage_id" name="payment[paypage_id]" value="<?php echo $_paypageId; ?>"/>
150
  <input type="hidden" id="<?php echo $_code ?>_merchant_txn_id" name="payment[merchant_txn_id]" value="<?php echo $_id; ?>"/>
151
  <input type="hidden" id="<?php echo $_code ?>_paypage_url" name="payment[paypage_url]" value="<?php echo $_paypageUrl; ?>"/>
152
  <input type="hidden" id="<?php echo $_code ?>_order_id" name="payment[order_id]" value="<?php echo $_id; ?>"/>
153
  <input type="hidden" id="<?php echo $_code ?>_report_group" name="payment[report_group]" value="<?php echo $_reportGroup; ?>"/>
154
+ <input type="hidden" id="<?php echo $_code ?>_paypage_enabled" name="payment[paypage_enabled]" value="<?php echo $this->getPaypageEnabled(); ?>"/>
155
  <input type="hidden" id="<?php echo $_code ?>_paypage_registration_id" name="payment[paypage_registration_id]" value=""/>
156
  <input type="hidden" id="<?php echo $_code ?>_bin" name="payment[bin]"/>
157
  <input type="hidden" id="<?php echo $_code ?>_code" name="payment[code]"/>
163
  <?php endif; ?>
164
  </ul>
165
 
166
+ <?php if($this->getPaypageEnabled()):?>
167
  <script type="text/javascript">
168
+ document.observe("dom:loaded", function() {
169
+ Payment.prototype.save = function() {
170
+
171
+ var _saveUrl = this.saveUrl;
172
+ var _onComplete = this.onComplete;
173
+ var _onSave = this.onSave;
174
+ var _currentMethod = this.currentMethod;
175
+ var _form = this.form;
176
+
177
+ if (checkout.loadWaiting!=false) return;
178
+ var validator = new Validation(this.form);
179
+ if (this.validate() && validator.validate()) {
180
+ checkout.setLoadWaiting('payment');
181
+
182
+ // Litle Page Stuff//
183
+ function setLitleResponseFields(response) {
184
+ $('<?php echo $_code ?>_code').value = response.response;
185
+ $('<?php echo $_code ?>_message').value = response.message;
186
+ $('<?php echo $_code ?>_response_time').value = response.responseTime;
187
+ $('<?php echo $_code ?>_litle_txn_id').value = response.litleTxnId;
188
+ $('<?php echo $_code ?>_type').value = response.type;
189
+ }
190
 
191
+ function submitAfterLitle() {
192
+ var request = new Ajax.Request(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  _saveUrl,
194
  {
195
  method:'post',
198
  onFailure: checkout.ajaxFailure.bind(checkout),
199
  parameters: Form.serialize(_form)
200
  }
201
+ );
202
+ }
203
 
204
+ function timeoutOnLitle() {
205
+ setLitleResponseFields();
206
+ alert('timeout error');
207
+ return false;
208
+ }
209
 
210
+ function onErrorAfterLitle(response) {
211
+ setLitleResponseFields(response);
212
+ alert('There was an error. Re-enter your payment information, or contact us for further assistance.');
213
+ return false;
214
+ }
215
 
216
+ var formFields = {
217
+ "accountNum" : $('<?php echo $_code ?>_cc_number'),
218
+ "paypageRegistrationId" : $('<?php echo $_code ?>_paypage_registration_id'),
219
+ "bin" : $('<?php echo $_code ?>_bin'),
220
+ "cvv2" : $('<?php echo $_code ?>_cc_cid')
221
+ };
222
+
223
+ var litleRequest = {
224
+ "paypageId" : $('<?php echo $_code ?>_paypage_id').value,
225
+ "reportGroup" : $('<?php echo $_code ?>_report_group').value,
226
+ "orderId" : $('<?php echo $_code ?>_order_id').value,
227
+ "id" : $('<?php echo $_code ?>_merchant_txn_id').value,
228
+ "url" : ($('<?php echo $_code ?>_paypage_url').value)
229
+ };
230
+
231
+ var selectmenu=$("<?php echo $_code ?>_cc_vaulted");
232
+
233
+ if(selectmenu){
234
+ var chosenoption=selectmenu.options[selectmenu.selectedIndex]
235
+ if (chosenoption.value == 0){
236
+ if( _currentMethod == "creditcard" ){
237
+ sendToLitle(litleRequest, formFields, setLitleResponseFields, onErrorAfterLitle);
238
+ }
239
+ }
240
+ } else{
241
  if( _currentMethod == "creditcard" ){
242
  sendToLitle(litleRequest, formFields, setLitleResponseFields, onErrorAfterLitle);
243
  }
244
  }
245
+ submitAfterLitle();
246
  }
247
+ };
248
+ });
 
 
 
 
 
 
 
 
249
  </script>
250
  <?php endif; ?>
app/design/frontend/{default/default/template/payment → base/default/template/litle}/form/litleecheck.phtml RENAMED
@@ -3,19 +3,19 @@
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') ?>
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" class="required"><?php echo $this->__('Bank routing number') ?><em>*</em></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" class="required"><?php echo $this->__('Bank account number') ?><em>*</em></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" class="required"><?php echo $this->__('Account type') ?><em>*</em></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') ?>
app/design/frontend/base/default/template/{payment → litle}/form/litlejs.phtml RENAMED
File without changes
app/design/frontend/base/default/template/litle/vault/list.phtml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /* @var $this Litle_Palorus_Block_Vault_List */ ?>
2
+ <div class="page-title title-buttons">
3
+ <h1><?php echo $this->__('Stored Credit Cards') ?></h1>
4
+ <!-- <button type="button" class="button" onclick="location.href='<?php echo $this->getAddUrl() ?>';" title="<?php echo $this->__('Add New Credit Card Profile') ?>"><span><span><?php echo $this->__('Add New Credit Card Profile') ?></span></span></button> -->
5
+ </div>
6
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
7
+ <ul>
8
+ <?php $cards = $this->getStoredCards() ?>
9
+ <?php if (count($cards)): ?>
10
+ <?php foreach($cards as $card): ?>
11
+ <li class="info-box">
12
+ <dl>
13
+ <?php if ($card) { ?>
14
+ <dt><?php echo $this->__('Card Type'); ?>:</dt>
15
+ <dd><?php echo $card->getTypeName(); ?></dd>
16
+ <dt><?php echo $this->__('Card Number'); ?>:</dt>
17
+ <dd><?php echo $this->__('Ends in') . ' ' . $card->getLast4(); ?></dd>
18
+ <?php } ?>
19
+ </dl>
20
+ <p class="actions">
21
+ <!-- <a style="margin-left: 0;" href="<?php echo $this->getEditUrl($card) ?>"><?php echo $this->__('Edit') ?></a> -->
22
+ <a class="btn-blank" href="#" onclick="return deleteCard('<?php echo $card->getId() ?>');"><?php echo $this->__('Delete') ?></a>
23
+ </p>
24
+ </li>
25
+ <?php endforeach; ?>
26
+ <?php else: ?>
27
+ <li class="item empty">
28
+ <p><?php echo $this->__('You have no stored credit cards.') ?></p>
29
+ </li>
30
+ <?php endif ?>
31
+ </ul>
32
+ <script type="text/javascript">
33
+ //<![CDATA[
34
+ function deleteCard (cardId) {
35
+ if (confirm('<?php echo $this->__('Are you sure you want to delete this profile?') ?>')) {
36
+ window.location='<?php echo $this->getDeleteUrl() ?>vault_id/' + cardId;
37
+ }
38
+ return false;
39
+ }
40
+ //]]>
41
+ </script>
42
+ <style type="text/css">
43
+ .info-box { float: left; width: 48%; margin-right: 2%; }
44
+ .info-box:nth-child(even) { float: right; margin-right: 0; }
45
+ .info-box dl { margin: 10px 17px 17px; }
46
+ .info-box dt { float: left; clear: left; width: 30%; margin-right: 5%; font-weight: bold; }
47
+ .info-box dd { float: left; width: 65%; }
48
+ p.actions { clear: both; padding: 10px 17px 17px; }
49
+ </style>
app/design/frontend/base/default/template/payment/form/litlecc.phtml DELETED
@@ -1,254 +0,0 @@
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/litleecheck.phtml DELETED
@@ -1,35 +0,0 @@
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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><package><name>Litle_Payments</name><version>8.13.2</version><stability>stable</stability><license>MIT</license><channel>community</channel><extends/><summary>This extension allows you to accept payments through Litle.</summary><description>Installation of this extension will allow you to easily accept payments through Litle. Once installed, you can choose to accept credit cards as well as eChecks to be processed by Litle.&amp;#13;
2
  &amp;#13;
3
  You will need to contact Litle to setup a merchant ID prior to processing your transaction. You can test your system against our sandbox without the need to contact Litle first.&amp;#13;
4
  &amp;#13;
@@ -8,4 +8,4 @@ Why Litle?&amp;#13;
8
  &amp;#13;
9
  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’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.&amp;#13; </description><notes>This extension implements Litle XML&amp;#13;
10
  &amp;#13;
11
- Additional features include enhanced reporting on orders, transactions, and customers.</notes><authors><author><name>Litle</name><user>Litle</user><email>sdksupport@litle.com</email></author></authors><date>2012-06-06</date><time>15:56:49</time><contents><target name="magelocal"><dir name="Litle"><dir><dir name="LEcheck"><dir name="Block"><dir name="Form"><file hash="ba7cc807aa5e227bb936a196985476a0" name="LEcheck.php"/></dir></dir><dir name="Helper"><file hash="2c2664ab694e0ba70e45157061a01436" name="Data.php"/></dir><dir name="etc"><file hash="f11fc4cef5e5a377b4d0570e926c9250" name="config.xml"/><file hash="daaf81623ceca045d3a3e56e296a29fc" name="system.xml"/></dir><dir name="Model"><file hash="1aa3e3e77c044e77154f9c24afcfc436" name="Transactiontypes.php"/><file hash="fe64d24b39251551b71e37937792b418" name="Config.php"/><file hash="cfc4ab4deb96affb632b7d6caf2b8b15" name="PaymentLogic.php"/><file hash="9e3d8ba06bcb9045abc82f20f18d5ef3" name="Url.php"/><file hash="6628bf9982d0d35341975d0bb83be5e1" name="Accounttypes.php"/><file hash="6a8d4d6f043976ad272c87a885d937f4" name="Validatehttp.php"/></dir></dir><dir name="LitleSDK"><file hash="17c64c7f34e5c84ab3461b92268ede46" name="LitleXmlMapper.php"/><file hash="5febaedb0eba2fbb6f6368320545c081" name="LitleOnlineRequest.php"/><file hash="f78ab9b5497554ae47181053f5f20ac8" name="Communication.php"/><file hash="7344e369d0b1a639dc5cd26b9a1fdbea" name="Setup.php"/><file hash="7613e168c5d16af1fe2c623041f4012f" name="Obj2xml.php"/><file hash="9fb83575223778fad8eaee1bef16ab36" name="XmlParser.php"/><file hash="fb4806e06412b72ed5a6b96fc20cb18f" name="XmlFields.php"/><file hash="c7253201309ce7e91a41735410cb4f2d" name="LitleOnline.php"/><file hash="505ca6afdfbe3fd521848ea6f23b8d07" name="Checker.php"/><file hash="f7951fbf0fc218eaa041f0265b358499" name="UrlMapper.php"/></dir><dir name="CreditCard"><dir name="controllers"><dir name="Adminhtml"><file hash="ca1347dcfd4dc19b311b31e75c23891e" name="OrderController.php"/></dir></dir><dir name="Block"><dir name="Adminhtml"><file hash="c01fb8a142a89562c41a1a315f8f1529" name="Ordergrid.php"/><file hash="a60e3bb449e9001cab70968c0ee9373d" name="Orderview.php"/></dir><dir name="Form"><file hash="b6300b9c6906aefe4fb1265f6e611a28" name="CreditCard.php"/></dir></dir><dir name="Helper"><file hash="22486958c37955f4d87d052de53cfecd" name="Data.php"/></dir><dir name="etc"><file hash="d7a1f47ba192bada53fd6dc4b1da1622" name="config.xml"/><file hash="82c4b9c1ece8485e97613c9ebc5ca8ee" name="system.xml"/></dir><dir name="Model"><file hash="00b1fdb98ecd344b76581fc98242c4e3" name="ValidateMerchantId.php"/><file hash="cf8f9d91ac8bf313aa8d97b865d719de" name="Cctypes.php"/><file hash="ae3aaf306279cf28b57bb703160aea6d" name="PaymentLogic.php"/><file hash="ce0ca23963d9eb05552528eb440d19fe" name="Url.php"/><dir name="Order"><file hash="a3364b0df34829475e913e53507888ea" name="Payment.php"/></dir><file hash="2ed8491cef39c7c17638e02b03b334b4" name="Lpayment.php"/><file hash="a4ba5179ecabffcbdecb70108b94f55a" name="Validatehttp.php"/></dir></dir><dir name="Palorus"><dir name="controllers"><dir name="Adminhtml"><file hash="89faddb2a693533126499504f3809e9d" name="MyformController.php"/></dir></dir><dir name="Block"><dir name="Adminhtml"><file hash="d09244a9d0616ffcb1230a4323cd23cf" name="Transaction.php"/><dir name="Palorus"><dir name="Insight"><file hash="092a1b895aa092a8c19b83578697af5e" name="Tab.php"/></dir></dir></dir></dir><dir name="Helper"><file hash="a00cb4f2aa593a036f80b8faf5795ab1" name="Data.php"/></dir><dir name="etc"><file hash="829e3f8678d894b6392a4a021b757c86" name="config.xml"/></dir><dir name="Model"><file hash="837fd9a46dc1d2a9362742299818aa9f" name="Insight.php"/><file hash="0e33db7cfdbae8e9b2a7de77aff12e98" name="Vault.php"/><dir name="Mysql4"><dir name="Vault"><file hash="433f5fee8c86fd2bd73282a7c3f7c1fb" name="Collection.php"/></dir><dir name="Insight"><file hash="ce93a4bc5c69a69967a5a48b8f6a0a6f" name="Collection.php"/></dir><file hash="b8faca9944ba3ccd28505b36a8485e50" name="Insight.php"/><file hash="6a94ddb1a9d46873d83cc3c71b2828a6" name="Vault.php"/></dir></dir><dir name="sql"><dir name="palorus_setup"><file hash="65e2cda8318d2e986c5644a802e66bf3" name="mysql4-install-8.13.0.php"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file hash="09fb485ff33fb8680e38742182d6d0ba" name="Litle_All.xml"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="payment"><dir name="form"><file hash="a92047f43e72f60fea75dd536bba0552" name="litleecheck.phtml"/><file hash="1d7afe36a27031ca5d4b0ba4c00a956e" name="litlecc.phtml"/></dir></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="payment"><dir name="form"><file hash="a92047f43e72f60fea75dd536bba0552" name="litleecheck.phtml"/><file hash="1d7afe36a27031ca5d4b0ba4c00a956e" name="litlecc.phtml"/><file hash="775224833051c1b7df7c32a626994ec0" name="litlejs.phtml"/></dir></dir></dir><dir name="layout"><file hash="4ed33c73b8c2edd3d57e140997a73ca8" name="litlecreditcard.xml"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="payment"><dir name="form"><file hash="b9921c8126c2eab4a77bd4f120935753" name="litleecheck.phtml"/><file hash="8abb799e1cf936411912fe996b17cfa7" name="litlecc.phtml"/></dir></dir></dir><dir name="layout"><file hash="c0e6321907f69c20502fd079188fbba4" name="litle.xml"/></dir></dir></dir></dir></target></contents><compatible/><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies></package>
1
+ <?xml version="1.0" encoding="UTF-8"?><package><name>Litle_Payments</name><version>8.13.3</version><stability>stable</stability><license>MIT</license><channel>community</channel><extends/><summary>This extension allows you to accept payments through Litle.</summary><description>Installation of this extension will allow you to easily accept payments through Litle. Once installed, you can choose to accept credit cards as well as eChecks to be processed by Litle.&amp;#13;
2
  &amp;#13;
3
  You will need to contact Litle to setup a merchant ID prior to processing your transaction. You can test your system against our sandbox without the need to contact Litle first.&amp;#13;
4
  &amp;#13;
8
  &amp;#13;
9
  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’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.&amp;#13; </description><notes>This extension implements Litle XML&amp;#13;
10
  &amp;#13;
11
+ Additional features include enhanced reporting on orders, transactions, and customers.</notes><authors><author><name>Litle</name><user>Litle</user><email>sdksupport@litle.com</email></author></authors><date>2012-10-01</date><time>17:36:46</time><contents><target name="magelocal"><dir name="Litle"><dir><dir name="CreditCard"><dir name="controllers"><dir name="Adminhtml"><file hash="ca1347dcfd4dc19b311b31e75c23891e" name="OrderController.php"/></dir></dir><dir name="Block"><dir name="Adminhtml"><file hash="a60e3bb449e9001cab70968c0ee9373d" name="Orderview.php"/><file hash="c01fb8a142a89562c41a1a315f8f1529" name="Ordergrid.php"/></dir><dir name="Form"><file hash="1cd0585e5d92329cf686e013b3a3870b" name="CreditCard.php"/></dir></dir><dir name="etc"><file hash="bfb76cd655b2f9d8d98a08931a832a3f" name="system.xml"/><file hash="6802cd6fcd4fb0ed9d0a9c73a904e56a" name="config.xml"/></dir><dir name="Model"><dir name="Order"><file hash="7969e8ea26e6a721730465504d9271e8" name="Payment.php"/></dir><file hash="cb707aa67327bccc6c9b41eb08270842" name="PaymentLogic.php"/><file hash="a4ba5179ecabffcbdecb70108b94f55a" name="Validatehttp.php"/><file hash="ce0ca23963d9eb05552528eb440d19fe" name="Url.php"/><file hash="2ed8491cef39c7c17638e02b03b334b4" name="Lpayment.php"/><file hash="cf8f9d91ac8bf313aa8d97b865d719de" name="Cctypes.php"/><file hash="00b1fdb98ecd344b76581fc98242c4e3" name="ValidateMerchantId.php"/></dir><dir name="Helper"><file hash="5c022ff439721fabc61bc42fc51c6a51" name="Data.php"/></dir></dir><dir name="LEcheck"><dir name="Block"><dir name="Form"><file hash="a60f23cc46bd35a45aa682324155d3fe" name="LEcheck.php"/></dir></dir><dir name="etc"><file hash="daaf81623ceca045d3a3e56e296a29fc" name="system.xml"/><file hash="e54518d4e8d5b9c25d6e14068236ec4d" name="config.xml"/></dir><dir name="Model"><file hash="fe64d24b39251551b71e37937792b418" name="Config.php"/><file hash="cfc4ab4deb96affb632b7d6caf2b8b15" name="PaymentLogic.php"/><file hash="6628bf9982d0d35341975d0bb83be5e1" name="Accounttypes.php"/><file hash="6a8d4d6f043976ad272c87a885d937f4" name="Validatehttp.php"/><file hash="9e3d8ba06bcb9045abc82f20f18d5ef3" name="Url.php"/><file hash="1aa3e3e77c044e77154f9c24afcfc436" name="Transactiontypes.php"/></dir><dir name="Helper"><file hash="2c2664ab694e0ba70e45157061a01436" name="Data.php"/></dir></dir><dir name="LitleSDK"><file hash="f7951fbf0fc218eaa041f0265b358499" name="UrlMapper.php"/><file hash="9fb83575223778fad8eaee1bef16ab36" name="XmlParser.php"/><file hash="505ca6afdfbe3fd521848ea6f23b8d07" name="Checker.php"/><file hash="7344e369d0b1a639dc5cd26b9a1fdbea" name="Setup.php"/><file hash="c7253201309ce7e91a41735410cb4f2d" name="LitleOnline.php"/><file hash="5febaedb0eba2fbb6f6368320545c081" name="LitleOnlineRequest.php"/><file hash="f78ab9b5497554ae47181053f5f20ac8" name="Communication.php"/><file hash="fb4806e06412b72ed5a6b96fc20cb18f" name="XmlFields.php"/><file hash="d254c8a71ee20f59d7699c09d9c9c174" name="Obj2xml.php"/><file hash="17c64c7f34e5c84ab3461b92268ede46" name="LitleXmlMapper.php"/></dir><dir name="Palorus"><dir name="controllers"><file hash="08a1373697b6f3dd8c9e6508573e87d7" name="VaultController.php"/><dir name="Adminhtml"><file hash="4e12464add381a9ca0b8d4b09feb4082" name="VaultController.php"/><file hash="89faddb2a693533126499504f3809e9d" name="MyformController.php"/></dir></dir><dir name="Block"><file hash="135de819b38ce7ff878c16b48e6b6545" name="Vault.php"/><dir name="Adminhtml"><file hash="d09244a9d0616ffcb1230a4323cd23cf" name="Transaction.php"/><dir name="Palorus"><dir name="Insight"><file hash="092a1b895aa092a8c19b83578697af5e" name="Tab.php"/></dir></dir><dir name="Customer"><dir name="Edit"><dir name="Tab"><file hash="16f272c9d87b6172610a576b2f4912f1" name="Vault.php"/></dir></dir></dir></dir><dir name="Vault"><file hash="79ee52a8a899feffeddd4ae036de6bc9" name="List.php"/></dir></dir><dir name="etc"><file hash="7394b041d21429d344373c9367923648" name="config.xml"/></dir><dir name="Model"><file hash="f256fc3f233092eebe2099c5f2622c3c" name="Vault.php"/><dir name="Mysql4"><file hash="d468febf17e1ab53bcd2848329662b56" name="Vault.php"/><dir name="Vault"><file hash="ed26a7b3761a82ab96f040d233dfdda0" name="Collection.php"/></dir><file hash="b8faca9944ba3ccd28505b36a8485e50" name="Insight.php"/><dir name="Insight"><file hash="ce93a4bc5c69a69967a5a48b8f6a0a6f" name="Collection.php"/></dir></dir><file hash="837fd9a46dc1d2a9362742299818aa9f" name="Insight.php"/></dir><dir name="Helper"><file hash="20e90ebc45f75da6117edeb55f8cc59c" name="Data.php"/></dir><dir name="sql"><dir name="palorus_setup"><file hash="3b959664a22dfeaf064b85a56abf74c0" name="mysql4-upgrade-8.13.2-8.13.3.php"/><file hash="65e2cda8318d2e986c5644a802e66bf3" name="mysql4-install-8.13.0.php"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file hash="09fb485ff33fb8680e38742182d6d0ba" name="Litle_All.xml"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file hash="b42e97feb8082098928265e136459ca2" name="litle.xml"/></dir><dir name="template"><dir name="litle"><dir name="form"><file hash="b9921c8126c2eab4a77bd4f120935753" name="litleecheck.phtml"/><file hash="c26146b155358c6a2e815f03a316b76b" name="litlecc.phtml"/></dir><dir name="customer"><dir name="tab"><file hash="33fd55b56e7a66011261eb4474dc3704" name="vault.phtml"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file hash="2552fc3975e214bde25203cf16f66e7c" name="litlecreditcard.xml"/></dir><dir name="template"><dir name="litle"><dir name="vault"><file hash="365ad13b50baf79a310f0ce5fb593c98" name="list.phtml"/></dir><dir name="form"><file hash="2ea144a98a5e71d6c89b14623a021276" name="litleecheck.phtml"/><file hash="775224833051c1b7df7c32a626994ec0" name="litlejs.phtml"/><file hash="f47ebfd26147674f78b4d61fa150398c" name="litlecc.phtml"/></dir></dir></dir></dir></dir></dir></target></contents><compatible/><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies></package>