Version Notes
Added Transparent Redirect option during checkout. This lowers PCI requirements by not transmitting the full card number to Magento.
Download this release
Release Info
Developer | mesolutions |
Extension | Mes_Gateway |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.4 to 1.2.0
- app/code/community/Mes/Gateway/Block/Form.php +7 -1
- app/code/community/Mes/Gateway/Model/Paymentmodel.php +26 -11
- app/code/community/Mes/Gateway/etc/config.xml +1 -0
- app/code/community/Mes/Gateway/etc/system.xml +11 -0
- app/design/frontend/base/default/template/mes/cc.phtml +140 -3
- js/mes/mes-1.0-min.js +8 -0
- package.xml +5 -6
app/code/community/Mes/Gateway/Block/Form.php
CHANGED
@@ -38,7 +38,13 @@ class Mes_Gateway_Block_Form extends Mage_Payment_Block_Form_Cc
|
|
38 |
}
|
39 |
|
40 |
protected function _prepareLayout()
|
41 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
return parent::_prepareLayout();
|
43 |
}
|
44 |
}
|
38 |
}
|
39 |
|
40 |
protected function _prepareLayout()
|
41 |
+
{
|
42 |
+
/*
|
43 |
+
// Will not always load JS on onepagecheckout... Inlining the JS in the template for now.
|
44 |
+
$blocks = $this->getLayout()->getAllBlocks();
|
45 |
+
if(isset($blocks['head']) && $blocks['head'] != null)
|
46 |
+
$blocks['head']->addJs('mes/mes-1.0-min.js');
|
47 |
+
*/
|
48 |
return parent::_prepareLayout();
|
49 |
}
|
50 |
}
|
app/code/community/Mes/Gateway/Model/Paymentmodel.php
CHANGED
@@ -44,6 +44,21 @@ class Mes_Gateway_Model_Paymentmodel extends Mage_Payment_Model_Method_Cc {
|
|
44 |
public function __construct() {
|
45 |
}
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
public function authorize(Varien_Object $payment, $amount) {
|
48 |
if($this->getConfigData('logging'))
|
49 |
Mage::log("[MeS Gateway Module] ".$this->getConfigData('payment_action')." attempt");
|
@@ -51,12 +66,11 @@ class Mes_Gateway_Model_Paymentmodel extends Mage_Payment_Model_Method_Cc {
|
|
51 |
$order = $payment->getOrder();
|
52 |
$orderid = $order->getIncrementId();
|
53 |
$billing = $order->getBillingAddress();
|
54 |
-
$shipping = $order->getShippingAddress(); ## May not be set
|
55 |
|
56 |
$requestValues = array(
|
57 |
"profile_id" => $this->getConfigData('profile_id'),
|
58 |
"profile_key" => $this->getConfigData('profile_key'),
|
59 |
-
"card_number" => preg_replace("/[^0-9]/", "", $payment->getCcNumber()),
|
60 |
"card_exp_date" => str_pad($payment->getCcExpMonth(), 2, "0", STR_PAD_LEFT) . substr($payment->getCcExpYear(), 2, 2),
|
61 |
"cvv2" => preg_replace("/[^0-9]/", "", $payment->getCcCid()),
|
62 |
"transaction_amount" => number_format($amount, 2, '.', ''),
|
@@ -77,6 +91,15 @@ class Mes_Gateway_Model_Paymentmodel extends Mage_Payment_Model_Method_Cc {
|
|
77 |
"country_code" => $billing['country_id'],
|
78 |
);
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
## Cannot depend on device fingerprint to always be available
|
81 |
if(isset($_POST['payment']['cc_fingerprint']) && $_POST['payment']['cc_fingerprint'] != "")
|
82 |
$requestValues['device_id'] = $_POST['payment']['cc_fingerprint'];
|
@@ -97,7 +120,6 @@ class Mes_Gateway_Model_Paymentmodel extends Mage_Payment_Model_Method_Cc {
|
|
97 |
return $this;
|
98 |
}
|
99 |
|
100 |
-
|
101 |
public function capture(Varien_Object $payment, $amount) {
|
102 |
if($payment->getParentTransactionId()) {
|
103 |
if($this->getConfigData('logging'))
|
@@ -127,7 +149,6 @@ class Mes_Gateway_Model_Paymentmodel extends Mage_Payment_Model_Method_Cc {
|
|
127 |
Mage::throwException('Unable to perform action: Invalid State');
|
128 |
}
|
129 |
|
130 |
-
|
131 |
public function refund(Varien_Object $payment, $amount) {
|
132 |
if($this->getConfigData('logging'))
|
133 |
Mage::log("[MeS Gateway Module] Refund/Void attempt");
|
@@ -160,14 +181,12 @@ class Mes_Gateway_Model_Paymentmodel extends Mage_Payment_Model_Method_Cc {
|
|
160 |
$payment->setStatus(self::STATUS_APPROVED);
|
161 |
return $this;
|
162 |
}
|
163 |
-
|
164 |
-
|
165 |
public function void(Varien_Object $payment) {
|
166 |
## Void/Auth Reversal or credit(if settled).
|
167 |
return $this->refund($payment, null);
|
168 |
}
|
169 |
|
170 |
-
|
171 |
protected function execute($requestValues) {
|
172 |
if($this->getConfigData('logging'))
|
173 |
Mage::log("[MeS Gateway Module] Starting cURL");
|
@@ -265,7 +284,6 @@ class Mes_Gateway_Model_Paymentmodel extends Mage_Payment_Model_Method_Cc {
|
|
265 |
}
|
266 |
}
|
267 |
|
268 |
-
|
269 |
private function getClientReferenceNumber($order, $orderid, $crn) {
|
270 |
|
271 |
$billing = $order->getBillingAddress();
|
@@ -287,12 +305,10 @@ class Mes_Gateway_Model_Paymentmodel extends Mage_Payment_Model_Method_Cc {
|
|
287 |
}
|
288 |
}
|
289 |
|
290 |
-
|
291 |
private function convertTransactionType($str) {
|
292 |
return $str == "authorize" ? "P" : "D";
|
293 |
}
|
294 |
|
295 |
-
|
296 |
private function secureEligible($str) {
|
297 |
## Visa and MC only for 3D Secure
|
298 |
if( ($str == "VI") || ($str == "MC") )
|
@@ -300,5 +316,4 @@ class Mes_Gateway_Model_Paymentmodel extends Mage_Payment_Model_Method_Cc {
|
|
300 |
else
|
301 |
return false;
|
302 |
}
|
303 |
-
|
304 |
}
|
44 |
public function __construct() {
|
45 |
}
|
46 |
|
47 |
+
/**
|
48 |
+
* During validation, allow any valid card or a truncated card number.
|
49 |
+
* @return bool
|
50 |
+
*/
|
51 |
+
public function validate() {
|
52 |
+
$errorMsg = false;
|
53 |
+
$info = $this->getInfoInstance();
|
54 |
+
$ccNumber = $info->getCcNumber();
|
55 |
+
|
56 |
+
if(preg_match("/^\*{11,12}\d{4}/", "", $ccNumber) === 0) // matches truncated card number
|
57 |
+
return true;
|
58 |
+
else
|
59 |
+
return parent::validate();
|
60 |
+
}
|
61 |
+
|
62 |
public function authorize(Varien_Object $payment, $amount) {
|
63 |
if($this->getConfigData('logging'))
|
64 |
Mage::log("[MeS Gateway Module] ".$this->getConfigData('payment_action')." attempt");
|
66 |
$order = $payment->getOrder();
|
67 |
$orderid = $order->getIncrementId();
|
68 |
$billing = $order->getBillingAddress();
|
69 |
+
$shipping = $order->getShippingAddress(); ## May not be set when digital goods are sold
|
70 |
|
71 |
$requestValues = array(
|
72 |
"profile_id" => $this->getConfigData('profile_id'),
|
73 |
"profile_key" => $this->getConfigData('profile_key'),
|
|
|
74 |
"card_exp_date" => str_pad($payment->getCcExpMonth(), 2, "0", STR_PAD_LEFT) . substr($payment->getCcExpYear(), 2, 2),
|
75 |
"cvv2" => preg_replace("/[^0-9]/", "", $payment->getCcCid()),
|
76 |
"transaction_amount" => number_format($amount, 2, '.', ''),
|
91 |
"country_code" => $billing['country_id'],
|
92 |
);
|
93 |
|
94 |
+
if($this->getConfigData('use_tokenization')) {
|
95 |
+
if(isset($_POST['payment']['cc_token']) && $_POST['payment']['cc_token'] != "")
|
96 |
+
$requestValues['card_id'] = $_POST['payment']['cc_token'];
|
97 |
+
else
|
98 |
+
Mage::throwException('No token was generated.');
|
99 |
+
}
|
100 |
+
else
|
101 |
+
$requestValues['card_number'] = preg_replace("/[^0-9]/", "", $payment->getCcNumber());
|
102 |
+
|
103 |
## Cannot depend on device fingerprint to always be available
|
104 |
if(isset($_POST['payment']['cc_fingerprint']) && $_POST['payment']['cc_fingerprint'] != "")
|
105 |
$requestValues['device_id'] = $_POST['payment']['cc_fingerprint'];
|
120 |
return $this;
|
121 |
}
|
122 |
|
|
|
123 |
public function capture(Varien_Object $payment, $amount) {
|
124 |
if($payment->getParentTransactionId()) {
|
125 |
if($this->getConfigData('logging'))
|
149 |
Mage::throwException('Unable to perform action: Invalid State');
|
150 |
}
|
151 |
|
|
|
152 |
public function refund(Varien_Object $payment, $amount) {
|
153 |
if($this->getConfigData('logging'))
|
154 |
Mage::log("[MeS Gateway Module] Refund/Void attempt");
|
181 |
$payment->setStatus(self::STATUS_APPROVED);
|
182 |
return $this;
|
183 |
}
|
184 |
+
|
|
|
185 |
public function void(Varien_Object $payment) {
|
186 |
## Void/Auth Reversal or credit(if settled).
|
187 |
return $this->refund($payment, null);
|
188 |
}
|
189 |
|
|
|
190 |
protected function execute($requestValues) {
|
191 |
if($this->getConfigData('logging'))
|
192 |
Mage::log("[MeS Gateway Module] Starting cURL");
|
284 |
}
|
285 |
}
|
286 |
|
|
|
287 |
private function getClientReferenceNumber($order, $orderid, $crn) {
|
288 |
|
289 |
$billing = $order->getBillingAddress();
|
305 |
}
|
306 |
}
|
307 |
|
|
|
308 |
private function convertTransactionType($str) {
|
309 |
return $str == "authorize" ? "P" : "D";
|
310 |
}
|
311 |
|
|
|
312 |
private function secureEligible($str) {
|
313 |
## Visa and MC only for 3D Secure
|
314 |
if( ($str == "VI") || ($str == "MC") )
|
316 |
else
|
317 |
return false;
|
318 |
}
|
|
|
319 |
}
|
app/code/community/Mes/Gateway/etc/config.xml
CHANGED
@@ -91,6 +91,7 @@
|
|
91 |
<bypassssl>0</bypassssl>
|
92 |
<simulator>1</simulator>
|
93 |
<use_proxy>0</use_proxy>
|
|
|
94 |
</gateway>
|
95 |
</payment>
|
96 |
</default>
|
91 |
<bypassssl>0</bypassssl>
|
92 |
<simulator>1</simulator>
|
93 |
<use_proxy>0</use_proxy>
|
94 |
+
<use_tokenization>0</use_tokenization>
|
95 |
</gateway>
|
96 |
</payment>
|
97 |
</default>
|
app/code/community/Mes/Gateway/etc/system.xml
CHANGED
@@ -148,6 +148,17 @@
|
|
148 |
<show_in_store>0</show_in_store>
|
149 |
</proxy_url>
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
<order_status translate="label">
|
152 |
<label>New order status</label>
|
153 |
<frontend_type>select</frontend_type>
|
148 |
<show_in_store>0</show_in_store>
|
149 |
</proxy_url>
|
150 |
|
151 |
+
<use_tokenization translate="label">
|
152 |
+
<label>Tokenize Card Before Authorization</label>
|
153 |
+
<comment><![CDATA[Reduces PCI requirements by having the cardholder's browser tokenize the card before it is sent to the shopping cart.<br /><b><ul><li>Your domain must be registered with Merchant e-Solutions prior to enabling this function.</li><li>Checkout must additionally have SSL enabled.</li></ul></b><br /><a href="http://resources.merchante-solutions.com/display/TPGPUB/Transparent+Redirect+Tokenization" target="_T">Read more about Transparent Redirect Tokenization here.</a>]]></comment>
|
154 |
+
<frontend_type>select</frontend_type>
|
155 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
156 |
+
<sort_order>105</sort_order>
|
157 |
+
<show_in_default>1</show_in_default>
|
158 |
+
<show_in_website>1</show_in_website>
|
159 |
+
<show_in_store>0</show_in_store>
|
160 |
+
</use_tokenization>
|
161 |
+
|
162 |
<order_status translate="label">
|
163 |
<label>New order status</label>
|
164 |
<frontend_type>select</frontend_type>
|
app/design/frontend/base/default/template/mes/cc.phtml
CHANGED
@@ -29,13 +29,22 @@
|
|
29 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
*/
|
31 |
?>
|
32 |
-
<?php
|
|
|
|
|
|
|
|
|
33 |
|
34 |
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
|
|
|
|
|
|
|
|
|
|
35 |
<li>
|
36 |
<label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
|
37 |
<div class="input-box">
|
38 |
-
<select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry
|
39 |
<option value=""><?php echo $this->__('--Please Select--')?></option>
|
40 |
<?php $_ccType = $this->getInfoData('cc_type') ?>
|
41 |
<?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
|
@@ -47,7 +56,7 @@
|
|
47 |
<li>
|
48 |
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
49 |
<div class="input-box">
|
50 |
-
<input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text
|
51 |
</div>
|
52 |
</li>
|
53 |
<li id="<?php echo $_code ?>_cc_type_exp_div">
|
@@ -139,13 +148,141 @@
|
|
139 |
<div id="BCLDGuidDiv" style="border: 0px; width: 0px; height: 0px;"></div>
|
140 |
<div id="BCLDflashplayer" style="border: 0px; width: 0px; height: 0px;"></div>
|
141 |
<input type="hidden" id="<?php echo $_code ?>_cc_fingerprint" name="payment[cc_fingerprint]" value="" />
|
|
|
|
|
|
|
|
|
|
|
142 |
</li>
|
143 |
|
144 |
</ul>
|
145 |
|
146 |
<script type="text/javascript" src="https://ds.bluecava.com/V50/LD/BCLD5.js"></script>
|
|
|
147 |
<script type="text/javascript">
|
148 |
//<![CDATA[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
if(typeof BCLD != 'undefined') // BlueCava may not have loaded.
|
150 |
BCLD.getSnapshot(fpOkay, fpError);
|
151 |
|
29 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
*/
|
31 |
?>
|
32 |
+
<?php
|
33 |
+
$_code = $this->getMethodCode();
|
34 |
+
$_config = Mage::getStoreConfig('payment/gateway');
|
35 |
+
Mage::Log($this->debug());
|
36 |
+
?>
|
37 |
|
38 |
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
39 |
+
<li>
|
40 |
+
<div id="mes_err" class="validation-failed" style="display: none; padding: 10px;">
|
41 |
+
test div
|
42 |
+
</div>
|
43 |
+
</li>
|
44 |
<li>
|
45 |
<label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
|
46 |
<div class="input-box">
|
47 |
+
<select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry">
|
48 |
<option value=""><?php echo $this->__('--Please Select--')?></option>
|
49 |
<?php $_ccType = $this->getInfoData('cc_type') ?>
|
50 |
<?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
|
56 |
<li>
|
57 |
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
58 |
<div class="input-box">
|
59 |
+
<input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text required-entry" value="" />
|
60 |
</div>
|
61 |
</li>
|
62 |
<li id="<?php echo $_code ?>_cc_type_exp_div">
|
148 |
<div id="BCLDGuidDiv" style="border: 0px; width: 0px; height: 0px;"></div>
|
149 |
<div id="BCLDflashplayer" style="border: 0px; width: 0px; height: 0px;"></div>
|
150 |
<input type="hidden" id="<?php echo $_code ?>_cc_fingerprint" name="payment[cc_fingerprint]" value="" />
|
151 |
+
<?php
|
152 |
+
if($_config['use_tokenization']) { ?>
|
153 |
+
<input type="hidden" id="<?php echo $_code ?>_cc_token" name="payment[cc_token]" value="" />
|
154 |
+
<?php } ?>
|
155 |
+
|
156 |
</li>
|
157 |
|
158 |
</ul>
|
159 |
|
160 |
<script type="text/javascript" src="https://ds.bluecava.com/V50/LD/BCLD5.js"></script>
|
161 |
+
<script type="text/javascript" src="<?php echo(Mage::getBaseUrl('js')); ?>mes/mes-1.0-min.js"></script>
|
162 |
<script type="text/javascript">
|
163 |
//<![CDATA[
|
164 |
+
|
165 |
+
<?php
|
166 |
+
# When using tokenization, overwrite payment.save with tokenization. Otherwise just validate and process.
|
167 |
+
if($_config['use_tokenization']) {
|
168 |
+
?>
|
169 |
+
// Override payment.save
|
170 |
+
payment.save = function($super) {
|
171 |
+
if(typeof BCLD == 'undefined') {
|
172 |
+
new Effect.Appear($('mes_err'), {duration:1, from:0.0, to:1.0});
|
173 |
+
$('mes_err').show().update("Tokenization Library failed to load.");
|
174 |
+
}
|
175 |
+
else {
|
176 |
+
$('mes_err').hide().update("");
|
177 |
+
var validator = new Validation(payment.form);
|
178 |
+
if (payment.validate() && validator.validate()) {
|
179 |
+
// Mes JS may not have loaded
|
180 |
+
if(Mes != 'undefined') {
|
181 |
+
var mes_cc = document.getElementById('gateway_cc_number').value;
|
182 |
+
var mes_month = document.getElementById('gateway_expiration').value;
|
183 |
+
if(mes_month.length == 1) mes_month = '0' + mes_month; // Pad month to 2-digit
|
184 |
+
var mes_year = document.getElementById('gateway_expiration_yr').value.substr(2,2); // Cut year to last 2 digits
|
185 |
+
Mes.tokenize(mes_cc, mes_month+mes_year, mesTokenResponse);
|
186 |
+
}
|
187 |
+
else
|
188 |
+
mesProcess();
|
189 |
+
}
|
190 |
+
}
|
191 |
+
};
|
192 |
+
<?php
|
193 |
+
}
|
194 |
+
# No tokenization -> Validate & process
|
195 |
+
else {
|
196 |
+
?>
|
197 |
+
// Override payment.save
|
198 |
+
payment.save = function($super) {
|
199 |
+
var validator = new Validation(payment.form);
|
200 |
+
if (payment.validate() && validator.validate())
|
201 |
+
mesProcess();
|
202 |
+
};
|
203 |
+
<?php
|
204 |
+
}
|
205 |
+
?>
|
206 |
+
function dumpResults(resultArray) {
|
207 |
+
var out = '';
|
208 |
+
for (var i in resultArray) {
|
209 |
+
out += i + ": " + resultArray[i] + "\n";
|
210 |
+
}
|
211 |
+
alert(out);
|
212 |
+
}
|
213 |
+
|
214 |
+
function mesTokenResponse(result) {
|
215 |
+
//dumpResults(result);
|
216 |
+
|
217 |
+
switch(result['code']) {
|
218 |
+
case 0:
|
219 |
+
document.getElementById('gateway_cc_token').value = result['token'];
|
220 |
+
mesProcess();
|
221 |
+
break;
|
222 |
+
case 1:
|
223 |
+
new Effect.Appear($('mes_err'), {duration:1, from:0.0, to:1.0});
|
224 |
+
$('mes_err').show().update("Your browser is not compatible with the payment security enforced by this website.<br />Please upgrade or use the latest version of any modern web browser.");
|
225 |
+
break;
|
226 |
+
case 2:
|
227 |
+
var cc = document.getElementById('<?php echo $_code ?>_cc_number');
|
228 |
+
|
229 |
+
if(cc.value.match(/^\*{11,12}\d{4}/) == null) {
|
230 |
+
$$('#gateway_cc_number').invoke('removeClassName', 'validation-passed').invoke('addClassName', 'validation-failed');
|
231 |
+
new Effect.Appear($('mes_err'), {duration:1, from:0.0, to:1.0});
|
232 |
+
$('mes_err').show().update("Invalid Credit Card Number");
|
233 |
+
}
|
234 |
+
else
|
235 |
+
mesProcess();
|
236 |
+
break;
|
237 |
+
case 3:
|
238 |
+
// Somehow, the exp date is invalid. Should not happen.
|
239 |
+
$$('#gateway_cc_number').invoke('removeClassName', 'validation-passed').invoke('addClassName', 'validation-failed');
|
240 |
+
new Effect.Appear($('mes_err'), {duration:1, from:0.0, to:1.0});
|
241 |
+
$('mes_err').show().update("Invalid expiry date or expired card");
|
242 |
+
break;
|
243 |
+
case 4: // Payment Gateway Error
|
244 |
+
new Effect.Appear($('mes_err'), {duration:1, from:0.0, to:1.0});
|
245 |
+
$('mes_err').show().update("There was an error processing the request with the gateway: "+result['gateway_text']);
|
246 |
+
break;
|
247 |
+
case 5: // HTTP error (IE 8,9 only)
|
248 |
+
case 6: // Transmission Error
|
249 |
+
new Effect.Appear($('mes_err'), {duration:1, from:0.0, to:1.0});
|
250 |
+
$('mes_err').show().update("There was an error processing the request. Please try again, or contact the administrator.");
|
251 |
+
break;
|
252 |
+
case 7: // Cross Scheme (non SSL to SSL) Error (IE 8,9 only)
|
253 |
+
new Effect.Appear($('mes_err'), {duration:1, from:0.0, to:1.0});
|
254 |
+
$('mes_err').show().update("Site must be secured with SSL to proceed. Please contact the administrator.");
|
255 |
+
break;
|
256 |
+
}
|
257 |
+
}
|
258 |
+
|
259 |
+
function mesProcess() {
|
260 |
+
<?php if($_config['use_tokenization']) { ?>
|
261 |
+
// Truncate card number before proceeding
|
262 |
+
var cc = document.getElementById('<?php echo $_code ?>_cc_number');
|
263 |
+
cc.value = truncate(cc.value);
|
264 |
+
<?php } ?>
|
265 |
+
|
266 |
+
if (checkout.loadWaiting != false) return;
|
267 |
+
checkout.setLoadWaiting('payment');
|
268 |
+
var request = new Ajax.Request(
|
269 |
+
payment.saveUrl,
|
270 |
+
{
|
271 |
+
method:'post',
|
272 |
+
onComplete: payment.onComplete,
|
273 |
+
onSuccess: payment.onSave,
|
274 |
+
onFailure: checkout.ajaxFailure.bind(checkout),
|
275 |
+
parameters: Form.serialize(payment.form)
|
276 |
+
}
|
277 |
+
);
|
278 |
+
}
|
279 |
+
|
280 |
+
function truncate(number) {
|
281 |
+
last = number.substring(number.length-4, number.length);
|
282 |
+
number = number.replace(new RegExp(".", "ig"),"*");
|
283 |
+
return number.substring(0, number.length-4) + last;
|
284 |
+
}
|
285 |
+
|
286 |
if(typeof BCLD != 'undefined') // BlueCava may not have loaded.
|
287 |
BCLD.getSnapshot(fpOkay, fpError);
|
288 |
|
js/mes/mes-1.0-min.js
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,19 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mes_Gateway</name>
|
4 |
-
<version>1.
|
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>
|
12 |
-
Enhanced fraud protection features.</notes>
|
13 |
<authors><author><name>Merchant e-Solutions</name><user>mesolutions</user><email>mes_certification@merchante-solutions.com</email></author></authors>
|
14 |
-
<date>2013-
|
15 |
-
<time>
|
16 |
-
<contents><target name="magecommunity"><dir name="Mes"><dir name="Gateway"><dir name="Block"><file name="Form.php" hash="
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|
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>
|