Mage_Usaepay - Version 1.0.3

Version Notes

* Fixed warnings in php 5.2+
* Added support for online partial refunds
* Fixed line item details

Download this release

Release Info

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


Code changes from version 1.0.1 to 1.0.3

app/code/community/Mage/Usaepay/Block/Form.php 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.0.3 - August 26th, 2011
5
  *
6
  * For assistance please contact devsupport@usaepay.com
7
  *
app/code/community/Mage/Usaepay/Helper/Data.php 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.0.3 - August 26th, 2011
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.1 - January 28th, 2011
5
  *
6
  * For assistance please contact devsupport@usaepay.com
7
  *
@@ -60,77 +60,6 @@ class Mage_Usaepay_Model_CCPaymentAction extends Mage_Payment_Model_Method_Cc
60
  protected $_canSaveCc = false;
61
 
62
  protected $_authMode = 'auto';
63
- /*
64
- public function validate()
65
- {
66
- parent::validate();
67
-
68
- $info = $this->getInfoInstance();
69
- $errorMsg = false;
70
- $availableTypes = explode(',',$this->getConfigData('cctypes'));
71
-
72
- $ccNumber = $info->getCcNumber();
73
-
74
-
75
- // remove credit card number delimiters such as "-" and space
76
- $ccNumber = preg_replace('/[\-\s]+/', '', $ccNumber);
77
- $info->setCcNumber($ccNumber);
78
-
79
- $ccType = '';
80
-
81
- if (!$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) {
82
- $errorCode = 'ccsave_expiration,ccsave_expiration_yr';
83
- $errorMsg = $this->_getHelper()->__('Incorrect credit card expiration date');
84
- }
85
-
86
- if (in_array($info->getCcType(), $availableTypes)){
87
- if ($this->validateCcNum($ccNumber)) {
88
-
89
- $ccType = 'OT';
90
- $ccTypeRegExpList = array(
91
- 'VI' => '/^4[0-9]{12}([0-9]{3})?$/', // Visa
92
- 'MC' => '/^5[1-5][0-9]{14}$/', // Master Card
93
- 'AE' => '/^3[47][0-9]{13}$/', // American Express
94
- 'DI' => '/^6011[0-9]{12}$/', // Discover
95
- 'SS' => '/^((6759[0-9]{12})|(49[013][1356][0-9]{13})|(633[34][0-9]{12})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$/'
96
- );
97
-
98
- foreach ($ccTypeRegExpList as $ccTypeMatch=>$ccTypeRegExp) {
99
- if (preg_match($ccTypeRegExp, $ccNumber)) {
100
- $ccType = $ccTypeMatch;
101
- break;
102
- }
103
- }
104
-
105
- if ($ccType!=$info->getCcType()) {
106
- $errorCode = 'ccsave_cc_type,ccsave_cc_number';
107
- $errorMsg = $this->_getHelper()->__('Credit card number mismatch with credit card type');
108
- }
109
- }
110
- else {
111
- $errorCode = 'ccsave_cc_number';
112
- $errorMsg = $this->_getHelper()->__('Invalid Credit Card Number');
113
- }
114
-
115
- }
116
-
117
- //validate credit card verification number
118
- if ($errorMsg === false && $this->hasVerification()) {
119
- $verifcationRegEx = $this->getVerificationRegEx();
120
- $regExp = isset($verifcationRegEx[$info->getCcType()]) ? $verifcationRegEx[$info->getCcType()] : '';
121
- if (!$info->getCcCid() || !$regExp || !preg_match($regExp ,$info->getCcCid())){
122
- $errorMsg = $this->_getHelper()->__('2 Please enter a valid credit card verification number.');
123
- }
124
- }
125
-
126
- if($errorMsg){
127
- Mage::throwException($errorMsg);
128
- //throw Mage::exception('Mage_Payment', $errorMsg, $errorCode);
129
- }
130
-
131
- return $this;
132
- }
133
- */
134
 
135
  public function authorize(Varien_Object $payment, $amount)
136
  {
@@ -202,9 +131,9 @@ class Mage_Usaepay_Model_CCPaymentAction extends Mage_Payment_Model_Method_Cc
202
  }
