Mes_Gateway - Version 1.2.1

Version Notes

Additional logging in the order history for Authorization code, AVS and CVV2 results.

Download this release

Release Info

Developer mesolutions
Extension Mes_Gateway
Version 1.2.1
Comparing to
See all releases


Code changes from version 1.2.0 to 1.2.1

app/code/community/Mes/Gateway/Model/Paymentmodel.php CHANGED
@@ -39,6 +39,7 @@ class Mes_Gateway_Model_Paymentmodel extends Mage_Payment_Model_Method_Cc {
39
  protected $_canVoid = true;
40
  protected $_canUseInternal = true; ## Creation of a transaction from the admin panel
41
  protected $_canUseCheckout = true;
 
42
  protected $_formBlockType = 'gateway/form';
43
 
44
  public function __construct() {
@@ -116,7 +117,18 @@ class Mes_Gateway_Model_Paymentmodel extends Mage_Payment_Model_Method_Cc {
116
  $response = $this->execute($requestValues);
117
  $payment->setStatus(self::STATUS_APPROVED);
118
  $payment->setTransactionId($response['transaction_id']);
 
 
 
119
  $payment->setIsTransactionClosed(0);
 
 
 
 
 
 
 
 
120
  return $this;
121
  }
122
 
@@ -141,7 +153,7 @@ class Mes_Gateway_Model_Paymentmodel extends Mage_Payment_Model_Method_Cc {
141
  $payment->setTransactionId($response['transaction_id']);
142
  $payment->setIsTransactionPending(false);
143
 
144
- return $this;
145
  }
146
  else if($this->getConfigData('payment_action') == self::ACTION_AUTHORIZE_CAPTURE)
147
  return $this->authorize($payment, $amount);
@@ -305,6 +317,32 @@ class Mes_Gateway_Model_Paymentmodel extends Mage_Payment_Model_Method_Cc {
305
  }
306
  }
307
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  private function convertTransactionType($str) {
309
  return $str == "authorize" ? "P" : "D";
310
  }
39
  protected $_canVoid = true;
40
  protected $_canUseInternal = true; ## Creation of a transaction from the admin panel
41
  protected $_canUseCheckout = true;
42
+ protected $_canSaveCc = false;
43
  protected $_formBlockType = 'gateway/form';
44
 
45
  public function __construct() {
117
  $response = $this->execute($requestValues);
118
  $payment->setStatus(self::STATUS_APPROVED);
119
  $payment->setTransactionId($response['transaction_id']);
120
+ $payment->setCcTransId($response['transaction_id']);
121
+ $payment->setCcAvsStatus($response['avs_result']);
122
+
123
  $payment->setIsTransactionClosed(0);
124
+
125
+ $textResult = '<strong>Authorization Results</strong><br />'.
126
+ '<strong>Approval Code:</strong> '.$response['auth_code'].'<br />'.
127
+ '<strong>AVS Result:</strong> '.$response['avs_result'].' - '.$this->convertAvsResult($response['avs_result']).'<br />'.
128
+ '<strong>CVV Result:</strong> '.$response['cvv2_result'].' - '.$this->convertCvvResult($response['cvv2_result']);
129
+ $order->addStatusHistoryComment($textResult, true);
130
+ $order->save();
131
+
132
  return $this;
133
  }
134
 
153
  $payment->setTransactionId($response['transaction_id']);
154
  $payment->setIsTransactionPending(false);
155
 
156
+ return $this;
157
  }
158
  else if($this->getConfigData('payment_action') == self::ACTION_AUTHORIZE_CAPTURE)
159
  return $this->authorize($payment, $amount);
317
  }
318
  }
319
 
