Litle_Payments - Version 8.15.2

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.15.2
Comparing to
See all releases


Code changes from version 8.15.0 to 8.15.2

app/.htaccess DELETED
@@ -1,2 +0,0 @@
1
- Order deny,allow
2
- Deny from all
 
 
app/code/local/Litle/CreditCard/Helper/Data.php CHANGED
@@ -30,19 +30,8 @@ class Litle_CreditCard_Helper_Data extends Mage_Core_Helper_Abstract
30
 
31
  // This method converts dollars to cents, and takes care of trailing decimals if any.
32
  public function formatAmount($amountInDecimal, $roundUp) {
33
- if( empty($amountInDecimal) || $amountInDecimal === "" )
34
- return $amountInDecimal;
35
 
36
- $amountInCents = ((double)$amountInDecimal) * 100;
37
- $amountToReturn = (int)$amountInCents;
38
-
39
- // check to see if we have left over decimals -- i.e. the incoming amount had more than 2 decimals
40
- if( $amountInCents != (double)$amountToReturn)
41
- {
42
- // yes, more decimals than needed indeed!
43
- $amountToReturn = ($roundUp) ? ($amountToReturn + 1) : ($amountToReturn);
44
- }
45
- return $amountToReturn;
46
  }
47
 
48
  /**
30
 
31
  // This method converts dollars to cents, and takes care of trailing decimals if any.
32
  public function formatAmount($amountInDecimal, $roundUp) {
 
 
33
 
34
+ return (Mage::app()->getStore()->roundPrice($amountInDecimal) * 100);
 
 
 
 
 
 
 
 
 
35
  }
36
 
37
  /**
app/code/local/Litle/CreditCard/Model/PaymentLogic.php CHANGED
@@ -162,25 +162,38 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
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) {
@@ -264,7 +277,7 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
264
  'user' => $this->getConfigData('user'),
265
  'password' => $this->getConfigData('password'),
266
  'merchantId' => $this->getMerchantId($payment),
267
- 'merchantSdk' => 'Magento;8.15.0',
268
  'reportGroup' => $this->getMerchantId($payment),
269
  'customerId' => $order->getCustomerEmail(),
270
  'url' => $this->getConfigData('url'),
@@ -325,19 +338,8 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
325
  public function getOrderDate(Varien_Object $payment)
326
  {
327
  $order = $payment->getOrder();
328
- $date = $order->getCreatedAtFormated('short');
329
- $date_temp = explode('/', $date);
330
- $month = $date_temp['0'];
331
- if ((int) $month < 10) {
332
- $month = '0' . $month;
333
- }
334
- $day = $date_temp['1'];
335
- if ((int) $day < 10) {
336
- $day = '0' . $day;
337
- }
338
- $year_temp = explode(' ', $date_temp['2']);
339
- $year = '20' . $year_temp['0'];
340
- return $year . '-' . $month . '-' . $day;
341
  }
342
 
343
  public function getLineItemData(Varien_Object $payment)
@@ -640,7 +642,7 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
640
  }
641
  elseif($litleResponseCode === '370') {
642
  $descriptiveMessage = "Internal System Error - Call Litle. There is a problem with the Litle System. Contact support@litle.com and provide the following transaction id: " . $litleTxnId;
643
- $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnIdMage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT);
644
  }
645
  else {
646
  $descriptiveMessage = "Transaction was not approved and Litle's Magento extension can not tell why. Contact Litle at support@litle.com and provide the following transaction id: " . $litleTxnId;
@@ -697,25 +699,7 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
697
  $info->setAdditionalInformation('orderSource', 'ecommerce');
698
  }
699
 
700
- $hash = array(
701
- 'orderId' => $orderId,
702
- 'amount' => $amountToPass,
703
- 'orderSource' => $info->getAdditionalInformation('orderSource'),
704
- 'billToAddress' => $this->getBillToAddress($payment),
705
- 'shipToAddress' => $this->getAddressInfo($payment),
706
- 'cardholderAuthentication' => $this->getFraudCheck($payment),
707
- 'enhancedData' => $this->getEnhancedData($payment),
708
- 'customBilling' => $this->getCustomBilling(
709
- Mage::app()->getStore()
710
- ->getBaseUrl())
711
- );
712
-
713
-
714
-
715
- $payment_hash = $this->creditCardOrPaypageOrToken($payment);
716
- $hash_temp = array_merge($hash, $payment_hash);
717
- $merchantData = $this->merchantData($payment);
718
- $hash_in = array_merge($hash_temp, $merchantData);
719
 
720
  $litleRequest = new LitleOnlineRequest();
721
  $litleResponse = $litleRequest->authorizationRequest($hash_in);
@@ -730,6 +714,29 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
730
 
731
  return $this;
732
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
733
 
734
  /**
735
  * this method is called if we are authorising AND capturing a transaction
@@ -777,7 +784,7 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
777
  'shipToAddress' => $this->getAddressInfo($payment),
778
  'enhancedData' => $this->getEnhancedData($payment)
779
  );
780
- $payment_hash = $this->creditCardOrPaypageOrToken($payment);
781
  $hash = array_merge($hash_temp, $payment_hash);
782
  }
783
  $merchantData = $this->merchantData($payment);
@@ -813,7 +820,7 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
813
  $amountToPass = Mage::helper('creditcard')->formatAmount($amount, true);
814
  if (! empty($order)) {
815
  $hash = array(
816
- 'litleTxnId' => $payment->getCcTransId(),
817
  'amount' => $amountToPass
818
  );
819
  $merchantData = $this->merchantData($payment);
@@ -825,6 +832,11 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
825
 
826
  return $this;
827
  }
 
 
 
 
 
828
 
829
  /**
830
  * called if voiding a payment
162
  return $retArray;
163
  }
164
 
165
+ protected $_modelPalorusVault;
166
+ public function setModelPalorusVault(Litle_Palorus_Model_Vault $modelPalorusVault) {
167
+ $this->_modelPalorusVault = $modelPalorusVault;
168
+ }
169
+
170
+ public function getModelPalorusVault() {
171
+ if(null === $this->_modelPalorusVault) {
172
+ $this->setModelPalorusVault(Mage::getModel('palorus/vault'));
173
+ }
174
+ return $this->_modelPalorusVault;
175
+ }
176
+
177
  public function getTokenInfo($payment)
178
  {
179
  $vaultIndex = $this->getInfoInstance()->getAdditionalInformation('cc_vaulted');
180
+ $vaultCard = $this->getModelPalorusVault()->load($vaultIndex);
181
 
182
  $retArray = array();
183
+ $retArray['type'] = $this->litleCcTypeEnum($vaultCard);
184
  $retArray['litleToken'] = $vaultCard->getToken();
185
  $retArray['cardValidationNum'] = $payment->getCcCid();
186
+
187
+ preg_match('/\d\d(\d\d)/', $vaultCard->getExpirationYear(), $expYear);
188
+ $retArray['expDate'] = sprintf('%02d%02d', $vaultCard->getExpirationMonth(), $expYear[1]);
189
  $payment->setCcLast4($vaultCard->getLast4());
190
  $payment->setCcType($vaultCard->getType());
191
 
192
  return $retArray;
193
  }
194
 
195
+ public function creditCardOrPaypageOrToken($payment, $info)
196
  {
 
197
  $vaultIndex = $info->getAdditionalInformation('cc_vaulted');
198
  $payment_hash = array();
199
  if ($vaultIndex > 0) {
277
  'user' => $this->getConfigData('user'),
278
  'password' => $this->getConfigData('password'),
279
  'merchantId' => $this->getMerchantId($payment),
280
+ 'merchantSdk' => 'Magento;8.15.2',
281
  'reportGroup' => $this->getMerchantId($payment),
282
  'customerId' => $order->getCustomerEmail(),
283
  'url' => $this->getConfigData('url'),
338
  public function getOrderDate(Varien_Object $payment)
339
  {
340
  $order = $payment->getOrder();
341
+ $date = $order->getCreatedAtStoreDate();
342
+ return Mage::getModel('core/date')->date('Y-m-d',$date);
 
 
 
 
 
 
 
 
 
 
 
343
  }
344
 
345
  public function getLineItemData(Varien_Object $payment)
642
  }
643
  elseif($litleResponseCode === '370') {
644
  $descriptiveMessage = "Internal System Error - Call Litle. There is a problem with the Litle System. Contact support@litle.com and provide the following transaction id: " . $litleTxnId;
645
+ $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT);
646
  }
647
  else {
648
  $descriptiveMessage = "Transaction was not approved and Litle's Magento extension can not tell why. Contact Litle at support@litle.com and provide the following transaction id: " . $litleTxnId;
699
  $info->setAdditionalInformation('orderSource', 'ecommerce');
700
  }
701
 
702
+ $hash_in = $this->generateAuthorizationHash($orderId, $amountToPass, $info, $payment);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
703
 
704
  $litleRequest = new LitleOnlineRequest();
705
  $litleResponse = $litleRequest->authorizationRequest($hash_in);
714
 
715
  return $this;
716
  }
717
+
718
+ function generateAuthorizationHash($orderId, $amountToPass, $info, $payment) {
719
+ $hash = array(
720
+ 'orderId' => $orderId,
721
+ 'id' => $orderId,
722
+ 'amount' => $amountToPass,
723
+ 'orderSource' => $info->getAdditionalInformation('orderSource'),
724
+ 'billToAddress' => $this->getBillToAddress($payment),
725
+ 'shipToAddress' => $this->getAddressInfo($payment),
726
+ 'cardholderAuthentication' => $this->getFraudCheck($payment),
727
+ 'enhancedData' => $this->getEnhancedData($payment),
728
+ 'customBilling' => $this->getCustomBilling(
729
+ Mage::app()->getStore()
730
+ ->getBaseUrl())
731
+ );
732
+
733
+ $payment_hash = $this->creditCardOrPaypageOrToken($payment, $info);
734
+ $hash_temp = array_merge($hash, $payment_hash);
735
+ $merchantData = $this->merchantData($payment);
736
+ $hash_in = array_merge($hash_temp, $merchantData);
737
+
738
+ return $hash_in;
739
+ }
740
 
741
  /**
742
  * this method is called if we are authorising AND capturing a transaction
784
  'shipToAddress' => $this->getAddressInfo($payment),
785
  'enhancedData' => $this->getEnhancedData($payment)
786
  );
787
+ $payment_hash = $this->creditCardOrPaypageOrToken($payment, $info);
788
  $hash = array_merge($hash_temp, $payment_hash);
789
  }
790
  $merchantData = $this->merchantData($payment);
820
  $amountToPass = Mage::helper('creditcard')->formatAmount($amount, true);
821
  if (! empty($order)) {
822
  $hash = array(
823
+ 'litleTxnId' => $this->findCaptureLitleTxnToRefundForPayment($payment),
824
  'amount' => $amountToPass
825
  );
826
  $merchantData = $this->merchantData($payment);
832
 
833
  return $this;
834
  }
835
+
836
+ function findCaptureLitleTxnToRefundForPayment($payment) {
837
+ $capture = $payment->lookupTransaction(false, Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
838
+ return $capture->getTxnId();
839
+ }
840
 
841
  /**
842
  * called if voiding a payment
app/code/local/Litle/CreditCard/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Litle_CreditCard>
5
- <version>8.15.0</version>
6
  </Litle_CreditCard>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Litle_CreditCard>
5
+ <version>8.15.2</version>
6
  </Litle_CreditCard>
7
  </modules>
8
  <global>
app/code/local/Litle/LEcheck/Model/PaymentLogic.php CHANGED
@@ -166,7 +166,7 @@ class Litle_LEcheck_Model_PaymentLogic extends Mage_Payment_Model_Method_Abstrac
166
  $hash = array('user'=> $this->getConfigData("user"),
167
  'password'=> $this->getConfigData("password"),
168
  'merchantId'=>$this->getMerchantId($payment),
169
- 'version'=>'8.10',
170
  'reportGroup'=>$this->getMerchantId($payment),
171
  'url'=>$this->getConfigData("url"),
172
  'proxy'=>$this->getConfigData("proxy"),
166
  $hash = array('user'=> $this->getConfigData("user"),
167
  'password'=> $this->getConfigData("password"),
168
  'merchantId'=>$this->getMerchantId($payment),
169
+ 'merchantSdk' => 'Magento;8.15.2',
170
  'reportGroup'=>$this->getMerchantId($payment),
171
  'url'=>$this->getConfigData("url"),
172
  'proxy'=>$this->getConfigData("proxy"),
app/code/local/Litle/LEcheck/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Litle_LEcheck>
5
- <version>8.15.0</version>
6
  </Litle_LEcheck>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Litle_LEcheck>
5
+ <version>8.15.2</version>
6
  </Litle_LEcheck>
7
  </modules>
8
  <global>
app/code/local/Litle/LitleSDK/Communication.php CHANGED
@@ -41,7 +41,7 @@ class Communication{
41
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
42
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,2);
43
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
44
- curl_setopt($ch, CURLOPT_SSLVERSION, 3);
45
  if(Mage::getStoreConfig('payment/CreditCard/debug_enable')) {
46
  $xmlToPrint = Communication::cleanseAccountNumber($req);
47
  $xmlToPrint = Communication::cleanseCardValidationNum($xmlToPrint);
41
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
42
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,2);
43
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
44
+ curl_setopt($ch, CURLOPT_SSLVERSION, 1);
45
  if(Mage::getStoreConfig('payment/CreditCard/debug_enable')) {
46
  $xmlToPrint = Communication::cleanseAccountNumber($req);
47
  $xmlToPrint = Communication::cleanseCardValidationNum($xmlToPrint);
app/code/local/Litle/LitleSDK/LitleOnlineRequest.php CHANGED
@@ -507,7 +507,6 @@ class LitleOnlineRequest
507
  {
508
 
509
  $hash_config = LitleOnlineRequest::overideconfig($hash_in);
510
- Mage::log($hash_config);
511
 
512
  $hash = LitleOnlineRequest::getOptionalAttributes($hash_in,$hash_out);
513
  Checker::choice($choice1);
507
  {
508
 
509
  $hash_config = LitleOnlineRequest::overideconfig($hash_in);
 
510
 
511
  $hash = LitleOnlineRequest::getOptionalAttributes($hash_in,$hash_out);
512
  Checker::choice($choice1);
app/code/local/Litle/Palorus/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Litle_Palorus>
5
- <version>8.15.0</version>
6
  </Litle_Palorus>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Litle_Palorus>
5
+ <version>8.15.2</version>
6
  </Litle_Palorus>
7
  </modules>
8
  <global>
package.xml CHANGED
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?><package><name>Litle_Payments</name><version>8.15.0</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>2014-03-25</date><time>11:01:50</time><contents><target name="magelocal"><dir name="Litle"><dir/></dir></target><target name="mageetc"/><target name="magedesign"/></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" standalone="no"?><package><name>Litle_Payments</name><version>8.15.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
  &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>2014-12-30</date><time>09:53:31</time><contents><target name="magelocal"><dir name="Litle"><dir/></dir></target><target name="mageetc"/><target name="magedesign"/></contents><compatible/><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies></package>