Litle_Payments - Version 8.15.0

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


Code changes from version 8.14.0 to 8.15.0

Files changed (42) hide show
  1. app/.gitignore +2 -0
  2. app/.htaccess +2 -0
  3. app/code/local/Litle/CreditCard/Helper/Data.php +2 -1
  4. app/code/local/Litle/CreditCard/Model/PaymentLogic.php +77 -28
  5. app/code/local/Litle/CreditCard/Model/Url.php +19 -7
  6. app/code/local/Litle/CreditCard/controllers/Adminhtml/OrderController.php +10 -11
  7. app/code/local/Litle/CreditCard/etc/config.xml +1 -1
  8. app/code/local/Litle/LEcheck/Model/PaymentLogic.php +13 -3
  9. app/code/local/Litle/LEcheck/etc/config.xml +1 -1
  10. app/code/local/Litle/LitleSDK/BatchRequest.php +413 -0
  11. app/code/local/Litle/LitleSDK/Checker.php +2 -2
  12. app/code/local/Litle/LitleSDK/Communication.php +7 -2
  13. app/code/local/Litle/LitleSDK/LitleOnline.php +8 -3
  14. app/code/local/Litle/LitleSDK/LitleOnlineRequest.php +313 -146
  15. app/code/local/Litle/LitleSDK/LitleRequest.php +299 -0
  16. app/code/local/Litle/LitleSDK/LitleResponseProcessor.php +73 -0
  17. app/code/local/Litle/LitleSDK/LitleXmlMapper.php +9 -5
  18. app/code/local/Litle/LitleSDK/Obj2xml.php +126 -7
  19. app/code/local/Litle/LitleSDK/Setup.php +22 -2
  20. app/code/local/Litle/LitleSDK/Transactions.php +353 -0
  21. app/code/local/Litle/LitleSDK/XmlFields.php +81 -26
  22. app/code/local/Litle/LitleSDK/XmlParser.php +5 -0
  23. app/code/local/Litle/Palorus/Helper/Data.php +10 -2
  24. app/code/local/Litle/Palorus/Model/Avscid.php +13 -0
  25. app/code/local/Litle/Palorus/Model/Mysql4/Avscid.php +9 -0
  26. app/code/local/Litle/Palorus/Model/Mysql4/Avscid/Collection.php +11 -0
  27. app/code/local/Litle/Palorus/Model/Vault.php +0 -10
  28. app/code/local/Litle/Palorus/etc/config.xml +4 -1
  29. app/code/local/Litle/Palorus/sql/palorus_setup/mysql4-upgrade-8.14.0-8.15.0.php +21 -0
  30. app/design/.gitignore +1 -0
  31. app/design/adminhtml/default/default/layout/.gitignore +31 -0
  32. app/design/adminhtml/default/default/locale/en_US/.gitignore +1 -0
  33. app/design/adminhtml/default/default/template/.gitignore +59 -0
  34. app/design/adminhtml/default/default/template/litle/form/litlecc.phtml +1 -1
  35. app/design/frontend/.gitignore +1 -0
  36. app/design/frontend/base/default/.gitignore +1 -0
  37. app/design/frontend/base/default/layout/.gitignore +39 -0
  38. app/design/frontend/base/default/template/.gitignore +42 -0
  39. app/design/frontend/base/default/template/litle/form/litlecc.phtml +1 -3
  40. app/etc/.gitignore +4 -0
  41. app/etc/modules/.gitignore +19 -0
  42. package.xml +2 -2
app/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /locale
2
+ /Mage.php
app/.htaccess ADDED
@@ -0,0 +1,2 @@
 
 
1
+ Order deny,allow
2
+ Deny from all
app/code/local/Litle/CreditCard/Helper/Data.php CHANGED
@@ -4,9 +4,10 @@ class Litle_CreditCard_Helper_Data extends Mage_Core_Helper_Abstract
4
  public function isStateOfOrderEqualTo($order, $inOrderState){
5
  $payment = $order->getPayment();
6
  $lastTxnId = $payment->getLastTransId();
 
7
  $lastTxn = $payment->getTransaction($lastTxnId);
8
 
9
- if( $lastTxn->getTxnType() === $inOrderState )
10
  return true;
11
  else
12
  return false;
4
  public function isStateOfOrderEqualTo($order, $inOrderState){
5
  $payment = $order->getPayment();
6
  $lastTxnId = $payment->getLastTransId();
7
+ Mage::log("Last txn id: " . $lastTxnId);
8
  $lastTxn = $payment->getTransaction($lastTxnId);
9
 
10
+ if( $lastTxn != null && $lastTxn->getTxnType() === $inOrderState )
11
  return true;
12
  else
13
  return false;
app/code/local/Litle/CreditCard/Model/PaymentLogic.php CHANGED
@@ -78,7 +78,7 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
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
 
@@ -96,7 +96,7 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
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());
@@ -264,13 +264,21 @@ 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
- 'version' => '8.10',
268
- 'merchantSdk' => 'Magento;8.14.0',
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
  }
@@ -290,13 +298,16 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
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
 
@@ -314,7 +325,7 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
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) {
@@ -383,9 +394,18 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
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
 
@@ -449,7 +469,9 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
449
  $this->getUpdater($litleResponse, 'tokenResponse', 'litleToken'),
450
  $this->getUpdater($litleResponse, 'tokenResponse', 'bin'));
451
 
452
- $this->getInfoInstance()->setAdditionalInformation('vault_id', $vault->getId());
 
 
453
  }
454
  }
455
 
@@ -500,7 +522,7 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
500
  }
501
  }
502
 
503
- public function writeFailedTransactionToDatabase($customerId, $orderId, $message, $xmlDocument) {
504
  $orderNumber = 0;
505
  if($orderId === null) {
506
  $orderId = 0;
@@ -537,6 +559,29 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
537
  Mage::log("Insert failed with error message: " . mysql_error(), null, "litle.log");
538
  Mage::log("Query executed: " . $sql, null, "litle.log");
539
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
540
  mysql_close($con);
541
  }
542
  }
@@ -554,54 +599,57 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
554
  Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID,
555
  Mage_Sales_Model_Order::STATE_CANCELED,
556
  Mage_Payment_Model_Method_Abstract::STATUS_VOID,
557
- "Authorization has expired - no need to reverse. The original Authorization is no longer valid, because it has expired. You can not perform an Authorization Reversal for an expired Authorization.");
 
558
  }
559
  elseif($litleResponseCode === '311') {
560
  $this->setOrderStatusAndCommentsForFailedTransaction( $payment, $litleTxnId,
561
  Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND,
562
  Mage_Sales_Model_Order::STATE_COMPLETE,
563
  Mage_Payment_Model_Method_Abstract::STATUS_APPROVED,
564
- "Deposit is already referenced by a chargeback. The deposit is already referenced by a chargeback; therefore, a refund cannot be processed against the original transaction.");
 
565
  }
566
  elseif($litleResponseCode === '316') {
567
  $this->setOrderStatusAndCommentsForFailedTransaction( $payment, $litleTxnId,
568
  Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND,
569
  Mage_Sales_Model_Order::STATE_COMPLETE,
570
  Mage_Payment_Model_Method_Abstract::STATUS_APPROVED,
571
- "Automatic refund already issued. This refund transaction is a duplicate for one already processed automatically by the Litle Fraud Chargeback Prevention Service.");
 
572
  }
573
  elseif($litleResponseCode === '335') {
574
  $descriptiveMessage = "This method of payment does not support authorization reversals. You can not perform an Authorization Reversal transaction for this payment type.";
575
- $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId);
576
  }
577
  elseif($litleResponseCode === '336') {
578
  $descriptiveMessage = "Reversal amount does not match Authorization amount. For a merchant initiated reversal against an American Express authorization, the reversal amount must match the authorization amount exactly.";
579
- $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId);
580
  }
581
  elseif($litleResponseCode === '361') {
582
- $descriptiveMessage = "Authorization no longer available. The authorization for this transaction is no longer available; the authorization has already been consumed by another capture.";
583
- $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId);
584
  }
585
  elseif($litleResponseCode === '362') {
586
  $descriptiveMessage = "Transaction Not Voided - Already Settled. This transaction cannot be voided; it has already been delivered to the card networks. You may want to try a refund instead.";
587
- $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId);
588
  }
589
  elseif($litleResponseCode === '365') {
590
  $descriptiveMessage = "Total credit amount exceeds capture amouont. The amount of the credit is greater than the capture, or the amount of this credit plus other credits already referencing this capture are greater than the capture amount.";
591
- $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId);
592
  }
593
  elseif($litleResponseCode === '370') {
594
  $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;
595
- $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId);
596
  }
597
  else {
598
  $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;
599
- $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId);
600
  }
601
 
602
  }
603
 
604
- public function setOrderStatusAndCommentsForFailedTransaction($payment, $litleTxnId, $transactionType, $orderState, $paymentStatus, $litleMessage) {
605
  $paymentHelp = new Litle_CreditCard_Model_Lpayment();
606
  $paymentHelp->setOrder($payment->getOrder());
607
  $transaction = $paymentHelp->addTransaction(transactionType, null, true, $litleMessage);
@@ -609,12 +657,12 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
609
  ->setCcTransId($litleTxnId)
610
  ->setLastTransId($litleTxnId)
611
  ->setTransactionId($litleTxnId)
612
- ->setIsTransactionClosed(true)
613
  ->setTransactionAdditionalInfo('additional_information', $litleMessage);
614
  }
615
 
616
- public function showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $messageToShow, $litleTxnId) {
617
- $this->writeFailedTransactionToDatabase($customerId, $orderId, $litleMessage, $litleResponse);
618
  $resource = Mage::getSingleton('core/resource');
619
  $conn = $resource->getConnection('core_read');
620
  $query = 'select failed_transactions_id from litle_failed_transactions where litle_txn_id = ' . $litleTxnId;
@@ -628,6 +676,7 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
628
  */
629
  public function authorize(Varien_Object $payment, $amount)
630
  {
 
631
  // @TODO This is the wrong way to do this.
632
  if (preg_match('/sales_order_create/i', $_SERVER['REQUEST_URI']) &&
633
  ($this->getConfigData('paypage_enable') == '1')) {
@@ -741,7 +790,7 @@ class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
741
  } else {
742
  $litleResponse = $litleRequest->captureRequest($hash_in);
743
  }
744
-
745
  if (! is_null($info->getAdditionalInformation('cc_should_save'))) {
746
  $this->_saveToken($payment, $litleResponse);
747
  }
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://reports.litle.com).");
82
  }
83
  }
84
 
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());
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'),
271
  'proxy' => $this->getConfigData('proxy'),
272
+ 'timeout' => $this->getConfigData('timeout'),
273
+ 'batch_requests_path' => 'MAGENTO', //Magento doesn't use batch
274
+ 'sftp_username' => 'MAGENTO', //Magento doesn't use batch
275
+ 'sftp_password' => 'MAGENTO', //Magento doesn't use batch
276
+ 'batch_url' => 'MAGENTO', //Magento doesn't use batch
277
+ 'tcp_port' => 'MAGENTO', //Magento doesn't use batch
278
+ 'tcp_ssl' => 'MAGENTO', //Magento doesn't use batch
279
+ 'tcp_timeout' => 'MAGENTO', //Magento doesn't use batch
280
+ 'litle_requests_path' => 'MAGENTO', //Magento doesn't use batch
281
+ 'print_xml' => 'false' //Magento uses debug_enabled instead
282
  );
283
  return $hash;
284
  }
298
  $url_temp2 = explode('.', $url);
299
  $count = count($url_temp2);
300
  }
301
+ if ($count == 2) {
302
  if (strlen($url_temp2['0'] . '.' . $url_temp2['1']) > 13) {
303
  $url = $url_temp2['0'];
304
  } else {
305
  $url = $url_temp2['0'] . '.' . $url_temp2['1'];
306
  }
307
  }
308
+ if($count == 1) {
309
+ $url = substr($url_temp2['0'], 0, 13);
310
+ }
311
  }
312
  }
313
 
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) {
394
  public function getFraudCheck(Varien_Object $payment)
395
  {
396
  $order = $payment->getOrder();
397
+ $ip = $order->getRemoteIp();
398
+ $ipv4Regex = "/\A(?:\d{1,3}\.){3}\d{1,3}\z/";
399
+ $matches = preg_match($ipv4Regex, $ip);
400
+ if($matches === 1) {
401
+ $hash = array(
402
+ 'customerIpAddress' => $ip
403
+ );
404
+ }
405
+ else {
406
+ Mage::log("Not sending ip address " . $ip . " because it isn't ipv4", null, "litle.log");
407
+ $hash = array();
408
+ }
409
  return $hash;
410
  }
411
 
469
  $this->getUpdater($litleResponse, 'tokenResponse', 'litleToken'),
470
  $this->getUpdater($litleResponse, 'tokenResponse', 'bin'));
471
 
472
+ if ($vault) {
473
+ $this->getInfoInstance()->setAdditionalInformation('vault_id', $vault->getId());
474
+ }
475
  }
476
  }
477
 
522
  }
523
  }
524
 
525
+ public function writeFailedTransactionToDatabase($customerId, $orderId, $message, $xmlDocument, $txnType) {
526
  $orderNumber = 0;
527
  if($orderId === null) {
528
  $orderId = 0;
559
  Mage::log("Insert failed with error message: " . mysql_error(), null, "litle.log");
560
  Mage::log("Query executed: " . $sql, null, "litle.log");
561
  }
562
+ $sql = "select * from sales_payment_transaction where order_id = " . $orderId . " order by created_at asc";
563
+ $result = mysql_query($sql);
564
+ Mage::log("Executed sql: " . $sql, null, "litle.log");
565
+ Mage::log($result, null, "litle.log");
566
+ while($row = mysql_fetch_assoc($result)) {
567
+ Mage::log($row['transaction_id'], null, "litle.log");
568
+ $sql = "insert into sales_payment_transaction (parent_id, order_id, payment_id, txn_id, parent_txn_id, txn_type, is_closed, created_at, additional_information) values (".$row['transaction_id'].", ".$orderId.", ".$orderId.", ".$litleTxnId.", ".$row['txn_id'].", '".$txnType."', 0,now(),'".serialize(array('message'=>message))."')";
569
+ }
570
+ Mage::log("Sql to execute is: " . $sql, null, "litle.log");
571
+ $result = mysql_query($sql);
572
+ if(!$result) {
573
+ Mage::log("Insert failed with error message: " . mysql_error(), null, "litle.log");
574
+ Mage::log("Query executed: " . $sql, null, "litle.log");
575
+ }
576
+
577
+ $sql = "insert into sales_flat_order_status_history (parent_id, is_customer_notified, is_visible_on_front, comment, status, created_at, entity_name) values (".$orderId.", 2, 0,'".$message.". Transaction ID: ".$litleTxnId."','processing',now(),'".$txnType."')";
578
+ Mage::log("Sql to execute is: " . $sql, null, "litle.log");
579
+ $result = mysql_query($sql);
580
+ if(!$result) {
581
+ Mage::log("Insert failed with error message: " . mysql_error(), null, "litle.log");
582
+ Mage::log("Query executed: " . $sql, null, "litle.log");
583
+ }
584
+
585
  mysql_close($con);
586
  }
587
  }
599
  Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID,
600
  Mage_Sales_Model_Order::STATE_CANCELED,
601
  Mage_Payment_Model_Method_Abstract::STATUS_VOID,
602
+ "Authorization has expired - no need to reverse. The original Authorization is no longer valid, because it has expired. You can not perform an Authorization Reversal for an expired Authorization.",
603
+ true);
604
  }
605
  elseif($litleResponseCode === '311') {
606
  $this->setOrderStatusAndCommentsForFailedTransaction( $payment, $litleTxnId,
607
  Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND,
608
  Mage_Sales_Model_Order::STATE_COMPLETE,
609
  Mage_Payment_Model_Method_Abstract::STATUS_APPROVED,
610
+ "Deposit is already referenced by a chargeback. The deposit is already referenced by a chargeback; therefore, a refund cannot be processed against the original transaction.",
611
+ true);
612
  }
613
  elseif($litleResponseCode === '316') {
614
  $this->setOrderStatusAndCommentsForFailedTransaction( $payment, $litleTxnId,
615
  Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND,
616
  Mage_Sales_Model_Order::STATE_COMPLETE,
617
  Mage_Payment_Model_Method_Abstract::STATUS_APPROVED,
618
+ "Automatic refund already issued. This refund transaction is a duplicate for one already processed automatically by the Litle Fraud Chargeback Prevention Service.",
619
+ true);
620
  }
621
  elseif($litleResponseCode === '335') {
622
  $descriptiveMessage = "This method of payment does not support authorization reversals. You can not perform an Authorization Reversal transaction for this payment type.";
623
+ $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
624
  }
625
  elseif($litleResponseCode === '336') {
626
  $descriptiveMessage = "Reversal amount does not match Authorization amount. For a merchant initiated reversal against an American Express authorization, the reversal amount must match the authorization amount exactly.";
627
+ $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
628
  }
629
  elseif($litleResponseCode === '361') {
630
+ $descriptiveMessage = "The order #".$order->getIncrementId()." can not be captured. Authorization no longer available. The authorization for this transaction is no longer available; the authorization has already been consumed by another capture.";
631
+ $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
632
  }
633
  elseif($litleResponseCode === '362') {
634
  $descriptiveMessage = "Transaction Not Voided - Already Settled. This transaction cannot be voided; it has already been delivered to the card networks. You may want to try a refund instead.";
635
+ $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
636
  }
637
  elseif($litleResponseCode === '365') {
638
  $descriptiveMessage = "Total credit amount exceeds capture amouont. The amount of the credit is greater than the capture, or the amount of this credit plus other credits already referencing this capture are greater than the capture amount.";
639
+ $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND);
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;
647
+ $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT);
648
  }
649
 
650
  }
651
 
652
+ public function setOrderStatusAndCommentsForFailedTransaction($payment, $litleTxnId, $transactionType, $orderState, $paymentStatus, $litleMessage, $closed) {
653
  $paymentHelp = new Litle_CreditCard_Model_Lpayment();
654
  $paymentHelp->setOrder($payment->getOrder());
655
  $transaction = $paymentHelp->addTransaction(transactionType, null, true, $litleMessage);
657
  ->setCcTransId($litleTxnId)
658
  ->setLastTransId($litleTxnId)
659
  ->setTransactionId($litleTxnId)
660
+ ->setIsTransactionClosed($closed)
661
  ->setTransactionAdditionalInfo('additional_information', $litleMessage);
662
  }
663
 
664
+ public function showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $messageToShow, $litleTxnId, $txnType) {
665
+ $this->writeFailedTransactionToDatabase($customerId, $orderId, $litleMessage, $litleResponse, $txnType);
666
  $resource = Mage::getSingleton('core/resource');
667
  $conn = $resource->getConnection('core_read');
668
  $query = 'select failed_transactions_id from litle_failed_transactions where litle_txn_id = ' . $litleTxnId;
676
  */
677
  public function authorize(Varien_Object $payment, $amount)
678
  {
679
+ // What about this? Mage::app()->getStore()->isAdmin()
680
  // @TODO This is the wrong way to do this.
681
  if (preg_match('/sales_order_create/i', $_SERVER['REQUEST_URI']) &&
682
  ($this->getConfigData('paypage_enable') == '1')) {
790
  } else {
791
  $litleResponse = $litleRequest->captureRequest($hash_in);
792
  }
793
+
794
  if (! is_null($info->getAdditionalInformation('cc_should_save'))) {
795
  $this->_saveToken($payment, $litleResponse);
796
  }
app/code/local/Litle/CreditCard/Model/Url.php CHANGED
@@ -10,17 +10,29 @@ class Litle_CreditCard_Model_URL
10
  'label' => 'Sandbox'
11
  ),
12
  array(
13
- 'value' => "https://cert.litle.com/vap/communicator/online",
14
- 'label' => 'Cert'
15
- ),
16
- array(
17
- 'value' => "https://precert.litle.com/vap/communicator/online",
18
- 'label' => 'PreCert'
19
  ),
 
 
 
 
 
 
 
 
 
 
 
 
20
  array(
21
  'value' => "https://payments.litle.com/vap/communicator/online",
22
  'label' => 'Production'
23
- )
 
 
 
 
24
  );
25
 
26
  }
10
  'label' => 'Sandbox'
11
  ),
12
  array(
13
+ 'value' => "https://postlive.litle.com/vap/communicator/online",
14
+ 'label' => 'Postlive'
 
 
 
 
15
  ),
16
+ array(
17
+ 'value' => "https://prelive.litle.com/vap/communicator/online",
18
+ 'label' => 'Prelive'
19
+ ),
20
+ array(
21
+ 'value' => "https://transact-postlive.litle.com/vap/communicator/online",
22
+ 'label' => 'Transact Postlive'
23
+ ),
24
+ array(
25
+ 'value' => "https://transact-prelive.litle.com/vap/communicator/online",
26
+ 'label' => 'Transact Prelive'
27
+ ),
28
  array(
29
  'value' => "https://payments.litle.com/vap/communicator/online",
30
  'label' => 'Production'
31
+ ),
32
+ array(
33
+ 'value' => "https://transact.litle.com/vap/communicator/online",
34
+ 'label' => 'Transact Production'
35
+ )
36
  );
37
 
38
  }
app/code/local/Litle/CreditCard/controllers/Adminhtml/OrderController.php CHANGED
@@ -4,21 +4,18 @@ class Litle_CreditCard_Adminhtml_OrderController extends Mage_Adminhtml_Controll
4
  public function massCaptureAction()
5
  {
6
  $orderIds = $this->getRequest()->getPost('order_ids', array());
7
- $countCaptureOrder = 0;
8
  foreach ($orderIds as $orderId) {
9
  $order = Mage::getModel('sales/order')->load($orderId);
10
  $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice(array());
11
  if ($order->canInvoice()){
12
  $invoice->register();
13
- $this->captureInvoice($invoice);
14
- $countCaptureOrder++;
 
15
  } else {
16
  $this->_getSession()->addError($this->__('The order #' . $invoice->getOrder()->getIncrementId() . ' cannot be Captured '));
17
  }
18
  }
19
- if ($countCaptureOrder) {
20
- $this->_getSession()->addSuccess($this->__('%s order(s) have been Captured', $countCaptureOrder));
21
- }
22
  $referrer = $_SERVER['HTTP_REFERER'];
23
  $this->_redirectUrl($referrer);
24
  }