320
+ private function convertAvsResult($resultCode) {
321
+ switch($resultCode) {
322
+ case 'G': return 'Non-U.S. issuing bank does not support AVS.';
323
+ case 'M': return 'Street address and postal code match.';
324
+ case 'N': return 'Street address and postal code do not match.';
325
+ case 'R': return 'System unavailable.';
326
+ case 'S': return 'Bank does not support AVS.';
327
+ case 'A': return 'Street address matches, but 5-digit and 9-digit postal code do not match.';
328
+ case 'X': return 'Street address and 9-digit postal code match.';
329
+ case 'Y': return 'Street address and 5-digit postal code match.';
330
+ case 'Z': return 'Street address does not match, but 5-digit postal code matches.';
331
+ default: return '';
332
+ }
333
+ }
334
+
335
+ private function convertCvvResult($resultCode) {
336
+ switch($resultCode) {
337
+ case 'M': return 'CVV Match.';
338
+ case 'N': return 'No CVV Match.';
339
+ case 'P': return 'Not Processed.';
340
+ case 'U': return 'System unavailable.';
341
+ case 'S': return 'Bank does not support verification.';
342
+ default: return '';
343
+ }
344
+ }
345
+
346
  private function convertTransactionType($str) {
347
  return $str == "authorize" ? "P" : "D";
348
  }
js/mes/mes-1.0-min.js DELETED
@@ -1,8 +0,0 @@
1
- /*!
2
- * Merchant e-Solutions Javascript Tokenization API
3
- * http://www.merchante-solutions.com
4
- *
5
- * V1.0 11/06/2012
6
- * Copyright 2012 Merchant e-Solutions
7
- */
8
- var Mes={mod10:function(f){var b,h,d,a,c,g;d=!0,a=0,h=(f+"").split("").reverse();for(c=0,g=h.length;c<g;c++){b=h[c],b=parseInt(b,10);if(d=!d){b*=2}b>9&&(b-=9),a+=b}return a%10===0},tokenize:function(d,c,a){var b=Mes.getCORS(a);if(!b){Mes.complete({code:1,text:"Unsupported Browser"},a)}else{if(!Mes.valCc(d)){Mes.complete({code:2,text:"Invalid Card Number"},a)}else{if(!Mes.valExpiry(c)){Mes.complete({code:3,text:"Invalid Expiry Date"},a)}else{b.onerror=function(){Mes.complete({code:6,text:"Transmission Error"},a)};b.onload=function(){if(typeof b.status!="undefined"&&b.status!==200){Mes.complete({code:5,text:"Http code "+b.status+" recieved"},a)}else{var e=Mes.parseJSON(b.responseText);if(e.error_code!="000"){Mes.complete({code:4,text:"Gateway Error",gateway_text:e.auth_response_text,gateway_error:e.error_code},a)}else{Mes.complete({code:0,text:"Success",token:e.transaction_id},a)}}};b.send("transaction_type=T&card_number="+d+"&card_exp_date="+c+"&resp_encoding=json")}}}},valCc:function(a){return Mes.mod10(a)&&a.length!=0},valExpiry:function(a){return a.length==4},parseJSON:function(json){var result;if(typeof JSON!=="object"){result=eval("(function(){return "+json+";})()")}else{result=JSON&&JSON.parse(json)||$.parseJSON(json)}return result},getCORS:function(a){var d=null,b="https://api.merchante-solutions.com/mes-api/tridentApi";if(typeof XMLHttpRequest!="undefined"){d=new XMLHttpRequest();if("withCredentials" in d){d.open("POST",b,true);d.setRequestHeader("Content-type","application/x-www-form-urlencoded");d.setRequestHeader("x-requested-with","XMLHttpRequest")}else{if(typeof XDomainRequest!="undefined"){d=new XDomainRequest();d.onprogress=function(){};d.ontimeout=function(){};try{d.open("POST",b)}catch(c){Mes.complete({code:7,text:c.message},a);throw c}}else{d=null}}}return d},complete:function(b,a){return typeof a=="function"?a(b):void 0}};
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mes_Gateway</name>
4
- <version>1.2.0</version>
5
  <stability>stable</stability>
