Posixtech_NetworkMerchants - Version 1.0.0.1

Version Notes

A payment method build from scratch to work seamlessly in Magento

• Version number: 1.0.0.1
• Stability: Stable
• Compatibility: 1.5, 1.6 ,1.7,1.8

Download this release

Release Info

Developer Posixtech Ltd.
Extension Posixtech_NetworkMerchants
Version 1.0.0.1
Comparing to
See all releases


Version 1.0.0.1

Files changed (22) hide show
  1. app/code/community/Posixtech/.DS_Store +0 -0
  2. app/code/community/Posixtech/NetworkMerchants/.DS_Store +0 -0
  3. app/code/community/Posixtech/NetworkMerchants/Block/.DS_Store +0 -0
  4. app/code/community/Posixtech/NetworkMerchants/Block/Direct/.DS_Store +0 -0
  5. app/code/community/Posixtech/NetworkMerchants/Block/Direct/Form/.DS_Store +0 -0
  6. app/code/community/Posixtech/NetworkMerchants/Block/Direct/Form/Cc.php +46 -0
  7. app/code/community/Posixtech/NetworkMerchants/Block/Direct/Info/.DS_Store +0 -0
  8. app/code/community/Posixtech/NetworkMerchants/Block/Direct/Info/Cc.php +132 -0
  9. app/code/community/Posixtech/NetworkMerchants/Helper/.DS_Store +0 -0
  10. app/code/community/Posixtech/NetworkMerchants/Helper/Data.php +40 -0
  11. app/code/community/Posixtech/NetworkMerchants/Model/.DS_Store +0 -0
  12. app/code/community/Posixtech/NetworkMerchants/Model/Direct/.DS_Store +0 -0
  13. app/code/community/Posixtech/NetworkMerchants/Model/Direct/Request.php +40 -0
  14. app/code/community/Posixtech/NetworkMerchants/Model/PaymentMethod.php +477 -0
  15. app/code/community/Posixtech/NetworkMerchants/etc/.DS_Store +0 -0
  16. app/code/community/Posixtech/NetworkMerchants/etc/config.xml +85 -0
  17. app/code/community/Posixtech/NetworkMerchants/etc/system.xml +195 -0
  18. app/design/frontend/default/default/template/networkmerchants/.DS_Store +0 -0
  19. app/design/frontend/default/default/template/networkmerchants/form/.DS_Store +0 -0
  20. app/design/frontend/default/default/template/networkmerchants/form/cc.phtml +140 -0
  21. app/etc/modules/Posixtech_NetworkMerchants.xml +49 -0
  22. package.xml +52 -0