@@ -28,20 +25,22 @@ class Litle_CreditCard_Adminhtml_OrderController extends Mage_Adminhtml_Controll
28
  try
29
  {
30
  $invoice->setRequestedCaptureCase('online');
31
- $invoice->sendEmail(true);
32
- $invoice->setEmailSent(true);
33
- $invoice->getOrder()->setCustomerNoteNotify(true);
34
- $invoice->getOrder()->setIsInProcess(true);
35
  $invoice->capture();
36
  $transactionSave = Mage::getModel('core/resource_transaction')
37
  ->addObject($invoice)
38
  ->addObject($invoice->getOrder());
39
  $transactionSave->save();
 
40
  }
41
-
42
  catch (Exception $e)
43
  {
 
44
  Mage::logException($e);
 
45
  }
46
  }
47
  }
4
  public function massCaptureAction()
5
  {
6
  $orderIds = $this->getRequest()->getPost('order_ids', array());
 
7
  foreach ($orderIds as $orderId) {
8
  $order = Mage::getModel('sales/order')->load($orderId);
9
  $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice(array());
10
  if ($order->canInvoice()){
11
  $invoice->register();
12
+ if($this->captureInvoice($invoice)) {
13
+ $this->_getSession()->addSuccess("The order #".$invoice->getOrder()->getIncrementId()." captured successfully");
14
+ }
15
  } else {
16
  $this->_getSession()->addError($this->__('The order #' . $invoice->getOrder()->getIncrementId() . ' cannot be Captured '));
17
  }
18
  }
 
 
 
19
  $referrer = $_SERVER['HTTP_REFERER'];
20
  $this->_redirectUrl($referrer);
21
  }
25
  try
26
  {
27
  $invoice->setRequestedCaptureCase('online');
28
+ //$invoice->sendEmail(true);
29
+ //$invoice->setEmailSent(true);
30
+ //$invoice->getOrder()->setCustomerNoteNotify(true);
31
+ //$invoice->getOrder()->setIsInProcess(true);
32
  $invoice->capture();
33
  $transactionSave = Mage::getModel('core/resource_transaction')
34
  ->addObject($invoice)
35
  ->addObject($invoice->getOrder());
36
  $transactionSave->save();
37
+ return true;
38
  }
 
39
  catch (Exception $e)
40
  {
41
+ Mage::getSingleton('core/session')->addError($e->getMessage());
42
  Mage::logException($e);
43
+ return false;
44
  }
45
  }
46
  }
app/code/local/Litle/CreditCard/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Litle_CreditCard>
5
- <version>8.13.3</version>
6
  </Litle_CreditCard>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Litle_CreditCard>
5
+ <version>8.15.0</version>
6
  </Litle_CreditCard>
7
  </modules>
8
  <global>
app/code/local/Litle/LEcheck/Model/PaymentLogic.php CHANGED
@@ -89,9 +89,9 @@ class Litle_LEcheck_Model_PaymentLogic extends Mage_Payment_Model_Method_Abstrac
89
  $returnFromThisModel = Mage::getStoreConfig('payment/CreditCard/' . $fieldToLookFor);
90
  }
91
 
92
- if( $returnFromThisModel == NULL )
93
  $returnFromThisModel = parent::getConfigData($fieldToLookFor, $store);
94
-
95
  return $returnFromThisModel;
96
  }
97
 
@@ -170,7 +170,17 @@ class Litle_LEcheck_Model_PaymentLogic extends Mage_Payment_Model_Method_Abstrac
170
  'reportGroup'=>$this->getMerchantId($payment),
171
  'url'=>$this->getConfigData("url"),
172
  'proxy'=>$this->getConfigData("proxy"),
173
- 'timeout'=>$this->getConfigData("timeout")
 
 
 
 
 
 
 
 
 
 
174
  );
175
  return $hash;
176
  }
89
  $returnFromThisModel = Mage::getStoreConfig('payment/CreditCard/' . $fieldToLookFor);
90
  }
91
 
92
+ if( $returnFromThisModel == NULL ) {
93
  $returnFromThisModel = parent::getConfigData($fieldToLookFor, $store);
94
+ }
95
  return $returnFromThisModel;
96
  }
97
 
170
  'reportGroup'=>$this->getMerchantId($payment),
171
  'url'=>$this->getConfigData("url"),
172
  'proxy'=>$this->getConfigData("proxy"),
173
+ 'timeout'=>$this->getConfigData("timeout"),
174
+ 'batch_requests_path' => 'MAGENTO', //Magento doesn't use batch
175
+ 'sftp_username' => 'MAGENTO', //Magento doesn't use batch
176
+ 'sftp_password' => 'MAGENTO', //Magento doesn't use batch
177
+ 'batch_url' => 'MAGENTO', //Magento doesn't use batch
178
+ 'tcp_port' => 'MAGENTO', //Magento doesn't use batch
179
+ 'tcp_ssl' => 'MAGENTO', //Magento doesn't use batch
180
+ 'tcp_timeout' => 'MAGENTO', //Magento doesn't use batch
181
+ 'litle_requests_path' => 'MAGENTO', //Magento doesn't use batch
182
+ 'print_xml' => 'false' //Magento uses debug_enabled instead
183
+
184
  );
185
  return $hash;
186
  }
app/code/local/Litle/LEcheck/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Litle_LEcheck>
5
- <version>8.13.3</version>
6
  </Litle_LEcheck>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Litle_LEcheck>
5
+ <version>8.15.0</version>
6
  </Litle_LEcheck>
7
  </modules>
8
  <global>
app/code/local/Litle/LitleSDK/BatchRequest.php ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BatchRequest {
4
+
5
+ private $counts_and_amounts;
6
+
7
+ public $total_txns = 0;
8
+
9
+ public $closed = false;
10
+
11
+ # file name which holds the transaction markups during the batch process
12
+ public $transaction_file;
13
+
14
+ public $batch_file;
15
+
16
+
17
+ public function isFull(){
18
+ return $this->total_txns >= MAX_TXNS_PER_BATCH;
19
+ }
20
+
21
+ public function __construct($request_dir=NULL){
22
+ // initialize the counts and amounts
23
+
24
+ $this->counts_and_amounts = array(
25
+ 'auth' => array(
26
+ 'count' => 0,
27
+ 'amount' => 0,
28
+ ),
29
+ 'sale' => array(
30
+ 'count' => 0,
31
+ 'amount' => 0,
32
+ ),
33
+ 'credit' => array(
34
+ 'count' => 0,
35
+ 'amount' => 0,
36
+ ),
37
+ 'tokenRegistration' => array(
38
+ 'count' => 0,
39
+ ),
40
+ 'captureGivenAuth' => array(
41
+ 'count' => 0,
42
+ 'amount' => 0,
43
+ ),
44
+ 'forceCapture' => array(
45
+ 'count' => 0,
46
+ 'amount' => 0,
47
+ ),
48
+ 'authReversal' => array(
49
+ 'count' => 0,
50
+ 'amount' => 0,
51
+ ),
52
+ 'capture' => array(
53
+ 'count' => 0,
54
+ 'amount' => 0,
55
+ ),
56
+ 'echeckVerification' => array(
57
+ 'count' => 0,
58
+ 'amount' => 0,
59
+ ),
60
+ 'echeckCredit' => array(
61
+ 'count' => 0,
62
+ 'amount' => 0,
63
+ ),
64
+ 'echeckRedeposit' => array(
65
+ 'count' => 0,
66
+ ),
67
+ 'echeckSale' => array(
68
+ 'count' => 0,
69
+ 'amount' => 0,
70
+ ),
71
+ 'updateCardValidationNumOnToken' => array(
72
+ 'count' => 0,
73
+ ),
74
+ 'updateSubscription' => array(
75
+ 'count' => 0,
76
+ ),
77
+ 'cancelSubscription' => array(
78
+ 'count' => 0,
79
+ ),
80
+ 'createPlan' => array(
81
+ 'count' => 0,
82
+ ),
83
+ 'updatePlan' => array(
84
+ 'count' => 0,
85
+ ),
86
+ 'activate' => array(
87
+ 'count' => 0,
88
+ 'amount' => 0,
89
+ ),
90
+ 'deactivate' => array(
91
+ 'count' => 0,
92
+ 'amount' => 0,
93
+ ),
94
+ 'load' => array(
95
+ 'count' => 0,
96
+ 'amount' => 0,
97
+ ),
98
+ 'unload' => array(
99
+ 'count' => 0,
100
+ 'amount' => 0,
101
+ ),
102
+ 'balanceInquiry' => array(
103
+ 'count' => 0,
104
+ 'amount' => 0,
105
+ ),
106
+ 'accountUpdate' => array(
107
+ 'count' => 0,
108
+ ));
109
+
110
+ // if a dir to place the request file is not explicitly provided, grab it from the config file
111
+ if(!$request_dir){
112
+ $conf = Obj2xml::getConfig(array());
113
+ $request_dir = $conf['batch_requests_path'];
114
+ }
115
+
116
+ if(substr($request_dir, -1, 1) != DIRECTORY_SEPARATOR){
117
+ $request_dir = $request_dir . DIRECTORY_SEPARATOR;
118
+ }
119
+
120
+ $ts = str_replace(" ", "", substr(microtime(), 2));
121
+ $filename = $request_dir . "batch_" . $ts . "_txns";
122
+ $batch_filename = $request_dir . "batch_" . $ts;
123
+
124
+ // if either file already exists, let's try again!
125
+ if(file_exists($filename) || file_exists($batch_filename)){
126
+ $this->__construct();
127
+ }
128
+
129
+ // if we were unable to write the file
130
+ if(file_put_contents($filename, "") === FALSE){
131
+ throw new RuntimeException("A batch file could not be written at $filename. Please check your privilege.");
132
+ }
133
+ $this->transaction_file = $filename;
134
+
135
+ // if we were unable to write the file
136
+ if(file_put_contents($batch_filename, "") === FALSE){
137
+ throw new RuntimeException("A batch file could not be written at $batch_filename. Please check your privilege.");
138
+ }
139
+ $this->batch_file = $batch_filename;
140
+
141
+ }
142
+
143
+ /*
144
+ * Extracts the appropriate values from the hash in and passes them along to the addTransaction function
145
+ */
146
+ public function addSale($hash_in){
147
+ $hash_out = Transactions::createSaleHash($hash_in);
148
+
149
+ $choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
150
+ $choice2_hash= array($hash_out['fraudCheck'],$hash_out['cardholderAuthentication']);
151
+
152
+ $this->addTransaction($hash_out, $hash_in, 'sale', $choice_hash, $choice2_hash);
153
+ $this->counts_and_amounts['sale']['count'] += 1;
154
+ $this->counts_and_amounts['sale']['amount'] += $hash_out['amount'];
155
+ }
156
+
157
+ public function addAuth($hash_in){
158
+ $hash_out = Transactions::createAuthHash($hash_in);
159
+
160
+ $choice_hash = array(XmlFields::returnArrayValue($hash_out,'card'),XmlFields::returnArrayValue($hash_out,'paypal'),XmlFields::returnArrayValue($hash_out,'token'),XmlFields::returnArrayValue($hash_out,'paypage'));
161
+
162
+ $this->addTransaction($hash_out, $hash_in, 'authorization', $choice_hash);
163
+ $this->counts_and_amounts['auth']['count'] += 1;
164
+ $this->counts_and_amounts['auth']['amount'] += $hash_out['amount'];
165
+ }
166
+
167
+ public function addAuthReversal($hash_in){
168
+ $hash_out = Transactions::createAuthReversalHash($hash_in);
169
+
170
+ $this->addTransaction($hash_out,$hash_in,'authReversal');
171
+ $this->counts_and_amounts['authReversal']['count'] += 1;
172
+ $this->counts_and_amounts['authReversal']['amount'] += $hash_out['amount'];
173
+ }
174
+
175
+ public function addCredit($hash_in){
176
+ $hash_out = Transactions::createCreditHash($hash_in);
177
+
178
+ $choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
179
+
180
+ $this->addTransaction($hash_out,$hash_in,'credit',$choice_hash);
181
+ $this->counts_and_amounts['credit']['count'] += 1;
182
+ $this->counts_and_amounts['credit']['amount'] += $hash_out['amount'];
183
+ }
184
+
185
+ public function addRegisterToken($hash_in){
186
+ $hash_out = Transactions::createRegisterTokenHash($hash_in);
187
+
188
+ $choice_hash = array($hash_out['accountNumber'],$hash_out['echeckForToken'],$hash_out['paypageRegistrationId']);
189
+
190
+ $this->addTransaction($hash_out,$hash_in,'registerTokenRequest',$choice_hash);
191
+ $this->counts_and_amounts['tokenRegistration']['count'] += 1;
192
+ }
193
+
194
+ public function addForceCapture($hash_in){
195
+ $hash_out = Transactions::createForceCaptureHash($hash_in);
196
+
197
+ $choice_hash = array(XmlFields::returnArrayValue($hash_out,'card'),XmlFields::returnArrayValue($hash_out,'paypal'),XmlFields::returnArrayValue($hash_out,'token'),XmlFields::returnArrayValue($hash_out,'paypage'));
198
+
199
+ $this->addTransaction($hash_out,$hash_in,'forceCapture',$choice_hash);
200
+ $this->counts_and_amounts['forceCapture']['count'] += 1;
201
+ $this->counts_and_amounts['forceCapture']['amount'] += $hash_out['amount'];
202
+
203
+ }
204
+
205
+ public function addCapture($hash_in){
206
+ $hash_out = Transactions::createCaptureHash($hash_in);
207
+
208
+ $this->addTransaction($hash_out,$hash_in,'capture');
209
+ $this->counts_and_amounts['capture']['count'] += 1;
210
+ $this->counts_and_amounts['capture']['amount'] += $hash_out['amount'];
211
+
212
+ }
213
+
214
+ public function addCaptureGivenAuth($hash_in){
215
+ $hash_out = Transactions::createCaptureGivenAuthHash($hash_in);
216
+
217
+ $choice_hash = array($hash_out['card'],$hash_out['token'],$hash_out['paypage']);
218
+
219
+ $this->addTransaction($hash_out,$hash_in,'captureGivenAuth',$choice_hash);
220
+ $this->counts_and_amounts['captureGivenAuth']['count'] += 1;
221
+ $this->counts_and_amounts['captureGivenAuth']['amount'] += $hash_out['amount'];
222
+
223
+ }
224
+
225
+ public function addEcheckRedeposit($hash_in){
226
+ $hash_out = Transactions::createEcheckRedepositHash($hash_in);
227
+
228
+ $choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
229
+
230
+ $this->addTransaction($hash_out,$hash_in,'echeckRedeposit',$choice_hash);
231
+ $this->counts_and_amounts['echeckRedeposit']['count'] += 1;
232
+ }
233
+
234
+ public function addEcheckSale($hash_in){
235
+ $hash_out = Transactions::createEcheckSaleHash($hash_in);
236
+
237
+ $choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
238
+
239
+ $this->addTransaction($hash_out,$hash_in,'echeckSale',$choice_hash);
240
+ $this->counts_and_amounts['echeckSale']['count'] += 1;
241
+ $this->counts_and_amounts['echeckSale']['amount'] += $hash_out['amount'];
242
+
243
+ }
244
+
245
+ public function addEcheckCredit($hash_in){
246
+ $hash_out = Transactions::createEcheckCreditHash($hash_in);
247
+
248
+ $choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
249
+
250
+ $this->addTransaction($hash_out,$hash_in,'echeckCredit',$choice_hash);
251
+ $this->counts_and_amounts['echeckCredit']['count'] += 1;
252
+ $this->counts_and_amounts['echeckCredit']['amount'] += $hash_out['amount'];
253
+
254
+ }
255
+
256
+ public function addEcheckVerification($hash_in){
257
+ $hash_out = Transactions::createEcheckVerificationHash($hash_in);
258
+
259
+ $choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
260
+
261
+ $this->addTransaction($hash_out,$hash_in,'echeckVerification',$choice_hash);
262
+ $this->counts_and_amounts['echeckVerification']['count'] += 1;
263
+ $this->counts_and_amounts['echeckVerification']['amount'] += $hash_out['amount'];
264
+
265
+ }
266
+
267
+ public function addUpdateCardValidationNumOnToken($hash_in){
268
+ $hash_out = Transactions::createUpdateCardValidationNumOnTokenHash($hash_in);
269
+
270
+ $this->addTransaction($hash_out,$hash_in,"updateCardValidationNumOnToken");
271
+ $this->counts_and_amounts['updateCardValidationNumOnToken']['count'] += 1;
272
+ }
273
+
274
+ public function addUpdateSubscription($hash_in){
275
+ $hash_out = Transactions::createUpdateSubscriptionHash($hash_in);
276
+
277
+ $this->addTransaction($hash_out,$hash_in,"updateSubscription");
278
+ $this->counts_and_amounts['updateSubscription']['count'] += 1;
279
+ }
280
+
281
+ public function addCancelSubscription($hash_in){
282
+ $hash_out = Transactions::createCancelSubscriptionHash($hash_in);
283
+
284
+ $this->addTransaction($hash_out,$hash_in,"cancelSubscription");
285
+ $this->counts_and_amounts['cancelSubscription']['count'] += 1;
286
+ }
287
+
288
+ public function addCreatePlan($hash_in){
289
+ $hash_out = Transactions::createCreatePlanHash($hash_in);
290
+
291
+ $this->addTransaction($hash_out,$hash_in,"createPlan");
292
+ $this->counts_and_amounts['createPlan']['count'] += 1;
293
+ }
294
+
295
+ public function addUpdatePlan($hash_in){
296
+ $hash_out = Transactions::createUpdatePlanHash($hash_in);
297
+
298
+ $this->addTransaction($hash_out,$hash_in,"updatePlan");
299
+ $this->counts_and_amounts['updatePlan']['count'] += 1;
300
+ }
301
+
302
+ public function addActivate($hash_in){
303
+ $hash_out = Transactions::createActivateHash($hash_in);
304
+
305
+ $this->addTransaction($hash_out,$hash_in,"activate");
306
+ $this->counts_and_amounts['activate']['count'] += 1;
307
+ $this->counts_and_amounts['activate']['amount'] += $hash_out['amount'];
308
+ }
309
+ public function addDeactivate($hash_in){
310
+ $hash_out = Transactions::createDeactivateHash($hash_in);
311
+
312
+ $this->addTransaction($hash_out,$hash_in,"deactivate");
313
+ $this->counts_and_amounts['deactivate']['count'] += 1;
314
+ }
315
+ public function addLoad($hash_in){
316
+ $hash_out = Transactions::createLoadHash($hash_in);
317
+
318
+ $this->addTransaction($hash_out,$hash_in,"load");
319
+ $this->counts_and_amounts['load']['count'] += 1;
320
+ $this->counts_and_amounts['load']['amount'] += $hash_out['amount'];
321
+ }
322
+ public function addUnload($hash_in){
323
+ $hash_out = Transactions::createUnloadHash($hash_in);
324
+
325
+ $this->addTransaction($hash_out,$hash_in,"unload");
326
+ $this->counts_and_amounts['unload']['count'] += 1;
327
+ $this->counts_and_amounts['unload']['amount'] += $hash_out['amount'];
328
+ }
329
+ public function addBalanceInquiry($hash_in){
330
+ $hash_out = Transactions::createBalanceInquiryHash($hash_in);
331
+
332
+ $this->addTransaction($hash_out,$hash_in,"balanceInquiry");
333
+ $this->counts_and_amounts['balanceInquiry']['count'] += 1;
334
+ }
335
+
336
+ public function addAccountUpdate($hash_in){
337
+ $hash_out = Transactions::createAccountUpdate($hash_in);
338
+
339
+ $choice_hash = array(XmlFields::returnArrayValue($hash_out,'card'),XmlFields::returnArrayValue($hash_out,'token'));
340
+
341
+ $this->addTransaction($hash_out,$hash_in,'accountUpdate',$choice_hash);
342
+ $this->counts_and_amounts['accountUpdate']['count'] += 1;
343
+ }
344
+
345
+ /*
346
+ * Adds the XML for the transaction given the appropriate data to the transactions file
347
+ */
348
+ private function addTransaction($hash_out, $hash_in, $type, $choice1 = null, $choice2 = null){
349
+
350
+ if($this->closed){
351
+ throw new RuntimeException("Could not add the transaction. This batchRequest is closed.");
352
+ }
353
+ if($this->isFull()){
354
+ throw new RuntimeException('The transaction could not be added to the batch. It is full.');
355
+ }
356
+ if($type == 'accountUpdate' && $this->counts_and_amounts['accountUpdate']['count'] != $this->total_txns){
357
+ throw new RuntimeException("The transaction could not be added to the batch. The transaction type $type cannot be mixed with non-Account Updates.");
358
+ }
359
+ else if($type != 'accountUpdate' && $this->counts_and_amounts['accountUpdate']['count'] == $this->total_txns && $this->total_txns > 0){
360
+ throw new RuntimeException("The transaction could not be added to the batch. The transaction type $type cannot be mixed with AccountUpdates.");
361
+ }
362
+
363
+ if(isset($hash_in['reportGroup'])){
364
+ $report_group = $hash_in['reportGroup'];
365
+ }
366
+ else{
367
+ $conf = Obj2xml::getConfig(array());
368
+ $report_group = $conf['reportGroup'];
369
+ }
370
+
371
+
372
+ Checker::choice($choice1);
373
+ Checker::choice($choice2);
374
+
375
+ $request = Obj2xml::transactionToXml($hash_out, $type, $report_group);
376
+
377
+ if(file_put_contents($this->transaction_file, $request, FILE_APPEND) === FALSE){
378
+ throw new RuntimeException("A transaction could not be written to the batch file at $transaction_file. Please check your privilege.");
379
+ }
380
+
381
+ $this->total_txns += 1;
382
+ }
383
+
384
+ /*
385
+ * When no more transactions are to be added, the transactions file can be amended with the XML tags for the counts
386
+ * and amounts of the batch request. Returns the filename of the complete batchrequest file
387
+ */
388
+ public function closeRequest(){
389
+ $handle = @fopen($this->transaction_file,"r");
390
+ if($handle){
391
+ file_put_contents($this->batch_file, Obj2xml::generateBatchHeader($this->counts_and_amounts), FILE_APPEND);
392
+ while(($buffer = fgets($handle, 4096)) !== false){
393
+ file_put_contents($this->batch_file, $buffer, FILE_APPEND);
394
+ }
395
+ if(!feof($handle)){
396
+ throw new RuntimeException("Error when reading transactions file at $this->transaction_file. Please check your privilege.");
397
+ }
398
+ fclose($handle);
399
+ file_put_contents($this->batch_file, "</batchRequest>", FILE_APPEND);
400
+
401
+ unlink($this->transaction_file);
402
+ unset($this->transaction_file);
403
+ $this->closed = true;
404
+ }
405
+ else{
406
+ throw new RuntimeException("Could not open transactions file at $this->transaction_file. Please check your privilege.");
407
+ }
408
+ }
409
+
410
+ public function getCountsAndAmounts(){
411
+ return $this->counts_and_amounts;
412
+ }
413
+ }
app/code/local/Litle/LitleSDK/Checker.php CHANGED
@@ -24,7 +24,7 @@
24
  */
