Version Notes
This extension implements Litle XML version 8.10
Download this release
Release Info
Developer | Litle |
Extension | Litle_Payments |
Version | 8.10.0 |
Comparing to | |
See all releases |
Version 8.10.0
- app/code/local/Litle/CreditCard/Model/PaymentLogic.php +296 -0
- app/code/local/Litle/CreditCard/Model/Url.php +27 -0
- app/code/local/Litle/CreditCard/Model/Validatehttp.php +34 -0
- app/code/local/Litle/CreditCard/etc/config.xml +50 -0
- app/code/local/Litle/CreditCard/etc/system.xml +114 -0
- app/code/local/Litle/LEcheck/Block/Form/LEcheck.php +26 -0
- app/code/local/Litle/LEcheck/Helper/Data.php +5 -0
- app/code/local/Litle/LEcheck/Model/Accounttypes.php +28 -0
- app/code/local/Litle/LEcheck/Model/Config.php +9 -0
- app/code/local/Litle/LEcheck/Model/PaymentLogic.php +291 -0
- app/code/local/Litle/LEcheck/Model/Transactiontypes.php +18 -0
- app/code/local/Litle/LEcheck/Model/Url.php +28 -0
- app/code/local/Litle/LEcheck/Model/Validatehttp.php +34 -0
- app/code/local/Litle/LEcheck/etc/config.xml +60 -0
- app/code/local/Litle/LEcheck/etc/system.xml +124 -0
- app/code/local/Litle/LitleSDK/Checker.php +52 -0
- app/code/local/Litle/LitleSDK/Communication.php +51 -0
- app/code/local/Litle/LitleSDK/LitleOnline.php +35 -0
- app/code/local/Litle/LitleSDK/LitleOnlineRequest.php +333 -0
- app/code/local/Litle/LitleSDK/LitleXmlMapper.php +41 -0
- app/code/local/Litle/LitleSDK/Obj2xml.php +97 -0
- app/code/local/Litle/LitleSDK/Setup.php +85 -0
- app/code/local/Litle/LitleSDK/XmlFields.php +432 -0
- app/code/local/Litle/LitleSDK/XmlParser.php +56 -0
- app/design/frontend/default/default/template/payment/form/litleecheck.phtml +35 -0
- app/etc/modules/Litle_All.xml +15 -0
- package.xml +27 -0
app/code/local/Litle/CreditCard/Model/PaymentLogic.php
ADDED
@@ -0,0 +1,296 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once('Litle/LitleSDK/LitleOnline.php');
|
3 |
+
|
4 |
+
class Litle_CreditCard_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
|
5 |
+
{
|
6 |
+
/**
|
7 |
+
* unique internal payment method identifier
|
8 |
+
*/
|
9 |
+
protected $_code = 'creditcard';
|
10 |
+
|
11 |
+
/**
|
12 |
+
* this should probably be true if you're using this
|
13 |
+
* method to take payments
|
14 |
+
*/
|
15 |
+
protected $_isGateway = true;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* can this method authorise?
|
19 |
+
*/
|
20 |
+
protected $_canAuthorize = true;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* can this method capture funds?
|
24 |
+
*/
|
25 |
+
protected $_canCapture = true;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* can we capture only partial amounts?
|
29 |
+
*/
|
30 |
+
protected $_canCapturePartial = true;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* can this method refund?
|
34 |
+
*/
|
35 |
+
protected $_canRefund = true;
|
36 |
+
|
37 |
+
protected $_canRefundInvoicePartial = true;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* can this method void transactions?
|
41 |
+
*/
|
42 |
+
protected $_canVoid = true;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* can admins use this payment method?
|
46 |
+
*/
|
47 |
+
protected $_canUseInternal = true;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* show this method on the checkout page
|
51 |
+
*/
|
52 |
+
protected $_canUseCheckout = true;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* available for multi shipping checkouts?
|
56 |
+
*/
|
57 |
+
protected $_canUseForMultishipping = true;
|
58 |
+
|
59 |
+
/**
|
60 |
+
* can this method save cc info for later use?
|
61 |
+
*/
|
62 |
+
protected $_canSaveCc = false;
|
63 |
+
|
64 |
+
|
65 |
+
public function getConfigData($fieldToLookFor, $store = NULL)
|
66 |
+
{
|
67 |
+
$returnFromThisModel = Mage::getStoreConfig('payment/CreditCard/' . $fieldToLookFor);
|
68 |
+
if( $returnFromThisModel == NULL )
|
69 |
+
$returnFromThisModel = parent::getConfigData($fieldToLookFor, $store);
|
70 |
+
|
71 |
+
return $returnFromThisModel;
|
72 |
+
}
|
73 |
+
|
74 |
+
public function getCreditCardInfo(Varien_Object $payment)
|
75 |
+
{
|
76 |
+
$retArray = array();
|
77 |
+
$retArray["type"] = $payment->getCcType();
|
78 |
+
$retArray["number"] = $payment->getCcNumber();
|
79 |
+
preg_match("/\d\d(\d\d)/", $payment->getCcExpYear(), $expYear);
|
80 |
+
$retArray["expDate"] = sprintf('%02d%02d', $payment->getCcExpMonth(), $expYear[1]);
|
81 |
+
$retArray["cardValidationNum"] = $payment->getCcCid();
|
82 |
+
|
83 |
+
return $retArray;
|
84 |
+
}
|
85 |
+
|
86 |
+
public function getContactInformation($contactInfo)
|
87 |
+
{
|
88 |
+
if(!empty($contactInfo)){
|
89 |
+
$retArray = array();
|
90 |
+
$retArray["firstName"] =$contactInfo->getFirstname();
|
91 |
+
$retArray["lastName"] = $contactInfo->getLastname();
|
92 |
+
$retArray["companyName"] = $contactInfo->getCompany();
|
93 |
+
$retArray["addressLine1"] = $contactInfo->getStreet(1);
|
94 |
+
$retArray["addressLine2"] = $contactInfo->getStreet(2);
|
95 |
+
$retArray["addressLine3"] = $contactInfo->getStreet(3);
|
96 |
+
$retArray["city"] = $contactInfo->getCity();
|
97 |
+
$retArray["state"] = $contactInfo->getRegion();
|
98 |
+
$retArray["zip"] = $contactInfo->getPostcode();
|
99 |
+
$retArray["country"] = $contactInfo->getCountry();
|
100 |
+
$retArray["email"] = $contactInfo->getCustomerEmail();
|
101 |
+
$retArray["phone"] = $contactInfo->getTelephone();
|
102 |
+
return $retArray;
|
103 |
+
}
|
104 |
+
return NULL;
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
public function getBillToAddress(Varien_Object $payment)
|
109 |
+
{
|
110 |
+
$order = $payment->getOrder();
|
111 |
+
if(!empty($order)){
|
112 |
+
$billing = $order ->getBillingAddress();
|
113 |
+
if(!empty($billing)){
|
114 |
+
return $this->getContactInformation($billing);
|
115 |
+
}
|
116 |
+
}
|
117 |
+
return NULL;
|
118 |
+
}
|
119 |
+
|
120 |
+
public function getShipToAddress(Varien_Object $payment)
|
121 |
+
{
|
122 |
+
$order = $payment->getOrder();
|
123 |
+
if(!empty($order)){
|
124 |
+
$shipping = $order->getShippingAddress();
|
125 |
+
if(!empty($shipping)){
|
126 |
+
return $this->getContactInformation($shipping);
|
127 |
+
}
|
128 |
+
}
|
129 |
+
return NULL;
|
130 |
+
}
|
131 |
+
|
132 |
+
public function merchantData(Varien_Object $payment)
|
133 |
+
{
|
134 |
+
$hash = array('user'=> $this->getConfigData("user"),
|
135 |
+
'password'=> $this->getConfigData("password"),
|
136 |
+
'merchantId'=>$this->getConfigData("merchant_id"),
|
137 |
+
'version'=>'8.10',
|
138 |
+
'reportGroup'=>$this->getConfigData("reportGroup"),
|
139 |
+
'url'=>$this->getConfigData("url"),
|
140 |
+
'proxy'=>$this->getConfigData("proxy"),
|
141 |
+
'timeout'=>$this->getConfigData("timeout")
|
142 |
+
);
|
143 |
+
return $hash;
|
144 |
+
}
|
145 |
+
|
146 |
+
public function processResponse(Varien_Object $payment,$litleResponse){
|
147 |
+
$message = XmlParser::getAttribute($litleResponse,'litleOnlineResponse','message');
|
148 |
+
if ($message == "Valid Format"){
|
149 |
+
$isSale = ($payment->getCcTransId() != NULL)? FALSE : TRUE;
|
150 |
+
if( isset($litleResponse))
|
151 |
+
{
|
152 |
+
$litleResponseCode = XMLParser::getNode($litleResponse,'response');
|
153 |
+
if($litleResponseCode != "000")
|
154 |
+
{
|
155 |
+
$payment
|
156 |
+
->setStatus("Rejected")
|
157 |
+
->setCcTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
|
158 |
+
->setLastTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
|
159 |
+
->setTransactionId(XMLParser::getNode($litleResponse,'litleTxnId'))
|
160 |
+
->setIsTransactionClosed(0)
|
161 |
+
->setTransactionAdditionalInfo(XMLParser::getNode($litleResponse,'message'));
|
162 |
+
|
163 |
+
if($isSale)
|
164 |
+
throw new Mage_Payment_Model_Info_Exception(Mage::helper('core')->__("Transaction was not approved. Contact us or try again later."));
|
165 |
+
else
|
166 |
+
throw new Mage_Payment_Model_Info_Exception(Mage::helper('core')->__("Transaction was not approved. Contact Litle or try again later."));
|
167 |
+
}
|
168 |
+
else
|
169 |
+
{
|
170 |
+
$payment
|
171 |
+
->setStatus("Approved")
|
172 |
+
->setCcTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
|
173 |
+
->setLastTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
|
174 |
+
->setTransactionId(XMLParser::getNode($litleResponse,'litleTxnId'))
|
175 |
+
->setIsTransactionClosed(0)
|
176 |
+
->setTransactionAdditionalInfo(XMLParser::getNode($litleResponse,'message'));
|
177 |
+
}
|
178 |
+
return $this;
|
179 |
+
}
|
180 |
+
}
|
181 |
+
else{
|
182 |
+
Mage::throwException($message);
|
183 |
+
}
|
184 |
+
}
|
185 |
+
/**
|
186 |
+
* this method is called if we are just authorising
|
187 |
+
* a transaction
|
188 |
+
*/
|
189 |
+
public function authorize(Varien_Object $payment, $amount)
|
190 |
+
{
|
191 |
+
$order = $payment->getOrder();
|
192 |
+
$orderId = $order->getIncrementId();
|
193 |
+
$amountToPass = ($amount* 100);
|
194 |
+
|
195 |
+
if (!empty($order)){
|
196 |
+
$hash = array(
|
197 |
+
'orderId'=> $orderId,
|
198 |
+
'amount'=> $amountToPass,
|
199 |
+
'orderSource'=> "ecommerce",
|
200 |
+
'billToAddress'=> $this->getBillToAddress($payment),
|
201 |
+
'shipToAddress'=> $this->getAddressInfo($payment),
|
202 |
+
'card'=> $this->getCreditCardInfo($payment)
|
203 |
+
);
|
204 |
+
$merchantData = $this->merchantData($payment);
|
205 |
+
$hash_in = array_merge($hash,$merchantData);
|
206 |
+
$litleRequest = new LitleOnlineRequest();
|
207 |
+
$litleResponse = $litleRequest->authorizationRequest($hash_in);
|
208 |
+
$this->processResponse($payment,$litleResponse);
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* this method is called if we are authorising AND
|
214 |
+
* capturing a transaction
|
215 |
+
*/
|
216 |
+
public function capture (Varien_Object $payment, $amount)
|
217 |
+
{
|
218 |
+
$order = $payment->getOrder();
|
219 |
+
if (!empty($order)){
|
220 |
+
|
221 |
+
$orderId =$order->getIncrementId();
|
222 |
+
$amountToPass = ($amount* 100);
|
223 |
+
$isPartialCapture = ($amount < $order->getGrandTotal()) ? "true" : "false";
|
224 |
+
$isSale = ($payment->getCcTransId() != NULL)? FALSE : TRUE;
|
225 |
+
|
226 |
+
if( !$isSale )
|
227 |
+
{
|
228 |
+
$hash = array(
|
229 |
+
'litleTxnId' => $payment->getParentTransactionId(),//getCcTransId(),
|
230 |
+
'amount' => $amountToPass,
|
231 |
+
'partial' => $isPartialCapture
|
232 |
+
);
|
233 |
+
} else {
|
234 |
+
$hash = array(
|
235 |
+
'orderId'=> $orderId,
|
236 |
+
'amount'=> $amountToPass,
|
237 |
+
'orderSource'=> "ecommerce",
|
238 |
+
'billToAddress'=> $this->getBillToAddress($payment),
|
239 |
+
'shipToAddress'=> $this->getAddressInfo($payment),
|
240 |
+
'card'=> $this->getCreditCardInfo($payment)
|
241 |
+
);
|
242 |
+
}
|
243 |
+
|
244 |
+
$merchantData = $this->merchantData($payment);
|
245 |
+
$hash_in = array_merge($hash,$merchantData);
|
246 |
+
$litleRequest = new LitleOnlineRequest();
|
247 |
+
|
248 |
+
if( $isSale )
|
249 |
+
{
|
250 |
+
$litleResponse = $litleRequest->saleRequest($hash_in);
|
251 |
+
} else {
|
252 |
+
$litleResponse = $litleRequest->captureRequest($hash_in);
|
253 |
+
}
|
254 |
+
}
|
255 |
+
$this->processResponse($payment,$litleResponse);
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* called if refunding
|
260 |
+
*/
|
261 |
+
public function refund (Varien_Object $payment, $amount)
|
262 |
+
{
|
263 |
+
$order = $payment->getOrder();
|
264 |
+
$amountToPass = ($amount* 100);
|
265 |
+
if (!empty($order)){
|
266 |
+
$hash = array(
|
267 |
+
'litleTxnId' => $payment->getCcTransId(),
|
268 |
+
'amount' => $amountToPass
|
269 |
+
);
|
270 |
+
$merchantData = $this->merchantData($payment);
|
271 |
+
$hash_in = array_merge($hash,$merchantData);
|
272 |
+
$litleRequest = new LitleOnlineRequest();
|
273 |
+
$litleResponse = $litleRequest->creditRequest($hash_in);
|
274 |
+
}
|
275 |
+
$this->processResponse($payment,$litleResponse);
|
276 |
+
return $this;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* called if voiding a payment
|
281 |
+
*/
|
282 |
+
public function void (Varien_Object $payment)
|
283 |
+
{
|
284 |
+
$order = $payment->getOrder();
|
285 |
+
if (!empty($order)){
|
286 |
+
$hash = array(
|
287 |
+
'litleTxnId' => $payment->getCcTransId()
|
288 |
+
);
|
289 |
+
$merchantData = $this->merchantData($payment);
|
290 |
+
$hash_in = array_merge($hash,$merchantData);
|
291 |
+
$litleRequest = new LitleOnlineRequest();
|
292 |
+
$litleResponse = $litleRequest->voidRequest($hash_in);
|
293 |
+
}
|
294 |
+
$this->processResponse($payment,$litleResponse);
|
295 |
+
}
|
296 |
+
}
|
app/code/local/Litle/CreditCard/Model/Url.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Litle_CreditCard_Model_URL
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array(
|
9 |
+
'value' => "https://www.testlitle.com/sandbox/communicator/online",
|
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 |
+
}
|
27 |
+
}
|
app/code/local/Litle/CreditCard/Model/Validatehttp.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Litle_CreditCard_Model_Validatehttp extends Mage_Core_Model_Config_Data
|
3 |
+
{
|
4 |
+
public function getFieldsetDataValue($key)
|
5 |
+
{
|
6 |
+
$data = $this->_getData('fieldset_data');
|
7 |
+
return (is_array($data) && isset($data[$key])) ? $data[$key] : null;
|
8 |
+
}
|
9 |
+
function save(){
|
10 |
+
if ($this->getFieldsetDataValue('active'))
|
11 |
+
{
|
12 |
+
$ch = curl_init();
|
13 |
+
curl_setopt($ch, CURLOPT_PROXY, $this->getFieldsetDataValue('proxy'));
|
14 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
15 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/xml'));
|
16 |
+
curl_setopt($ch, CURLOPT_URL, $this->getFieldsetDataValue('url'));
|
17 |
+
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
|
18 |
+
curl_setopt($ch,CURLOPT_TIMEOUT,'5');
|
19 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
|
20 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,2);
|
21 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
22 |
+
$output = curl_exec($ch);
|
23 |
+
|
24 |
+
if (! $output){
|
25 |
+
Mage::throwException('Error connecting to Litle. Make sure your HTTP configuration settings are correct.');
|
26 |
+
}
|
27 |
+
else
|
28 |
+
{
|
29 |
+
curl_close($ch);
|
30 |
+
}
|
31 |
+
return parent::save();
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
app/code/local/Litle/CreditCard/etc/config.xml
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Litle_CreditCard>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Litle_CreditCard>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<creditcard>
|
11 |
+
<class>Litle_CreditCard_Model</class>
|
12 |
+
</creditcard>
|
13 |
+
</models>
|
14 |
+
<resources>
|
15 |
+
<creditcard_setup>
|
16 |
+
<setup>
|
17 |
+
<module>Litle_CreditCard</module>
|
18 |
+
</setup>
|
19 |
+
<connection>
|
20 |
+
<use>core_setup</use>
|
21 |
+
</connection>
|
22 |
+
</creditcard_setup>
|
23 |
+
<creditcard_write>
|
24 |
+
<connection>
|
25 |
+
<use>core_write</use>
|
26 |
+
</connection>
|
27 |
+
</creditcard_write>
|
28 |
+
<creditcard_read>
|
29 |
+
<connection>
|
30 |
+
<use>core_read</use>
|
31 |
+
</connection>
|
32 |
+
</creditcard_read>
|
33 |
+
</resources>
|
34 |
+
</global>
|
35 |
+
<default>
|
36 |
+
<payment>
|
37 |
+
<creditcard>
|
38 |
+
<active>1</active>
|
39 |
+
<timeout>65</timeout>
|
40 |
+
<url>https://www.testlitle.com/sandbox/communicator/online</url>
|
41 |
+
<model>creditcard/paymentLogic</model>
|
42 |
+
<order_status>pending</order_status>
|
43 |
+
<title>Credit Card (Litle Payment)</title>
|
44 |
+
<cctypes>AE,VI,MC,DI</cctypes>
|
45 |
+
<payment_action>authorize</payment_action>
|
46 |
+
<allowspecific>0</allowspecific>
|
47 |
+
</creditcard>
|
48 |
+
</payment>
|
49 |
+
</default>
|
50 |
+
</config>
|
app/code/local/Litle/CreditCard/etc/system.xml
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<payment>
|
5 |
+
<groups>
|
6 |
+
<CreditCard translate="label" module="paygate">
|
7 |
+
<label>Litle - Credit Card</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>1</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>1</show_in_store>
|
13 |
+
<fields>
|
14 |
+
<active translate="label">
|
15 |
+
<label>Enabled</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>1</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>0</show_in_store>
|
22 |
+
</active>
|
23 |
+
<title translate="label">
|
24 |
+
<label>Title</label>
|
25 |
+
<frontend_type>text</frontend_type>
|
26 |
+
<sort_order>2</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>1</show_in_website>
|
29 |
+
<show_in_store>1</show_in_store>
|
30 |
+
</title>
|
31 |
+
<user translate="label">
|
32 |
+
<label>User</label>
|
33 |
+
<frontend_type>text</frontend_type>
|
34 |
+
<sort_order>3</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>0</show_in_store>
|
38 |
+
</user>
|
39 |
+
<password translate="label">
|
40 |
+
<label>Password</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>4</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>0</show_in_store>
|
46 |
+
</password>
|
47 |
+
<merchant_id translate="label">
|
48 |
+
<label>Merchant ID</label>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>5</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>0</show_in_store>
|
54 |
+
</merchant_id>
|
55 |
+
<reportGroup translate="label">
|
56 |
+
<label>Report Group</label>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<sort_order>6</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>0</show_in_store>
|
62 |
+
</reportGroup>
|
63 |
+
<proxy translate="label">
|
64 |
+
<label>HTTP Proxy</label>
|
65 |
+
<frontend_type>text</frontend_type>
|
66 |
+
<sort_order>9</sort_order>
|
67 |
+
<backend_model>creditcard/validatehttp</backend_model>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>0</show_in_store>
|
71 |
+
</proxy>
|
72 |
+
<timeout translate="label">
|
73 |
+
<label>HTTP Timeout</label>
|
74 |
+
<frontend_type>text</frontend_type>
|
75 |
+
<sort_order>10</sort_order>
|
76 |
+
<show_in_default>1</show_in_default>
|
77 |
+
<show_in_website>1</show_in_website>
|
78 |
+
<show_in_store>0</show_in_store>
|
79 |
+
</timeout>
|
80 |
+
<url translate="label">
|
81 |
+
<label>HTTP URL</label>
|
82 |
+
<frontend_type>select</frontend_type>
|
83 |
+
<source_model>creditcard/url</source_model>
|
84 |
+
<sort_order>8</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>0</show_in_store>
|
88 |
+
</url>
|
89 |
+
<payment_action translate="label">
|
90 |
+
<label>Payment Action</label>
|
91 |
+
<frontend_type>select</frontend_type>
|
92 |
+
<source_model>paygate/authorizenet_source_paymentAction
|
93 |
+
</source_model>
|
94 |
+
<sort_order>7</sort_order>
|
95 |
+
<show_in_default>1</show_in_default>
|
96 |
+
<show_in_website>1</show_in_website>
|
97 |
+
<show_in_store>0</show_in_store>
|
98 |
+
</payment_action>
|
99 |
+
<order_status translate="label">
|
100 |
+
<label>New Order Status</label>
|
101 |
+
<frontend_type>select</frontend_type>
|
102 |
+
<source_model>adminhtml/system_config_source_order_status_processing
|
103 |
+
</source_model>
|
104 |
+
<sort_order>7</sort_order>
|
105 |
+
<show_in_default>1</show_in_default>
|
106 |
+
<show_in_website>1</show_in_website>
|
107 |
+
<show_in_store>0</show_in_store>
|
108 |
+
</order_status>
|
109 |
+
</fields>
|
110 |
+
</CreditCard>
|
111 |
+
</groups>
|
112 |
+
</payment>
|
113 |
+
</sections>
|
114 |
+
</config>
|
app/code/local/Litle/LEcheck/Block/Form/LEcheck.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Litle_LEcheck_Block_Form_LEcheck extends Mage_Payment_Block_Form
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->setTemplate('payment/form/litleecheck.phtml');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function getAccountAvailableTypes()
|
11 |
+
{
|
12 |
+
$types = array('Checking' => 'Checking', 'Savings' => 'Savings','Corporate'=>'Corporate','Corp Savings' => 'Corp Savings');
|
13 |
+
if ($method = $this->getMethod()) {
|
14 |
+
$availableTypes = $method->getConfigData('accounttypes');
|
15 |
+
if ($availableTypes) {
|
16 |
+
$availableTypes = explode(',', $availableTypes);
|
17 |
+
foreach ($types as $code=>$name) {
|
18 |
+
if (!in_array($code, $availableTypes)) {
|
19 |
+
unset($types[$code]);
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
24 |
+
return $types;
|
25 |
+
}
|
26 |
+
}
|
app/code/local/Litle/LEcheck/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Litle_LEcheck_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
}
|
app/code/local/Litle/LEcheck/Model/Accounttypes.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Litle_LEcheck_Model_Accounttypes
|
3 |
+
{
|
4 |
+
public function getAllowedTypes()
|
5 |
+
{
|
6 |
+
return array('Checking','Savings', 'Corporate', 'Corp Savings');
|
7 |
+
}
|
8 |
+
|
9 |
+
public function toOptionArray()
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* making filter by allowed cards
|
13 |
+
*/
|
14 |
+
$allowed = $this->getAllowedTypes();
|
15 |
+
$options = array();
|
16 |
+
|
17 |
+
foreach (Mage::getSingleton('lecheck/config')->getAccountTypes() as $code => $name) {
|
18 |
+
if (in_array($code, $allowed) || !count($allowed)) {
|
19 |
+
$options[] = array(
|
20 |
+
'value' => $code,
|
21 |
+
'label' => $name
|
22 |
+
);
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
return $options;
|
27 |
+
}
|
28 |
+
}
|
app/code/local/Litle/LEcheck/Model/Config.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Litle_LEcheck_Model_Config
|
3 |
+
{
|
4 |
+
public function getAccountTypes()
|
5 |
+
{
|
6 |
+
$types = array('Checking' => 'Checking', 'Savings' => 'Savings','Corporate'=>'Corporate','Corp Savings' => 'Corp Savings');
|
7 |
+
return $types;
|
8 |
+
}
|
9 |
+
}
|
app/code/local/Litle/LEcheck/Model/PaymentLogic.php
ADDED
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once('Litle/LitleSDK/LitleOnline.php');
|
3 |
+
|
4 |
+
class Litle_LEcheck_Model_PaymentLogic extends Mage_Payment_Model_Method_Abstract
|
5 |
+
{
|
6 |
+
/**
|
7 |
+
* unique internal payment method identifier
|
8 |
+
*/
|
9 |
+
protected $_code = 'lecheck';
|
10 |
+
|
11 |
+
protected $_formBlockType = 'lecheck/form_lEcheck';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* this should probably be true if you're using this
|
15 |
+
* method to take payments
|
16 |
+
*/
|
17 |
+
protected $_isGateway = true;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* can this method authorise?
|
21 |
+
*/
|
22 |
+
protected $_canAuthorize = true;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* can this method capture funds?
|
26 |
+
*/
|
27 |
+
protected $_canCapture = true;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* can we capture only partial amounts?
|
31 |
+
*/
|
32 |
+
protected $_canCapturePartial = true;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* can this method refund?
|
36 |
+
*/
|
37 |
+
protected $_canRefund = true;
|
38 |
+
|
39 |
+
protected $_canRefundInvoicePartial = true;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* can this method void transactions?
|
43 |
+
*/
|
44 |
+
protected $_canVoid = true;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* can admins use this payment method?
|
48 |
+
*/
|
49 |
+
protected $_canUseInternal = true;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* show this method on the checkout page
|
53 |
+
*/
|
54 |
+
protected $_canUseCheckout = true;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* available for multi shipping checkouts?
|
58 |
+
*/
|
59 |
+
protected $_canUseForMultishipping = true;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* can this method save cc info for later use?
|
63 |
+
*/
|
64 |
+
protected $_canSaveCc = false;
|
65 |
+
|
66 |
+
|
67 |
+
public function assignData($data)
|
68 |
+
{
|
69 |
+
if (!($data instanceof Varien_Object)) {
|
70 |
+
$data = new Varien_Object($data);
|
71 |
+
}
|
72 |
+
|
73 |
+
$info = $this->getInfoInstance();
|
74 |
+
$info->setAdditionalInformation('echeck_routing_num', $data->getEcheckRoutingNumber());
|
75 |
+
$info->setAdditionalInformation('echeck_bank_acc_num', $data->getEcheckBankAcctNum());
|
76 |
+
$info->setAdditionalInformation('echeck_acc_type', $data->getEcheckAccountType());
|
77 |
+
|
78 |
+
return $this;
|
79 |
+
}
|
80 |
+
|
81 |
+
public function getConfigData($fieldToLookFor, $store = NULL)
|
82 |
+
{
|
83 |
+
$returnFromThisModel = Mage::getStoreConfig('payment/LitleEcheck/' . $fieldToLookFor);
|
84 |
+
if( $returnFromThisModel == NULL )
|
85 |
+
$returnFromThisModel = parent::getConfigData($fieldToLookFor, $store);
|
86 |
+
|
87 |
+
return $returnFromThisModel;
|
88 |
+
}
|
89 |
+
|
90 |
+
public function getEcheckInfo(Varien_Object $payment)
|
91 |
+
{
|
92 |
+
$info = $this->getInfoInstance();
|
93 |
+
$retArray = array();
|
94 |
+
$retArray["accNum"] = $info->getAdditionalInformation('echeck_bank_acc_num');
|
95 |
+
$retArray["accType"] = $info->getAdditionalInformation('echeck_acc_type');
|
96 |
+
$retArray["routingNum"] = $info->getAdditionalInformation('echeck_routing_num');
|
97 |
+
return $retArray;
|
98 |
+
}
|
99 |
+
|
100 |
+
public function getContactInformation($contactInfo)
|
101 |
+
{
|
102 |
+
if(!empty($contactInfo)){
|
103 |
+
$retArray = array();
|
104 |
+
$retArray["firstName"] =$contactInfo->getFirstname();
|
105 |
+
$retArray["lastName"] = $contactInfo->getLastname();
|
106 |
+
$retArray["companyName"] = $contactInfo->getCompany();
|
107 |
+
$retArray["addressLine1"] = $contactInfo->getStreet(1);
|
108 |
+
$retArray["addressLine2"] = $contactInfo->getStreet(2);
|
109 |
+
$retArray["addressLine3"] = $contactInfo->getStreet(3);
|
110 |
+
$retArray["city"] = $contactInfo->getCity();
|
111 |
+
$retArray["state"] = $contactInfo->getRegion();
|
112 |
+
$retArray["zip"] = $contactInfo->getPostcode();
|
113 |
+
$retArray["country"] = $contactInfo->getCountry();
|
114 |
+
$retArray["email"] = $contactInfo->getCustomerEmail();
|
115 |
+
$retArray["phone"] = $contactInfo->getTelephone();
|
116 |
+
return $retArray;
|
117 |
+
}
|
118 |
+
return NULL;
|
119 |
+
}
|
120 |
+
|
121 |
+
|
122 |
+
public function getBillToAddress(Varien_Object $payment)
|
123 |
+
{
|
124 |
+
$order = $payment->getOrder();
|
125 |
+
if(!empty($order)){
|
126 |
+
$billing = $order ->getBillingAddress();
|
127 |
+
if(!empty($billing)){
|
128 |
+
return $this->getContactInformation($billing);
|
129 |
+
}
|
130 |
+
}
|
131 |
+
return NULL;
|
132 |
+
}
|
133 |
+
|
134 |
+
public function getShipToAddress(Varien_Object $payment)
|
135 |
+
{
|
136 |
+
$order = $payment->getOrder();
|
137 |
+
if(!empty($order)){
|
138 |
+
$shipping = $order->getShippingAddress();
|
139 |
+
if(!empty($shipping)){
|
140 |
+
return $this->getContactInformation($shipping);
|
141 |
+
}
|
142 |
+
}
|
143 |
+
return NULL;
|
144 |
+
}
|
145 |
+
|
146 |
+
public function merchantData(Varien_Object $payment)
|
147 |
+
{
|
148 |
+
$hash = array('user'=> $this->getConfigData("user"),
|
149 |
+
'password'=> $this->getConfigData("password"),
|
150 |
+
'merchantId'=>$this->getConfigData("merchant_id"),
|
151 |
+
'version'=>'8.10',
|
152 |
+
'reportGroup'=>$this->getConfigData("reportGroup"),
|
153 |
+
'url'=>$this->getConfigData("url"),
|
154 |
+
'proxy'=>$this->getConfigData("proxy"),
|
155 |
+
'timeout'=>$this->getConfigData("timeout")
|
156 |
+
);
|
157 |
+
return $hash;
|
158 |
+
}
|
159 |
+
|
160 |
+
public function processResponse(Varien_Object $payment,$litleResponse){
|
161 |
+
$message = XmlParser::getAttribute($litleResponse,'litleOnlineResponse','message');
|
162 |
+
if ($message == "Valid Format"){
|
163 |
+
if( isset($litleResponse))
|
164 |
+
{
|
165 |
+
$litleResponseCode = XMLParser::getNode($litleResponse,'response');
|
166 |
+
if($litleResponseCode != "000")
|
167 |
+
{
|
168 |
+
$payment
|
169 |
+
->setStatus("Rejected")
|
170 |
+
->setCcTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
|
171 |
+
->setLastTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
|
172 |
+
->setTransactionId(XMLParser::getNode($litleResponse,'litleTxnId'))
|
173 |
+
->setIsTransactionClosed(0)
|
174 |
+
->setTransactionAdditionalInfo(XMLParser::getNode($litleResponse,'message'));
|
175 |
+
|
176 |
+
throw new Mage_Payment_Model_Info_Exception(Mage::helper('core')->__("Transaction was not approved. Contact us or try again later."));
|
177 |
+
}
|
178 |
+
else
|
179 |
+
{
|
180 |
+
$payment
|
181 |
+
->setStatus("Approved")
|
182 |
+
->setCcTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
|
183 |
+
->setLastTransId(XMLParser::getNode($litleResponse,'litleTxnId'))
|
184 |
+
->setTransactionId(XMLParser::getNode($litleResponse,'litleTxnId'))
|
185 |
+
->setIsTransactionClosed(0)
|
186 |
+
->setTransactionAdditionalInfo(XMLParser::getNode($litleResponse,'message'));
|
187 |
+
}
|
188 |
+
return $this;
|
189 |
+
}
|
190 |
+
}
|
191 |
+
else{
|
192 |
+
Mage::throwException($message);
|
193 |
+
}
|
194 |
+
}
|
195 |
+
/**
|
196 |
+
* this method is called if we are just authorising
|
197 |
+
* a transaction
|
198 |
+
*/
|
199 |
+
public function authorize(Varien_Object $payment, $amount)
|
200 |
+
{
|
201 |
+
$order = $payment->getOrder();
|
202 |
+
$orderId = $order->getIncrementId();
|
203 |
+
$amountToPass = ($amount* 100);
|
204 |
+
|
205 |
+
if (!empty($order)){
|
206 |
+
$hash = array(
|
207 |
+
'orderId'=> $orderId,
|
208 |
+
'amount'=> $amountToPass,
|
209 |
+
'orderSource'=> "ecommerce",
|
210 |
+
'verify'=>'true',
|
211 |
+
'billToAddress'=> $this->getBillToAddress($payment),
|
212 |
+
'shipToAddress'=> $this->getAddressInfo($payment),
|
213 |
+
'echeck'=> $this->getEcheckInfo($payment)
|
214 |
+
);
|
215 |
+
$merchantData = $this->merchantData($payment);
|
216 |
+
$hash_in = array_merge($hash,$merchantData);
|
217 |
+
$litleRequest = new LitleOnlineRequest();
|
218 |
+
$litleResponse = $litleRequest->echeckVerificationRequest($hash_in);
|
219 |
+
$this->processResponse($payment,$litleResponse);
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* this method is called if we are authorising AND
|
225 |
+
* capturing a transaction
|
226 |
+
*/
|
227 |
+
public function capture (Varien_Object $payment, $amount)
|
228 |
+
{
|
229 |
+
$order = $payment->getOrder();
|
230 |
+
$orderId =$order->getIncrementId();
|
231 |
+
$amountToPass = ($amount* 100);
|
232 |
+
|
233 |
+
if (!empty($order)){
|
234 |
+
$hash = array(
|
235 |
+
'orderId'=> $orderId,
|
236 |
+
'amount'=> $amountToPass,
|
237 |
+
'orderSource'=> "ecommerce",
|
238 |
+
'verify'=>'true',
|
239 |
+
'billToAddress'=> $this->getBillToAddress($payment),
|
240 |
+
'shipToAddress'=> $this->getAddressInfo($payment),
|
241 |
+
'echeck'=> $this->getEcheckInfo($payment)
|
242 |
+
);
|
243 |
+
$merchantData = $this->merchantData($payment);
|
244 |
+
$hash_in = array_merge($hash,$merchantData);
|
245 |
+
$litleRequest = new LitleOnlineRequest();
|
246 |
+
$litleResponse = $litleRequest->echeckSaleRequest($hash_in);
|
247 |
+
}
|
248 |
+
$this->processResponse($payment,$litleResponse);
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* called if refunding
|
253 |
+
*/
|
254 |
+
public function refund (Varien_Object $payment, $amount)
|
255 |
+
{
|
256 |
+
$order = $payment->getOrder();
|
257 |
+
$amountToPass = ($amount* 100);
|
258 |
+
if (!empty($order)){
|
259 |
+
$hash = array(
|
260 |
+
'litleTxnId' => $payment->getCcTransId(),
|
261 |
+
'amount' => $amountToPass
|
262 |
+
);
|
263 |
+
|
264 |
+
$merchantData = $this->merchantData($payment);
|
265 |
+
$hash_in = array_merge($hash,$merchantData);
|
266 |
+
$litleRequest = new LitleOnlineRequest();
|
267 |
+
$litleResponse = $litleRequest->echeckCreditRequest($hash_in);
|
268 |
+
}
|
269 |
+
|
270 |
+
$this->processResponse($payment,$litleResponse);
|
271 |
+
return $this;
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* called if voiding a payment
|
276 |
+
*/
|
277 |
+
public function void (Varien_Object $payment)
|
278 |
+
{
|
279 |
+
$order = $payment->getOrder();
|
280 |
+
if (!empty($order)){
|
281 |
+
$hash = array(
|
282 |
+
'litleTxnId' => $payment->getCcTransId()
|
283 |
+
);
|
284 |
+
$merchantData = $this->merchantData($payment);
|
285 |
+
$hash_in = array_merge($hash,$merchantData);
|
286 |
+
$litleRequest = new LitleOnlineRequest();
|
287 |
+
$litleResponse = $litleRequest->echeckVoidRequest($hash_in);
|
288 |
+
}
|
289 |
+
$this->processResponse($payment,$litleResponse);
|
290 |
+
}
|
291 |
+
}
|
app/code/local/Litle/LEcheck/Model/Transactiontypes.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Litle_LEcheck_Model_Transactiontypes
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array(
|
9 |
+
'value' => Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE,
|
10 |
+
'label' => 'Verification'
|
11 |
+
),
|
12 |
+
array(
|
13 |
+
'value' => Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE_CAPTURE,
|
14 |
+
'label' => 'Sale'
|
15 |
+
),
|
16 |
+
);
|
17 |
+
}
|
18 |
+
}
|
app/code/local/Litle/LEcheck/Model/Url.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Litle_LEcheck_Model_URL
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
|
9 |
+
array(
|
10 |
+
'value' => "https://www.testlitle.com/sandbox/communicator/online",
|
11 |
+
'label' => 'Sandbox'
|
12 |
+
),
|
13 |
+
array(
|
14 |
+
'value' => "https://cert.litle.com/vap/communicator/online",
|
15 |
+
'label' => 'Cert'
|
16 |
+
),
|
17 |
+
array(
|
18 |
+
'value' => "https://precert.litle.com/vap/communicator/online",
|
19 |
+
'label' => 'PreCert'
|
20 |
+
),
|
21 |
+
array(
|
22 |
+
'value' => "https://payments.litle.com/vap/communicator/online",
|
23 |
+
'label' => 'Production'
|
24 |
+
)
|
25 |
+
);
|
26 |
+
|
27 |
+
}
|
28 |
+
}
|
app/code/local/Litle/LEcheck/Model/Validatehttp.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Litle_LEcheck_Model_Validatehttp extends Mage_Core_Model_Config_Data
|
3 |
+
{
|
4 |
+
public function getFieldsetDataValue($key)
|
5 |
+
{
|
6 |
+
$data = $this->_getData('fieldset_data');
|
7 |
+
return (is_array($data) && isset($data[$key])) ? $data[$key] : null;
|
8 |
+
}
|
9 |
+
function save(){
|
10 |
+
if ($this->getFieldsetDataValue('active'))
|
11 |
+
{
|
12 |
+
$ch = curl_init();
|
13 |
+
curl_setopt($ch, CURLOPT_PROXY, $this->getFieldsetDataValue('proxy'));
|
14 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
15 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/xml'));
|
16 |
+
curl_setopt($ch, CURLOPT_URL, $this->getFieldsetDataValue('url'));
|
17 |
+
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
|
18 |
+
curl_setopt($ch,CURLOPT_TIMEOUT,'5');
|
19 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
|
20 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,2);
|
21 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
22 |
+
$output = curl_exec($ch);
|
23 |
+
|
24 |
+
if (! $output){
|
25 |
+
Mage::throwException('Error connecting to Litle. Make sure your HTTP configuration settings are correct.');
|
26 |
+
}
|
27 |
+
else
|
28 |
+
{
|
29 |
+
curl_close($ch);
|
30 |
+
}
|
31 |
+
return parent::save();
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
app/code/local/Litle/LEcheck/etc/config.xml
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Litle_LEcheck>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Litle_LEcheck>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<lecheck>
|
11 |
+
<class>Litle_LEcheck_Block</class>
|
12 |
+
</lecheck>
|
13 |
+
</blocks>
|
14 |
+
<helpers>
|
15 |
+
<lecheck>
|
16 |
+
<class>Litle_LEcheck_Helper</class>
|
17 |
+
</lecheck>
|
18 |
+
</helpers>
|
19 |
+
<models>
|
20 |
+
<lecheck>
|
21 |
+
<class>Litle_LEcheck_Model</class>
|
22 |
+
</lecheck>
|
23 |
+
</models>
|
24 |
+
<resources>
|
25 |
+
<lecheck_setup>
|
26 |
+
<setup>
|
27 |
+
<module>Litle_LEcheck</module>
|
28 |
+
</setup>
|
29 |
+
<connection>
|
30 |
+
<use>core_setup</use>
|
31 |
+
</connection>
|
32 |
+
</lecheck_setup>
|
33 |
+
<lecheck_write>
|
34 |
+
<connection>
|
35 |
+
<use>core_write</use>
|
36 |
+
</connection>
|
37 |
+
</lecheck_write>
|
38 |
+
<lecheck_read>
|
39 |
+
<connection>
|
40 |
+
<use>core_read</use>
|
41 |
+
</connection>
|
42 |
+
</lecheck_read>
|
43 |
+
</resources>
|
44 |
+
</global>
|
45 |
+
<default>
|
46 |
+
<payment>
|
47 |
+
<lecheck>
|
48 |
+
<active>1</active>
|
49 |
+
<timeout>65</timeout>
|
50 |
+
<url>https://www.testlitle.com/sandbox/communicator/online</url>
|
51 |
+
<model>lecheck/paymentLogic</model>
|
52 |
+
<order_status>1</order_status>
|
53 |
+
<payment_action>authorize</payment_action>
|
54 |
+
<test>1</test>
|
55 |
+
<title>Litle Echeck</title>
|
56 |
+
<allowspecific>0</allowspecific>
|
57 |
+
</lecheck>
|
58 |
+
</payment>
|
59 |
+
</default>
|
60 |
+
</config>
|
app/code/local/Litle/LEcheck/etc/system.xml
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<payment>
|
5 |
+
<groups>
|
6 |
+
<LEcheck translate="label" module="paygate">
|
7 |
+
<label>Litle - Echeck</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>1</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>1</show_in_store>
|
13 |
+
<fields>
|
14 |
+
<active translate="label">
|
15 |
+
<label>Enabled</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>1</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>0</show_in_store>
|
22 |
+
</active>
|
23 |
+
<title translate="label">
|
24 |
+
<label>Title</label>
|
25 |
+
<frontend_type>text</frontend_type>
|
26 |
+
<sort_order>1</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>1</show_in_website>
|
29 |
+
<show_in_store>1</show_in_store>
|
30 |
+
</title>
|
31 |
+
<accounttypes translate="label">
|
32 |
+
<label>Account Types</label>
|
33 |
+
<frontend_type>multiselect</frontend_type>
|
34 |
+
<source_model>lecheck/accounttypes
|
35 |
+
</source_model>
|
36 |
+
<sort_order>15</sort_order>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>1</show_in_website>
|
39 |
+
<show_in_store>0</show_in_store>
|
40 |
+
</accounttypes>
|
41 |
+
<user translate="label">
|
42 |
+
<label>User</label>
|
43 |
+
<frontend_type>text</frontend_type>
|
44 |
+
<sort_order>3</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>0</show_in_store>
|
48 |
+
</user>
|
49 |
+
<password translate="label">
|
50 |
+
<label>Password</label>
|
51 |
+
<frontend_type>text</frontend_type>
|
52 |
+
<sort_order>4</sort_order>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>1</show_in_website>
|
55 |
+
<show_in_store>0</show_in_store>
|
56 |
+
</password>
|
57 |
+
<merchant_id translate="label">
|
58 |
+
<label>Merchant ID</label>
|
59 |
+
<frontend_type>text</frontend_type>
|
60 |
+
<sort_order>5</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>0</show_in_store>
|
64 |
+
</merchant_id>
|
65 |
+
<reportGroup translate="label">
|
66 |
+
<label>Report Group</label>
|
67 |
+
<frontend_type>text</frontend_type>
|
68 |
+
<sort_order>6</sort_order>
|
69 |
+
<show_in_default>1</show_in_default>
|
70 |
+
<show_in_website>1</show_in_website>
|
71 |
+
<show_in_store>0</show_in_store>
|
72 |
+
</reportGroup>
|
73 |
+
<proxy translate="label">
|
74 |
+
<label>Http Proxy</label>
|
75 |
+
<frontend_type>text</frontend_type>
|
76 |
+
<sort_order>8</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>0</show_in_store>
|
80 |
+
</proxy>
|
81 |
+
<timeout translate="label">
|
82 |
+
<label>HTTP Timeout</label>
|
83 |
+
<frontend_type>text</frontend_type>
|
84 |
+
<sort_order>9</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>0</show_in_store>
|
88 |
+
</timeout>
|
89 |
+
<url translate="label">
|
90 |
+
<label>HTTP URL</label>
|
91 |
+
<frontend_type>select</frontend_type>
|
92 |
+
<source_model>lecheck/url</source_model>
|
93 |
+
<backend_model>lecheck/validatehttp</backend_model>
|
94 |
+
<sort_order>7</sort_order>
|
95 |
+
<show_in_default>1</show_in_default>
|
96 |
+
<show_in_website>1</show_in_website>
|
97 |
+
<show_in_store>0</show_in_store>
|
98 |
+
</url>
|
99 |
+
<payment_action translate="label">
|
100 |
+
<label>Payment Action</label>
|
101 |
+
<frontend_type>select</frontend_type>
|
102 |
+
<source_model>lecheck/transactiontypes
|
103 |
+
</source_model>
|
104 |
+
<sort_order>7</sort_order>
|
105 |
+
<show_in_default>1</show_in_default>
|
106 |
+
<show_in_website>1</show_in_website>
|
107 |
+
<show_in_store>0</show_in_store>
|
108 |
+
</payment_action>
|
109 |
+
<order_status translate="label">
|
110 |
+
<label>New Order Status</label>
|
111 |
+
<frontend_type>select</frontend_type>
|
112 |
+
<source_model>adminhtml/system_config_source_order_status_processing
|
113 |
+
</source_model>
|
114 |
+
<sort_order>7</sort_order>
|
115 |
+
<show_in_default>1</show_in_default>
|
116 |
+
<show_in_website>1</show_in_website>
|
117 |
+
<show_in_store>0</show_in_store>
|
118 |
+
</order_status>
|
119 |
+
</fields>
|
120 |
+
</LEcheck>
|
121 |
+
</groups>
|
122 |
+
</payment>
|
123 |
+
</sections>
|
124 |
+
</config>
|
app/code/local/Litle/LitleSDK/Checker.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2011 Litle & Co.
|
4 |
+
*
|
5 |
+
* Permission is hereby granted, free of charge, to any person
|
6 |
+
* obtaining a copy of this software and associated documentation
|
7 |
+
* files (the "Software"), to deal in the Software without
|
8 |
+
* restriction, including without limitation the rights to use,
|
9 |
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
+
* copies of the Software, and to permit persons to whom the
|
11 |
+
* Software is furnished to do so, subject to the following
|
12 |
+
* conditions:
|
13 |
+
*
|
14 |
+
* The above copyright notice and this permission notice shall be
|
15 |
+
* included in all copies or substantial portions of the Software.
|
16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
|
17 |
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18 |
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19 |
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20 |
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22 |
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23 |
+
* OTHER DEALINGS IN THE SOFTWARE.
|
24 |
+
*/
|
25 |
+
class Checker
|
26 |
+
{
|
27 |
+
function requiredField($value)
|
28 |
+
{
|
29 |
+
if ($value != null)
|
30 |
+
{
|
31 |
+
return $value;
|
32 |
+
}
|
33 |
+
else
|
34 |
+
{
|
35 |
+
return "REQUIRED";
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
function choice($choiceArray)
|
40 |
+
{
|
41 |
+
$i= 0;
|
42 |
+
for($y=0;$y<count($choiceArray);$y++){
|
43 |
+
if (isset($choiceArray[$y])){
|
44 |
+
$i++;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
if ( $i > 1)
|
48 |
+
{
|
49 |
+
throw new Exception("Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!");
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
app/code/local/Litle/LitleSDK/Communication.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2011 Litle & Co.
|
4 |
+
*
|
5 |
+
* Permission is hereby granted, free of charge, to any person
|
6 |
+
* obtaining a copy of this software and associated documentation
|
7 |
+
* files (the "Software"), to deal in the Software without
|
8 |
+
* restriction, including without limitation the rights to use,
|
9 |
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
+
* copies of the Software, and to permit persons to whom the
|
11 |
+
* Software is furnished to do so, subject to the following
|
12 |
+
* conditions:
|
13 |
+
*
|
14 |
+
* The above copyright notice and this permission notice shall be
|
15 |
+
* included in all copies or substantial portions of the Software.
|
16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
|
17 |
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18 |
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19 |
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20 |
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22 |
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23 |
+
* OTHER DEALINGS IN THE SOFTWARE.
|
24 |
+
*/
|
25 |
+
class 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);
|
31 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/xml'));
|
32 |
+
curl_setopt($ch, CURLOPT_URL, $config['url']);
|
33 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
|
34 |
+
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
|
35 |
+
curl_setopt($ch,CURLOPT_TIMEOUT, $config['timeout']);
|
36 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
|
37 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,2);
|
38 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
39 |
+
$output = curl_exec($ch);
|
40 |
+
$responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
41 |
+
if (! $output){
|
42 |
+
throw new Exception (curl_error($ch));
|
43 |
+
}
|
44 |
+
else
|
45 |
+
{
|
46 |
+
curl_close($ch);
|
47 |
+
return $output;
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
51 |
+
}
|
app/code/local/Litle/LitleSDK/LitleOnline.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Copyright (c) 2011 Litle & Co.
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person
|
7 |
+
* obtaining a copy of this software and associated documentation
|
8 |
+
* files (the "Software"), to deal in the Software without
|
9 |
+
* restriction, including without limitation the rights to use,
|
10 |
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11 |
+
* copies of the Software, and to permit persons to whom the
|
12 |
+
* Software is furnished to do so, subject to the following
|
13 |
+
* conditions:
|
14 |
+
*
|
15 |
+
* The above copyright notice and this permission notice shall be
|
16 |
+
* included in all copies or substantial portions of the Software.
|
17 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
|
18 |
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
19 |
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20 |
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
21 |
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
22 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
23 |
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
24 |
+
* OTHER DEALINGS IN THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
error_reporting(E_ALL ^ E_NOTICE);
|
28 |
+
//ini_set('display_errors', '1');
|
29 |
+
require_once realpath(dirname(__FILE__)) . '/LitleXmlMapper.php';
|
30 |
+
require_once realpath(dirname(__FILE__)) . '/XmlFields.php';
|
31 |
+
require_once realpath(dirname(__FILE__)) . '/Communication.php';
|
32 |
+
require_once realpath(dirname(__FILE__)) . '/XmlParser.php';
|
33 |
+
require_once realpath(dirname(__FILE__)) . '/Obj2xml.php';
|
34 |
+
require_once realpath(dirname(__FILE__)) . '/Checker.php';
|
35 |
+
require_once realpath(dirname(__FILE__)) . '/LitleOnlineRequest.php';
|
app/code/local/Litle/LitleSDK/LitleOnlineRequest.php
ADDED
@@ -0,0 +1,333 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2011 Litle & Co.
|
4 |
+
*
|
5 |
+
* Permission is hereby granted, free of charge, to any person
|
6 |
+
* obtaining a copy of this software and associated documentation
|
7 |
+
* files (the "Software"), to deal in the Software without
|
8 |
+
* restriction, including without limitation the rights to use,
|
9 |
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
+
* copies of the Software, and to permit persons to whom the
|
11 |
+
* Software is furnished to do so, subject to the following
|
12 |
+
* conditions:
|
13 |
+
*
|
14 |
+
* The above copyright notice and this permission notice shall be
|
15 |
+
* included in all copies or substantial portions of the Software.
|
16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
|
17 |
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18 |
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19 |
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20 |
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22 |
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23 |
+
* OTHER DEALINGS IN THE SOFTWARE.
|
24 |
+
*/
|
25 |
+
|
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::filteringType($hash_in['merchantData'])),
|
62 |
+
'recyclingRequest'=>(XmlFields::recyclingRequestType($hash_in['recyclingRequest'])));
|
63 |
+
}
|
64 |
+
|
65 |
+
$choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
|
66 |
+
$authorizationResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'authorization',$choice_hash);
|
67 |
+
return $authorizationResponse;
|
68 |
+
}
|
69 |
+
|
70 |
+
public function saleRequest($hash_in)
|
71 |
+
{
|
72 |
+
$hash_out = array(
|
73 |
+
'litleTxnId' => $hash_in['litleTxnId'],
|
74 |
+
'orderId' =>Checker::requiredField($hash_in['orderId']),
|
75 |
+
'amount' =>Checker::requiredField($hash_in['amount']),
|
76 |
+
'orderSource'=>Checker::requiredField($hash_in['orderSource']),
|
77 |
+
'customerInfo'=>XmlFields::customerInfo($hash_in['customerInfo']),
|
78 |
+
'billToAddress'=>XmlFields::contact($hash_in['billToAddress']),
|
79 |
+
'shipToAddress'=>XmlFields::contact($hash_in['shipToAddress']),
|
80 |
+
'card'=> XmlFields::cardType($hash_in['card']),
|
81 |
+
'paypal'=>XmlFields::payPal($hash_in['paypal']),
|
82 |
+
'token'=>XmlFields::cardTokenType($hash_in['token']),
|
83 |
+
'paypage'=>XmlFields::cardPaypageType($hash_in['paypage']),
|
84 |
+
'billMeLaterRequest'=>XmlFields::billMeLaterRequest($hash_in['billMeLaterRequest']),
|
85 |
+
'fraudCheck'=>XmlFields::fraudCheckType($hash_in['fraudCheck']),
|
86 |
+
'cardholderAuthentication'=>XmlFields::fraudCheckType($hash_in['cardholderAuthentication']),
|
87 |
+
'customBilling'=>XmlFields::customBilling($hash_in['customBilling']),
|
88 |
+
'taxBilling'=>XmlFields::taxBilling($hash_in['taxBilling']),
|
89 |
+
'enhancedData'=>XmlFields::enhancedData($hash_in['enhancedData']),
|
90 |
+
'processingInstructions'=>XmlFields::processingInstructions($hash_in['processingInstructions']),
|
91 |
+
'pos'=>XmlFields::pos($hash_in['pos']),
|
92 |
+
'payPalOrderComplete'=> $hash_in['paypalOrderComplete'],
|
93 |
+
'payPalNotes'=> $hash_in['paypalNotesType'],
|
94 |
+
'amexAggregatorData'=>XmlFields::amexAggregatorData($hash_in['amexAggregatorData']),
|
95 |
+
'allowPartialAuth'=>$hash_in['allowPartialAuth'],
|
96 |
+
'healthcareIIAS'=>XmlFields::healthcareIIAS($hash_in['healthcareIIAS']),
|
97 |
+
'filtering'=>XmlFields::filteringType($hash_in['filtering']),
|
98 |
+
'merchantData'=>XmlFields::filteringType($hash_in['merchantData']),
|
99 |
+
'recyclingRequest'=>XmlFields::recyclingRequestType($hash_in['recyclingRequest']));
|
100 |
+
|
101 |
+
$choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
|
102 |
+
$choice2_hash= array($hash_out['fraudCheck'],$hash_out['cardholderAuthentication']);
|
103 |
+
$saleResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'sale',$choice_hash,$choice_hash2);
|
104 |
+
return $saleResponse;
|
105 |
+
}
|
106 |
+
|
107 |
+
public function authReversalRequest($hash_in)
|
108 |
+
{
|
109 |
+
$hash_out = array(
|
110 |
+
'litleTxnId' => Checker::requiredField($hash_in['litleTxnId']),
|
111 |
+
'amount' =>$hash_in['amount'],
|
112 |
+
'payPalNotes'=>$hash_in['payPalNotes'],
|
113 |
+
'actionReason'=>$hash_in['actionReason']);
|
114 |
+
$authReversalResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'authReversal');
|
115 |
+
return $authReversalResponse;
|
116 |
+
}
|
117 |
+
|
118 |
+
public function creditRequest($hash_in)
|
119 |
+
{
|
120 |
+
$hash_out = array(
|
121 |
+
'litleTxnId' => XmlFields::returnArrayValue($hash_in, 'litleTxnId'),
|
122 |
+
'orderId' =>XmlFields::returnArrayValue($hash_in, 'orderId'),
|
123 |
+
'amount' =>XmlFields::returnArrayValue($hash_in, 'amount'),
|
124 |
+
'orderSource'=>XmlFields::returnArrayValue($hash_in, 'orderSource'),
|
125 |
+
'billToAddress'=>XmlFields::contact(XMLFields::returnArrayValue($hash_in, 'billToAddress')),
|
126 |
+
'card'=>XmlFields::cardType(XMLFields::returnArrayValue($hash_in, 'card')),
|
127 |
+
'paypal'=>XmlFields::credit_payPal(XMLFields::returnArrayValue($hash_in, 'paypal')),
|
128 |
+
'token'=>XmlFields::cardTokenType(XMLFields::returnArrayValue($hash_in, 'token')),
|
129 |
+
'paypage'=>XmlFields::cardPaypageType(XMLFields::returnArrayValue($hash_in, 'paypage')),
|
130 |
+
'customBilling'=>XmlFields::customBilling(XMLFields::returnArrayValue($hash_in, 'customBilling')),
|
131 |
+
'taxBilling'=>XmlFields::taxBilling(XMLFields::returnArrayValue($hash_in, 'taxBilling')),
|
132 |
+
'billMeLaterRequest'=>XmlFields::billMeLaterRequest(XMLFields::returnArrayValue($hash_in, 'billMeLaterRequest')),
|
133 |
+
'enhancedData'=>XmlFields::enhancedData(XMLFields::returnArrayValue($hash_in, 'enhancedData')),
|
134 |
+
'processingInstructions'=>XmlFields::processingInstructions(XMLFields::returnArrayValue($hash_in, 'processingInstructions')),
|
135 |
+
'pos'=>XmlFields::pos(XMLFields::returnArrayValue($hash_in, 'pos')),
|
136 |
+
'amexAggregatorData'=>XmlFields::amexAggregatorData(XMLFields::returnArrayValue($hash_in, 'amexAggregatorData')),
|
137 |
+
'payPalNotes' =>XmlFields::returnArrayValue($hash_in, 'payPalNotes')
|
138 |
+
);
|
139 |
+
|
140 |
+
$choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
|
141 |
+
$creditResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'credit',$choice_hash);
|
142 |
+
return $creditResponse;
|
143 |
+
}
|
144 |
+
|
145 |
+
public function registerTokenRequest($hash_in)
|
146 |
+
{
|
147 |
+
$hash_out = array(
|
148 |
+
'orderId'=>$hash_in['orderId'],
|
149 |
+
'accountNumber'=>$hash_in['accountNumber'],
|
150 |
+
'echeckForToken'=>XmlFields::echeckForTokenType($hash_in['echeckForToken']),
|
151 |
+
'paypageRegistrationId'=>$hash_in['paypageRegistrationId']);
|
152 |
+
|
153 |
+
$choice_hash = array($hash_out['accountNumber'],$hash_out['echeckForToken'],$hash_out['paypageRegistrationId']);
|
154 |
+
$registerTokenResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'registerTokenRequest',$choice_hash);
|
155 |
+
return $registerTokenResponse;
|
156 |
+
}
|
157 |
+
|
158 |
+
public function forceCaptureRequest($hash_in)
|
159 |
+
{
|
160 |
+
$hash_out = array(
|
161 |
+
'orderId' =>Checker::requiredField($hash_in['orderId']),
|
162 |
+
'amount' =>$hash_in['amount'],
|
163 |
+
'orderSource'=>Checker::requiredField($hash_in['orderSource']),
|
164 |
+
'billToAddress'=>XmlFields::contact($hash_in['billToAddress']),
|
165 |
+
'card'=> XmlFields::cardType($hash_in['card']),
|
166 |
+
'token'=>XmlFields::cardTokenType($hash_in['token']),
|
167 |
+
'paypage'=>XmlFields::cardPaypageType($hash_in['paypage']),
|
168 |
+
'customBilling'=>XmlFields::customBilling($hash_in['customBilling']),
|
169 |
+
'taxBilling'=>XmlFields::taxBilling($hash_in['taxBilling']),
|
170 |
+
'enhancedData'=>XmlFields::enhancedData($hash_in['enhancedData']),
|
171 |
+
'processingInstructions'=>XmlFields::processingInstructions($hash_in['processingInstructions']),
|
172 |
+
'pos'=>XmlFields::pos($hash_in['pos']),
|
173 |
+
'amexAggregatorData'=>XmlFields::amexAggregatorData($hash_in['amexAggregatorData']));
|
174 |
+
|
175 |
+
$choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
|
176 |
+
$forceCaptureResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'forceCapture',$choice_hash);
|
177 |
+
return $forceCaptureResponse;
|
178 |
+
}
|
179 |
+
|
180 |
+
public function captureRequest($hash_in)
|
181 |
+
{
|
182 |
+
$hash_out = array(
|
183 |
+
'partial'=>$hash_in['partial'],
|
184 |
+
'litleTxnId' => Checker::requiredField($hash_in['litleTxnId']),
|
185 |
+
'amount' =>($hash_in['amount']),
|
186 |
+
'enhancedData'=>XmlFields::enhancedData($hash_in['enhancedData']),
|
187 |
+
'processingInstructions'=>XmlFields::processingInstructions($hash_in['processingInstructions']),
|
188 |
+
'payPalOrderComplete'=>$hash_in['payPalOrderComplete'],
|
189 |
+
'payPalNotes' =>$hash_in['payPalNotes']);
|
190 |
+
$captureResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'capture');
|
191 |
+
return $captureResponse;
|
192 |
+
}
|
193 |
+
|
194 |
+
public function captureGivenAuthRequest($hash_in)
|
195 |
+
{
|
196 |
+
$hash_out = array(
|
197 |
+
'orderId'=>Checker::requiredField($hash_in['orderId']),
|
198 |
+
'authInformation'=>XmlFields::authInformation($hash_in['authInformation']),
|
199 |
+
'amount' =>Checker::requiredField($hash_in['amount']),
|
200 |
+
'orderSource'=>Checker::requiredField($hash_in['orderSource']),
|
201 |
+
'billToAddress'=>XmlFields::contact($hash_in['billToAddress']),
|
202 |
+
'shipToAddress'=>XmlFields::contact($hash_in['shipToAddress']),
|
203 |
+
'card'=> XmlFields::cardType($hash_in['card']),
|
204 |
+
'token'=>XmlFields::cardTokenType($hash_in['token']),
|
205 |
+
'paypage'=>XmlFields::cardPaypageType($hash_in['paypage']),
|
206 |
+
'customBilling'=>XmlFields::customBilling($hash_in['customBilling']),
|
207 |
+
'taxBilling'=>XmlFields::taxBilling($hash_in['taxBilling']),
|
208 |
+
'billMeLaterRequest'=>XmlFields::billMeLaterRequest($hash_in['billMeLaterRequest']),
|
209 |
+
'enhancedData'=>XmlFields::enhancedData($hash_in['enhancedData']),
|
210 |
+
'processingInstructions'=>XmlFields::processingInstructions($hash_in['processingInstructions']),
|
211 |
+
'pos'=>XmlFields::pos($hash_in['pos']),
|
212 |
+
'amexAggregatorData'=>XmlFields::amexAggregatorData($hash_in['amexAggregatorData']));
|
213 |
+
|
214 |
+
$choice_hash = array($hash_out['card'],$hash_out['token'],$hash_out['paypage']);
|
215 |
+
$captureGivenAuthResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'captureGivenAuth',$choice_hash);
|
216 |
+
return $captureGivenAuthResponse;
|
217 |
+
}
|
218 |
+
|
219 |
+
public function echeckRedepositRequest($hash_in)
|
220 |
+
{
|
221 |
+
$hash_out = array(
|
222 |
+
'litleTxnId' => Checker::requiredField($hash_in['litleTxnId']),
|
223 |
+
'echeck'=>XmlFields::echeckType($hash_in['echeck']),
|
224 |
+
'echeckToken'=>XmlFields::echeckTokenType($hash_in['echeckToken']));
|
225 |
+
|
226 |
+
$choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
|
227 |
+
$echeckRedepositResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'echeckRedeposit',$choice_hash);
|
228 |
+
return $echeckRedepositResponse;
|
229 |
+
}
|
230 |
+
|
231 |
+
public function echeckSaleRequest($hash_in)
|
232 |
+
{
|
233 |
+
$hash_out = array(
|
234 |
+
'litleTxnId'=>$hash_in['litleTxnId'],
|
235 |
+
'orderId'=>$hash_in['orderId'],
|
236 |
+
'verify'=>$hash_in['verify'],
|
237 |
+
'amount'=>$hash_in['amount'],
|
238 |
+
'orderSource'=>$hash_in['orderSource'],
|
239 |
+
'billToAddress'=>XmlFields::contact($hash_in['billToAddress']),
|
240 |
+
'shipToAddress'=>XmlFields::contact($hash_in['shipToAddress']),
|
241 |
+
'echeck'=>XmlFields::echeckType($hash_in['echeck']),
|
242 |
+
'echeckToken'=>XmlFields::echeckTokenType($hash_in['echeckToken']),
|
243 |
+
'customBilling'=>XmlFields::customBilling($hash_in['customBilling']));
|
244 |
+
|
245 |
+
$choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
|
246 |
+
|
247 |
+
$echeckSaleResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'echeckSale',$choice_hash);
|
248 |
+
return $echeckSaleResponse;
|
249 |
+
}
|
250 |
+
|
251 |
+
public function echeckCreditRequest($hash_in)
|
252 |
+
{
|
253 |
+
$hash_out = array(
|
254 |
+
'litleTxnId'=>$hash_in['litleTxnId'],
|
255 |
+
'orderId'=>$hash_in['orderId'],
|
256 |
+
'amount'=>$hash_in['amount'],
|
257 |
+
'orderSource'=>$hash_in['orderSource'],
|
258 |
+
'billToAddress'=>XmlFields::contact($hash_in['billToAddress']),
|
259 |
+
'echeck'=>XmlFields::echeckType($hash_in['echeck']),
|
260 |
+
'echeckToken'=>XmlFields::echeckTokenType($hash_in['echeckToken']),
|
261 |
+
'customBilling'=>XmlFields::customBilling($hash_in['customBilling']));
|
262 |
+
|
263 |
+
$choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
|
264 |
+
$echeckCreditResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'echeckCredit',$choice_hash);
|
265 |
+
return $echeckCreditResponse;
|
266 |
+
}
|
267 |
+
|
268 |
+
public function echeckVerificationRequest($hash_in)
|
269 |
+
{
|
270 |
+
|
271 |
+
$hash_out = array(
|
272 |
+
'litleTxnId'=>$hash_in['litleTxnId'],
|
273 |
+
'orderId'=>Checker::requiredField($hash_in['orderId']),
|
274 |
+
'amount'=>Checker::requiredField($hash_in['amount']),
|
275 |
+
'orderSource'=>Checker::requiredField($hash_in['orderSource']),
|
276 |
+
'billToAddress'=>XmlFields::contact($hash_in['billToAddress']),
|
277 |
+
'echeck'=>XmlFields::echeckType($hash_in['echeck']),
|
278 |
+
'echeckToken'=>XmlFields::echeckTokenType($hash_in['echeckToken']));
|
279 |
+
|
280 |
+
$choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
|
281 |
+
$choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
|
282 |
+
$echeckVerificationResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'echeckVerification',$choice_hash);
|
283 |
+
return $echeckVerificationResponse;
|
284 |
+
}
|
285 |
+
|
286 |
+
public function voidRequest($hash_in)
|
287 |
+
{
|
288 |
+
$hash_out = array(
|
289 |
+
'litleTxnId' => Checker::requiredField($hash_in['litleTxnId']),
|
290 |
+
'processingInstructions'=>XmlFields::processingInstructions($hash_in['processingInstructions']));
|
291 |
+
|
292 |
+
$voidResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,'void');
|
293 |
+
return $voidResponse;
|
294 |
+
}
|
295 |
+
|
296 |
+
public function echeckVoidRequest($hash_in)
|
297 |
+
{
|
298 |
+
$hash_out = array(
|
299 |
+
'litleTxnId' => Checker::requiredField($hash_in['litleTxnId']),
|
300 |
+
);
|
301 |
+
$echeckVoidResponse = LitleOnlineRequest::processRequest($hash_out,$hash_in,"echeckVoid");
|
302 |
+
return $echeckVoidResponse;
|
303 |
+
}
|
304 |
+
|
305 |
+
private function overideConfig($hash_in)
|
306 |
+
{
|
307 |
+
$hash_out = array(
|
308 |
+
'user'=>$hash_in['user'],
|
309 |
+
'password'=>$hash_in['password'],
|
310 |
+
'merchantId'=>$hash_in['merchantId'],
|
311 |
+
'reportGroup'=>$hash_in['reportGroup'],
|
312 |
+
'id'=>$hash_in['id'],
|
313 |
+
'version'=>$hash_in['version'],
|
314 |
+
'url'=>$hash_in['url'],
|
315 |
+
'timeout'=>$hash_in['timeout'],
|
316 |
+
'proxy'=>$hash_in['proxy']);
|
317 |
+
return $hash_out;
|
318 |
+
}
|
319 |
+
|
320 |
+
private function processRequest($hash_out, $hash_in, $type, $choice1 = null, $choice2 = null)
|
321 |
+
{
|
322 |
+
|
323 |
+
$hash_config = LitleOnlineRequest::overideconfig($hash_in);
|
324 |
+
Checker::choice($choice1);
|
325 |
+
Checker::choice($choice2);
|
326 |
+
$request = Obj2xml::toXml($hash_out,$hash_config, $type);
|
327 |
+
|
328 |
+
$litleOnlineResponse = $this->newXML->request($request,$hash_config);
|
329 |
+
return $litleOnlineResponse;
|
330 |
+
}
|
331 |
+
|
332 |
+
}
|
333 |
+
|
app/code/local/Litle/LitleSDK/LitleXmlMapper.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2011 Litle & Co.
|
4 |
+
*
|
5 |
+
* Permission is hereby granted, free of charge, to any person
|
6 |
+
* obtaining a copy of this software and associated documentation
|
7 |
+
* files (the "Software"), to deal in the Software without
|
8 |
+
* restriction, including without limitation the rights to use,
|
9 |
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
+
* copies of the Software, and to permit persons to whom the
|
11 |
+
* Software is furnished to do so, subject to the following
|
12 |
+
* conditions:
|
13 |
+
*
|
14 |
+
* The above copyright notice and this permission notice shall be
|
15 |
+
* included in all copies or substantial portions of the Software.
|
16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
|
17 |
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18 |
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19 |
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20 |
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22 |
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23 |
+
* OTHER DEALINGS IN THE SOFTWARE.
|
24 |
+
*/
|
25 |
+
require_once realpath(dirname(__FILE__)) . '/LitleOnline.php';
|
26 |
+
|
27 |
+
class LitleXmlMapper
|
28 |
+
{
|
29 |
+
public function __construct()
|
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 |
+
}
|
app/code/local/Litle/LitleSDK/Obj2xml.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2011 Litle & Co.
|
4 |
+
*
|
5 |
+
* Permission is hereby granted, free of charge, to any person
|
6 |
+
* obtaining a copy of this software and associated documentation
|
7 |
+
* files (the "Software"), to deal in the Software without
|
8 |
+
* restriction, including without limitation the rights to use,
|
9 |
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
+
* copies of the Software, and to permit persons to whom the
|
11 |
+
* Software is furnished to do so, subject to the following
|
12 |
+
* conditions:
|
13 |
+
*
|
14 |
+
* The above copyright notice and this permission notice shall be
|
15 |
+
* included in all copies or substantial portions of the Software.
|
16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
|
17 |
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18 |
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19 |
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20 |
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22 |
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23 |
+
* OTHER DEALINGS IN THE SOFTWARE.
|
24 |
+
*/
|
25 |
+
class Obj2xml {
|
26 |
+
|
27 |
+
public static function toXml($data, $hash_config, $type, $rootNodeName = 'litleOnlineRequest', $xml=null)
|
28 |
+
{
|
29 |
+
$config= Obj2xml::getConfig($hash_config);
|
30 |
+
$xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$rootNodeName />");
|
31 |
+
$xml-> addAttribute('merchantId',$config["merchantId"]);
|
32 |
+
$xml-> addAttribute('version',$config["version"]);
|
33 |
+
$xml-> addAttribute('xmlns:xmlns','http://www.litle.com/schema');// does not show up on browser docs
|
34 |
+
$authentication = $xml->addChild('authentication');
|
35 |
+
$authentication->addChild('user',$config["user"]);
|
36 |
+
$authentication->addChild('password',$config["password"]);
|
37 |
+
$transacType = $xml->addChild($type);
|
38 |
+
if(isset($data['partial'])) {
|
39 |
+
($transacType-> addAttribute('partial',$data["partial"]));
|
40 |
+
};
|
41 |
+
unset($data['partial']);
|
42 |
+
#merchant SDK attribute $transacType-> addAttribute('partial',$data["partial"])
|
43 |
+
if(isset($config['customerId'])) {
|
44 |
+
($transacType-> addAttribute('customerId',$config["customerId"]));
|
45 |
+
};
|
46 |
+
if(isset($config['reportGroup'])) {
|
47 |
+
($transacType-> addAttribute('reportGroup',$config["reportGroup"]));
|
48 |
+
};
|
49 |
+
if(isset($config['id'])) {
|
50 |
+
($transacType-> addAttribute('id',$config["id"]));
|
51 |
+
};
|
52 |
+
Obj2xml::iterateChildren($data,$transacType);
|
53 |
+
return $xml->asXML();
|
54 |
+
}
|
55 |
+
|
56 |
+
private function iterateChildren($data,$transacType){
|
57 |
+
foreach($data as $key => $value)
|
58 |
+
{
|
59 |
+
if ($value == "REQUIRED"){
|
60 |
+
throw new Exception("Missing Required Field: /$key/");
|
61 |
+
}elseif (((is_string($value)) || is_numeric($value))) {
|
62 |
+
$transacType->addChild($key,$value);
|
63 |
+
}elseif(is_array($value))
|
64 |
+
{
|
65 |
+
$node = $transacType->addChild($key);
|
66 |
+
Obj2xml::iterateChildren($value,$node);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
public function getConfig($data)
|
72 |
+
{
|
73 |
+
|
74 |
+
@$config_array =parse_ini_file('litle_SDK_config.ini');
|
75 |
+
$names = array('user','password','merchantId','timeout','proxy','reportGroup','version','url');
|
76 |
+
foreach($names as $name)
|
77 |
+
{
|
78 |
+
if (isset($data[$name]))
|
79 |
+
{
|
80 |
+
$config[$name] = $data[$name];
|
81 |
+
|
82 |
+
}else{
|
83 |
+
if ($name == 'merchantId'){
|
84 |
+
$config['merchantId'] = $config_array['currency_merchant_map']['DEFAULT'];
|
85 |
+
}else {
|
86 |
+
if ((!isset($config_array[$name])) and ($name != 'proxy')){
|
87 |
+
throw new Exception("Missing Field /$name/");
|
88 |
+
}
|
89 |
+
$config[$name] = $config_array[$name];
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
return $config;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
?>
|
app/code/local/Litle/LitleSDK/Setup.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2011 Litle & Co.
|
4 |
+
*
|
5 |
+
* Permission is hereby granted, free of charge, to any person
|
6 |
+
* obtaining a copy of this software and associated documentation
|
7 |
+
* files (the "Software"), to deal in the Software without
|
8 |
+
* restriction, including without limitation the rights to use,
|
9 |
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
+
* copies of the Software, and to permit persons to whom the
|
11 |
+
* Software is furnished to do so, subject to the following
|
12 |
+
* conditions:
|
13 |
+
*
|
14 |
+
* The above copyright notice and this permission notice shall be
|
15 |
+
* included in all copies or substantial portions of the Software.
|
16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
|
17 |
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18 |
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19 |
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20 |
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22 |
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23 |
+
* OTHER DEALINGS IN THE SOFTWARE.
|
24 |
+
*/
|
25 |
+
function writeConfig($line,$handle){
|
26 |
+
foreach ($line as $keys => $values){
|
27 |
+
fwrite($handle, $keys. '');
|
28 |
+
if (is_array($values)){
|
29 |
+
foreach ($values as $key2 => $value2){
|
30 |
+
fwrite($handle,"['" . $key2 . "'] =" . $value2 . PHP_EOL);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
else{
|
34 |
+
fwrite($handle,' =' . $values);
|
35 |
+
fwrite($handle, PHP_EOL);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
function initialize(){
|
40 |
+
|
41 |
+
$line = array();
|
42 |
+
$merchantArray = array();
|
43 |
+
$handle = @fopen('./litle_SDK_config.ini', "w");
|
44 |
+
if ($handle) {
|
45 |
+
print "Welcome to Litle PHP_SDK" . PHP_EOL;
|
46 |
+
print "Please input your user name: ";
|
47 |
+
$line['user'] = trim(fgets(STDIN));
|
48 |
+
print "Please input your password: ";
|
49 |
+
$line['password'] = trim(fgets(STDIN));
|
50 |
+
print "Please input your merchantId: ";
|
51 |
+
$line['currency_merchant_map ']['DEFAULT'] = trim(fgets(STDIN));
|
52 |
+
print "Please choose Litle url from the following list (example: 'cert') or directly input another URL: \nsandbox => https://www.testlitle.com/sandbox/communicator/online \ncert => https://cert.litle.com/vap/communicator/online \nprecert => https://precert.litle.com/vap/communicator/online \nproduction1 => https://payments.litle.com/vap/communicator/online \nproduction2 => https://payments2.litle.com/vap/communicator/online" . PHP_EOL;
|
53 |
+
$url = urlMapper(trim(fgets(STDIN)));
|
54 |
+
$line['url'] = $url;
|
55 |
+
print "Please input the proxy, if no proxy hit enter key: ";
|
56 |
+
$line['proxy'] = trim(fgets(STDIN));
|
57 |
+
writeConfig($line,$handle);
|
58 |
+
fwrite($handle, "version = 8.10" . PHP_EOL);
|
59 |
+
fwrite($handle, "timeout = 65". PHP_EOL);
|
60 |
+
fwrite($handle, "reportGroup = planets". PHP_EOL);
|
61 |
+
}
|
62 |
+
fclose($handle);
|
63 |
+
print "The Litle configuration file has been generated, the file is located in the lib directory". PHP_EOL;
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
|
68 |
+
function urlMapper($litleEnv){
|
69 |
+
$litleOnlineCtx = 'vap/communicator/online';
|
70 |
+
if ($litleEnv == "sandbox")
|
71 |
+
return 'https://www.testlitle.com/sandbox/communicator/online';
|
72 |
+
elseif ($litleEnv == "cert")
|
73 |
+
return 'https://cert.litle.com/' . $litleOnlineCtx;
|
74 |
+
elseif ($litleEnv == "precert")
|
75 |
+
return 'https://precert.litle.com/' . $litleOnlineCtx;
|
76 |
+
elseif ($litleEnv == "production1")
|
77 |
+
return 'https://payments.litle.com/' . $litleOnlineCtx;
|
78 |
+
elseif ($litleEnv == "production2")
|
79 |
+
return 'https://payments2.litle.com/' . $litleOnlineCtx;
|
80 |
+
else
|
81 |
+
return 'https://www.testlitle.com/sandbox/communicator/online';
|
82 |
+
}
|
83 |
+
|
84 |
+
initialize();
|
85 |
+
|
app/code/local/Litle/LitleSDK/XmlFields.php
ADDED
@@ -0,0 +1,432 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2011 Litle & Co.
|
4 |
+
*
|
5 |
+
* Permission is hereby granted, free of charge, to any person
|
6 |
+
* obtaining a copy of this software and associated documentation
|
7 |
+
* files (the "Software"), to deal in the Software without
|
8 |
+
* restriction, including without limitation the rights to use,
|
9 |
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
+
* copies of the Software, and to permit persons to whom the
|
11 |
+
* Software is furnished to do so, subject to the following
|
12 |
+
* conditions:
|
13 |
+
*
|
14 |
+
* The above copyright notice and this permission notice shall be
|
15 |
+
* included in all copies or substantial portions of the Software.
|
16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
|
17 |
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18 |
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19 |
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20 |
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21 |
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22 |
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23 |
+
* OTHER DEALINGS IN THE SOFTWARE.
|
24 |
+
*/
|
25 |
+
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 |
+
|
35 |
+
public static function contact($hash_in)
|
36 |
+
{
|
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 |
+
}
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
public static function customerInfo($hash_in)
|
61 |
+
{
|
62 |
+
if (isset($hash_in))
|
63 |
+
{
|
64 |
+
$hash_out= array(
|
65 |
+
"ssn"=>XmlFields::returnArrayValue($hash_in, "ssn"),
|
66 |
+
"dob"=>XmlFields::returnArrayValue($hash_in, "dob"),
|
67 |
+
"customerRegistrationDate"=>XmlFields::returnArrayValue($hash_in, "customerRegistrationDate"),
|
68 |
+
"customerType"=>XmlFields::returnArrayValue($hash_in, "customerType"),
|
69 |
+
"incomeAmount"=>XmlFields::returnArrayValue($hash_in, "incomeAmount"),
|
70 |
+
"incomeCurrency"=>XmlFields::returnArrayValue($hash_in, "incomeCurrency"),
|
71 |
+
"customerCheckingAccount"=>XmlFields::returnArrayValue($hash_in, "customerCheckingAccount"),
|
72 |
+
"customerSavingAccount"=>XmlFields::returnArrayValue($hash_in, "customerSavingAccount"),
|
73 |
+
"customerWorkTelephone"=>XmlFields::returnArrayValue($hash_in, "customerWorkTelephone"),
|
74 |
+
"residenceStatus"=>XmlFields::returnArrayValue($hash_in, "residenceStatus"),
|
75 |
+
"yearsAtResidence"=>XmlFields::returnArrayValue($hash_in, "yearsAtResidence"),
|
76 |
+
"yearsAtEmployer"=>XmlFields::returnArrayValue($hash_in, "yearsAtEmployer")
|
77 |
+
);
|
78 |
+
return $hash_out;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
public static function billMeLaterRequest($hash_in)
|
83 |
+
{
|
84 |
+
if (isset($hash_in))
|
85 |
+
{
|
86 |
+
$hash_out = array(
|
87 |
+
"bmlMerchantId"=>XmlFields::returnArrayValue($hash_in, "bmlMerchantId"),
|
88 |
+
"termsAndConditions"=>XmlFields::returnArrayValue($hash_in, "termsAndConditions"),
|
89 |
+
"preapprovalNumber"=>XmlFields::returnArrayValue($hash_in, "preapprovalNumber"),
|
90 |
+
"merchantPromotionalCode"=>XmlFields::returnArrayValue($hash_in, "merchantPromotionalCode"),
|
91 |
+
"customerPasswordChanged"=>XmlFields::returnArrayValue($hash_in, "customerPasswordChanged"),
|
92 |
+
"customerEmailChanged"=>XmlFields::returnArrayValue($hash_in, "customerEmailChanged"),
|
93 |
+
"customerPhoneChanged"=>XmlFields::returnArrayValue($hash_in, "customerPhoneChanged"),
|
94 |
+
"secretQuestionCode"=>XmlFields::returnArrayValue($hash_in, "secretQuestionCode"),
|
95 |
+
"secretQuestionAnswer"=>XmlFields::returnArrayValue($hash_in, "secretQuestionAnswer"),
|
96 |
+
"virtualAuthenticationKeyPresenceIndicator"=>XmlFields::returnArrayValue($hash_in, "virtualAuthenticationKeyPresenceIndicator"),
|
97 |
+
"virtualAuthenticationKeyData"=>XmlFields::returnArrayValue($hash_in, "virtualAuthenticationKeyData"),
|
98 |
+
"itemCategoryCode"=>XmlFields::returnArrayValue($hash_in, "itemCategoryCode"),
|
99 |
+
"authorizationSourcePlatform"=>XmlFields::returnArrayValue($hash_in, "authorizationSourcePlatform")
|
100 |
+
);
|
101 |
+
return $hash_out;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
public static function fraudCheckType($hash_in)
|
106 |
+
{
|
107 |
+
if (isset($hash_in))
|
108 |
+
{
|
109 |
+
$hash_out = array(
|
110 |
+
"authenticationValue"=>XmlFields::returnArrayValue($hash_in, "authenticationValue"),
|
111 |
+
"authenticationTransactionId"=>XmlFields::returnArrayValue($hash_in, "authenticationTransactionId"),
|
112 |
+
"customerIpAddress"=>XmlFields::returnArrayValue($hash_in, "customerIpAddress"),
|
113 |
+
"authenticatedByMerchant"=>XmlFields::returnArrayValue($hash_in, "authenticatedByMerchant")
|
114 |
+
);
|
115 |
+
return $hash_out;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
public static function authInformation($hash_in)
|
120 |
+
{
|
121 |
+
if (isset($hash_in))
|
122 |
+
{
|
123 |
+
$hash_out = array(
|
124 |
+
"authDate"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "authDate"))),
|
125 |
+
"authCode"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "authCode"))),
|
126 |
+
"fraudResult"=>XmlFields::fraudResult(XmlFields::returnArrayValue($hash_in,"fraudResult")),
|
127 |
+
"authAmount"=>XmlFields::returnArrayValue($hash_in,'authAmount')
|
128 |
+
);
|
129 |
+
return $hash_out;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
public static function fraudResult($hash_in)
|
134 |
+
{
|
135 |
+
if (isset($hash_in))
|
136 |
+
{
|
137 |
+
$hash_out= array(
|
138 |
+
"avsResult"=>XmlFields::returnArrayValue($hash_in, "avsResult"),
|
139 |
+
"cardValidationResult"=>XmlFields::returnArrayValue($hash_in, "cardValidationResult"),
|
140 |
+
"authenticationResult"=>XmlFields::returnArrayValue($hash_in, "authenticationResult"),
|
141 |
+
"advancedAVSResult"=>XmlFields::returnArrayValue($hash_in, "advancedAVSResult")
|
142 |
+
);
|
143 |
+
return $hash_out;
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
public static function healthcareAmounts($hash_in)
|
148 |
+
{
|
149 |
+
if (isset($hash_in))
|
150 |
+
{
|
151 |
+
$hash_out = array(
|
152 |
+
"totalHealthcareAmount"=>XmlFields::returnArrayValue($hash_in, "totalHealthcareAmount"),
|
153 |
+
"RxAmount"=>XmlFields::returnArrayValue($hash_in, "RxAmount"),
|
154 |
+
"visionAmount"=>XmlFields::returnArrayValue($hash_in, "visionAmount"),
|
155 |
+
"clinicOtherAmount"=>XmlFields::returnArrayValue($hash_in, "clinicOtherAmount"),
|
156 |
+
"dentalAmount"=>XmlFields::returnArrayValue($hash_in, "dentalAmount")
|
157 |
+
);
|
158 |
+
return $hash_out;
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
public static function healthcareIIAS($hash_in)
|
163 |
+
{
|
164 |
+
if (isset($hash_in))
|
165 |
+
{
|
166 |
+
$hash_out = array(
|
167 |
+
"healthcareAmounts"=>(XmlFields::healthcareAmounts(XmlFields::returnArrayValue($hash_in, "healthcareAmounts"))),
|
168 |
+
"IIASFlag"=>XmlFields::returnArrayValue($hash_in, "IIASFlag")
|
169 |
+
);
|
170 |
+
return $hash_out;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
public static function pos($hash_in)
|
175 |
+
{
|
176 |
+
if (isset($hash_in))
|
177 |
+
{
|
178 |
+
$hash_out = array(
|
179 |
+
"capability"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "capability"))),
|
180 |
+
"entryMode"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "entryMode"))),
|
181 |
+
"cardholderId"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "cardholderId")))
|
182 |
+
);
|
183 |
+
return $hash_out;
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
public static function detailTax($hash_in)
|
188 |
+
{
|
189 |
+
if (isset($hash_in))
|
190 |
+
{
|
191 |
+
$hash_out = array(
|
192 |
+
"taxIncludedInTotal"=>XmlFields::returnArrayValue($hash_in, "taxIncludedInTotal"),
|
193 |
+
"taxAmount"=>XmlFields::returnArrayValue($hash_in, "taxAmount"),
|
194 |
+
"taxRate"=>XmlFields::returnArrayValue($hash_in, "taxRate"),
|
195 |
+
"taxTypeIdentifier"=>XmlFields::returnArrayValue($hash_in, "taxTypeIdentifier"),
|
196 |
+
"cardAcceptorTaxId"=>XmlFields::returnArrayValue($hash_in, "cardAcceptorTaxId")
|
197 |
+
);
|
198 |
+
return $hash_out;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
public static function lineItemData($hash_in)
|
203 |
+
{
|
204 |
+
if (isset($hash_in))
|
205 |
+
{
|
206 |
+
$hash_out = array(
|
207 |
+
"itemSequenceNumber"=>XmlFields::returnArrayValue($hash_in, "itemSequenceNumber"),
|
208 |
+
"itemDescription"=>XmlFields::returnArrayValue($hash_in, "itemDescription"),
|
209 |
+
"productCode"=>XmlFields::returnArrayValue($hash_in, "productCode"),
|
210 |
+
"quantity"=>XmlFields::returnArrayValue($hash_in, "quantity"),
|
211 |
+
"unitOfMeasure"=>XmlFields::returnArrayValue($hash_in, "unitOfMeasure"),
|
212 |
+
"taxAmount"=>XmlFields::returnArrayValue($hash_in, "taxAmount"),
|
213 |
+
"lineItemTotal"=>XmlFields::returnArrayValue($hash_in, "lineItemTotal"),
|
214 |
+
"lineItemTotalWithTax"=>XmlFields::returnArrayValue($hash_in, "lineItemTotalWithTax"),
|
215 |
+
"itemDiscountAmount"=>XmlFields::returnArrayValue($hash_in, "itemDiscountAmount"),
|
216 |
+
"commodityCode"=>XmlFields::returnArrayValue($hash_in, "commodityCode"),
|
217 |
+
"unitCost"=>XmlFields::returnArrayValue($hash_in, "unitCost"),
|
218 |
+
"detailTax"=>(XmlFields::detailTax(XmlFields::returnArrayValue($hash_in, "detailTax")))
|
219 |
+
);
|
220 |
+
return $hash_out;
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
public static function enhancedData($hash_in)
|
225 |
+
{
|
226 |
+
if (isset($hash_in))
|
227 |
+
{
|
228 |
+
$hash_out = array(
|
229 |
+
"customerReference"=>XmlFields::returnArrayValue($hash_in, "customerReference"),
|
230 |
+
"salesTax"=>XmlFields::returnArrayValue($hash_in, "salesTax"),
|
231 |
+
"deliveryType"=>XmlFields::returnArrayValue($hash_in, "deliveryType"),
|
232 |
+
"taxExempt"=>XmlFields::returnArrayValue($hash_in, "taxExempt"),
|
233 |
+
"discountAmount"=>XmlFields::returnArrayValue($hash_in, "discountAmount"),
|
234 |
+
"shippingAmount"=>XmlFields::returnArrayValue($hash_in, "shippingAmount"),
|
235 |
+
"dutyAmount"=>XmlFields::returnArrayValue($hash_in, "dutyAmount"),
|
236 |
+
"shipFromPostalCode"=>XmlFields::returnArrayValue($hash_in, "shipFromPostalCode"),
|
237 |
+
"destinationPostalCode"=>XmlFields::returnArrayValue($hash_in, "destinationPostalCode"),
|
238 |
+
"destinationCountryCode"=>XmlFields::returnArrayValue($hash_in, "destinationCountryCode"),
|
239 |
+
"invoiceReferenceNumber"=>XmlFields::returnArrayValue($hash_in, "invoiceReferenceNumber"),
|
240 |
+
"orderDate"=>XmlFields::returnArrayValue($hash_in, "orderDate"),
|
241 |
+
"detailTax"=>(XmlFields::detailTax(XmlFields::returnArrayValue($hash_in, "detailTax"))),
|
242 |
+
"lineItemData"=>(XmlFields::lineItemData(XmlFields::returnArrayValue($hash_in, "lineItemData")))
|
243 |
+
);
|
244 |
+
return $hash_out;
|
245 |
+
}
|
246 |
+
}
|
247 |
+
|
248 |
+
public static function amexAggregatorData($hash_in)
|
249 |
+
{
|
250 |
+
if (isset($hash_in))
|
251 |
+
{
|
252 |
+
$hash_out = array(
|
253 |
+
"sellerId"=>XmlFields::returnArrayValue($hash_in, "sellerId"),
|
254 |
+
"sellerMerchantCategoryCode"=>XmlFields::returnArrayValue($hash_in, "sellerMerchantCategoryCode")
|
255 |
+
);
|
256 |
+
return $hash_out;
|
257 |
+
}
|
258 |
+
}
|
259 |
+
|
260 |
+
public static function cardType($hash_in)
|
261 |
+
{
|
262 |
+
if (isset($hash_in))
|
263 |
+
{
|
264 |
+
$hash_out= array(
|
265 |
+
"type"=>XmlFields::returnArrayValue($hash_in, "type"),
|
266 |
+
"track"=>XmlFields::returnArrayValue($hash_in, "track"),
|
267 |
+
"number"=>XmlFields::returnArrayValue($hash_in, "number"),
|
268 |
+
"expDate"=>XmlFields::returnArrayValue($hash_in, "expDate"),
|
269 |
+
"cardValidationNum"=>XmlFields::returnArrayValue($hash_in, "cardValidationNum")
|
270 |
+
);
|
271 |
+
return $hash_out;
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
public static function cardTokenType($hash_in)
|
276 |
+
{
|
277 |
+
if (isset($hash_in))
|
278 |
+
{
|
279 |
+
$hash_out = array(
|
280 |
+
"litleToken"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "litleToken"))),
|
281 |
+
"expDate"=>XmlFields::returnArrayValue($hash_in, "expDate"),
|
282 |
+
"cardValidationNum"=>XmlFields::returnArrayValue($hash_in, "cardValidationNumber"),
|
283 |
+
"type"=>XmlFields::returnArrayValue($hash_in, "type")
|
284 |
+
);
|
285 |
+
return $hash_out;
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
public static function cardPaypageType($hash_in)
|
290 |
+
{
|
291 |
+
if (isset($hash_in))
|
292 |
+
{
|
293 |
+
$hash_out = array(
|
294 |
+
"paypageRegistrationId"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "paypageRegistrationId"))),
|
295 |
+
"expDate"=>XmlFields::returnArrayValue($hash_in, "expDate"),
|
296 |
+
"cardValidationNum"=>XmlFields::returnArrayValue($hash_in, "cardValidationNumber"),
|
297 |
+
"type"=>XmlFields::returnArrayValue($hash_in, "type")
|
298 |
+
);
|
299 |
+
return $hash_out;
|
300 |
+
}
|
301 |
+
}
|
302 |
+
|
303 |
+
public static function paypal($hash_in)
|
304 |
+
{
|
305 |
+
if (isset($hash_in))
|
306 |
+
{
|
307 |
+
$hash_out = array(
|
308 |
+
"payerId"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "payerId"))),
|
309 |
+
"token"=>XmlFields::returnArrayValue($hash_in, "token"),
|
310 |
+
"transactionId"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "transactionId")))
|
311 |
+
);
|
312 |
+
return $hash_out;
|
313 |
+
}
|
314 |
+
}
|
315 |
+
|
316 |
+
#paypal field for credit transaction
|
317 |
+
public static function credit_paypal($hash_in)
|
318 |
+
{
|
319 |
+
if (isset($hash_in))
|
320 |
+
{
|
321 |
+
$hash_out = array(
|
322 |
+
"payerId"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "payerId"))),
|
323 |
+
"payerEmail" =>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "payerEmail")))
|
324 |
+
);
|
325 |
+
return $hash_out;
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
public static function customBilling($hash_in)
|
330 |
+
{
|
331 |
+
if (isset($hash_in))
|
332 |
+
{
|
333 |
+
$hash_out = array(
|
334 |
+
"phone"=>XmlFields::returnArrayValue($hash_in, "phone"),
|
335 |
+
"city" =>XmlFields::returnArrayValue($hash_in, "city"),
|
336 |
+
"url" =>XmlFields::returnArrayValue($hash_in, "url"),
|
337 |
+
"descriptor" =>XmlFields::returnArrayValue($hash_in, "descriptor")
|
338 |
+
);
|
339 |
+
return $hash_out;
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
public static function taxBilling($hash_in)
|
344 |
+
{
|
345 |
+
if (isset($hash_in))
|
346 |
+
{
|
347 |
+
$hash_out = array(
|
348 |
+
"taxAuthority"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "taxAuthority"))),
|
349 |
+
"state" =>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "state"))),
|
350 |
+
"govtTxnType" =>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "govtTxnType")))
|
351 |
+
);
|
352 |
+
return $hash_out;
|
353 |
+
}
|
354 |
+
}
|
355 |
+
|
356 |
+
public static function processingInstructions($hash_in)
|
357 |
+
{
|
358 |
+
if (isset($hash_in))
|
359 |
+
{
|
360 |
+
$hash_out = array(
|
361 |
+
"bypassVelocityCheck"=>XmlFields::returnArrayValue($hash_in, "bypassVelocityCheck")
|
362 |
+
);
|
363 |
+
return $hash_out;
|
364 |
+
}
|
365 |
+
}
|
366 |
+
|
367 |
+
public static function echeckForTokenType($hash_in)
|
368 |
+
{
|
369 |
+
if (isset($hash_in))
|
370 |
+
{
|
371 |
+
$hash_out = array(
|
372 |
+
"accNum"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "accNum"))),
|
373 |
+
"routingNum" =>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "routingNum")))
|
374 |
+
);
|
375 |
+
return $hash_out;
|
376 |
+
}
|
377 |
+
}
|
378 |
+
|
379 |
+
public static function filteringType($hash_in)
|
380 |
+
{
|
381 |
+
if (isset($hash_in))
|
382 |
+
{
|
383 |
+
$hash_out = array(
|
384 |
+
"prepaid"=>XmlFields::returnArrayValue($hash_in, "prepaid"),
|
385 |
+
"international" =>XmlFields::returnArrayValue($hash_in, "international"),
|
386 |
+
"chargeback" =>XmlFields::returnArrayValue($hash_in, "chargeback")
|
387 |
+
);
|
388 |
+
return $hash_out;
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
public static function echeckType($hash_in)
|
393 |
+
{
|
394 |
+
if (isset($hash_in))
|
395 |
+
{
|
396 |
+
$hash_out = array(
|
397 |
+
"accType"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "accType"))),
|
398 |
+
"accNum" =>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "accNum"))),
|
399 |
+
"routingNum" =>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "routingNum"))),
|
400 |
+
"checkNum" =>XmlFields::returnArrayValue($hash_in, "checkNum")
|
401 |
+
);
|
402 |
+
return $hash_out;
|
403 |
+
}
|
404 |
+
}
|
405 |
+
|
406 |
+
public static function echeckTokenType($hash_in)
|
407 |
+
{
|
408 |
+
if (isset($hash_in))
|
409 |
+
{
|
410 |
+
$hash_out = array(
|
411 |
+
"litleToken"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "litleToken"))),
|
412 |
+
"routingNum" =>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "routingNum"))),
|
413 |
+
"accType" =>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "accType"))),
|
414 |
+
"checkNum" =>XmlFields::returnArrayValue($hash_in, "checkNum")
|
415 |
+
);
|
416 |
+
return $hash_out;
|
417 |
+
}
|
418 |
+
}
|
419 |
+
|
420 |
+
public static function recyclingRequestType($hash_in)
|
421 |
+
{
|
422 |
+
if (isset($hash_in))
|
423 |
+
{
|
424 |
+
$hash_out = array(
|
425 |
+
"recycleBy"=>(Checker::requiredField(XmlFields::returnArrayValue($hash_in, "recycleBy")))
|
426 |
+
);
|
427 |
+
return $hash_out;
|
428 |
+
}
|
429 |
+
}
|
430 |
+
|
431 |
+
|
432 |
+
}
|
app/code/local/Litle/LitleSDK/XmlParser.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
#error_reporting(E_ALL);
|
3 |
+
#ini_set('display_errors', '1');
|
4 |
+
|
5 |
+
// =begin
|
6 |
+
// Copyright (c) 2011 Litle & Co.
|
7 |
+
|
8 |
+
// Permission is hereby granted, free of charge, to any person
|
9 |
+
// obtaining a copy of this software and associated documentation
|
10 |
+
// files (the "Software"), to deal in the Software without
|
11 |
+
// restriction, including without limitation the rights to use,
|
12 |
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
13 |
+
// copies of the Software, and to permit persons to whom the
|
14 |
+
// Software is furnished to do so, subject to the following
|
15 |
+
// conditions:
|
16 |
+
|
17 |
+
// The above copyright notice and this permission notice shall be
|
18 |
+
// included in all copies or substantial portions of the Software.
|
19 |
+
|
20 |
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
21 |
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
22 |
+
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
23 |
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
24 |
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
25 |
+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26 |
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
27 |
+
// OTHER DEALINGS IN THE SOFTWARE.
|
28 |
+
// =end
|
29 |
+
// class and methods to parse a XML document into an object
|
30 |
+
class XMLParser{
|
31 |
+
|
32 |
+
public static function domParser($xml)
|
33 |
+
{
|
34 |
+
$doc = new DOMDocument();
|
35 |
+
$doc->loadXML($xml);
|
36 |
+
return $doc;
|
37 |
+
}
|
38 |
+
|
39 |
+
public static function getNode($dom, $elementName)
|
40 |
+
{
|
41 |
+
$elements = $dom->getElementsByTagName($elementName);
|
42 |
+
$retVal = "";
|
43 |
+
foreach ($elements as $element) {
|
44 |
+
$retVal = $element->nodeValue;
|
45 |
+
}
|
46 |
+
return $retVal;
|
47 |
+
}
|
48 |
+
|
49 |
+
public static function getAttribute($dom, $elementName, $attributeName)
|
50 |
+
{
|
51 |
+
$attributes = $dom->getElementsByTagName($elementName)->item(0);
|
52 |
+
$retVal = $attributes->getAttribute($attributeName);
|
53 |
+
return $retVal;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
?>
|
app/design/frontend/default/default/template/payment/form/litleecheck.phtml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<fieldset class="form-list">
|
2 |
+
<?php $_code=$this->getMethodCode() ?>
|
3 |
+
<ul id="payment_form_<?php echo $_code ?>" style="display:none">
|
4 |
+
<li>
|
5 |
+
<div class="input-box">
|
6 |
+
<label for="<?php echo $_code ?>_echeck_routing_number"><?php echo $this->__('Bank routing number') ?> <span class="required">*</span></label><br />
|
7 |
+
<input id="<?php echo $_code ?>_echeck_routing_number" name="payment[echeck_routing_number]" class="input-text required-entry">
|
8 |
+
</div>
|
9 |
+
</li>
|
10 |
+
<li>
|
11 |
+
<div class="input-box">
|
12 |
+
<label for="<?php echo $_code ?>_echeck_bank_acct_num"><?php echo $this->__('Bank account number') ?> <span class="required">*</span></label><br />
|
13 |
+
<input id="<?php echo $_code ?>_echeck_bank_acct_num" name="payment[echeck_bank_acct_num]" class="input-text required-entry">
|
14 |
+
</div>
|
15 |
+
</li>
|
16 |
+
<li>
|
17 |
+
<div class="input-box">
|
18 |
+
<label for="<?php echo $_code ?>_echeck_account_type"><?php echo $this->__('Account type') ?> <span class="required">*</span></label><br />
|
19 |
+
<select id="<?php echo $_code ?>_echeck_account_type" name="payment[echeck_account_type]" class="input-text required-entry">
|
20 |
+
<option value=""><?php echo $this->__('--Please Select--')?></option>
|
21 |
+
<?php $_accountType = $this->getInfoData('account_type') ?>
|
22 |
+
<?php foreach ($this->getAccountAvailableTypes() as $_typeCode => $_typeName): ?>
|
23 |
+
<option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_accountType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
|
24 |
+
<?php endforeach ?>
|
25 |
+
</select>
|
26 |
+
</div>
|
27 |
+
</li>
|
28 |
+
<!-- li>
|
29 |
+
<div class="input-box">
|
30 |
+
<label for="<?php echo $_code ?>_echeck_type"><?php echo $this->__('Echeck type') ?> <span class="required">*</span></label><br />
|
31 |
+
<input id="<?php echo $_code ?>_echeck_type" name="payment[echeck_type]" class="required-entry">
|
32 |
+
</div>
|
33 |
+
</li-->
|
34 |
+
</ul>
|
35 |
+
</fieldset>
|
app/etc/modules/Litle_All.xml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Litle_CreditCard>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Litle_CreditCard>
|
8 |
+
</modules>
|
9 |
+
<modules>
|
10 |
+
<Litle_LEcheck>
|
11 |
+
<active>true</active>
|
12 |
+
<codePool>local</codePool>
|
13 |
+
</Litle_LEcheck>
|
14 |
+
</modules>
|
15 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Litle_Payments</name>
|
4 |
+
<version>8.10.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>MIT</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This extension allows you to accept payments through Litle.</summary>
|
10 |
+
<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.
|
11 |
+

|
12 |
+
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.
|
13 |
+

|
14 |
+
To test with sandbox, you may enter any user name and password, and select 'Sandbox' from the drop down menu in Payment Method configuration.
|
15 |
+

|
16 |
+
Why Litle?
|
17 |
+

|
18 |
+
We deliver the most efficient and effective core processing available to digital and direct merchants. Relevant, value-added solutions help you drive more lasting and profitable customer relationships. We’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.
|
19 |
+
</description>
|
20 |
+
<notes>This extension implements Litle XML version 8.10</notes>
|
21 |
+
<authors><author><name>Litle </name><user>Litle</user><email>sdksupport@litle.com</email></author></authors>
|
22 |
+
<date>2012-03-28</date>
|
23 |
+
<time>15:54:50</time>
|
24 |
+
<contents><target name="magelocal"><dir name="Litle"><dir><dir name="CreditCard"><dir name="Model"><file name="PaymentLogic.php" hash="0b72c1b297c6c84635d0e9018f841c80"/><file name="Url.php" hash="ce0ca23963d9eb05552528eb440d19fe"/><file name="Validatehttp.php" hash="79dac70cf02fc3e005c9bb8ef0f3e0e0"/></dir><dir name="etc"><file name="config.xml" hash="be5172f7d2ec1a5d16c64f313487be82"/><file name="system.xml" hash="bd072a42ff569bbb7bd5530c0366ee60"/></dir></dir><dir name="LEcheck"><dir name="Block"><dir name="Form"><file name="LEcheck.php" hash="ba7cc807aa5e227bb936a196985476a0"/></dir></dir><dir name="Helper"><file name="Data.php" hash="2c2664ab694e0ba70e45157061a01436"/></dir><dir name="Model"><file name="Accounttypes.php" hash="6628bf9982d0d35341975d0bb83be5e1"/><file name="Config.php" hash="fe64d24b39251551b71e37937792b418"/><file name="PaymentLogic.php" hash="90449604d306518c671caa75ef0d880e"/><file name="Transactiontypes.php" hash="1aa3e3e77c044e77154f9c24afcfc436"/><file name="Url.php" hash="9e3d8ba06bcb9045abc82f20f18d5ef3"/><file name="Validatehttp.php" hash="6a8d4d6f043976ad272c87a885d937f4"/></dir><dir name="etc"><file name="config.xml" hash="0150e3b72ffd8b8fd08891390d02178e"/><file name="system.xml" hash="1721d5468396eaae10987be8423e0ff8"/></dir></dir><dir name="LitleSDK"><file name="Checker.php" hash="e38d02c1fc3d54faa5d2ba0302bff5ec"/><file name="Communication.php" hash="f78ab9b5497554ae47181053f5f20ac8"/><file name="LitleOnline.php" hash="f2561f12f4e47d6c1d1ae60c835e9f4f"/><file name="LitleOnlineRequest.php" hash="609062240175f4827399b81543b11ec8"/><file name="LitleXmlMapper.php" hash="17c64c7f34e5c84ab3461b92268ede46"/><file name="Obj2xml.php" hash="63f36945e7bd1dc0ae2392ea3ad7560d"/><file name="Setup.php" hash="d726bbc909f3f4754c3e73b8915f8706"/><file name="XmlFields.php" hash="d84c23fbddcb4829cddf77470ecd1191"/><file name="XmlParser.php" hash="9fb83575223778fad8eaee1bef16ab36"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="payment"><dir name="form"><file name="litleecheck.phtml" hash="a92047f43e72f60fea75dd536bba0552"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Litle_All.xml" hash="57f8967136923914e7a0a04f0432b821"/></dir></target></contents>
|
25 |
+
<compatible/>
|
26 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
27 |
+
</package>
|