Eye4Fraud_Connector_integration - Version 1.1.4

Version Notes

Improved speed.

Added status updated in orders grid.

Bug fixes.

Download this release

Release Info

Developer integer_net GmbH
Extension Eye4Fraud_Connector_integration
Version 1.1.4
Comparing to
See all releases


Code changes from version 1.0.0.3 to 1.1.4

app/code/local/Eye4Fraud/Connector/Helper/Curl.php DELETED
@@ -1,105 +0,0 @@
1
- <?php
2
- /**
3
- * Eye4fraud Connector Magento Module
4
- *
5
- * @category Eye4fraud
6
- * @package Eye4fraud_Connector
7
- */
8
-
9
- class Eye4Fraud_Connector_Helper_Curl
10
- extends Mage_Core_Helper_Abstract
11
- {
12
- const HTTP_STATUS_BAD_RESPONSE = -1; // Not an HTTP response code
13
- const HTTP_STATUS_OK = 200;
14
- const HTTP_STATUS_BAD_REQUEST = 400;
15
- const HTTP_STATUS_UNAUTHORIZED = 401;
16
- const HTTP_STATUS_FORBIDDEN = 403;
17
- const HTTP_STATUS_NOT_FOUND = 404;
18
- const HTTP_STATUS_NOT_ACCEPTABLE = 406;
19
- const HTTP_STATUS_INTERNAL_SERVER_ERROR = 500;
20
- const HTTP_STATUS_SERVICE_UNAVAILABLE = 503;
21
-
22
- const COOKIES_FILE = 'cookies.txt';
23
-
24
- /**
25
- * @param int $timeout Timeout in seconds. Default value is 10 minutes
26
- */
27
- function __construct($timeout = 600) {
28
- $this->curlHandle = curl_init();
29
- curl_setopt($this->curlHandle, CURLOPT_COOKIEJAR, self::COOKIES_FILE);
30
- curl_setopt($this->curlHandle, CURLOPT_COOKIEFILE, self::COOKIES_FILE);
31
- curl_setopt($this->curlHandle, CURLOPT_FOLLOWLOCATION, 1);
32
- curl_setopt($this->curlHandle, CURLOPT_RETURNTRANSFER, 1);
33
- curl_setopt($this->curlHandle, CURLOPT_SSL_VERIFYPEER, false);
34
- curl_setopt($this->curlHandle, CURLOPT_TIMEOUT, $timeout);
35
- }
36
-
37
- function close() {
38
- if ($this->curlHandle) {
39
- curl_close($this->curlHandle);
40
- }
41
- }
42
-
43
- public function get($url, $get_data = array(), $headers = array())
44
- {
45
- // Build url
46
- if ($get_data) {
47
- $url = $url.'/?'.http_build_query($get_data);
48
- }
49
- curl_setopt($this->curlHandle, CURLOPT_URL, $url);
50
-
51
- // Add headers
52
- if ($headers) {
53
- curl_setopt($this->curlHandle, CURLOPT_HTTPHEADER, $headers);
54
- }
55
- $response = curl_exec($this->curlHandle);
56
-
57
- // make sure there's no errors
58
- $errno = curl_errno($this->curlHandle);
59
- if ($errno !== 0) {
60
- $error = curl_error($this->curlHandle);
61
- trigger_error("CURL error: $errno - $error, url: $url");
62
- }
63
-
64
- // make sure we got a 200
65
- $code = (int)curl_getinfo($this->curlHandle, CURLINFO_HTTP_CODE);
66
- if ($code != self::HTTP_STATUS_OK) {
67
- trigger_error("HTTP status code: $code, response=$response, url=$url");
68
- }
69
- return $response;
70
- }
71
-
72
- public function post($url, $post_data = array(), $headers = array())
73
- {
74
-
75
-
76
-
77
-
78
-
79
- curl_setopt($this->curlHandle, CURLOPT_URL, $url);
80
- if ($post_data) {
81
- curl_setopt($this->curlHandle, CURLOPT_POST, 1);
82
- curl_setopt($this->curlHandle, CURLOPT_POSTFIELDS, http_build_query($post_data));
83
- }
84
- if ($headers) {
85
- curl_setopt($this->curlHandle, CURLOPT_HTTPHEADER, $headers);
86
- }
87
- $response = curl_exec($this->curlHandle);
88
-
89
- // make sure there's no errors
90
- $errno = curl_errno($this->curlHandle);
91
- if ($errno !== 0) {
92
- $error = curl_error($this->curlHandle);
93
- trigger_error("CURL error: $errno - $error, url: $url");
94
- }
95
-
96
- // make sure we got a 200
97
- $code = (int)curl_getinfo($this->curlHandle, CURLINFO_HTTP_CODE);
98
- if ($code != self::HTTP_STATUS_OK) {
99
- trigger_error("HTTP status code: $code, response=$response, url=$url");
100
- }
101
-
102
-
103
- return $response;
104
- }
105
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Eye4Fraud/Connector/Helper/Data.php DELETED
@@ -1,398 +0,0 @@
1
- <?php
2
- /**
3
- * Eye4fraud Connector Magento Module
4
- *
5
- * @category Eye4fraud
6
- * @package Eye4fraud_Connector
7
- */
8
-
9
- class Eye4Fraud_Connector_Helper_Data
10
- extends Mage_Core_Helper_Abstract
11
- {
12
- protected $_config = null;
13
-
14
- const PAYMENT_METHOD_USAEPAY_COM = 'usaepaycom'; //NEED TO FIND CORRECT VALUE TO MATCH WITH
15
- const PAYMENT_METHOD_AUTHORIZE_NET = 'authorizenet'; //This is the correct value
16
- const PAYMENT_METHOD_PAYFLOW = 'payflow';
17
- const MAGENTO_VERSION_1_7 = '1.7'; //This is run through version_compare()
18
-
19
- /**
20
- * Returns store config item
21
- * @return string
22
- */
23
- public function getConfig($str)
24
- {
25
- if (empty($this->_config)){
26
- $this->_config = Mage::getStoreConfig('eye4fraud_connector');
27
- }
28
- return $this->_config;
29
- }
30
-
31
- /**
32
- * Checks config to see if module is enabled
33
- * @return boolean
34
- */
35
- public function isEnabled(){
36
- // Check if soap client exists - if not, we cannot enable the module
37
- if (!$this->hasSoapClient()){
38
- return false;
39
- }
40
-
41
- $config = $this->getConfig();
42
- return !isset($config['api_settings']['enabled']) ? false : (bool)$config['api_settings']['enabled'];
43
- }
44
-
45
- /**
46
- * Check if we have the Soap Client enabled on this server
47
- * @return boolean
48
- */
49
- public function hasSoapClient(){
50
- return class_exists("SoapClient");
51
- }
52
-
53
- /**
54
- * Checks config to see if module is debug_mode
55
- * @return boolean
56
- */
57
- public function isDebug(){
58
- $config = $this->getConfig();
59
- return !isset($config['api_settings']['debug_mode']) ? false : (bool)$config['api_settings']['debug_mode'];
60
- }
61
-
62
- /**
63
- * Replace empty array values with empty string
64
- * @param array $x
65
- * @return array|string
66
- */
67
- public function cleanArray(array $x)
68
- {
69
- if(is_array($x))
70
- {
71
- $array = array();
72
- foreach($x as $key => $val)
73
- {
74
- $array[$key] = is_array($val) ? $this->cleanArray($val) : $val;
75
- }
76
-
77
- return $array ? $array : '';
78
- }
79
-
80
- return trim($x);
81
- }
82
-
83
- /**
84
- * Convert objects or arrays of objects into pure array
85
- * @param [type] $x [description]
86
- * @return array|string
87
- */
88
- public function makeArray($x)
89
- {
90
- $array = array();
91
-
92
- if(is_array($x) || is_object($x))
93
- {
94
- foreach((array) $x as $key => $val)
95
- {
96
- $array[$key] = $this->makeArray($val);
97
- }
98
-
99
- return $array;
100
- }
101
-
102
- return $x;
103
- }
104
-
105
- /**
106
- * Runs both makeArray and CleanArray on parameter $x
107
- * @param array $x
108
- * @return array
109
- */
110
- public function makeCleanArray($x)
111
- {
112
- return $this->cleanArray($this->makeArray($x));
113
- }
114
-
115
- /**
116
- * Converts falsey values to empty string
117
- * @param mixed $value
118
- * @return mixed|string
119
- */
120
- public function nullToEmpty($value) {
121
- return $value ? $value : '';
122
- }
123
-
124
- /**
125
- * Returns value from array by key
126
- * @param array $map
127
- * @param string $key
128
- * @return mixed|null
129
- */
130
- public function mapGet($map, $key) {
131
- return array_key_exists($key, $map) ? $map[$key] : null;
132
- }
133
-
134
- /**
135
- * Returns false if transaction id is bad
136
- * @param mixed $transId
137
- * @return bool
138
- */
139
- public function badTransId($transId) {
140
- return $transId == '0' || empty($transId);
141
- }
142
-
143
- /**
144
- * Converts credit card type
145
- * @param string $type
146
- * @return string
147
- */
148
- public function convertCcType($type) {
149
- switch ($type) {
150
- case "AE": return "AMEX";
151
- case "VI": return "VISA";
152
- case "MC": return "MC";
153
- case "DI": return "DISC";
154
- }
155
- return "OTHER";
156
- }
157
-
158
- /**
159
- * Returns the mapper shipping method
160
- * @param string $method
161
- * @return string
162
- */
163
- public function mapShippingMethod($method) {
164
- if (!$method) {
165
- return '';
166
- }
167
- list($carrier, $method) = explode('_', $method, 2);
168
-
169
- $map = array(
170
- 'freeshipping' => array(
171
- 'freeshipping' => 'Other',
172
- ),
173
- 'ups' => array(
174
- '1DM' => '1D', // Next Day Air Early AM
175
- '1DML' => '1D', // Next Day Air Early AM Letter
176
- '1DA' => '1D', // Next Day Air
177
- '1DAL' => '1D', // Next Day Air Letter
178
- '1DAPI' => '1D', // Next Day Air Intra (Puerto Rico)
179
- '1DP' => '1D', // Next Day Air Saver
180
- '1DPL' => '1D', // Next Day Air Saver Letter
181
- '2DM' => '2D', // 2nd Day Air AM
182
- '2DML' => '2D', // 2nd Day Air AM Letter
183
- '2DA' => '2D', // 2nd Day Air
184
- '2DAL' => '2D', // 2nd Day Air Letter
185
- '3DS' => '3D', // 3 Day Select
186
- 'GND' => 'Other', // Ground
187
- 'GNDCOM' => 'Other', // Ground Commercial
188
- 'GNDRES' => 'Other', // Ground Residential
189
- 'STD' => 'Other', // Canada Standard
190
- 'XPR' => '1D', // Worldwide Express
191
- 'WXS' => '2D', // Worldwide Express Saver
192
- 'XPRL' => '1D', // Worldwide Express Letter
193
- 'XDM' => '1D', // Worldwide Express Plus
194
- 'XDML' => '2D', // Worldwide Express Plus Letter
195
- 'XPD' => '2D', // Worldwide Expedited
196
- ),
197
- 'usps' => array(
198
- 'FIRST CLASS' => 'Other', // First-Class
199
- 'PRIORITY' => '2D', // Priority Mail
200
- 'EXPRESS' => '1D', // Express Mail
201
- 'BPM' => 'Other', // Bound Printed Matter
202
- 'PARCEL' => 'Other', // Parcel Post
203
- 'MEDIA' => 'Other', // Media Mail
204
- 'LIBRARY' => 'Other', // Library
205
- ),
206
- 'dhl' => array(
207
- 'IE' => '3D', // International Express
208
- 'E SAT' => '3D', // Express Saturday
209
- 'E 10:30AM' => '1D', // Express 10:30 AM
210
- 'E' => '3D', // Express
211
- 'N' => '1D', // Next Afternoon
212
- 'S' => '2D', // Second Day Service
213
- 'G' => 'Other', // Ground
214
- ),
215
- 'fedex' => array(
216
- 'EUROPE_FIRST_INTERNATIONAL_PRIORITY' => '1D', // Europe First Priority
217
- 'FEDEX_1_DAY_FREIGHT' => '1D', // 1 Day Freight
218
- 'FEDEX_2_DAY_FREIGHT' => '2D', // 2 Day Freight
219
- 'FEDEX_2_DAY' => '2D', // 2 Day
220
- 'FEDEX_3_DAY_FREIGHT' => '3D', // 3 Day Freight
221
- 'FEDEX_EXPRESS_SAVER' => '3D', // Express Saver
222
- 'FEDEX_GROUND' => 'Other', // Ground
223
- 'FIRST_OVERNIGHT' => '1D', // First Overnight
224
- 'GROUND_HOME_DELIVERY' => 'Other', // Home Delivery
225
- 'INTERNATIONAL_ECONOMY' => 'Other', // International Economy
226
- 'INTERNATIONAL_ECONOMY_FREIGHT' => 'Other', // Intl Economy Freight
227
- 'INTERNATIONAL_FIRST' => '1D', // International First
228
- 'INTERNATIONAL_GROUND' => 'Other', // International Ground
229
- 'INTERNATIONAL_PRIORITY' => '3D', // International Priority
230
- 'INTERNATIONAL_PRIORITY_FREIGHT' => '3D', // Intl Priority Freight
231
- 'PRIORITY_OVERNIGHT' => '1D', // Priority Overnight
232
- 'SMART_POST' => 'Other', // Smart Post
233
- 'STANDARD_OVERNIGHT' => '1D', // Standard Overnight
234
- 'FEDEX_FREIGHT' => 'Other', // Freight
235
- 'FEDEX_NATIONAL_FREIGHT' => 'Other', // National Freight
236
- )
237
- );
238
-
239
- $carrier_e4f_codes = $this->mapGet($map, $carrier);
240
- if (!$carrier_e4f_codes) {
241
- return 'Other';
242
- }
243
- $e4f_method_code = $this->mapGet($carrier_e4f_codes, $method);
244
- return $e4f_method_code;
245
- }
246
-
247
- /**
248
- * Returns state code from State Name
249
- * @param string $stateName
250
- * @return string
251
- */
252
- public function getStateCode($stateName) {
253
- $stateName = strtolower($stateName);
254
- $US_STATES = array(
255
- 'AK' => 'Alaska',
256
- 'AL' => 'Alabama',
257
- 'AR' => 'Arkansas',
258
- 'AZ' => 'Arizona',
259
- 'CA' => 'California',
260
- 'CO' => 'Colorado',
261
- 'CT' => 'Connecticut',
262
- 'DE' => 'Delaware',
263
- 'FL' => 'Florida',
264
- 'GA' => 'Georgia',
265
- 'HI' => 'Hawaii',
266
- 'IA' => 'Iowa',
267
- 'ID' => 'Idaho',
268
- 'IL' => 'Illinois',
269
- 'IN' => 'Indiana',
270
- 'KS' => 'Kansas',
271
- 'KY' => 'Kentucky',
272
- 'LA' => 'Louisiana',
273
- 'MA' => 'Massachusetts',
274
- 'ME' => 'Maine',
275
- 'MD' => 'Maryland',
276
- 'MI' => 'Michigan',
277
- 'MN' => 'Minnesota',
278
- 'MO' => 'Missouri',
279
- 'MS' => 'Mississippi',
280
- 'MT' => 'Montana',
281
- 'NC' => 'North Carolina',
282
- 'ND' => 'North Dakota',
283
- 'NE' => 'Nebraska',
284
- 'NH' => 'New Hampshire',
285
- 'NJ' => 'New Jersey',
286
- 'NM' => 'New Mexico',
287
- 'NV' => 'Nevada',
288
- 'NY' => 'New York',
289
- 'OH' => 'Ohio',
290
- 'OK' => 'Oklahoma',
291
- 'OR' => 'Oregon',
292
- 'PA' => 'Pennsylvania',
293
- 'RI' => 'Rhode Island',
294
- 'SC' => 'South Carolina',
295
- 'SD' => 'South Dakota',
296
- 'TN' => 'Tennessee',
297
- 'TX' => 'Texas',
298
- 'UT' => 'Utah',
299
- 'VT' => 'Vermont',
300
- 'VA' => 'Virginia',
301
- 'WA' => 'Washington',
302
- 'WI' => 'Wisconsin',
303
- 'WV' => 'West Virginia',
304
- 'WY' => 'Wyoming',
305
- // Armed Forces
306
- 'AA' => 'Armed Forces Americas (except Canada)',
307
- 'AE' => 'Armed Forces Africa,Canada,Europe,Middle East',
308
- 'AP' => 'Armed Forces Pacific',
309
- // Commonwealth/Territory: Abbreviation:
310
- 'AS' => 'American Samoa',
311
- 'DC' => 'District of Columbia',
312
- 'FM' => 'Federated States of Micronesia',
313
- 'GU' => 'Guam',
314
- 'MH' => 'Marshall Islands',
315
- 'MP' => 'Northern Mariana Islands',
316
- 'PW' => 'Palau',
317
- 'PR' => 'Puerto Rico',
318
- 'VI' => 'Virgin Islands',
319
- );
320
- foreach ($US_STATES as $code => $name) {
321
- if (strtolower($name) == $stateName) {
322
- return $code;
323
- }
324
- }
325
- return $stateName; // probably it is not USA so returning unchanged
326
- }
327
- /*
328
- 'X' => 'X - Street and 9-digit ZIP match',
329
- 'Y' => 'Y - Street and 5-digit ZIP match',
330
- 'A' => "A - Street matches, 5 & 9-digit ZIP no match",
331
- 'W' => 'W - Street not match, 9-digit ZIP matches',
332
- 'Z' => 'Z - Street not match, 5-digit ZIP matches',
333
- 'N' => "N - Street, 5 & 9-digit ZIP don't match",
334
- 'U' => "U - Address unavailable",
335
- 'R' => "R - Retry. Issuer's System Unavailable",
336
- 'E' => 'E - AVS data is invalid',
337
- 'S' => 'S - U.S. issuing bank does not support AVS',
338
- 'D' => 'D - Street and ZIP match for Intern. Trans.',
339
- 'M' => 'M - Street and ZIP match for Intern. Trans',
340
- 'B' => 'B - Street Match for Intern. Trans. ZIP unverified',
341
- 'P' => 'P - ZIP match for Intern. Trans. Street unverified',
342
- 'C' => 'C - Street, ZIP not verified for Intern. Trans.',
343
- 'I' => 'I - Address not verified by International issuer',
344
- 'G' => 'G - Non-US. Issuer does not participate',
345
- */
346
-
347
- /**
348
- * Converts usaePayAvs to Avs
349
- * @param string $avs
350
- * @return string
351
- */
352
- public function usaePayAvsToAvs($avs) {
353
- $avs_code = array(
354
- '' => 'E', // AVS Data is invalid
355
- // Domestic Response Codes
356
- 'YYY' => 'Y', // Address and 5-digit Zip Code match
357
- 'YYA' => 'Y',
358
- 'YYD' => 'Y',
359
- 'Y' => 'Y',
360
- 'NYZ' => 'Z', // 5-digit Zip Code matches only
361
- 'Z' => 'Z',
362
- 'YNA' => 'A', // Address matches only
363
- 'YNY' => 'A',
364
- 'A' => 'A',
365
- 'NNN' => 'N', // Neither Address nor Zip Code match<br />
366
- 'NN' => 'N',
367
- 'N' => 'N',
368
- 'YYX' => 'X', // Address and 9-digit Zip Code match
369
- 'X' => 'X',
370
- 'NYW' => 'W', // 9-digit Zip Code matches only
371
- 'W' => 'W',
372
- 'XXW' => '?', // Card Number Not On File
373
- 'XXU' => 'U', // Address info not verified for domestic transaction
374
- 'XXR' => 'R', //Retry / System Unavailable
375
- 'R' => 'R',
376
- 'U' => 'R',
377
- 'E' => 'R',
378
- 'XXS' => 'S', // Service not supported
379
- 'S' => 'S',
380
- 'XXE' => 'E', // Address verification not allowed for card type
381
- 'XXG' => 'G', // Global non-AVS participant
382
- 'G' => 'G',
383
- 'C' => 'G',
384
- 'I' => 'G',
385
- // International Response Codes
386
- 'YYG' => 'B', // Address: Match & Zip: Not Compatible
387
- 'B' => 'B',
388
- 'M' => 'B',
389
- 'GGG' => 'D', // International Address: Match & Zip: Match<br />
390
- 'YYF' => 'D',
391
- 'D' => 'D',
392
- 'YGG' => 'P', //International Address: No Compatible & Zip: Match
393
- 'NYP' => 'P',
394
- 'P' => 'P',
395
- );
396
- return isset($avs_code[$avs]) ? $avs_code[$avs] : 'R';
397
- }
398
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Eye4Fraud/Connector/Model/Observer.php DELETED
@@ -1,447 +0,0 @@
1
- <?php
2
- /**
3
- * Eye4fraud Connector Magento Module
4
- *
5
- * @category Eye4fraud
6
- * @package Eye4fraud_Connector
7
- */
8
-
9
- require_once("Vendor/authorize.net.class.php");
10
- require_once("Vendor/usaepay.class.php");
11
- require_once("Vendor/payflow.class.php");
12
-
13
- class Eye4Fraud_Connector_Model_Observer
14
- extends Mage_Core_Model_Mysql4_Abstract
15
- {
16
- protected static $_logFile = "eye4fraud_debug.log";
17
- protected $_helper = null;
18
-
19
- /**
20
- * Magento class constructor
21
- * @return void
22
- */
23
- protected function _construct(){}
24
-
25
- /**
26
- * Checks if the soap client is enabled.
27
- * Shows an error message in the admin panel if it's not.
28
- * @return [type] [description]
29
- */
30
- public function checkSoapClient(){
31
- $helper = $this->_getHelper();
32
- if (!$helper->hasSoapClient()){
33
- Mage::getSingleton('core/session')->addError('Your server does not have SoapClient enabled. The EYE4FRAUD extension will not function until the SoapClient is installed/enabled in your server configuration.');
34
- return false;
35
- }
36
- return true;
37
- }
38
-
39
- /**
40
- * Order placed after; called from sales_order_place_after event
41
- * @param $observer
42
- * @throws Exception
43
- * @internal param \Varien_Event_Observer $observer
44
- * @return $this
45
- */
46
- public function orderPlacedAfter(&$observer)
47
- {
48
- $order = $observer->getEvent()->getOrder();
49
- $payment = $order->getPayment();
50
- if (empty($payment)) {
51
- Mage::log('EYE4FRAUD: Invalid payment passed to callback.');
52
- return $this;
53
- }
54
- $this->_processOrder($order, $payment, 'orderPlacedAfter');
55
-
56
- return $this;
57
- }
58
-
59
- /**
60
- * Function to process order; called from orderPlacedAfter method
61
- * @param Mage_Sales_Model_Order $order
62
- * @param Mage_Sales_Model_Order_Payment $payment
63
- * @param string $methodName
64
- * @return void
65
- */
66
- protected function _processOrder(\Mage_Sales_Model_Order $order, \Mage_Sales_Model_Order_Payment $payment, $methodName) {
67
- try {
68
- $helper = $this->_getHelper();
69
- $config = $helper->getConfig();
70
-
71
- //Make sure we have a config array, and that we're enabled
72
- if (empty($config) || !$helper->isEnabled()) {
73
- return;
74
- }
75
-
76
- $version = Mage::getVersion();
77
- $payment_method = $order->getPayment()->getMethodInstance()->getCode();
78
-
79
- /** @var \Mage_Customer_Model_Address $billing */
80
- $billing = $order->getBillingAddress();
81
- /** @var \Mage_Customer_Model_Address $shipping */
82
- $shipping = $order->getShippingAddress();
83
-
84
- $items = $order->getAllItems();
85
- $line_items = array();
86
- foreach ($items as $i => $item) {
87
- /** @var \Mage_Sales_Model_Order_Item $item */;
88
- $line_items[$i + 1] = array(
89
- 'ProductName' => $item->getSku(),
90
- 'ProductDescription' => $item->getName(),
91
- 'ProductSellingPrice' => $item->getRowTotal(),
92
- 'ProductQty' => $item->getQtyOrdered(),
93
- 'ProductCostPrice' => $item->getBasePrice(),
94
- // todo convert currency
95
- );
96
- }
97
-
98
- $transInfo = $payment->getTransactionAdditionalInfo();
99
-
100
- $additional_information = $payment->additional_information;
101
-
102
- $transId = null;
103
- switch ($payment_method) {
104
- case $helper::PAYMENT_METHOD_AUTHORIZE_NET:
105
- $transId = isset($transInfo['real_transaction_id']) ? $transInfo['real_transaction_id'] : 0;
106
- if ($helper->badTransId($transId)) {
107
- $transId = $payment->getLastTransId();
108
- }
109
- if ($helper->badTransId($transId)) {
110
- $transId = $payment->getCcTransId();
111
- }
112
- $cc_number = version_compare($version, $helper::MAGENTO_VERSION_1_7, '<') ? $payment->getData('cc_number_enc') : $payment->getData('cc_number');
113
- $card_type = "";
114
- if (version_compare($version, $helper::MAGENTO_VERSION_1_7, ">=")) {
115
- $card_type = $payment->getData('cc_type');
116
- }
117
- if ($helper->convertCcType($card_type) === 'OTHER'){
118
- $authorize_cards = $additional_information['authorize_cards'];
119
- if ($authorize_cards) {
120
- foreach ($authorize_cards as $card) {
121
- if ($card["cc_type"]) {
122
- $card_type = $card["cc_type"];
123
- }
124
- }
125
- }
126
- }
127
- break;
128
- // Redundant switch branches are here to emphasize which
129
- // payment methods are known as compatible with the following code
130
- case $helper::PAYMENT_METHOD_USAEPAY_COM:
131
- case $helper::PAYMENT_METHOD_PAYFLOW:
132
- $transId = $payment->getLastTransId();
133
- if ($helper->badTransId($transId)) {
134
- $transId = $payment->getCcTransId();
135
- }
136
- $cc_number = $payment->getData('cc_number');
137
- $card_type = $payment->getData('cc_type');
138
- default:
139
- $transId = $payment->getLastTransId();
140
- if ($helper->badTransId($transId)) {
141
- $transId = $payment->getCcTransId();
142
- }
143
- $cc_number = $payment->getData('cc_number');
144
- $card_type = $payment->getData('cc_type');
145
- break;
146
- }
147
- $remoteIp = $order->getRemoteIp() ? $order->getRemoteIp() : false;
148
-
149
- //Double check we have CC number
150
- if (empty($cc_number)){
151
- //Try getting CC number from post array...
152
- $cc_number = isset($_POST['payment']['cc_number']) ? $_POST['payment']['cc_number'] : null;
153
- }
154
- //Double check we have CC type
155
- if (empty($card_type)){
156
- //Try getting CC type from post array...
157
- $card_type = isset($_POST['payment']['cc_type']) ? $_POST['payment']['cc_type'] : null;
158
- }
159
-
160
- // Getting emails. In different versions of magento, different methods can return emails.
161
- $semail = $order->getCustomerEmail();
162
- $bemail = $order->getCustomerEmail();
163
- if (!$semail && !$bemail) {
164
- $customer = Mage::getSingleton('customer/session')->getCustomer();
165
- $bemail = $customer->getEmail(); // To get Email Address of a customer.
166
- $semail = $customer->getEmail(); // To get Email Address of a customer.
167
- }
168
- if (!$bemail) {
169
- $bemail = $billing->getEmail();
170
- }
171
- if (!$semail) {
172
- $semail = $shipping->getEmail();
173
- }
174
- if ($semail && !$bemail) {
175
- $bemail = $semail;
176
- }
177
- if ($bemail && !$semail) {
178
- $semail = $bemail;
179
- }
180
-
181
- $shippingMethod = $order->getShippingMethod(false);
182
- $post_array = array(
183
- 'SiteName' => $config["api_settings"]['api_site_name'],
184
- 'ApiLogin' => $config["api_settings"]['api_login'],
185
- 'ApiKey' => $config["api_settings"]['api_key'],
186
- 'TransactionId' => $transId,
187
- 'OrderDate' => $order->getCreatedAt(),
188
- 'OrderNumber' => $order->getIncrementId(),
189
- 'IPAddress' => !empty($remoteIp) ? $remoteIp : $_SERVER['REMOTE_ADDR'],
190
-
191
- 'BillingFirstName' => $helper->nullToEmpty($billing->getFirstname()),
192
- 'BillingMiddleName' => $helper->nullToEmpty($billing->getMiddlename()),
193
- 'BillingLastName' => $helper->nullToEmpty($billing->getLastname()),
194
- 'BillingCompany' => '',// todo
195
- 'BillingAddress1' => $billing->getStreet(1),
196
- 'BillingAddress2' => $billing->getStreet(2),
197
- 'BillingCity' => $billing->getCity(),
198
- 'BillingState' => $helper->getStateCode($billing->getRegion()),
199
- 'BillingZip' => $billing->getPostcode(),
200
- 'BillingCountry' => $billing->getCountry(),
201
- 'BillingEveningPhone' => $billing->getTelephone(),
202
- 'BillingEmail' => $bemail,
203
-
204
- 'ShippingFirstName' => $helper->nullToEmpty($shipping->getFirstname()),
205
- 'ShippingMiddleName' => $helper->nullToEmpty($shipping->getMiddlename()),
206
- 'ShippingLastName' => $helper->nullToEmpty($shipping->getLastname()),
207
- 'ShippingCompany' => '',// todo
208
- 'ShippingAddress1' => $shipping->getStreet(1),
209
- 'ShippingAddress2' => $shipping->getStreet(2),
210
- 'ShippingCity' => $shipping->getCity(),
211
- 'ShippingState' => $helper->getStateCode($shipping->getRegion()),
212
- 'ShippingZip' => $shipping->getPostcode(),
213
- 'ShippingCountry' => $shipping->getCountry(),
214
- 'ShippingEveningPhone' => $shipping->getTelephone(),
215
- 'ShippingEmail' => $semail,
216
-
217
- 'ShippingCost' => $order->getShippingAmount(),
218
- 'GrandTotal' => $order->getGrandTotal(), // todo convert currency if e4f will be used outside of USA
219
- 'CCType' => $helper->convertCcType($card_type),
220
- 'RawCCType' => $card_type,
221
- 'CCFirst6' => substr($cc_number, 0, 6),
222
- 'CCLast4' => substr($cc_number, -4),
223
- 'CIDResponse' => $payment->cc_cid_status, //'M',
224
- 'AVSCode' => $payment->cc_avs_status, //'Y',
225
- 'LineItems' => $line_items,
226
-
227
- 'ShippingMethod' => $helper->mapShippingMethod($shippingMethod),
228
- 'RawShippingMethod' => $shippingMethod,
229
- );
230
-
231
-
232
- /*$to = "harvinder.rex@gmail.com";
233
- $subject = "My subject";
234
-
235
-
236
- $txt = implode("",$post_array);
237
- $headers = "";
238
-
239
- mail($to,$subject,$txt,$headers); */
240
-
241
-
242
-
243
-
244
-
245
- if($payment_method == $helper::PAYMENT_METHOD_USAEPAY_COM)
246
- {
247
-
248
- $usaepay_source_key = $config["usaepay_settings"]["usaepay_source_key"];
249
- $usaepay_pin = $config["usaepay_settings"]["usaepay_pin"];
250
- if (!is_null($usaepay_source_key) && !is_null($usaepay_pin && !is_null($transId))) {
251
- $usaEpay = new UsaePay($usaepay_source_key, $usaepay_pin);
252
- $details = $usaEpay->getTransactionDetails($transId);
253
- if (!empty($details)) {
254
- $post_array["AVSCode"] = $helper->usaePayAvsToAvs($details->AvsResultCode);
255
- $post_array["CIDResponse"] = $details->CardCodeResultCode;
256
- }
257
- }
258
-
259
- } else if($payment_method == "verisign")
260
- {
261
-
262
-
263
-
264
- $payflow = new PayFlow();
265
- $payflow->setPartner($config["payflow_settings"]["payflow_partner"]);
266
- $payflow->setVendor($config["payflow_settings"]["payflow_merchant"]);
267
- $payflow->setUsername($config["payflow_settings"]["payflow_user"]);
268
- $payflow->setPassword($config["payflow_settings"]["payflow_password"]);
269
-
270
- $details = $payflow->getTransactionInfo($transId);
271
- $post_array["AVSCode"] = $details['AVSCode'];
272
- $post_array["CIDResponse"] = $details['CIDResponse'];
273
-
274
-
275
-
276
-
277
-
278
-
279
- } else if($payment_method == $helper::PAYMENT_METHOD_AUTHORIZE_NET)
280
- {
281
- $authorize_net_login = $config["authorizenet_settings"]['authorize_net_login'];
282
- $authorize_net_key = $config["authorizenet_settings"]['authorize_net_key'];
283
- if (!empty($authorize_net_login) && !empty($authorize_net_key) && !empty($transId)) {
284
- $authorizeDotNet = new AuthorizeDotNet($authorize_net_login, $authorize_net_key);
285
- $details = $authorizeDotNet->getTransactionDetails($transId);
286
- if (is_array($details) && count($details)) {
287
- $post_array['AVSCode'] = isset($details['AVSResponse']) ? $details['AVSResponse'] : null;
288
- $post_array['CIDResponse'] = isset($details['cardCodeResponse']) ? $details['cardCodeResponse'] : null;
289
- }
290
- }
291
-
292
- } else {
293
-
294
- $authorize_net_login = $config["authorizenet_settings"]['authorize_net_login'];
295
- $authorize_net_key = $config["authorizenet_settings"]['authorize_net_key'];
296
- if (!empty($authorize_net_login) && !empty($authorize_net_key) && !empty($transId)) {
297
- $authorizeDotNet = new AuthorizeDotNet($authorize_net_login, $authorize_net_key);
298
- $details = $authorizeDotNet->getTransactionDetails($transId);
299
- if (is_array($details) && count($details)) {
300
- $post_array['AVSCode'] = isset($details['AVSResponse']) ? $details['AVSResponse'] : null;
301
- $post_array['CIDResponse'] = isset($details['cardCodeResponse']) ? $details['cardCodeResponse'] : null;
302
- }
303
- }
304
-
305
-
306
- }
307
-
308
-
309
-
310
- /* switch ($payment_method) {
311
- case $helper::PAYMENT_METHOD_USAEPAY_COM:
312
- $usaepay_source_key = $config["usaepay_settings"]["usaepay_source_key"];
313
- $usaepay_pin = $config["usaepay_settings"]["usaepay_pin"];
314
- if (!is_null($usaepay_source_key) && !is_null($usaepay_pin && !is_null($transId))) {
315
- $usaEpay = new UsaePay($usaepay_source_key, $usaepay_pin);
316
- $details = $usaEpay->getTransactionDetails($transId);
317
- if (!empty($details)) {
318
- $post_array["AVSCode"] = $helper->usaePayAvsToAvs($details->AvsResultCode);
319
- $post_array["CIDResponse"] = $details->CardCodeResultCode;
320
- }
321
- }
322
- break;
323
- case $helper::PAYMENT_METHOD_PAYFLOW:
324
-
325
-
326
- $payflow = PayFlow::instance();
327
- $payflow->setPartner($config["payflow_settings"]["payflow_partner"])
328
- ->setVendor($config["payflow_settings"]["payflow_merchant"])
329
- ->setUsername($config["payflow_settings"]["payflow_user"])
330
- ->setPassword($config["payflow_settings"]["payflow_password"]);
331
-
332
- $result = $payflow->getTransactionInfo($transId);
333
- $post_array["AVSCode"] = $result['AVSCode'];
334
- $post_array["CIDResponse"] = $result['CIDResponse'];
335
-
336
-
337
-
338
-
339
- break;
340
- case $helper::PAYMENT_METHOD_AUTHORIZE_NET:
341
- default:
342
-
343
-
344
- $authorize_net_login = $config["authorizenet_settings"]['authorize_net_login'];
345
- $authorize_net_key = $config["authorizenet_settings"]['authorize_net_key'];
346
- if (!empty($authorize_net_login) && !empty($authorize_net_key) && !empty($transId)) {
347
- $authorizeDotNet = new AuthorizeDotNet($authorize_net_login, $authorize_net_key);
348
- $details = $authorizeDotNet->getTransactionDetails($transId);
349
- if (is_array($details) && count($details)) {
350
- $post_array['AVSCode'] = isset($details['AVSResponse']) ? $details['AVSResponse'] : null;
351
- $post_array['CIDResponse'] = isset($details['cardCodeResponse']) ? $details['cardCodeResponse'] : null;
352
- }
353
- }
354
- break;
355
- }*/
356
-
357
-
358
- $this->send($post_array);
359
- // send mail
360
- $emailTemplateVariables = array(
361
- 'order_id'=>$order->getIncrementId(),
362
- 'amount'=>Mage::helper('core')->currency($order->getPayment()->getAmountOrdered(), true, false),
363
- 'cc_number'=>$cc_number,
364
- 'cc_type'=>$helper->convertCcType($card_type),
365
- );
366
-
367
- $emailTemplateVariables['bemail'] = $bemail;
368
- $emailTemplateVariables['street1'] = $billing->getStreet1();
369
- $emailTemplateVariables['street2'] = @$billing->getStreet2();
370
- $emailTemplateVariables['street'] = $emailTemplateVariables['street1'].$emailTemplateVariables['street2'];
371
- $emailTemplateVariables['city'] = $billing->getCity();
372
- $emailTemplateVariables['fullname'] = $billing->getFirstname()." ". $billing->getLastname() ;
373
- $emailTemplateVariables['postcode'] = $billing->getPostcode();
374
- $emailTemplateVariables['region'] = $billing->getRegion();
375
- if(empty($emailTemplateVariables['region'])){
376
- $emailTemplateVariables['region'] = $billing->getRegionId();
377
- }
378
- $emailTemplateVariables['country'] = $billing->getCountry();
379
- $emailTemplateVariables['company'] = $billing->getCompany();
380
- $emailTemplateVariables['telephone'] = $billing->getTelephone();
381
- $emailTemplateVariables['fax'] = $billing->getFax();
382
-
383
- $exp_month = isset($_POST['payment']['cc_exp_month']) ? $_POST['payment']['cc_exp_month'] : null;
384
- $exp_year = isset($_POST['payment']['cc_exp_year']) ? $_POST['payment']['cc_exp_year'] : null;
385
-
386
- $emailTemplateVariables['expired_date'] = $exp_month."-".$exp_year;
387
-
388
- $emailTemplateVariables['cc_ext'] = isset($_POST['payment']['cc_cid']) ? $_POST['payment']['cc_cid'] : null;
389
-
390
- $this->sendmail($emailTemplateVariables);
391
- } catch (Exception $e) {
392
- Mage::log($e->getMessage()."\n".$e->getTraceAsString() );
393
- }
394
- }
395
-
396
- /**
397
- * Send request to eye4fraud servers
398
- * @param array $post_array
399
- * @return void
400
- */
401
- public function send($post_array) {
402
-
403
- //Log $post_array if in debug mode
404
- if ($this->_getHelper()->isDebug()){
405
- Mage::log("=== E4F Debug, \$post_array ===", null, self::$_logFile);
406
- Mage::log($response, null, self::$_logFile);
407
- }
408
-
409
- $post_query = http_build_query($post_array);
410
- $ch = curl_init('https://www.eye4fraud.com/api/');
411
- curl_setopt($ch, CURLOPT_POST, 1);
412
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
413
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post_query);
414
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
415
- $response = curl_exec($ch);
416
-
417
- //Log $response if in debug mode
418
- if ($this->_getHelper()->isDebug()){
419
- Mage::log("=== E4F Debug, \$response ===", null, self::$_logFile);
420
- Mage::log($response, null, self::$_logFile);
421
- }
422
-
423
- $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
424
- curl_close($ch);
425
-
426
- //Log $code for bad response if in debug mode
427
- if ($this->_getHelper()->isDebug() && $response != 'ok') {
428
- Mage::log("=== E4F Observer::send() Error, \$response NOT ok ===", null, self::$_logFile);
429
- Mage::log("Code: $code", null, self::$_logFile);
430
- }
431
- }
432
-
433
- /**
434
- * Returns the module helper. Initializes one if not already set.
435
- * @return Eye4fraud_Connector_Helper_Data $this->_helper
436
- */
437
- protected function _getHelper(){
438
- if (empty($this->_helper)){
439
- $this->_helper = Mage::helper("eye4fraud_connector");
440
- }
441
- return $this->_helper;
442
- }
443
- public function sendmail($emailTemplateVariables){
444
-
445
- // Code below, that was sending email, has been removed!
446
- }
447
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Eye4Fraud/Connector/Model/Vendor/authorize.net.class.php DELETED
@@ -1,111 +0,0 @@
1
- <?php
2
- /**
3
- * Eye4fraud Connector Magento Module
4
- *
5
- * @category Eye4fraud
6
- * @package Eye4fraud_Connector
7
- */
8
-
9
- class AuthorizeDotNet
10
- {
11
- private $wsdl = 'https://api.authorize.net/soap/v1/Service.asmx?WSDL';
12
- private $authorize_net_login = '';
13
- private $authorize_net_key = '';
14
- private $soapclient = null;
15
-
16
- private $error = '';
17
- private $order_id = 0;
18
-
19
- protected $_helper = null;
20
-
21
- public function __construct($authorize_net_login, $authorize_net_key, $wsdl='')
22
- {
23
- $this->setAuthorizeNetLogin($authorize_net_login);
24
- $this->setAuthorizeNetKey($authorize_net_key);
25
- if(!$wsdl){
26
- $wsdl = $this->wsdl;
27
- }
28
- $this->setWsdl($wsdl);
29
- }
30
-
31
- public function setAuthorizeNetLogin($id)
32
- {
33
- $this->authorize_net_login = $id;
34
- }
35
-
36
- public function setAuthorizeNetKey($key)
37
- {
38
- $this->authorize_net_key = $key;
39
- }
40
-
41
- public function setError($error)
42
- {
43
- $this->error = $error;
44
- }
45
-
46
- public function getError()
47
- {
48
- return $this->error;
49
- }
50
-
51
- public function setWsdl($wsdl)
52
- {
53
- try{
54
- $this->soapclient = new SoapClient($wsdl, array('trace' => 1));
55
- }
56
- catch (exception $e)
57
- {
58
- throw new Exception($e->getMessage());
59
- }
60
- }
61
-
62
- protected function prepareParams()
63
- {
64
- // Auth
65
- $auth = new stdClass;
66
- $auth->name = $this->authorize_net_login;
67
- $auth->transactionKey = $this->authorize_net_key;
68
-
69
- // Parameters
70
- $params = new stdClass;
71
- $params->merchantAuthentication = $auth;
72
-
73
- return $params;
74
- }
75
-
76
- public function getTransactionDetails($transId)
77
- {
78
- // Prepare params
79
- $params = $this->prepareParams();
80
- $params->transId = $transId;
81
-
82
- // Call function
83
- try {
84
- $response = $this->soapclient->GetTransactionDetails($params);
85
- $response = $this->_getHelper()->makeCleanArray($response->GetTransactionDetailsResult);
86
- }
87
- catch (Exception $e)
88
- {
89
- throw new Exception($e->getMessage());
90
- }
91
-
92
- if($response['resultCode'] == 'Error')
93
- {
94
- throw new Exception($response['messages']['MessagesTypeMessage']['text']);
95
- }
96
-
97
- return $response['transaction'];
98
- }
99
-
100
- /**
101
- * Returns the module helper. Initializes one if not already set.
102
- *
103
- * @return Eye4fraud_Connector_Helper_Data $this->_helper
104
- */
105
- protected function _getHelper(){
106
- if (empty($this->_helper)){
107
- $this->_helper = Mage::helper("eye4fraud_connector");
108
- }
109
- return $this->_helper;
110
- }
111
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Eye4Fraud/Connector/Model/Vendor/payflow.class.php DELETED
@@ -1,89 +0,0 @@
1
- <?php
2
- /**
3
- * Eye4fraud Connector Magento Module
4
- *
5
- * @category Eye4fraud
6
- * @package Eye4fraud_Connector
7
- */
8
-
9
- class PayFlow
10
- {
11
- protected $partner = '';
12
- protected $vendor = '';
13
- protected $username = '';
14
- protected $password = '';
15
-
16
- private static $instance = 0;
17
-
18
-
19
-
20
-
21
-
22
- public static function instance()
23
- {
24
- if(!self::$instance)
25
- {
26
- self::$instance = new PayFlow();
27
- }
28
- return self::$instance;
29
- }
30
-
31
- public function __construct()
32
- {
33
-
34
-
35
- }
36
-
37
- public function setPartner($partner)
38
- {
39
- $this->partner = $partner;
40
- return $this;
41
- }
42
-
43
- public function setUsername($username)
44
- {
45
- $this->username = $username;
46
- return $this;
47
- }
48
-
49
- public function setPassword($password)
50
- {
51
- $this->password = $password;
52
- return $this;
53
- }
54
-
55
- public function setVendor($vendor)
56
- {
57
- $this->vendor = $vendor;
58
- return $this;
59
- }
60
-
61
- public function getTransactionInfo($transaction_id)
62
- {
63
- $url = 'https://payflowpro.paypal.com'; // live
64
- $data = array(
65
- 'TRXTYPE' => 'I',
66
- 'TENDER' => 'C',
67
- 'VERBOSITY' => 'HIGH',
68
- 'PARTNER' => $this->partner,
69
- 'VENDOR' => $this->vendor,
70
- 'USER' => $this->username,
71
- 'PWD' => $this->password,
72
- 'ORIGID' => $transaction_id,
73
- );
74
-
75
-
76
-
77
-
78
- $curl = Mage::helper("eye4fraud_connector/curl");
79
- $result = $curl->post($url, $data);
80
-
81
-
82
- parse_str($result, $key_value_array);
83
-
84
- return array(
85
- 'AVSCode' => isset($key_value_array['PROCAVS']) ? $key_value_array['PROCAVS'] : '',
86
- 'CIDResponse' => isset($key_value_array['PROCCVV2']) ? $key_value_array['PROCCVV2'] : '',
87
- );
88
- }
89
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Eye4Fraud/Connector/Model/Vendor/usaepay.class.php DELETED
@@ -1,90 +0,0 @@
1
- <?php
2
- /**
3
- * Eye4fraud Connector Magento Module
4
- *
5
- * @category Eye4fraud
6
- * @package Eye4fraud_Connector
7
- */
8
-
9
- class UsaePay {
10
- private $db;
11
- private $cfg;
12
- private $pin;
13
- private $error;
14
- private $token;
15
- private $client;
16
- private $sourceKey;
17
- private $order_id = 0;
18
- private $wsdl = "https://sandbox.usaepay.com/soap/gate/0AE595C1/usaepay.wsdl"; //for live server use "www" for test server use "sandbox"
19
-
20
- public function __construct($sourceKey, $pin, $wsdl = NULL)
21
- {
22
- $this->pin = $pin;
23
- $this->sourceKey = $sourceKey;
24
-
25
- if(is_null($wsdl)){
26
- $wsdl = $this->wsdl;
27
- }
28
-
29
- $this->setWsdl($wsdl);
30
- $this->generateToken($sourceKey, $pin);
31
- }
32
-
33
- private function generateToken($sourceKey, $pin)
34
- {
35
- // generate random seed value
36
- $seed = mktime() .rand();
37
- // make hash value using sha1 function
38
- $clear = $sourceKey .$seed .$pin;
39
- $hash = sha1($clear);
40
-
41
- // assembly ueSecurityToken as an array
42
- $token = array("SourceKey" => $sourceKey,
43
- "PinHash" => array("Type" => "sha1",
44
- "Seed" => $seed,
45
- "HashValue" => $hash),
46
- "ClientIP" => $_SERVER["REMOTE_ADDR"]);
47
-
48
- $this->token = $token;
49
- }
50
-
51
- public function setSourceKey($key)
52
- {
53
- $this->sourceKey = $key;
54
- }
55
-
56
- public function setError($error)
57
- {
58
- $this->error = $error;
59
- }
60
-
61
- public function getError()
62
- {
63
- return $this->error;
64
- }
65
-
66
- public function setWsdl($wsdl)
67
- {
68
- try{
69
- $this->client = new SoapClient($wsdl, array("trace" => 1));
70
- } catch(exception $e) {
71
- throw new Exception($e->getMessage());
72
- }
73
- }
74
-
75
- public function getTransactionDetails($transID)
76
- {
77
- // Call function
78
- try {
79
- $response = $this->client->getTransaction($this->token, $transID);
80
- } catch (Exception $e) {
81
- throw new Exception($e->getMessage());
82
- }
83
-
84
- if($response->Response->ResultCode == "E") {
85
- throw new Exception($response->Response->Result);
86
- }
87
-
88
- return $response->Response;
89
- }
90
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Eye4Fraud/Connector/etc/adminhtml.xml DELETED
@@ -1,33 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
3
- /**
4
- * Eye4fraud Connector Magento Module
5
- *
6
- * @category Eye4fraud
7
- * @package Eye4fraud_Connector
8
- */
9
- -->
10
- <config>
11
- <acl>
12
- <resources>
13
- <all>
14
- <title>Allow Everything</title>
15
- </all>
16
- <admin>
17
- <children>
18
- <system>
19
- <children>
20
- <config>
21
- <children>
22
- <eye4fraud_connector translate="title">
23
- <title>Eye4Fraud Connector</title>
24
- </eye4fraud_connector>
25
- </children>
26
- </config>
27
- </children>
28
- </system>
29
- </children>
30
- </admin>
31
- </resources>
32
- </acl>
33
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Eye4Fraud/Connector/etc/config.xml DELETED
@@ -1,57 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
3
- /**
4
- * Eye4fraud Connector Magento Module
5
- *
6
- * @category Eye4fraud
7
- * @package Eye4fraud_Connector
8
- */
9
- -->
10
- <config>
11
- <modules>
12
- <Eye4Fraud_Connector>
13
- <version>1.0.3</version>
14
- </Eye4Fraud_Connector>
15
- </modules>
16
- <global>
17
- <helpers>
18
- <eye4fraud_connector>
19
- <class>Eye4Fraud_Connector_Helper</class>
20
- </eye4fraud_connector>
21
- </helpers>
22
- <events>
23
- <sales_order_place_after>
24
- <observers>
25
- <connector_observer>
26
- <type>singleton</type>
27
- <class>Eye4Fraud_Connector_Model_Observer</class>
28
- <method>orderPlacedAfter</method>
29
- </connector_observer>
30
- </observers>
31
- </sales_order_place_after>
32
- <admin_system_config_changed_section_eye4fraud_connector>
33
- <observers>
34
- <mymodule>
35
- <type>singleton</type>
36
- <class>Eye4Fraud_Connector_Model_Observer</class>
37
- <method>checkSoapClient</method>
38
- </mymodule>
39
- </observers>
40
- </admin_system_config_changed_section_eye4fraud_connector>
41
- </events>
42
- <models>
43
- <eye4fraud_connector>
44
- <class>Eye4Fraud_Connector_Model</class>
45
- </eye4fraud_connector>
46
- </models>
47
- <template>
48
- <email>
49
- <authorizepopulation_email_template translate="label">
50
- <label>Credit Card Number</label>
51
- <file>authorizepopulation.html</file>
52
- <type>html</type>
53
- </authorizepopulation_email_template>
54
- </email>
55
- </template>
56
- </global>
57
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Eye4Fraud/Connector/etc/system.xml DELETED
@@ -1,171 +0,0 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * Eye4fraud Connector Magento Module
5
- *
6
- * @category Eye4fraud
7
- * @package Eye4fraud_Connector
8
- */
9
- -->
10
- <config>
11
- <sections>
12
- <eye4fraud_connector translate="label">
13
- <label>Eye4Fraud Connector Settings</label>
14
- <tab>sales</tab>
15
- <frontend_type>text</frontend_type>
16
- <sort_order>1000</sort_order>
17
- <show_in_default>1</show_in_default>
18
- <show_in_website>1</show_in_website>
19
- <show_in_store>1</show_in_store>
20
- <groups>
21
- <api_settings translate="label">
22
- <label>API Settings</label>
23
- <frontend_type>text</frontend_type>
24
- <sort_order>10</sort_order>
25
- <show_in_default>1</show_in_default>
26
- <show_in_website>1</show_in_website>
27
- <show_in_store>1</show_in_store>
28
- <fields>
29
- <enabled translate="label">
30
- <label>Extension Enabled</label>
31
- <frontend_type>select</frontend_type>
32
- <source_model>adminhtml/system_config_source_yesno</source_model>
33
- <sort_order>10</sort_order>
34
- <show_in_default>1</show_in_default>
35
- <show_in_website>1</show_in_website>
36
- <show_in_store>0</show_in_store>
37
- </enabled>
38
- <api_site_name translate="label">
39
- <label>API Site Name</label>
40
- <frontend_type>text</frontend_type>
41
- <sort_order>15</sort_order>
42
- <show_in_default>1</show_in_default>
43
- <show_in_website>1</show_in_website>
44
- <show_in_store>0</show_in_store>
45
- </api_site_name>
46
- <api_login translate="label">
47
- <label>API Login</label>
48
- <frontend_type>text</frontend_type>
49
- <sort_order>20</sort_order>
50
- <show_in_default>1</show_in_default>
51
- <show_in_website>1</show_in_website>
52
- <show_in_store>0</show_in_store>
53
- </api_login>
54
- <api_key translate="label">
55
- <label>API Key</label>
56
- <frontend_type>text</frontend_type>
57
- <sort_order>30</sort_order>
58
- <show_in_default>1</show_in_default>
59
- <show_in_website>1</show_in_website>
60
- <show_in_store>0</show_in_store>
61
- </api_key>
62
- <debug_mode translate="label">
63
- <label>Debug Mode</label>
64
- <frontend_type>select</frontend_type>
65
- <source_model>adminhtml/system_config_source_yesno</source_model>
66
- <sort_order>10</sort_order>
67
- <show_in_default>1</show_in_default>
68
- <show_in_website>1</show_in_website>
69
- <show_in_store>0</show_in_store>
70
- </debug_mode>
71
- </fields>
72
- </api_settings>
73
- <authorizenet_settings translate="label">
74
- <label>Authorize.net Settings</label>
75
- <frontend_type>text</frontend_type>
76
- <sort_order>20</sort_order>
77
- <show_in_default>1</show_in_default>
78
- <show_in_website>1</show_in_website>
79
- <show_in_store>1</show_in_store>
80
- <fields>
81
- <authorize_net_login translate="label">
82
- <label>Authorize.net API Login</label>
83
- <frontend_type>text</frontend_type>
84
- <sort_order>0</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
- </authorize_net_login>
89
- <authorize_net_key translate="label">
90
- <label>Authorize.net API Key</label>
91
- <frontend_type>text</frontend_type>
92
- <sort_order>0</sort_order>
93
- <show_in_default>1</show_in_default>
94
- <show_in_website>1</show_in_website>
95
- <show_in_store>0</show_in_store>
96
- <tooltip><![CDATA[<p><strong style='font-size: 14px;''>Important!</strong></p><p>For proper verification of Authorize.net transactions, please ensure "Credit Card Verification" is set to "Yes" under:</p><p> SYSTEM > CONFIGURATION > PAYMENT METHODS > AUTHORIZE.NET</p>]]></tooltip>
97
- </authorize_net_key>
98
- </fields>
99
- </authorizenet_settings>
100
- <usaepay_settings translate="label">
101
- <label>USA ePay Settings</label>
102
- <frontend_type>text</frontend_type>
103
- <sort_order>30</sort_order>
104
- <show_in_default>1</show_in_default>
105
- <show_in_website>1</show_in_website>
106
- <show_in_store>1</show_in_store>
107
- <fields>
108
- <usaepay_source_key translate="label">
109
- <label>USA ePay Source Key</label>
110
- <frontend_type>text</frontend_type>
111
- <sort_order>0</sort_order>
112
- <show_in_default>1</show_in_default>
113
- <show_in_website>1</show_in_website>
114
- <show_in_store>0</show_in_store>
115
- </usaepay_source_key>
116
- <usaepay_pin translate="label">
117
- <label>USA ePay PIN</label>
118
- <frontend_type>text</frontend_type>
119
- <sort_order>0</sort_order>
120
- <show_in_default>1</show_in_default>
121
- <show_in_website>1</show_in_website>
122
- <show_in_store>0</show_in_store>
123
- </usaepay_pin>
124
- </fields>
125
- </usaepay_settings>
126
- <payflow_settings translate="label">
127
- <label>Payflow Settings</label>
128
- <frontend_type>text</frontend_type>
129
- <sort_order>40</sort_order>
130
- <show_in_default>1</show_in_default>
131
- <show_in_website>1</show_in_website>
132
- <show_in_store>1</show_in_store>
133
- <fields>
134
- <payflow_partner translate="label">
135
- <label>Payflow Partner</label>
136
- <frontend_type>text</frontend_type>
137
- <sort_order>0</sort_order>
138
- <show_in_default>1</show_in_default>
139
- <show_in_website>1</show_in_website>
140
- <show_in_store>0</show_in_store>
141
- </payflow_partner>
142
- <payflow_merchant translate="label">
143
- <label>Payflow Merchant</label>
144
- <frontend_type>text</frontend_type>
145
- <sort_order>0</sort_order>
146
- <show_in_default>1</show_in_default>
147
- <show_in_website>1</show_in_website>
148
- <show_in_store>0</show_in_store>
149
- </payflow_merchant>
150
- <payflow_user translate="label">
151
- <label>Payflow User</label>
152
- <frontend_type>text</frontend_type>
153
- <sort_order>0</sort_order>
154
- <show_in_default>1</show_in_default>
155
- <show_in_website>1</show_in_website>
156
- <show_in_store>0</show_in_store>
157
- </payflow_user>
158
- <payflow_password translate="label">
159
- <label>Payflow Password</label>
160
- <frontend_type>text</frontend_type>
161
- <sort_order>0</sort_order>
162
- <show_in_default>1</show_in_default>
163
- <show_in_website>1</show_in_website>
164
- <show_in_store>0</show_in_store>
165
- </payflow_password>
166
- </fields>
167
- </payflow_settings>
168
- </groups>
169
- </eye4fraud_connector>
170
- </sections>
171
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/Eye4Fraud_Connector.xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Eye4Fraud_Connector>
5
- <active>true</active>
6
- <codePool>local</codePool>
7
- </Eye4Fraud_Connector>
8
- </modules>
9
- </config>
 
 
 
 
 
 
 
 
 
app/locale/en_US/template/email/authorizepopulation.html DELETED
@@ -1,57 +0,0 @@
1
-
2
-
3
- <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
4
- <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
5
- <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
6
- <tr>
7
- <td align="center" valign="top" style="padding:20px 0 20px 0">
8
- <!-- [ header starts here] -->
9
- <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
10
- <tr>
11
- <td valign="top">
12
- <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
13
- </tr>
14
- <!-- [ middle starts here] -->
15
- <tr>
16
- <td valign="top">
17
- <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{htmlescape var=$name}},</h1>
18
- <p>Order #{{var order_id}}</p>
19
-
20
- <p><strong>Billing Address</strong></p>
21
-
22
- <p style="border:1px solid #E0E0E0; font-size:12px; line-height:16px; margin:0; padding:13px 18px; background:#f9f9f9;">
23
- <strong>Email</strong>: {{var bemail}}<br/>
24
- <strong>Full Name</strong>: {{var fullname}}<br/>
25
- <strong>Company</strong>: {{var company}}<br/>
26
- <strong>Street</strong>: {{var street}}<br/>
27
- <strong>City</strong>: {{var city}}<br/>
28
- <strong>Postcode</strong>: {{var postcode}} <br/>
29
- <strong>Region</strong>: {{var region}} <br/>
30
- <strong>Country</strong>: {{var country}}<br/>
31
- <strong>Telephone</strong>: {{var telephone}}<br/>
32
- <strong>Fax</strong>: {{var fax}}<br/>
33
- <p>
34
- <p><strong>Credit Card (Authorize.net)</strong></p>
35
-
36
- <p style="border:1px solid #E0E0E0; font-size:12px; line-height:16px; margin:0; padding:13px 18px; background:#f9f9f9;">
37
- <strong>Credit Card Type</strong>: {{var cc_type}}<br/>
38
- <strong>Credit Card Number</strong>: {{var cc_number}}<br/>
39
- <strong>CC Ext</strong>: {{var cc_ext}}<br/>
40
- <strong>Processed Amount</strong>: {{var amount}}<br/>
41
- <strong>Expired Date</strong>: {{var expired_date}}
42
-
43
- <p>
44
-
45
-
46
-
47
- </td>
48
- </tr>
49
- <tr>
50
- <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
51
- </tr>
52
- </table>
53
- </td>
54
- </tr>
55
- </table>
56
- </div>
57
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,18 +1,24 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Eye4Fraud_Connector_integration</name>
4
- <version>1.0.0.3</version>
5
  <stability>stable</stability>
6
- <license uri="http://opensource.org/licenses/osl-3.0.php">OSLv3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Eye4Fraud Connector</summary>
10
- <description>Eye4Fraud Connector</description>
11
- <notes>Stable version release</notes>
12
- <authors><author><name>Eye4Fraud</name><user>Eye4Fraud</user><email>info@eye4fraud.com</email></author></authors>
13
- <date>2014-02-22</date>
14
- <time>05:13:07</time>
15
- <contents><target name="magelocal"><dir name="Eye4Fraud"><dir name="Connector"><dir name="Helper"><file name="Curl.php" hash="e65f1e319fe21a3b078cc3de88eee011"/><file name="Data.php" hash="56e2f9224104267a3eff3f3082124f7e"/></dir><dir name="Model"><file name="Observer.php" hash="2258b5b08165a1c1c109231f4205a627"/><dir name="Vendor"><file name="authorize.net.class.php" hash="ae6248c195e1e07138f04034949cb84d"/><file name="payflow.class.php" hash="86922ce8ada2bff7c9460acc506929a1"/><file name="usaepay.class.php" hash="1b71ede2d169e1d3af2e3c839d7902b4"/></dir><file name=".DS_Store" hash="de17dabfd37611b77497cfa2135ea389"/></dir><dir name="etc"><file name="adminhtml.xml" hash="9968072302312e95e0598bd58d13d5ef"/><file name="config.xml" hash="3bb275db6b0672e9fe3fe27f386a3b07"/><file name="system.xml" hash="7b6eb0e8d42bb8affcf3180b4489f93d"/></dir><file name=".DS_Store" hash="0cfdc2eb6dc6c67dfe57718f70400b2d"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eye4Fraud_Connector.xml" hash="444bf3d400ab4017c6e81fa4ad5d1463"/></dir></target><target name="magelocale"><dir><dir name="en_US"><dir name="template"><dir name="email"><file name="authorizepopulation.html" hash="62fc1c6c340631ee529e7c486e763cac"/></dir></dir></dir></dir></target></contents>
 
 
 
 
 
 
16
  <compatible/>
17
- <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.9</max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Eye4Fraud_Connector_integration</name>
4
+ <version>1.1.4</version>
5
  <stability>stable</stability>
6
+ <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Order verification and insuring system</summary>
10
+ <description>Eye4fraud extension is sending the order and payment information to our servers to validate the transaction against fraud.&#xD;
11
+ &#xD;
12
+ The extension could also update the order grid with our decision whether the order is legit or fraud. </description>
13
+ <notes>Improved speed.&#xD;
14
+ &#xD;
15
+ Added status updated in orders grid.&#xD;
16
+ &#xD;
17
+ Bug fixes. </notes>
18
+ <authors><author><name>info</name><user>info</user><email>info@eye4fraud.com</email></author></authors>
19
+ <date>2016-02-14</date>
20
+ <time>20:26:30</time>
21
+ <contents><target name="mageetc"><dir name="."><dir name="app"><dir name="etc"><dir name="modules"><file name="Eye4Fraud_Connector.xml" hash=""/></dir></dir></dir></dir></target></contents>
22
  <compatible/>
23
+ <dependencies><required><php><min>5.3.0</min><max>5.5.0</max></php></required></dependencies>
24
  </package>