Litle_Payments - Version 8.10.0

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 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 @@