app/code/community/Posixtech/.DS_Store ADDED
Binary file
app/code/community/Posixtech/NetworkMerchants/.DS_Store ADDED
Binary file
app/code/community/Posixtech/NetworkMerchants/Block/.DS_Store ADDED
Binary file
app/code/community/Posixtech/NetworkMerchants/Block/Direct/.DS_Store ADDED
Binary file
app/code/community/Posixtech/NetworkMerchants/Block/Direct/Form/.DS_Store ADDED
Binary file
app/code/community/Posixtech/NetworkMerchants/Block/Direct/Form/Cc.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Posixtech Ltd.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ *
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to support@posixtech.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * You can edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future.
18
+ *
19
+ * =================================================================
20
+ * MAGENTO EDITION USAGE NOTICE
21
+ * =================================================================
22
+ * This package designed for Magento COMMUNITY edition version 1.5.0.0 to all upper version.
23
+ * Posixtech Ltd. does not guarantee correct work of this extension
24
+ * on any other Magento edition except Magento COMMUNITY edition.
25
+ * Posixtech Ltd. does not provide extension support in case of
26
+ * incorrect edition usage.
27
+ * =================================================================
28
+ *
29
+ * @category Posixtech
30
+ * @package NetworkMerchants
31
+ * @copyright Copyright (c) 2013 Posixtech Ltd. (http://www.posixtech.com)
32
+ * @license http://www.posixtech.com/POSIXTECH_LTD_LICENSE.txt
33
+ */
34
+
35
+ class Posixtech_NetworkMerchants_Block_Direct_Form_Cc extends Mage_Payment_Block_Form_Cc
36
+ {
37
+ /**
38
+ * Set block template
39
+ */
40
+ protected function _construct()
41
+ {
42
+ parent::_construct();
43
+ $this->setTemplate('networkmerchants/form/cc.phtml');
44
+ }
45
+
46
+ }
app/code/community/Posixtech/NetworkMerchants/Block/Direct/Info/.DS_Store ADDED
Binary file
app/code/community/Posixtech/NetworkMerchants/Block/Direct/Info/Cc.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Posixtech Ltd.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ *
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to support@posixtech.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * You can edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future.
18
+ *
19
+ * =================================================================
20
+ * MAGENTO EDITION USAGE NOTICE
21
+ * =================================================================
22
+ * This package designed for Magento COMMUNITY edition version 1.5.0.0 to all upper version.
23
+ * Posixtech Ltd. does not guarantee correct work of this extension
24
+ * on any other Magento edition except Magento COMMUNITY edition.
25
+ * Posixtech Ltd. does not provide extension support in case of
26
+ * incorrect edition usage.
27
+ * =================================================================
28
+ *
29
+ * @category Posixtech
30
+ * @package NetworkMerchants
31
+ * @copyright Copyright (c) 2013 Posixtech Ltd. (http://www.posixtech.com)
32
+ * @license http://www.posixtech.com/POSIXTECH_LTD_LICENSE.txt
33
+ */
34
+
35
+ class Posixtech_NetworkMerchants_Block_Direct_Info_Cc extends Mage_Payment_Block_Info_Cc
36
+ {
37
+ /**
38
+ * Retrieve credit card type name
39
+ *
40
+ * @return string
41
+ */
42
+ public function getCcTypeName()
43
+ {
44
+ $types = Mage::getSingleton('payment/config')->getCcTypes();
45
+ $ccType = $this->getInfo()->getCcType();
46
+ if (isset($types[$ccType])) {
47
+ return $types[$ccType];
48
+ }
49
+ return (empty($ccType)) ? Mage::helper('networkmerchants')->__('N/A') : $ccType;
50
+ }
51
+
52
+ /**
53
+ * Whether current payment method has credit card expiration info
54
+ *
55
+ * @return bool
56
+ */
57
+ public function hasCcExpDate()
58
+ {
59
+ return (int)$this->getInfo()->getCcExpMonth() || (int)$this->getInfo()->getCcExpYear();
60
+ }
61
+
62
+ /**
63
+ * Retrieve CC expiration month
64
+ *
65
+ * @return string
66
+ */
67
+ public function getCcExpMonth()
68
+ {
69
+ $month = $this->getInfo()->getCcExpMonth();
70
+ if ($month<10) {
71
+ $month = '0'.$month;
72
+ }
73
+ return $month;
74
+ }
75
+
76
+ /**
77
+ * Retrieve CC expiration date
78
+ *
79
+ * @return Zend_Date
80
+ */
81
+ public function getCcExpDate()
82
+ {
83
+ $date = Mage::app()->getLocale()->date(0);
84
+ $date->setYear($this->getInfo()->getCcExpYear());
85
+ $date->setMonth($this->getInfo()->getCcExpMonth());
86
+ return $date;
87
+ }
88
+
89
+ /**
90
+ * Prepare credit card related payment info
91
+ *
92
+ * @param Varien_Object|array $transport
93
+ * @return Varien_Object
94
+ */
95
+ protected function _prepareSpecificInformation($transport = null)
96
+ {
97
+ if (null !== $this->_paymentSpecificInformation) {
98
+ return $this->_paymentSpecificInformation;
99
+ }
100
+ $transport = parent::_prepareSpecificInformation($transport);
101
+ $data = array();
102
+ if ($ccType = $this->getCcTypeName()) {
103
+ $data[Mage::helper('networkmerchants')->__('Credit Card Type')] = $ccType;
104
+ }
105
+ if ($this->getInfo()->getCcLast4()) {
106
+ $data[Mage::helper('networkmerchants')->__('Credit Card Number')] = sprintf('xxxx-%s', $this->getInfo()->getCcLast4());
107
+ }
108
+ if (!$this->getIsSecureMode()) {
109
+ if ($ccSsIssue = $this->getInfo()->getCcSsIssue()) {
110
+ $data[Mage::helper('networkmerchants')->__('Switch/Solo/Maestro Issue Number')] = $ccSsIssue;
111
+ }
112
+ $year = $this->getInfo()->getCcSsStartYear();
113
+ $month = $this->getInfo()->getCcSsStartMonth();
114
+ if ($year && $month) {
115
+ $data[Mage::helper('networkmerchants')->__('Switch/Solo/Maestro Start Date')] = $this->_formatCardDate($year, $month);
116
+ }
117
+ }
118
+ return $transport->setData(array_merge($data, $transport->getData()));
119
+ }
120
+
121
+ /**
122
+ * Format year/month on the credit card
123
+ *
124
+ * @param string $year
125
+ * @param string $month
126
+ * @return string
127
+ */
128
+ protected function _formatCardDate($year, $month)
129
+ {
130
+ return sprintf('%s/%s', sprintf('%02d', $month), $year);
131
+ }
132
+ }
app/code/community/Posixtech/NetworkMerchants/Helper/.DS_Store ADDED
Binary file
app/code/community/Posixtech/NetworkMerchants/Helper/Data.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Posixtech Ltd.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ *
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to support@posixtech.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * You can edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future.
18
+ *
19
+ * =================================================================
20
+ * MAGENTO EDITION USAGE NOTICE
21
+ * =================================================================
22
+ * This package designed for Magento COMMUNITY edition version 1.5.0.0 to all upper version.
23
+ * Posixtech Ltd. does not guarantee correct work of this extension
24
+ * on any other Magento edition except Magento COMMUNITY edition.
25
+ * Posixtech Ltd. does not provide extension support in case of
26
+ * incorrect edition usage.
27
+ * =================================================================
28
+ *
29
+ * @category Posixtech
30
+ * @package NetworkMerchants
31
+ * @copyright Copyright (c) 2013 Posixtech Ltd. (http://www.posixtech.com)
32
+ * @license http://www.posixtech.com/POSIXTECH_LTD_LICENSE.txt
33
+ */
34
+
35
+ class Posixtech_NetworkMerchants_Helper_Data extends Mage_Core_Helper_Abstract
36
+ {
37
+
38
+ }
39
+
40
+ ?>
app/code/community/Posixtech/NetworkMerchants/Model/.DS_Store ADDED
Binary file
app/code/community/Posixtech/NetworkMerchants/Model/Direct/.DS_Store ADDED
Binary file
app/code/community/Posixtech/NetworkMerchants/Model/Direct/Request.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Posixtech Ltd.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ *
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to support@posixtech.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * You can edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future.
18
+ *
19
+ * =================================================================
20
+ * MAGENTO EDITION USAGE NOTICE
21
+ * =================================================================
22
+ * This package designed for Magento COMMUNITY edition version 1.5.0.0 to all upper version.
23
+ * Posixtech Ltd. does not guarantee correct work of this extension
24
+ * on any other Magento edition except Magento COMMUNITY edition.
25
+ * Posixtech Ltd. does not provide extension support in case of
26
+ * incorrect edition usage.
27
+ * =================================================================
28
+ *
29
+ * @category Posixtech
30
+ * @package NetworkMerchants
31
+ * @copyright Copyright (c) 2013 Posixtech Ltd. (http://www.posixtech.com)
32
+ * @license http://www.posixtech.com/POSIXTECH_LTD_LICENSE.txt
33
+ */
34
+
35
+ class Posixtech_NetworkMerchants_Model_Direct_Request extends Varien_Object
36
+ {
37
+
38
+ }
39
+
40
+ ?>
app/code/community/Posixtech/NetworkMerchants/Model/PaymentMethod.php ADDED
@@ -0,0 +1,477 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Posixtech Ltd.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ *
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to support@posixtech.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * You can edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future.
18
+ *
19
+ * =================================================================
20
+ * MAGENTO EDITION USAGE NOTICE
21
+ * =================================================================
22
+ * This package designed for Magento COMMUNITY edition version 1.5.0.0 to all upper version.
23
+ * Posixtech Ltd. does not guarantee correct work of this extension
24
+ * on any other Magento edition except Magento COMMUNITY edition.
25
+ * Posixtech Ltd. does not provide extension support in case of
26
+ * incorrect edition usage.
27
+ * =================================================================
28
+ *
29
+ * @category Posixtech
30
+ * @package NetworkMerchants
31
+ * @copyright Copyright (c) 2013 Posixtech Ltd. (http://www.posixtech.com)
32
+ * @license http://www.posixtech.com/POSIXTECH_LTD_LICENSE.txt
33
+ */
34
+
35
+ class Posixtech_NetworkMerchants_Model_PaymentMethod extends Mage_Payment_Model_Method_Cc
36
+ {
37
+ protected $_code = 'networkmerchants';
38
+ protected $_isGateway = true;
39
+ protected $_canAuthorize = true;
40
+ protected $_canCapture = true;
41
+ protected $_canRefund = true;
42
+ protected $_canVoid = true;
43
+ protected $_canUseCheckout = true;
44
+ protected $_canSaveCC = false;
45
+
46
+ protected $_formBlockType = 'networkmerchants/direct_form_cc';
47
+ protected $_infoBlockType = 'networkmerchants/direct_info_cc';
48
+
49
+ private $_gatewayURL = 'https://secure.nmi.com/api/transact.php';
50
+
51
+ const REQUEST_TYPE_AUTH_CAPTURE = 'AUTH_CAPTURE';
52
+ const REQUEST_TYPE_AUTH_ONLY = 'AUTH_ONLY';
53
+
54
+ const RESPONSE_CODE_APPROVED = 1;
55
+ const RESPONSE_CODE_DECLINED = 2;
56
+ const RESPONSE_CODE_ERROR = 3;
57
+ const RESPONSE_CODE_HELD = 4;
58
+
59
+ const APPROVED = 1;
60
+ const DECLINED = 2;
61
+ const ERROR = 3;
62
+
63
+ /**
64
+ * Assign data to info model instance
65
+ *
66
+ * @param mixed $data
67
+ * @return Mage_Payment_Model_Info
68
+ */
69
+ public function assignData($data)
70
+ {
71
+ if (!($data instanceof Varien_Object)) {
72
+ $data = new Varien_Object($data);
73
+ }
74
+ $info = $this->getInfoInstance();
75
+ $info->setCcType($data->getCcType())
76
+ ->setCcOwner($data->getCcOwner())
77
+ ->setCcLast4(substr($data->getCcNumber(), -4))
78
+ ->setCcNumber($data->getCcNumber())
79
+ ->setCcCid($data->getCcCid())
80
+ ->setCcExpMonth($data->getCcExpMonth())
81
+ ->setCcExpYear($data->getCcExpYear())
82
+ ->setCcSsIssue($data->getCcSsIssue())
83
+ ->setCcSsStartMonth($data->getCcSsStartMonth())
84
+ ->setCcSsStartYear($data->getCcSsStartYear())
85
+ ;
86
+ return $this;
87
+ }
88
+
89
+ /**
90
+ * Send authorize request to gateway
91
+ *
92
+ */
93
+ public function authorize(Varien_Object $payment, $amount)
94
+ {
95
+ if ($amount <= 0) {
96
+ Mage::throwException(Mage::helper('networkmerchants')->__('Invalid amount for authorization.'));
97
+ }
98
+
99
+ $payment->setAmount($amount);
100
+ $payment->setAnetTransType(self::REQUEST_TYPE_AUTH_ONLY);
101
+
102
+ $request = $this->_buildRequest($payment);
103
+ $r = $this->doSale($request);
104
+
105
+ if (isset($r['response']) && ($r['response'] == 1)) {
106
+ if(isset($r['responsetext']) && (($r['responsetext'] == 'SUCCESS') || ($r['responsetext']=='Approved or completed successfully')) ) {
107
+ $payment->setTransactionId($r['transactionid'])
108
+ ->setCcApproval($r['authcode'])
109
+ ->setCcTransId($r['transactionid'])
110
+ ->setIsTransactionClosed(0)
111
+ ->setParentTransactionId(null)
112
+ ->setCcAvsStatus($r['avsresponse'])
113
+ ->setCcCidStatus($r['cvvresponse']);
114
+ return $this;
115
+ } else {
116
+ Mage::throwException('Transaction Declined: ' . $r['responsetext']);
117
+ }
118
+ } else {
119
+ Mage::throwException('Transaction Declined: ' . $r['responsetext']);
120
+ }
121
+ return $this;
122
+ }
123
+
124
+ protected function _buildRequest(Varien_Object $payment)
125
+ {
126
+ $order = $payment->getOrder();
127
+
128
+ $request = $this->_getRequest();
129
+
130
+ $testMode = $this->getConfigData('test_mode');
131
+
132
+ if($testMode) {
133
+ $request->setLoginUserName('demo')
134
+ ->setLoginPassword('password');
135
+ } else {
136
+ $username = $this->getConfigData('username');
137
+ $password = $this->getConfigData('password');
138
+ $request->setLoginUserName($username)
139
+ ->setLoginPassword($password);
140
+ }
141
+
142
+ $billing = $order->getBillingAddress();
143
+
144
+ if (!empty($billing)) {
145
+ $request->setBillingFirstname(strval($billing->getFirstname()));
146
+ $request->setBillingLastname(strval($billing->getLastname()));
147
+ $request->setBillingCompany(strval($billing->getCompany()));
148
+ $request->setBillingAddress1(strval($billing->getStreet(1)));
149
+ $request->setBillingAddress2(strval($billing->getStreet(2)));
150
+ $request->setBillingCity(strval($billing->getCity()));
151
+ $request->setBillingState(strval($billing->getRegion()));
152
+ $request->setBillingZip(strval($billing->getPostcode()));
153
+ $request->setBillingCountry(strval($billing->getCountry()));
154
+ $request->setBillingPhone(strval($billing->getTelephone()));
155
+ $request->setBillingFax(strval($billing->getFax()));
156
+ $request->setBillingEmail(strval($order->getCustomerEmail()));
157
+ $request->setBillingWebsite("");
158
+ }
159
+
160
+ $shipping = $order->getShippingAddress();
161
+ if (empty($shipping)) {
162
+ $shipping = $billing;
163
+ }
164
+
165
+ if (!empty($shipping)) {
166
+ $request->setShippingFirstname(strval($shipping->getFirstname()));
167
+ $request->setShippingLastname(strval($shipping->getLastname()));
168
+ $request->setShippingCompany(strval($shipping->getCompany()));
169
+ $request->setShippingAddress1(strval($shipping->getStreet(1)));
170
+ $request->setShippingAddress2(strval($shipping->getStreet(2)));
171
+ $request->setShippingCity(strval($shipping->getCity()));
172
+ $request->setShippingState(strval($shipping->getRegion()));
173
+ $request->setShippingZip(strval($shipping->getPostcode()));
174
+ $request->setShippingCountry(strval($shipping->getCountry()));
175
+ $request->setShippingEmail(strval($order->getCustomerEmail()));
176
+ }
177
+
178
+ $request->setOrderid($order->getIncrementId());
179
+ $request->setOrderdescription('');
180
+ $request->setTax(sprintf('%.2F', $order->getBaseTaxAmount()));
181
+ $request->setShipping(sprintf('%.2F', $order->getBaseShippingAmount()));
182
+ $request->setPonumber(strval($payment->getPoNumber()));
183
+ $request->setIpaddress(strval($order->getRemoteIp()));
184
+
185
+ $ccNumber = '';
186
+ $expDate = '';
187
+ $ccCid = '';
188
+ if($payment->getCcNumber()){
189
+ $ccNumber = $payment->getCcNumber();
190
+ $yr = substr($payment->getCcExpYear(), -2);
191
+ $expDate = sprintf('%02d%02d', $payment->getCcExpMonth(), $yr);
192
+ $ccCid = $payment->getCcCid();
193
+ } else {
194
+ Mage::throwException('Wrong Credit Card Number');
195
+ }
196
+
197
+ $request->setCreditCardNumber($ccNumber);
198
+ $request->setCcExp($expDate);
199
+ $request->setCvv($ccCid);
200
+
201
+ if($payment->getAmount()){
202
+ $request->setAmount($payment->getAmount());
203
+ }
204
+
205
+ return $request;
206
+ }
207
+
208
+ protected function _getRequest()
209
+ {
210
+ return Mage::getModel('networkmerchants/direct_request');
211
+ }
212
+
213
+ public function doSale($request) {
214
+ $query = "";
215
+
216
+ // Login Information
217
+ $query .= "username=" . urlencode($request->getLoginUserName()) . "&";
218
+ $query .= "password=" . urlencode($request->getLoginPassword()) . "&";
219
+
220
+ // Sales Information
221
+ $query .= "ccnumber=" . urlencode($request->getCreditCardNumber()) . "&";
222
+ $query .= "ccexp=" . urlencode($request->getCcExp()) . "&";
223
+ $query .= "amount=" . urlencode(number_format($request->getAmount(),2,".","")) . "&";
224
+ $query .= "cvv=" . urlencode($request->getCvv()) . "&";
225
+
226
+ // Order Information
227
+ $query .= "ipaddress=" . urlencode($request->getIpaddress()) . "&";
228
+ $query .= "orderid=" . urlencode($request->getOrderid()) . "&";
229
+ $query .= "orderdescription=" . urlencode($request->getOrderdescription()) . "&";
230
+ $query .= "tax=" . urlencode(number_format($request->getTax(),2,".","")) . "&";
231
+ $query .= "shipping=" . urlencode(number_format($request->getShipping(),2,".","")) . "&";
232
+ $query .= "ponumber=" . urlencode($request->getPonumber()) . "&";
233
+
234
+ // Billing Information
235
+ $query .= "firstname=" . urlencode($request->getBillingFirstname()) . "&";
236
+ $query .= "lastname=" . urlencode($request->getBillingLastname()) . "&";
237
+ $query .= "company=" . urlencode($request->getBillingCompany()) . "&";
238
+ $query .= "address1=" . urlencode($request->getBillingAddress1()) . "&";
239
+ $query .= "address2=" . urlencode($request->getBillingAddress2()) . "&";
240
+ $query .= "city=" . urlencode($request->getBillingCity()) . "&";
241
+ $query .= "state=" . urlencode($request->getBillingState()) . "&";
242
+ $query .= "zip=" . urlencode($request->getBillingZip()) . "&";
243
+ $query .= "country=" . urlencode($request->getBillingCountry()) . "&";
244
+ $query .= "phone=" . urlencode($request->getBillingPhone()) . "&";
245
+ $query .= "fax=" . urlencode($request->getBillingFax()) . "&";
246
+ $query .= "email=" . urlencode($request->getBillingEmail()) . "&";
247
+ $query .= "website=" . urlencode($request->getBillingWebsite()) . "&";
248
+
249
+ // Shipping Information
250
+ $query .= "shipping_firstname=" . urlencode($request->getShippingFirstname()) . "&";
251
+ $query .= "shipping_lastname=" . urlencode($request->getShippingLastname()) . "&";
252
+ $query .= "shipping_company=" . urlencode($request->getShippingCompany()) . "&";
253
+ $query .= "shipping_address1=" . urlencode($request->getShippingAddress1()) . "&";
254
+ $query .= "shipping_address2=" . urlencode($request->getShippingAddress2()) . "&";
255
+ $query .= "shipping_city=" . urlencode($request->getShippingCity()) . "&";
256
+ $query .= "shipping_state=" . urlencode($request->getShippingState()) . "&";
257
+ $query .= "shipping_zip=" . urlencode($request->getShippingZip()) . "&";
258
+ $query .= "shipping_country=" . urlencode($request->getShippingCountry()) . "&";
259
+ $query .= "shipping_email=" . urlencode($request->getShippingEmail()) . "&";
260
+ $query .= "type=auth";
261
+
262
+ return $this->_doPost($query);
263
+ }
264
+
265
+ /**
266
+ * Send capture request to gateway
267
+ *
268
+ */
269
+ public function capture(Varien_Object $payment, $amount) {
270
+
271
+ if ($amount <= 0) {
272
+ Mage::throwException(Mage::helper('networkmerchants')->__('Invalid amount for capture.'));
273
+ }
274
+
275
+ $this->_preauthorizeCapture($payment,$amount);
276
+
277
+ $transactionid = $payment->getTransactionId();
278
+ $order = $payment->getOrder();
279
+
280
+ $testMode = $this->getConfigData('test_mode');
281
+ $username = '';
282
+ $password = '';
283
+ if($testMode) {
284
+ $username = 'demo';
285
+ $password = 'password';
286
+ } else {
287
+ $username = $this->getConfigData('username');
288
+ $password = $this->getConfigData('password');
289
+ }
290
+
291
+ $query = "";
292
+ // Login Information
293
+ $query .= "username=" . urlencode($username) . "&";
294
+ $query .= "password=" . urlencode($password) . "&";
295
+
296
+ // Transaction Information
297
+ $query .= "transactionid=" . urlencode($transactionid) . "&";
298
+ if ($amount>0) {
299
+ $query .= "amount=" . urlencode(number_format($amount,2,".","")) . "&";
300
+ }
301
+ $query .= "type=capture";
302
+
303
+ $result = $this->_doPost($query);
304
+
305
+ if (isset($result['response']) && ($result['response'] == 1)) {
306
+ if(isset($result['responsetext']) && (($result['responsetext'] == 'SUCCESS') || ($result['responsetext']=='Approved or completed successfully')) ) {
307
+ $payment->setStatus(self::STATUS_APPROVED);
308
+ $payment->setLastTransId($result['transactionid']);
309
+ if (!$payment->getParentTransactionId() || $result['transactionid'] != $payment->getParentTransactionId()) {
310
+ $payment->setTransactionId($result['transactionid']);
311
+ }
312
+ return $this;
313
+ } else {
314
+ Mage::throwException('Transaction Declined: ' . $result['transactionid']);
315
+ }
316
+ } else {
317
+ Mage::throwException('Transaction Declined: ' . $result['transactionid']);
318
+ }
319
+ }
320
+
321
+ /**
322
+ * Send capture request to gateway for capture authorized transactions
323
+ *
324
+ * @param Mage_Payment_Model_Info $payment
325
+ * @param decimal $amount
326
+ */
327
+ protected function _preauthorizeCapture($payment, $requestedAmount)
328
+ {
329
+ $payment->setAmount($requestedAmount);
330
+ $payment->setAnetTransType(self::REQUEST_TYPE_AUTH_CAPTURE);
331
+
332
+ $request = $this->_buildRequest($payment);
333
+
334
+ $r = $this->doSale($request);
335
+
336
+ if (isset($r['response']) && ($r['response'] == 1)) {
337
+ if(isset($r['responsetext']) && (($r['responsetext'] == 'SUCCESS') || ($r['responsetext']=='Approved or completed successfully')) ) {
338
+ $payment->setTransactionId($r['transactionid'])
339
+ ->setCcApproval($r['authcode'])
340
+ ->setCcTransId($r['transactionid'])
341
+ ->setIsTransactionClosed(0)
342
+ ->setParentTransactionId(null)
343
+ ->setCcAvsStatus($r['avsresponse'])
344
+ ->setCcCidStatus($r['cvvresponse']);
345
+ return $this;
346
+ } else {
347
+ Mage::throwException('Transaction Declined: ' . $r['responsetext']);
348
+ }
349
+ } else {
350
+ Mage::throwException('Transaction Declined: ' . $r['responsetext']);
351
+ }
352
+ return $this;
353
+ }
354
+
355
+ public function _doPost($query) {
356
+ $ch = curl_init();
357
+ curl_setopt($ch, CURLOPT_URL, $this->_gatewayURL);
358
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
359
+ curl_setopt($ch, CURLOPT_TIMEOUT, 15);
360
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
361
+ curl_setopt($ch, CURLOPT_HEADER, 0);
362
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
363
+
364
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
365
+ curl_setopt($ch, CURLOPT_POST, 1);
366
+
367
+ if (!($data = curl_exec($ch))) {
368
+ Mage::throwException('Transaction Declined: error transaction');
369
+ return ERROR;
370
+ }
371
+ curl_close($ch);
372
+ unset($ch);
373
+ $responses = array();
374
+ $data = explode("&",$data);
375
+ for($i=0;$i<count($data);$i++) {
376
+ $rdata = explode("=",$data[$i]);
377
+ $responses[$rdata[0]] = $rdata[1];
378
+ }
379
+ return $responses;
380
+ }
381
+
382
+ /**
383
+ * Refund the amount
384
+ *
385
+ * @param Varien_Object $payment
386
+ * @param decimal $amount
387
+ * @return GatewayProcessingServices_ThreeStep_Model_PaymentMethod
388
+ * @throws Mage_Core_Exception
389
+ */
390
+ public function refund(Varien_Object $payment, $amount) {
391
+ if ($payment->getRefundTransactionId() && $amount > 0) {
392
+ $order = $payment->getOrder();
393
+
394
+ $testMode = $this->getConfigData('test_mode');
395
+ $username = '';
396
+ $password = '';
397
+ if($testMode) {
398
+ $username = 'demo';
399
+ $password = 'password';
400
+ } else {
401
+ $username = $this->getConfigData('username');
402
+ $password = $this->getConfigData('password');
403
+ }
404
+
405
+ $query = "";
406
+ // Login Information
407
+ $query .= "username=" . urlencode($username) . "&";
408
+ $query .= "password=" . urlencode($password) . "&";
409
+ // Transaction Information
410
+ $query .= "transactionid=" . urlencode($payment->getParentTransactionId()) . "&";
411
+ if ($amount>0) {
412
+ $query .= "amount=" . urlencode(number_format($amount,2,".","")) . "&";
413
+ }
414
+ $query .= "type=refund";
415
+ $result = $this->_doPost($query);
416
+ if (isset($result['response']) && ($result['response'] == 1)) {
417
+ $payment->setStatus(self::STATUS_SUCCESS );
418
+ return $this;
419
+ } else {
420
+ $payment->setStatus(self::STATUS_ERROR);
421
+ Mage::throwException('Refund Failed: Invalid transaction ID');
422
+ }
423
+ }
424
+ $payment->setStatus(self::STATUS_ERROR);
425
+ Mage::throwException('Refund Failed: Invalid transaction ID');
426
+ }
427
+
428
+ /**
429
+ * Void the payment through gateway
430
+ *
431
+ * @param Varien_Object $payment
432
+ * @return GatewayProcessingServices_ThreeStep_Model_PaymentMethod
433
+ * @throws Mage_Core_Exception
434
+ */
435
+ public function void(Varien_Object $payment) {
436
+
437
+ if ($payment->getParentTransactionId()) {
438
+ $order = $payment->getOrder();
439
+
440
+ $testMode = $this->getConfigData('test_mode');
441
+ $username = '';
442
+ $password = '';
443
+ if($testMode) {
444
+ $username = 'demo';
445
+ $password = 'password';
446
+ } else {
447
+ $username = $this->getConfigData('username');
448
+ $password = $this->getConfigData('password');
449
+ }
450
+
451
+ $query = "";
452
+ // Login Information
453
+ $query .= "username=" . urlencode($username) . "&";
454
+ $query .= "password=" . urlencode($password) . "&";
455
+ // Transaction Information
456
+ $query .= "transactionid=" . urlencode($payment->getParentTransactionId()) . "&";
457
+ $query .= "type=void";
458
+ $result = $this->_doPost($query);
459
+ if (isset($result['response']) && ($result['response'] == 1)) {
460
+ $payment->setStatus(self::STATUS_SUCCESS );
461
+ return $this;
462
+ } else {
463
+ $payment->setStatus(self::STATUS_ERROR);
464
+ Mage::throwException('Void Failed: Invalid transaction ID.');
465
+ }
466
+ }
467
+ $payment->setStatus(self::STATUS_ERROR);
468
+ Mage::throwException('Void Failed: Invalid transaction ID.');
469
+ }
470
+
471
+ public function cancel(Varien_Object $payment)
472
+ {
473
+ return $this->void($payment);
474
+ }
475
+ }
476
+
477
+ ?>
app/code/community/Posixtech/NetworkMerchants/etc/.DS_Store ADDED
Binary file
app/code/community/Posixtech/NetworkMerchants/etc/config.xml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ *
4
+ * Posixtech Ltd.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the EULA
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ *
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 support@posixtech.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * You can edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future.
19
+ *
20
+ * =================================================================
21
+ * MAGENTO EDITION USAGE NOTICE
22
+ * =================================================================
23
+ * This package designed for Magento COMMUNITY edition version 1.5.0.0 to all upper version.
24
+ * Posixtech Ltd. does not guarantee correct work of this extension
25
+ * on any other Magento edition except Magento COMMUNITY edition.
26
+ * Posixtech Ltd. does not provide extension support in case of
27
+ * incorrect edition usage.
28
+ * =================================================================
29
+ *
30
+ * @category Posixtech
31
+ * @package NetworkMerchants
32
+ * @copyright Copyright (c) 2013 Posixtech Ltd. (http://www.posixtech.com)
33
+ * @license http://www.posixtech.com/POSIXTECH_LTD_LICENSE.txt
34
+ *
35
+ -->
36
+ <config>
37
+ <modules>
38
+ <Posixtech_NetworkMerchants>
39
+ <version>1.0.0.1</version>
40
+ </Posixtech_NetworkMerchants>
41
+ </modules>
42
+ <global>
43
+ <blocks>
44
+ <networkmerchants>
45
+ <class>Posixtech_NetworkMerchants_Block</class>
46
+ </networkmerchants>
47
+ </blocks>
48
+ <models>
49
+ <networkmerchants>
50
+ <class>Posixtech_NetworkMerchants_Model</class>
51
+ </networkmerchants>
52
+ </models>
53
+ <helpers>
54
+ <networkmerchants>
55
+ <class>Posixtech_NetworkMerchants_Helper</class>
56
+ </networkmerchants>
57
+ </helpers>
58
+ </global>
59
+ <frontend>
60
+ <routers>
61
+ <networkmerchants>
62
+ <use>standard</use>
63
+ <args>
64
+ <module>Posixtech_NetworkMerchants</module>
65
+ <frontName>networkmerchants</frontName>
66
+ </args>
67
+ </networkmerchants>
68
+ </routers>
69
+ </frontend>
70
+ <default>
71
+ <payment>
72
+ <networkmerchants>
73
+ <active>0</active>
74
+ <model>networkmerchants/paymentMethod</model>
75
+ <order_status>processing</order_status>
76
+ <title>Credit Card(NMI)</title>
77
+ <cctypes>VI,MC,DI,AE</cctypes>
78
+ <payment_action>authorize</payment_action>
79
+ <currency>USD</currency>
80
+ <allowspecific>0</allowspecific>
81
+ <useccv>0</useccv>
82
+ </networkmerchants>
83
+ </payment>
84
+ </default>
85
+ </config>
app/code/community/Posixtech/NetworkMerchants/etc/system.xml ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ *
4
+ * Posixtech Ltd.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the EULA
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ *
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 support@posixtech.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * You can edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future.
19
+ *
20
+ * =================================================================
21
+ * MAGENTO EDITION USAGE NOTICE
22
+ * =================================================================
23
+ * This package designed for Magento COMMUNITY edition version 1.5.0.0 to all upper version.
24
+ * Posixtech Ltd. does not guarantee correct work of this extension
25
+ * on any other Magento edition except Magento COMMUNITY edition.
26
+ * Posixtech Ltd. does not provide extension support in case of
27
+ * incorrect edition usage.
28
+ * =================================================================
29
+ *
30
+ * @category Posixtech
31
+ * @package NetworkMerchants
32
+ * @copyright Copyright (c) 2013 Posixtech Ltd. (http://www.posixtech.com)
33
+ * @license http://www.posixtech.com/POSIXTECH_LTD_LICENSE.txt
34
+ *
35
+ -->
36
+ <config>
37
+ <sections>
38
+ <payment>
39
+ <groups>
40
+ <networkmerchants translate="label" module="paygate">
41
+ <label>Network Merchants</label>
42
+ <sort_order>100</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>0</show_in_store>
46
+ <fields>
47
+ <active translate="label">
48
+ <label>Enabled</label>
49
+ <frontend_type>select</frontend_type>
50
+ <source_model>adminhtml/system_config_source_yesno</source_model>
51
+ <comment><![CDATA[Whether this payment method is enabled or disabled]]></comment>
52
+ <sort_order>1</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>0</show_in_store>
56
+ </active>
57
+ <title translate="label">
58
+ <label>Title</label>
59
+ <frontend_type>text</frontend_type>
60
+ <sort_order>2</sort_order>
61
+ <comment><![CDATA[The title of the payment method that will be displayed to customers.]]></comment>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ </title>
66
+ <username translate="label">
67
+ <label>User Name</label>
68
+ <frontend_type>text</frontend_type>
69
+ <sort_order>3</sort_order>
70
+ <comment><![CDATA[User Name that is use to hook the payment method to your gateway account.]]></comment>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>0</show_in_store>
74
+ </username>
75
+ <password translate="label">
76
+ <label>Password</label>
77
+ <frontend_type>text</frontend_type>
78
+ <sort_order>4</sort_order>
79
+ <comment><![CDATA[Password that is use to hook the payment method to your gateway account.]]></comment>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>0</show_in_store>
83
+ </password>
84
+ <payment_action translate="label">
85
+ <label>Payment Action</label>
86
+ <frontend_type>select</frontend_type>
87
+ <source_model>paygate/authorizenet_source_paymentAction</source_model>
88
+ <sort_order>5</sort_order>
89
+ <comment><![CDATA["Authorize Only" or "Authorize and Capture". If you select Authorize Only, you will need to capture the transaction in order for funds to move.]]></comment>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>0</show_in_store>
93
+ </payment_action>
94
+ <order_status transaction="label">
95
+ <label>New order status</label>
96
+ <frontend_type>select</frontend_type>
97
+ <source_model>adminhtml/system_config_source_order_status</source_model>
98
+ <comment><![CDATA[The status of the order after the payment is successful.]]></comment>
99
+ <sort_order>6</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>0</show_in_store>
103
+ </order_status>
104
+ <test_mode translate="label">
105
+ <label>Test Mode</label>
106
+ <frontend_type>select</frontend_type>
107
+ <source_model>adminhtml/system_config_source_yesno</source_model>
108
+ <comment><![CDATA[If test mode is enabled, your transactions will be sent to a test merchant account.]]></comment>
109
+ <sort_order>7</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>0</show_in_store>
113
+ </test_mode>
114
+ <currency translate="label">
115
+ <label>Accepted Currency</label>
116
+ <frontend_type>select</frontend_type>
117
+ <source_model>adminhtml/system_config_source_currency</source_model>
118
+ <sort_order>8</sort_order>
119
+ <show_in_default>1</show_in_default>
120
+ <show_in_website>1</show_in_website>
121
+ <show_in_store>0</show_in_store>
122
+ </currency>
123
+ <cctypes translate="label">
124
+ <label>Credit Card Types</label>
125
+ <frontend_type>multiselect</frontend_type>
126
+ <source_model>paygate/authorizenet_source_cctype</source_model>
127
+ <sort_order>9</sort_order>
128
+ <comment><![CDATA[Select which credit card types are accepted.]]></comment>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>0</show_in_store>
132
+ </cctypes>
133
+ <useccv translate="label">
134
+ <label>Credit Card Verification</label>
135
+ <frontend_type>select</frontend_type>
136
+ <source_model>adminhtml/system_config_source_yesno</source_model>
137
+ <comment><![CDATA[Whether the 3 or 4 digit card security code is required.]]></comment>
138
+ <sort_order>10</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>0</show_in_store>
142
+ </useccv>
143
+ <allowspecific translate="label">
144
+ <label><![CDATA[Payment from applicable countries:]]></label>
145
+ <comment><![CDATA[Set this to "Specific Countries" if you wish to limit what countries may place orders.]]></comment>
146
+ <frontend_type>allowspecific</frontend_type>
147
+ <sort_order>11</sort_order>
148
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
149
+ <show_in_default>1</show_in_default>
150
+ <show_in_website>1</show_in_website>
151
+ <show_in_store>1</show_in_store>
152
+ </allowspecific>
153
+ <specificcountry translate="label">
154
+ <label><![CDATA[Payment from Specific countries:]]></label>
155
+ <comment><![CDATA[Which countries this payment method is available to. This becomes active if the setting above is set to "Specific Countries".]]></comment>
156
+ <frontend_type>multiselect</frontend_type>
157
+ <sort_order>12</sort_order>
158
+ <source_model>adminhtml/system_config_source_country</source_model>
159
+ <show_in_default>1</show_in_default>
160
+ <show_in_website>1</show_in_website>
161
+ <show_in_store>1</show_in_store>
162
+ </specificcountry>
163
+ <min_order_total translate="label">
164
+ <label>Minimum Order Total</label>
165
+ <frontend_type>text</frontend_type>
166
+ <sort_order>13</sort_order>
167
+ <show_in_default>1</show_in_default>
168
+ <show_in_website>1</show_in_website>
169
+ <show_in_store>0</show_in_store>
170
+ </min_order_total>
171
+ <max_order_total translate="label">
172
+ <label>Maximum Order Total</label>
173
+ <frontend_type>text</frontend_type>
174
+ <sort_order>14</sort_order>
175
+ <show_in_default>1</show_in_default>
176
+ <show_in_website>1</show_in_website>
177
+ <show_in_store>0</show_in_store>
178
+ </max_order_total>
179
+ <sort_order translate="label">
180
+ <label>Sort Order</label>
181
+ <comment><![CDATA[In which order this payment method will appear on the checkout page.]]></comment>
182
+ <frontend_type>text</frontend_type>
183
+ <sort_order>15</sort_order>
184
+ <show_in_default>1</show_in_default>
185
+ <show_in_website>1</show_in_website>
186
+ <show_in_store>0</show_in_store>
187
+ <frontend_class>validate-number</frontend_class>
188
+ </sort_order>
189
+ </fields>
190
+ </networkmerchants>
191
+ </groups>
192
+ </payment>
193
+ </sections>
194
+ </config>
195
+
app/design/frontend/default/default/template/networkmerchants/.DS_Store ADDED
Binary file
app/design/frontend/default/default/template/networkmerchants/form/.DS_Store ADDED
Binary file
app/design/frontend/default/default/template/networkmerchants/form/cc.phtml ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Posixtech Ltd.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ *
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to support@posixtech.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * You can edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future.
18
+ *
19
+ * =================================================================
20
+ * MAGENTO EDITION USAGE NOTICE
21
+ * =================================================================
22
+ * This package designed for Magento COMMUNITY edition version 1.5.0.0 to all upper version.
23
+ * Posixtech Ltd. does not guarantee correct work of this extension
24
+ * on any other Magento edition except Magento COMMUNITY edition.
25
+ * Posixtech Ltd. does not provide extension support in case of
26
+ * incorrect edition usage.
27
+ * =================================================================
28
+ *
29
+ * @category Posixtech
30
+ * @package NetworkMerchants
31
+ * @copyright Copyright (c) 2013 Posixtech Ltd. (http://www.posixtech.com)
32
+ * @license http://www.posixtech.com/POSIXTECH_LTD_LICENSE.txt
33
+ */
34
+ ?>
35
+
36
+
37
+ <?php $_code = $this->getMethodCode() ?>
38
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
39
+ <li>
40
+ <label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
41
+ <div class="input-box">
42
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" title="<?php echo $this->__('Credit Card Type') ?>" class="required-entry validate-cc-type-select">
43
+ <option value=""><?php echo $this->__('--Please Select--') ?></option>
44
+ <?php $_ccType = $this->getInfoData('cc_type') ?>
45
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
46
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode == $_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
47
+ <?php endforeach ?>
48
+ </select>
49
+ </div>
50
+ </li>
51
+ <li>
52
+ <label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
53
+ <div class="input-box">
54
+ <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
55
+ </div>
56
+ </li>
57
+ <li>
58
+ <label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
59
+ <div class="input-box">
60
+ <div class="v-fix">
61
+ <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
62
+ <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
63
+ <?php foreach ($this->getCcMonths() as $k => $v): ?>
64
+ <option value="<?php echo $k ? $k : '' ?>"<?php if($k == $_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
65
+ <?php endforeach ?>
66
+ </select>
67
+ </div>
68
+ <div class="v-fix">
69
+ <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
70
+ <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
71
+ <?php foreach ($this->getCcYears() as $k => $v): ?>
72
+ <option value="<?php echo $k ? $k : '' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
73
+ <?php endforeach ?>
74
+ </select>
75
+ </div>
76
+ </div>
77
+ </li>
78
+ <?php echo $this->getChildHtml() ?>
79
+
80
+ <?php if($this->hasVerification()): ?>
81
+ <li>
82
+ <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
83
+ <div class="input-box">
84
+ <div class="v-fix">
85
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
86
+ </div>
87
+ <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
88
+ </div>
89
+ </li>
90
+ <?php endif; ?>
91
+ <?php if ($this->hasSsCardType()): ?>
92
+ <li id="<?php echo $_code ?>_cc_type_ss_div">
93
+ <ul class="inner-form">
94
+ <li class="form-alt"><label for="<?php echo $_code ?>_cc_issue" class="required"><em>*</em><?php echo $this->__('Switch/Solo/Maestro Only') ?></label></li>
95
+ <li>
96
+ <label for="<?php echo $_code ?>_cc_issue"><?php echo $this->__('Issue Number') ?>:</label>
97
+ <span class="input-box">
98
+ <input type="text" title="<?php echo $this->__('Issue Number') ?>" class="input-text validate-cc-ukss cvv" id="<?php echo $_code ?>_cc_issue" name="payment[cc_ss_issue]" value="" />
99
+ </span>
100
+ </li>
101
+
102
+ <li>
103
+ <label for="<?php echo $_code ?>_start_month"><?php echo $this->__('Start Date') ?>:</label>
104
+ <div class="input-box">
105
+ <div class="v-fix">
106
+ <select id="<?php echo $_code ?>_start_month" name="payment[cc_ss_start_month]" class="validate-cc-ukss month">
107
+ <?php foreach ($this->getCcMonths() as $k => $v): ?>
108
+ <option value="<?php echo $k ? $k : '' ?>"<?php if($k == $this->getInfoData('cc_ss_start_month')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
109
+ <?php endforeach ?>
110
+ </select>
111
+ </div>
112
+ <div class="v-fix">
113
+ <select id="<?php echo $_code ?>_start_year" name="payment[cc_ss_start_year]" class="validate-cc-ukss year">
114
+ <?php foreach ($this->getSsStartYears() as $k => $v): ?>
115
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k == $this->getInfoData('cc_ss_start_year')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
116
+ <?php endforeach ?>
117
+ </select>
118
+ </div>
119
+ </div>
120
+ </li>
121
+ <li class="adv-container">&nbsp;</li>
122
+ </ul>
123
+ <script type="text/javascript">
124
+ //<![CDATA[
125
+ var SSChecked<?php echo $_code ?> = function() {
126
+ var elm = $('<?php echo $_code ?>_cc_type');
127
+ if (['SS','SM','SO'].indexOf(elm.value) != -1) {
128
+ $('<?php echo $_code ?>_cc_type_ss_div').show();
129
+ } else {
130
+ $('<?php echo $_code ?>_cc_type_ss_div').hide();
131
+ }
132
+ };
133
+
134
+ Event.observe($('<?php echo $_code ?>_cc_type'), 'change', SSChecked<?php echo $_code ?>);
135
+ SSChecked<?php echo $_code ?>();
136
+ //]]>
137
+ </script>
138
+ </li>
139
+ <?php endif; ?>
140
+ </ul>
app/etc/modules/Posixtech_NetworkMerchants.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ *
4
+ * Posixtech Ltd.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the EULA
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ *
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 support@posixtech.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * You can edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future.
19
+ *
20
+ * =================================================================
21
+ * MAGENTO EDITION USAGE NOTICE
22
+ * =================================================================
23
+ * This package designed for Magento COMMUNITY edition version 1.5.0.0 to all upper version.
24
+ * Posixtech Ltd. does not guarantee correct work of this extension
25
+ * on any other Magento edition except Magento COMMUNITY edition.
26
+ * Posixtech Ltd. does not provide extension support in case of
27
+ * incorrect edition usage.
28
+ * =================================================================
29
+ *
30
+ * @category Posixtech
31
+ * @package NetworkMerchants
32
+ * @copyright Copyright (c) 2013 Posixtech Ltd. (http://www.posixtech.com)
33
+ * @license http://www.posixtech.com/POSIXTECH_LTD_LICENSE.txt
34
+ *
35
+ -->
36
+ <config>
37
+ <modules>
38
+ <Posixtech_NetworkMerchants>
39
+ <active>true</active>
40
+ <codePool>community</codePool>
41
+ <!--
42
+ Core Magento Payment module dependency
43
+ -->
44
+ <depends>
45
+ <Mage_Payment />
46
+ </depends>
47
+ </Posixtech_NetworkMerchants>
48
+ </modules>
49
+ </config>
package.xml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Posixtech_NetworkMerchants</name>
4
+ <version>1.0.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.posixtech.com/POSIXTECH_LTD_LICENSE.txt">POSIXTECH_LTD_LICENSE</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>What is &#x201C;NMI Direct Post API&#x201D;? The Direct Post method is the simplest integration method for both web-based and non web-based payment applications; however, merchants using this integration method should have passed a PCI vulnerability scans before use. For detail regarding this payment method, you can browse https://www.nmi.com/&#xD;
10
+ &#xD;
11
+ Network Merchants Inc (NMI) provide solution regarding payment gateways for companies that want to process online transactions in real-time anywhere in the world through unique distribution channel and power of control. The &#x2018;First Call Resolution&#x2019;, &#x2018;Proprietary, Innovative &amp; Secure Products&#x2019; and &#x2018;Non-Compete Guarantee&#x2019; are key feature of NMI</summary>
12
+ <description>Overview: &#xD;
13
+ Network Merchants Inc. Payment Gateway Integration (Direct Post API)&#xD;
14
+ &#xD;
15
+ &#xD;
16
+ What is &#x201C;NMI Direct Post API&#x201D;? The Direct Post method is the simplest integration method for both web-based and non web-based payment applications; however, merchants using this integration method should have passed a PCI vulnerability scans before use. For detail regarding this payment method, you can browse https://www.nmi.com/&#xD;
17
+ &#xD;
18
+ Network Merchants Inc (NMI) provide solution regarding payment gateways for companies that want to process online transactions in real-time anywhere in the world through unique distribution channel and power of control. The &#x2018;First Call Resolution&#x2019;, &#x2018;Proprietary, Innovative &amp; Secure Products&#x2019; and &#x2018;Non-Compete Guarantee&#x2019; are key feature of NMI&#xD;
19
+ &#xD;
20
+ This module is based on &#x2018;Transaction Request APIs&#x2019; and has following option &#xD;
21
+ a. Authorize, &#xD;
22
+ b. Authorize &amp; capture, &#xD;
23
+ c. Void&#xD;
24
+ d. Refund.&#xD;
25
+ &#xD;
26
+ &#xD;
27
+ Customer Experience&#xD;
28
+ 1. Free customer support.&#xD;
29
+ 2. Free extension updates.&#xD;
30
+ 3. Free bug fixing.&#xD;
31
+ 4. PE compatibility&#xD;
32
+ 5. Easy 2-minute installation&#xD;
33
+ 6. All our extensions come open source&#xD;
34
+ 7. Free upgrades during support period&#xD;
35
+ 8. Our excellent support team is waiting to hear from you each business day from 9:00 am to 5:00 pm GMT&#xD;
36
+ Visit Extension Page: http://store.posixtech.com/nmi-direct-post-api.html &#xD;
37
+ User Guide: http://store.posixtech.com/nmi-direct-post-api.html &#xD;
38
+ Please note you must already have a Network Merchants Inc account to use this module.&#xD;
39
+ Please, check Magento versions compatibility on the product page!&#xD;
40
+ </description>
41
+ <notes>A payment method build from scratch to work seamlessly in Magento&#xD;
42
+ &#xD;
43
+ &#x2022; Version number: 1.0.0.1 &#xD;
44
+ &#x2022; Stability: Stable &#xD;
45
+ &#x2022; Compatibility: 1.5, 1.6 ,1.7,1.8</notes>
46
+ <authors><author><name>Posixtech Ltd.</name><user>posixtech</user><email>info@posixtech.com</email></author></authors>
47
+ <date>2013-11-15</date>
48
+ <time>11:03:56</time>
49
+ <contents><target name="magecommunity"><dir name="Posixtech"><dir name="NetworkMerchants"><dir name="Block"><dir name="Direct"><dir name="Form"><file name="Cc.php" hash="cc849c46ec15b74d9ccc67d503dced90"/><file name=".DS_Store" hash="5fee2b876e4438ab4b88b25b0cedd4e6"/></dir><dir name="Info"><file name="Cc.php" hash="1f65aaf483320075531780db1f65b1ea"/><file name=".DS_Store" hash="5fee2b876e4438ab4b88b25b0cedd4e6"/></dir><file name=".DS_Store" hash="1b57af7fedd28f88710e11d4342f43eb"/></dir><file name=".DS_Store" hash="2209c4ebeb79dd90152514adb95102bc"/></dir><dir name="Helper"><file name="Data.php" hash="921d622c9f7d889d93ee42216efdf8ce"/><file name=".DS_Store" hash="5cc9b356b8566590d84d1a846226a1e1"/></dir><dir name="Model"><dir name="Direct"><file name="Request.php" hash="bae335e36c9042dfc41d8c474ff8da71"/><file name=".DS_Store" hash="70d24aa344419921e5d1ec1fe72cc082"/></dir><file name="PaymentMethod.php" hash="5497092a3a8922837b890d7a6f3ec0d3"/><file name=".DS_Store" hash="807fb538f6177b96f9d87b07e0e99560"/></dir><dir name="etc"><file name="config.xml" hash="711c1181116bba1266884db4a354a4fa"/><file name="system.xml" hash="32c758ef339e07d89ed8393310cd38bc"/><file name=".DS_Store" hash="3cf7327b7340b7db7c031327cb542a62"/></dir><file name=".DS_Store" hash="7c43533d587efe5cf71deecbd962d309"/></dir><file name=".DS_Store" hash="6ad8c67a0c53cf2a589d82d057229899"/></dir></target><target name="mageetc"><dir name="modules"><file name="Posixtech_NetworkMerchants.xml" hash="9742774cfc7565a93c52edb1206fdce3"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="networkmerchants"><dir name="form"><file name="cc.phtml" hash="4234692fc2a7bb37365255d07b4575c3"/><file name=".DS_Store" hash="860327bc9800f32ef30c2b37a9bec056"/></dir><file name=".DS_Store" hash="5d6ac7fcc92eca27e410fa88ac6df707"/></dir></dir></dir></dir></dir></target></contents>
50
+ <compatible/>
51
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
52
+ </package>