25
  class Checker
26
  {
27
- function requiredField($value)
28
  {
29
  if ($value != null)
30
  {
@@ -36,7 +36,7 @@ class Checker
36
  }
37
  }
38
 
39
- function choice($choiceArray)
40
  {
41
  $i= 0;
42
  for($y=0;$y<count($choiceArray);$y++){
24
  */
25
  class Checker
26
  {
27
+ static function requiredField($value)
28
  {
29
  if ($value != null)
30
  {
36
  }
37
  }
38
 
39
+ static function choice($choiceArray)
40
  {
41
  $i= 0;
42
  for($y=0;$y<count($choiceArray);$y++){
app/code/local/Litle/LitleSDK/Communication.php CHANGED
@@ -23,8 +23,13 @@
23
  * OTHER DEALINGS IN THE SOFTWARE.
24
  */
25
  class Communication{
26
- function httpRequest($req,$hash_config=NULL){
 
27
  $config = Obj2xml::getConfig($hash_config);
 
 
 
 
28
  $ch = curl_init();
29
  curl_setopt($ch, CURLOPT_PROXY, $config['proxy']);
30
  curl_setopt($ch, CURLOPT_POST, true);
@@ -36,6 +41,7 @@ class Communication{
36
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
37
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,2);
38
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
39
  if(Mage::getStoreConfig('payment/CreditCard/debug_enable')) {
40
  $xmlToPrint = Communication::cleanseAccountNumber($req);
41
  $xmlToPrint = Communication::cleanseCardValidationNum($xmlToPrint);
@@ -69,5 +75,4 @@ class Communication{
69
  static public function cleansePassword($xml) {
70
  return preg_replace("|<password>.*?</password>|", "<password>NEUTERED</password>",$xml);
71
  }
72
-
73
  }
23
  * OTHER DEALINGS IN THE SOFTWARE.
24
  */
25
  class Communication{
26
+ static function httpRequest($req,$hash_config=NULL){
27
+
28
  $config = Obj2xml::getConfig($hash_config);
29
+
30
+ if((int)$config['print_xml']){
31
+ echo $req;
32
+ }
33
  $ch = curl_init();
34
  curl_setopt($ch, CURLOPT_PROXY, $config['proxy']);
35
  curl_setopt($ch, CURLOPT_POST, true);
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);
75
  static public function cleansePassword($xml) {
76
  return preg_replace("|<password>.*?</password>|", "<password>NEUTERED</password>",$xml);
77
  }
 
78
  }
app/code/local/Litle/LitleSDK/LitleOnline.php CHANGED
@@ -23,9 +23,10 @@
23
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
  * OTHER DEALINGS IN THE SOFTWARE.
25
  */
26
- define('CURRENT_XML_VERSION', '8.13');
27
- error_reporting(E_ALL ^ E_NOTICE);
28
- //ini_set('display_errors', '1');
 
29
  require_once realpath(dirname(__FILE__)) . '/LitleXmlMapper.php';
30
  require_once realpath(dirname(__FILE__)) . '/XmlFields.php';
31
  require_once realpath(dirname(__FILE__)) . '/Communication.php';
@@ -34,3 +35,7 @@ require_once realpath(dirname(__FILE__)) . '/Obj2xml.php';
34
  require_once realpath(dirname(__FILE__)) . '/Checker.php';
35
  require_once realpath(dirname(__FILE__)) . '/LitleOnlineRequest.php';
36
  require_once realpath(dirname(__FILE__)) . '/UrlMapper.php';
 
 
 
 
23
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
  * OTHER DEALINGS IN THE SOFTWARE.
25
  */
26
+ define('CURRENT_XML_VERSION', '8.23');
27
+ define('CURRENT_SDK_VERSION', 'PHP;8.23.0');
28
+ define('MAX_TXNS_PER_BATCH', 100000);
29
+ define('MAX_TXNS_PER_REQUEST', 500000);
30
  require_once realpath(dirname(__FILE__)) . '/LitleXmlMapper.php';
31
  require_once realpath(dirname(__FILE__)) . '/XmlFields.php';
32
  require_once realpath(dirname(__FILE__)) . '/Communication.php';
35
  require_once realpath(dirname(__FILE__)) . '/Checker.php';
36
  require_once realpath(dirname(__FILE__)) . '/LitleOnlineRequest.php';
37
  require_once realpath(dirname(__FILE__)) . '/UrlMapper.php';
38
+ require_once realpath(dirname(__FILE__)) . '/BatchRequest.php';
39
+ require_once realpath(dirname(__FILE__)) . '/LitleRequest.php';
40
+ require_once realpath(dirname(__FILE__)) . '/Transactions.php';
41
+ require_once realpath(dirname(__FILE__)) . '/LitleResponseProcessor.php';
app/code/local/Litle/LitleSDK/LitleOnlineRequest.php CHANGED
@@ -25,45 +25,53 @@
25
 
26
  class LitleOnlineRequest
27
  {
28
- public function __construct()
 
 
29
  {
 
30
  $this->newXML = new LitleXmlMapper();
31
  }
32
 
33
  public function authorizationRequest($hash_in)
34
  {
35
  if (isset($hash_in['litleTxnId'])){
36
- $hash_out = array('litleTxnId'=> ($hash_in['litleTxnId']));
37
  }
38
  else {
39
  $hash_out = array(
40
- 'orderId'=> Checker::requiredField($hash_in['orderId']),
41
- 'amount'=>Checker::requiredField($hash_in['amount']),
42
- 'orderSource'=>Checker::requiredField($hash_in['orderSource']),
43
- 'customerInfo'=>(XmlFields::customerInfo($hash_in['customerInfo'])),
44
- 'billToAddress'=>(XmlFields::contact($hash_in['billToAddress'])),
45
- 'shipToAddress'=>(XmlFields::contact($hash_in['shipToAddress'])),
46
- 'card'=> (XmlFields::cardType($hash_in['card'])),
47
- 'paypal'=>(XmlFields::payPal($hash_in['paypal'])),
48
- 'token'=>(XmlFields::cardTokenType($hash_in['token'])),
49
- 'paypage'=>(XmlFields::cardPaypageType($hash_in['paypage'])),
50
- 'billMeLaterRequest'=>(XmlFields::billMeLaterRequest($hash_in['billMeLaterRequest'])),
51
- 'cardholderAuthentication'=>(XmlFields::fraudCheckType($hash_in['cardholderAuthentication'])),
52
- 'processingInstructions'=>(XmlFields::processingInstructions($hash_in['processingInstructions'])),
53
- 'pos'=>(XmlFields::pos($hash_in['pos'])),
54
- 'customBilling'=>(XmlFields::customBilling($hash_in['customBilling'])),
55
- 'taxBilling'=>(XmlFields::taxBilling($hash_in['taxBilling'])),
56
- 'enhancedData'=>(XmlFields::enhancedData($hash_in['enhancedData'])),
57
- 'amexAggregatorData'=>(XmlFields::amexAggregatorData($hash_in['amexAggregatorData'])),
58
- 'allowPartialAuth'=>$hash_in['allowPartialAuth'],
59
- 'healthcareIIAS'=>(XmlFields::healthcareIIAS($hash_in['healthcareIIAS'])),
60
- 'filtering'=>(XmlFields::filteringType($hash_in['filtering'])),
61
- 'merchantData'=>(XmlFields::merchantData($hash_in['merchantData'])),
62
- 'recyclingRequest'=>(XmlFields::recyclingRequestType($hash_in['recyclingRequest'])),
63
- 'fraudFilterOverride'=> $hash_in['fraudFilterOverride']);
 
 
 
 
 
64
  }
65
 
66
- $choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
67
  $authorizationResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'authorization',$choice_hash);
68
  return $authorizationResponse;
69
  }
@@ -71,48 +79,55 @@ class LitleOnlineRequest
71
  public function saleRequest($hash_in)
72
  {
73
  $hash_out = array(
74
- 'litleTxnId' => $hash_in['litleTxnId'],
75
- 'orderId' =>Checker::requiredField($hash_in['orderId']),
76
- 'amount' =>Checker::requiredField($hash_in['amount']),
77
- 'orderSource'=>Checker::requiredField($hash_in['orderSource']),
78
- 'customerInfo'=>XmlFields::customerInfo($hash_in['customerInfo']),
79
- 'billToAddress'=>XmlFields::contact($hash_in['billToAddress']),
80
- 'shipToAddress'=>XmlFields::contact($hash_in['shipToAddress']),
81
- 'card'=> XmlFields::cardType($hash_in['card']),
82
- 'paypal'=>XmlFields::payPal($hash_in['paypal']),
83
- 'token'=>XmlFields::cardTokenType($hash_in['token']),
84
- 'paypage'=>XmlFields::cardPaypageType($hash_in['paypage']),
85
- 'billMeLaterRequest'=>XmlFields::billMeLaterRequest($hash_in['billMeLaterRequest']),
86
- 'fraudCheck'=>XmlFields::fraudCheckType($hash_in['fraudCheck']),
87
- 'cardholderAuthentication'=>XmlFields::fraudCheckType($hash_in['cardholderAuthentication']),
88
- 'customBilling'=>XmlFields::customBilling($hash_in['customBilling']),
89
- 'taxBilling'=>XmlFields::taxBilling($hash_in['taxBilling']),
90
- 'enhancedData'=>XmlFields::enhancedData($hash_in['enhancedData']),
91
- 'processingInstructions'=>XmlFields::processingInstructions($hash_in['processingInstructions']),
92
- 'pos'=>XmlFields::pos($hash_in['pos']),
93
- 'payPalOrderComplete'=> $hash_in['paypalOrderComplete'],
94
- 'payPalNotes'=> $hash_in['paypalNotesType'],
95
- 'amexAggregatorData'=>XmlFields::amexAggregatorData($hash_in['amexAggregatorData']),
96
- 'allowPartialAuth'=>$hash_in['allowPartialAuth'],
97
- 'healthcareIIAS'=>XmlFields::healthcareIIAS($hash_in['healthcareIIAS']),
98
- 'filtering'=>XmlFields::filteringType($hash_in['filtering']),
99
- 'merchantData'=>XmlFields::merchantData($hash_in['merchantData']),
100
- 'recyclingRequest'=>XmlFields::recyclingRequestType($hash_in['recyclingRequest']),
101
- 'fraudFilterOverride'=> $hash_in['fraudFilterOverride']);
 
 
 
 
 
 
102
 
103
  $choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
104
  $choice2_hash= array($hash_out['fraudCheck'],$hash_out['cardholderAuthentication']);
105
- $saleResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'sale',$choice_hash,$choice_hash2);
106
  return $saleResponse;
107
  }
108
 
109
  public function authReversalRequest($hash_in)
110
  {
111
  $hash_out = array(
112
- 'litleTxnId' => Checker::requiredField($hash_in['litleTxnId']),
113
- 'amount' =>$hash_in['amount'],
114
- 'payPalNotes'=>$hash_in['payPalNotes'],
115
- 'actionReason'=>$hash_in['actionReason']);
 
116
  $authReversalResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'authReversal');
117
  return $authReversalResponse;
118
  }
@@ -123,6 +138,7 @@ class LitleOnlineRequest
123
  'litleTxnId' => XmlFields::returnArrayValue($hash_in, 'litleTxnId'),
124
  'orderId' =>XmlFields::returnArrayValue($hash_in, 'orderId'),
125
  'amount' =>XmlFields::returnArrayValue($hash_in, 'amount'),
 
126
  'orderSource'=>XmlFields::returnArrayValue($hash_in, 'orderSource'),
127
  'billToAddress'=>XmlFields::contact(XMLFields::returnArrayValue($hash_in, 'billToAddress')),
128
  'card'=>XmlFields::cardType(XMLFields::returnArrayValue($hash_in, 'card')),
@@ -148,10 +164,12 @@ class LitleOnlineRequest
148
  public function registerTokenRequest($hash_in)
149
  {
150
  $hash_out = array(
151
- 'orderId'=>$hash_in['orderId'],
152
- 'accountNumber'=>$hash_in['accountNumber'],
153
- 'echeckForToken'=>XmlFields::echeckForTokenType($hash_in['echeckForToken']),
154
- 'paypageRegistrationId'=>$hash_in['paypageRegistrationId']);
 
 
155
 
156
  $choice_hash = array($hash_out['accountNumber'],$hash_out['echeckForToken'],$hash_out['paypageRegistrationId']);
157
  $registerTokenResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'registerTokenRequest',$choice_hash);
@@ -161,21 +179,25 @@ class LitleOnlineRequest
161
  public function forceCaptureRequest($hash_in)
162
  {
163
  $hash_out = array(
164
- 'orderId' =>Checker::requiredField($hash_in['orderId']),
165
- 'amount' =>$hash_in['amount'],
166
- 'orderSource'=>Checker::requiredField($hash_in['orderSource']),
167
- 'billToAddress'=>XmlFields::contact($hash_in['billToAddress']),
168
- 'card'=> XmlFields::cardType($hash_in['card']),
169
- 'token'=>XmlFields::cardTokenType($hash_in['token']),
170
- 'paypage'=>XmlFields::cardPaypageType($hash_in['paypage']),
171
- 'customBilling'=>XmlFields::customBilling($hash_in['customBilling']),
172
- 'taxBilling'=>XmlFields::taxBilling($hash_in['taxBilling']),
173
- 'enhancedData'=>XmlFields::enhancedData($hash_in['enhancedData']),
174
- 'processingInstructions'=>XmlFields::processingInstructions($hash_in['processingInstructions']),
175
- 'pos'=>XmlFields::pos($hash_in['pos']),
176
- 'amexAggregatorData'=>XmlFields::amexAggregatorData($hash_in['amexAggregatorData']));
 
 
 
 
177
 
178
- $choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
179
  $forceCaptureResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'forceCapture',$choice_hash);
180
  return $forceCaptureResponse;
181
  }
@@ -183,13 +205,14 @@ class LitleOnlineRequest
183
  public function captureRequest($hash_in)
184
  {
185
  $hash_out = array(
186
- 'partial'=>$hash_in['partial'],
187
- 'litleTxnId' => Checker::requiredField($hash_in['litleTxnId']),
188
- 'amount' =>($hash_in['amount']),
189
- 'enhancedData'=>XmlFields::enhancedData($hash_in['enhancedData']),
190
- 'processingInstructions'=>XmlFields::processingInstructions($hash_in['processingInstructions']),
191
- 'payPalOrderComplete'=>$hash_in['payPalOrderComplete'],
192
- 'payPalNotes' =>$hash_in['payPalNotes']);
 
193
  $captureResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'capture');
194
  return $captureResponse;
195
  }
@@ -197,22 +220,26 @@ class LitleOnlineRequest
197
  public function captureGivenAuthRequest($hash_in)
198
  {
199
  $hash_out = array(
200
- 'orderId'=>Checker::requiredField($hash_in['orderId']),
201
- 'authInformation'=>XmlFields::authInformation($hash_in['authInformation']),
202
- 'amount' =>Checker::requiredField($hash_in['amount']),
203
- 'orderSource'=>Checker::requiredField($hash_in['orderSource']),
204
- 'billToAddress'=>XmlFields::contact($hash_in['billToAddress']),
205
- 'shipToAddress'=>XmlFields::contact($hash_in['shipToAddress']),
206
- 'card'=> XmlFields::cardType($hash_in['card']),
207
- 'token'=>XmlFields::cardTokenType($hash_in['token']),
208
- 'paypage'=>XmlFields::cardPaypageType($hash_in['paypage']),
209
- 'customBilling'=>XmlFields::customBilling($hash_in['customBilling']),
210
- 'taxBilling'=>XmlFields::taxBilling($hash_in['taxBilling']),
211
- 'billMeLaterRequest'=>XmlFields::billMeLaterRequest($hash_in['billMeLaterRequest']),
212
- 'enhancedData'=>XmlFields::enhancedData($hash_in['enhancedData']),
213
- 'processingInstructions'=>XmlFields::processingInstructions($hash_in['processingInstructions']),
214
- 'pos'=>XmlFields::pos($hash_in['pos']),
215
- 'amexAggregatorData'=>XmlFields::amexAggregatorData($hash_in['amexAggregatorData']));
 
 
 
 
216
 
217
  $choice_hash = array($hash_out['card'],$hash_out['token'],$hash_out['paypage']);
218
  $captureGivenAuthResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'captureGivenAuth',$choice_hash);
@@ -222,9 +249,11 @@ class LitleOnlineRequest
222
  public function echeckRedepositRequest($hash_in)
223
  {
224
  $hash_out = array(
225
- 'litleTxnId' => Checker::requiredField($hash_in['litleTxnId']),
226
- 'echeck'=>XmlFields::echeckType($hash_in['echeck']),
227
- 'echeckToken'=>XmlFields::echeckTokenType($hash_in['echeckToken']));
 
 
228
 
229
  $choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
230
  $echeckRedepositResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'echeckRedeposit',$choice_hash);
@@ -234,34 +263,38 @@ class LitleOnlineRequest
234
  public function echeckSaleRequest($hash_in)
235
  {
236
  $hash_out = array(
237
- 'litleTxnId'=>$hash_in['litleTxnId'],
238
- 'orderId'=>$hash_in['orderId'],
239
- 'verify'=>$hash_in['verify'],
240
- 'amount'=>$hash_in['amount'],
241
- 'orderSource'=>$hash_in['orderSource'],
242
- 'billToAddress'=>XmlFields::contact($hash_in['billToAddress']),
243
- 'shipToAddress'=>XmlFields::contact($hash_in['shipToAddress']),
244
- 'echeck'=>XmlFields::echeckType($hash_in['echeck']),
245
- 'echeckToken'=>XmlFields::echeckTokenType($hash_in['echeckToken']),
246
- 'customBilling'=>XmlFields::customBilling($hash_in['customBilling']));
247
 
248
  $choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
249
 
250
  $echeckSaleResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'echeckSale',$choice_hash);
251
  return $echeckSaleResponse;
252
  }
 
 
 
 
253
 
254
  public function echeckCreditRequest($hash_in)
255
  {
256
  $hash_out = array(
257
- 'litleTxnId'=>$hash_in['litleTxnId'],
258
- 'orderId'=>$hash_in['orderId'],
259
- 'amount'=>$hash_in['amount'],
260
- 'orderSource'=>$hash_in['orderSource'],
261
- 'billToAddress'=>XmlFields::contact($hash_in['billToAddress']),
262
- 'echeck'=>XmlFields::echeckType($hash_in['echeck']),
263
- 'echeckToken'=>XmlFields::echeckTokenType($hash_in['echeckToken']),
264
- 'customBilling'=>XmlFields::customBilling($hash_in['customBilling']));
265
 
266
  $choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
267
  $echeckCreditResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'echeckCredit',$choice_hash);
@@ -272,13 +305,15 @@ class LitleOnlineRequest
272
  {
273
 
274
  $hash_out = array(
275
- 'litleTxnId'=>$hash_in['litleTxnId'],
276
- 'orderId'=>Checker::requiredField($hash_in['orderId']),
277
- 'amount'=>Checker::requiredField($hash_in['amount']),
278
- 'orderSource'=>Checker::requiredField($hash_in['orderSource']),
279
- 'billToAddress'=>XmlFields::contact($hash_in['billToAddress']),
280
- 'echeck'=>XmlFields::echeckType($hash_in['echeck']),
281
- 'echeckToken'=>XmlFields::echeckTokenType($hash_in['echeckToken']));
 
 
282
 
283
  $choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
284
  $choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
@@ -289,8 +324,8 @@ class LitleOnlineRequest
289
  public function voidRequest($hash_in)
290
  {
291
  $hash_out = array(
292
- 'litleTxnId' => Checker::requiredField($hash_in['litleTxnId']),
293
- 'processingInstructions'=>XmlFields::processingInstructions($hash_in['processingInstructions']));
294
 
295
  $voidResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'void');
296
  return $voidResponse;
@@ -299,39 +334,171 @@ class LitleOnlineRequest
299
  public function echeckVoidRequest($hash_in)
300
  {
301
  $hash_out = array(
302
- 'litleTxnId' => Checker::requiredField($hash_in['litleTxnId']),
303
  );
304
  $echeckVoidResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,"echeckVoid");
305
  return $echeckVoidResponse;
306
  }
307
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  private function overideConfig($hash_in)
309
  {
310
  $hash_out = array(
311
- 'user'=>$hash_in['user'],
312
- 'password'=>$hash_in['password'],
313
- 'merchantId'=>$hash_in['merchantId'],
314
- 'reportGroup'=>$hash_in['reportGroup'],
315
- 'version'=>$hash_in['version'],
316
- 'url'=>$hash_in['url'],
317
- 'timeout'=>$hash_in['timeout'],
318
- 'proxy'=>$hash_in['proxy']);
 
 
 
 
 
 
 
 
 
319
  return $hash_out;
320
  }
321
 
322
  private function getOptionalAttributes($hash_in,$hash_out)
323
  {
324
  if(isset($hash_in['merchantSdk'])) {
325
- $hash_out['merchantSdk'] = $hash_in['merchantSdk'];
326
  }
327
  else {
328
- $hash_out['merchantSdk'] = 'PHP;8.14.0';
329
  }
330
  if(isset($hash_in['id'])) {
331
- $hash_out['id'] = $hash_in['id'];
332
  }
333
  if(isset($hash_in['customerId'])) {
334
- $hash_out['customerId'] = $hash_in['customerId'];
 
 
 
335
  }
336
  return $hash_out;
337
  }
@@ -340,13 +507,13 @@ class LitleOnlineRequest
340
  {
341
 
342
  $hash_config = LitleOnlineRequest::overideconfig($hash_in);
 
343
 
344
  $hash = LitleOnlineRequest::getOptionalAttributes($hash_in,$hash_out);
345
  Checker::choice($choice1);
346
  Checker::choice($choice2);
347
  $request = Obj2xml::toXml($hash,$hash_config, $type);
348
-
349
- $litleOnlineResponse = $this->newXML->request($request,$hash_config);
350
  return $litleOnlineResponse;
351
  }
352
 
25
 
26
  class LitleOnlineRequest
27
  {
28
+ private $useSimpleXml = false;
29
+
30
+ public function __construct($treeResponse=false)
31
  {
32
+ $this->useSimpleXml = $treeResponse;
33
  $this->newXML = new LitleXmlMapper();
34
  }
35
 
36
  public function authorizationRequest($hash_in)
37
  {
38
  if (isset($hash_in['litleTxnId'])){
39
+ $hash_out = array('litleTxnId'=> (XmlFields::returnArrayValue($hash_in,'litleTxnId')));
40
  }
41
  else {
42
  $hash_out = array(
43
+ 'orderId'=> Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
44
+ 'amount'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'amount')),
45
+ 'surchargeAmount' =>XmlFields::returnArrayValue($hash_in,'surchargeAmount'),
46
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
47
+ 'customerInfo'=>(XmlFields::customerInfo(XmlFields::returnArrayValue($hash_in,'customerInfo'))),
48
+ 'billToAddress'=>(XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress'))),
49
+ 'shipToAddress'=>(XmlFields::contact(XmlFields::returnArrayValue($hash_in,'shipToAddress'))),
50
+ 'card'=> (XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card'))),
51
+ 'paypal'=>(XmlFields::payPal(XmlFields::returnArrayValue($hash_in,'paypal'))),
52
+ 'token'=>(XmlFields::cardTokenType(XmlFields::returnArrayValue($hash_in,'token'))),
53
+ 'paypage'=>(XmlFields::cardPaypageType(XmlFields::returnArrayValue($hash_in,'paypage'))),
54
+ 'billMeLaterRequest'=>(XmlFields::billMeLaterRequest(XmlFields::returnArrayValue($hash_in,'billMeLaterRequest'))),
55
+ 'cardholderAuthentication'=>(XmlFields::fraudCheckType(XmlFields::returnArrayValue($hash_in,'cardholderAuthentication'))),
56
+ 'processingInstructions'=>(XmlFields::processingInstructions(XmlFields::returnArrayValue($hash_in,'processingInstructions'))),
57
+ 'pos'=>(XmlFields::pos(XmlFields::returnArrayValue($hash_in,'pos'))),
58
+ 'customBilling'=>(XmlFields::customBilling(XmlFields::returnArrayValue($hash_in,'customBilling'))),
59
+ 'taxBilling'=>(XmlFields::taxBilling(XmlFields::returnArrayValue($hash_in,'taxBilling'))),
60
+ 'enhancedData'=>(XmlFields::enhancedData(XmlFields::returnArrayValue($hash_in,'enhancedData'))),
61
+ 'amexAggregatorData'=>(XmlFields::amexAggregatorData(XmlFields::returnArrayValue($hash_in,'amexAggregatorData'))),
62
+ 'allowPartialAuth'=>XmlFields::returnArrayValue($hash_in,'allowPartialAuth'),
63
+ 'healthcareIIAS'=>(XmlFields::healthcareIIAS(XmlFields::returnArrayValue($hash_in,'healthcareIIAS'))),
64
+ 'filtering'=>(XmlFields::filteringType(XmlFields::returnArrayValue($hash_in,'filtering'))),
65
+ 'merchantData'=>(XmlFields::merchantData(XmlFields::returnArrayValue($hash_in,'merchantData'))),
66
+ 'recyclingRequest'=>(XmlFields::recyclingRequestType(XmlFields::returnArrayValue($hash_in,'recyclingRequest'))),
67
+ 'fraudFilterOverride'=> XmlFields::returnArrayValue($hash_in,'fraudFilterOverride'),
68
+ 'recurringRequest'=>XmlFields::recurringRequestType(XmlFields::returnArrayValue($hash_in,'recurringRequest')),
69
+ 'debtRepayment'=>XmlFields::returnArrayValue($hash_in,'debtRepayment'),
70
+ 'advancedFraudChecks'=>XmlFields::advancedFraudChecksType(XmlFields::returnArrayValue($hash_in,'advancedFraudChecks')),
71
+ );
72
  }
73
 
74
+ $choice_hash = array(XmlFields::returnArrayValue($hash_out,'card'),XmlFields::returnArrayValue($hash_out,'paypal'),XmlFields::returnArrayValue($hash_out,'token'),XmlFields::returnArrayValue($hash_out,'paypage'));
75
  $authorizationResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'authorization',$choice_hash);
76
  return $authorizationResponse;
77
  }
79
  public function saleRequest($hash_in)
80
  {
81
  $hash_out = array(
82
+ 'litleTxnId' => XmlFields::returnArrayValue($hash_in,'litleTxnId'),
83
+ 'orderId' =>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
84
+ 'amount' =>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'amount')),
85
+ 'surchargeAmount' =>XmlFields::returnArrayValue($hash_in,'surchargeAmount'),
86
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
87
+ 'customerInfo'=>XmlFields::customerInfo(XmlFields::returnArrayValue($hash_in,'customerInfo')),
88
+ 'billToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress')),
89
+ 'shipToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'shipToAddress')),
90
+ 'card'=> XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card')),
91
+ 'paypal'=>XmlFields::payPal(XmlFields::returnArrayValue($hash_in,'paypal')),
92
+ 'token'=>XmlFields::cardTokenType(XmlFields::returnArrayValue($hash_in,'token')),
93
+ 'paypage'=>XmlFields::cardPaypageType(XmlFields::returnArrayValue($hash_in,'paypage')),
94
+ 'billMeLaterRequest'=>XmlFields::billMeLaterRequest(XmlFields::returnArrayValue($hash_in,'billMeLaterRequest')),
95
+ 'fraudCheck'=>XmlFields::fraudCheckType(XmlFields::returnArrayValue($hash_in,'fraudCheck')),
96
+ 'cardholderAuthentication'=>XmlFields::fraudCheckType(XmlFields::returnArrayValue($hash_in,'cardholderAuthentication')),
97
+ 'customBilling'=>XmlFields::customBilling(XmlFields::returnArrayValue($hash_in,'customBilling')),
98
+ 'taxBilling'=>XmlFields::taxBilling(XmlFields::returnArrayValue($hash_in,'taxBilling')),
99
+ 'enhancedData'=>XmlFields::enhancedData(XmlFields::returnArrayValue($hash_in,'enhancedData')),
100
+ 'processingInstructions'=>XmlFields::processingInstructions(XmlFields::returnArrayValue($hash_in,'processingInstructions')),
101
+ 'pos'=>XmlFields::pos(XmlFields::returnArrayValue($hash_in,'pos')),
102
+ 'payPalOrderComplete'=> XmlFields::returnArrayValue($hash_in,'paypalOrderComplete'),
103
+ 'payPalNotes'=> XmlFields::returnArrayValue($hash_in,'paypalNotesType'),
104
+ 'amexAggregatorData'=>XmlFields::amexAggregatorData(XmlFields::returnArrayValue($hash_in,'amexAggregatorData')),
105
+ 'allowPartialAuth'=>XmlFields::returnArrayValue($hash_in,'allowPartialAuth'),
106
+ 'healthcareIIAS'=>XmlFields::healthcareIIAS(XmlFields::returnArrayValue($hash_in,'healthcareIIAS')),
107
+ 'filtering'=>XmlFields::filteringType(XmlFields::returnArrayValue($hash_in,'filtering')),
108
+ 'merchantData'=>XmlFields::merchantData(XmlFields::returnArrayValue($hash_in,'merchantData')),
109
+ 'recyclingRequest'=>XmlFields::recyclingRequestType(XmlFields::returnArrayValue($hash_in,'recyclingRequest')),
110
+ 'fraudFilterOverride'=> XmlFields::returnArrayValue($hash_in,'fraudFilterOverride'),
111
+ 'recurringRequest'=>XmlFields::recurringRequestType(XmlFields::returnArrayValue($hash_in,'recurringRequest')),
112
+ 'litleInternalRecurringRequest'=>XmlFields::litleInternalRecurringRequestType(XmlFields::returnArrayValue($hash_in,'litleInternalRecurringRequest')),
113
+ 'debtRepayment'=>XmlFields::returnArrayValue($hash_in,'debtRepayment'),
114
+ 'advancedFraudChecks'=>XmlFields::advancedFraudChecksType(XmlFields::returnArrayValue($hash_in,'advancedFraudChecks')),
115
+ );
116
 
117
  $choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
118
  $choice2_hash= array($hash_out['fraudCheck'],$hash_out['cardholderAuthentication']);
119
+ $saleResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'sale',$choice_hash,$choice2_hash);
120
  return $saleResponse;
