BluePay_CreditCard - Version 1.5.5.5

Version Notes

Fixed issue with Company Name not being passed to BluePay

Download this release

Release Info

Developer Justin Slingerland
Extension BluePay_CreditCard
Version 1.5.5.5
Comparing to
See all releases


Code changes from version 1.5.5.4 to 1.5.5.5

app/code/core/Mage/Adminhtml/Model/System/Config/Source/Duplicatewindow.php DELETED
@@ -1,88 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Adminhtml
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
- /**
28
- * Used in creating options for Yes|No config value selection
29
- *
30
- */
31
- class Mage_Adminhtml_Model_System_Config_Source_DuplicateWindow
32
- {
33
-
34
- /**
35
- * Options getter
36
- *
37
- * @return array
38
- */
39
- public function toOptionArray()
40
- {
41
- return array(
42
- array('value' => 0, 'label'=>Mage::helper('adminhtml')->__('Off')),
43
- array('value' => 120, 'label'=>Mage::helper('adminhtml')->__('2 minutes')),
44
- array('value' => 300, 'label'=>Mage::helper('adminhtml')->__('5 minutes')),
45
- array('value' => 600, 'label'=>Mage::helper('adminhtml')->__('10 minutes')),
46
- array('value' => 1200, 'label'=>Mage::helper('adminhtml')->__('20 minutes')),
47
- array('value' => 1800, 'label'=>Mage::helper('adminhtml')->__('30 minutes')),
48
- array('value' => 2700, 'label'=>Mage::helper('adminhtml')->__('45 minutes')),
49
- array('value' => 3600, 'label'=>Mage::helper('adminhtml')->__('1 hour')),
50
- array('value' => 7200, 'label'=>Mage::helper('adminhtml')->__('2 hours')),
51
- array('value' => 14400, 'label'=>Mage::helper('adminhtml')->__('4 hours')),
52
- array('value' => 21600, 'label'=>Mage::helper('adminhtml')->__('6 hours')),
53
- array('value' => 28800, 'label'=>Mage::helper('adminhtml')->__('8 hours')),
54
- array('value' => 43200, 'label'=>Mage::helper('adminhtml')->__('12 hours')),
55
- array('value' => 86400, 'label'=>Mage::helper('adminhtml')->__('24 hours')),
56
- array('value' => 129600, 'label'=>Mage::helper('adminhtml')->__('36 hours')),
57
- array('value' => 172800, 'label'=>Mage::helper('adminhtml')->__('48 hours')),
58
- );
59
- }
60
-
61
- /**
62
- * Get options in "key-value" format
63
- *
64
- * @return array
65
- */
66
- public function toArray()
67
- {
68
- return array(
69
- 0 => Mage::helper('adminhtml')->__('Off'),
70
- 120 => Mage::helper('adminhtml')->__('2 minutes'),
71
- 300 => Mage::helper('adminhtml')->__('5 minutes'),
72
- 600 => Mage::helper('adminhtml')->__('10 minutes'),
73
- 1200 => Mage::helper('adminhtml')->__('20 minutes'),
74
- 1800 => Mage::helper('adminhtml')->__('30 minutes'),
75
- 2700 => Mage::helper('adminhtml')->__('45 minutes'),
76
- 3600 => Mage::helper('adminhtml')->__('1 hour'),
77
- 7200 => Mage::helper('adminhtml')->__('2 hours'),
78
- 14400 => Mage::helper('adminhtml')->__('4 hours'),
79
- 21600 => Mage::helper('adminhtml')->__('6 hours'),
80
- 28800 => Mage::helper('adminhtml')->__('8 hours'),
81
- 43200 => Mage::helper('adminhtml')->__('12 hours'),
82
- 86400 => Mage::helper('adminhtml')->__('24 hours'),
83
- 129600 => Mage::helper('adminhtml')->__('36 hours'),
84
- 172800 => Mage::helper('adminhtml')->__('48 hours'),
85
- );
86
- }
87
-
88
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status/Processingcomplete.php DELETED
@@ -1,40 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Adminhtml
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
- /**
28
- * Order Statuses source model
29
- */
30
- class Mage_Adminhtml_Model_System_Config_Source_Order_Status_Processingcomplete extends Mage_Adminhtml_Model_System_Config_Source_Order_Status
31
- {
32
- public function toOptionArray()
33
- {
34
- return array(
35
- array('value' =>Mage_Sales_Model_Order::STATE_PROCESSING, 'label'=> 'Processing'),
36
- array('value' =>'paid', 'label'=> 'Paid'),
37
- array('value' =>Mage_Sales_Model_Order::STATE_COMPLETE, 'label'=> 'Complete'),
38
- );
39
- }
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/BluePay/CreditCard/Model/CCPayment.php CHANGED
@@ -29,8 +29,8 @@
29
  class BluePay_CreditCard_Model_CCPayment extends Mage_Payment_Model_Method_Cc
30
  {
31
  const CGI_URL = 'https://secure.bluepay.com/interfaces/bp10emu';
32
- const STQ_URL = 'https://secure.bluepay.com/interfaces/stq';
33
- const CURRENT_VERSION = '1.5.5.0';
34
 
35
  const REQUEST_METHOD_CC = 'CREDIT';
36
  const REQUEST_METHOD_ECHECK = 'ACH';
@@ -55,33 +55,33 @@ class BluePay_CreditCard_Model_CCPayment extends Mage_Payment_Model_Method_Cc
55
 
56
  const RESPONSE_CODE_APPROVED = 'APPROVED';
57
  const RESPONSE_CODE_DECLINED = 'DECLINED';
58
- const RESPONSE_CODE_ERROR = 'ERROR';
59
  const RESPONSE_CODE_MISSING = 'MISSING';
60
  const RESPONSE_CODE_HELD = 4;
61
 
62
-
63
- const INVOICE_ID = 0;
64
- const BANK_NAME = 1;
65
- const PAYMENT_ACCOUNT = 2;
66
- const AUTH_CODE = 3;
67
- const CARD_TYPE = 4;
68
- const AMOUNT = 5;
69
- const REBID = 6;
70
- const AVS = 7;
71
- const ORDER_ID = 8;
72
- const CARD_EXPIRE = 9;
73
- const Result = 10;
74
- const RRNO = 11;
75
- const CVV2 = 12;
76
- const PAYMENT_TYPE = 13;
77
- const MESSAGE = 14;
78
-
79
  protected $responseHeaders;
80
  protected $tempVar;
81
 
82
- protected $_code = 'ccpayment';
83
- protected $_formBlockType = 'creditcard/form';
84
- protected static $_dupe = true;
85
  protected static $_underscoreCache = array();
86
 
87
  /**
@@ -90,14 +90,14 @@ class BluePay_CreditCard_Model_CCPayment extends Mage_Payment_Model_Method_Cc
90
  protected $_isGateway = true;
91
  protected $_canAuthorize = true;
92
  protected $_canCapture = true;
93
- protected $_canCapturePartial = true;
94
  protected $_canRefund = true;
95
- protected $_canRefundInvoicePartial = true;
96
  protected $_canVoid = true;
97
  protected $_canUseInternal = true;
98
  protected $_canUseCheckout = true;
99
  protected $_canUseForMultishipping = true;
100
- protected $_canSaveCc = false;
101
 
102
  protected $_allowCurrencyCode = array('USD');
103
 
@@ -163,11 +163,11 @@ class BluePay_CreditCard_Model_CCPayment extends Mage_Payment_Model_Method_Cc
163
  ->setIsTransactionClosed(0)
164
  ->setCcTransId($result->getRrno())
165
  ->setCcAvsStatus($result->getAvs())
166
- ->setCcCidStatus($result->getCvv2());
167
-
168
  switch ($result->getResult()) {
169
  case self::RESPONSE_CODE_APPROVED:
170
- $payment->setStatus(self::STATUS_APPROVED);
171
  return $this;
172
  case self::RESPONSE_CODE_DECLINED:
173
  Mage::throwException(Mage::helper('paygate')->__('The transaction has been declined'));
@@ -182,53 +182,53 @@ class BluePay_CreditCard_Model_CCPayment extends Mage_Payment_Model_Method_Cc
182
  * Send capture request to gateway
183
  */
184
  public function capture(Varien_Object $payment, $amount)
185
- {
186
- $payment->setAmount($amount);
187
- $result =$this->_checkDuplicate($payment);
188
  if ($payment->getCcTransId()) {
189
  $payment->setTransactionType(self::REQUEST_TYPE_CAPTURE_ONLY);
190
  } else {
191
  $payment->setTransactionType(self::REQUEST_TYPE_AUTH_CAPTURE);
192
  }
193
- $payment->setRrno($payment->getCcTransId());
194
- $request = $this->_buildRequest($payment);
195
- $result = $this->_postRequest($request);
196
- if ($result->getResult() == self::RESPONSE_CODE_APPROVED) {
197
- $payment->setStatus(self::STATUS_APPROVED);
198
  ////$payment->setCcTransId($result->getTransactionId());
199
- $payment->setLastTransId($result->getRrno());
200
  if (!$payment->getParentTransactionId() || $result->getRrno() != $payment->getParentTransactionId()) {
201
  $payment->setTransactionId($result->getRrno());
202
  }
203
  return $this;
204
- }
205
- switch ($result->getResult()) {
206
- case self::RESPONSE_CODE_DECLINED:
207
- Mage::throwException(Mage::helper('paygate')->__('The transaction has been declined.'));
208
- case self::RESPONSE_CODE_ERROR || self::RESPONSE_CODE_MISSING:
209
- if ($result->getMessage() == 'Already%20Captured') {
210
- $payment->setTransactionType(self::REQUEST_TYPE_AUTH_CAPTURE);
211
- $request=$this->_buildRequest($payment);
212
- $result =$this->_postRequest($request);
213
- if ($result->getResult() == self::RESPONSE_CODE_APPROVED && $result->getMessage() != 'DUPLICATE') {
214
- $payment->setStatus(self::STATUS_APPROVED);
215
- $payment->setLastTransId($result->getRrno());
216
- if (!$payment->getParentTransactionId() || $result->getRrno() != $payment->getParentTransactionId()) {
217
- $payment->setTransactionId($result->getRrno());
218
- }
219
- return $this;
220
- } else {
221
- Mage::throwException(Mage::helper('paygate')->__('Error: ' . $result->getMessage()));
222
- }
223
- } else {
224
- Mage::throwException(Mage::helper('paygate')->__('Error: ' . $result->getMessage()));
225
- }
226
- default:
227
- Mage::throwException(Mage::helper('paygate')->__('An error has occured with your payment.'));
228
- }
229
- Mage::throwException(Mage::helper('paygate')->__('Error in capturing the payment.'));
230
- }
231
-
232
 
233
  /**
234
  * Void the payment through gateway
@@ -284,151 +284,151 @@ class BluePay_CreditCard_Model_CCPayment extends Mage_Payment_Model_Method_Cc
284
  /**
285
  * Prepare request to gateway
286
  */
287
- protected function _buildRequest(Varien_Object $payment)
288
- {
289
- $order = $payment->getOrder();
290
- $this->setStore($order->getStoreId());
291
-
292
- if (!$payment->getPaymentType()) {
293
- $payment->setPaymentType(self::REQUEST_METHOD_CC);
294
- }
295
- $request = Mage::getModel('creditcard/CCPayment_request');
296
- if ($order && $order->getIncrementId()) {
297
- $request->setInvoiceID($order->getIncrementId());
298
- }
299
- $request->setMode(($this->getConfigData('test_mode') == 'TEST') ? 'TEST' : 'LIVE');
300
-
301
- if ($payment->getAdditionalData()) {
302
- $request->setRrno($payment->getAdditionalData());
303
- $payment->setRrno($payment->getAdditionalData());
304
- }
305
-
306
- $request->setMerchant($this->getConfigData('login'))
307
- ->setTransactionType($payment->getTransactionType())
308
- ->setPaymentType($payment->getPaymentType())
309
- ->setTamperProofSeal($this->calcTPS($payment));
310
- if($payment->getAmount()){
311
- $request->setAmount($payment->getAmount(),2);
312
- }
313
- if ($payment->getCcTransId()){
314
- $request->setRrno($payment->getCcTransId());
315
- }
316
- switch ($payment->getTransactionType()) {
317
- case self::REQUEST_TYPE_CREDIT:
318
- case self::REQUEST_TYPE_VOID:
319
- case self::REQUEST_TYPE_CAPTURE_ONLY:
320
- $request->setRrno($payment->getCcTransId());
321
- break;
322
- }
323
- $cart = Mage::helper('checkout/cart')->getCart()->getItemsCount();
324
- $cartSummary = Mage::helper('checkout/cart')->getCart()->getSummaryQty();
325
- Mage::getSingleton('core/session', array('name'=>'frontend'));
326
- $session = Mage::getSingleton('checkout/session');
327
-
328
- $comment = "";
329
-
330
- foreach ($session->getQuote()->getAllItems() as $item) {
331
-
332
- $comment .= $item->getQty() . ' ';
333
- $comment .= '[' . $item->getSku() . ']' . ' ';
334
- $comment .= $item->getName() . ' ';
335
- $comment .= $item->getDescription() . ' ';
336
- $comment .= $item->getBaseCalculationPrice . ' ';
337
- }
338
-
339
-
340
- if (!empty($order)) {
341
- $billing = $order->getBillingAddress();
342
- if (!empty($billing)) {
343
- $request->setName1($billing->getFirstname())
344
- ->setName2($billing->getLastname())
345
- ->setCompany($billing->getCompany())
346
- ->setAddr1($billing->getStreet(1))
347
- ->setCity($billing->getCity())
348
- ->setState($billing->getRegion())
349
- ->setZipcode($billing->getPostcode())
350
- ->setCountry($billing->getCountry())
351
- ->setPhone($billing->getTelephone())
352
- ->setFax($billing->getFax())
353
- ->setCustomId($billing->getCustomerId())
354
- ->setComment($comment)
355
- ->setEmail($order->getCustomerEmail());
356
- }
357
-
358
- $shipping = $order->getShippingAddress();
359
- if (!empty($shipping)) {
360
- $request->setXShipToFirstName($shipping->getFirstname())
361
- ->setXShipToLastName($shipping->getLastname())
362
- ->setXShipToCompany($shipping->getCompany())
363
- ->setXShipToAddress($shipping->getStreet(1))
364
- ->setXShipToCity($shipping->getCity())
365
- ->setXShipToState($shipping->getRegion())
366
- ->setXShipToZip($shipping->getPostcode())
367
- ->setXShipToCountry($shipping->getCountry());
368
- }
369
- }
370
-
371
- switch ($payment->getPaymentType()) {
372
- case self::REQUEST_METHOD_CC:
373
- if($payment->getCcNumber()){
374
- $temp = $payment->getCcExpYear();
375
- $CcExpYear = str_split($temp, 2);
376
- $request->setCcNum($payment->getCcNumber())
377
- ->setCcExpires(sprintf('%02d%02d', $payment->getCcExpMonth(), $CcExpYear[1]))
378
- ->setCvccvv2($payment->getCcCid());
379
- }
380
- break;
381
-
382
- case self::REQUEST_METHOD_ECHECK:
383
- $request->setAchRouting($payment->getEcheckRoutingNumber())
384
- ->setAchAccount($payment->getEcheckAccountNumber())
385
- ->setAchAccountType($payment->getEcheckAccountType())
386
- ->setName($payment->getEcheckAccountName())
387
- ->setDocType($payment->getEcheckType());
388
- break;
389
- }
390
- return $request;
391
- }
392
-
393
  protected function _postRequest(Varien_Object $request)
394
- {
395
- $debugData = array('request' => $request->getData());
396
- //if (!self::$_dupe) {
397
- $result = Mage::getModel('creditcard/CCPayment_result');
398
- //}
399
- if (isset($_POST["?Result"])) {
400
- $_POST["Result"] = $_POST["?Result"];
401
- unset($_POST["?Result"]);
402
- }
403
- if (!isset($_POST["Result"])) {
404
  $client = new Varien_Http_Client();
405
  $uri = $this->getConfigData('cgi_url');
406
  $client->setUri($uri ? $uri : self::CGI_URL);
407
  $client->setConfig(array(
408
  'maxredirects'=>0,
409
- 'timeout'=>30,
410
- 'useragent'=>'BluePay Magento Credit Card Plugin/' . self::CURRENT_VERSION,
411
  ));
412
- $client->setParameterPost($request->getData());
413
- $comma_separated = implode(",", $request->getData());
414
- //Mage::throwException($this->_wrapGatewayError($comma_separated));
415
- $client->setMethod(Zend_Http_Client::POST);
416
- try {
417
- $response = $client->request();
418
  }
419
  catch (Exception $e) {
420
  $debugData['result'] = $result->getData();
421
  $this->_debug($debugData);
422
  Mage::throwException($this->_wrapGatewayError($e->getMessage()));
423
  }
424
- $r = $response->getHeader('location');
425
- //if (self::$_dupe) {
426
- // return $result;
427
- //}
428
- if ($r) {
429
  $result->setResult($this->parseHeader($r, 'value', self::Result))
430
- ->setInvoiceId($this->parseHeader($r, 'value', self::INVOICE_ID))
431
- ->setBankName($this->parseHeader($r, 'value', self::BANK_NAME))
432
  ->setMessage($this->parseHeader($r, 'value', self::MESSAGE))
433
  ->setAuthCode($this->parseHeader($r, 'value', self::AUTH_CODE))
434
  ->setAvs($this->parseHeader($r, 'value', self::AVS))
@@ -436,81 +436,81 @@ class BluePay_CreditCard_Model_CCPayment extends Mage_Payment_Model_Method_Cc
436
  ->setAmount($this->parseHeader($r, 'value', self::AMOUNT))
437
  ->setPaymentType($this->parseHeader($r, 'value', self::PAYMENT_TYPE))
438
  ->setOrderId($this->parseHeader($r, 'value', self::ORDER_ID))
439
- ->setCvv2($this->parseHeader($r, 'value', self::CVV2));
440
- $this->assignBluePayToken($result->getRrno());
441
  }
442
  else {
443
- Mage::throwException(Mage::helper('paygate')->__('Error in payment gateway.'));
444
  }
445
 
446
  $debugData['result'] = $result->getData();
447
- $this->_debug($debugData);
448
- } else {
449
- $result->setResult($_POST["Result"]);
450
- $result->setMessage($_POST["MESSAGE"]);
451
- }
452
  return $result;
453
- }
454
-
455
- protected function _checkDuplicate(Varien_Object $payment)
456
- {
457
- if ($this->getConfigData('duplicate_check') == '0') {
458
- return;
459
- }
460
- $order = $payment->getOrder();
461
- $billing = $order->getBillingAddress();
462
- $reportStart = date("Y-m-d H:i:s", time() - (3600 * 5) - $this->getConfigData('duplicate_check'));
463
- $reportEnd = date("Y-m-d H:i:s", time() - (3600 * 5));
464
- $hashstr = $this->getConfigData('trans_key') . $this->getConfigData('login') .
465
- $reportStart . $reportEnd;
466
- $request = Mage::getModel('creditcard/CCPayment_request');
467
- $request->setData("MODE", $this->getConfigData('test_mode') == 'TEST' ? 'TEST' : 'LIVE');
468
- $request->setData("TAMPER_PROOF_SEAL", bin2hex(md5($hashstr, true)));
469
- $request->setData("ACCOUNT_ID", $this->getConfigData('login'));
470
- $request->setData("REPORT_START_DATE", $reportStart);
471
- $request->setData("REPORT_END_DATE", $reportEnd);
472
- $request->setData("EXCLUDE_ERRORS", 1);
473
- $request->setData("ISNULL_f_void", 1);
474
- $request->setData("name1", $billing['firstname']);
475
- $request->setData("name2", $billing['lastname']);
476
- $request->setData("amount", $payment->getAmount());
477
- $request->setData("status", '1');
478
- $request->setData("IGNORE_NULL_STR", '0');
479
- $request->setData("trans_type", "SALE");
480
- $client = new Varien_Http_Client();
481
-
482
- $client->setUri($uri ? $uri : self::STQ_URL);
483
- $client->setConfig(array(
484
- 'maxredirects'=>0,
485
- 'timeout'=>30,
486
- ));
487
- $client->setParameterPost($request->getData());
488
- $client->setMethod(Zend_Http_Client::POST);
489
- try {
490
- $response = $client->request();
491
- }
492
- catch (Exception $e) {
493
-
494
- $this->_debug($debugData);
495
- Mage::throwException($this->_wrapGatewayError($e->getMessage()));
496
- }
497
- $p = parse_str($client->request()->getBody());
498
- if ($id) {
499
- $conn = Mage::getSingleton('core/resource')->getConnection('core_read');
500
- $result = $conn->fetchAll("SELECT * FROM sales_payment_transaction WHERE txn_id='$id'");
501
- if ($result)
502
- return;
503
- self::$_dupe = true;
504
- $payment->setTransactionType(self::REQUEST_TYPE_CREDIT);
505
- $payment->setCcTransId($id);
506
- $payment->setRrno($id);
507
- $request = $this->_buildRequest($payment);
508
- $result = $this->_postRequest($request);
509
- $payment->setCcTransId('');
510
- }
511
- }
512
-
513
-
514
  /**
515
  * Gateway response wrapper
516
  */
@@ -526,7 +526,7 @@ class BluePay_CreditCard_Model_CCPayment extends Mage_Payment_Model_Method_Cc
526
 
527
  $hashstr = $this->getConfigData('trans_key') . $this->getConfigData('login') .
528
  $payment->getTransactionType() . $payment->getAmount() . $payment->getRrno() .
529
- $this->getConfigData('test_mode');
530
  return bin2hex( md5($hashstr, true) );
531
  }
532
 
@@ -536,148 +536,148 @@ class BluePay_CreditCard_Model_CCPayment extends Mage_Payment_Model_Method_Cc
536
  $t = explode("&", $s[1]);
537
  $value = explode("=", $t[$pos]);
538
  return $value[$nameVal];
539
- }
540
-
541
- public function validate()
542
- {
543
- /*
544
- * calling parent validate function
545
- */
546
- $info = $this->getInfoInstance();
547
- $errorMsg = false;
548
- $availableTypes = explode(',',$this->getConfigData('cctypes'));
549
-
550
- $ccNumber = $info->getCcNumber();
551
-
552
- // remove credit card number delimiters such as "-" and space
553
- $ccNumber = preg_replace('/[\-\s]+/', '', $ccNumber);
554
- $info->setCcNumber($ccNumber);
555
-
556
- $ccType = '';
557
-
558
- if (in_array($info->getCcType(), $availableTypes)){
559
- if ($this->validateCcNum($ccNumber)
560
- // Other credit card type number validation
561
- || ($this->OtherCcType($info->getCcType()) && $this->validateCcNumOther($ccNumber))) {
562
-
563
- $ccType = 'OT';
564
- $ccTypeRegExpList = array(
565
- //Solo, Switch or Maestro. International safe
566
- /*
567
- // Maestro / Solo
568
- 'SS' => '/^((6759[0-9]{12})|(6334|6767[0-9]{12})|(6334|6767[0-9]{14,15})'
569
- . '|(5018|5020|5038|6304|6759|6761|6763[0-9]{12,19})|(49[013][1356][0-9]{12})'
570
- . '|(633[34][0-9]{12})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$/',
571
- */
572
- // Solo only
573
- 'SO' => '/(^(6334)[5-9](\d{11}$|\d{13,14}$))|(^(6767)(\d{12}$|\d{14,15}$))/',
574
- 'SM' => '/(^(5[0678])\d{11,18}$)|(^(6[^05])\d{11,18}$)|(^(601)[^1]\d{9,16}$)|(^(6011)\d{9,11}$)'
575
- . '|(^(6011)\d{13,16}$)|(^(65)\d{11,13}$)|(^(65)\d{15,18}$)'
576
- . '|(^(49030)[2-9](\d{10}$|\d{12,13}$))|(^(49033)[5-9](\d{10}$|\d{12,13}$))'
577
- . '|(^(49110)[1-2](\d{10}$|\d{12,13}$))|(^(49117)[4-9](\d{10}$|\d{12,13}$))'
578
- . '|(^(49118)[0-2](\d{10}$|\d{12,13}$))|(^(4936)(\d{12}$|\d{14,15}$))/',
579
- // Visa
580
- 'VI' => '/^4[0-9]{12}([0-9]{3})?$/',
581
- // Master Card
582
- 'MC' => '/^5[1-5][0-9]{14}$/',
583
- // American Express
584
- 'AE' => '/^3[47][0-9]{13}$/',
585
- // Discovery
586
- 'DI' => '/^6011[0-9]{12}$/',
587
- // JCB
588
- 'JCB' => '/^(3[0-9]{15}|(2131|1800)[0-9]{11})$/'
589
- );
590
-
591
- foreach ($ccTypeRegExpList as $ccTypeMatch=>$ccTypeRegExp) {
592
- if (preg_match($ccTypeRegExp, $ccNumber)) {
593
- $ccType = $ccTypeMatch;
594
- break;
595
- }
596
- }
597
-
598
- if (!$this->OtherCcType($info->getCcType()) && $ccType!=$info->getCcType()) {
599
- $errorMsg = Mage::helper('payment')->__('Credit card number mismatch with credit card type.');
600
- }
601
- }
602
- else {
603
- $errorMsg = Mage::helper('payment')->__('Invalid Credit Card Number');
604
- }
605
-
606
- }
607
- else {
608
- $errorMsg = Mage::helper('payment')->__('Credit card type is not allowed for this payment method.');
609
- }
610
-
611
- //validate credit card verification number
612
- if ($errorMsg === false && $this->hasVerification()) {
613
- $verifcationRegEx = $this->getVerificationRegEx();
614
- $regExp = isset($verifcationRegEx[$info->getCcType()]) ? $verifcationRegEx[$info->getCcType()] : '';
615
- if (!$info->getCcCid() || !$regExp || !preg_match($regExp ,$info->getCcCid())){
616
- $errorMsg = Mage::helper('payment')->__('Please enter a valid credit card verification number.');
617
- }
618
- }
619
-
620
- if ($ccType != 'SS' && !$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) {
621
- $errorMsg = Mage::helper('payment')->__('Incorrect credit card expiration date.');
622
- }
623
-
624
- if($errorMsg) {
625
- if ($this->getConfigData('use_iframe') == '1') {
626
- $errorMsg = '';
627
- }
628
- }
629
-
630
- //This must be after all validation conditions
631
- if ($this->getIsCentinelValidationEnabled()) {
632
- $this->getCentinelValidator()->validate($this->getCentinelValidationData());
633
- }
634
-
635
- return $this;
636
- }
637
-
638
- public function assignData($data)
639
- {
640
- if (!($data instanceof Varien_Object)) {
641
- $data = new Varien_Object($data);
642
- }
643
-
644
- $info = $this->getInfoInstance();
645
- $info->setCcType($data->getCcType())
646
- ->setCcOwner($data->getCcOwner())
647
- ->setCcLast4(substr($data->getCcNumber(), -4))
648
- ->setCcNumber($data->getCcNumber())
649
- ->setCcCid($data->getCcCid())
650
- ->setCcExpMonth($data->getCcExpMonth())
651
- ->setCcExpYear($data->getCcExpYear())
652
- ->setCcSsIssue($data->getCcSsIssue())
653
- ->setCcSsStartMonth($data->getCcSsStartMonth())
654
- ->setCcSsStartYear($data->getCcSsStartYear())
655
- ->setAdditionalData($data->getBpToken());
656
- return $this;
657
-
658
- }
659
-
660
- public function assignBluePayToken($token)
661
- {
662
- $info = $this->getInfoInstance();
663
- $info->setAdditionalData($token);
664
- }
665
-
666
- public function prepareSave()
667
- {
668
- $info = $this->getInfoInstance();
669
-
670
- if ($this->_canSaveCc) {
671
- $info->setCcNumberEnc($info->encrypt('xxxx-'.$info->getCcLast4()));
672
- }
673
- if ($info->getAdditionalData()) {
674
- $info->setAdditionalData($info->getAdditionalData());
675
- }
676
- //$info->setCcCidEnc($info->encrypt($info->getCcCid()));
677
- $info->setCcNumber(null)
678
- ->setCcCid(null);
679
- return $this;
680
-
681
  }
682
 
683
  public function hasVerificationBackend()
@@ -687,6 +687,6 @@ class BluePay_CreditCard_Model_CCPayment extends Mage_Payment_Model_Method_Cc
687
  return true;
688
  }
