Mage_Usaepay - Version 1.1.0

Version Notes

- adds support for extended fraud protection using ThreatMetrix
- fixes bug with billing address information pulling incorrectly from the shipping address

Download this release

Release Info

Developer Tim McEwen
Extension Mage_Usaepay
Version 1.1.0
Comparing to
See all releases


Code changes from version 1.0.3 to 1.1.0

app/code/community/Mage/Usaepay/Block/Form.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * USA ePay Magento Plugin.
4
- * v1.0.3 - August 26th, 2011
5
  *
6
  * For assistance please contact devsupport@usaepay.com
7
  *
@@ -45,8 +45,11 @@
45
 
46
  class Mage_Usaepay_Block_Form extends Mage_Payment_Block_Form
47
  {
 
 
48
  protected function _construct()
49
  {
 
50
  $this->setTemplate('usaepay/form.phtml');
51
  parent::_construct();
52
  }
@@ -60,6 +63,47 @@ class Mage_Usaepay_Block_Form extends Mage_Payment_Block_Form
60
  {
61
  return Mage::getSingleton('payment/config');
62
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  public function getCcAvailableTypes()
65
  {
@@ -99,5 +143,63 @@ class Mage_Usaepay_Block_Form extends Mage_Payment_Block_Form
99
  $years[date('Y',strtotime("+$i years"))] = date('Y',strtotime("+$i years"));
100
  return $years;
101
  }
102
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
1
  <?php
2
  /**
3
  * USA ePay Magento Plugin.
4
+ * v1.1.0 - March 14th, 2012
5
  *
6
  * For assistance please contact devsupport@usaepay.com
7
  *
45
 
46
  class Mage_Usaepay_Block_Form extends Mage_Payment_Block_Form
47
  {
48
+ protected $_paymentConfig;
49
+
50
  protected function _construct()
51
  {
52
+ $this->_paymentConfig = Mage::getStoreConfig('payment/usaepay');
53
  $this->setTemplate('usaepay/form.phtml');
54
  parent::_construct();
55
  }
63
  {
64
  return Mage::getSingleton('payment/config');
65
  }
66
+
67
+ public function createExtendedFraudProfilingSession()
68
+ {
69
+ if(!$this->_paymentConfig['extendedfraudprofiling']) return false;
70
+
71
+ $checkout = Mage::getSingleton('checkout/session');
72
+ $stepIsAllowed = $checkout->getStepData('payment', 'allow');
73
+ $stepIsComplete = $checkout->getStepData('payment', 'complete');
74
+
75
+ if(!$stepIsAllowed || $stepIsComplete)
76
+ {
77
+ return false;
78
+ }
79
+
80
+ try
81
+ {
82
+ $method = $this->getMethod();
83
+
84
+ if(!$method) return false;
85
+
86
+ // payment info might not be avliable at this point (first render?)
87
+ $paymentInfo = $method->getInfoInstance();
88
+ }
89
+ catch (Exception $e)
90
+ {
91
+ Mage::logException($e);
92
+ return false;
93
+ }
94
+
95
+ $results = self::_getExtendedFraudProfilingSession($this->_paymentConfig);
96
+
97
+ // Mage::log('createExtendedFraudProfilingSession() sessionid: '.$results['sessionid']);
98
+
99
+ if($results)
100
+ {
101
+ // efp = extended fraud profiling
102
+ $paymentInfo->setAdditionalInformation('usaepay_efpSessionId', $results['sessionid']);
103
+ }
104
+
105
+ return $results;
106
+ }
107
 
108
  public function getCcAvailableTypes()
109
  {
143
  $years[date('Y',strtotime("+$i years"))] = date('Y',strtotime("+$i years"));
144
  return $years;
145
  }
146
+
147
+ static protected function _getExtendedFraudProfilingSession($config)
148
+ {
149
+ $seed = md5(mt_rand());
150
+ $action = 'getsession';
151
+
152
+ // build hash
153
+ $prehash = $action . ":" . $config['sourcepin'] . ":" . $seed;
154
+ $hash = 's/' . $seed . '/' . sha1($prehash);
155
+
156
+ // Figure out URL
157
+ $url = 'https://www.usaepay.com/interface/profiler/';
158
+ /*if(preg_match('~https://([^/]*)/~i', $this->gatewayurl, $m)) {
159
+ $url = 'https://' . $m[1] . '/interface/profiler/';
160
+ }*/
161
+
162
+ // Look for usesandbox
163
+ if($config['sandbox']) $url = "https://sandbox.usaepay.com/interface/profiler/";
164
+
165
+ // Add request paramters
166
+ $url .= $action . '?SourceKey=' . rawurlencode($config['sourcekey']) . '&Hash=' . rawurlencode($hash);
167
+
168
+ // Make Rest Call
169
+ $output = file_get_contents($url);
170
+
171
+ // Mage::log("usaepay -> extended fraud profiling session\nrequest url:\n$url\nresponse:\n$output", null, 'usaepay.log');
172
+
173
+ if(!$output) {
174
+ Mage::log('usaepay -> payment form error -> extended fraud profiling -> Blank response', Zend_Log::ERR);
175
+ return false;
176
+ }
177
+
178
+ // Parse response
179
+ $xml = simplexml_load_string($output);
180
+ if(!$xml) {
181
+ Mage::log('usaepay -> payment form error -> extended fraud profiling -> Unable to parse response', Zend_Log::ERR);
182
+ return false;
183
+ }
184
+
185
+ if($xml->Response!='A') {
186
+ Mage::log('usaepay -> payment form error -> extended fraud profiling -> ('.$xml->ErrorCode.') '.$xml->Reason, Zend_Log::ERR);
187
+ return false;
188
+ }
189
+
190
+ // assemble template
191
+ $query ='org_id=' .$xml->OrgID . '&session_id=' . $xml->SessionID;
192
+ $baseurl = "https://h.online-metrix.net/fp/";
193
+
194
+ $out = '';
195
+ $out .= '<p style="background:url('.$baseurl.'clear.png?'.$query.'&m=1)"></p>';
196
+ $out .= '<img src="'.$baseurl.'clear.png?'.$query.'&m=2" width="1" height="1" alt="">';
197
+ $out .= '<script src="'.$baseurl.'check.js?'.$query.'" type="text/javascript"></script>';
198
+ $out .= '<object type="application/x-shockwave-flash" data="'.$baseurl.'fp.swf?'.$query.'" width="1" height="1" id="thm_fp">';
199
+ $out .= ' <param name="movie" value="'.$baseurl.'fp.swf?'.$query.'" />';
200
+ $out .= '<div></div></object>';
201
+
202
+ // cast xml 'objects' as strings to avoid weird issues elsewhere (like setAdditionalInfo for payments)
203
+ return array('sessionid'=> (string)$xml->SessionID, 'orgid'=> (string)$xml->OrgID, 'html'=> $out);
204
+ }
205
  }