121
  }
122
 
123
  public function authReversalRequest($hash_in)
124
  {
125
  $hash_out = array(
126
+ 'litleTxnId' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleTxnId')),
127
+ 'amount' =>XmlFields::returnArrayValue($hash_in,'amount'),
128
+ 'surchargeAmount' =>XmlFields::returnArrayValue($hash_in,'surchargeAmount'),
129
+ 'payPalNotes'=>XmlFields::returnArrayValue($hash_in,'payPalNotes'),
130
+ 'actionReason'=>XmlFields::returnArrayValue($hash_in,'actionReason'));
131
  $authReversalResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'authReversal');
132
  return $authReversalResponse;
133
  }
138
  'litleTxnId' => XmlFields::returnArrayValue($hash_in, 'litleTxnId'),
139
  'orderId' =>XmlFields::returnArrayValue($hash_in, 'orderId'),
140
  'amount' =>XmlFields::returnArrayValue($hash_in, 'amount'),
141
+ 'surchargeAmount' =>XmlFields::returnArrayValue($hash_in,'surchargeAmount'),
142
  'orderSource'=>XmlFields::returnArrayValue($hash_in, 'orderSource'),
143
  'billToAddress'=>XmlFields::contact(XMLFields::returnArrayValue($hash_in, 'billToAddress')),
144
  'card'=>XmlFields::cardType(XMLFields::returnArrayValue($hash_in, 'card')),
164
  public function registerTokenRequest($hash_in)
165
  {
166
  $hash_out = array(
167
+ 'orderId'=>XmlFields::returnArrayValue($hash_in,'orderId'),
168
+ 'accountNumber'=>XmlFields::returnArrayValue($hash_in,'accountNumber'),
169
+ 'echeckForToken'=>XmlFields::echeckForTokenType(XmlFields::returnArrayValue($hash_in,'echeckForToken')),
170
+ 'paypageRegistrationId'=>XmlFields::returnArrayValue($hash_in,'paypageRegistrationId'),
171
+ 'cardValidationNum'=>XmlFields::returnArrayValue($hash_in,'cardValidationNum'),
172
+ );
173
 
174
  $choice_hash = array($hash_out['accountNumber'],$hash_out['echeckForToken'],$hash_out['paypageRegistrationId']);
175
  $registerTokenResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'registerTokenRequest',$choice_hash);
179
  public function forceCaptureRequest($hash_in)
180
  {
181
  $hash_out = array(
182
+ 'orderId' =>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
183
+ 'amount' =>XmlFields::returnArrayValue($hash_in,'amount'),
184
+ 'surchargeAmount' =>XmlFields::returnArrayValue($hash_in,'surchargeAmount'),
185
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
186
+ 'billToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress')),
187
+ 'card'=> XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card')),
188
+ 'token'=>XmlFields::cardTokenType(XmlFields::returnArrayValue($hash_in,'token')),
189
+ 'paypage'=>XmlFields::cardPaypageType(XmlFields::returnArrayValue($hash_in,'paypage')),
190
+ 'customBilling'=>XmlFields::customBilling(XmlFields::returnArrayValue($hash_in,'customBilling')),
191
+ 'taxBilling'=>XmlFields::taxBilling(XmlFields::returnArrayValue($hash_in,'taxBilling')),
192
+ 'enhancedData'=>XmlFields::enhancedData(XmlFields::returnArrayValue($hash_in,'enhancedData')),
193
+ 'processingInstructions'=>XmlFields::processingInstructions(XmlFields::returnArrayValue($hash_in,'processingInstructions')),
194
+ 'pos'=>XmlFields::pos(XmlFields::returnArrayValue($hash_in,'pos')),
195
+ 'amexAggregatorData'=>XmlFields::amexAggregatorData(XmlFields::returnArrayValue($hash_in,'amexAggregatorData')),
196
+ 'merchantData'=>(XmlFields::merchantData(XmlFields::returnArrayValue($hash_in,'merchantData'))),
197
+ 'debtRepayment'=>XmlFields::returnArrayValue($hash_in,'debtRepayment'),
198
+ );
199
 
200
+ $choice_hash = array(XmlFields::returnArrayValue($hash_out,'card'),XmlFields::returnArrayValue($hash_out,'paypal'),XmlFields::returnArrayValue($hash_out,'token'),XmlFields::returnArrayValue($hash_out,'paypage'));
201
  $forceCaptureResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'forceCapture',$choice_hash);
202
  return $forceCaptureResponse;
203
  }
205
  public function captureRequest($hash_in)
206
  {
207
  $hash_out = array(
208
+ 'partial'=>XmlFields::returnArrayValue($hash_in,'partial'),
209
+ 'litleTxnId' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleTxnId')),
210
+ 'amount' =>(XmlFields::returnArrayValue($hash_in,'amount')),
211
+ 'surchargeAmount' =>XmlFields::returnArrayValue($hash_in,'surchargeAmount'),
212
+ 'enhancedData'=>XmlFields::enhancedData(XmlFields::returnArrayValue($hash_in,'enhancedData')),
213
+ 'processingInstructions'=>XmlFields::processingInstructions(XmlFields::returnArrayValue($hash_in,'processingInstructions')),
214
+ 'payPalOrderComplete'=>XmlFields::returnArrayValue($hash_in,'payPalOrderComplete'),
215
+ 'payPalNotes' =>XmlFields::returnArrayValue($hash_in,'payPalNotes'));
216
  $captureResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'capture');
217
  return $captureResponse;
218
  }
220
  public function captureGivenAuthRequest($hash_in)
221
  {
222
  $hash_out = array(
223
+ 'orderId'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
224
+ 'authInformation'=>XmlFields::authInformation(XmlFields::returnArrayValue($hash_in,'authInformation')),
225
+ 'amount' =>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'amount')),
226
+ 'surchargeAmount' =>XmlFields::returnArrayValue($hash_in,'surchargeAmount'),
227
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
228
+ 'billToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress')),
229
+ 'shipToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'shipToAddress')),
230
+ 'card'=> XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card')),
231
+ 'token'=>XmlFields::cardTokenType(XmlFields::returnArrayValue($hash_in,'token')),
232
+ 'paypage'=>XmlFields::cardPaypageType(XmlFields::returnArrayValue($hash_in,'paypage')),
233
+ 'customBilling'=>XmlFields::customBilling(XmlFields::returnArrayValue($hash_in,'customBilling')),
234
+ 'taxBilling'=>XmlFields::taxBilling(XmlFields::returnArrayValue($hash_in,'taxBilling')),
235
+ 'billMeLaterRequest'=>XmlFields::billMeLaterRequest(XmlFields::returnArrayValue($hash_in,'billMeLaterRequest')),
236
+ 'enhancedData'=>XmlFields::enhancedData(XmlFields::returnArrayValue($hash_in,'enhancedData')),
237
+ 'processingInstructions'=>XmlFields::processingInstructions(XmlFields::returnArrayValue($hash_in,'processingInstructions')),
238
+ 'pos'=>XmlFields::pos(XmlFields::returnArrayValue($hash_in,'pos')),
239
+ 'amexAggregatorData'=>XmlFields::amexAggregatorData(XmlFields::returnArrayValue($hash_in,'amexAggregatorData')),
240
+ 'merchantData'=>(XmlFields::merchantData(XmlFields::returnArrayValue($hash_in,'merchantData'))),
241
+ 'debtRepayment'=>XmlFields::returnArrayValue($hash_in,'debtRepayment')
242
+ );
243
 
244
  $choice_hash = array($hash_out['card'],$hash_out['token'],$hash_out['paypage']);
245
  $captureGivenAuthResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'captureGivenAuth',$choice_hash);
249
  public function echeckRedepositRequest($hash_in)
250
  {
251
  $hash_out = array(
252
+ 'litleTxnId' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleTxnId')),
253
+ 'echeck'=>XmlFields::echeckType(XmlFields::returnArrayValue($hash_in,'echeck')),
254
+ 'echeckToken'=>XmlFields::echeckTokenType(XmlFields::returnArrayValue($hash_in,'echeckToken')),
255
+ 'merchantData'=>(XmlFields::merchantData(XmlFields::returnArrayValue($hash_in,'merchantData')))
256
+ );
257
 
258
  $choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
259
  $echeckRedepositResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'echeckRedeposit',$choice_hash);
263
  public function echeckSaleRequest($hash_in)
264
  {
265
  $hash_out = array(
266
+ 'litleTxnId'=>XmlFields::returnArrayValue($hash_in,'litleTxnId'),
267
+ 'orderId'=>XmlFields::returnArrayValue($hash_in,'orderId'),
268
+ 'verify'=>XmlFields::returnArrayValue($hash_in,'verify'),
269
+ 'amount'=>XmlFields::returnArrayValue($hash_in,'amount'),
270
+ 'orderSource'=>XmlFields::returnArrayValue($hash_in,'orderSource'),
271
+ 'billToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress')),
272
+ 'shipToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'shipToAddress')),
273
+ 'echeck'=>XmlFields::echeckType(XmlFields::returnArrayValue($hash_in,'echeck')),
274
+ 'echeckToken'=>XmlFields::echeckTokenType(XmlFields::returnArrayValue($hash_in,'echeckToken')),
275
+ 'customBilling'=>XmlFields::customBilling(XmlFields::returnArrayValue($hash_in,'customBilling')));
276
 
277
  $choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
278
 
279
  $echeckSaleResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'echeckSale',$choice_hash);
280
  return $echeckSaleResponse;
281
  }
282
+
283
+ //public function echeckSaleRequestObject(EcheckSale $echeckSale) {
284
+ //TODO Can I overload? What are php's rules?
285
+ //}
286
 
287
  public function echeckCreditRequest($hash_in)
288
  {
289
  $hash_out = array(
290
+ 'litleTxnId'=>XmlFields::returnArrayValue($hash_in,'litleTxnId'),
291
+ 'orderId'=>XmlFields::returnArrayValue($hash_in,'orderId'),
292
+ 'amount'=>XmlFields::returnArrayValue($hash_in,'amount'),
293
+ 'orderSource'=>XmlFields::returnArrayValue($hash_in,'orderSource'),
294
+ 'billToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress')),
295
+ 'echeck'=>XmlFields::echeckType(XmlFields::returnArrayValue($hash_in,'echeck')),
296
+ 'echeckToken'=>XmlFields::echeckTokenType(XmlFields::returnArrayValue($hash_in,'echeckToken')),
297
+ 'customBilling'=>XmlFields::customBilling(XmlFields::returnArrayValue($hash_in,'customBilling')));
298
 
299
  $choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
300
  $echeckCreditResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'echeckCredit',$choice_hash);
305
  {
306
 
307
  $hash_out = array(
308
+ 'litleTxnId'=>XmlFields::returnArrayValue($hash_in,'litleTxnId'),
309
+ 'orderId'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
310
+ 'amount'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'amount')),
311
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
312
+ 'billToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress')),
313
+ 'echeck'=>XmlFields::echeckType(XmlFields::returnArrayValue($hash_in,'echeck')),
314
+ 'echeckToken'=>XmlFields::echeckTokenType(XmlFields::returnArrayValue($hash_in,'echeckToken')),
315
+ 'merchantData'=>(XmlFields::merchantData(XmlFields::returnArrayValue($hash_in,'merchantData'))),
316
+ );
317
 
318
  $choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
319
  $choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
324
  public function voidRequest($hash_in)
325
  {
326
  $hash_out = array(
327
+ 'litleTxnId' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleTxnId')),
328
+ 'processingInstructions'=>XmlFields::processingInstructions(XmlFields::returnArrayValue($hash_in,'processingInstructions')));
329
 
330
  $voidResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'void');
331
  return $voidResponse;
334
  public function echeckVoidRequest($hash_in)
335
  {
336
  $hash_out = array(
337
+ 'litleTxnId' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleTxnId')),
338
  );
339
  $echeckVoidResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,"echeckVoid");
340
  return $echeckVoidResponse;
341
  }
342
 