689
  return (bool) $configData;
690
- }
691
 
692
  }
29
  class BluePay_CreditCard_Model_CCPayment extends Mage_Payment_Model_Method_Cc
30
  {
31
  const CGI_URL = 'https://secure.bluepay.com/interfaces/bp10emu';
32
+ const STQ_URL = 'https://secure.bluepay.com/interfaces/stq';
33
+ const CURRENT_VERSION = '1.5.5.0';
34
 
35
  const REQUEST_METHOD_CC = 'CREDIT';
36
  const REQUEST_METHOD_ECHECK = 'ACH';
55
 
56
  const RESPONSE_CODE_APPROVED = 'APPROVED';
57
  const RESPONSE_CODE_DECLINED = 'DECLINED';
58
+ const RESPONSE_CODE_ERROR = 'ERROR';
59
  const RESPONSE_CODE_MISSING = 'MISSING';
60
  const RESPONSE_CODE_HELD = 4;
61
 
62
+
63
+ const INVOICE_ID = 0;
64
+ const BANK_NAME = 1;
65
+ const PAYMENT_ACCOUNT = 2;
66
+ const AUTH_CODE = 3;
67
+ const CARD_TYPE = 4;
68
+ const AMOUNT = 5;
69
+ const REBID = 6;
70
+ const AVS = 7;
71
+ const ORDER_ID = 8;
72
+ const CARD_EXPIRE = 9;
73
+ const Result = 10;
74
+ const RRNO = 11;
75
+ const CVV2 = 12;
76
+ const PAYMENT_TYPE = 13;
77
+ const MESSAGE = 14;
78
+
79
  protected $responseHeaders;
80
  protected $tempVar;
81
 
82
+ protected $_code = 'ccpayment';
83
+ protected $_formBlockType = 'creditcard/form';
84
+ protected static $_dupe = true;
85
  protected static $_underscoreCache = array();
86
 
87
  /**
90
  protected $_isGateway = true;
91
  protected $_canAuthorize = true;
92
  protected $_canCapture = true;
93
+ protected $_canCapturePartial = true;
94
  protected $_canRefund = true;
95
+ protected $_canRefundInvoicePartial = true;
96
  protected $_canVoid = true;
97
  protected $_canUseInternal = true;
98
  protected $_canUseCheckout = true;
99
  protected $_canUseForMultishipping = true;
100
+ protected $_canSaveCc = false;
101
 
102
  protected $_allowCurrencyCode = array('USD');
103
 
163
  ->setIsTransactionClosed(0)
164
  ->setCcTransId($result->getRrno())
165
  ->setCcAvsStatus($result->getAvs())
166
+ ->setCcCidStatus($result->getCvv2());
167
+
168
  switch ($result->getResult()) {
169
  case self::RESPONSE_CODE_APPROVED:
170
+ $payment->setStatus(self::STATUS_APPROVED);
171
  return $this;
172
  case self::RESPONSE_CODE_DECLINED:
173
  Mage::throwException(Mage::helper('paygate')->__('The transaction has been declined'));
182
  * Send capture request to gateway
183
  */
184
  public function capture(Varien_Object $payment, $amount)
185
+ {
186
+ $payment->setAmount($amount);
187
+ $result =$this->_checkDuplicate($payment);
188
  if ($payment->getCcTransId()) {
189
  $payment->setTransactionType(self::REQUEST_TYPE_CAPTURE_ONLY);
190
  } else {
191
  $payment->setTransactionType(self::REQUEST_TYPE_AUTH_CAPTURE);
192
  }
193
+ $payment->setRrno($payment->getCcTransId());
194
+ $request = $this->_buildRequest($payment);
195
+ $result = $this->_postRequest($request);
196
+ if ($result->getResult() == self::RESPONSE_CODE_APPROVED) {
197
+ $payment->setStatus(self::STATUS_APPROVED);
198
  ////$payment->setCcTransId($result->getTransactionId());
199
+ $payment->setLastTransId($result->getRrno());
200
  if (!$payment->getParentTransactionId() || $result->getRrno() != $payment->getParentTransactionId()) {
201
  $payment->setTransactionId($result->getRrno());
202
  }
203
  return $this;
204
+ }
205
+ switch ($result->getResult()) {
206
+ case self::RESPONSE_CODE_DECLINED:
207
+ Mage::throwException(Mage::helper('paygate')->__('The transaction has been declined.'));
208
+ case self::RESPONSE_CODE_ERROR || self::RESPONSE_CODE_MISSING:
209
+ if ($result->getMessage() == 'Already%20Captured') {
210
+ $payment->setTransactionType(self::REQUEST_TYPE_AUTH_CAPTURE);
211
+ $request=$this->_buildRequest($payment);
212
+ $result =$this->_postRequest($request);
213
+ if ($result->getResult() == self::RESPONSE_CODE_APPROVED && $result->getMessage() != 'DUPLICATE') {
214
+ $payment->setStatus(self::STATUS_APPROVED);
215
+ $payment->setLastTransId($result->getRrno());
216
+ if (!$payment->getParentTransactionId() || $result->getRrno() != $payment->getParentTransactionId()) {
217
+ $payment->setTransactionId($result->getRrno());
218
+ }
219
+ return $this;
220
+ } else {
221
+ Mage::throwException(Mage::helper('paygate')->__('Error: ' . $result->getMessage()));
222
+ }
223
+ } else {
224
+ Mage::throwException(Mage::helper('paygate')->__('Error: ' . $result->getMessage()));
225
+ }
226
+ default:
227
+ Mage::throwException(Mage::helper('paygate')->__('An error has occured with your payment.'));
228
+ }
229
+ Mage::throwException(Mage::helper('paygate')->__('Error in capturing the payment.'));
230
+ }
231
+
232
 
233
  /**
234
  * Void the payment through gateway
284
  /**
285
  * Prepare request to gateway
286
  */
287
+ protected function _buildRequest(Varien_Object $payment)
288
+ {
289
+ $order = $payment->getOrder();
290
+ $this->setStore($order->getStoreId());
291
+
292
+ if (!$payment->getPaymentType()) {
293
+ $payment->setPaymentType(self::REQUEST_METHOD_CC);
294
+ }
295
+ $request = Mage::getModel('creditcard/CCPayment_request');
296
+ if ($order && $order->getIncrementId()) {
297
+ $request->setInvoiceID($order->getIncrementId());
298
+ }
299
+ $request->setMode(($this->getConfigData('test_mode') == 'TEST') ? 'TEST' : 'LIVE');
300
+
301
+ if ($payment->getAdditionalData()) {
302
+ $request->setRrno($payment->getAdditionalData());
303
+ $payment->setRrno($payment->getAdditionalData());
304
+ }
305
+
306
+ $request->setMerchant($this->getConfigData('login'))
307
+ ->setTransactionType($payment->getTransactionType())
308
+ ->setPaymentType($payment->getPaymentType())
309
+ ->setTamperProofSeal($this->calcTPS($payment));
310
+ if($payment->getAmount()){
311
+ $request->setAmount($payment->getAmount(),2);
312
+ }
313
+ if ($payment->getCcTransId()){
314
+ $request->setRrno($payment->getCcTransId());
315
+ }
316
+ switch ($payment->getTransactionType()) {
317
+ case self::REQUEST_TYPE_CREDIT:
318
+ case self::REQUEST_TYPE_VOID:
319
+ case self::REQUEST_TYPE_CAPTURE_ONLY:
320
+ $request->setRrno($payment->getCcTransId());
321
+ break;
322
+ }
323
+ $cart = Mage::helper('checkout/cart')->getCart()->getItemsCount();
324
+ $cartSummary = Mage::helper('checkout/cart')->getCart()->getSummaryQty();
325
+ Mage::getSingleton('core/session', array('name'=>'frontend'));
326
+ $session = Mage::getSingleton('checkout/session');
327
+
328
+ $comment = "";
329
+
330
+ foreach ($session->getQuote()->getAllItems() as $item) {
331
+
332
+ $comment .= $item->getQty() . ' ';
333
+ $comment .= '[' . $item->getSku() . ']' . ' ';
334
+ $comment .= $item->getName() . ' ';
335
+ $comment .= $item->getDescription() . ' ';
336
+ $comment .= $item->getBaseCalculationPrice . ' ';
337
+ }
338
+
339
+
340
+ if (!empty($order)) {
341
+ $billing = $order->getBillingAddress();
342
+ if (!empty($billing)) {
343
+ $request->setName1($billing->getFirstname())
344
+ ->setName2($billing->getLastname())
345
+ ->setCompanyName($billing->getCompany())
346
+ ->setAddr1($billing->getStreet(1))
347
+ ->setCity($billing->getCity())
348
+ ->setState($billing->getRegion())
349
+ ->setZipcode($billing->getPostcode())
350
+ ->setCountry($billing->getCountry())
351
+ ->setPhone($billing->getTelephone())
352
+ ->setFax($billing->getFax())
353
+ ->setCustomId($billing->getCustomerId())
354
+ ->setComment($comment)
355
+ ->setEmail($order->getCustomerEmail());
356
+ }
357
+
358
+ $shipping = $order->getShippingAddress();
359
+ if (!empty($shipping)) {
360
+ $request->setXShipToFirstName($shipping->getFirstname())
361
+ ->setXShipToLastName($shipping->getLastname())
362
+ ->setXShipToCompany($shipping->getCompany())
363
+ ->setXShipToAddress($shipping->getStreet(1))
364
+ ->setXShipToCity($shipping->getCity())
365
+ ->setXShipToState($shipping->getRegion())
366
+ ->setXShipToZip($shipping->getPostcode())
367
+ ->setXShipToCountry($shipping->getCountry());
368
+ }
369
+ }
370
+
371
+ switch ($payment->getPaymentType()) {
372
+ case self::REQUEST_METHOD_CC:
373
+ if($payment->getCcNumber()){
374
+ $temp = $payment->getCcExpYear();
375
+ $CcExpYear = str_split($temp, 2);
376
+ $request->setCcNum($payment->getCcNumber())
377
+ ->setCcExpires(sprintf('%02d%02d', $payment->getCcExpMonth(), $CcExpYear[1]))
378
+ ->setCvccvv2($payment->getCcCid());
379
+ }
380
+ break;
381
+
382
+ case self::REQUEST_METHOD_ECHECK:
383
+ $request->setAchRouting($payment->getEcheckRoutingNumber())
384
+ ->setAchAccount($payment->getEcheckAccountNumber())
385
+ ->setAchAccountType($payment->getEcheckAccountType())
386
+ ->setName($payment->getEcheckAccountName())
387
+ ->setDocType($payment->getEcheckType());
388
+ break;
389
+ }
390
+ return $request;
391
+ }
392
+
393
  protected function _postRequest(Varien_Object $request)
394
+ {
395
+ $debugData = array('request' => $request->getData());
396
+ //if (!self::$_dupe) {
397
+ $result = Mage::getModel('creditcard/CCPayment_result');
398
+ //}
399
+ if (isset($_POST["?Result"])) {
400
+ $_POST["Result"] = $_POST["?Result"];
401
+ unset($_POST["?Result"]);
402
+ }
403
+ if (!isset($_POST["Result"])) {
404
  $client = new Varien_Http_Client();
405
  $uri = $this->getConfigData('cgi_url');
406
  $client->setUri($uri ? $uri : self::CGI_URL);
407
  $client->setConfig(array(
408
  'maxredirects'=>0,
409
+ 'timeout'=>30,
410
+ 'useragent'=>'BluePay Magento Credit Card Plugin/' . self::CURRENT_VERSION,
411
  ));
412
+ $client->setParameterPost($request->getData());
413
+ $comma_separated = implode(",", $request->getData());
414
+ //Mage::throwException($this->_wrapGatewayError($comma_separated));
415
+ $client->setMethod(Zend_Http_Client::POST);
416
+ try {
417
+ $response = $client->request();
418
  }
419
  catch (Exception $e) {
420
  $debugData['result'] = $result->getData();
421
  $this->_debug($debugData);
422
  Mage::throwException($this->_wrapGatewayError($e->getMessage()));
423
  }
424
+ $r = $response->getHeader('location');
425
+ //if (self::$_dupe) {
426
+ // return $result;
427
+ //}
428
+ if ($r) {
429
  $result->setResult($this->parseHeader($r, 'value', self::Result))
430
+ ->setInvoiceId($this->parseHeader($r, 'value', self::INVOICE_ID))
431
+ ->setBankName($this->parseHeader($r, 'value', self::BANK_NAME))
432
  ->setMessage($this->parseHeader($r, 'value', self::MESSAGE))
433
  ->setAuthCode($this->parseHeader($r, 'value', self::AUTH_CODE))
434
  ->setAvs($this->parseHeader($r, 'value', self::AVS))
436
  ->setAmount($this->parseHeader($r, 'value', self::AMOUNT))
437
  ->setPaymentType($this->parseHeader($r, 'value', self::PAYMENT_TYPE))
438
  ->setOrderId($this->parseHeader($r, 'value', self::ORDER_ID))
439
+ ->setCvv2($this->parseHeader($r, 'value', self::CVV2));
440
+ $this->assignBluePayToken($result->getRrno());
441
  }
442
  else {
443
+ Mage::throwException(Mage::helper('paygate')->__('Error in payment gateway.'));
444
  }
445
 
446
  $debugData['result'] = $result->getData();
447
+ $this->_debug($debugData);
448
+ } else {
449
+ $result->setResult($_POST["Result"]);
450
+ $result->setMessage($_POST["MESSAGE"]);
451
+ }
452
  return $result;
453
+ }
454
+
455
+ protected function _checkDuplicate(Varien_Object $payment)
456
+ {
457
+ if ($this->getConfigData('duplicate_check') == '0') {
458
+ return;
459
+ }
460
+ $order = $payment->getOrder();
461
+ $billing = $order->getBillingAddress();
462
+ $reportStart = date("Y-m-d H:i:s", time() - (3600 * 5) - $this->getConfigData('duplicate_check'));
463
+ $reportEnd = date("Y-m-d H:i:s", time() - (3600 * 5));
464
+ $hashstr = $this->getConfigData('trans_key') . $this->getConfigData('login') .
465
+ $reportStart . $reportEnd;
466
+ $request = Mage::getModel('creditcard/CCPayment_request');
467
+ $request->setData("MODE", $this->getConfigData('test_mode') == 'TEST' ? 'TEST' : 'LIVE');
468
+ $request->setData("TAMPER_PROOF_SEAL", bin2hex(md5($hashstr, true)));
469
+ $request->setData("ACCOUNT_ID", $this->getConfigData('login'));
470
+ $request->setData("REPORT_START_DATE", $reportStart);
471
+ $request->setData("REPORT_END_DATE", $reportEnd);
472
+ $request->setData("EXCLUDE_ERRORS", 1);
473
+ $request->setData("ISNULL_f_void", 1);
474
+ $request->setData("name1", $billing['firstname']);
475
+ $request->setData("name2", $billing['lastname']);
476
+ $request->setData("amount", $payment->getAmount());
477
+ $request->setData("status", '1');
478
+ $request->setData("IGNORE_NULL_STR", '0');
479
+ $request->setData("trans_type", "SALE");
480
+ $client = new Varien_Http_Client();
481
+
482
+ $client->setUri($uri ? $uri : self::STQ_URL);
483
+ $client->setConfig(array(
484
+ 'maxredirects'=>0,
485
+ 'timeout'=>30,
486
+ ));
487
+ $client->setParameterPost($request->getData());
488
+ $client->setMethod(Zend_Http_Client::POST);
489
+ try {
490
+ $response = $client->request();
491
+ }
492
+ catch (Exception $e) {
493
+
494
+ $this->_debug($debugData);
495
+ Mage::throwException($this->_wrapGatewayError($e->getMessage()));
496
+ }
497
+ $p = parse_str($client->request()->getBody());
498
+ if ($id) {
499
+ $conn = Mage::getSingleton('core/resource')->getConnection('core_read');
500
+ $result = $conn->fetchAll("SELECT * FROM sales_payment_transaction WHERE txn_id='$id'");
501
+ if ($result)
502
+ return;
503
+ self::$_dupe = true;
504
+ $payment->setTransactionType(self::REQUEST_TYPE_CREDIT);
505
+ $payment->setCcTransId($id);
506
+ $payment->setRrno($id);
507
+ $request = $this->_buildRequest($payment);
508
+ $result = $this->_postRequest($request);
509
+ $payment->setCcTransId('');
510
+ }
511
+ }
512
+
513
+
514
  /**
515
  * Gateway response wrapper
516
  */
526
 
527
  $hashstr = $this->getConfigData('trans_key') . $this->getConfigData('login') .
528
  $payment->getTransactionType() . $payment->getAmount() . $payment->getRrno() .
529
+ $this->getConfigData('test_mode');
530
  return bin2hex( md5($hashstr, true) );
531
  }