6
- <license>BSD</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>This plug-in will allow credit card acceptance through the Merchant e-Solutions Payment Gateway.</summary>
10
- <description>For full setup instructions see resources.merchante-solutions.com.</description>
11
- <notes>Added Transparent Redirect option during checkout. This lowers PCI requirements by not transmitting the full card number to Magento.</notes>
12
- <authors><author><name>Merchant e-Solutions</name><user>mesolutions</user><email>mes_certification@merchante-solutions.com</email></author></authors>
13
- <date>2013-03-06</date>
14
- <time>19:53:20</time>
15
- <contents><target name="magecommunity"><dir name="Mes"><dir name="Gateway"><dir name="Block"><file name="Form.php" hash="03e1cab2da92ca33015ec1f273f0b347"/></dir><dir name="Helper"><file name="Data.php" hash="1a95e5fc5e9fdbd269d9252c1cc943f9"/></dir><dir name="Model"><file name="Paymentmodel.php" hash="b37522d8fb88eaf3c144375dc95c2d69"/><file name="Session.php" hash="f6ce82220c951243ab7c65f6394c9027"/><dir name="Source"><file name="Cardtypes.php" hash="c86be0ea657658fc49fbda3639a663f0"/><file name="Currencies.php" hash="cde6d43fdd21b96c570fc082c2acaadb"/><file name="Transactiontype.php" hash="de93477fe1e51031399ece2a7fcf45ea"/></dir></dir><dir name="etc"><file name="config.xml" hash="a95891af9d6d7e4e5eadf62aea1e7858"/><file name="system.xml" hash="4e1a96a603b3ce3420bbf8e03b5b9283"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mes_Gateway.xml" hash="3c66636dd94beda5bfb984565b52aca1"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="mes"><file name="cc.phtml" hash="b60628a7afd7dcb4d8f7f9416778732c"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="mes"><file name="mes-1.0-min.js" hash="d91042c43a28462ed499dd481cf74852"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mes_Gateway</name>
4
+ <version>1.2.1</version>
5
  <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/apachepl.php">Apache Software License</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>The Official Free Processing plug-in for the MeS Payment Gateway.</summary>
10
+ <description>This plug-in will allow credit card acceptance through the Merchant e-Solutions Payment Gateway.</description>
11
+ <notes>Additional logging in the order history for Authorization code, AVS and CVV2 results.</notes>
12
+ <authors><author><name>mesolutions</name><user>mesolutions</user><email>mes_certification@merchante-solutions.com</email></author></authors>
13
+ <date>2013-04-24</date>
14
+ <time>16:25:48</time>
15
+ <contents><target name="magecommunity"><dir name="Mes"><dir name="Gateway"><dir name="Block"><file name="Form.php" hash="03e1cab2da92ca33015ec1f273f0b347"/></dir><dir name="Helper"><file name="Data.php" hash="1a95e5fc5e9fdbd269d9252c1cc943f9"/></dir><dir name="Model"><file name="Paymentmodel.php" hash="1452674749cd6fda3586c09b30fce4be"/><file name="Session.php" hash="f6ce82220c951243ab7c65f6394c9027"/><dir name="Source"><file name="Cardtypes.php" hash="c86be0ea657658fc49fbda3639a663f0"/><file name="Currencies.php" hash="cde6d43fdd21b96c570fc082c2acaadb"/><file name="Transactiontype.php" hash="de93477fe1e51031399ece2a7fcf45ea"/></dir></dir><dir name="etc"><file name="config.xml" hash="a95891af9d6d7e4e5eadf62aea1e7858"/><file name="system.xml" hash="4e1a96a603b3ce3420bbf8e03b5b9283"/></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Mes_Gateway.xml" hash="3c66636dd94beda5bfb984565b52aca1"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="mes"><file name="cc.phtml" hash="b60628a7afd7dcb4d8f7f9416778732c"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>