343
+ public function depositReversalRequest($hash_in)
344
+ {
345
+ $hash_out = array(
346
+ 'litleTxnId' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleTxnId')),
347
+ );
348
+ $response = LitleOnlineRequest::processRequest($hash_out,$hash_in,"depositReversal");
349
+ return $response;
350
+ }
351
+ public function refundReversalRequest($hash_in)
352
+ {
353
+ $hash_out = array(
354
+ 'litleTxnId' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleTxnId')),
355
+ );
356
+ $response = LitleOnlineRequest::processRequest($hash_out,$hash_in,"refundReversal");
357
+ return $response;
358
+ }
359
+ public function activateReversalRequest($hash_in)
360
+ {
361
+ $hash_out = array(
362
+ 'litleTxnId' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleTxnId')),
363
+ );
364
+ $response = LitleOnlineRequest::processRequest($hash_out,$hash_in,"activateReversal");
365
+ return $response;
366
+ }
367
+ public function deactivateReversalRequest($hash_in)
368
+ {
369
+ $hash_out = array(
370
+ 'litleTxnId' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleTxnId')),
371
+ );
372
+ $response = LitleOnlineRequest::processRequest($hash_out,$hash_in,"deactivateReversal");
373
+ return $response;
374
+ }
375
+ public function loadReversalRequest($hash_in)
376
+ {
377
+ $hash_out = array(
378
+ 'litleTxnId' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleTxnId')),
379
+ );
380
+ $response = LitleOnlineRequest::processRequest($hash_out,$hash_in,"loadReversal");
381
+ return $response;
382
+ }
383
+ public function unloadReversalRequest($hash_in)
384
+ {
385
+ $hash_out = array(
386
+ 'litleTxnId' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleTxnId')),
387
+ );
388
+ $response = LitleOnlineRequest::processRequest($hash_out,$hash_in,"unloadReversal");
389
+ return $response;
390
+ }
391
+
392
+ public function updateCardValidationNumOnToken($hash_in)
393
+ {
394
+ $hash_out = array(
395
+ 'orderId'=>XmlFields::returnArrayValue($hash_in,'orderId'),
396
+ 'litleToken' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleToken')),
397
+ 'cardValidationNum' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'cardValidationNum')),
398
+ );
399
+ $updateCardValidationNumOnTokenResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,"updateCardValidationNumOnToken");
400
+ return $updateCardValidationNumOnTokenResponse;
401
+ }
402
+
403
+ public function updateSubscription($hash_in)
404
+ {
405
+ $hash_out = Transactions::createUpdateSubscriptionHash($hash_in);
406
+ $choice_hash = array(XmlFields::returnArrayValue($hash_out,'card'),XmlFields::returnArrayValue($hash_out,'token'),XmlFields::returnArrayValue($hash_out,'paypage'));
407
+ $updateSubscriptionResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,"updateSubscription");
408
+ return $updateSubscriptionResponse;
409
+ }
410
+
411
+ public function cancelSubscription($hash_in)
412
+ {
413
+ $hash_out = Transactions::createCancelSubscriptionHash($hash_in);
414
+ $cancelSubscriptionResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,"cancelSubscription");
415
+ return $cancelSubscriptionResponse;
416
+ }
417
+
418
+ public function updatePlan($hash_in)
419
+ {
420
+ $hash_out = Transactions::createUpdatePlanHash($hash_in);
421
+ $updatePlanResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,"updatePlan");
422
+ return $updatePlanResponse;
423
+ }
424
+
425
+ public function createPlan($hash_in)
426
+ {
427
+ $hash_out = Transactions::createCreatePlanHash($hash_in);
428
+ $createPlanResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,"createPlan");
429
+ return $createPlanResponse;
430
+ }
431
+
432
+ public function activate($hash_in)
433
+ {
434
+ $hash_out = Transactions::createActivateHash($hash_in);
435
+ $txnResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,"activate");
436
+ return $txnResponse;
437
+ }
438
+ public function deactivate($hash_in)
439
+ {
440
+ $hash_out = Transactions::createDeactivateHash($hash_in);
441
+ $txnResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,"deactivate");
442
+ return $txnResponse;
443
+ }
444
+ public function load($hash_in)
445
+ {
446
+ $hash_out = Transactions::createLoadHash($hash_in);
447
+ $txnResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,"load");
448
+ return $txnResponse;
449
+ }
450
+ public function unload($hash_in)
451
+ {
452
+ $hash_out = Transactions::createUnloadHash($hash_in);
453
+ $txnResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,"unload");
454
+ return $txnResponse;
455
+ }
456
+ public function balanceInquiry($hash_in)
457
+ {
458
+ $hash_out = Transactions::createBalanceInquiryHash($hash_in);
459
+ $txnResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,"balanceInquiry");
460
+ return $txnResponse;
461
+ }
462
+
463
  private function overideConfig($hash_in)
464
  {
465
  $hash_out = array(
466
+ 'user'=>XmlFields::returnArrayValue($hash_in,'user'),
467
+ 'password'=>XmlFields::returnArrayValue($hash_in,'password'),
468
+ 'merchantId'=>XmlFields::returnArrayValue($hash_in,'merchantId'),
469
+ 'reportGroup'=>XmlFields::returnArrayValue($hash_in,'reportGroup'),
470
+ 'version'=>XmlFields::returnArrayValue($hash_in,'version'),
471
+ 'url'=>XmlFields::returnArrayValue($hash_in,'url'),
472
+ 'timeout'=>XmlFields::returnArrayValue($hash_in,'timeout'),
473
+ 'proxy'=>XmlFields::returnArrayValue($hash_in,'proxy'),
474
+ 'litle_requests_path'=>XmlFields::returnArrayValue($hash_in,'litle_requests_path'),
475
+ 'batch_requests_path'=>XmlFields::returnArrayValue($hash_in,'batch_requests_path'),
476
+ 'sftp_username'=>XmlFields::returnArrayValue($hash_in,'sftp_username'),
477
+ 'sftp_password'=>XmlFields::returnArrayValue($hash_in,'sftp_password'),
478
+ 'batch_url'=>XmlFields::returnArrayValue($hash_in,'batch_url'),
479
+ 'tcp_port'=>XmlFields::returnArrayValue($hash_in,'tcp_port'),
480
+ 'tcp_ssl'=>XmlFields::returnArrayValue($hash_in,'tcp_ssl'),
481
+ 'tcp_timeout'=>XmlFields::returnArrayValue($hash_in,'tcp_timeout'),
482
+ 'print_xml'=>XmlFields::returnArrayValue($hash_in,'print_xml'));
483
  return $hash_out;
484
  }
485
 
486
  private function getOptionalAttributes($hash_in,$hash_out)
487
  {
488
  if(isset($hash_in['merchantSdk'])) {
489
+ $hash_out['merchantSdk'] = XmlFields::returnArrayValue($hash_in,'merchantSdk');
490
  }
491
  else {
492
+ $hash_out['merchantSdk'] = CURRENT_SDK_VERSION;
493
  }
494
  if(isset($hash_in['id'])) {
495
+ $hash_out['id'] = XmlFields::returnArrayValue($hash_in,'id');
496
  }
497
  if(isset($hash_in['customerId'])) {
498
+ $hash_out['customerId'] = XmlFields::returnArrayValue($hash_in,'customerId');
499
+ }
500
+ if(isset($hash_in['loggedInUser'])) {
501
+ $hash_out['loggedInUser'] = XmlFields::returnArrayValue($hash_in,'loggedInUser');
502
  }
503
  return $hash_out;
504
  }
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);
514
  Checker::choice($choice2);
515
  $request = Obj2xml::toXml($hash,$hash_config, $type);
516
+ $litleOnlineResponse = $this->newXML->request($request,$hash_config,$this->useSimpleXml);
 
517
  return $litleOnlineResponse;
518
  }
519
 
app/code/local/Litle/LitleSDK/LitleRequest.php ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ #include('Net/SFTP.php');
5
+
6
+ class LitleRequest{
7
+
8
+ # file name that holds the batch requests once added
9
+ public $batches_file;
10
+
11
+ public $request_file;
12
+
13
+ public $response_file;
14
+
15
+ private $config;
16
+
17
+
18
+ public $num_batch_requests = 0;
19
+ # note that a single litle request cannot hold more than 500,000 transactions
20
+ public $total_transactions = 0;
21
+
22
+ public $closed = false;
23
+ /*
24
+ * Creates the intermediate request file and preps it to have batches added
25
+ */
26
+ public function __construct($overrides=array()){
27
+ $config = Obj2xml::getConfig($overrides);
28
+
29
+ $this->config= $config;
30
+ $request_dir = $config['litle_requests_path'];
31
+
32
+ if(substr($request_dir, -1, 1) != DIRECTORY_SEPARATOR){
33
+ $request_dir = $request_dir . DIRECTORY_SEPARATOR;
34
+ }
35
+
36
+ $ts = str_replace(" ", "", substr(microtime(), 2));
37
+ $batches_filename = $request_dir . "request_" . $ts . "_batches";
38
+ $request_filename = $request_dir . "request_" . $ts;
39
+ $response_filename = $request_dir . "response_" . $ts;
40
+ // if either file already exists, let's try again!
41
+ if(file_exists($batches_filename) || file_exists($request_filename) || file_exists($response_filename)){
42
+ $this->__construct();
43
+ }
44
+
45
+ // if we were unable to write the file
46
+ if(file_put_contents($batches_filename, "") === FALSE){
47
+ throw new RuntimeException("A request file could not be written at $batches_filename. Please check your privilege.");
48
+ }
49
+ $this->batches_file = $batches_filename;
50
+
51
+ // if we were unable to write the file
52
+ if(file_put_contents($request_filename, "") === FALSE){
53
+ throw new RuntimeException("A request file could not be written at $request_filename. Please check your privilege.");
54
+ }
55
+ $this->request_file = $request_filename;
56
+
57
+ if(file_put_contents($response_filename, "") === FALSE){
58
+ throw new RuntimeException("A response file could not be written at $response_filename. Please check your privilege.");
59
+ }
60
+ $this->response_file = $response_filename;
61
+ }
62
+
63
+ public function wouldFill($addl_txns_count){
64
+ return ($this->total_transactions + $addl_txns_count) > MAX_TXNS_PER_REQUEST;
65
+ }
66
+
67
+ /*
68
+ * Adds a closed batch request to the Litle Request. This entails copying the completed batch file into the intermediary
69
+ * request file
70
+ */
71
+ public function addBatchRequest($batch_request){
72
+ if($this->wouldFill($batch_request->total_txns)){
73
+ throw new RuntimeException("Couldn't add the batch to the Litle Request. The total number of transactions would exceed the maximum allowed for a request.");
74
+ }
75
+
76
+ if($this->closed){
77
+ throw new RuntimeException("Could not add the batchRequest. This litleRequest is closed.");
78
+ }
79
+
80
+ if(!$batch_request->closed){
81
+ $batch_request->closeRequest();
82
+ }
83
+ $handle = @fopen($batch_request->batch_file,"r");
84
+ if($handle){
85
+ while(($buffer = fgets($handle, 4096)) !== false){
86
+ file_put_contents($this->batches_file, $buffer, FILE_APPEND);
87
+ }
88
+ if(!feof($handle)){
89
+ throw new RuntimeException("Error when reading batch file at $batch_request->batch_file. Please check your privilege.");
90
+ }
91
+ fclose($handle);
92
+
93
+ unlink($batch_request->batch_file);
94
+ unset($batch_request->batch_file);
95
+ $this->num_batch_requests += 1;
96
+ $this->total_transactions += $batch_request->total_txns;
97
+ }
98
+ else{
99
+ throw new RuntimeException("Could not open batch file at $batch_request->batch_file. Please check your privilege.");
100
+ }
101
+ }
102
+
103
+ public function createRFRRequest($hash_in){
104
+ if($this->num_batch_requests > 0){
105
+ throw new RuntimeException("Could not add the RFR Request. A single Litle Request cannot have both an RFR request and batch requests together.");
106
+ }
107
+
108
+ if($this->closed){
109
+ throw new RuntimeException("Could not add the RFR Request. This litleRequest is closed.");
110
+ }
111
+ $RFRXml = Obj2xml::rfrRequestToXml($hash_in);
112
+ file_put_contents($this->request_file, Obj2xml::generateRequestHeader($this->config, $this->num_batch_requests), FILE_APPEND);
113
+ file_put_contents($this->request_file, $RFRXml, FILE_APPEND);
114
+ file_put_contents($this->request_file, "</litleRequest>", FILE_APPEND);
115
+ unlink($this->batches_file);
116
+ unset($this->batches_file);
117
+ $this->closed = true;
118
+ }
119
+ /*
120
+ * Fleshes out the XML needed for the Litle Request. Returns the file name of the completed request file
121
+ */
122
+ public function closeRequest(){
123
+ $handle = @fopen($this->batches_file,"r");
124
+ if($handle){
125
+ file_put_contents($this->request_file, Obj2xml::generateRequestHeader($this->config, $this->num_batch_requests), FILE_APPEND);
126
+ while(($buffer = fgets($handle, 4096)) !== false){
127
+ file_put_contents($this->request_file, $buffer, FILE_APPEND);
128
+ }
129
+ if(!feof($handle)){
130
+ throw new RuntimeException("Error when reading batches file at $this->batches_file. Please check your privilege.");
131
+ }
132
+ fclose($handle);
133
+ file_put_contents($this->request_file, "</litleRequest>", FILE_APPEND);
134
+
135
+ unlink($this->batches_file);
136
+ unset($this->batches_file);
137
+ $this->closed = true;
138
+ }
139
+ else{
140
+ throw new RuntimeException("Could not open batches file at $this->batches_file. Please check your privilege.");
141
+ }
142
+ }
143
+
144
+ /*
145
+ * Alias for the preferred method of sFTP delivery
146
+ */
147
+ public function sendToLitle(){
148
+ $this->sendToLitleSFTP();
149
+ return $this->response_file;
150
+ }
151
+
152
+ /*
153
+ * Deliver the Litle Request over sFTP using the credentials given by the config. Returns the name of the file retrieved from the server
154
+ */
155
+ public function sendToLitleSFTP(){
156
+ if(!$this->closed){
157
+ $this->closeRequest();
158
+ }
159
+
160
+ $session = $this->createSFTPSession();
161
+ # with extension .prg
162
+ $session->put('/inbound/' . basename($this->request_file) . '.prg', $this->request_file, NET_SFTP_LOCAL_FILE);
163
+ # rename when the file upload is complete
164
+ $session->rename('/inbound/' . basename($this->request_file) . '.prg', '/inbound/' . basename($this->request_file) . '.asc');
165
+
166
+ $this->retrieveFromLitleSFTP($session);
167
+ }
168
+
169
+ /*
170
+ * Given a timeout (defaults to 7200 seconds - two hours), periodically poll the SFTP directory, looking for the response file for this request.
171
+ */
172
+ public function retrieveFromLitleSFTP($session, $sftp_timeout=7200){
173
+ $time_spent = 0;
174
+ $this->resetSFTPSession($session);
175
+ while($time_spent < $sftp_timeout){
176
+ # we'll get booted off periodically; make this a non-issue by periodically reconnecting
177
+ if($time_spent % 180 == 0){
178
+ $this->resetSFTPSession($session);
179
+ }
180
+
181
+ $files = $session->nlist('/outbound');
182
+
183
+ if(in_array(basename($this->request_file) . '.asc', $files)){
184
+ $this->downloadFromLitleSFTP($session,$time_spent, $sftp_timeout);
185
+ return;
186
+ }
187
+
188
+ $time_spent += 20;
189
+ sleep(20);
190
+ }
191
+
192
+ throw new Exception("Response file can not be retrieved because of timeout (Duration : 2 hours)");
193
+
194
+ }
195
+
196
+ /*
197
+ * Creates SFTP Session with given login credentials
198
+ */
199
+ public function createSFTPSession(){
200
+ $sftp_url = $this->config['batch_url'];
201
+ $sftp_username = $this->config['sftp_username'];
202
+ $sftp_password = $this->config['sftp_password'];
203
+ $session = new Net_SFTP($sftp_url);
204
+ if(!$session->login($sftp_username, $sftp_password)){
205
+ throw new RuntimeException("Failed to SFTP with the username $sftp_username and the password $sftp_password to the host $sftp_url. Check your credentials!");
206
+ }
207
+
208
+ return $session;
209
+ }
210
+
211
+ /*
212
+ * Resets SFTP Session if Session is unseeted or timed out
213
+ */
214
+ public function resetSFTPSession($session){
215
+ if(!isset($session)){
216
+ $session = $this->createSFTPSession();
217
+ }
218
+ }
219
+
220
+ /*
221
+ * Downloads the response file from the SFTP server to local system iteratively
222
+ */
223
+ public function downloadFromLitleSFTP($session, $time_spent, $sftp_timeout){
224
+ $sftp_remote_file = '/outbound/' . basename($this->request_file) . '.asc';
225
+ $this->resetSFTPSession($session);
226
+ while($time_spent < $sftp_timeout){
227
+ try{
228
+ if($time_spent % 180 == 0){
229
+ $this->resetSFTPSession($session);
230
+ }
231
+ $session->get($sftp_remote_file, $this->response_file);
232
+ $session->delete($sftp_remote_file);
233
+ $this->response_file = str_replace("request", "response", $this->response_file);
234
+ unset ($session);
235
+ return;
236
+ }
237
+ catch(Exception $exception){
238
+ $message = $exception->getMessage();
239
+ if(stristr($message, "errno=32 broken pipe")){
240
+ $time_spent += 20;
241
+ sleep(20);
242
+ }
243
+ else{
244
+ throw new Exception($message);
245
+ }
246
+ }
247
+ }
248
+ }
249
+
250
+ /*
251
+ * Deliver the Litle Request over a TCP stream. Returns the name of the file retrieved from the server
252
+ */
253
+ public function sendToLitleStream(){
254
+ if(!$this->closed){
255
+ $this->closeRequest();
256
+ }
257
+
258
+ $tcp_url = $this->config['batch_url'];
259
+ $tcp_port = $this->config['tcp_port'];
260
+ $tcp_ssl = (int)$this->config['tcp_ssl'];
261
+ $tcp_timeout = $this->config['tcp_timeout'];;
262
+
263
+ if($tcp_ssl){
264
+ $tcp_url = 'ssl://' . $tcp_url;
265
+ }
266
+
267
+ $sock = fsockopen($tcp_url, $tcp_port, $err_no, $err_str, $tcp_timeout);
268
+
269
+ if(!$sock){
270
+ throw new RuntimeException("Error when opening socket at $tcp_url : $tcp_port. Error number: $err_no Error message: $err_str");
271
+ }
272
+ else{
273
+ $handle = @fopen($this->request_file,"r");
274
+ if($handle){
275
+ while(($buffer = fgets($handle, 4096)) !== false){
276
+ fwrite($sock, $buffer);
277
+ }
278
+ if(!feof($handle)){
279
+ throw new RuntimeException("Error when reading request file at $this->request_file. Please check your privilege.");
280
+ }
281
+ fclose($handle);
282
+ }
283
+ else{
284
+ throw new RuntimeException("Could not open request file at $this->request_file. Please check your privilege.");
285
+ }
286
+ # read from the response socket while there's data
287
+ while (!feof($sock)) {
288
+ file_put_contents($this->response_file, fgets($sock, 128), FILE_APPEND);
289
+ }
290
+ fclose($sock);
291
+ return $this->response_file;
292
+ }
293
+ }
294
+ }
295
+
296
+
297
+
298
+
299
+
app/code/local/Litle/LitleSDK/LitleResponseProcessor.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LitleResponseProcessor {
3
+
4
+ private $xml_reader;
5
+
6
+ /*
7
+ * $response_file is a string corresponding to the path of the response file to be processed.
8
+ */
9
+ public function __construct($response_file){
10
+ $this->xml_reader = new XMLReader();
11
+ $this->xml_reader->open("file://" . $response_file);
12
+ $this->xml_reader->setParserProperty(XMLReader::SUBST_ENTITIES, true);
13
+ # read onto the root node
14
+ $this->xml_reader->read();
15
+ # if the response from litle is non-zero
16
+ if($this->xml_reader->getAttribute("response") == "1"){
17
+ $msg = $this->xml_reader->getAttribute('message');
18
+ throw new RuntimeException("Response file $response_file indicates error: $msg");
19
+ }
20
+ }
21
+
22
+ /*
23
+ * If called with either false or no argument, return a SimpleXMLElement corresponding to the next transaction response in the response file.
24
+ * If called with true, return the raw XML for the next transaction response in the response file.
25
+ *
26
+ * In either case, if another transaction cannot be read from the file, return FALSE.
27
+ */
28
+ public function nextTransaction($raw = FALSE){
29
+ $tracked_elements_names = array(
30
+ "accountUpdateResponse",
31
+ "authorizationResponse",
32
+ "authReversalResponse",
33
+ "captureResponse",
34
+ "captureGivenAuthResponse",
35
+ "creditResponse",
36
+ "echeckCreditResponse",
37
+ "echeckRedepositResponse",
38
+ "echeckSalesResponse",
39
+ "echeckVerificationResponse",
40
+ "forceCaptureResponse",
41
+ "registerTokenResponse",
42
+ "saleResponse",
43
+ "updateCardValidationNumOnTokenResponse",
44
+ "updateSubscriptionResponse",
45
+ "cancelSubscriptionResponse",
46
+ "createPlanResponse",
47
+ "updatePlanResponse",
48
+ "activateResponse",
49
+ "deactivateResponse",
50
+ "loadResponse",
51
+ "unloadResponse",
52
+ "balanceInquiryResponse"
53
+ );
54
+
55
+ if(in_array($this->xml_reader->localName, $tracked_elements_names) && $this->xml_reader->nodeType != XMLReader::END_ELEMENT){
56
+ $txn_response = $this->xml_reader->readOuterXml();
57
+ if(!$raw){
58
+ $txn_response = simplexml_load_string($txn_response);
59
+ }
60
+ $this->xml_reader->read();
61
+ return $txn_response;
62
+ }
63
+ else{
64
+ if($this->xml_reader->read()){
65
+ return $this->nextTransaction($raw);
66
+ }
67
+ return false;
68
+ }
69
+ }
70
+ }
71
+
72
+
73
+
app/code/local/Litle/LitleSDK/LitleXmlMapper.php CHANGED
@@ -22,7 +22,7 @@
22
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
  * OTHER DEALINGS IN THE SOFTWARE.
24
  */
25
- require_once realpath(dirname(__FILE__)) . '/LitleOnline.php';
26
 
27
  class LitleXmlMapper
28
  {
@@ -30,12 +30,16 @@ class LitleXmlMapper
30
  {
31
  }
32
 
33
- public function request($request,$hash_config=NULL)
34
  {
35
-
36
  $response = Communication::httpRequest($request,$hash_config);
37
- $respOb = XmlParser::domParser($response);
38
- return $respOb;
 
 
 
 
 
39
  }
40
 
41
  }
22
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
  * OTHER DEALINGS IN THE SOFTWARE.
24
  */
25
+ #require_once realpath(dirname(__FILE__)) . '/LitleOnline.php';
26
 
27
  class LitleXmlMapper
28
  {
30
  {
31
  }
32
 
33
+ public function request($request,$hash_config=NULL,$useSimpleXml)
34
  {
 
35
  $response = Communication::httpRequest($request,$hash_config);
36
+ if($useSimpleXml) {
37
+ $respObj = simplexml_load_string($response);
38
+ }
39
+ else {
40
+ $respObj = XmlParser::domParser($response);
41
+ }
42
+ return $respObj;
43
  }
44
 
45
  }