532
 
536
  $t = explode("&", $s[1]);
537
  $value = explode("=", $t[$pos]);
538
  return $value[$nameVal];
539
+ }
540
+
541
+ public function validate()
542
+ {
543
+ /*
544
+ * calling parent validate function
545
+ */
546
+ $info = $this->getInfoInstance();
547
+ $errorMsg = false;
548
+ $availableTypes = explode(',',$this->getConfigData('cctypes'));
549
+
550
+ $ccNumber = $info->getCcNumber();
551
+
552
+ // remove credit card number delimiters such as "-" and space
553
+ $ccNumber = preg_replace('/[\-\s]+/', '', $ccNumber);
554
+ $info->setCcNumber($ccNumber);
555
+
556
+ $ccType = '';
557
+
558
+ if (in_array($info->getCcType(), $availableTypes)){
559
+ if ($this->validateCcNum($ccNumber)
560
+ // Other credit card type number validation
561
+ || ($this->OtherCcType($info->getCcType()) && $this->validateCcNumOther($ccNumber))) {
562
+
563
+ $ccType = 'OT';
564
+ $ccTypeRegExpList = array(
565
+ //Solo, Switch or Maestro. International safe
566
+ /*
567
+ // Maestro / Solo
568
+ 'SS' => '/^((6759[0-9]{12})|(6334|6767[0-9]{12})|(6334|6767[0-9]{14,15})'
569
+ . '|(5018|5020|5038|6304|6759|6761|6763[0-9]{12,19})|(49[013][1356][0-9]{12})'
570
+ . '|(633[34][0-9]{12})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$/',
571
+ */
572
+ // Solo only
573
+ 'SO' => '/(^(6334)[5-9](\d{11}$|\d{13,14}$))|(^(6767)(\d{12}$|\d{14,15}$))/',
574
+ 'SM' => '/(^(5[0678])\d{11,18}$)|(^(6[^05])\d{11,18}$)|(^(601)[^1]\d{9,16}$)|(^(6011)\d{9,11}$)'
575
+ . '|(^(6011)\d{13,16}$)|(^(65)\d{11,13}$)|(^(65)\d{15,18}$)'
576
+ . '|(^(49030)[2-9](\d{10}$|\d{12,13}$))|(^(49033)[5-9](\d{10}$|\d{12,13}$))'
577
+ . '|(^(49110)[1-2](\d{10}$|\d{12,13}$))|(^(49117)[4-9](\d{10}$|\d{12,13}$))'
578
+ . '|(^(49118)[0-2](\d{10}$|\d{12,13}$))|(^(4936)(\d{12}$|\d{14,15}$))/',
579
+ // Visa
580
+ 'VI' => '/^4[0-9]{12}([0-9]{3})?$/',
581
+ // Master Card
582
+ 'MC' => '/^5[1-5][0-9]{14}$/',
583
+ // American Express
584
+ 'AE' => '/^3[47][0-9]{13}$/',
585
+ // Discovery
586
+ 'DI' => '/^6011[0-9]{12}$/',
587
+ // JCB
588
+ 'JCB' => '/^(3[0-9]{15}|(2131|1800)[0-9]{11})$/'
589
+ );
590
+
591
+ foreach ($ccTypeRegExpList as $ccTypeMatch=>$ccTypeRegExp) {
592
+ if (preg_match($ccTypeRegExp, $ccNumber)) {
593
+ $ccType = $ccTypeMatch;
594
+ break;
595
+ }
596
+ }
597
+
598
+ if (!$this->OtherCcType($info->getCcType()) && $ccType!=$info->getCcType()) {
599
+ $errorMsg = Mage::helper('payment')->__('Credit card number mismatch with credit card type.');
600
+ }
601
+ }
602
+ else {
603
+ $errorMsg = Mage::helper('payment')->__('Invalid Credit Card Number');
604
+ }
605
+
606
+ }
607
+ else {
608
+ $errorMsg = Mage::helper('payment')->__('Credit card type is not allowed for this payment method.');
609
+ }
610
+
611
+ //validate credit card verification number
612
+ if ($errorMsg === false && $this->hasVerification()) {
613
+ $verifcationRegEx = $this->getVerificationRegEx();
614
+ $regExp = isset($verifcationRegEx[$info->getCcType()]) ? $verifcationRegEx[$info->getCcType()] : '';
615
+ if (!$info->getCcCid() || !$regExp || !preg_match($regExp ,$info->getCcCid())){
616
+ $errorMsg = Mage::helper('payment')->__('Please enter a valid credit card verification number.');
617
+ }
618
+ }
619
+
620
+ if ($ccType != 'SS' && !$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) {
621
+ $errorMsg = Mage::helper('payment')->__('Incorrect credit card expiration date.');
622
+ }
623
+
624
+ if($errorMsg) {
625
+ if ($this->getConfigData('use_iframe') == '1') {
626
+ $errorMsg = '';
627
+ }
628
+ }
629
+
630
+ //This must be after all validation conditions
631
+ if ($this->getIsCentinelValidationEnabled()) {
632
+ $this->getCentinelValidator()->validate($this->getCentinelValidationData());
633
+ }
634
+
635
+ return $this;
636
+ }
637
+
638
+ public function assignData($data)
639
+ {
640
+ if (!($data instanceof Varien_Object)) {
641
+ $data = new Varien_Object($data);
642
+ }
643
+
644
+ $info = $this->getInfoInstance();
645
+ $info->setCcType($data->getCcType())
646
+ ->setCcOwner($data->getCcOwner())
647
+ ->setCcLast4(substr($data->getCcNumber(), -4))
648
+ ->setCcNumber($data->getCcNumber())
649
+ ->setCcCid($data->getCcCid())
650
+ ->setCcExpMonth($data->getCcExpMonth())
651
+ ->setCcExpYear($data->getCcExpYear())
652
+ ->setCcSsIssue($data->getCcSsIssue())
653
+ ->setCcSsStartMonth($data->getCcSsStartMonth())
654
+ ->setCcSsStartYear($data->getCcSsStartYear())
655
+ ->setAdditionalData($data->getBpToken());
656
+ return $this;
657
+
658
+ }
659
+
660
+ public function assignBluePayToken($token)
661
+ {
662
+ $info = $this->getInfoInstance();
663
+ $info->setAdditionalData($token);
664
+ }
665
+
666
+ public function prepareSave()
667
+ {
668
+ $info = $this->getInfoInstance();
669
+
670
+ if ($this->_canSaveCc) {
671
+ $info->setCcNumberEnc($info->encrypt('xxxx-'.$info->getCcLast4()));
672
+ }
673
+ if ($info->getAdditionalData()) {
674
+ $info->setAdditionalData($info->getAdditionalData());
675
+ }
676
+ //$info->setCcCidEnc($info->encrypt($info->getCcCid()));
677
+ $info->setCcNumber(null)
678
+ ->setCcCid(null);
679
+ return $this;
680
+
681
  }