203
 
204
  // line item data
205
- foreach ($order->getAllItems() as $item) {
206
- $tran->addLine($item->getSku(), $item->getName(), '', $item->getPrice(), $item->getQty(), $item->getTaxAmount() );
207
- }
208
  }
209
 
210
  //file_put_contents(tempnam('/tmp','authorize'), print_r($payment,true));
@@ -350,15 +279,8 @@ class Mage_Usaepay_Model_CCPaymentAction extends Mage_Payment_Model_Method_Cc
350
  }
351
 
352
  return $this;
353
- }
354
-
355
-
356
- public function canRefund()
357
- {
358
- //ueLogDebug("CCPaymentAction::canRefund");
359
-
360
- return true;
361
  }
 
362
  public function refund(Varien_Object $payment, $amount)
363
  {
364
 
@@ -400,21 +322,6 @@ class Mage_Usaepay_Model_CCPaymentAction extends Mage_Payment_Model_Method_Cc
400
  }
401
  return $this;
402
  }
403
-
404
-
405
- public function processInvoice($invoice, $payment)
406
- {
407
- return $this;
408
- }
409
- public function onInvoiceCreate(Mage_Sales_Model_Invoice_Payment $payment)
410
- {
411
- }
412
-
413
- public function canCapture()
414
- {
415
- //ueLogDebug("CCPaymentAction::canCapture");
416
- return true;
417
- }
418
 
419
  public function capture(Varien_Object $payment, $amount)
420
  {
@@ -526,7 +433,7 @@ class Mage_Usaepay_Model_CCPaymentAction extends Mage_Payment_Model_Method_Cc
526
 
527
  $tran->key=$this->getConfigData('sourcekey');
528
  $tran->pin=$this->getConfigData('sourcepin');
529
- $tran->software = 'Mage_Usaepay 1.0.1';
530
  return $tran;
531
  }
532
  }
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
  *
60
  protected $_canSaveCc = false;
61
 
62
  protected $_authMode = 'auto';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  public function authorize(Varien_Object $payment, $amount)
65
  {
131
  }
132
 
133
  // line item data
134
+ foreach ($order->getAllVisibleItems() as $item) {
135
+ $tran->addLine($item->getSku(), $item->getName(), '', $item->getPrice(), $item->getQtyToInvoice(), $item->getTaxAmount());
136
+ }
137
  }
138
 
139
  //file_put_contents(tempnam('/tmp','authorize'), print_r($payment,true));
279
  }
280
 
281
  return $this;
 
 
 
 
 
 
 
 
282
  }
283
+
284
  public function refund(Varien_Object $payment, $amount)
285
  {
286
 
322
  }
323
  return $this;
324
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
 
326
  public function capture(Varien_Object $payment, $amount)
327
  {
433
 
434
  $tran->key=$this->getConfigData('sourcekey');
435
  $tran->pin=$this->getConfigData('sourcepin');
436
+ $tran->software = 'Mage_Usaepay 1.0.2';
437
  return $tran;
438
  }
439
  }
app/code/community/Mage/Usaepay/Model/TranApi.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * USA ePay Magento Plugin.
4
- * v1.0.1 - January 28th, 2011
5
  *
6
  * Copyright (c) 2010 USAePay
7
  * All rights reserved.
@@ -40,7 +40,7 @@
40
  * POSSIBILITY OF SUCH DAMAGE.
41
  *
42
  * @category Mage
43
- * @package Mage_Usaepay_Model_CCPaymentAction
44
  * @copyright Copyright (c) 2010 USAePay (www.usaepay.com)
45
  * @license http://opensource.org/licenses/bsd-license.php BSD License
46
  */