app/code/local/Litle/LitleSDK/Obj2xml.php CHANGED
@@ -30,9 +30,13 @@ class Obj2xml {
30
  $config= Obj2xml::getConfig($hash_config);
31
  $xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$rootNodeName />");
32
  $xml-> addAttribute('merchantId',$config["merchantId"]);
33
- $xml-> addAttribute('version',$config["version"]);
34
  $xml-> addAttribute('merchantSdk',$data['merchantSdk']);
35
  unset($data['merchantSdk']);
 
 
 
 
36
  $xml-> addAttribute('xmlns:xmlns','http://www.litle.com/schema');// does not show up on browser docs
37
  $authentication = $xml->addChild('authentication');
38
  $authentication->addChild('user',$config["user"]);
@@ -46,7 +50,8 @@ class Obj2xml {
46
  ($transacType-> addAttribute('customerId',$data["customerId"]));
47
  };
48
  unset($data['customerId']);
49
- if(isset($config['reportGroup'])) {
 
50
  ($transacType-> addAttribute('reportGroup',$config["reportGroup"]));
51
  };
52
  if(isset($data['id'])) {
@@ -56,8 +61,122 @@ class Obj2xml {
56
  Obj2xml::iterateChildren($data,$transacType);
57
  return $xml->asXML();
58
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
- private function iterateChildren($data,$transacType){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  foreach($data as $key => $value)
62
  {
63
  if ($value === "REQUIRED"){
@@ -78,11 +197,11 @@ class Obj2xml {
78
  }
79
  }
80
 
81
- public function getConfig($data)
82
  {
83
-
84
- @$config_array =parse_ini_file('litle_SDK_config.ini');
85
- $names = array('user','password','merchantId','timeout','proxy','reportGroup','version','url');
86
  foreach($names as $name)
87
  {
88
  if (isset($data[$name]))
30
  $config= Obj2xml::getConfig($hash_config);
31
  $xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$rootNodeName />");
32
  $xml-> addAttribute('merchantId',$config["merchantId"]);
33
+ $xml-> addAttribute('version',CURRENT_XML_VERSION);
34
  $xml-> addAttribute('merchantSdk',$data['merchantSdk']);
35
  unset($data['merchantSdk']);
36
+ if(isset($data['loggedInUser'])) {
37
+ $xml->addAttribute('loggedInUser',$data["loggedInUser"]);
38
+ };
39
+ unset($data['loggedInUser']);
40
  $xml-> addAttribute('xmlns:xmlns','http://www.litle.com/schema');// does not show up on browser docs
41
  $authentication = $xml->addChild('authentication');
42
  $authentication->addChild('user',$config["user"]);
50
  ($transacType-> addAttribute('customerId',$data["customerId"]));
51
  };
52
  unset($data['customerId']);
53
+
54
+ if(Obj2xml::transactionShouldHaveReportGroup($type, $config) && isset($config['reportGroup'])) {
55
  ($transacType-> addAttribute('reportGroup',$config["reportGroup"]));
56
  };
57
  if(isset($data['id'])) {
61
  Obj2xml::iterateChildren($data,$transacType);
62
  return $xml->asXML();
63
  }
64
+
65
+ public static function transactionShouldHaveReportGroup($transactionType) {
66
+ $transactionsThatDontHaveReportGroup = array(
67
+ 'updateSubscription',
68
+ 'cancelSubscription',
69
+ 'createPlan',
70
+ 'updatePlan'
71
+ );
72
+ return (FALSE === array_search($transactionType, $transactionsThatDontHaveReportGroup));
73
+ }
74
+
75
+ public static function transactionToXml($data, $type, $report_group){
76
+
77
+ $transac = simplexml_load_string("<$type />");
78
+ if(Obj2xml::transactionShouldHaveReportGroup($type)) {
79
+ $transac->addAttribute('reportGroup', $report_group);
80
+ }
81
+ Obj2xml::iterateChildren($data,$transac);
82
+
83
+ return str_replace("<?xml version=\"1.0\"?>\n", "", $transac->asXML());
84
+ }
85
+
86
+ public static function rfrRequestToXml($hash_in){
87
+ $rfr = simplexml_load_string("<RFRRequest />");
88
+ if(isset($hash_in['litleSessionId'])){
89
+ $rfr->addChild('litleSessionId', $hash_in['litleSessionId']);
90
+ }
91
+ else if(isset($hash_in['merchantId']) && isset($hash_in['postDay'])){
92
+ $auFileRequest = $rfr->addChild('accountUpdateFileRequestData');
93
+ $auFileRequest->addChild('merchantId', $hash_in['merchantId']);
94
+ $auFileRequest->addChild('postDay', $hash_in['postDay']);
95
+ }
96
+ else{
97
+ throw RuntimeException('To add an RFR Request, either a litleSessionId or a merchantId and a postDay must be set.');
98
+ }
99
+ return str_replace("<?xml version=\"1.0\"?>\n", "", $rfr->asXML());
100
+ }
101
 
102
+ public static function generateBatchHeader($counts_and_amounts){
103
+ $config= Obj2xml::getConfig(array());
104
+
105
+ $xml = simplexml_load_string("<batchRequest />");
106
+ $xml->addAttribute('merchantId', $config['merchantId']);
107
+ $xml->addAttribute('merchantSdk', CURRENT_SDK_VERSION);
108
+
109
+ $xml->addAttribute('authAmount', $counts_and_amounts['auth']['amount']);
110
+ $xml->addAttribute('numAuths', $counts_and_amounts['auth']['count']);
111
+
112
+ $xml->addAttribute('saleAmount', $counts_and_amounts['sale']['amount']);
113
+ $xml->addAttribute('numSales', $counts_and_amounts['sale']['count']);
114
+
115
+ $xml->addAttribute('creditAmount', $counts_and_amounts['credit']['amount']);
116
+ $xml->addAttribute('numCredits', $counts_and_amounts['credit']['count']);
117
+
118
+ $xml->addAttribute('numTokenRegistrations', $counts_and_amounts['tokenRegistration']['count']);
119
+
120
+ $xml->addAttribute('captureGivenAuthAmount', $counts_and_amounts['captureGivenAuth']['amount']);
121
+ $xml->addAttribute('numCaptureGivenAuths', $counts_and_amounts['captureGivenAuth']['count']);
122
+
123
+ $xml->addAttribute('forceCaptureAmount', $counts_and_amounts['forceCapture']['amount']);
124
+ $xml->addAttribute('numForceCaptures', $counts_and_amounts['forceCapture']['count']);
125
+
126
+ $xml->addAttribute('authReversalAmount', $counts_and_amounts['authReversal']['amount']);
127
+ $xml->addAttribute('numAuthReversals', $counts_and_amounts['authReversal']['count']);
128
+
129
+ $xml->addAttribute('captureAmount', $counts_and_amounts['capture']['amount']);
130
+ $xml->addAttribute('numCaptures', $counts_and_amounts['capture']['count']);
131
+
132
+ $xml->addAttribute('echeckVerificationAmount', $counts_and_amounts['echeckVerification']['amount']);
133
+ $xml->addAttribute('numEcheckVerification', $counts_and_amounts['echeckVerification']['count']);
134
+
135
+ $xml->addAttribute('echeckCreditAmount', $counts_and_amounts['echeckCredit']['amount']);
136
+ $xml->addAttribute('numEcheckCredit', $counts_and_amounts['echeckCredit']['count']);
137
+
138
+ $xml->addAttribute('numEcheckRedeposit', $counts_and_amounts['echeckRedeposit']['count']);
139
+
140
+ $xml->addAttribute('echeckSalesAmount', $counts_and_amounts['echeckSale']['amount']);
141
+ $xml->addAttribute('numEcheckSales', $counts_and_amounts['echeckSale']['count']);
142
+
143
+ $xml->addAttribute('numUpdateCardValidationNumOnTokens', $counts_and_amounts['updateCardValidationNumOnToken']['count']);
144
+
145
+ $xml->addAttribute('numUpdateSubscriptions', $counts_and_amounts['updateSubscription']['count']);
146
+
147
+ $xml->addAttribute('numCancelSubscriptions', $counts_and_amounts['cancelSubscription']['count']);
148
+
149
+ $xml->addAttribute('numCreatePlans', $counts_and_amounts['createPlan']['count']);
150
+ $xml->addAttribute('numUpdatePlans', $counts_and_amounts['updatePlan']['count']);
151
+
152
+ $xml->addAttribute('numActivates', $counts_and_amounts['activate']['count']);
153
+ $xml->addAttribute('activateAmount', $counts_and_amounts['activate']['amount']);
154
+ $xml->addAttribute('numDeactivates', $counts_and_amounts['deactivate']['count']);
155
+ $xml->addAttribute('numLoads', $counts_and_amounts['load']['count']);
156
+ $xml->addAttribute('loadAmount', $counts_and_amounts['load']['amount']);
157
+ $xml->addAttribute('numUnloads', $counts_and_amounts['unload']['count']);
158
+ $xml->addAttribute('unloadAmount', $counts_and_amounts['unload']['amount']);
159
+ $xml->addAttribute('numBalanceInquirys', $counts_and_amounts['balanceInquiry']['count']);
160
+
161
+ $xml->addAttribute('numAccountUpdates', $counts_and_amounts['accountUpdate']['count']);
162
+
163
+ return str_replace("/>", ">", str_replace("<?xml version=\"1.0\"?>\n", "", $xml->asXML()));
164
+ }
165
+
166
+ public static function generateRequestHeader($config, $num_batch_requests){
167
+ $xml = simplexml_load_string("<litleRequest />");
168
+
169
+ $xml->addAttribute('numBatchRequests', $num_batch_requests);
170
+ $xml->addAttribute('version', CURRENT_XML_VERSION);
171
+ $xml->addAttribute('xmlns:xmlns','http://www.litle.com/schema');
172
+ $authentication = $xml->addChild('authentication');
173
+ $authentication->addChild('user',$config["user"]);
174
+ $authentication->addChild('password',$config["password"]);
175
+
176
+ return str_replace("<?xml version=\"1.0\"?>\n", "", str_replace("</litleRequest>", "", $xml->asXML()));
177
+ }
178
+
179
+ private static function iterateChildren($data,$transacType){
180
  foreach($data as $key => $value)
181
  {
182
  if ($value === "REQUIRED"){
197
  }
198
  }
199
 
200
+ public static function getConfig($data)
201
  {
202
+ @$config_array =parse_ini_file('litle_SDK_config.ini'); //TODO Use an empty config_array if the file doesn't exist
203
+ $names = array('user','password','merchantId','timeout','proxy','reportGroup','version','url',
204
+ 'litle_requests_path', 'batch_requests_path', 'sftp_username', 'sftp_password', 'batch_url', 'tcp_port', 'tcp_ssl', 'tcp_timeout', 'print_xml');
205
  foreach($names as $name)
206
  {
207
  if (isset($data[$name]))
app/code/local/Litle/LitleSDK/Setup.php CHANGED
@@ -51,13 +51,33 @@ function initialize(){
51
  $line['password'] = trim(fgets(STDIN));
52
  print "Please input your merchantId: ";
53
  $line['currency_merchant_map ']['DEFAULT'] = trim(fgets(STDIN));
54
- print "Please choose Litle url from the following list (example: 'cert') or directly input another URL: \nsandbox => https://www.testlitle.com/sandbox/communicator/online \ncert => https://cert.litle.com/vap/communicator/online \nprecert => https://precert.litle.com/vap/communicator/online \nproduction1 => https://payments.litle.com/vap/communicator/online \nproduction2 => https://payments2.litle.com/vap/communicator/online" . PHP_EOL;
55
  $url = UrlMapper::getUrl(trim(fgets(STDIN)));
56
  $line['url'] = $url;
57
  print "Please input the proxy, if no proxy hit enter key: ";
58
  $line['proxy'] = trim(fgets(STDIN));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  writeConfig($line,$handle);
60
- fwrite($handle, "version = 8.13" . PHP_EOL);
61
  fwrite($handle, "timeout = 65". PHP_EOL);
62
  fwrite($handle, "reportGroup = Default Report Group". PHP_EOL);
63
  }
51
  $line['password'] = trim(fgets(STDIN));
52
  print "Please input your merchantId: ";
53
  $line['currency_merchant_map ']['DEFAULT'] = trim(fgets(STDIN));
54
+ print "Please choose Litle url from the following list (example: 'sandbox') or directly input another URL: \nsandbox => https://www.testlitle.com/sandbox/communicator/online \npostlive => https://postlive.litle.com/vap/communicator/online \ntransact-postlive => https://transact-postlive.litle.com/vap/communicator/online \nproduction => https://payments.litle.com/vap/communicator/online \nproduction-transact => https://transact.litle.com/vap/communicator/online \nprelive => https://prelive.litle.com/vap/communicator/online \ntransact-prelive => https://transact-prelive.litle.com/vap/communicator/online" . PHP_EOL;
55
  $url = UrlMapper::getUrl(trim(fgets(STDIN)));
56
  $line['url'] = $url;
57
  print "Please input the proxy, if no proxy hit enter key: ";
58
  $line['proxy'] = trim(fgets(STDIN));
59
+
60
+ print "Batch processing saves files to disk. \n";
61
+ print "Please input a directory to save these files. If you are not using batch processing, you may hit enter. ";
62
+ $dir = trim(fgets(STDIN));
63
+ $line['batch_requests_path'] = $dir;
64
+ $line['litle_requests_path'] = $dir;
65
+
66
+ print "Please input your SFTP username. If you are not using SFTP, you may hit enter. ";
67
+ $line['sftp_username'] = trim(fgets(STDIN));
68
+ print "Please input your SFTP password. If you are not using SFTP, you may hit enter. ";
69
+ $line['sftp_password'] = trim(fgets(STDIN));
70
+ print "Please input the URL for batch processing. If you are not using batch processing, you may hit enter. ";
71
+ $line['batch_url'] = trim(fgets(STDIN));
72
+ print "Please input the port for stream batch delivery. If you are not using stream batch delivery, you may hit enter. ";
73
+ $line['tcp_port'] = trim(fgets(STDIN));
74
+ print "Please input the timeout (in seconds) for stream batch delivery. If you are not using stream batch delivery, you may hit enter. ";
75
+ $line['tcp_timeout'] = trim(fgets(STDIN));
76
+ # ssl should be usd by default
77
+ $line['tcp_ssl'] = '1';
78
+ $line['print_xml'] = '0';
79
+
80
  writeConfig($line,$handle);
 
81
  fwrite($handle, "timeout = 65". PHP_EOL);
82
  fwrite($handle, "reportGroup = Default Report Group". PHP_EOL);
83
  }
app/code/local/Litle/LitleSDK/Transactions.php ADDED
@@ -0,0 +1,353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Transactions {
4
+
5
+
6
+ public static function createSaleHash($hash_in){
7
+ $hash_out = array(
8
+ 'litleTxnId' => XmlFields::returnArrayValue($hash_in,'litleTxnId'),
9
+ 'orderId' =>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
10
+ 'amount' =>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'amount')),
11
+ 'surchargeAmount' =>XmlFields::returnArrayValue($hash_in,'surchargeAmount'),
12
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
13
+ 'customerInfo'=>XmlFields::customerInfo(XmlFields::returnArrayValue($hash_in,'customerInfo')),
14
+ 'billToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress')),
15
+ 'shipToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'shipToAddress')),
16
+ 'card'=> XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card')),
17
+ 'paypal'=>XmlFields::payPal(XmlFields::returnArrayValue($hash_in,'paypal')),
18
+ 'token'=>XmlFields::cardTokenType(XmlFields::returnArrayValue($hash_in,'token')),
19
+ 'paypage'=>XmlFields::cardPaypageType(XmlFields::returnArrayValue($hash_in,'paypage')),
20
+ 'billMeLaterRequest'=>XmlFields::billMeLaterRequest(XmlFields::returnArrayValue($hash_in,'billMeLaterRequest')),
21
+ 'fraudCheck'=>XmlFields::fraudCheckType(XmlFields::returnArrayValue($hash_in,'fraudCheck')),
22
+ 'cardholderAuthentication'=>XmlFields::fraudCheckType(XmlFields::returnArrayValue($hash_in,'cardholderAuthentication')),
23
+ 'customBilling'=>XmlFields::customBilling(XmlFields::returnArrayValue($hash_in,'customBilling')),
24
+ 'taxBilling'=>XmlFields::taxBilling(XmlFields::returnArrayValue($hash_in,'taxBilling')),
25
+ 'enhancedData'=>XmlFields::enhancedData(XmlFields::returnArrayValue($hash_in,'enhancedData')),
26
+ 'processingInstructions'=>XmlFields::processingInstructions(XmlFields::returnArrayValue($hash_in,'processingInstructions')),
27
+ 'pos'=>XmlFields::pos(XmlFields::returnArrayValue($hash_in,'pos')),
28
+ 'payPalOrderComplete'=> XmlFields::returnArrayValue($hash_in,'paypalOrderComplete'),
29
+ 'payPalNotes'=> XmlFields::returnArrayValue($hash_in,'paypalNotesType'),
30
+ 'amexAggregatorData'=>XmlFields::amexAggregatorData(XmlFields::returnArrayValue($hash_in,'amexAggregatorData')),
31
+ 'allowPartialAuth'=>XmlFields::returnArrayValue($hash_in,'allowPartialAuth'),
32
+ 'healthcareIIAS'=>XmlFields::healthcareIIAS(XmlFields::returnArrayValue($hash_in,'healthcareIIAS')),
33
+ 'filtering'=>XmlFields::filteringType(XmlFields::returnArrayValue($hash_in,'filtering')),
34
+ 'merchantData'=>XmlFields::merchantData(XmlFields::returnArrayValue($hash_in,'merchantData')),
35
+ 'recyclingRequest'=>XmlFields::recyclingRequestType(XmlFields::returnArrayValue($hash_in,'recyclingRequest')),
36
+ 'fraudFilterOverride'=> XmlFields::returnArrayValue($hash_in,'fraudFilterOverride'),
37
+ 'recurringRequest'=>XmlFields::recurringRequestType(XmlFields::returnArrayValue($hash_in,'recurringRequest')),
38
+ 'litleInternalRecurringRequest'=>XmlFields::litleInternalRecurringRequestType(XmlFields::returnArrayValue($hash_in,'litleInternalRecurringRequest')),
39
+ 'debtRepayment'=>XmlFields::returnArrayValue($hash_in,'debtRepayment'),
40
+ );
41
+ return $hash_out;
42
+ }
43
+
44
+ public static function createAuthHash($hash_in){
45
+ $hash_out = array(
46
+ 'orderId'=> Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
47
+ 'amount'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'amount')),
48
+ 'surchargeAmount' =>XmlFields::returnArrayValue($hash_in,'surchargeAmount'),
49
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
50
+ 'customerInfo'=>(XmlFields::customerInfo(XmlFields::returnArrayValue($hash_in,'customerInfo'))),
51
+ 'billToAddress'=>(XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress'))),
52
+ 'shipToAddress'=>(XmlFields::contact(XmlFields::returnArrayValue($hash_in,'shipToAddress'))),
53
+ 'card'=> (XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card'))),
54
+ 'paypal'=>(XmlFields::payPal(XmlFields::returnArrayValue($hash_in,'paypal'))),
55
+ 'token'=>(XmlFields::cardTokenType(XmlFields::returnArrayValue($hash_in,'token'))),
56
+ 'paypage'=>(XmlFields::cardPaypageType(XmlFields::returnArrayValue($hash_in,'paypage'))),
57
+ 'billMeLaterRequest'=>(XmlFields::billMeLaterRequest(XmlFields::returnArrayValue($hash_in,'billMeLaterRequest'))),
58
+ 'cardholderAuthentication'=>(XmlFields::fraudCheckType(XmlFields::returnArrayValue($hash_in,'cardholderAuthentication'))),
59
+ 'processingInstructions'=>(XmlFields::processingInstructions(XmlFields::returnArrayValue($hash_in,'processingInstructions'))),
60
+ 'pos'=>(XmlFields::pos(XmlFields::returnArrayValue($hash_in,'pos'))),
61
+ 'customBilling'=>(XmlFields::customBilling(XmlFields::returnArrayValue($hash_in,'customBilling'))),
62
+ 'taxBilling'=>(XmlFields::taxBilling(XmlFields::returnArrayValue($hash_in,'taxBilling'))),
63
+ 'enhancedData'=>(XmlFields::enhancedData(XmlFields::returnArrayValue($hash_in,'enhancedData'))),
64
+ 'amexAggregatorData'=>(XmlFields::amexAggregatorData(XmlFields::returnArrayValue($hash_in,'amexAggregatorData'))),
65
+ 'allowPartialAuth'=>XmlFields::returnArrayValue($hash_in,'allowPartialAuth'),
66
+ 'healthcareIIAS'=>(XmlFields::healthcareIIAS(XmlFields::returnArrayValue($hash_in,'healthcareIIAS'))),
67
+ 'filtering'=>(XmlFields::filteringType(XmlFields::returnArrayValue($hash_in,'filtering'))),
68
+ 'merchantData'=>(XmlFields::merchantData(XmlFields::returnArrayValue($hash_in,'merchantData'))),
69
+ 'recyclingRequest'=>(XmlFields::recyclingRequestType(XmlFields::returnArrayValue($hash_in,'recyclingRequest'))),
70
+ 'fraudFilterOverride'=> XmlFields::returnArrayValue($hash_in,'fraudFilterOverride'),
71
+ 'recurringRequest'=>XmlFields::recurringRequestType(XmlFields::returnArrayValue($hash_in,'recurringRequest')),
72
+ 'debtRepayment'=>XmlFields::returnArrayValue($hash_in,'debtRepayment'),
73
+ );
74
+ return $hash_out;
75
+ }
76
+
77
+ public static function createAuthReversalHash($hash_in){
78
+ $hash_out = array(
79
+ 'litleTxnId' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleTxnId')),
80
+ 'amount' =>XmlFields::returnArrayValue($hash_in,'amount'),
81
+ 'surchargeAmount' =>XmlFields::returnArrayValue($hash_in,'surchargeAmount'),
82
+ 'payPalNotes'=>XmlFields::returnArrayValue($hash_in,'payPalNotes'),
83
+ 'actionReason'=>XmlFields::returnArrayValue($hash_in,'actionReason')
84
+ );
85
+ return $hash_out;
86
+ }
87
+
88
+ public static function createCreditHash($hash_in){
89
+ $hash_out = array(
90
+ 'litleTxnId' => XmlFields::returnArrayValue($hash_in, 'litleTxnId'),
91
+ 'orderId' =>XmlFields::returnArrayValue($hash_in, 'orderId'),
92
+ 'amount' =>XmlFields::returnArrayValue($hash_in, 'amount'),
93
+ 'surchargeAmount' =>XmlFields::returnArrayValue($hash_in,'surchargeAmount'),
94
+ 'orderSource'=>XmlFields::returnArrayValue($hash_in, 'orderSource'),
95
+ 'billToAddress'=>XmlFields::contact(XMLFields::returnArrayValue($hash_in, 'billToAddress')),
96
+ 'card'=>XmlFields::cardType(XMLFields::returnArrayValue($hash_in, 'card')),
97
+ 'paypal'=>XmlFields::credit_payPal(XMLFields::returnArrayValue($hash_in, 'paypal')),
98
+ 'token'=>XmlFields::cardTokenType(XMLFields::returnArrayValue($hash_in, 'token')),
99
+ 'paypage'=>XmlFields::cardPaypageType(XMLFields::returnArrayValue($hash_in, 'paypage')),
100
+ 'customBilling'=>XmlFields::customBilling(XMLFields::returnArrayValue($hash_in, 'customBilling')),
101
+ 'taxBilling'=>XmlFields::taxBilling(XMLFields::returnArrayValue($hash_in, 'taxBilling')),
102
+ 'billMeLaterRequest'=>XmlFields::billMeLaterRequest(XMLFields::returnArrayValue($hash_in, 'billMeLaterRequest')),
103
+ 'enhancedData'=>XmlFields::enhancedData(XMLFields::returnArrayValue($hash_in, 'enhancedData')),
104
+ 'processingInstructions'=>XmlFields::processingInstructions(XMLFields::returnArrayValue($hash_in, 'processingInstructions')),
105
+ 'pos'=>XmlFields::pos(XMLFields::returnArrayValue($hash_in, 'pos')),
106
+ 'amexAggregatorData'=>XmlFields::amexAggregatorData(XMLFields::returnArrayValue($hash_in, 'amexAggregatorData')),
107
+ 'payPalNotes' =>XmlFields::returnArrayValue($hash_in, 'payPalNotes'),
108
+ 'actionReason'=>XmlFields::returnArrayValue($hash_in, 'actionReason')
109
+ );
110
+ return $hash_out;
111
+ }
112
+
113
+ public static function createRegisterTokenHash($hash_in){
114
+ $hash_out = array(
115
+ 'orderId'=>XmlFields::returnArrayValue($hash_in,'orderId'),
116
+ 'accountNumber'=>XmlFields::returnArrayValue($hash_in,'accountNumber'),
117
+ 'echeckForToken'=>XmlFields::echeckForTokenType(XmlFields::returnArrayValue($hash_in,'echeckForToken')),
118
+ 'paypageRegistrationId'=>XmlFields::returnArrayValue($hash_in,'paypageRegistrationId'),
119
+ 'cardValidationNum'=>XmlFields::returnArrayValue($hash_in,'cardValidationNum'),
120
+ );
121
+ return $hash_out;
122
+ }
123
+
124
+ public static function createForceCaptureHash($hash_in){
125
+ $hash_out = array(
126
+ 'orderId' =>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
127
+ 'amount' =>XmlFields::returnArrayValue($hash_in,'amount'),
128
+ 'surchargeAmount' =>XmlFields::returnArrayValue($hash_in,'surchargeAmount'),
129
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
130
+ 'billToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress')),
131
+ 'card'=> XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card')),
132
+ 'token'=>XmlFields::cardTokenType(XmlFields::returnArrayValue($hash_in,'token')),
133
+ 'paypage'=>XmlFields::cardPaypageType(XmlFields::returnArrayValue($hash_in,'paypage')),
134
+ 'customBilling'=>XmlFields::customBilling(XmlFields::returnArrayValue($hash_in,'customBilling')),
135
+ 'taxBilling'=>XmlFields::taxBilling(XmlFields::returnArrayValue($hash_in,'taxBilling')),
136
+ 'enhancedData'=>XmlFields::enhancedData(XmlFields::returnArrayValue($hash_in,'enhancedData')),
137
+ 'processingInstructions'=>XmlFields::processingInstructions(XmlFields::returnArrayValue($hash_in,'processingInstructions')),
138
+ 'pos'=>XmlFields::pos(XmlFields::returnArrayValue($hash_in,'pos')),
139
+ 'amexAggregatorData'=>XmlFields::amexAggregatorData(XmlFields::returnArrayValue($hash_in,'amexAggregatorData')),
140
+ 'merchantData'=>(XmlFields::merchantData(XmlFields::returnArrayValue($hash_in,'merchantData'))),
141
+ 'debtRepayment'=>XmlFields::returnArrayValue($hash_in,'debtRepayment'),
142
+ );
143
+ return $hash_out;
144
+ }
145
+
146
+ public static function createCaptureHash($hash_in){
147
+ $hash_out = array(
148
+ 'partial'=>XmlFields::returnArrayValue($hash_in,'partial'),
149
+ 'litleTxnId' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleTxnId')),
150
+ 'amount' =>(XmlFields::returnArrayValue($hash_in,'amount')),
151
+ 'surchargeAmount' =>XmlFields::returnArrayValue($hash_in,'surchargeAmount'),
152
+ 'enhancedData'=>XmlFields::enhancedData(XmlFields::returnArrayValue($hash_in,'enhancedData')),
153
+ 'processingInstructions'=>XmlFields::processingInstructions(XmlFields::returnArrayValue($hash_in,'processingInstructions')),
154
+ 'payPalOrderComplete'=>XmlFields::returnArrayValue($hash_in,'payPalOrderComplete'),
155
+ 'payPalNotes' =>XmlFields::returnArrayValue($hash_in,'payPalNotes'));
156
+ return $hash_out;
157
+ }
158
+
159
+ public static function createCaptureGivenAuthHash($hash_in){
160
+ $hash_out = array(
161
+ 'orderId'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
162
+ 'authInformation'=>XmlFields::authInformation(XmlFields::returnArrayValue($hash_in,'authInformation')),
163
+ 'amount' =>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'amount')),
164
+ 'surchargeAmount' =>XmlFields::returnArrayValue($hash_in,'surchargeAmount'),
165
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
166
+ 'billToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress')),
167
+ 'shipToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'shipToAddress')),
168
+ 'card'=> XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card')),
169
+ 'token'=>XmlFields::cardTokenType(XmlFields::returnArrayValue($hash_in,'token')),
170
+ 'paypage'=>XmlFields::cardPaypageType(XmlFields::returnArrayValue($hash_in,'paypage')),
171
+ 'customBilling'=>XmlFields::customBilling(XmlFields::returnArrayValue($hash_in,'customBilling')),
172
+ 'taxBilling'=>XmlFields::taxBilling(XmlFields::returnArrayValue($hash_in,'taxBilling')),
173
+ 'billMeLaterRequest'=>XmlFields::billMeLaterRequest(XmlFields::returnArrayValue($hash_in,'billMeLaterRequest')),
174
+ 'enhancedData'=>XmlFields::enhancedData(XmlFields::returnArrayValue($hash_in,'enhancedData')),
175
+ 'processingInstructions'=>XmlFields::processingInstructions(XmlFields::returnArrayValue($hash_in,'processingInstructions')),
176
+ 'pos'=>XmlFields::pos(XmlFields::returnArrayValue($hash_in,'pos')),
177
+ 'amexAggregatorData'=>XmlFields::amexAggregatorData(XmlFields::returnArrayValue($hash_in,'amexAggregatorData')),
178
+ 'merchantData'=>(XmlFields::merchantData(XmlFields::returnArrayValue($hash_in,'merchantData'))),
179
+ 'debtRepayment'=>XmlFields::returnArrayValue($hash_in,'debtRepayment')
180
+ );
181
+ return $hash_out;
182
+ }
183
+
184
+ public static function createEcheckRedepositHash($hash_in){
185
+ $hash_out = array(
186
+ 'litleTxnId' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleTxnId')),
187
+ 'echeck'=>XmlFields::echeckType(XmlFields::returnArrayValue($hash_in,'echeck')),
188
+ 'echeckToken'=>XmlFields::echeckTokenType(XmlFields::returnArrayValue($hash_in,'echeckToken')),
189
+ 'merchantData'=>(XmlFields::merchantData(XmlFields::returnArrayValue($hash_in,'merchantData')))
190
+ );
191
+ return $hash_out;
192
+ }
193
+
194
+ public static function createEcheckSaleHash($hash_in){
195
+ $hash_out = array(
196
+ 'litleTxnId'=>XmlFields::returnArrayValue($hash_in,'litleTxnId'),
197
+ 'orderId'=>XmlFields::returnArrayValue($hash_in,'orderId'),
198
+ 'verify'=>XmlFields::returnArrayValue($hash_in,'verify'),
199
+ 'amount'=>XmlFields::returnArrayValue($hash_in,'amount'),
200
+ 'orderSource'=>XmlFields::returnArrayValue($hash_in,'orderSource'),
201
+ 'billToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress')),
202
+ 'shipToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'shipToAddress')),
203
+ 'echeck'=>XmlFields::echeckType(XmlFields::returnArrayValue($hash_in,'echeck')),
204
+ 'echeckToken'=>XmlFields::echeckTokenType(XmlFields::returnArrayValue($hash_in,'echeckToken')),
205
+ 'customBilling'=>XmlFields::customBilling(XmlFields::returnArrayValue($hash_in,'customBilling')));
206
+ return $hash_out;
207
+ }
208
+
209
+ public static function createEcheckCreditHash($hash_in){
210
+ $hash_out = array(
211
+ 'litleTxnId'=>XmlFields::returnArrayValue($hash_in,'litleTxnId'),
212
+ 'orderId'=>XmlFields::returnArrayValue($hash_in,'orderId'),
213
+ 'amount'=>XmlFields::returnArrayValue($hash_in,'amount'),
214
+ 'orderSource'=>XmlFields::returnArrayValue($hash_in,'orderSource'),
215
+ 'billToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress')),
216
+ 'echeck'=>XmlFields::echeckType(XmlFields::returnArrayValue($hash_in,'echeck')),
217
+ 'echeckToken'=>XmlFields::echeckTokenType(XmlFields::returnArrayValue($hash_in,'echeckToken')),
218
+ 'customBilling'=>XmlFields::customBilling(XmlFields::returnArrayValue($hash_in,'customBilling')));
219
+ return $hash_out;
220
+ }
221
+
222
+ public static function createEcheckVerificationHash($hash_in){
223
+
224
+ $hash_out = array(
225
+ 'litleTxnId'=>XmlFields::returnArrayValue($hash_in,'litleTxnId'),
226
+ 'orderId'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
227
+ 'amount'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'amount')),
228
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
229
+ 'billToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress')),
230
+ 'echeck'=>XmlFields::echeckType(XmlFields::returnArrayValue($hash_in,'echeck')),
231
+ 'echeckToken'=>XmlFields::echeckTokenType(XmlFields::returnArrayValue($hash_in,'echeckToken')),
232
+ 'merchantData'=>(XmlFields::merchantData(XmlFields::returnArrayValue($hash_in,'merchantData'))),
233
+ );
234
+
235
+ return $hash_out;
236
+ }
237
+
238
+ public static function createUpdateCardValidationNumOnTokenHash($hash_in){
239
+ $hash_out = array(
240
+ 'orderId'=>XmlFields::returnArrayValue($hash_in,'orderId'),
241
+ 'litleToken' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'litleToken')),
242
+ 'cardValidationNum' => Checker::requiredField(XmlFields::returnArrayValue($hash_in,'cardValidationNum')),
243
+ );
244
+
245
+ return $hash_out;
246
+ }
247
+
248
+ public static function createUpdateSubscriptionHash($hash_in){
249
+ $hash_out = array(
250
+ 'subscriptionId'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'subscriptionId')),
251
+ 'planCode'=>XmlFields::returnArrayValue($hash_in,'planCode'),
252
+ 'billToAddress'=>XmlFields::contact(XmlFields::returnArrayValue($hash_in,'billToAddress')),
253
+ 'card'=>XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card')),
254
+ 'token'=>XmlFields::cardTokenType(XmlFields::returnArrayValue($hash_in,'token')),
255
+ 'paypage'=>XmlFields::cardPaypageType(XmlFields::returnArrayValue($hash_in,'paypage')),
256
+ 'billingDate'=>XmlFields::returnArrayValue($hash_in,'billingDate')
257
+ );
258
+
259
+ return $hash_out;
260
+ }
261
+
262
+ public static function createCancelSubscriptionHash($hash_in){
263
+ $hash_out = array(
264
+ 'subscriptionId'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'subscriptionId'))
265
+ );
266
+
267
+ return $hash_out;
268
+ }
269
+
270
+ public static function createCreatePlanHash($hash_in){
271
+ $hash_out = array(
272
+ 'planCode'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'planCode')),
273
+ 'name'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'name')),
274
+ 'description'=>XmlFields::returnArrayValue($hash_in,'description'),
275
+ 'intervalType'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'intervalType')),
276
+ 'amount'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'amount')),
277
+ 'numberOfPayments'=>XmlFields::returnArrayValue($hash_in,'numberOfPayments'),
278
+ 'trialNumberOfIntervals'=>XmlFields::returnArrayValue($hash_in,'trialNumberOfIntervals'),
279
+ 'trialIntervalType'=>XmlFields::returnArrayValue($hash_in,'trialIntervalType'),
280
+ 'active'=>XmlFields::returnArrayValue($hash_in,'active')
281
+ );
282
+
283
+ return $hash_out;
284
+ }
285
+
286
+ public static function createUpdatePlanHash($hash_in){
287
+ $hash_out = array(
288
+ 'planCode'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'planCode')),
289
+ 'active'=>XmlFields::returnArrayValue($hash_in,'active')
290
+ );
291
+
292
+ return $hash_out;
293
+ }
294
+
295
+ public static function createActivateHash($hash_in){
296
+ $hash_out = array(
297
+ 'orderId'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
298
+ 'amount'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'amount')),
299
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
300
+ 'card'=>Checker::requiredField(XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card')))
301
+ );
302
+
303
+ return $hash_out;
304
+ }
305
+ public static function createDeactivateHash($hash_in){
306
+ $hash_out = array(
307
+ 'orderId'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
308
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
309
+ 'card'=>Checker::requiredField(XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card')))
310
+ );
311
+
312
+ return $hash_out;
313
+ }
314
+ public static function createLoadHash($hash_in){
315
+ $hash_out = array(
316
+ 'orderId'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
317
+ 'amount'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'amount')),
318
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
319
+ 'card'=>Checker::requiredField(XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card')))
320
+ );
321
+
322
+ return $hash_out;
323
+ }
324
+ public static function createUnloadHash($hash_in){
325
+ $hash_out = array(
326
+ 'orderId'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
327
+ 'amount'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'amount')),
328
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
329
+ 'card'=>Checker::requiredField(XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card')))
330
+ );
331
+
332
+ return $hash_out;
333
+ }
334
+ public static function createBalanceInquiryHash($hash_in){
335
+ $hash_out = array(
336
+ 'orderId'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
337
+ 'orderSource'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderSource')),
338
+ 'card'=>Checker::requiredField(XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card')))
339
+ );
340
+
341
+ return $hash_out;
342
+ }
343
+
344
+ public static function createAccountUpdate($hash_in){
345
+ $hash_out = array(
346
+ 'orderId'=>Checker::requiredField(XmlFields::returnArrayValue($hash_in,'orderId')),
347
+ 'card'=> XmlFields::cardType(XmlFields::returnArrayValue($hash_in,'card')),
348
+ 'token'=>XmlFields::cardTokenType(XmlFields::returnArrayValue($hash_in,'token')),
349
+ );
350
+
351
+ return $hash_out;
352
+ }
353
+ }
app/code/local/Litle/LitleSDK/XmlFields.php CHANGED
@@ -26,9 +26,12 @@ require_once realpath(dirname(__FILE__)) . "/LitleOnline.php";
26
 