app/code/community/Mage/Usaepay/Helper/Data.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * USA ePay Magento Plugin.
4
- * v1.0.3 - August 26th, 2011
5
  *
6
  * For assistance please contact devsupport@usaepay.com
7
  *
1
  <?php
2
  /**
3
  * USA ePay Magento Plugin.
4
+ * v1.1.0 - March 14th, 2012
5
  *
6
  * For assistance please contact devsupport@usaepay.com
7
  *
app/code/community/Mage/Usaepay/Model/CCPaymentAction.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * USA ePay Magento Plugin.
4
- * v1.0.3 - August 26th, 2011
5
  *
6
  * For assistance please contact devsupport@usaepay.com
7
  *
@@ -66,6 +66,15 @@ class Mage_Usaepay_Model_CCPaymentAction extends Mage_Payment_Model_Method_Cc
66
 
67
  // initialize transaction object
68
  $tran = $this->_initTransaction($payment);
 
 
 
 
 
 
 
 
 
69
 
70
  // general payment data
71
  $tran->cardholder = $payment->getCcOwner();
@@ -92,28 +101,28 @@ class Mage_Usaepay_Model_CCPaymentAction extends Mage_Payment_Model_Method_Cc
92
 
93
  $tran->tax = $order->getTaxAmount();
94
  $tran->shipping = $order->getShippingAmount();
95
-
96
- // avs data
97
- list($avsstreet) = $order->getBillingAddress()->getStreet();
98
- $tran->street = $avsstreet;
99
- $tran->zip = $order->getBillingAddress()->getPostcode();
100
-
101
  $tran->description=($this->getConfigData('description')?str_replace('[orderid]',$orderid,$this->getConfigData('description')):"Magento Order #" . $orderid);
102
 
103
  // billing info
104
- $billing = $order->getShippingAddress();
105
- if (!empty($billing)) {
106
- $tran->billfname = $billing->getFirstname();
107
- $tran->billlname = $billing->getLastname();
108
- $tran->billcompany = $billing->getCompany();
109
- $tran->billstreet = $billing->getStreet(1);
110
- $tran->billstreet2 = $billing->getStreet(2);
111
- $tran->billcity = $billing->getCity();
112
- $tran->billstate = $billing->getRegion();
113
- $tran->billzip = $billing->getPostcode();
114
- $tran->billcountry = $billing->getCountry();
115
- $tran->billphone= $billing->getTelephone();
116
- $tran->custid = $billing->getCustomerId();
 
 
 
 
 
117
  }
118
 
119
  // shipping info
@@ -152,16 +161,33 @@ class Mage_Usaepay_Model_CCPaymentAction extends Mage_Payment_Model_Method_Cc
152
  ->setCcTransId($tran->refnum)
153
  ->setCcAvsStatus($tran->avs_result_code)
154
  ->setCcCidStatus($tran->cvv2_result_code);
155
-
156
-
157
 
158
  if($tran->resultcode=='A')
159
  {
160
  if($this->getConfigData('payment_action') == self::ACTION_AUTHORIZE) $payment->setLastTransId('0');
161
  else $payment->setLastTransId($tran->refnum);
162
- $payment->setStatus(self::STATUS_APPROVED);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
 
164
- //ueLogDebug("CCPaymentAction::Authorize Approved" );
165
 
166
  } elseif($tran->resultcode == 'D') {
167
 
@@ -174,6 +200,16 @@ class Mage_Usaepay_Model_CCPaymentAction extends Mage_Payment_Model_Method_Cc
174
 
175
  Mage::throwException(Mage::helper('paygate')->__('Payment authorization error: ' . $tran->error . '('.$tran->errorcode . ')'));
176
  }
 
 
 
 
 
 
 
 
 
 
177
 
178
  return $this;
179
  }
@@ -209,27 +245,27 @@ class Mage_Usaepay_Model_CCPaymentAction extends Mage_Payment_Model_Method_Cc
209
  $tran->tax = $order->getTaxAmount();
210
  $tran->shipping = $order->getShippingAmount();
211
 
212
- // avs data
213
- list($avsstreet) = $order->getBillingAddress()->getStreet();
214
- $tran->street = $avsstreet;
215
- $tran->zip = $order->getBillingAddress()->getPostcode();
216
-
217
  $tran->description=($this->getConfigData('description')?str_replace('[orderid]',$orderid,$this->getConfigData('description')):"Magento Order #" . $orderid);
218
 
219
  // billing info
220
- $billing = $order->getShippingAddress();
221
  if (!empty($billing)) {
222
- $tran->billfname = $billing->getFirstname();
223
- $tran->billlname = $billing->getLastname();
224
- $tran->billcompany = $billing->getCompany();
225
- $tran->billstreet = $billing->getStreet(1);
226
- $tran->billstreet2 = $billing->getStreet(2);
227
- $tran->billcity = $billing->getCity();
228
- $tran->billstate = $billing->getRegion();
229
- $tran->billzip = $billing->getPostcode();
230
- $tran->billcountry = $billing->getCountry();
231
- $tran->billphone= $billing->getTelephone();
232
- $tran->custid = $billing->getCustomerId();
 
 
 
 
 
233
  }
234
 
235
  // shipping info
1
  <?php
2
  /**
3
  * USA ePay Magento Plugin.
4
+ * v1.1.0 - March 14th, 2012
5
  *
6
  * For assistance please contact devsupport@usaepay.com
7
  *
66
 
67
  // initialize transaction object
68
  $tran = $this->_initTransaction($payment);
69
+
70
+ $useExtendedFraudProfiling = $this->getConfigData('extendedfraudprofiling');
71
+
72
+ if($useExtendedFraudProfiling)
73
+ {
74
+ // Mage::log('payment additional information (sessionid): '.print_r($payment->getAdditionalInformation('usaepay_efpSessionId'), true));
75
+ $sessionId = $payment->getAdditionalInformation('usaepay_efpSessionId');
76
+ if($sessionId) $tran->session = $sessionId;
77
+ }
78
 
79
  // general payment data
80
  $tran->cardholder = $payment->getCcOwner();
101
 
102
  $tran->tax = $order->getTaxAmount();
103
  $tran->shipping = $order->getShippingAmount();
104
+
 
 
 
 
 
105
  $tran->description=($this->getConfigData('description')?str_replace('[orderid]',$orderid,$this->getConfigData('description')):"Magento Order #" . $orderid);
106
 
107
  // billing info
108
+ $billing = $order->getBillingAddress();
109
+ if (!empty($billing)) {
110
+ // avs data
111
+ list($avsstreet) = $billing->getStreet();
112
+ $tran->street = $avsstreet;
113
+ $tran->zip = $billing->getPostcode();
114
+
115
+ $tran->billfname = $billing->getFirstname();
116
+ $tran->billlname = $billing->getLastname();
117
+ $tran->billcompany = $billing->getCompany();
118
+ $tran->billstreet = $billing->getStreet(1);
119
+ $tran->billstreet2 = $billing->getStreet(2);
120
+ $tran->billcity = $billing->getCity();
121
+ $tran->billstate = $billing->getRegion();
122
+ $tran->billzip = $billing->getPostcode();
123
+ $tran->billcountry = $billing->getCountry();
124
+ $tran->billphone= $billing->getTelephone();
125
+ $tran->custid = $billing->getCustomerId();
126
  }
127
 
128
  // shipping info
161
  ->setCcTransId($tran->refnum)
162
  ->setCcAvsStatus($tran->avs_result_code)
163
  ->setCcCidStatus($tran->cvv2_result_code);
 
 
164
 
165
  if($tran->resultcode=='A')
166
  {
167
  if($this->getConfigData('payment_action') == self::ACTION_AUTHORIZE) $payment->setLastTransId('0');
168
  else $payment->setLastTransId($tran->refnum);
169
+
170
+ $isResponseSet = false;
171
+ if($useExtendedFraudProfiling)
172
+ {
173
+ $useSuspectedFraudConfig = (int)$this->getConfigData('usesuspectedfraud');
174
+ $isFraud = ($useSuspectedFraudConfig === 2 && $tran->profilerResponse == 'reject') ||
175
+ ($useSuspectedFraudConfig === 3 && ($tran->profilerResponse == 'reject' || $tran->profilerResponse == 'review'));
176
+
177
+ if($useSuspectedFraudConfig && $isFraud)
178
+ {
179
+ $payment->setIsTransactionPending(true);
180
+ $payment->setIsFraudDetected(true);
181
+ $isResponseSet = true;
182
+ }
183
+ }
184
+
185
+ if(!$isResponseSet)
186
+ {
187
+ $payment->setStatus(self::STATUS_APPROVED);
188
+ }
189
 
190
+ //ueLogDebug("CCPaymentAction::Authorize Approved");
191
 
192
  } elseif($tran->resultcode == 'D') {
193
 
200
 
201
  Mage::throwException(Mage::helper('paygate')->__('Payment authorization error: ' . $tran->error . '('.$tran->errorcode . ')'));
202
  }
203
+
204
+ if ($useExtendedFraudProfiling && $tran->profilerResponse && !empty($order)) {
205
+ $comment = "Extended Fraud Profiler Results:\n";
206
+ if($tran->profilerResponse) $comment .= "<br>response: {$tran->profilerResponse}\n";
207
+ // score can be 0 so check it strictly against empty string
208
+ if($tran->profilerScore !== '') $comment .= "<br>score: {$tran->profilerScore}\n";
209
+ if($tran->profilerReason) $comment .= "<br>reason: {$tran->profilerReason}\n";
210
+ $order->addStatusHistoryComment($comment);
211
+ $order->save();
212
+ }
213
 
214
  return $this;
215
  }
245
  $tran->tax = $order->getTaxAmount();
246
  $tran->shipping = $order->getShippingAmount();
247
 
 
 
 
 
 
248
  $tran->description=($this->getConfigData('description')?str_replace('[orderid]',$orderid,$this->getConfigData('description')):"Magento Order #" . $orderid);
249
 
250
  // billing info
251
+ $billing = $order->getBillingAddress();
252
  if (!empty($billing)) {
253
+ // avs data
254
+ list($avsstreet) = $billing->getStreet();
255
+ $tran->street = $avsstreet;
256
+ $tran->zip = $billing->getPostcode();
257
+
258
+ $tran->billfname = $billing->getFirstname();
259
+ $tran->billlname = $billing->getLastname();
260
+ $tran->billcompany = $billing->getCompany();
261
+ $tran->billstreet = $billing->getStreet(1);
262
+ $tran->billstreet2 = $billing->getStreet(2);
263
+ $tran->billcity = $billing->getCity();
264
+ $tran->billstate = $billing->getRegion();
265
+ $tran->billzip = $billing->getPostcode();
266
+ $tran->billcountry = $billing->getCountry();
267
+ $tran->billphone= $billing->getTelephone();
268
+ $tran->custid = $billing->getCustomerId();
269
  }
270
 
271
  // shipping info
app/code/community/Mage/Usaepay/Model/SuspectedFraudConfigOptions.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * USA ePay Magento Plugin.
4
+ * v1.1.0 - March 14th, 2012
5
+ *
6
+ * For assistance please contact devsupport@usaepay.com
7
+ *
8
+ * Copyright (c) 2010 USAePay
9
+ * All rights reserved.
10
+ *
11
+ * Redistribution and use in source and binary forms, with or without
12
+ * modification, are permitted provided that the following conditions
13
+ * are met:
14
+ *
15
+ * - Redistributions of source code must retain the above copyright
16
+ * notice, this list of conditions and the following disclaimer.
17
+ * - Redistributions in binary form must reproduce the above
18
+ * copyright notice, this list of conditions and the following
19
+ * disclaimer in the documentation and/or other materials
20
+ * provided with the distribution.
21
+ * - Neither the name of the USAePay nor the names of its
22
+ * contributors may be used to endorse or promote products
23
+ * derived from this software without specific prior written
24
+ * permission.
25
+ *
26
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
30
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
32
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
36
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37
+ * POSSIBILITY OF SUCH DAMAGE.
38
+ *
39
+ * @category Mage
40
+ * @package Mage_Usaepay_Model
41
+ * @copyright Copyright (c) 2010 USAePay (www.usaepay.com)
42
+ * @license http://opensource.org/licenses/bsd-license.php BSD License
43
+ */
44
+
45
+ class Mage_Usaepay_Model_SuspectedFraudConfigOptions
46
+ {
47
+ public function toOptionArray()
48
+ {
49
+ return array(
50
+ array(
51
+ 'value' => 0,
52
+ 'label' => Mage::helper('paygate')->__('Never')
53
+ ),
54
+ array(
55
+ 'value' => 2,
56
+ 'label' => Mage::helper('paygate')->__('Reject only')
57
+ ),
58
+ array(
59
+ 'value' => 3,
60
+ 'label' => Mage::helper('paygate')->__('Reject and Review')
61
+ ),
62
+ );
63
+ }
64
+ }
app/code/community/Mage/Usaepay/Model/TranApi.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * USA ePay Magento Plugin.
4
- * v1.0.3 - August 26th, 2011
5
  *