@@ -256,9 +256,7 @@ class Mage_Usaepay_Model_TranApi {
256
  public $blank; // blank response
257
  public $transporterror; // transport error
258
 
259
-
260
- // Constructor
261
- function umTransaction()
262
  {
263
  // Set default values.
264
  $this->command="sale";
@@ -270,7 +268,16 @@ class Mage_Usaepay_Model_TranApi {
270
  $this->lineitems = array();
271
  if(isset($_SERVER['REMOTE_ADDR'])) $this->ip=$_SERVER['REMOTE_ADDR'];
272
  $this->software="USAePay PHP API v" . USAEPAY_VERSION;
273
-
 
 
 
 
 
 
 
 
 
274
  }
275
 
276
  /**
@@ -283,14 +290,14 @@ class Mage_Usaepay_Model_TranApi {
283
  * @param string $taxable
284
  * @param int $qty
285
  */
286
- function addLine($sku, $name, $description, $cost, $qty, $taxable)
287
  {
288
  $this->lineitems[] = array(
289
  'sku' => $sku,
290
  'name' => $name,
291
  'description' => $description,
292
  'cost' => $cost,
293
- 'taxable' => $taxable,
294
  'qty' => $qty
295
  );
296
  }
@@ -327,7 +334,7 @@ class Mage_Usaepay_Model_TranApi {
327
  if(!$this->exp) return "Expiration Date is required";
328
  }
329
  }
330
- $this->amount=ereg_replace("[^[:digit:].]","",$this->amount);
331
  if(!$this->amount) return "Amount is required";
332
  if(!$this->invoice && !$this->orderid) return "Invoice number or Order ID is required";
333
  if(!$this->magstripe) {
@@ -486,12 +493,15 @@ class Mage_Usaepay_Model_TranApi {
486
  $data['UMhash'] = $hash;
487
  }
488
 
489
- // Figure out URL
490
- $url = ($this->gatewayurl?$this->gatewayurl:"https://www.usaepay.com/gate");
491
- if($this->usesandbox) $url = "https://sandbox.usaepay.com/gate";
492
-
493
  // Post data to Gateway
494
  $result=$this->httpPost($url, $data);
 
 
 
495
  if($result===false) return false;
496
 
497
  // result is in urlencoded format, parse into an array
@@ -607,18 +617,14 @@ class Mage_Usaepay_Model_TranApi {
607
 
608
 
609
 
610
-
611
-
612
- // Figure out URL
613
- $url = ($this->gatewayurl?$this->gatewayurl:"https://www.usaepay.com/soap/gate/15E7FB61");
614
- if($this->usesandbox) $url = "https://sandbox.usaepay.com/soap/gate/15E7FB61";
615
 
616
- // ueLogDebug("TranApi::ProcessQuickSale Request\n------------------------\n URL: $url\n Request: $data \n");
617
 
618
  // Post data to Gateway
619
  $result=$this->httpPost($url, array('xml'=>$data));
620
 
621
- // ueLogDebug("TranApi::ProcessQuickSale Response\n------------------------\n URL: $url\n" . " Response: $result\n" . "---------\n");
622
 
623
  if($result===false) return false;
624
 
@@ -718,19 +724,14 @@ class Mage_Usaepay_Model_TranApi {
718
  '</SOAP-ENV:Envelope>';
719
 
720
 
721
-
722
-
723
-
724
- // Figure out URL
725
- $url = ($this->gatewayurl?$this->gatewayurl:"https://www.usaepay.com/soap/gate/15E7FB61");
726
- if($this->usesandbox) $url = "https://sandbox.usaepay.com/soap/gate/15E7FB61";
727
 
728
- // ueLogDebug("TranApi::ProcessQuickSale Request\n------------------------\n URL: $url\n Request: $data \n");
729
 
730
  // Post data to Gateway
731
  $result=$this->httpPost($url, array('xml'=>$data));
732
 
733
- // ueLogDebug("TranApi::ProcessQuickSale Response\n------------------------\n URL: $url\n" . " Response: $result\n" . "---------\n");
734
 
735
  if($result===false) return false;
736
 
@@ -882,9 +883,11 @@ class Mage_Usaepay_Model_TranApi {
882
  $this->errorcode=10132;
883
  $this->blank=1;
884
  $this->transporterror=$this->curlerror=curl_error($ch);
 
885
  curl_close ($ch);
886
  return false;
887
  }
 
888
  curl_close ($ch);
889
  $this->rawresult=$result;
890
 
@@ -901,7 +904,7 @@ class Mage_Usaepay_Model_TranApi {
901
  }
902
 
903
  // result will be on the last line of the return
904
- $tmp=split("\n",$result);
905
  $result=$tmp[count($tmp)-1];
906
 
907
  return $result;
@@ -944,7 +947,7 @@ class Mage_Usaepay_Model_TranApi {
944
  {
945
  $this->result="Error";
946
  $this->resultcode="E";
947
- $this->error="Unable to open connection to gateway";
948
  $this->errorcode=10132;
949
  $this->blank=1;
950
  if(function_exists('error_get_last')) {
@@ -969,8 +972,6 @@ class Mage_Usaepay_Model_TranApi {
969
  $this->errorcode=10132;
970
  $this->blank=1;
971
  fclose($fd);
972
- //$this->curlerror=curl_error($ch);
973
- //curl_close ($ch);
974
  return false;
975
  }
976
 
@@ -981,10 +982,50 @@ class Mage_Usaepay_Model_TranApi {
981
 
982
  function xmlentities($string)
983
  {
984
- $string = preg_replace('/[^a-zA-Z0-9 _\-\.\'\r\n]/e', '_uePrivateXMLEntities("$0")', $string);
985
- return $string;
 
 
 
 
 
 
986
  }
987
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
988
  }
989
 
990
  function _uePrivateXMLEntities($num)
@@ -1018,104 +1059,4 @@ function _uePrivateXMLEntities($num)
1018
  159 => '&#376;');
1019
  $num = ord($num);
1020
  return (($num > 127 && $num < 160) ? $chars[$num] : "&#".$num.";" );
1021
- }
1022
-
1023
-
1024
-
1025
-
1026
- // umVerifyCreditCardNumber
1027
- // Validates a credit card and returns the type of card.
1028
- //
1029
- // Card Types:
1030
- // 1 Mastercard
1031
- // 2 Visa
1032
- // 3 American Express
1033
- // 4 Diners Club/Carte Blanche
1034
- // 10 Discover
1035
- // 20 enRoute
1036
- // 28 JCB
1037
-
1038
-
1039
- /**
1040
- * Evaluates a creditcard number and if valid, returns the card type code
1041
- *
1042
- * @param ccnum string
1043
- * @return int
1044
- */
1045
- function umVerifyCreditCardNumber($ccnum)
1046
- {
1047
- global $umErrStr;
1048
-
1049
-
1050
- //okay lets do the stupid
1051
- $ccnum=str_replace("-","",$ccnum);
1052
- $ccnum=str_replace(" ","",$ccnum);
1053
- $ccnum=str_replace("/","",$ccnum);
1054
-
1055
- if(!ereg("^[[:digit:]]{1,200}$", $ccnum)) {$umErrStr="Cardnumber contains characters that are not numbers"; return 0;}
1056
- if(!ereg("^[[:digit:]]{13,16}$", $ccnum)) {$umErrStr="Cardnumber is not between 13 and 16 digits long"; return 0;}
1057
-
1058
-
1059
- // Run Luhn Mod-10 to ensure proper check digit
1060
- $total=0;
1061
- $y=0;
1062
- for($i=strlen($ccnum)-1; $i >= 0; $i--)
1063
- {
1064
- if($y==1) $y=2; else $y=1; //multiply every other digit by 2
1065
- $tmp=substr($ccnum,$i,1)*$y;
1066
- if($tmp >9) $tmp=substr($tmp,0,1) + substr($tmp,1,1);
1067
- $total+=$tmp;
1068
- }
1069
- if($total%10) {$umErrStr="Cardnumber fails Luhn Mod-10 check digit"; return 0;}
1070
-
1071
-
1072
- switch(substr($ccnum,0,1))
1073
- {
1074
- case 2: //enRoute - First four digits must be 2014 or 2149. Only valid length is 15 digits
1075
- if((substr($ccnum,0,4) == "2014" || substr($ccnum,0,4) == "2149") && strlen($ccnum) == 15) return 20;
1076
- break;
1077
- case 3: //JCB - Um yuck, read the if statement below, and oh by the way 300 through 309 overlaps with diners club. bummer.
1078
- if((substr($ccnum,0,4) == "3088" || substr($ccnum,0,4) == "3096" || substr($ccnum,0,4) == "3112" || substr($ccnum,0,4) == "3158" || substr($ccnum,0,4) == "3337" ||
1079
- (substr($ccnum,0,8) >= "35280000" ||substr($ccnum,0,8) <= "358999999")) && strlen($ccnum)==16)
1080
- {
1081
- return 28;
1082
- } else {
1083
- switch(substr($ccnum,1,1))
1084
- {
1085
- case 4:
1086
- case 7: // American Express - First digit must be 3 and second digit 4 or 7. Only Valid length is 15
1087
- if(strlen($ccnum) == 15) return 3;
1088
- break;
1089
- case 0:
1090
- case 6:
1091
- case 8: //Diners Club/Carte Blanche - First digit must be 3 and second digit 0, 6 or 8. Only valid length is 14
1092
- if(strlen($ccnum) == 14) return 4;
1093
- break;
1094
- }
1095
- }
1096
- break;
1097
- case 4: // Visa - First digit must be a 4 and length must be either 13 or 16 digits.
1098
- if(strlen($ccnum) == 13 || strlen($ccnum) == 16)
1099
- {
1100
- return 2;
1101
- }
1102
- break;
1103
-
1104
- case 5: // Mastercard - First digit must be a 5 and second digit must be int the range 1 to 5 inclusive. Only valid length is 16
1105
- if((substr($ccnum,1,1) >=1 && substr($ccnum,1,1) <=5) && strlen($ccnum) == 16)
1106
- {
1107
- return 1;
1108
- }
1109
- break;
1110
- case 6: // Discover - First four digits must be 6011. Only valid length is 16 digits.
1111
- if(substr($ccnum,0,4) == "6011" && strlen($ccnum) == 16) return 10;
1112
- }
1113
-
1114
-
1115
- // couldn't match a card profile. time to call it quits and go home. this goose is cooked.
1116
- $umErrStr="Cardnumber did not match any known creditcard profiles";
1117
- return 0;
1118
  }
1119
-
1120
-
1121
- ?>
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.
40
  * POSSIBILITY OF SUCH DAMAGE.
41
  *
42
  * @category Mage
43
+ * @package Mage_Usaepay_Model
44
  * @copyright Copyright (c) 2010 USAePay (www.usaepay.com)
45
  * @license http://opensource.org/licenses/bsd-license.php BSD License
46
  */
256
  public $blank; // blank response
257
  public $transporterror; // transport error
258
 
259
+ function __construct()
 
 
260
  {
261
  // Set default values.
262
  $this->command="sale";
268
  $this->lineitems = array();
269
  if(isset($_SERVER['REMOTE_ADDR'])) $this->ip=$_SERVER['REMOTE_ADDR'];
270
  $this->software="USAePay PHP API v" . USAEPAY_VERSION;
271
+ }
272
+
273
+ protected function _log($message, $level = null)
274
+ {
275
+ Mage::log($message, $level, 'usaepay.log');
276
+ }
277
+
278
+ protected function _getGatewayBaseUrl()
279
+ {
280
+ return $this->usesandbox ? 'https://sandbox.usaepay.com' : 'https://www.usaepay.com';
281
  }
282
 
283
  /**
290
  * @param string $taxable
291
  * @param int $qty
292
  */
293
+ function addLine($sku, $name, $description, $cost, $qty, $taxAmount)
294
  {
295
  $this->lineitems[] = array(
296
  'sku' => $sku,
297
  'name' => $name,
298
  'description' => $description,
299
  'cost' => $cost,
300
+ 'taxable' => ($taxAmount > 0) ? 'Y' : 'N',
301
  'qty' => $qty
302
  );
303
  }
334
  if(!$this->exp) return "Expiration Date is required";
335
  }
336
  }
337
+ $this->amount = preg_replace('/[^\d.]+/', '', $this->amount);
338
  if(!$this->amount) return "Amount is required";
339
  if(!$this->invoice && !$this->orderid) return "Invoice number or Order ID is required";
340
  if(!$this->magstripe) {
493
  $data['UMhash'] = $hash;
494
  }
495
 
496
+ $url = $this->_getGatewayBaseUrl().'/gate';
497
+
498
+ // $this->_log("TranApi::Process\nURL: $url\n------------------------\nRequest:\n".print_r($data, true)."\n------------------------\n");
499
+
500
  // Post data to Gateway
501
  $result=$this->httpPost($url, $data);
502
+
503
+ // $this->_log("TranApi::Process\nResponse:\n$result\n------------------------\n");
504
+
505
  if($result===false) return false;
506
 
507
  // result is in urlencoded format, parse into an array
617
 
618
 
619
 
620
+ $url = $this->_getGatewayBaseUrl().'/soap/gate/15E7FB61';
 
 
 
 
621
 
622
+ // $this->_log("TranApi::ProcessQuickSale\nURL: $url\n------------------------\nRequest:\n$data\n------------------------\n");
623
 
624
  // Post data to Gateway
625
  $result=$this->httpPost($url, array('xml'=>$data));
626
 
627
+ // $this->_log("TranApi::ProcessQuickSale\nResponse:\n$result\n------------------------\n");
628
 
629
  if($result===false) return false;
630
 
724
  '</SOAP-ENV:Envelope>';
725
 
726
 
727
+ $url = $this->_getGatewayBaseUrl().'/soap/gate/15E7FB61';
 
 
 
 
 
728
 
729
+ // $this->_log("TranApi::ProcessQuickCredit\nURL: $url\n------------------------\nRequest:\n$data\n------------------------\n");
730
 
731
  // Post data to Gateway
732
  $result=$this->httpPost($url, array('xml'=>$data));
733
 
734
+ // $this->_log("TranApi::ProcessQuickCredit\nResponse:\n$result\n------------------------\n");
735
 
736
  if($result===false) return false;
737
 
883
  $this->errorcode=10132;
884
  $this->blank=1;
885
  $this->transporterror=$this->curlerror=curl_error($ch);
886
+ // $this->_log('curl error: '.$this->curlerror, Zend_Log::ERR);
887
  curl_close ($ch);
888
  return false;
889
  }
890
+
891
  curl_close ($ch);
892
  $this->rawresult=$result;
893
 
904
  }
905
 
906
  // result will be on the last line of the return
907
+ $tmp=explode("\n",$result);
908
  $result=$tmp[count($tmp)-1];
909
 
910
  return $result;
947
  {
948
  $this->result="Error";
949
  $this->resultcode="E";
950
+ $this->error="Unable to open connection to gateway.";
951
  $this->errorcode=10132;
952
  $this->blank=1;
953
  if(function_exists('error_get_last')) {
972
  $this->errorcode=10132;
973
  $this->blank=1;
974
  fclose($fd);
 
 
975
  return false;
976
  }
977
 
982
 
983
  function xmlentities($string)
984
  {
985
+ // $string = preg_replace('/[^a-zA-Z0-9 _\-\.\'\r\n]/e', '_uePrivateXMLEntities("$0")', $string);
986
+ $string = preg_replace_callback('/[^a-zA-Z0-9 _\-\.\'\r\n]/', array('self', '_xmlEntitesReplaceCallback'), $string);
987
+ return $string;
988
+ }
989
+
990
+ static protected function _xmlEntitesReplaceCallback($matches)
991
+ {
992
+ return self::_uePrivateXMLEntities($matches[0]);
993
  }
994
 
995
+ static protected function _uePrivateXMLEntities($char)
996
+ {
997
+ $chars = array(
998
+ 128 => '&#8364;',
999
+ 130 => '&#8218;',
1000
+ 131 => '&#402;',
1001
+ 132 => '&#8222;',
1002
+ 133 => '&#8230;',
1003
+ 134 => '&#8224;',
1004
+ 135 => '&#8225;',
1005
+ 136 => '&#710;',
1006
+ 137 => '&#8240;',
1007
+ 138 => '&#352;',
1008
+ 139 => '&#8249;',
1009
+ 140 => '&#338;',
1010
+ 142 => '&#381;',
1011
+ 145 => '&#8216;',
1012
+ 146 => '&#8217;',
1013
+ 147 => '&#8220;',
1014
+ 148 => '&#8221;',
1015
+ 149 => '&#8226;',
1016
+ 150 => '&#8211;',
1017
+ 151 => '&#8212;',
1018
+ 152 => '&#732;',
1019
+ 153 => '&#8482;',
1020
+ 154 => '&#353;',
1021
+ 155 => '&#8250;',
1022
+ 156 => '&#339;',
1023
+ 158 => '&#382;',
1024
+ 159 => '&#376;'
1025
+ );
1026
+ $num = ord($char);
1027
+ return (($num > 127 && $num < 160) ? $chars[$num] : "&#".$num.";" );
1028
+ }
1029
  }
1030
 
1031
  function _uePrivateXMLEntities($num)
1059
  159 => '&#376;');