27
  class XmlFields
28
  {
29
- public static function returnArrayValue($hash_in, $key)
30
  {
31
  $retVal = array_key_exists($key, $hash_in)? $hash_in[$key] : null;
 
 
 
32
  return $retVal;
33
  }
34
 
@@ -37,20 +40,20 @@ class XmlFields
37
  if (isset($hash_in))
38
  {
39
  $hash_out = array(
40
- "name"=>XmlFields::returnArrayValue($hash_in, "name"),
41
- "firstName" =>XmlFields::returnArrayValue($hash_in, "firstName"),
42
- "middleInitial"=>XmlFields::returnArrayValue($hash_in, "middleInitial"),
43
- "lastName"=>XmlFields::returnArrayValue($hash_in, "lastName"),
44
- "companyName"=>XmlFields::returnArrayValue($hash_in, "companyName"),
45
- "addressLine1"=>XmlFields::returnArrayValue($hash_in, "addressLine1"),
46
- "addressLine2"=>XmlFields::returnArrayValue($hash_in, "addressLine2"),
47
- "addressLine3"=>XmlFields::returnArrayValue($hash_in, "addressLine3"),
48
- "city"=>XmlFields::returnArrayValue($hash_in, "city"),
49
- "state"=>XmlFields::returnArrayValue($hash_in, "state"),
50
- "zip"=>XmlFields::returnArrayValue($hash_in, "zip"),
51
- "country"=>XmlFields::returnArrayValue($hash_in, "country"),
52
- "email"=>XmlFields::returnArrayValue($hash_in, "email"),
53
- "phone"=>XmlFields::returnArrayValue($hash_in, "phone")
54
  );
55
  return $hash_out;
56
  }
@@ -192,7 +195,9 @@ class XmlFields
192
  $hash_out = array(
193
  "capability"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "capability"))),
194
  "entryMode"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "entryMode"))),
195
- "cardholderId"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "cardholderId")))
 
 
196
  );
197
  return $hash_out;
198
  }
@@ -219,8 +224,8 @@ class XmlFields
219
  {
220
  $hash_out = array(
221
  "itemSequenceNumber"=>XmlFields::returnArrayValue($hash_in, "itemSequenceNumber"),
222
- "itemDescription"=>XmlFields::returnArrayValue($hash_in, "itemDescription"),
223
- "productCode"=>XmlFields::returnArrayValue($hash_in, "productCode"),
224
  "quantity"=>XmlFields::returnArrayValue($hash_in, "quantity"),
225
  "unitOfMeasure"=>XmlFields::returnArrayValue($hash_in, "unitOfMeasure"),
226
  "taxAmount"=>XmlFields::returnArrayValue($hash_in, "taxAmount"),
@@ -257,13 +262,15 @@ class XmlFields
257
  if ($key == 'lineItemData' && $key != NULL){
258
  $lineItem = array();
259
  for($j=0; $j<count($value); $j++){
260
- $hash_out[('lineItemData' . (string)$j)] = XmlFields::lineItemData($value[$j]);
 
261
  }
262
  }
263
  elseif ($key == 'detailTax' & $key != NULL){
264
  $detailtax = array();
265
  for($j=0; $j<count($value); $j++){
266
- $hash_out[('detailTax' . (string)$j)] = XmlFields::detailTax($value[$j]);
 
267
  }
268
  }
269
  }
@@ -359,10 +366,10 @@ class XmlFields
359
  if (isset($hash_in))
360
  {
361
  $hash_out = array(
362
- "phone"=>XmlFields::returnArrayValue($hash_in, "phone"),
363
- "city" =>XmlFields::returnArrayValue($hash_in, "city"),
364
- "url" =>XmlFields::returnArrayValue($hash_in, "url"),
365
- "descriptor" =>XmlFields::returnArrayValue($hash_in, "descriptor")
366
  );
367
  return $hash_out;
368
  }
@@ -455,6 +462,54 @@ class XmlFields
455
  return $hash_out;
456
  }
457
  }
458
-
459
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
460
  }
26
 
27
  class XmlFields
28
  {
29
+ public static function returnArrayValue($hash_in, $key, $maxlength = null)
30
  {
31
  $retVal = array_key_exists($key, $hash_in)? $hash_in[$key] : null;
32
+ if ($maxlength && !is_null($retVal)) {
33
+ $retVal = substr($retVal, 0, $maxlength);
34
+ }
35
  return $retVal;
36
  }
37
 
40
  if (isset($hash_in))
41
  {
42
  $hash_out = array(
43
+ "name"=>XmlFields::returnArrayValue($hash_in, "name", 100),
44
+ "firstName" =>XmlFields::returnArrayValue($hash_in, "firstName", 25),
45
+ "middleInitial"=>XmlFields::returnArrayValue($hash_in, "middleInitial", 1),
46
+ "lastName"=>XmlFields::returnArrayValue($hash_in, "lastName", 25),
47
+ "companyName"=>XmlFields::returnArrayValue($hash_in, "companyName", 40),
48
+ "addressLine1"=>XmlFields::returnArrayValue($hash_in, "addressLine1", 35),
49
+ "addressLine2"=>XmlFields::returnArrayValue($hash_in, "addressLine2", 35),
50
+ "addressLine3"=>XmlFields::returnArrayValue($hash_in, "addressLine3", 35),
51
+ "city"=>XmlFields::returnArrayValue($hash_in, "city", 35),
52
+ "state"=>XmlFields::returnArrayValue($hash_in, "state", 30),
53
+ "zip"=>XmlFields::returnArrayValue($hash_in, "zip", 20),
54
+ "country"=>XmlFields::returnArrayValue($hash_in, "country", 3),
55
+ "email"=>XmlFields::returnArrayValue($hash_in, "email", 100),
56
+ "phone"=>XmlFields::returnArrayValue($hash_in, "phone", 20)
57
  );
58
  return $hash_out;
59
  }
195
  $hash_out = array(
196
  "capability"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "capability"))),
197
  "entryMode"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "entryMode"))),
198
+ "cardholderId"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "cardholderId"))),
199
+ "terminalId"=>XmlFields::returnArrayValue($hash_in,"terminalId"),
200
+ "catLevel"=>XmlFields::returnArrayValue($hash_in,"catLevel"),
201
  );
202
  return $hash_out;
203
  }