6
  * Copyright (c) 2010 USAePay
7
  * All rights reserved.
@@ -256,6 +256,13 @@ class Mage_Usaepay_Model_TranApi {
256
  public $blank; // blank response
257
  public $transporterror; // transport error
258
 
 
 
 
 
 
 
 
259
  function __construct()
260
  {
261
  // Set default values.
@@ -454,7 +461,9 @@ class Mage_Usaepay_Model_TranApi {
454
  "UMsignature" => $this->signature,
455
  "UMsoftware" => $this->software,
456
  "UMignoreDuplicate" => $this->ignoreduplicate,
457
- "UMrefNum" => $this->refnum);
 
 
458
 
459
  // tack on custom fields
460
  for($i=1; $i<=20; $i++)
@@ -534,6 +543,11 @@ class Mage_Usaepay_Model_TranApi {
534
  $this->error=(isset($tmp["UMerror"])?$tmp["UMerror"]:"");
535
  $this->errorcode=(isset($tmp["UMerrorcode"])?$tmp["UMerrorcode"]:"10132");
536
  $this->custnum=(isset($tmp["UMcustnum"])?$tmp["UMcustnum"]:"");
 
 
 
 
 
537
 
538
  // Obsolete variable (for backward compatibility) At some point they will no longer be set.
539
  $this->avs=(isset($tmp["UMavsResult"])?$tmp["UMavsResult"]:"");
1
  <?php
2
  /**
3
  * USA ePay Magento Plugin.
4
+ * v1.1.0 - March 14th, 2012
5
  *
6
  * Copyright (c) 2010 USAePay
7
  * All rights reserved.
256
  public $blank; // blank response
257
  public $transporterror; // transport error
258
 
259
+ // Extended Fraud Profiler Fields
260
+ public $session; // session id
261
+ // responses fields
262
+ public $profilerScore;
263
+ public $profilerResponse;
264
+ public $profilerReason;
265
+
266
  function __construct()
267
  {
268
  // Set default values.
461
  "UMsignature" => $this->signature,
462
  "UMsoftware" => $this->software,
463
  "UMignoreDuplicate" => $this->ignoreduplicate,
464
+ "UMrefNum" => $this->refnum,
465
+ "UMsession" => $this->session
466
+ );
467
 
468
  // tack on custom fields
469
  for($i=1; $i<=20; $i++)
543
  $this->error=(isset($tmp["UMerror"])?$tmp["UMerror"]:"");
544
  $this->errorcode=(isset($tmp["UMerrorcode"])?$tmp["UMerrorcode"]:"10132");
545
  $this->custnum=(isset($tmp["UMcustnum"])?$tmp["UMcustnum"]:"");
546
+
547
+ // extended fraud profiler results
548
+ $this->profilerScore = isset($tmp['UMprofilerScore']) ? $tmp['UMprofilerScore'] : '';
549
+ $this->profilerResponse = isset($tmp['UMprofilerResponse']) ? $tmp['UMprofilerResponse'] : '';
550
+ $this->profilerReason = isset($tmp['UMprofilerReason']) ? $tmp['UMprofilerReason'] : '';
551
 
552
  // Obsolete variable (for backward compatibility) At some point they will no longer be set.
553
  $this->avs=(isset($tmp["UMavsResult"])?$tmp["UMavsResult"]:"");
app/code/community/Mage/Usaepay/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <!--
3
  /**
4
  * USA ePay Magento Plugin.
5
- * v1.0.3 - August 26th, 2011
6
  *
7
  * For assistance please contact devsupport@usaepay.com
8
  *
@@ -79,6 +79,8 @@
79
  <order_status>pending</order_status>
80
  <title>Credit Card</title>
81
  <active>0</active>
 
 
82
  <allowspecific>0</allowspecific>
83
  <cctypes>AE,VI,MC,DI</cctypes>
84
  <payment_action>authorize</payment_action>
2
  <!--
3
  /**
4
  * USA ePay Magento Plugin.
5
+ * v1.1.0 - March 14th, 2012
6
  *
7
  * For assistance please contact devsupport@usaepay.com
8
  *
79
  <order_status>pending</order_status>
80
  <title>Credit Card</title>
81
  <active>0</active>
82
+ <extendedfraudprofiling>0</extendedfraudprofiling>
83
+ <usesuspectedfraud>0</usesuspectedfraud>
84
  <allowspecific>0</allowspecific>
85
  <cctypes>AE,VI,MC,DI</cctypes>
86
  <payment_action>authorize</payment_action>
app/code/community/Mage/Usaepay/etc/system.xml CHANGED
@@ -2,7 +2,7 @@
2
  <!--
3
  /**
4
  * USA ePay Magento Plugin.
5
- * v1.0.3 - August 26th, 2011
6
  *
7
  * For assistance please contact devsupport@usaepay.com
8
  *
@@ -61,7 +61,7 @@
61
  <label>Enabled</label>
62
  <frontend_type>select</frontend_type>
63
  <source_model>adminhtml/system_config_source_yesno</source_model>
64
- <sort_order>1</sort_order>
65
  <show_in_default>1</show_in_default>
66
  <show_in_website>1</show_in_website>
67
  <show_in_store>0</show_in_store>
@@ -69,7 +69,7 @@
69
  <title translate="label">
70
  <label>Title</label>
71
  <frontend_type>text</frontend_type>
72
- <sort_order>2</sort_order>
73
  <show_in_default>1</show_in_default>
74
  <show_in_website>1</show_in_website>
75
  <show_in_store>1</show_in_store>
@@ -77,7 +77,7 @@
77
  <sourcekey translate="label">
78
  <label>Source Key</label>
79
  <frontend_type>text</frontend_type>
80
- <sort_order>3</sort_order>
81
  <show_in_default>1</show_in_default>
82
  <show_in_website>1</show_in_website>
83
  <show_in_store>0</show_in_store>
@@ -86,7 +86,7 @@
86
  <label>Source PIN</label>
87
  <comment>Must match pin assigned to source key, leave blank if no pin set.</comment>
88
  <frontend_type>text</frontend_type>
89
- <sort_order>4</sort_order>
90
  <show_in_default>1</show_in_default>
91
  <show_in_website>1</show_in_website>
92
  <show_in_store>0</show_in_store>
@@ -95,7 +95,7 @@
95
  <label>Transaction Description</label>
96
  <comment>By default "Magento Order #1235". To include order id in description use "[orderid]". For example "[My Store Order #[orderid]".</comment>
97
  <frontend_type>text</frontend_type>
98
- <sort_order>5</sort_order>
99
  <show_in_default>1</show_in_default>
100
  <show_in_website>1</show_in_website>
101
  <show_in_store>0</show_in_store>
@@ -105,7 +105,7 @@
105
  <comment>Set to yes if you want USAePay to send the customer a receipt. This is not the same as the receipt sent by Magento. If you also have Magento configured to send a receipt the customer will receive two receipts.</comment>
106
  <frontend_type>select</frontend_type>
107
  <source_model>adminhtml/system_config_source_yesno</source_model>
108
- <sort_order>6</sort_order>
109
  <show_in_default>1</show_in_default>
110
  <show_in_website>1</show_in_website>
111
  <show_in_store>0</show_in_store>
@@ -114,16 +114,36 @@
114
  <label>Receipt Template</label>
115
  <comment>Leave blank to use the default customer receipt template or enter the name of a custom receipt created in the USAePay merchant console.</comment>
116
  <frontend_type>text</frontend_type>
117
- <sort_order>7</sort_order>
 
 
 
 
 
 
 
 
 
 
118
  <show_in_default>1</show_in_default>
119
  <show_in_website>1</show_in_website>
120
  <show_in_store>0</show_in_store>
121
- </custreceipt_template>
 
 
 
 
 
 
 
 
 
 
122
  <order_status translate="label">
123
  <label>New order status</label>
124
  <frontend_type>select</frontend_type>
125
  <source_model>adminhtml/system_config_source_order_status_processing</source_model>
126
- <sort_order>8</sort_order>
127
  <show_in_default>1</show_in_default>
128
  <show_in_website>1</show_in_website>
129
  <show_in_store>0</show_in_store>
@@ -132,7 +152,7 @@
132
  <label>Use Sandbox</label>
133
  <frontend_type>select</frontend_type>
134
  <source_model>adminhtml/system_config_source_yesno</source_model>
135
- <sort_order>9</sort_order>
136
  <show_in_default>1</show_in_default>
137
  <show_in_website>1</show_in_website>
138
  <show_in_store>0</show_in_store>
@@ -141,7 +161,7 @@
141
  <label>Payment Action</label>
142
  <frontend_type>select</frontend_type>
143
  <source_model>paygate/authorizenet_source_paymentAction</source_model>
144
- <sort_order>10</sort_order>
145
  <show_in_default>1</show_in_default>
146
  <show_in_website>1</show_in_website>
147
  <show_in_store>0</show_in_store>
@@ -149,7 +169,7 @@
149
  <sort_order translate="label">
150
  <label>Sort order</label>
151
  <frontend_type>text</frontend_type>
152
- <sort_order>12</sort_order>
153
  <show_in_default>1</show_in_default>
154
  <show_in_website>1</show_in_website>
155
  <show_in_store>0</show_in_store>
@@ -158,7 +178,7 @@
158
  <label>Credit Card Types</label>
159
  <frontend_type>multiselect</frontend_type>
160
  <source_model>paygate/authorizenet_source_cctype</source_model>
161
- <sort_order>15</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>
@@ -167,7 +187,7 @@
167
  <label>Accepted currency</label>
168
  <frontend_type>select</frontend_type>
169
  <source_model>adminhtml/system_config_source_currency</source_model>
170
- <sort_order>16</sort_order>
171
  <show_in_default>1</show_in_default>
172
  <show_in_website>1</show_in_website>
173
  <show_in_store>0</show_in_store>
@@ -175,7 +195,7 @@
175
  <allowspecific translate="label">
176
  <label>Payment from applicable countries</label>
177
  <frontend_type>allowspecific</frontend_type>
178
- <sort_order>50</sort_order>
179
  <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
180
  <show_in_default>1</show_in_default>
181
  <show_in_website>1</show_in_website>
@@ -184,7 +204,7 @@
184
  <specificcountry translate="label">
185
  <label>Payment from Specific countries</label>
186
  <frontend_type>multiselect</frontend_type>
187
- <sort_order>51</sort_order>
188
  <source_model>adminhtml/system_config_source_country</source_model>
189
  <show_in_default>1</show_in_default>
190
  <show_in_website>1</show_in_website>
@@ -193,7 +213,7 @@
193
  <min_order_total translate="label">
194
  <label>Minimum Order Total</label>
195
  <frontend_type>text</frontend_type>
196
- <sort_order>98</sort_order>
197
  <show_in_default>1</show_in_default>
198
  <show_in_website>1</show_in_website>
199
  <show_in_store>0</show_in_store>
@@ -201,7 +221,7 @@
201
  <max_order_total translate="label">
202
  <label>Maximum Order Total</label>
203
  <frontend_type>text</frontend_type>
204
- <sort_order>99</sort_order>
205
  <show_in_default>1</show_in_default>
206
  <show_in_website>1</show_in_website>
207
  <show_in_store>0</show_in_store>
2
  <!--
3
  /**
4
  * USA ePay Magento Plugin.
5
+ * v1.1.0 - March 14th, 2012
6
  *
7
  * For assistance please contact devsupport@usaepay.com
8
  *
61
  <label>Enabled</label>
62
  <frontend_type>select</frontend_type>
63
  <source_model>adminhtml/system_config_source_yesno</source_model>
64
+ <sort_order>10</sort_order>
65
  <show_in_default>1</show_in_default>
66
  <show_in_website>1</show_in_website>
67
  <show_in_store>0</show_in_store>
69
  <title translate="label">
70
  <label>Title</label>
71
  <frontend_type>text</frontend_type>
72
+ <sort_order>20</sort_order>
73
  <show_in_default>1</show_in_default>
74
  <show_in_website>1</show_in_website>
75
  <show_in_store>1</show_in_store>
77
  <sourcekey translate="label">
78
  <label>Source Key</label>
79
  <frontend_type>text</frontend_type>
80
+ <sort_order>30</sort_order>
81
  <show_in_default>1</show_in_default>
82
  <show_in_website>1</show_in_website>
83
  <show_in_store>0</show_in_store>
86
  <label>Source PIN</label>
87
  <comment>Must match pin assigned to source key, leave blank if no pin set.</comment>
88
  <frontend_type>text</frontend_type>
89
+ <sort_order>40</sort_order>
90
  <show_in_default>1</show_in_default>
91
  <show_in_website>1</show_in_website>
92
  <show_in_store>0</show_in_store>
95
  <label>Transaction Description</label>
96
  <comment>By default "Magento Order #1235". To include order id in description use "[orderid]". For example "[My Store Order #[orderid]".</comment>
97
  <frontend_type>text</frontend_type>
98
+ <sort_order>50</sort_order>
99
  <show_in_default>1</show_in_default>
100
  <show_in_website>1</show_in_website>
101
  <show_in_store>0</show_in_store>
105
  <comment>Set to yes if you want USAePay to send the customer a receipt. This is not the same as the receipt sent by Magento. If you also have Magento configured to send a receipt the customer will receive two receipts.</comment>
106
  <frontend_type>select</frontend_type>
107
  <source_model>adminhtml/system_config_source_yesno</source_model>
108
+ <sort_order>60</sort_order>
109
  <show_in_default>1</show_in_default>
110
  <show_in_website>1</show_in_website>
111
  <show_in_store>0</show_in_store>
114
  <label>Receipt Template</label>
115
  <comment>Leave blank to use the default customer receipt template or enter the name of a custom receipt created in the USAePay merchant console.</comment>
116
  <frontend_type>text</frontend_type>
117
+ <sort_order>70</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>0</show_in_store>
121
+ </custreceipt_template>
122
+ <extendedfraudprofiling translate="label comment">
123
+ <label>Enable Extended Fraud Profiling</label>
124
+ <comment>This will enable customer device identification and enhanced fraud identification via a third party provider such as ThreatMetrix. To use this premium service you must signup with your merchant service provider.</comment>
125
+ <frontend_type>select</frontend_type>
126
+ <source_model>adminhtml/system_config_source_yesno</source_model>
127
+ <sort_order>80</sort_order>
128
  <show_in_default>1</show_in_default>
129
  <show_in_website>1</show_in_website>
130
  <show_in_store>0</show_in_store>
131
+ </extendedfraudprofiling>
132
+ <usesuspectedfraud translate="label comment">
133
+ <label>Set Suspected Fraud Status</label>
134
+ <comment><![CDATA[With <i>Extended Fraud Profiling</i> enabled, this will set the order status to "Suspected Fraud" depending on the profiler response.]]></comment>
135
+ <frontend_type>select</frontend_type>
136
+ <source_model>usaepay/SuspectedFraudConfigOptions</source_model>
137
+ <sort_order>81</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
+ </usesuspectedfraud>
142
  <order_status translate="label">
143
  <label>New order status</label>
144
  <frontend_type>select</frontend_type>
145
  <source_model>adminhtml/system_config_source_order_status_processing</source_model>
146
+ <sort_order>90</sort_order>
147
  <show_in_default>1</show_in_default>
148
  <show_in_website>1</show_in_website>
149
  <show_in_store>0</show_in_store>
152
  <label>Use Sandbox</label>
153
  <frontend_type>select</frontend_type>
154
  <source_model>adminhtml/system_config_source_yesno</source_model>
155
+ <sort_order>100</sort_order>
156
  <show_in_default>1</show_in_default>
157
  <show_in_website>1</show_in_website>
158
  <show_in_store>0</show_in_store>
161
  <label>Payment Action</label>
162
  <frontend_type>select</frontend_type>
163
  <source_model>paygate/authorizenet_source_paymentAction</source_model>
164
+ <sort_order>110</sort_order>
165
  <show_in_default>1</show_in_default>
166
  <show_in_website>1</show_in_website>
167
  <show_in_store>0</show_in_store>
169
  <sort_order translate="label">
170
  <label>Sort order</label>
171
  <frontend_type>text</frontend_type>
172
+ <sort_order>120</sort_order>
173
  <show_in_default>1</show_in_default>
174
  <show_in_website>1</show_in_website>
175
  <show_in_store>0</show_in_store>
178
  <label>Credit Card Types</label>
179
  <frontend_type>multiselect</frontend_type>
180
  <source_model>paygate/authorizenet_source_cctype</source_model>
181
+ <sort_order>150</sort_order>
182
  <show_in_default>1</show_in_default>
183
  <show_in_website>1</show_in_website>
184
  <show_in_store>0</show_in_store>
187
  <label>Accepted currency</label>
188
  <frontend_type>select</frontend_type>
189
  <source_model>adminhtml/system_config_source_currency</source_model>
190
+ <sort_order>160</sort_order>
191
  <show_in_default>1</show_in_default>
192
  <show_in_website>1</show_in_website>
193
  <show_in_store>0</show_in_store>
195
  <allowspecific translate="label">
196
  <label>Payment from applicable countries</label>
197
  <frontend_type>allowspecific</frontend_type>
198
+ <sort_order>170</sort_order>
199
  <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
200
  <show_in_default>1</show_in_default>
201
  <show_in_website>1</show_in_website>
204
  <specificcountry translate="label">
205
  <label>Payment from Specific countries</label>
206
  <frontend_type>multiselect</frontend_type>
207
+ <sort_order>171</sort_order>
208
  <source_model>adminhtml/system_config_source_country</source_model>
209
  <show_in_default>1</show_in_default>
210
  <show_in_website>1</show_in_website>
213
  <min_order_total translate="label">
214
  <label>Minimum Order Total</label>
215
  <frontend_type>text</frontend_type>
216
+ <sort_order>180</sort_order>
217
  <show_in_default>1</show_in_default>
218
  <show_in_website>1</show_in_website>
219
  <show_in_store>0</show_in_store>
221
  <max_order_total translate="label">
222
  <label>Maximum Order Total</label>
223
  <frontend_type>text</frontend_type>
224
+ <sort_order>181</sort_order>
225
  <show_in_default>1</show_in_default>
226
  <show_in_website>1</show_in_website>
227
  <show_in_store>0</show_in_store>
app/design/adminhtml/base/default/template/usaepay/form.phtml CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * USA ePay Magento Plugin.
4
- * v1.0.1 - January 28th, 2011
5
  *
6
  * For assistance please contact devsupport@usaepay.com
7
  *
1
  <?php
2
  /**
3
  * USA ePay Magento Plugin.
4
+ * v1.1.0 - March 14th, 2012
5
  *
6
  * For assistance please contact devsupport@usaepay.com
7
  *
app/design/frontend/base/default/template/usaepay/form.phtml CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * USA ePay Magento Plugin.
4
- * v1.0.2 - January 28th, 2011
5
  *
6
  * For assistance please contact devsupport@usaepay.com
7
  *
@@ -99,4 +99,14 @@
99
  </div>
100
  </li>
101
  </ul>
102
- </fieldset>
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  /**
3
  * USA ePay Magento Plugin.
4
+ * v1.1.0 - March 14th, 2012
5
  *
6
  * For assistance please contact devsupport@usaepay.com
7
  *
99
  </div>
100
  </li>
101
  </ul>
102
+ </fieldset>
103
+ <?php
104
+ // TODO: make sure this isn't cached
105
+ // REM: this is outside the hidden area to avoid possible http request issues
106
+ if($this->_paymentConfig['extendedfraudprofiling'])
107
+ {
108
+ $fraudProfiler = $this->createExtendedFraudProfilingSession();
109
+
110
+ if($fraudProfiler) echo '<div style="position:absolute;left:-5000px;line-height:1px;">'.$fraudProfiler['html'].'</div>';
111
+ }
112
+ ?>
app/etc/modules/Mage_Usaepay.xml CHANGED
@@ -2,7 +2,7 @@
2
  <!--
3
  /**
4
  * USA ePay Magento Plugin.
5
- * v1.0.2 - January 28th, 2011
6
  *
7
  * For assistance please contact devsupport@usaepay.com
8
  *
2
  <!--
3
  /**
4
  * USA ePay Magento Plugin.
5
+ * v1.1.0 - March 14th, 2012
6
  *
7
  * For assistance please contact devsupport@usaepay.com
8
  *
package.xml CHANGED
@@ -1,20 +1,19 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Usaepay</name>
4
- <version>1.0.3</version>
5
  <stability>stable</stability>
6
- <license uri="http://opensource.org/licenses/bsd-license.php">BSD License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Payment gateway module for USAePay. </summary>
10
- <description>Credit Card processing module for the USAePay payment gateway. Provides full payment integration, allowing merchants to manage their credit card payments entirely from within Magento. Supports partial shipments, refunds and voids.</description>
11
- <notes>* Fixed warnings in php 5.2+&#xD;
12
- * Added support for online partial refunds&#xD;
13
- * Fixed line item details</notes>
14
- <authors><author><name>Tim McEwen</name><user>tmcewen</user><email>magento@tmcode.com</email></author></authors>
15
- <date>2011-09-12</date>
16
- <time>22:19:02</time>
17
- <contents><target name="magecommunity"><dir name="Mage"><dir name="Usaepay"><dir name="Block"><file name="Form.php" hash="a33c90023e99b02a95c91a6232ce25c0"/></dir><dir name="Helper"><file name="Data.php" hash="6b09ae4d50f6d47d8ad090a0defce7f3"/></dir><dir name="Model"><file name="CCPaymentAction.php" hash="63e8c5dcdb90c06af35b64441b402a65"/><file name="TranApi.php" hash="42304b5c424b43ca7496994e92f2d593"/></dir><dir name="etc"><file name="config.xml" hash="1fae631514675f6d5f302fa3e1967f09"/><file name="system.xml" hash="1f54b1abcd0ccb6d36c622c6ab4fc436"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="usaepay"><file name="form.phtml" hash="c7e80bc686b5a3fdaeaf3c80dc2bf338"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="usaepay"><file name="form.phtml" hash="dce0f6a88065a7d3a7c5177f2595faed"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Usaepay.xml" hash="ce3835b6e22271989b4304b9cfd01224"/></dir></target></contents>
18
  <compatible/>
19
- <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Usaepay</name>
4
+ <version>1.1.0</version>
5
  <stability>stable</stability>
6
+ <license>BSD License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Payment gateway module for USAePay. </summary>
10
+ <description>Provides native support for the USAePay gateway. To use module you must first generate a source key and pin within the USAePay console.</description>
11
+ <notes>- adds support for extended fraud protection using ThreatMetrix&#xD;
12
+ - fixes bug with billing address information pulling incorrectly from the shipping address</notes>
13
+ <authors><author><name>Tim McEwen</name><user>tmcewen</user><email>tim@usaepay.com</email></author></authors>
14
+ <date>2012-03-19</date>
15
+ <time>21:53:49</time>
16
+ <contents><target name="magecommunity"><dir name="Mage"><dir name="Usaepay"><dir name="Model"><file name="CCPaymentAction.php" hash="25c0deaffbc294ff5c375db970227ce4"/><file name="SuspectedFraudConfigOptions.php" hash="86d0d52c45f33bdc3d9d8b373d5bd074"/><file name="TranApi.php" hash="674a7e1a0d9e4ebac6413c358ac9fce3"/></dir><dir name="Helper"><file name="Data.php" hash="b97c73bf3d44c55716983eb8668ff0f5"/></dir><dir name="Block"><file name="Form.php" hash="bcc77121a4d802b6c23fcc59e41dcf7a"/></dir><dir name="etc"><file name="config.xml" hash="3d04924f05fd37d38ce377a4b9dad7b1"/><file name="system.xml" hash="3225cd4696f249f84e719d41b7b92a83"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="usaepay"><file name="form.phtml" hash="e2b0a6f62d87e585ef8f976748444e9a"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="usaepay"><file name="form.phtml" hash="ab55c4c0d0980f8dd0f4750bb825f06d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Usaepay.xml" hash="9e0577b98f08666323e60431010905fb"/></dir></target></contents>
 
17
  <compatible/>
18
+ <dependencies><required><php><min>5.2.0</min><max>5.4.0</max></php></required></dependencies>
19
  </package>