1060
  $num = ord($num);
1061
  return (($num > 127 && $num < 160) ? $chars[$num] : "&#".$num.";" );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1062
  }
 
 
 
app/code/community/Mage/Usaepay/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <!--
3
  /**
4
  * USA ePay Magento Plugin.
5
- * v1.0.1 - January 28th, 2011
6
  *
7
  * For assistance please contact devsupport@usaepay.com
8
  *
2
  <!--
3
  /**
4
  * USA ePay Magento Plugin.
5
+ * v1.0.3 - August 26th, 2011
6
  *
7
  * For assistance please contact devsupport@usaepay.com
8
  *
app/code/community/Mage/Usaepay/etc/system.xml CHANGED
@@ -2,7 +2,7 @@
2
  <!--
3
  /**
4
  * USA ePay Magento Plugin.
5
- * v1.0.1 - January 28th, 2011
6
  *
7
  * For assistance please contact devsupport@usaepay.com
8
  *
2
  <!--
3
  /**
4
  * USA ePay Magento Plugin.
5
+ * v1.0.3 - August 26th, 2011
6
  *
7
  * For assistance please contact devsupport@usaepay.com
8
  *
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.1 - January 28th, 2011
5
  *
6
  * For assistance please contact devsupport@usaepay.com
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
  *
app/etc/modules/Mage_Usaepay.xml CHANGED
@@ -2,7 +2,7 @@
2
  <!--
3
  /**
4
  * USA ePay Magento Plugin.
5
- * v1.0.1 - January 28th, 2011
6
  *
7
  * For assistance please contact devsupport@usaepay.com
8
  *
2
  <!--
3
  /**
4
  * USA ePay Magento Plugin.
5
+ * v1.0.2 - January 28th, 2011
6
  *
7
  * For assistance please contact devsupport@usaepay.com
8
  *
package.xml CHANGED
@@ -1,20 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Usaepay</name>
4
- <version>1.0.1</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>* Add setting for changing list of accepted card types
12
-
13
- * Line item details are transmitted to gateway</notes>
14
- <authors><author><name>Tim McEwen</name><user>auto-converted</user><email>magento@tmcode.com</email></author></authors>
15
- <date>2011-01-26</date>
16
- <time>20:38:42</time>
17
- <contents><target name="magedesign"><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><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="usaepay"><file name="form.phtml" hash="87863f9b608f89133c0532e222f83a06"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Mage"><dir name="Usaepay"><dir name="Block"><file name="Form.php" hash="3df424b9b657b9cb1b60bfe187a0ea91"/></dir><dir name="etc"><file name="config.xml" hash="94897d705a7b56bd980c1831d7425cf2"/><file name="system.xml" hash="c0c4675b5815dcc7a0f780874e425887"/></dir><dir name="Helper"><file name="Data.php" hash="5ce61e29e6ab579e7b69a7b29b443521"/></dir><dir name="Model"><file name="CCPaymentAction.php" hash="97ea35d3e76a5d7e0f82d5047832d05c"/><file name="TranApi.php" hash="ade39d688faf08fa7c50d31ba05f6922"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Usaepay.xml" hash="a8ed808ca7a716465eef0961c09d8711"/></dir></target></contents>
18
  <compatible/>
19
- <dependencies/>
20
  </package>
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>