682
 
683
  public function hasVerificationBackend()
687
  return true;
688
  }
689
  return (bool) $configData;
690
+ }
691
 
692
  }
app/code/local/BluePay/CreditCard/Model/CCPayment.php~ ADDED
@@ -0,0 +1,692 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category BluePay
23
+ * @package BluePay_CreditCard
24
+ * @copyright Copyright (c) 2010 BluePay Processing, LLC (http://www.bluepay.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+
29
+ class BluePay_CreditCard_Model_CCPayment extends Mage_Payment_Model_Method_Cc
30
+ {
31
+ const CGI_URL = 'https://secure.bluepay.com/interfaces/bp10emu';
32
+ const STQ_URL = 'https://secure.bluepay.com/interfaces/stq';
33
+ const CURRENT_VERSION = '1.5.5.0';
34
+
35
+ const REQUEST_METHOD_CC = 'CREDIT';
36
+ const REQUEST_METHOD_ECHECK = 'ACH';
37
+
38
+ const REQUEST_TYPE_AUTH_CAPTURE = 'SALE';
39
+ const REQUEST_TYPE_AUTH_ONLY = 'AUTH';
40
+ const REQUEST_TYPE_CAPTURE_ONLY = 'CAPTURE';
41
+ const REQUEST_TYPE_CREDIT = 'REFUND';
42
+ const REQUEST_TYPE_VOID = 'VOID';
43
+ const REQUEST_TYPE_PRIOR_AUTH_CAPTURE = 'PRIOR_AUTH_CAPTURE';
44
+
45
+ const ECHECK_ACCT_TYPE_CHECKING = 'CHECKING';
46
+ const ECHECK_ACCT_TYPE_BUSINESS = 'BUSINESSCHECKING';
47
+ const ECHECK_ACCT_TYPE_SAVINGS = 'SAVINGS';
48
+
49
+ const ECHECK_TRANS_TYPE_CCD = 'CCD';
50
+ const ECHECK_TRANS_TYPE_PPD = 'PPD';
51
+ const ECHECK_TRANS_TYPE_TEL = 'TEL';
52
+ const ECHECK_TRANS_TYPE_WEB = 'WEB';
53
+
54
+ const RESPONSE_DELIM_CHAR = ',';
55
+
56
+ const RESPONSE_CODE_APPROVED = 'APPROVED';
57
+ const RESPONSE_CODE_DECLINED = 'DECLINED';
58
+ const RESPONSE_CODE_ERROR = 'ERROR';
59
+ const RESPONSE_CODE_MISSING = 'MISSING';
60
+ const RESPONSE_CODE_HELD = 4;
61
+
62
+
63
+ const INVOICE_ID = 0;
64
+ const BANK_NAME = 1;
65
+ const PAYMENT_ACCOUNT = 2;
66
+ const AUTH_CODE = 3;
67
+ const CARD_TYPE = 4;
68
+ const AMOUNT = 5;
69
+ const REBID = 6;
70
+ const AVS = 7;
71
+ const ORDER_ID = 8;
72
+ const CARD_EXPIRE = 9;
73
+ const Result = 10;
74
+ const RRNO = 11;
75
+ const CVV2 = 12;
76
+ const PAYMENT_TYPE = 13;
77
+ const MESSAGE = 14;
78
+
79
+ protected $responseHeaders;
80
+ protected $tempVar;
81
+
82
+ protected $_code = 'ccpayment';
83
+ protected $_formBlockType = 'creditcard/form';
84
+ protected static $_dupe = true;
85
+ protected static $_underscoreCache = array();
86
+
87
+ /**
88
+ * Availability options
89
+ */
90
+ protected $_isGateway = true;
91
+ protected $_canAuthorize = true;
92
+ protected $_canCapture = true;
93
+ protected $_canCapturePartial = true;
94
+ protected $_canRefund = true;
95
+ protected $_canRefundInvoicePartial = true;
96
+ protected $_canVoid = true;
97
+ protected $_canUseInternal = true;
98
+ protected $_canUseCheckout = true;
99
+ protected $_canUseForMultishipping = true;
100
+ protected $_canSaveCc = false;
101
+
102
+ protected $_allowCurrencyCode = array('USD');
103
+
104
+ /**
105
+ * Fields that should be replaced in debug with '***'
106
+ *
107
+ * @var array
108
+ */
109
+ protected $_debugReplacePrivateDataKeys = array('x_login', 'x_tran_key',
110
+ 'x_card_num', 'x_exp_date',
111
+ 'x_card_code', 'x_bank_aba_code',
112
+ 'x_bank_name', 'x_bank_acct_num',
113
+ 'x_bank_acct_type','x_bank_acct_name',
114
+ 'x_echeck_type');
115
+
116
+ /**
117
+ * Check method for processing with base currency
118
+ *
119
+ * @param string $currencyCode
120
+ * @return boolean
121
+ */
122
+ public function canUseForCurrency($currencyCode)
123
+ {
124
+ if (!in_array($currencyCode, $this->getAcceptedCurrencyCodes())) {
125
+ return false;
126
+ }
127
+ return true;
128
+ }
129
+
130
+ /**
131
+ * Return array of currency codes supplied by Payment Gateway
132
+ *
133
+ * @return array
134
+ */
135
+ public function getAcceptedCurrencyCodes()
136
+ {
137
+ if (!$this->hasData('_accepted_currency')) {
138
+ $acceptedCurrencyCodes = $this->_allowCurrencyCode;
139
+ $acceptedCurrencyCodes[] = $this->getConfigData('currency');
140
+ $this->setData('_accepted_currency', $acceptedCurrencyCodes);
141
+ }
142
+ return $this->_getData('_accepted_currency');
143
+ }
144
+
145
+ /**
146
+ * Send authorize request to gateway
147
+ */
148
+
149
+ public function authorize(Varien_Object $payment, $amount)
150
+ {
151
+ if ($amount <= 0) {
152
+ Mage::throwException(Mage::helper('paygate')->__('Invalid amount for authorization.'));
153
+ }
154
+ $payment->setTransactionType(self::REQUEST_TYPE_AUTH_ONLY);
155
+ $payment->setAmount($amount);
156
+
157
+ $request= $this->_buildRequest($payment);
158
+ $result = $this->_postRequest($request);
159
+
160
+ $payment->setCcApproval($result->getAuthCode())
161
+ ->setLastTransId($result->getRrno())
162
+ ->setTransactionId($result->getRrno())
163
+ ->setIsTransactionClosed(0)
164
+ ->setCcTransId($result->getRrno())
165
+ ->setCcAvsStatus($result->getAvs())
166
+ ->setCcCidStatus($result->getCvv2());
167
+
168
+ switch ($result->getResult()) {
169
+ case self::RESPONSE_CODE_APPROVED:
170
+ $payment->setStatus(self::STATUS_APPROVED);
171
+ return $this;
172
+ case self::RESPONSE_CODE_DECLINED:
173
+ Mage::throwException(Mage::helper('paygate')->__('The transaction has been declined'));
174
+ case self::RESPONSE_CODE_ERROR:
175
+ Mage::throwException(Mage::helper('paygate')->__('Error: ' . $result->getMessage()));
176
+ default:
177
+ Mage::throwException(Mage::helper('paygate')->__('An error has occured with your payment.'));
178
+ }
179
+ }
180
+
181
+ /**
182
+ * Send capture request to gateway
183
+ */
184
+ public function capture(Varien_Object $payment, $amount)
185
+ {
186
+ $payment->setAmount($amount);
187
+ $result =$this->_checkDuplicate($payment);
188
+ if ($payment->getCcTransId()) {
189
+ $payment->setTransactionType(self::REQUEST_TYPE_CAPTURE_ONLY);
190
+ } else {
191
+ $payment->setTransactionType(self::REQUEST_TYPE_AUTH_CAPTURE);
192
+ }
193
+ $payment->setRrno($payment->getCcTransId());
194
+ $request = $this->_buildRequest($payment);
195
+ $result = $this->_postRequest($request);
196
+ if ($result->getResult() == self::RESPONSE_CODE_APPROVED) {
197
+ $payment->setStatus(self::STATUS_APPROVED);
198
+ ////$payment->setCcTransId($result->getTransactionId());
199
+ $payment->setLastTransId($result->getRrno());
200
+ if (!$payment->getParentTransactionId() || $result->getRrno() != $payment->getParentTransactionId()) {
201
+ $payment->setTransactionId($result->getRrno());
202
+ }
203
+ return $this;
204
+ }
205
+ switch ($result->getResult()) {
206
+ case self::RESPONSE_CODE_DECLINED:
207
+ Mage::throwException(Mage::helper('paygate')->__('The transaction has been declined.'));
208
+ case self::RESPONSE_CODE_ERROR || self::RESPONSE_CODE_MISSING:
209
+ if ($result->getMessage() == 'Already%20Captured') {
210
+ $payment->setTransactionType(self::REQUEST_TYPE_AUTH_CAPTURE);
211
+ $request=$this->_buildRequest($payment);
212
+ $result =$this->_postRequest($request);
213
+ if ($result->getResult() == self::RESPONSE_CODE_APPROVED && $result->getMessage() != 'DUPLICATE') {
214
+ $payment->setStatus(self::STATUS_APPROVED);
215
+ $payment->setLastTransId($result->getRrno());
216
+ if (!$payment->getParentTransactionId() || $result->getRrno() != $payment->getParentTransactionId()) {
217
+ $payment->setTransactionId($result->getRrno());
218
+ }
219
+ return $this;
220
+ } else {
221
+ Mage::throwException(Mage::helper('paygate')->__('Error: ' . $result->getMessage()));
222
+ }
223
+ } else {
224
+ Mage::throwException(Mage::helper('paygate')->__('Error: ' . $result->getMessage()));
225
+ }
226
+ default:
227
+ Mage::throwException(Mage::helper('paygate')->__('An error has occured with your payment.'));
228
+ }
229
+ Mage::throwException(Mage::helper('paygate')->__('Error in capturing the payment.'));
230
+ }
231
+
232
+
233
+ /**
234
+ * Void the payment through gateway
235
+ */
236
+ public function void(Varien_Object $payment)
237
+ {
238
+ if ($payment->getParentTransactionId()) {
239
+ $order = $payment->getOrder();
240
+ $payment->setTransactionType(self::REQUEST_TYPE_CREDIT);
241
+ $payment->setAmount($amount);
242
+ $payment->setRrno($payment->getParentTransactionId());
243
+ $request = $this->_buildRequest($payment);
244
+ $result = $this->_postRequest($request);
245
+ if ($result->getResult()==self::RESPONSE_CODE_APPROVED) {
246
+ $payment->setStatus(self::STATUS_APPROVED);
247
+ $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->save();
248
+ return $this;
249
+ }
250
+ $payment->setStatus(self::STATUS_ERROR);
251
+ Mage::throwException($this->_wrapGatewayError($result->getMessage()));
252
+ }
253
+ $payment->setStatus(self::STATUS_ERROR);
254
+ Mage::throwException(Mage::helper('paygate')->__('Invalid transaction ID.'));
255
+ }
256
+
257
+ /**
258
+ * refund the amount with transaction id
259
+ */
260
+ public function refund(Varien_Object $payment, $amount)
261
+ {
262
+ if ($payment->getRefundTransactionId() && $amount > 0) {
263
+ $payment->setTransactionType(self::REQUEST_TYPE_CREDIT);
264
+ $payment->setRrno($payment->getRefundTransactionId());
265
+ $payment->setAmount($amount);
266
+ $request = $this->_buildRequest($payment);
267
+ $request->setRrno($payment->getRefundTransactionId());
268
+ $result = $this->_postRequest($request);
269
+ if ($result->getResult()==self::RESPONSE_CODE_APPROVED) {
270
+ $payment->setStatus(self::STATUS_SUCCESS);
271
+ return $this;
272
+ }
273
+ if ($result->getResult()==self::RESPONSE_CODE_DECLINED) {
274
+ Mage::throwException($this->_wrapGatewayError('DECLINED'));
275
+ }
276
+ if ($result->getResult()==self::RESPONSE_CODE_ERROR) {
277
+ Mage::throwException($this->_wrapGatewayError('ERROR'));
278
+ }
279
+ Mage::throwException($this->_wrapGatewayError($result->getRrno()));
280
+ }
281
+ Mage::throwException(Mage::helper('paygate')->__('Error in refunding the payment.'));
282
+ }
283
+
284
+ /**
285
+ * Prepare request to gateway
286
+ */
287
+ protected function _buildRequest(Varien_Object $payment)
288
+ {
289
+ $order = $payment->getOrder();
290
+ $this->setStore($order->getStoreId());
291
+
292
+ if (!$payment->getPaymentType()) {
293
+ $payment->setPaymentType(self::REQUEST_METHOD_CC);
294
+ }
295
+ $request = Mage::getModel('creditcard/CCPayment_request');
296
+ if ($order && $order->getIncrementId()) {
297
+ $request->setInvoiceID($order->getIncrementId());
298
+ }
299
+ $request->setMode(($this->getConfigData('test_mode') == 'TEST') ? 'TEST' : 'LIVE');
300
+
301
+ if ($payment->getAdditionalData()) {
302
+ $request->setRrno($payment->getAdditionalData());
303
+ $payment->setRrno($payment->getAdditionalData());
304
+ }
305
+
306
+ $request->setMerchant($this->getConfigData('login'))
307
+ ->setTransactionType($payment->getTransactionType())
308
+ ->setPaymentType($payment->getPaymentType())
309
+ ->setTamperProofSeal($this->calcTPS($payment));
310
+ if($payment->getAmount()){
311
+ $request->setAmount($payment->getAmount(),2);
312
+ }
313
+ if ($payment->getCcTransId()){
314
+ $request->setRrno($payment->getCcTransId());
315
+ }
316
+ switch ($payment->getTransactionType()) {
317
+ case self::REQUEST_TYPE_CREDIT:
318
+ case self::REQUEST_TYPE_VOID:
319
+ case self::REQUEST_TYPE_CAPTURE_ONLY:
320
+ $request->setRrno($payment->getCcTransId());
321
+ break;
322
+ }
323
+ $cart = Mage::helper('checkout/cart')->getCart()->getItemsCount();
324
+ $cartSummary = Mage::helper('checkout/cart')->getCart()->getSummaryQty();
325
+ Mage::getSingleton('core/session', array('name'=>'frontend'));
326
+ $session = Mage::getSingleton('checkout/session');
327
+
328
+ $comment = "";
329
+
330
+ foreach ($session->getQuote()->getAllItems() as $item) {
331
+
332
+ $comment .= $item->getQty() . ' ';
333
+ $comment .= '[' . $item->getSku() . ']' . ' ';
334
+ $comment .= $item->getName() . ' ';
335
+ $comment .= $item->getDescription() . ' ';
336
+ $comment .= $item->getBaseCalculationPrice . ' ';
337
+ }
338
+
339
+
340
+ if (!empty($order)) {
341
+ $billing = $order->getBillingAddress();
342
+ if (!empty($billing)) {
343
+ $request->setName1($billing->getFirstname())
344
+ ->setName2($billing->getLastname())
345
+ ->setCompany($billing->getCompany())
346
+ ->setAddr1($billing->getStreet(1))
347
+ ->setCity($billing->getCity())
348
+ ->setState($billing->getRegion())
349
+ ->setZipcode($billing->getPostcode())
350
+ ->setCountry($billing->getCountry())
351
+ ->setPhone($billing->getTelephone())
352
+ ->setFax($billing->getFax())
353
+ ->setCustomId($billing->getCustomerId())
354
+ ->setComment($comment)
355
+ ->setEmail($order->getCustomerEmail());
356
+ }
357
+
358
+ $shipping = $order->getShippingAddress();
359
+ if (!empty($shipping)) {
360
+ $request->setXShipToFirstName($shipping->getFirstname())
361
+ ->setXShipToLastName($shipping->getLastname())
362
+ ->setXShipToCompany($shipping->getCompany())
363
+ ->setXShipToAddress($shipping->getStreet(1))
364
+ ->setXShipToCity($shipping->getCity())
365
+ ->setXShipToState($shipping->getRegion())
366
+ ->setXShipToZip($shipping->getPostcode())
367
+ ->setXShipToCountry($shipping->getCountry());
368
+ }
369
+ }
370
+
371
+ switch ($payment->getPaymentType()) {
372
+ case self::REQUEST_METHOD_CC:
373
+ if($payment->getCcNumber()){
374
+ $temp = $payment->getCcExpYear();
375
+ $CcExpYear = str_split($temp, 2);
376
+ $request->setCcNum($payment->getCcNumber())
377
+ ->setCcExpires(sprintf('%02d%02d', $payment->getCcExpMonth(), $CcExpYear[1]))
378
+ ->setCvccvv2($payment->getCcCid());
379
+ }
380
+ break;
381
+
382
+ case self::REQUEST_METHOD_ECHECK:
383
+ $request->setAchRouting($payment->getEcheckRoutingNumber())
384
+ ->setAchAccount($payment->getEcheckAccountNumber())
385
+ ->setAchAccountType($payment->getEcheckAccountType())
386
+ ->setName($payment->getEcheckAccountName())
387
+ ->setDocType($payment->getEcheckType());
388
+ break;
389
+ }
390
+ return $request;
391
+ }
392
+
393
+ protected function _postRequest(Varien_Object $request)
394
+ {
395
+ $debugData = array('request' => $request->getData());
396
+ //if (!self::$_dupe) {
397
+ $result = Mage::getModel('creditcard/CCPayment_result');
398
+ //}
399
+ if (isset($_POST["?Result"])) {
400
+ $_POST["Result"] = $_POST["?Result"];
401
+ unset($_POST["?Result"]);
402
+ }
403
+ if (!isset($_POST["Result"])) {
404
+ $client = new Varien_Http_Client();
405
+ $uri = $this->getConfigData('cgi_url');
406
+ $client->setUri($uri ? $uri : self::CGI_URL);
407
+ $client->setConfig(array(
408
+ 'maxredirects'=>0,
409
+ 'timeout'=>30,
410
+ 'useragent'=>'BluePay Magento Credit Card Plugin/' . self::CURRENT_VERSION,
411
+ ));
412
+ $client->setParameterPost($request->getData());
413
+ $comma_separated = implode(",", $request->getData());
414
+ //Mage::throwException($this->_wrapGatewayError($comma_separated));
415
+ $client->setMethod(Zend_Http_Client::POST);
416
+ try {
417
+ $response = $client->request();
418
+ }
419
+ catch (Exception $e) {
420
+ $debugData['result'] = $result->getData();
421
+ $this->_debug($debugData);
422
+ Mage::throwException($this->_wrapGatewayError($e->getMessage()));
423
+ }
424
+ $r = $response->getHeader('location');
425
+ //if (self::$_dupe) {
426
+ // return $result;
427
+ //}
428
+ if ($r) {
429
+ $result->setResult($this->parseHeader($r, 'value', self::Result))
430
+ ->setInvoiceId($this->parseHeader($r, 'value', self::INVOICE_ID))
431
+ ->setBankName($this->parseHeader($r, 'value', self::BANK_NAME))
432
+ ->setMessage($this->parseHeader($r, 'value', self::MESSAGE))
433
+ ->setAuthCode($this->parseHeader($r, 'value', self::AUTH_CODE))
434
+ ->setAvs($this->parseHeader($r, 'value', self::AVS))
435
+ ->setRrno($this->parseHeader($r, 'value', self::RRNO))
436
+ ->setAmount($this->parseHeader($r, 'value', self::AMOUNT))
437
+ ->setPaymentType($this->parseHeader($r, 'value', self::PAYMENT_TYPE))
438
+ ->setOrderId($this->parseHeader($r, 'value', self::ORDER_ID))
439
+ ->setCvv2($this->parseHeader($r, 'value', self::CVV2));
440
+ $this->assignBluePayToken($result->getRrno());
441
+ }
442
+ else {
443
+ Mage::throwException(Mage::helper('paygate')->__('Error in payment gateway.'));
444
+ }
445
+
446
+ $debugData['result'] = $result->getData();
447
+ $this->_debug($debugData);
448
+ } else {
449
+ $result->setResult($_POST["Result"]);
450
+ $result->setMessage($_POST["MESSAGE"]);
451
+ }
452
+ return $result;
453
+ }
454
+
455
+ protected function _checkDuplicate(Varien_Object $payment)
456
+ {
457
+ if ($this->getConfigData('duplicate_check') == '0') {
458
+ return;
459
+ }
460
+ $order = $payment->getOrder();
461
+ $billing = $order->getBillingAddress();
462
+ $reportStart = date("Y-m-d H:i:s", time() - (3600 * 5) - $this->getConfigData('duplicate_check'));
463
+ $reportEnd = date("Y-m-d H:i:s", time() - (3600 * 5));
464
+ $hashstr = $this->getConfigData('trans_key') . $this->getConfigData('login') .
465
+ $reportStart . $reportEnd;
466
+ $request = Mage::getModel('creditcard/CCPayment_request');
467
+ $request->setData("MODE", $this->getConfigData('test_mode') == 'TEST' ? 'TEST' : 'LIVE');
468
+ $request->setData("TAMPER_PROOF_SEAL", bin2hex(md5($hashstr, true)));
469
+ $request->setData("ACCOUNT_ID", $this->getConfigData('login'));
470
+ $request->setData("REPORT_START_DATE", $reportStart);
471
+ $request->setData("REPORT_END_DATE", $reportEnd);
472
+ $request->setData("EXCLUDE_ERRORS", 1);
473
+ $request->setData("ISNULL_f_void", 1);
474
+ $request->setData("name1", $billing['firstname']);
475
+ $request->setData("name2", $billing['lastname']);
476
+ $request->setData("amount", $payment->getAmount());
477
+ $request->setData("status", '1');
478
+ $request->setData("IGNORE_NULL_STR", '0');
479
+ $request->setData("trans_type", "SALE");
480
+ $client = new Varien_Http_Client();
481
+
482
+ $client->setUri($uri ? $uri : self::STQ_URL);
483
+ $client->setConfig(array(
484
+ 'maxredirects'=>0,
485
+ 'timeout'=>30,
486
+ ));
487
+ $client->setParameterPost($request->getData());
488
+ $client->setMethod(Zend_Http_Client::POST);
489
+ try {
490
+ $response = $client->request();
491
+ }
492
+ catch (Exception $e) {
493
+
494
+ $this->_debug($debugData);
495
+ Mage::throwException($this->_wrapGatewayError($e->getMessage()));
496
+ }
497
+ $p = parse_str($client->request()->getBody());
498
+ if ($id) {
499
+ $conn = Mage::getSingleton('core/resource')->getConnection('core_read');
500
+ $result = $conn->fetchAll("SELECT * FROM sales_payment_transaction WHERE txn_id='$id'");
501
+ if ($result)
502
+ return;
503
+ self::$_dupe = true;
504
+ $payment->setTransactionType(self::REQUEST_TYPE_CREDIT);
505
+ $payment->setCcTransId($id);
506
+ $payment->setRrno($id);
507
+ $request = $this->_buildRequest($payment);
508
+ $result = $this->_postRequest($request);
509
+ $payment->setCcTransId('');
510
+ }
511
+ }
512
+
513
+
514
+ /**
515
+ * Gateway response wrapper
516
+ */
517
+ protected function _wrapGatewayError($text)
518
+ {
519
+ return Mage::helper('paygate')->__('Gateway error: %s', $text);
520
+ }
521
+
522
+ protected final function calcTPS(Varien_Object $payment) {
523
+
524
+ $order = $payment->getOrder();
525
+ $billing = $order->getBillingAddress();
526
+
527
+ $hashstr = $this->getConfigData('trans_key') . $this->getConfigData('login') .
528
+ $payment->getTransactionType() . $payment->getAmount() . $payment->getRrno() .
529
+ $this->getConfigData('test_mode');
530
+ return bin2hex( md5($hashstr, true) );
531
+ }
532
+
533
+ protected function parseHeader($header, $nameVal, $pos) {
534
+ $nameVal = ($nameVal == 'name') ? '0' : '1';
535
+ $s = explode("?", $header);
536
+ $t = explode("&", $s[1]);
537
+ $value = explode("=", $t[$pos]);
538
+ return $value[$nameVal];
539
+ }
540
+
541
+ public function validate()
542
+ {
543
+ /*
544
+ * calling parent validate function
545
+ */
546
+ $info = $this->getInfoInstance();
547
+ $errorMsg = false;
548
+ $availableTypes = explode(',',$this->getConfigData('cctypes'));
549
+
550
+ $ccNumber = $info->getCcNumber();
551
+
552
+ // remove credit card number delimiters such as "-" and space
553
+ $ccNumber = preg_replace('/[\-\s]+/', '', $ccNumber);
554
+ $info->setCcNumber($ccNumber);
555
+
556
+ $ccType = '';
557
+
558
+ if (in_array($info->getCcType(), $availableTypes)){
559
+ if ($this->validateCcNum($ccNumber)
560
+ // Other credit card type number validation
561
+ || ($this->OtherCcType($info->getCcType()) && $this->validateCcNumOther($ccNumber))) {
562
+
563
+ $ccType = 'OT';
564
+ $ccTypeRegExpList = array(
565
+ //Solo, Switch or Maestro. International safe
566
+ /*
567
+ // Maestro / Solo
568
+ 'SS' => '/^((6759[0-9]{12})|(6334|6767[0-9]{12})|(6334|6767[0-9]{14,15})'
569
+ . '|(5018|5020|5038|6304|6759|6761|6763[0-9]{12,19})|(49[013][1356][0-9]{12})'
570
+ . '|(633[34][0-9]{12})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$/',
571
+ */
572
+ // Solo only
573
+ 'SO' => '/(^(6334)[5-9](\d{11}$|\d{13,14}$))|(^(6767)(\d{12}$|\d{14,15}$))/',
574
+ 'SM' => '/(^(5[0678])\d{11,18}$)|(^(6[^05])\d{11,18}$)|(^(601)[^1]\d{9,16}$)|(^(6011)\d{9,11}$)'
575
+ . '|(^(6011)\d{13,16}$)|(^(65)\d{11,13}$)|(^(65)\d{15,18}$)'
576
+ . '|(^(49030)[2-9](\d{10}$|\d{12,13}$))|(^(49033)[5-9](\d{10}$|\d{12,13}$))'
577
+ . '|(^(49110)[1-2](\d{10}$|\d{12,13}$))|(^(49117)[4-9](\d{10}$|\d{12,13}$))'
578
+ . '|(^(49118)[0-2](\d{10}$|\d{12,13}$))|(^(4936)(\d{12}$|\d{14,15}$))/',
579
+ // Visa
580
+ 'VI' => '/^4[0-9]{12}([0-9]{3})?$/',
581
+ // Master Card
582
+ 'MC' => '/^5[1-5][0-9]{14}$/',
583
+ // American Express
584
+ 'AE' => '/^3[47][0-9]{13}$/',
585
+ // Discovery
586
+ 'DI' => '/^6011[0-9]{12}$/',
587
+ // JCB
588
+ 'JCB' => '/^(3[0-9]{15}|(2131|1800)[0-9]{11})$/'
589
+ );
590
+
591
+ foreach ($ccTypeRegExpList as $ccTypeMatch=>$ccTypeRegExp) {
592
+ if (preg_match($ccTypeRegExp, $ccNumber)) {
593
+ $ccType = $ccTypeMatch;
594
+ break;
595
+ }
596
+ }
597
+
598
+ if (!$this->OtherCcType($info->getCcType()) && $ccType!=$info->getCcType()) {
599
+ $errorMsg = Mage::helper('payment')->__('Credit card number mismatch with credit card type.');
600
+ }
601
+ }
602
+ else {
603
+ $errorMsg = Mage::helper('payment')->__('Invalid Credit Card Number');
604
+ }
605
+
606
+ }
607
+ else {
608
+ $errorMsg = Mage::helper('payment')->__('Credit card type is not allowed for this payment method.');
609
+ }
610
+
611
+ //validate credit card verification number
612
+ if ($errorMsg === false && $this->hasVerification()) {
613
+ $verifcationRegEx = $this->getVerificationRegEx();
614
+ $regExp = isset($verifcationRegEx[$info->getCcType()]) ? $verifcationRegEx[$info->getCcType()] : '';
615
+ if (!$info->getCcCid() || !$regExp || !preg_match($regExp ,$info->getCcCid())){
616
+ $errorMsg = Mage::helper('payment')->__('Please enter a valid credit card verification number.');
617
+ }
618
+ }
619
+
620
+ if ($ccType != 'SS' && !$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) {
621
+ $errorMsg = Mage::helper('payment')->__('Incorrect credit card expiration date.');
622
+ }
623
+
624
+ if($errorMsg) {
625
+ if ($this->getConfigData('use_iframe') == '1') {
626
+ $errorMsg = '';
627
+ }
628
+ }
629
+
630
+ //This must be after all validation conditions
631
+ if ($this->getIsCentinelValidationEnabled()) {
632
+ $this->getCentinelValidator()->validate($this->getCentinelValidationData());
633
+ }
634
+
635
+ return $this;
636
+ }
637
+
638
+ public function assignData($data)
639
+ {
640
+ if (!($data instanceof Varien_Object)) {
641
+ $data = new Varien_Object($data);
642
+ }
643
+
644
+ $info = $this->getInfoInstance();
645
+ $info->setCcType($data->getCcType())
646
+ ->setCcOwner($data->getCcOwner())
647
+ ->setCcLast4(substr($data->getCcNumber(), -4))
648
+ ->setCcNumber($data->getCcNumber())
649
+ ->setCcCid($data->getCcCid())
650
+ ->setCcExpMonth($data->getCcExpMonth())
651
+ ->setCcExpYear($data->getCcExpYear())
652
+ ->setCcSsIssue($data->getCcSsIssue())
653
+ ->setCcSsStartMonth($data->getCcSsStartMonth())
654
+ ->setCcSsStartYear($data->getCcSsStartYear())
655
+ ->setAdditionalData($data->getBpToken());
656
+ return $this;
657
+
658
+ }
659
+
660
+ public function assignBluePayToken($token)
661
+ {
662
+ $info = $this->getInfoInstance();
663
+ $info->setAdditionalData($token);
664
+ }
665
+
666
+ public function prepareSave()
667
+ {
668
+ $info = $this->getInfoInstance();
669
+
670
+ if ($this->_canSaveCc) {
671
+ $info->setCcNumberEnc($info->encrypt('xxxx-'.$info->getCcLast4()));
672
+ }
673
+ if ($info->getAdditionalData()) {
674
+ $info->setAdditionalData($info->getAdditionalData());
675
+ }
676
+ //$info->setCcCidEnc($info->encrypt($info->getCcCid()));
677
+ $info->setCcNumber(null)
678
+ ->setCcCid(null);
679
+ return $this;
680
+
681
+ }
682
+
683
+ public function hasVerificationBackend()
684
+ {
685
+ $configData = $this->getConfigData('useccv_backend');
686
+ if(is_null($configData)){
687
+ return true;
688
+ }
689
+ return (bool) $configData;
690
+ }
691
+
692
+ }
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>BluePay_CreditCard</name>
4
- <version>1.5.5.4</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Credit card payment module for the BluePay gateway.</summary>
10
- <description>Credit card payment module for the BluePay gateway.</description>
11
- <notes>Fixed compatibility with E-Check module</notes>
12
  <authors><author><name>Justin Slingerland</name><user>jslingerland</user><email>jslingerland@bluepay.com</email></author></authors>
13
- <date>2014-09-18</date>
14
- <time>15:04:30</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="BluePay_CreditCard.xml" hash="8a84b7d3e004f61f9d55e428b55cea8c"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="bluepay.xml" hash="cde2375a1a27707f7942117ed04f481f"/></dir><dir name="template"><dir name="bluepay"><file name="form.phtml" hash="e5cf9ce8eeaeae71fb3372fb542f7431"/><file name="creditcard.phtml" hash="4084bffebe86bead51a4910091fe82a5"/><file name="creditcardiframe.phtml" hash="55c518297c050fc4ce6a82a65d6620b0"/><file name="button.phtml" hash="85af90e7faab002f872f82e3d663139f"/><file name="inforeview.phtml" hash="0d29af5174235ded956fea6e92302a54"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="bluepay"><file name="creditcard.phtml" hash="34d197c5479f948b17c7a58a155a1e9d"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="bluepay"><file name="bluepay.js" hash="c371e7e864f1b3db25328fa08e3e9c27"/><dir name="easyXDM"><file name="easyXDM.Widgets.debug.js" hash="26b23561d39a64b926fe8dafea2f0a7b"/><file name="easyXDM.Widgets.js" hash="26b23561d39a64b926fe8dafea2f0a7b"/><file name="easyXDM.Widgets.min.js" hash="790f5fa04af75a8013d0ff5fd6dc770d"/><file name="easyXDM.debug.js" hash="2f74fa97b0aacdfb5e8570e381465905"/><file name="easyXDM.js" hash="499464a0c3d89679c11df6ee5d188df5"/><file name="easyXDM.min.js" hash="e3fd912457d7213fe5ccae7bf0fd0c82"/><file name="name.html" hash="990620350432f6c7e28f1e111ce598c8"/><file name=".gitignore" hash="f256c78995e7e95eb33afc3cee8ff195"/></dir></dir></dir></target><target name="magelocal"><dir name="BluePay"><dir name="CreditCard"><dir name="Block"><file name="Form.php" hash="3132dfeb27e31edb4c5a2a862126cdd7"/><file name=".Form.php.swp" hash="0220b69997fe967f426dcf20f6d57185"/></dir><dir name="Helper"><file name="Data.php" hash="dc77bf42a31b7dd5dc31b92549c99abc"/></dir><dir name="Model"><dir name="CCPayment"><file name="Debug.php" hash="bde283680e78d3891affd630c0959bc8"/><file name="Request.php" hash="0317b2c7dc66004767405b78a3cc2631"/><file name="Result.php" hash="0d285e50805f03af609c87d91fce092a"/><dir name="Source"><file name="Cctype.php" hash="9d0f6dd894fb1006ed9bedce966f270b"/><file name="PaymentAction.php" hash="a233de610ff201a77d920fd73ecfb24a"/></dir></dir><file name="CCPayment.php" hash="cb24f25eb95ffddf1465d01e9d0613a9"/><file name="Config.php" hash="387ecaf88faa6c7d740b78d9e2dd2db6"/><dir name="Mysql4"><dir name="CCPayment"><dir name="Debug"><file name="Collection.php" hash="9d4c92ad278242715d08b6e202770ce1"/></dir><file name="Debug.php" hash="4f64c922ddb5b80d36538696471b69b5"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="f514f783fd39e1836b6ef4fc5087ea18"/><file name="system.xml" hash="a7622a714caebe79f607e6aea2fffee1"/></dir><dir name="sql"><dir name="creditcard_setup"><file name="mysql4-install-0.7.0.php" hash="c97f60ff629417efef8beebf619caa9a"/></dir></dir></dir></dir></target><target name="magecore"><dir name="Mage"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Order"><dir name="Status"><file name="Processingcomplete.php" hash="f9eb96ffc645117a04cc094b62fb24d4"/></dir></dir><file name="Testmode.php" hash="3f72e89b4f8239ad839d591310468453"/><file name="Duplicatewindow.php" hash="86b5f8c6d10b2cca813919c8aead0464"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>5.6.9</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>BluePay_CreditCard</name>
4
+ <version>1.5.5.5</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Credit Card payment module for the BluePay gateway.</summary>
10
+ <description>Credit Card payment module for the BluePay gateway.</description>
11
+ <notes>Fixed issue with Company Name not being passed to BluePay</notes>
12
  <authors><author><name>Justin Slingerland</name><user>jslingerland</user><email>jslingerland@bluepay.com</email></author></authors>
13
+ <date>2015-08-24</date>
14
+ <time>18:37:57</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="BluePay_CreditCard.xml" hash="8a84b7d3e004f61f9d55e428b55cea8c"/></dir></target><target name="mageweb"><dir name="js"><dir name="bluepay"><file name="bluepay.js" hash="c371e7e864f1b3db25328fa08e3e9c27"/><dir name="easyXDM"><file name="easyXDM.Widgets.debug.js" hash="26b23561d39a64b926fe8dafea2f0a7b"/><file name="easyXDM.Widgets.js" hash="26b23561d39a64b926fe8dafea2f0a7b"/><file name="easyXDM.Widgets.min.js" hash="790f5fa04af75a8013d0ff5fd6dc770d"/><file name="easyXDM.debug.js" hash="2f74fa97b0aacdfb5e8570e381465905"/><file name="easyXDM.js" hash="499464a0c3d89679c11df6ee5d188df5"/><file name="easyXDM.min.js" hash="e3fd912457d7213fe5ccae7bf0fd0c82"/><file name="name.html" hash="990620350432f6c7e28f1e111ce598c8"/><file name=".gitignore" hash="f256c78995e7e95eb33afc3cee8ff195"/></dir></dir></dir></target><target name="magelocal"><dir name="BluePay"><dir name="CreditCard"><dir name="Block"><file name="Form.php" hash="3132dfeb27e31edb4c5a2a862126cdd7"/><file name=".Form.php.swp" hash="0220b69997fe967f426dcf20f6d57185"/></dir><dir name="Helper"><file name="Data.php" hash="dc77bf42a31b7dd5dc31b92549c99abc"/></dir><dir name="Model"><dir name="CCPayment"><file name="Debug.php" hash="bde283680e78d3891affd630c0959bc8"/><file name="Request.php" hash="0317b2c7dc66004767405b78a3cc2631"/><file name="Result.php" hash="0d285e50805f03af609c87d91fce092a"/><dir name="Source"><file name="Cctype.php" hash="9d0f6dd894fb1006ed9bedce966f270b"/><file name="PaymentAction.php" hash="a233de610ff201a77d920fd73ecfb24a"/></dir></dir><file name="CCPayment.php" hash="75eebdfcf80c84030c43a72b26184302"/><file name="CCPayment.php~" hash="ec3b63212a194e3ef7fba51bae3cf1f6"/><file name="Config.php" hash="387ecaf88faa6c7d740b78d9e2dd2db6"/><dir name="Mysql4"><dir name="CCPayment"><dir name="Debug"><file name="Collection.php" hash="9d4c92ad278242715d08b6e202770ce1"/></dir><file name="Debug.php" hash="4f64c922ddb5b80d36538696471b69b5"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="f514f783fd39e1836b6ef4fc5087ea18"/><file name="system.xml" hash="a7622a714caebe79f607e6aea2fffee1"/></dir><dir name="sql"><dir name="creditcard_setup"><file name="mysql4-install-0.7.0.php" hash="c97f60ff629417efef8beebf619caa9a"/></dir></dir></dir></dir></target><target name="magecore"><dir name="Mage"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Testmode.php" hash="3f72e89b4f8239ad839d591310468453"/></dir></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="bluepay.xml" hash="cde2375a1a27707f7942117ed04f481f"/></dir><dir name="template"><dir name="bluepay"><file name="creditcard.phtml" hash="4084bffebe86bead51a4910091fe82a5"/><file name="form.phtml" hash="e5cf9ce8eeaeae71fb3372fb542f7431"/><file name="creditcardiframe.phtml" hash="55c518297c050fc4ce6a82a65d6620b0"/><file name="button.phtml" hash="85af90e7faab002f872f82e3d663139f"/><file name="inforeview.phtml" hash="0d29af5174235ded956fea6e92302a54"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="bluepay"><file name="creditcard.phtml" hash="34d197c5479f948b17c7a58a155a1e9d"/><file name="inforeview.phtml" hash=""/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>5.6.9</max></php></required></dependencies>
18
  </package>