224
  {
225
  $hash_out = array(
226
  "itemSequenceNumber"=>XmlFields::returnArrayValue($hash_in, "itemSequenceNumber"),
227
+ "itemDescription"=>XmlFields::returnArrayValue($hash_in, "itemDescription", 26),
228
+ "productCode"=>XmlFields::returnArrayValue($hash_in, "productCode", 12),
229
  "quantity"=>XmlFields::returnArrayValue($hash_in, "quantity"),
230
  "unitOfMeasure"=>XmlFields::returnArrayValue($hash_in, "unitOfMeasure"),
231
  "taxAmount"=>XmlFields::returnArrayValue($hash_in, "taxAmount"),
262
  if ($key == 'lineItemData' && $key != NULL){
263
  $lineItem = array();
264
  for($j=0; $j<count($value); $j++){
265
+ $outIndex = ('lineItemData') . (string)$j;
266
+ $hash_out[$outIndex] = XmlFields::lineItemData(XmlFields::returnArrayValue($value,$j));
267
  }
268
  }
269
  elseif ($key == 'detailTax' & $key != NULL){
270
  $detailtax = array();
271
  for($j=0; $j<count($value); $j++){
272
+ $outIndex = ('detailTax') . (string)$j;
273
+ $hash_out[$outIndex] = XmlFields::detailTax(XmlFields::returnArrayValue($value,$j));
274
  }
275
  }
276
  }
366
  if (isset($hash_in))
367
  {
368
  $hash_out = array(
369
+ "phone"=>XmlFields::returnArrayValue($hash_in, "phone", 13),
370
+ "city" =>XmlFields::returnArrayValue($hash_in, "city", 35),
371
+ "url" =>XmlFields::returnArrayValue($hash_in, "url", 13),
372
+ "descriptor" =>XmlFields::returnArrayValue($hash_in, "descriptor", 25)
373
  );
374
  return $hash_out;
375
  }
462
  return $hash_out;
463
  }
464
  }
465
+
466
+
467
+
468
+ public static function recurringRequestType($hash_in)
469
+ {
470
+ if(isset($hash_in))
471
+ {
472
+ $hash_out = array(
473
+ "subscription"=>(XmlFields::recurringSubscriptionType(XmlFields::returnArrayValue($hash_in,"subscription")))
474
+ );
475
+ return $hash_out;
476
+ }
477
+ }
478
+
479
+ public static function recurringSubscriptionType($hash_in) {
480
+ if(isset($hash_in))
481
+ {
482
+ $hash_out = array(
483
+ "planCode"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "planCode"))),
484
+ "numberOfPayments"=>(XmlFields::returnArrayValue($hash_in, "numberOfPayments")),
485
+ "startDate"=>(XmlFields::returnArrayValue($hash_in, "startDate")),
486
+ "amount"=>(XmlFields::returnArrayValue($hash_in, "amount")),
487
+ );
488
+ return $hash_out;
489
+ }
490
+ }
491
+
492
+ public static function litleInternalRecurringRequestType($hash_in)
493
+ {
494
+ if(isset($hash_in))
495
+ {
496
+ $hash_out = array(
497
+ "subscriptionId"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "subscriptionId"))),
498
+ "recurringTxnId"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "recurringTxnId")))
499
+ );
500
+ return $hash_out;
501
+ }
502
+ }
503
+
504
+ public static function advancedFraudChecksType($hash_in)
505
+ {
506
+ if (isset($hash_in))
507
+ {
508
+ $hash_out = array(
509
+ "threatMetrixSessionId"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "threatMetrixSessionId", 128)))
510
+ );
511
+ return $hash_out;
512
+ }
513
+ }
514
+
515
  }
app/code/local/Litle/LitleSDK/XmlParser.php CHANGED
@@ -52,5 +52,10 @@ class XMLParser{
52
  $retVal = $attributes->getAttribute($attributeName);
53
  return $retVal;
54
  }
 
 
 
 
 
55
  }
56
  ?>
52
  $retVal = $attributes->getAttribute($attributeName);
53
  return $retVal;
54
  }
55
+
56
+ public static function getDomDocumentAsString($dom)
57
+ {
58
+ return $dom->saveXML($dom);
59
+ }
60
  }
61
  ?>
app/code/local/Litle/Palorus/Helper/Data.php CHANGED
@@ -38,7 +38,7 @@ class Litle_Palorus_Helper_Data extends Mage_Core_Helper_Abstract
38
 
39
  public function getBaseUrl()
40
  {
41
- $url = Mage::getModel('creditcard/paymentlogic')->getConfigData('url');
42
  return self::getBaseUrlFrom($url);
43
  }
44
 
@@ -112,7 +112,15 @@ class Litle_Palorus_Helper_Data extends Mage_Core_Helper_Abstract
112
 
113
  static public function formatAvailableBalance($balance)
114
  {
115
- return self::formatMoney($balance);
 
 
 
 
 
 
 
 
116
  }
117
 
118
  static public function formatAffluence($affluence)
38
 
39
  public function getBaseUrl()
40
  {
41
+ $url = Mage::getModel('creditcard/paymentLogic')->getConfigData('url');
42
  return self::getBaseUrlFrom($url);
43
  }
44
 
112
 
113
  static public function formatAvailableBalance($balance)
114
  {
115
+ if ($balance === '' || $balance === NULL) {
116
+ $available_balance = '';
117
+ } else {
118
+ $balance = str_pad($balance, 3, '0', STR_PAD_LEFT);
119
+ $available_balance = substr_replace($balance, '.', -2, 0);
120
+ $available_balance = '$' . $available_balance;
121
+ }
122
+
123
+ return $available_balance;
124
  }
125
 
126
  static public function formatAffluence($affluence)
app/code/local/Litle/Palorus/Model/Avscid.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_Palorus_Model_Avscid extends Mage_Core_Model_Abstract
4
+ {
5
+ protected $_model = NULL;
6
+
7
+ protected function _construct()
8
+ {
9
+ $this->_model = 'palorus/avscid';
10
+ $this->_init($this->_model);
11
+ }
12
+
13
+ }
app/code/local/Litle/Palorus/Model/Mysql4/Avscid.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_Palorus_Model_Mysql4_Avscid extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('palorus/avscid', 'avs_cid_id');
8
+ }
9
+ }
app/code/local/Litle/Palorus/Model/Mysql4/Avscid/Collection.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Litle_Palorus_Model_Mysql4_Avscid_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('palorus/avscid');
9
+ }
10
+
11
+ }
app/code/local/Litle/Palorus/Model/Vault.php CHANGED
@@ -84,16 +84,6 @@ class Litle_Palorus_Model_Vault extends Mage_Core_Model_Abstract
84
  return $vault;
85
  }
86
 
87
- public function proveArchitRight($foo, $bar, $foobar) {
88
- // fetch write database connection that is used in Mage_Core module
89
- $write = Mage::getSingleton('core/resource')->getConnection('core_setup');
90
- //$write->beginTransaction();
91
-
92
- // now $write is an instance of Zend_Db_Adapter_Abstract
93
- $write->query("insert into litle_vault (vault_id, order_id, customer_id, last4, token, type, bin) values ($foo,$bar,0,1234,$foobar,'VI','123456')");
94
- //$write->commit();
95
- }
96
-
97
  /**
98
  * Create a token with the minimum information.
99
  *
84
  return $vault;
85
  }
86
 
 
 
 
 
 
 
 
 
 
 
87
  /**
88
  * Create a token with the minimum information.
89
  *
app/code/local/Litle/Palorus/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Litle_Palorus>
5
- <version>8.14.0</version>
6
  </Litle_Palorus>
7
  </modules>
8
  <global>
@@ -23,6 +23,9 @@
23
  <failedtransactions>
24
  <table>litle_failed_transactions</table>
25
  </failedtransactions>
 
 
 
26
  </entities>
27
  </palorus_mysql4>
28
  </models>
2
  <config>
3
  <modules>
4
  <Litle_Palorus>
5
+ <version>8.15.0</version>
6
  </Litle_Palorus>
7
  </modules>
8
  <global>
23
  <failedtransactions>
24
  <table>litle_failed_transactions</table>
25
  </failedtransactions>
26
+ <avscid>
27
+ <table>litle_avs_cid</table>
28
+ </avscid>
29
  </entities>
30
  </palorus_mysql4>
31
  </models>
app/code/local/Litle/Palorus/sql/palorus_setup/mysql4-upgrade-8.14.0-8.15.0.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ Mage::log("About to start upgrade from 8.14.0 to 8.15.0", null, "litle_install.log");
5
+ $installer->startSetup();
6
+
7
+ $sql = "
8
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('palorus/avscid')}` (
9
+ `avs_cid_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
10
+ `order_id` int(10) unsigned,
11
+ `avs_response` varchar(3),
12
+ `cid_response` varchar(3),
13
+ PRIMARY KEY (`avs_cid_id`)
14
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
15
+ ";
16
+ Mage::log("SQL: " . $sql, null, "litle_install.log");
17
+ $installer->run($sql);
18
+ Mage::log("Created table litle_avs_cid", null, "litle_install.log");
19
+
20
+ Mage::log("About to end upgrade from 8.14.0 to 8.15.0", null, "litle_install.log");
21
+ $installer->endSetup();
app/design/.gitignore ADDED
@@ -0,0 +1 @@
 
1
+ /install
app/design/adminhtml/default/default/layout/.gitignore ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /admin.xml
2
+ /adminnotification.xml
3
+ /api2.xml
4
+ /authorizenet.xml
5
+ /bundle.xml
6
+ /captcha.xml
7
+ /catalog.xml
8
+ /centinel.xml
9
+ /cms.xml
10
+ /compiler.xml
11
+ /connect.xml
12
+ /currencysymbol.xml
13
+ /customer.xml
14
+ /dataflow.xml
15
+ /downloadable.xml
16
+ /giftmessage.xml
17
+ /importexport.xml
18
+ /index.xml
19
+ /main.xml
20
+ /moneybookers.xml
21
+ /newsletter.xml
22
+ /oauth.xml
23
+ /pagecache.xml
24
+ /promo.xml
25
+ /report.xml
26
+ /rss.xml
27
+ /sales.xml
28
+ /search.xml
29
+ /tag.xml
30
+ /widget.xml
31
+ /xmlconnect.xml
app/design/adminhtml/default/default/locale/en_US/.gitignore ADDED
@@ -0,0 +1 @@
 
1
+ /translate.csv
app/design/adminhtml/default/default/template/.gitignore ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /api
2
+ /api2
3
+ /authorizenet
4
+ /backup
5
+ /bundle
6
+ /captcha
7
+ /catalog
8
+ /centinel
9
+ /cms
10
+ /compiler
11
+ /connect
12
+ /currencysymbol
13
+ /customer
14
+ /dashboard
15
+ /directory
16
+ /downloadable
17
+ /eav
18
+ /email
19
+ /giftmessage
20
+ /googlebase
21
+ /importexport
22
+ /index
23
+ /media
24
+ /moneybookers
25
+ /newsletter
26
+ /notification
27
+ /oauth
28
+ /page
29
+ /pagecache
30
+ /paygate
31
+ /payment
32
+ /paypal
33
+ /permissions
34
+ /poll
35
+ /promo
36
+ /rating
37
+ /report
38
+ /review
39
+ /sales
40
+ /store
41
+ /system
42
+ /tag
43
+ /tax
44
+ /urlrewrite
45
+ /usa
46
+ /weee
47
+ /widget
48
+ /xmlconnect
49
+ /access_denied.phtml
50
+ /coming.phtml
51
+ /empty.phtml
52
+ /example.phtml
53
+ /forgotpassword.phtml
54
+ /formkey.phtml
55
+ /login.phtml
56
+ /overlay_popup.phtml
57
+ /page.phtml
58
+ /popup.phtml
59
+ /resetforgottenpassword.phtml
app/design/adminhtml/default/default/template/litle/form/litlecc.phtml CHANGED
@@ -88,7 +88,7 @@ $_paypageUrl = Mage::getModel('Litle_CreditCard_Model_PaymentLogic')->getConfigD
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: ?>
88
  </li>
89
  <?php endif; ?>
90
 
91
+ <a href="https://reports.litle.com/ui/vt" target="_blank">Litle Virtual Terminal</a>
92
  <br/><br/>
93
 
94
  <?php else: ?>
app/design/frontend/.gitignore ADDED
@@ -0,0 +1 @@
 
1
+ /default
app/design/frontend/base/default/.gitignore ADDED
@@ -0,0 +1 @@
 
1
+ /etc
app/design/frontend/base/default/layout/.gitignore ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /sales
2
+ /authorizenet.xml
3
+ /bundle.xml
4
+ /captcha.xml
5
+ /catalog_msrp.xml
6
+ /catalog.xml
7
+ /cataloginventory.xml
8
+ /catalogsearch.xml
9
+ /centinel.xml
10
+ /checkout.xml
11
+ /cms.xml
12
+ /contacts.xml
13
+ /core.xml
14
+ /customer.xml
15
+ /directory.xml
16
+ /downloadable.xml
17
+ /googleanalytics.xml
18
+ /googlecheckout.xml
19
+ /moneybookers.xml
20
+ /newsletter.xml
21
+ /oauth.xml
22
+ /page.xml
23
+ /pagecache.xml
24
+ /payment.xml
25
+ /paypal.xml
26
+ /paypaluk.xml
27
+ /persistent.xml
28
+ /poll.xml
29
+ /productalert.xml
30
+ /reports.xml
31
+ /review.xml
32
+ /rss.xml
33
+ /sales.xml
34
+ /sendfriend.xml
35
+ /shipping.xml
36
+ /tag.xml
37
+ /weee.xml
38
+ /wishlist.xml
39
+ /xmlconnect.xml
app/design/frontend/base/default/template/.gitignore ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /authorizenet
2
+ /bundle
3
+ /callouts
4
+ /captcha
5
+ /catalog
6
+ /cataloginventory
7
+ /catalogsearch
8
+ /centinel
9
+ /checkout
10
+ /cms
11
+ /contacts
12
+ /core
13
+ /customer
14
+ /directory
15
+ /downloadable
16
+ /email
17
+ /giftmessage
18
+ /googleanalytics
19
+ /googlecheckout
20
+ /moneybookers
21
+ /newsletter
22
+ /oauth
23
+ /page
24
+ /pagecache
25
+ /paygate
26
+ /payment
27
+ /paypal
28
+ /paypaluk
29
+ /persistent
30
+ /poll
31
+ /productalert
32
+ /rating
33
+ /reports
34
+ /review
35
+ /rss
36
+ /sales
37
+ /sendfriend
38
+ /shipping
39
+ /tag
40
+ /tax
41
+ /wishlist
42
+ /xmlconnect
app/design/frontend/base/default/template/litle/form/litlecc.phtml CHANGED
@@ -46,7 +46,7 @@ $_id = $_time . substr($_session,13);
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>
@@ -165,7 +165,6 @@ $_id = $_time . substr($_session,13);
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;
@@ -245,6 +244,5 @@ document.observe("dom:loaded", function() {
245
  submitAfterLitle();
246
  }
247
  };
248
- });
249
  </script>
250
  <?php endif; ?>
46
  <ul class="form-list" id="payment_form_<?php echo $_code ?>"
47
  style="display: none;">
48
 
49
+ <?php if($_isLoggedIn && $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>
165
 
166
  <?php if($this->getPaypageEnabled()):?>
167
  <script type="text/javascript">
 
168
  Payment.prototype.save = function() {
169
 
170
  var _saveUrl = this.saveUrl;
244
  submitAfterLitle();
245
  }
246
  };
 
247
  </script>
248
  <?php endif; ?>
app/etc/.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /config.xml
2
+ /local.xml.additional
3
+ /local.xml.template
4
+ /local.xml
app/etc/modules/.gitignore ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /Mage_All.xml
2
+ /Mage_Api.xml
3
+ /Mage_Api2.xml
4
+ /Mage_Authorizenet.xml
5
+ /Mage_Bundle.xml
6
+ /Mage_Captcha.xml
7
+ /Mage_Centinel.xml
8
+ /Mage_Compiler.xml
9
+ /Mage_Connect.xml
10
+ /Mage_CurrencySymbol.xml
11
+ /Mage_Downloadable.xml
12
+ /Mage_ImportExport.xml
13
+ /Mage_Oauth.xml
14
+ /Mage_PageCache.xml
15
+ /Mage_Persistent.xml
16
+ /Mage_Weee.xml
17
+ /Mage_Widget.xml
18
+ /Mage_XmlConnect.xml
19
+ /Phoenix_Moneybookers.xml
package.xml CHANGED
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><package><name>Litle_Payments</name><version>8.14.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>2012-11-16</date><time>17:09:28</time><contents><target name="magelocal"><dir name="Litle"><dir><dir name="LEcheck"><dir name="Block"><dir name="Form"><file hash="a60f23cc46bd35a45aa682324155d3fe" name="LEcheck.php"/></dir></dir><dir name="Helper"><file hash="2c2664ab694e0ba70e45157061a01436" name="Data.php"/></dir><dir name="etc"><file hash="e54518d4e8d5b9c25d6e14068236ec4d" 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="e31de9a4933a78435cf5173650cb65c3" name="LitleOnlineRequest.php"/><file hash="212bd38b2507f0f890cf1a161456e45f" name="Communication.php"/><file hash="7344e369d0b1a639dc5cd26b9a1fdbea" name="Setup.php"/><file hash="d254c8a71ee20f59d7699c09d9c9c174" 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="1cd0585e5d92329cf686e013b3a3870b" name="CreditCard.php"/></dir></dir><dir name="Helper"><file hash="5c022ff439721fabc61bc42fc51c6a51" name="Data.php"/></dir><dir name="etc"><file hash="6802cd6fcd4fb0ed9d0a9c73a904e56a" name="config.xml"/><file hash="86c5b777be1e8d9e7b5b4c1d3154ed22" name="system.xml"/></dir><dir name="Model"><file hash="00b1fdb98ecd344b76581fc98242c4e3" name="ValidateMerchantId.php"/><file hash="cf8f9d91ac8bf313aa8d97b865d719de" name="Cctypes.php"/><file hash="0626727ec55268fcaf6e33a55b3508d4" name="PaymentLogic.php"/><file hash="ce0ca23963d9eb05552528eb440d19fe" name="Url.php"/><dir name="Order"><file hash="7969e8ea26e6a721730465504d9271e8" 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="717b8b9040d24b466b4b32df2434d95e" name="MyformController.php"/><file hash="4e12464add381a9ca0b8d4b09feb4082" name="VaultController.php"/></dir><file hash="08a1373697b6f3dd8c9e6508573e87d7" name="VaultController.php"/></dir><dir name="Block"><dir name="Vault"><file hash="79ee52a8a899feffeddd4ae036de6bc9" name="List.php"/></dir><dir name="Adminhtml"><file hash="ed5e2fe4884bd645549d52b5c84c7b8e" name="Transaction.php"/><dir name="Palorus"><dir name="Insight"><file hash="3d85f19b92c87365f56b356706e60dcb" name="Failedtransactionshome.php"/><file hash="d85debd2ff5d4cce14c948875f8c5f44" name="Tab.php"/><file hash="88480b417f99e8b93a22a5f060374db8" name="Failedtransactions.php"/><file hash="8c4cf7970444d3e51b93c548bb0c2aea" name="Failedtransactionsview.php"/><file hash="7ffd05ce801a49b4ab9cde9c970a6bda" name="Grid.php"/></dir></dir><dir name="Customer"><dir name="Edit"><dir name="Tab"><file hash="16f272c9d87b6172610a576b2f4912f1" name="Vault.php"/></dir></dir></dir></dir><file hash="135de819b38ce7ff878c16b48e6b6545" name="Vault.php"/></dir><dir name="Helper"><file hash="e4bf0aa1363f1879d4526b498a78f7d1" name="Data.php"/></dir><dir name="etc"><file hash="4a6db754e0a4c0784907725ea138c8b6" name="config.xml"/></dir><dir name="Model"><file hash="696fcdb15789c67dee56425c7131c87b" name="Failedtransactions.php"/><file hash="837fd9a46dc1d2a9362742299818aa9f" name="Insight.php"/><file hash="ac7ef488ca780e35ca93e4daac20bdb1" name="Vault.php"/><dir name="Mysql4"><dir name="Vault"><file hash="ed26a7b3761a82ab96f040d233dfdda0" name="Collection.php"/></dir><dir name="Insight"><file hash="ce93a4bc5c69a69967a5a48b8f6a0a6f" name="Collection.php"/></dir><file hash="5a542d03ff8287113711a1f54a86d51f" name="Failedtransactions.php"/><file hash="b8faca9944ba3ccd28505b36a8485e50" name="Insight.php"/><file hash="d468febf17e1ab53bcd2848329662b56" name="Vault.php"/><dir name="Failedtransactions"><dir name="Grid"><file hash="e595f99d9d45041976973969a160de65" name="Collection.php"/></dir><file hash="22ffa1993e6c83677718c523dbb26130" name="Collection.php"/></dir></dir></dir><dir name="sql"><dir name="palorus_setup"><file hash="65e2cda8318d2e986c5644a802e66bf3" name="mysql4-install-8.13.0.php"/><file hash="bc7b843786f6c71b2012cd64203ed2d4" name="mysql4-upgrade-8.13.3-8.14.0.php"/><file hash="66bc35e477c287ee27ecefe6c18fda41" name="mysql4-upgrade-8.13.2-8.13.3.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="base"><dir name="default"><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="f47ebfd26147674f78b4d61fa150398c" name="litlecc.phtml"/><file hash="775224833051c1b7df7c32a626994ec0" name="litlejs.phtml"/></dir></dir></dir><dir name="layout"><file hash="2552fc3975e214bde25203cf16f66e7c" name="litlecreditcard.xml"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="litle"><dir name="form"><file hash="b9921c8126c2eab4a77bd4f120935753" name="litleecheck.phtml"/><file hash="c26146b155358c6a2e815f03a316b76b" name="litlecc.phtml"/><file hash="01ced0c103321c78a9aeb48780aedc3a" name="failedtransactions.phtml"/><file hash="6b65964f06d4ffc8bd73c5b0bc3a3487" name="failedtransactionsview.phtml"/></dir><dir name="customer"><dir name="tab"><file hash="33fd55b56e7a66011261eb4474dc3704" name="vault.phtml"/></dir></dir></dir></dir><dir name="layout"><file hash="b42e97feb8082098928265e136459ca2" 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" 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
  &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>