Version Notes
Extension provides the ability for merchants to process through the CardConnect Gateway.
Download this release
Release Info
Developer | Team FireGento |
Extension | CardconnectCcgateway |
Version | 1.0.8.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.8.4 to 1.0.8.5
- app/code/community/Cardconnect/Ccgateway/Model/Standard.php +4 -0
- app/code/community/Cardconnect/Ccgateway/controllers/LogController.php +46 -0
- app/code/community/Cardconnect/Ccgateway/controllers/PaymentController.php +366 -367
- app/code/community/Cardconnect/Ccgateway/etc/config.xml +1 -1
- app/design/adminhtml/default/default/template/ccgateway/form.phtml +3 -2
- app/design/frontend/base/default/template/ccgateway/cardmanagement/editcard.phtml +3 -2
- app/design/frontend/base/default/template/ccgateway/cardmanagement/new.phtml +3 -1
- app/design/frontend/base/default/template/ccgateway/form.phtml +5 -3
- js/cardconnect/ccgateway.js +76 -56
- package.xml +4 -4
app/code/community/Cardconnect/Ccgateway/Model/Standard.php
CHANGED
@@ -123,6 +123,10 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
123 |
return Mage::getUrl('ccgateway/payment/redirect');
|
124 |
}
|
125 |
|
|
|
|
|
|
|
|
|
126 |
/**
|
127 |
* Get Payment transaction type
|
128 |
*/
|
123 |
return Mage::getUrl('ccgateway/payment/redirect');
|
124 |
}
|
125 |
|
126 |
+
public function getErrorlogUrl() {
|
127 |
+
return Mage::getUrl('ccgateway/log/logfrontenderrors');
|
128 |
+
}
|
129 |
+
|
130 |
/**
|
131 |
* Get Payment transaction type
|
132 |
*/
|
app/code/community/Cardconnect/Ccgateway/controllers/LogController.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @brief Defines the redirect and response function
|
5 |
+
* @category Magento CardConnect Payment Module
|
6 |
+
* @author CardConnect
|
7 |
+
* @copyright Portions copyright 2014 CardConnect
|
8 |
+
* @copyright Portions copyright Magento 2014
|
9 |
+
* @license GPL v2, please see LICENSE.txt
|
10 |
+
* @access public
|
11 |
+
* @version $Id: $
|
12 |
+
*
|
13 |
+
* */
|
14 |
+
|
15 |
+
/**
|
16 |
+
Magento
|
17 |
+
*
|
18 |
+
NOTICE OF LICENSE
|
19 |
+
*
|
20 |
+
This source file is subject to the Open Software License (OSL 3.0)
|
21 |
+
that is bundled with this package in the file LICENSE.txt.
|
22 |
+
It is also available through the world-wide-web at this URL:
|
23 |
+
http://opensource.org/licenses/osl-3.0.php
|
24 |
+
If you did not receive a copy of the license and are unable to
|
25 |
+
obtain it through the world-wide-web, please send an email
|
26 |
+
to license@magentocommerce.com so we can send you a copy immediately.
|
27 |
+
*
|
28 |
+
@category Cardconnect
|
29 |
+
@package Cardconnect_Ccgateway
|
30 |
+
@copyright Copyright (c) 2014 CardConnect (http://www.cardconnect.com)
|
31 |
+
@license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
32 |
+
*/
|
33 |
+
class Cardconnect_Ccgateway_LogController extends Mage_Core_Controller_Front_Action {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* To log front end error messages
|
37 |
+
*/
|
38 |
+
|
39 |
+
public function logfrontenderrorsAction()
|
40 |
+
{
|
41 |
+
$param = $this->getRequest()->getParams();
|
42 |
+
|
43 |
+
$myLogMessage = "JS Error : " . __FILE__ . " @ " . __LINE__ . " ERROR : " . $param["error_msg"];
|
44 |
+
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
45 |
+
}
|
46 |
+
}
|
app/code/community/Cardconnect/Ccgateway/controllers/PaymentController.php
CHANGED
@@ -1,367 +1,366 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* @brief Defines the redirect and response function
|
5 |
-
* @category Magento CardConnect Payment Module
|
6 |
-
* @author CardConnect
|
7 |
-
* @copyright Portions copyright 2014 CardConnect
|
8 |
-
* @copyright Portions copyright Magento 2014
|
9 |
-
* @license GPL v2, please see LICENSE.txt
|
10 |
-
* @access public
|
11 |
-
* @version $Id: $
|
12 |
-
*
|
13 |
-
* */
|
14 |
-
|
15 |
-
/**
|
16 |
-
Magento
|
17 |
-
*
|
18 |
-
NOTICE OF LICENSE
|
19 |
-
*
|
20 |
-
This source file is subject to the Open Software License (OSL 3.0)
|
21 |
-
that is bundled with this package in the file LICENSE.txt.
|
22 |
-
It is also available through the world-wide-web at this URL:
|
23 |
-
http://opensource.org/licenses/osl-3.0.php
|
24 |
-
If you did not receive a copy of the license and are unable to
|
25 |
-
obtain it through the world-wide-web, please send an email
|
26 |
-
to license@magentocommerce.com so we can send you a copy immediately.
|
27 |
-
*
|
28 |
-
@category Cardconnect
|
29 |
-
@package Cardconnect_Ccgateway
|
30 |
-
@copyright Copyright (c) 2014 CardConnect (http://www.cardconnect.com)
|
31 |
-
@license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
32 |
-
*/
|
33 |
-
class Cardconnect_Ccgateway_PaymentController extends Mage_Core_Controller_Front_Action {
|
34 |
-
|
35 |
-
protected $_order = NULL;
|
36 |
-
protected $_paymentInst = NULL;
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Get singleton of Checkout Session Model
|
40 |
-
*
|
41 |
-
* @return Mage_Checkout_Model_Session
|
42 |
-
*/
|
43 |
-
protected function _getCheckout() {
|
44 |
-
return Mage::getSingleton('checkout/session');
|
45 |
-
}
|
46 |
-
|
47 |
-
protected function _getPendingPaymentStatus() {
|
48 |
-
return Mage::helper('ccgateway')->getPendingPaymentStatus();
|
49 |
-
}
|
50 |
-
|
51 |
-
// The redirect action is triggered when someone places an order
|
52 |
-
public function redirectAction() {
|
53 |
-
try {
|
54 |
-
$session = $this->_getCheckout();
|
55 |
-
|
56 |
-
$order = Mage::getModel('sales/order');
|
57 |
-
$order->loadByIncrementId($session->getLastRealOrderId());
|
58 |
-
if (!$order->getId()) {
|
59 |
-
Mage::throwException('No order found for processing');
|
60 |
-
}
|
61 |
-
if ($order->getState() != Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
|
62 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, $this->_getPendingPaymentStatus(), Mage::helper('ccgateway')->__('Customer was redirected to ccgateway.'))->save();
|
63 |
-
}
|
64 |
-
|
65 |
-
if ($session->getQuoteId() && $session->getLastSuccessQuoteId()) {
|
66 |
-
$session->setccgatewayQuoteId($session->getQuoteId());
|
67 |
-
}
|
68 |
-
|
69 |
-
$checkoutType = Mage::getModel('ccgateway/standard')->getConfigData('checkout_type' , $order->getStoreId());
|
70 |
-
|
71 |
-
if ($checkoutType == "tokenized_post") {
|
72 |
-
$response = Mage::getModel('ccgateway/standard')->authService($order);
|
73 |
-
|
74 |
-
if ($response['resptext'] == "CardConnect_Error") {
|
75 |
-
$errorMsg = "We are unable to perform the requested action, please contact customer service.";
|
76 |
-
$session = $this->_getCheckout();
|
77 |
-
$session->addError(Mage::helper('ccgateway')->__($errorMsg));
|
78 |
-
$this->_redirect('checkout/cart');
|
79 |
-
} else if ($response['resptext'] == "CardConnect_Timeout_Error") {
|
80 |
-
$errorMsg = "We were unable to complete the requested operation at this time. Please try again later or contact customer service.";
|
81 |
-
$errorStat = "PPS62"; //PPS62 is for Timed Out error
|
82 |
-
$this->responseCancel($errorStat);
|
83 |
-
|
84 |
-
$session = $this->_getCheckout();
|
85 |
-
$session->addError(Mage::helper('ccgateway')->__($errorMsg));
|
86 |
-
$this->_redirect('checkout/cart');
|
87 |
-
} else {
|
88 |
-
$this->responseAction($response);
|
89 |
-
}
|
90 |
-
|
91 |
-
} else {
|
92 |
-
$this->loadLayout();
|
93 |
-
$this->renderLayout();
|
94 |
-
}
|
95 |
-
$session->unsQuoteId();
|
96 |
-
return;
|
97 |
-
} catch (Mage_Core_Exception $e) {
|
98 |
-
$this->_getCheckout()->addError($e->getMessage());
|
99 |
-
}
|
100 |
-
}
|
101 |
-
|
102 |
-
// The response action is triggered when your gateway sends back a response after processing the customer's payment
|
103 |
-
|
104 |
-
public function responseAction($response = "") {
|
105 |
-
|
106 |
-
$session = $this->_getCheckout();
|
107 |
-
$order = Mage::getModel('sales/order');
|
108 |
-
$order->loadByIncrementId($session->getLastRealOrderId());
|
109 |
-
$cc_action = Mage::getModel('ccgateway/standard')->getConfigData('checkout_trans' , $order->getStoreId());
|
110 |
-
$merchid = Mage::getModel('ccgateway/standard')->getConfigData('merchant' , $order->getStoreId());
|
111 |
-
|
112 |
-
if (!empty($response['token'])){
|
113 |
-
$ccToken = $response['token'];
|
114 |
-
} else {
|
115 |
-
$ccToken ="";
|
116 |
-
}
|
117 |
-
|
118 |
-
|
119 |
-
if ($this->getRequest()->isPost()) {
|
120 |
-
$post = $this->getRequest()->getPost();
|
121 |
-
|
122 |
-
$orderId = $post['orderId'];
|
123 |
-
$errorCode = $post['errorCode'];
|
124 |
-
$errorDesc = $post['errorDesc'];
|
125 |
-
$avsResp = $post['avsResp'];
|
126 |
-
$cvvResp = $post['cvvResp'];
|
127 |
-
$retref = $post['retref'];
|
128 |
-
|
129 |
-
|
130 |
-
/* Handling Hosted Payment Page API Response */
|
131 |
-
$data = array('CC_ACTION' => $cc_action, /* Checkout Transaction Type */
|
132 |
-
'CC_RETREF' => "$retref", /* Retrieval Reference Number */
|
133 |
-
'CC_AMT' => $post['amount'], /* Capture Amount */
|
134 |
-
'CC_AUTHCODE' => $post['authCode'], /* Authorization code */
|
135 |
-
'CC_ORDERID' => $post['orderId'], /* Order Id */
|
136 |
-
'CC_TOKEN' => $ccToken, /* Token @$post['token']; */
|
137 |
-
'CC_MERCHID' => $merchid, /* Merchant Id */
|
138 |
-
'CC_RESPCODE' => $post['errorCode'], /* Error Code */
|
139 |
-
'CC_RESPTEXT' => $post['errorDesc'], /* Error Description */
|
140 |
-
'CC_AVSRESP' => $post['avsResp'], /* AVS Result */
|
141 |
-
'CC_CVVRESP' => $post['cvvResp'], /* CVV Result */
|
142 |
-
'CC_CREATED' => now() /* Request's response time */
|
143 |
-
);
|
144 |
-
} else {
|
145 |
-
|
146 |
-
$orderId = $response['orderid'];
|
147 |
-
$errorCode = $response['respcode'];
|
148 |
-
$errorDesc = $response['resptext'];
|
149 |
-
$avsResp = @$response['avsresp'];
|
150 |
-
$cvvResp = @$response['cvvresp'];
|
151 |
-
$retref = $response['retref'];
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
/* Handling Tokenize Post API Response */
|
156 |
-
$data = array('CC_ACTION' => $cc_action, /* Checkout Transaction Type */
|
157 |
-
'CC_RETREF' => "$retref", /* Retrieval Reference Number */
|
158 |
-
'CC_AMT' => $response['amount'], /* Capture Amount */
|
159 |
-
'CC_AUTHCODE' => @$response['authcode'], /* Authorization code */
|
160 |
-
'CC_ORDERID' => $response['orderid'], /* Order Id */
|
161 |
-
'CC_TOKEN' => $ccToken, /* Token @$response['token']; */
|
162 |
-
'CC_MERCHID' => $merchid, /* Merchant Id */
|
163 |
-
'CC_RESPPROC' => $response['respproc'], /* Response Processor */
|
164 |
-
'CC_RESPCODE' => $response['respcode'], /* Error Code */
|
165 |
-
'CC_RESPTEXT' => $response['resptext'], /* Error Description */
|
166 |
-
'CC_RESPSTAT' => $response['respstat'], /* Response Status */
|
167 |
-
'CC_AVSRESP' => $avsResp, /* AVS Result */
|
168 |
-
'CC_CVVRESP' => $cvvResp, /* CVV Result */
|
169 |
-
'CC_CREATED' => now() /* Request's response time */
|
170 |
-
);
|
171 |
-
}
|
172 |
-
|
173 |
-
if ($errorCode == 00) {
|
174 |
-
$statCVV = true; // false = Failure, true = Success
|
175 |
-
$statAVS = true; // false = Failure, true = Success
|
176 |
-
$voidOnAvs = Mage::getModel('ccgateway/standard')->getConfigData('void_avs' , $order->getStoreId());
|
177 |
-
$voidOnCvv = Mage::getModel('ccgateway/standard')->getConfigData('void_cvv' , $order->getStoreId());
|
178 |
-
// Check config setting if void on cvv is yes
|
179 |
-
if ($voidOnCvv == 1) {
|
180 |
-
if ($cvvResp == "N") {
|
181 |
-
$statCVV = false;
|
182 |
-
$errorStat = "CVV";
|
183 |
-
} else {
|
184 |
-
$statCVV = true;
|
185 |
-
}
|
186 |
-
}
|
187 |
-
// Check config setting if void on Avs is yes
|
188 |
-
if ($voidOnAvs == 1) {
|
189 |
-
if ($avsResp == "N") {
|
190 |
-
$statAVS = false;
|
191 |
-
$errorStat = "AVS";
|
192 |
-
} else {
|
193 |
-
$statAVS = true;
|
194 |
-
}
|
195 |
-
}
|
196 |
-
|
197 |
-
|
198 |
-
if (($statAVS && $statCVV) == false) {
|
199 |
-
$this->saveResponseData2ccgateway($data);
|
200 |
-
$voidResponse = Mage::getModel('ccgateway/standard')->voidService($order);
|
201 |
-
if($voidResponse['respcode'] == '00' ){
|
202 |
-
$this->responseCancel($errorStat);
|
203 |
-
// Set custom order status
|
204 |
-
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', $errorDesc)->save();
|
205 |
-
}
|
206 |
-
} else {
|
207 |
-
$this->saveResponseData2ccgateway($data);
|
208 |
-
$this->responseSuccess($orderId);
|
209 |
-
// Set custom order status
|
210 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_processing', $errorDesc)->save();
|
211 |
-
}
|
212 |
-
} elseif ($errorCode == 02) {
|
213 |
-
$errorStat = $response['respproc'] . $response['respcode'];
|
214 |
-
$this->responseCancel($errorStat);
|
215 |
-
$this->saveResponseData2ccgateway($data);
|
216 |
-
// Set custom order status
|
217 |
-
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', $errorDesc)->save();
|
218 |
-
} else {
|
219 |
-
$errorStat = $response['respproc'] . $response['respcode'];
|
220 |
-
$this->responseCancel(@$errorStat);
|
221 |
-
$this->saveResponseData2ccgateway($data);
|
222 |
-
// Set custom order status
|
223 |
-
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', $errorDesc)->save();
|
224 |
-
}
|
225 |
-
}
|
226 |
-
|
227 |
-
// Save date to CardConnect responce table
|
228 |
-
protected function saveResponseData2ccgateway($data) {
|
229 |
-
|
230 |
-
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->getCollection()
|
231 |
-
->addFieldToFilter('CC_ORDERID', array('eq' => $data['CC_ORDERID']))
|
232 |
-
->addFieldToSelect('CC_ACTION');
|
233 |
-
|
234 |
-
if ($collection->count() == 0) {
|
235 |
-
$model = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->setData($data);
|
236 |
-
$model->save();
|
237 |
-
}
|
238 |
-
|
239 |
-
return $this;
|
240 |
-
}
|
241 |
-
|
242 |
-
// Payment was successful, so update the order's state, send order email and move to the success page
|
243 |
-
protected function responseSuccess($orderId) {
|
244 |
-
$order = Mage::getModel('sales/order');
|
245 |
-
$order->loadByIncrementId($orderId);
|
246 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'Gateway has authorized the payment.');
|
247 |
-
|
248 |
-
$order->sendNewOrderEmail();
|
249 |
-
$order->setEmailSent(true);
|
250 |
-
|
251 |
-
try {
|
252 |
-
|
253 |
-
$session = Mage::getSingleton('checkout/session');
|
254 |
-
$session->setQuoteId($session->getCcgatewayQuoteId());
|
255 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_processing', "Successfully order placed via CardConnect.");
|
256 |
-
$order->save();
|
257 |
-
Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
|
258 |
-
$this->_redirect('checkout/onepage/success', array('_secure'=>true));
|
259 |
-
return;
|
260 |
-
} catch (Mage_Core_Exception $e) {
|
261 |
-
$this->_getCheckout()->addError($e->getMessage());
|
262 |
-
$this->_redirect('checkout/cart'); // Redirect on cart page if there is error.
|
263 |
-
} catch (Exception $e) {
|
264 |
-
$this->_debug('Ccgateway error: ' . $e->getMessage());
|
265 |
-
Mage::logException($e);
|
266 |
-
}
|
267 |
-
|
268 |
-
}
|
269 |
-
|
270 |
-
|
271 |
-
// Function for cancel the order
|
272 |
-
protected function responseCancel($errorStat) {
|
273 |
-
$session = $this->_getCheckout();
|
274 |
-
$order = Mage::getModel('sales/order');
|
275 |
-
$order->loadByIncrementId($session->getLastRealOrderId());
|
276 |
-
|
277 |
-
Mage::helper('ccgateway')->cancelCcOrder($order);
|
278 |
-
if ($quoteId = $session->getCcgatewayQuoteId()) {
|
279 |
-
$quote = Mage::getModel('sales/quote')->load($quoteId);
|
280 |
-
if ($quote->getId()) {
|
281 |
-
$quote->setIsActive(true)->save();
|
282 |
-
$session->setQuoteId($quoteId);
|
283 |
-
}
|
284 |
-
}
|
285 |
-
|
286 |
-
$errorMsg = "";
|
287 |
-
if ($errorStat == "CVV") {
|
288 |
-
$session->addError(Mage::helper('ccgateway')->__('Error - Invalid cvv , Please check cvv information,which is entered on payment page.'));
|
289 |
-
$errorMsg = "CVV does not match.";
|
290 |
-
Mage::log("Auto voided the transaction Due to CVV NO MATCH");
|
291 |
-
} elseif ($errorStat == "AVS") {
|
292 |
-
$session->addError(Mage::helper('ccgateway')->__('Error - Please check billing information , try again.'));
|
293 |
-
$errorMsg = "AVS does not match.";
|
294 |
-
Mage::log("Auto voided the transaction Due to AVS NO MATCH");
|
295 |
-
} elseif ($errorStat == "PPS62") {
|
296 |
-
$errorMsg = "Timeout error response from CardConnect.";
|
297 |
-
Mage::log("Error - Order process is timed out , try again.");
|
298 |
-
} else {
|
299 |
-
$errorMsg = Mage::helper('ccgateway')->matchResponseError($errorStat);
|
300 |
-
Mage:: log($errorStat . " :- " . $errorMsg);
|
301 |
-
$session->addError(Mage::helper('ccgateway')->__($errorMsg));
|
302 |
-
}
|
303 |
-
|
304 |
-
// Set custom order status
|
305 |
-
if ($errorStat == "PPS62") {
|
306 |
-
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_timeout', $errorMsg)->save();
|
307 |
-
} else {
|
308 |
-
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', $errorMsg)->save();
|
309 |
-
}
|
310 |
-
|
311 |
-
$this->_redirect('checkout/cart');
|
312 |
-
}
|
313 |
-
|
314 |
-
// Function for call Inquire services
|
315 |
-
public function inquireAction() {
|
316 |
-
|
317 |
-
$orderid = $this->getRequest()->getParam('orderId');
|
318 |
-
$model = Mage::getModel('ccgateway/standard');
|
319 |
-
$data = $model->inquireService($orderid);
|
320 |
-
echo $data;
|
321 |
-
|
322 |
-
return $data;
|
323 |
-
}
|
324 |
-
|
325 |
-
// Function for call Get Profile Webservices Checkout Page
|
326 |
-
public function getProfileDataAction() {
|
327 |
-
$profileId = $this->getRequest()->getParam('profile');
|
328 |
-
|
329 |
-
$response = Mage::getModel('ccgateway/standard')->getProfileWebServiceCheckout($profileId);
|
330 |
-
|
331 |
-
$json = json_encode($response);
|
332 |
-
|
333 |
-
$this->getResponse()
|
334 |
-
->clearHeaders()
|
335 |
-
->setHeader('Content-Type', 'application/json')
|
336 |
-
->setBody($json);
|
337 |
-
}
|
338 |
-
|
339 |
-
// Function for call Get Profile Webservices Edit Card Data
|
340 |
-
public function getProfileDataEditAction() {
|
341 |
-
$profileId = $this->getRequest()->getParam('profile');
|
342 |
-
$cc_id = $this->getRequest()->getParam('cc_id');
|
343 |
-
$response = Mage::getModel('ccgateway/standard')->getProfileWebService($profileId, $cc_id);
|
344 |
-
|
345 |
-
$json = json_encode($response);
|
346 |
-
|
347 |
-
$this->getResponse()
|
348 |
-
->clearHeaders()
|
349 |
-
->setHeader('Content-Type', 'application/json')
|
350 |
-
->setBody($json);
|
351 |
-
}
|
352 |
-
|
353 |
-
/**
|
354 |
-
* To delete wallet profile
|
355 |
-
*/
|
356 |
-
public function deletewalletAction() {
|
357 |
-
|
358 |
-
$walletid = $this->getRequest()->getParam('cc_id');
|
359 |
-
$customerId = $this->getRequest()->getParam('customerId');
|
360 |
-
|
361 |
-
$response = Mage::getModel('ccgateway/standard')->deleteWalletDataService($walletid, $customerId);
|
362 |
-
|
363 |
-
echo $response;
|
364 |
-
exit;
|
365 |
-
}
|
366 |
-
|
367 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @brief Defines the redirect and response function
|
5 |
+
* @category Magento CardConnect Payment Module
|
6 |
+
* @author CardConnect
|
7 |
+
* @copyright Portions copyright 2014 CardConnect
|
8 |
+
* @copyright Portions copyright Magento 2014
|
9 |
+
* @license GPL v2, please see LICENSE.txt
|
10 |
+
* @access public
|
11 |
+
* @version $Id: $
|
12 |
+
*
|
13 |
+
* */
|
14 |
+
|
15 |
+
/**
|
16 |
+
Magento
|
17 |
+
*
|
18 |
+
NOTICE OF LICENSE
|
19 |
+
*
|
20 |
+
This source file is subject to the Open Software License (OSL 3.0)
|
21 |
+
that is bundled with this package in the file LICENSE.txt.
|
22 |
+
It is also available through the world-wide-web at this URL:
|
23 |
+
http://opensource.org/licenses/osl-3.0.php
|
24 |
+
If you did not receive a copy of the license and are unable to
|
25 |
+
obtain it through the world-wide-web, please send an email
|
26 |
+
to license@magentocommerce.com so we can send you a copy immediately.
|
27 |
+
*
|
28 |
+
@category Cardconnect
|
29 |
+
@package Cardconnect_Ccgateway
|
30 |
+
@copyright Copyright (c) 2014 CardConnect (http://www.cardconnect.com)
|
31 |
+
@license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
32 |
+
*/
|
33 |
+
class Cardconnect_Ccgateway_PaymentController extends Mage_Core_Controller_Front_Action {
|
34 |
+
|
35 |
+
protected $_order = NULL;
|
36 |
+
protected $_paymentInst = NULL;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get singleton of Checkout Session Model
|
40 |
+
*
|
41 |
+
* @return Mage_Checkout_Model_Session
|
42 |
+
*/
|
43 |
+
protected function _getCheckout() {
|
44 |
+
return Mage::getSingleton('checkout/session');
|
45 |
+
}
|
46 |
+
|
47 |
+
protected function _getPendingPaymentStatus() {
|
48 |
+
return Mage::helper('ccgateway')->getPendingPaymentStatus();
|
49 |
+
}
|
50 |
+
|
51 |
+
// The redirect action is triggered when someone places an order
|
52 |
+
public function redirectAction() {
|
53 |
+
try {
|
54 |
+
$session = $this->_getCheckout();
|
55 |
+
|
56 |
+
$order = Mage::getModel('sales/order');
|
57 |
+
$order->loadByIncrementId($session->getLastRealOrderId());
|
58 |
+
if (!$order->getId()) {
|
59 |
+
Mage::throwException('No order found for processing');
|
60 |
+
}
|
61 |
+
if ($order->getState() != Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
|
62 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, $this->_getPendingPaymentStatus(), Mage::helper('ccgateway')->__('Customer was redirected to ccgateway.'))->save();
|
63 |
+
}
|
64 |
+
|
65 |
+
if ($session->getQuoteId() && $session->getLastSuccessQuoteId()) {
|
66 |
+
$session->setccgatewayQuoteId($session->getQuoteId());
|
67 |
+
}
|
68 |
+
|
69 |
+
$checkoutType = Mage::getModel('ccgateway/standard')->getConfigData('checkout_type' , $order->getStoreId());
|
70 |
+
|
71 |
+
if ($checkoutType == "tokenized_post") {
|
72 |
+
$response = Mage::getModel('ccgateway/standard')->authService($order);
|
73 |
+
|
74 |
+
if ($response['resptext'] == "CardConnect_Error") {
|
75 |
+
$errorMsg = "We are unable to perform the requested action, please contact customer service.";
|
76 |
+
$session = $this->_getCheckout();
|
77 |
+
$session->addError(Mage::helper('ccgateway')->__($errorMsg));
|
78 |
+
$this->_redirect('checkout/cart');
|
79 |
+
} else if ($response['resptext'] == "CardConnect_Timeout_Error") {
|
80 |
+
$errorMsg = "We were unable to complete the requested operation at this time. Please try again later or contact customer service.";
|
81 |
+
$errorStat = "PPS62"; //PPS62 is for Timed Out error
|
82 |
+
$this->responseCancel($errorStat);
|
83 |
+
|
84 |
+
$session = $this->_getCheckout();
|
85 |
+
$session->addError(Mage::helper('ccgateway')->__($errorMsg));
|
86 |
+
$this->_redirect('checkout/cart');
|
87 |
+
} else {
|
88 |
+
$this->responseAction($response);
|
89 |
+
}
|
90 |
+
|
91 |
+
} else {
|
92 |
+
$this->loadLayout();
|
93 |
+
$this->renderLayout();
|
94 |
+
}
|
95 |
+
$session->unsQuoteId();
|
96 |
+
return;
|
97 |
+
} catch (Mage_Core_Exception $e) {
|
98 |
+
$this->_getCheckout()->addError($e->getMessage());
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
// The response action is triggered when your gateway sends back a response after processing the customer's payment
|
103 |
+
|
104 |
+
public function responseAction($response = "") {
|
105 |
+
|
106 |
+
$session = $this->_getCheckout();
|
107 |
+
$order = Mage::getModel('sales/order');
|
108 |
+
$order->loadByIncrementId($session->getLastRealOrderId());
|
109 |
+
$cc_action = Mage::getModel('ccgateway/standard')->getConfigData('checkout_trans' , $order->getStoreId());
|
110 |
+
$merchid = Mage::getModel('ccgateway/standard')->getConfigData('merchant' , $order->getStoreId());
|
111 |
+
|
112 |
+
if (!empty($response['token'])){
|
113 |
+
$ccToken = $response['token'];
|
114 |
+
} else {
|
115 |
+
$ccToken ="";
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
if ($this->getRequest()->isPost()) {
|
120 |
+
$post = $this->getRequest()->getPost();
|
121 |
+
|
122 |
+
$orderId = $post['orderId'];
|
123 |
+
$errorCode = $post['errorCode'];
|
124 |
+
$errorDesc = $post['errorDesc'];
|
125 |
+
$avsResp = $post['avsResp'];
|
126 |
+
$cvvResp = $post['cvvResp'];
|
127 |
+
$retref = $post['retref'];
|
128 |
+
|
129 |
+
|
130 |
+
/* Handling Hosted Payment Page API Response */
|
131 |
+
$data = array('CC_ACTION' => $cc_action, /* Checkout Transaction Type */
|
132 |
+
'CC_RETREF' => "$retref", /* Retrieval Reference Number */
|
133 |
+
'CC_AMT' => $post['amount'], /* Capture Amount */
|
134 |
+
'CC_AUTHCODE' => $post['authCode'], /* Authorization code */
|
135 |
+
'CC_ORDERID' => $post['orderId'], /* Order Id */
|
136 |
+
'CC_TOKEN' => $ccToken, /* Token @$post['token']; */
|
137 |
+
'CC_MERCHID' => $merchid, /* Merchant Id */
|
138 |
+
'CC_RESPCODE' => $post['errorCode'], /* Error Code */
|
139 |
+
'CC_RESPTEXT' => $post['errorDesc'], /* Error Description */
|
140 |
+
'CC_AVSRESP' => $post['avsResp'], /* AVS Result */
|
141 |
+
'CC_CVVRESP' => $post['cvvResp'], /* CVV Result */
|
142 |
+
'CC_CREATED' => now() /* Request's response time */
|
143 |
+
);
|
144 |
+
} else {
|
145 |
+
|
146 |
+
$orderId = $response['orderid'];
|
147 |
+
$errorCode = $response['respcode'];
|
148 |
+
$errorDesc = $response['resptext'];
|
149 |
+
$avsResp = @$response['avsresp'];
|
150 |
+
$cvvResp = @$response['cvvresp'];
|
151 |
+
$retref = $response['retref'];
|
152 |
+
|
153 |
+
|
154 |
+
|
155 |
+
/* Handling Tokenize Post API Response */
|
156 |
+
$data = array('CC_ACTION' => $cc_action, /* Checkout Transaction Type */
|
157 |
+
'CC_RETREF' => "$retref", /* Retrieval Reference Number */
|
158 |
+
'CC_AMT' => $response['amount'], /* Capture Amount */
|
159 |
+
'CC_AUTHCODE' => @$response['authcode'], /* Authorization code */
|
160 |
+
'CC_ORDERID' => $response['orderid'], /* Order Id */
|
161 |
+
'CC_TOKEN' => $ccToken, /* Token @$response['token']; */
|
162 |
+
'CC_MERCHID' => $merchid, /* Merchant Id */
|
163 |
+
'CC_RESPPROC' => $response['respproc'], /* Response Processor */
|
164 |
+
'CC_RESPCODE' => $response['respcode'], /* Error Code */
|
165 |
+
'CC_RESPTEXT' => $response['resptext'], /* Error Description */
|
166 |
+
'CC_RESPSTAT' => $response['respstat'], /* Response Status */
|
167 |
+
'CC_AVSRESP' => $avsResp, /* AVS Result */
|
168 |
+
'CC_CVVRESP' => $cvvResp, /* CVV Result */
|
169 |
+
'CC_CREATED' => now() /* Request's response time */
|
170 |
+
);
|
171 |
+
}
|
172 |
+
|
173 |
+
if ($errorCode == 00) {
|
174 |
+
$statCVV = true; // false = Failure, true = Success
|
175 |
+
$statAVS = true; // false = Failure, true = Success
|
176 |
+
$voidOnAvs = Mage::getModel('ccgateway/standard')->getConfigData('void_avs' , $order->getStoreId());
|
177 |
+
$voidOnCvv = Mage::getModel('ccgateway/standard')->getConfigData('void_cvv' , $order->getStoreId());
|
178 |
+
// Check config setting if void on cvv is yes
|
179 |
+
if ($voidOnCvv == 1) {
|
180 |
+
if ($cvvResp == "N") {
|
181 |
+
$statCVV = false;
|
182 |
+
$errorStat = "CVV";
|
183 |
+
} else {
|
184 |
+
$statCVV = true;
|
185 |
+
}
|
186 |
+
}
|
187 |
+
// Check config setting if void on Avs is yes
|
188 |
+
if ($voidOnAvs == 1) {
|
189 |
+
if ($avsResp == "N") {
|
190 |
+
$statAVS = false;
|
191 |
+
$errorStat = "AVS";
|
192 |
+
} else {
|
193 |
+
$statAVS = true;
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
|
198 |
+
if (($statAVS && $statCVV) == false) {
|
199 |
+
$this->saveResponseData2ccgateway($data);
|
200 |
+
$voidResponse = Mage::getModel('ccgateway/standard')->voidService($order);
|
201 |
+
if($voidResponse['respcode'] == '00' ){
|
202 |
+
$this->responseCancel($errorStat);
|
203 |
+
// Set custom order status
|
204 |
+
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', $errorDesc)->save();
|
205 |
+
}
|
206 |
+
} else {
|
207 |
+
$this->saveResponseData2ccgateway($data);
|
208 |
+
$this->responseSuccess($orderId);
|
209 |
+
// Set custom order status
|
210 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_processing', $errorDesc)->save();
|
211 |
+
}
|
212 |
+
} elseif ($errorCode == 02) {
|
213 |
+
$errorStat = $response['respproc'] . $response['respcode'];
|
214 |
+
$this->responseCancel($errorStat);
|
215 |
+
$this->saveResponseData2ccgateway($data);
|
216 |
+
// Set custom order status
|
217 |
+
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', $errorDesc)->save();
|
218 |
+
} else {
|
219 |
+
$errorStat = $response['respproc'] . $response['respcode'];
|
220 |
+
$this->responseCancel(@$errorStat);
|
221 |
+
$this->saveResponseData2ccgateway($data);
|
222 |
+
// Set custom order status
|
223 |
+
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', $errorDesc)->save();
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
// Save date to CardConnect responce table
|
228 |
+
protected function saveResponseData2ccgateway($data) {
|
229 |
+
|
230 |
+
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->getCollection()
|
231 |
+
->addFieldToFilter('CC_ORDERID', array('eq' => $data['CC_ORDERID']))
|
232 |
+
->addFieldToSelect('CC_ACTION');
|
233 |
+
|
234 |
+
if ($collection->count() == 0) {
|
235 |
+
$model = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->setData($data);
|
236 |
+
$model->save();
|
237 |
+
}
|
238 |
+
|
239 |
+
return $this;
|
240 |
+
}
|
241 |
+
|
242 |
+
// Payment was successful, so update the order's state, send order email and move to the success page
|
243 |
+
protected function responseSuccess($orderId) {
|
244 |
+
$order = Mage::getModel('sales/order');
|
245 |
+
$order->loadByIncrementId($orderId);
|
246 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'Gateway has authorized the payment.');
|
247 |
+
|
248 |
+
$order->sendNewOrderEmail();
|
249 |
+
$order->setEmailSent(true);
|
250 |
+
|
251 |
+
try {
|
252 |
+
|
253 |
+
$session = Mage::getSingleton('checkout/session');
|
254 |
+
$session->setQuoteId($session->getCcgatewayQuoteId());
|
255 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_processing', "Successfully order placed via CardConnect.");
|
256 |
+
$order->save();
|
257 |
+
Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
|
258 |
+
$this->_redirect('checkout/onepage/success', array('_secure'=>true));
|
259 |
+
return;
|
260 |
+
} catch (Mage_Core_Exception $e) {
|
261 |
+
$this->_getCheckout()->addError($e->getMessage());
|
262 |
+
$this->_redirect('checkout/cart'); // Redirect on cart page if there is error.
|
263 |
+
} catch (Exception $e) {
|
264 |
+
$this->_debug('Ccgateway error: ' . $e->getMessage());
|
265 |
+
Mage::logException($e);
|
266 |
+
}
|
267 |
+
|
268 |
+
}
|
269 |
+
|
270 |
+
|
271 |
+
// Function for cancel the order
|
272 |
+
protected function responseCancel($errorStat) {
|
273 |
+
$session = $this->_getCheckout();
|
274 |
+
$order = Mage::getModel('sales/order');
|
275 |
+
$order->loadByIncrementId($session->getLastRealOrderId());
|
276 |
+
|
277 |
+
Mage::helper('ccgateway')->cancelCcOrder($order);
|
278 |
+
if ($quoteId = $session->getCcgatewayQuoteId()) {
|
279 |
+
$quote = Mage::getModel('sales/quote')->load($quoteId);
|
280 |
+
if ($quote->getId()) {
|
281 |
+
$quote->setIsActive(true)->save();
|
282 |
+
$session->setQuoteId($quoteId);
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
$errorMsg = "";
|
287 |
+
if ($errorStat == "CVV") {
|
288 |
+
$session->addError(Mage::helper('ccgateway')->__('Error - Invalid cvv , Please check cvv information,which is entered on payment page.'));
|
289 |
+
$errorMsg = "CVV does not match.";
|
290 |
+
Mage::log("Auto voided the transaction Due to CVV NO MATCH");
|
291 |
+
} elseif ($errorStat == "AVS") {
|
292 |
+
$session->addError(Mage::helper('ccgateway')->__('Error - Please check billing information , try again.'));
|
293 |
+
$errorMsg = "AVS does not match.";
|
294 |
+
Mage::log("Auto voided the transaction Due to AVS NO MATCH");
|
295 |
+
} elseif ($errorStat == "PPS62") {
|
296 |
+
$errorMsg = "Timeout error response from CardConnect.";
|
297 |
+
Mage::log("Error - Order process is timed out , try again.");
|
298 |
+
} else {
|
299 |
+
$errorMsg = Mage::helper('ccgateway')->matchResponseError($errorStat);
|
300 |
+
Mage:: log($errorStat . " :- " . $errorMsg);
|
301 |
+
$session->addError(Mage::helper('ccgateway')->__($errorMsg));
|
302 |
+
}
|
303 |
+
|
304 |
+
// Set custom order status
|
305 |
+
if ($errorStat == "PPS62") {
|
306 |
+
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_timeout', $errorMsg)->save();
|
307 |
+
} else {
|
308 |
+
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', $errorMsg)->save();
|
309 |
+
}
|
310 |
+
|
311 |
+
$this->_redirect('checkout/cart');
|
312 |
+
}
|
313 |
+
|
314 |
+
// Function for call Inquire services
|
315 |
+
public function inquireAction() {
|
316 |
+
|
317 |
+
$orderid = $this->getRequest()->getParam('orderId');
|
318 |
+
$model = Mage::getModel('ccgateway/standard');
|
319 |
+
$data = $model->inquireService($orderid);
|
320 |
+
echo $data;
|
321 |
+
|
322 |
+
return $data;
|
323 |
+
}
|
324 |
+
|
325 |
+
// Function for call Get Profile Webservices Checkout Page
|
326 |
+
public function getProfileDataAction() {
|
327 |
+
$profileId = $this->getRequest()->getParam('profile');
|
328 |
+
|
329 |
+
$response = Mage::getModel('ccgateway/standard')->getProfileWebServiceCheckout($profileId);
|
330 |
+
|
331 |
+
$json = json_encode($response);
|
332 |
+
|
333 |
+
$this->getResponse()
|
334 |
+
->clearHeaders()
|
335 |
+
->setHeader('Content-Type', 'application/json')
|
336 |
+
->setBody($json);
|
337 |
+
}
|
338 |
+
|
339 |
+
// Function for call Get Profile Webservices Edit Card Data
|
340 |
+
public function getProfileDataEditAction() {
|
341 |
+
$profileId = $this->getRequest()->getParam('profile');
|
342 |
+
$cc_id = $this->getRequest()->getParam('cc_id');
|
343 |
+
$response = Mage::getModel('ccgateway/standard')->getProfileWebService($profileId, $cc_id);
|
344 |
+
|
345 |
+
$json = json_encode($response);
|
346 |
+
|
347 |
+
$this->getResponse()
|
348 |
+
->clearHeaders()
|
349 |
+
->setHeader('Content-Type', 'application/json')
|
350 |
+
->setBody($json);
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* To delete wallet profile
|
355 |
+
*/
|
356 |
+
public function deletewalletAction() {
|
357 |
+
|
358 |
+
$walletid = $this->getRequest()->getParam('cc_id');
|
359 |
+
$customerId = $this->getRequest()->getParam('customerId');
|
360 |
+
|
361 |
+
$response = Mage::getModel('ccgateway/standard')->deleteWalletDataService($walletid, $customerId);
|
362 |
+
|
363 |
+
echo $response;
|
364 |
+
exit;
|
365 |
+
}
|
366 |
+
}
|
|
app/code/community/Cardconnect/Ccgateway/etc/config.xml
CHANGED
@@ -35,7 +35,7 @@ to license@magentocommerce.com so we can send you a copy immediately.
|
|
35 |
<config>
|
36 |
<modules>
|
37 |
<Cardconnect_Ccgateway>
|
38 |
-
<version>1.0.8.
|
39 |
</Cardconnect_Ccgateway>
|
40 |
</modules>
|
41 |
<global>
|
35 |
<config>
|
36 |
<modules>
|
37 |
<Cardconnect_Ccgateway>
|
38 |
+
<version>1.0.8.5</version>
|
39 |
</Cardconnect_Ccgateway>
|
40 |
</modules>
|
41 |
<global>
|
app/design/adminhtml/default/default/template/ccgateway/form.phtml
CHANGED
@@ -37,6 +37,7 @@
|
|
37 |
<?php $_code = $this->getMethodCode();
|
38 |
$isTestMode = $this->isTransactionModeTest();
|
39 |
$siteName = Mage::helper('ccgateway')->getSiteName();
|
|
|
40 |
?>
|
41 |
<ul id="payment_form_<?php echo $_code ?>" style="display:none">
|
42 |
<?php if ($this->getCheckoutType() == "payment_page") { ?>
|
@@ -69,12 +70,12 @@
|
|
69 |
<li>
|
70 |
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
71 |
<div class="input-box">
|
72 |
-
<input type="text" onchange="valid_credit_card(value, '<?php echo $isTestMode; ?>', '<?php echo $siteName; ?>')" onkeypress="javascript:return validate(event , 'ccgateway_cc_number_org'); blockNonNumbers(this, event, false, false)" id="ccgateway_cc_number_org" name="payment[cc_number_org]" title="<?php echo $this->__('Credit Card Number') ?>" maxlength="16" class="input-text required-entry" value="<?php if($this->getInfoData('cc_number')){ echo substr_replace($this->getInfoData('cc_number'), str_repeat('*', 12), 0, 12); } ?>" />
|
73 |
<input type="hidden" id="<?php // echo $_code ?>ccgateway_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text" value="<?php echo $this->getInfoData('cc_number')?>" />
|
74 |
<div class="validation-advice" id="testError" style="display: none;"></div>
|
75 |
</div>
|
76 |
|
77 |
-
|
78 |
<li><div id="response"></div></li>
|
79 |
<div id="fade" style="display:none;">
|
80 |
<div id="loading_box" class="loader"></div>
|
37 |
<?php $_code = $this->getMethodCode();
|
38 |
$isTestMode = $this->isTransactionModeTest();
|
39 |
$siteName = Mage::helper('ccgateway')->getSiteName();
|
40 |
+
$errorLogURL = Mage::getUrl('ccgateway/log/logfrontenderrors',array('_secure'=>true));
|
41 |
?>
|
42 |
<ul id="payment_form_<?php echo $_code ?>" style="display:none">
|
43 |
<?php if ($this->getCheckoutType() == "payment_page") { ?>
|
70 |
<li>
|
71 |
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
72 |
<div class="input-box">
|
73 |
+
<input type="text" onchange="valid_credit_card(value, '<?php echo $isTestMode; ?>', '<?php echo $siteName; ?>', '<?php echo $errorLogURL; ?>')" onkeypress="javascript:return validate(event , 'ccgateway_cc_number_org'); blockNonNumbers(this, event, false, false)" id="ccgateway_cc_number_org" name="payment[cc_number_org]" title="<?php echo $this->__('Credit Card Number') ?>" maxlength="16" class="input-text required-entry" value="<?php if($this->getInfoData('cc_number')){ echo substr_replace($this->getInfoData('cc_number'), str_repeat('*', 12), 0, 12); } ?>" />
|
74 |
<input type="hidden" id="<?php // echo $_code ?>ccgateway_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text" value="<?php echo $this->getInfoData('cc_number')?>" />
|
75 |
<div class="validation-advice" id="testError" style="display: none;"></div>
|
76 |
</div>
|
77 |
|
78 |
+
</li>
|
79 |
<li><div id="response"></div></li>
|
80 |
<div id="fade" style="display:none;">
|
81 |
<div id="loading_box" class="loader"></div>
|
app/design/frontend/base/default/template/ccgateway/cardmanagement/editcard.phtml
CHANGED
@@ -99,9 +99,10 @@
|
|
99 |
<div id="fade" style="display:none;">
|
100 |
<div id="loading_box" class="loader"></div>
|
101 |
</div>
|
|
|
102 |
|
103 |
<fieldset class="form-list">
|
104 |
-
<form id="editcard" name="editcard" method="post" action="<?php echo Mage::getUrl('ccgateway/cardmanagement/updateprofile',array('_secure'=>true)); ?>" onload="callGetProfileWebserviceController(<?php echo $this->getUrl('ccgateway/payment/getprofiledata'); ?>
|
105 |
<?php
|
106 |
$_code = $this->getMethodCode();
|
107 |
$isTestMode = $this->isTransactionModeTest();
|
@@ -142,7 +143,7 @@
|
|
142 |
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
143 |
<div class="input-box">
|
144 |
|
145 |
-
<input type="text" onchange="valid_credit_card(value, '<?php echo $isTestMode; ?>', '<?php echo $siteName; ?>')" onkeypress="javascript:return validate(event, 'ccgateway_cc_number_org');
|
146 |
blockNonNumbers(this, event, false, false)" id="ccgateway_cc_number_org" name="editcard[cc_number_org]" title="<?php echo $this->__('Credit Card Number') ?>" maxlength="16" class="input-text required-entry" value="" required />
|
147 |
<input type="hidden" id="ccgateway_cc_number" name="editcard[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text" value="" required />
|
148 |
<input type="hidden" id="ccgateway_cc_profile" name="editcard[profile]" title="<?php echo $this->__('Customer Profile') ?>" class="input-text" value="" required />
|
99 |
<div id="fade" style="display:none;">
|
100 |
<div id="loading_box" class="loader"></div>
|
101 |
</div>
|
102 |
+
<?php $errorLogURL = Mage::getUrl('ccgateway/log/logfrontenderrors',array('_secure'=>true)); ?>
|
103 |
|
104 |
<fieldset class="form-list">
|
105 |
+
<form id="editcard" name="editcard" method="post" action="<?php echo Mage::getUrl('ccgateway/cardmanagement/updateprofile',array('_secure'=>true)); ?>" onload="callGetProfileWebserviceController(<?php echo $this->getUrl('ccgateway/payment/getprofiledata'); ?>,profile, , '<?php echo $errorLogURL; ?>');">
|
106 |
<?php
|
107 |
$_code = $this->getMethodCode();
|
108 |
$isTestMode = $this->isTransactionModeTest();
|
143 |
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
144 |
<div class="input-box">
|
145 |
|
146 |
+
<input type="text" onchange="valid_credit_card(value, '<?php echo $isTestMode; ?>', '<?php echo $siteName; ?>', '<?php echo $errorLogURL; ?>')" onkeypress="javascript:return validate(event, 'ccgateway_cc_number_org');
|
147 |
blockNonNumbers(this, event, false, false)" id="ccgateway_cc_number_org" name="editcard[cc_number_org]" title="<?php echo $this->__('Credit Card Number') ?>" maxlength="16" class="input-text required-entry" value="" required />
|
148 |
<input type="hidden" id="ccgateway_cc_number" name="editcard[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text" value="" required />
|
149 |
<input type="hidden" id="ccgateway_cc_profile" name="editcard[profile]" title="<?php echo $this->__('Customer Profile') ?>" class="input-text" value="" required />
|
app/design/frontend/base/default/template/ccgateway/cardmanagement/new.phtml
CHANGED
@@ -54,6 +54,7 @@ if(Mage::getSingleton('customer/session')->isLoggedIn()) {
|
|
54 |
$billingPostCode = $billingAddress->getData('postcode');
|
55 |
$billingTelephone = $billingAddress->getData('telephone');
|
56 |
}
|
|
|
57 |
}
|
58 |
|
59 |
|
@@ -101,7 +102,8 @@ if(Mage::getSingleton('customer/session')->isLoggedIn()) {
|
|
101 |
<li>
|
102 |
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
103 |
<div class="input-box">
|
104 |
-
|
|
|
105 |
blockNonNumbers(this, event, false, false)" id="ccgateway_cc_number_org" name="addcard[cc_number_org]" title="<?php echo $this->__('Credit Card Number') ?>" maxlength="16" class="input-text required-entry" value="" required />
|
106 |
<input type="hidden" id="ccgateway_cc_number" name="addcard[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text" value="" required />
|
107 |
<div class="validation-advice" id="testError" style="display: none;"></div>
|
54 |
$billingPostCode = $billingAddress->getData('postcode');
|
55 |
$billingTelephone = $billingAddress->getData('telephone');
|
56 |
}
|
57 |
+
$errorLogURL = Mage::getUrl('ccgateway/log/logfrontenderrors',array('_secure'=>true));
|
58 |
}
|
59 |
|
60 |
|
102 |
<li>
|
103 |
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
104 |
<div class="input-box">
|
105 |
+
|
106 |
+
<input type="text" onblur="valid_credit_card(value, '<?php echo $isTestMode; ?>', '<?php echo $siteName; ?>', '<?php echo $errorLogURL; ?>')" onkeypress="javascript:return validate(event, 'ccgateway_cc_number_org');
|
107 |
blockNonNumbers(this, event, false, false)" id="ccgateway_cc_number_org" name="addcard[cc_number_org]" title="<?php echo $this->__('Credit Card Number') ?>" maxlength="16" class="input-text required-entry" value="" required />
|
108 |
<input type="hidden" id="ccgateway_cc_number" name="addcard[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text" value="" required />
|
109 |
<div class="validation-advice" id="testError" style="display: none;"></div>
|
app/design/frontend/base/default/template/ccgateway/form.phtml
CHANGED
@@ -61,6 +61,7 @@ if(Mage::getModel('ccgateway/standard')->getConfigData('active')==1){
|
|
61 |
$billingCountry = $billingAddress->getCountryId();
|
62 |
$billingPostCode = $billingAddress->getPostcode();
|
63 |
$billingTelephone = $billingAddress->getTelephone();
|
|
|
64 |
?>
|
65 |
|
66 |
<ul id="payment_form_<?php echo $_code ?>" style="display:none">
|
@@ -88,7 +89,7 @@ if(Mage::getModel('ccgateway/standard')->getConfigData('active')==1){
|
|
88 |
<li class="wide">
|
89 |
<label for="<?php echo $_code ?>_cc_profile_name" class="required"><em>*</em><?php echo $this->__('Choose Your Card For Payment') ?></label>
|
90 |
<div class="input-box">
|
91 |
-
<select id="payment[profile_name]" name="payment[profile_name]" onchange="javascript:return callGetProfileWebserviceController(<?php echo '\'' . $requestUrl . '\''; ?>, this.value);" title="<?php echo $this->__('Select Your Card') ?>" class="required-entry validate-select">
|
92 |
<option value=""><?php echo $this->__('--Please Select--') ?></option>
|
93 |
<?php foreach ($this->getCCProfileName() as $data): ?>
|
94 |
<option value="<?php echo $data->getData('CC_PROFILEID'); ?>"
|
@@ -123,6 +124,7 @@ if(Mage::getModel('ccgateway/standard')->getConfigData('active')==1){
|
|
123 |
<label for="<?php echo $_code ?>_cc_type" class="required validate-cc-type "><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
|
124 |
<div class="input-box" >
|
125 |
|
|
|
126 |
<select readonly id="ccgateway_cc_type" name="payment[cc_type]" title="<?php echo $this->__('Credit Card Type') ?>" class="required-entry validate-select" onchange="resetcardinfo();">
|
127 |
<option value=""><?php echo $this->__('--Please Select--') ?></option>
|
128 |
<?php $accttype = (isset($response[0]['accttype'])) ? $response[0]['accttype'] : null;
|
@@ -140,10 +142,10 @@ if(Mage::getModel('ccgateway/standard')->getConfigData('active')==1){
|
|
140 |
<?php if ($this->hasCCProfile() == true) { ?>
|
141 |
<label id="cc_number_label" for="<?php echo $_code ?>_cc_number" class="input-text required-entry"><?php echo $maskedToken; ?></label>
|
142 |
|
143 |
-
<input type="text" hidden onchange="valid_credit_card(value , '<?php echo $isTestMode; ?>', '<?php echo $siteName; ?>')" onkeypress="javascript:return validate(event, 'ccgateway_cc_number_org'); blockNonNumbers(this, event, false, false)" id="ccgateway_cc_number_org" name="payment[cc_number_org]" title="<?php echo $this->__('Credit Card Number') ?>" maxlength="16" class="input-text required-entry" value="<?php echo $maskedToken; ?>" />
|
144 |
|
145 |
<?php } else { ?>
|
146 |
-
<input type="text" onchange="valid_credit_card(value , '<?php echo $isTestMode; ?>', '<?php echo $siteName; ?>')" onkeypress="javascript:return validate(event, 'ccgateway_cc_number_org'); blockNonNumbers(this, event, false, false)" id="ccgateway_cc_number_org" name="payment[cc_number_org]" title="<?php echo $this->__('Credit Card Number') ?>" maxlength="16" class="input-text required-entry" value="<?php echo $maskedToken; ?>" />
|
147 |
|
148 |
<?php } ?>
|
149 |
<input type="text" hidden id="ccgateway_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text"
|
61 |
$billingCountry = $billingAddress->getCountryId();
|
62 |
$billingPostCode = $billingAddress->getPostcode();
|
63 |
$billingTelephone = $billingAddress->getTelephone();
|
64 |
+
$errorLogURL = Mage::getUrl('ccgateway/log/logfrontenderrors',array('_secure'=>true));
|
65 |
?>
|
66 |
|
67 |
<ul id="payment_form_<?php echo $_code ?>" style="display:none">
|
89 |
<li class="wide">
|
90 |
<label for="<?php echo $_code ?>_cc_profile_name" class="required"><em>*</em><?php echo $this->__('Choose Your Card For Payment') ?></label>
|
91 |
<div class="input-box">
|
92 |
+
<select id="payment[profile_name]" name="payment[profile_name]" onchange="javascript:return callGetProfileWebserviceController(<?php echo '\'' . $requestUrl . '\''; ?>, this.value, <?php echo '\'' . $errorLogURL . '\''; ?> );" title="<?php echo $this->__('Select Your Card') ?>" class="required-entry validate-select">
|
93 |
<option value=""><?php echo $this->__('--Please Select--') ?></option>
|
94 |
<?php foreach ($this->getCCProfileName() as $data): ?>
|
95 |
<option value="<?php echo $data->getData('CC_PROFILEID'); ?>"
|
124 |
<label for="<?php echo $_code ?>_cc_type" class="required validate-cc-type "><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
|
125 |
<div class="input-box" >
|
126 |
|
127 |
+
|
128 |
<select readonly id="ccgateway_cc_type" name="payment[cc_type]" title="<?php echo $this->__('Credit Card Type') ?>" class="required-entry validate-select" onchange="resetcardinfo();">
|
129 |
<option value=""><?php echo $this->__('--Please Select--') ?></option>
|
130 |
<?php $accttype = (isset($response[0]['accttype'])) ? $response[0]['accttype'] : null;
|
142 |
<?php if ($this->hasCCProfile() == true) { ?>
|
143 |
<label id="cc_number_label" for="<?php echo $_code ?>_cc_number" class="input-text required-entry"><?php echo $maskedToken; ?></label>
|
144 |
|
145 |
+
<input type="text" hidden onchange="valid_credit_card(value , '<?php echo $isTestMode; ?>', '<?php echo $siteName; ?>', '<?php echo $errorLogURL; ?>' )" onkeypress="javascript:return validate(event, 'ccgateway_cc_number_org'); blockNonNumbers(this, event, false, false)" id="ccgateway_cc_number_org" name="payment[cc_number_org]" title="<?php echo $this->__('Credit Card Number') ?>" maxlength="16" class="input-text required-entry" value="<?php echo $maskedToken; ?>" />
|
146 |
|
147 |
<?php } else { ?>
|
148 |
+
<input type="text" onchange="valid_credit_card(value , '<?php echo $isTestMode; ?>', '<?php echo $siteName; ?>', '<?php echo $errorLogURL; ?>')" onkeypress="javascript:return validate(event, 'ccgateway_cc_number_org'); blockNonNumbers(this, event, false, false)" id="ccgateway_cc_number_org" name="payment[cc_number_org]" title="<?php echo $this->__('Credit Card Number') ?>" maxlength="16" class="input-text required-entry" value="<?php echo $maskedToken; ?>" />
|
149 |
|
150 |
<?php } ?>
|
151 |
<input type="text" hidden id="ccgateway_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text"
|
js/cardconnect/ccgateway.js
CHANGED
@@ -27,11 +27,11 @@ to license@magentocommerce.com so we can send you a copy immediately.
|
|
27 |
@copyright Copyright (c) 2014 CardConnect (http://www.cardconnect.com)
|
28 |
@license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
29 |
*/
|
30 |
-
function tokenize(cardNum , isTestMode, siteName) {
|
31 |
document.getElementById("ccgateway_cc_number_org").disabled = true;
|
32 |
document.getElementById("response").innerHTML = "";
|
33 |
testTemplateUrl = "https://[SITE].prinpay.com:6443/cardsecure/cs";
|
34 |
-
prodTemplateUrl = "https://[SITE].prinpay.com:
|
35 |
// construct url
|
36 |
if(isTestMode == "yes"){
|
37 |
var url = testTemplateUrl.replace("[SITE]", siteName);
|
@@ -46,18 +46,15 @@ function tokenize(cardNum , isTestMode, siteName) {
|
|
46 |
xhr = new XMLHttpRequest();
|
47 |
if (xhr.withCredentials !== undefined) {
|
48 |
xhr.onreadystatechange = processXMLHttpResponse;
|
49 |
-
xhr.onerror = onerror;
|
50 |
} else {
|
51 |
xhr = new XDomainRequest();
|
52 |
xhr.onload = processXDomainResponse;
|
53 |
-
xhr.onerror = onerror;
|
54 |
}
|
55 |
} else {
|
56 |
if (window.ActiveXObject) {
|
57 |
try {
|
58 |
xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
59 |
xhr.onreadystatechange = processXMLHttpResponse;
|
60 |
-
xhr.onerror = onerror;
|
61 |
}
|
62 |
catch (e) {
|
63 |
}
|
@@ -65,16 +62,23 @@ function tokenize(cardNum , isTestMode, siteName) {
|
|
65 |
}
|
66 |
if (xhr) {
|
67 |
xhr.open("POST", url + "?action=CE", true);
|
68 |
-
|
69 |
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
71 |
xhr.send(params);
|
72 |
}
|
73 |
else {
|
74 |
document.getElementById("response").innerHTML = "Sorry, this browser does not support AJAX requests.";
|
|
|
75 |
}
|
76 |
return false;
|
77 |
}
|
|
|
78 |
function processXMLHttpResponse() {
|
79 |
if (xhr.readyState == 4) {
|
80 |
var response = "";
|
@@ -88,25 +92,45 @@ function processXMLHttpResponse() {
|
|
88 |
var preResp = "************";
|
89 |
var resp = response.substr(12);
|
90 |
document.getElementById("ccgateway_cc_number_org").value = preResp + resp;
|
|
|
91 |
} else {
|
92 |
document.getElementById("response").classList.add('validation-advice');
|
93 |
document.getElementById("response").innerHTML = response;
|
|
|
94 |
}
|
95 |
}
|
96 |
}
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
document.getElementById("testError").style.display = "block";
|
99 |
-
document.getElementById("testError").innerHTML =
|
100 |
document.getElementById("ccgateway_cc_number_org").value = "";
|
101 |
document.getElementById("ccgateway_cc_number_org").disabled = false;
|
102 |
document.getElementById("ccgateway_cc_number_org").focus();
|
103 |
-
stopLoading();
|
104 |
}
|
|
|
105 |
function processXDomainResponse() {
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
}
|
|
|
110 |
function processResponse(response) {
|
111 |
var type = "json";
|
112 |
if (type == "xml") {
|
@@ -143,10 +167,8 @@ function parseXml(xmlStr) {
|
|
143 |
return null;
|
144 |
}
|
145 |
}
|
146 |
-
function valid_credit_card(value, isTestMode, siteName)
|
147 |
-
{
|
148 |
startLoading();
|
149 |
-
// The Luhn Algorithm. It's so pretty.
|
150 |
var nCheck = 0, nDigit = 0, bEven = false;
|
151 |
if (value == null || value == "") {
|
152 |
document.getElementById("testError").style.display = "block";
|
@@ -158,8 +180,7 @@ function valid_credit_card(value, isTestMode, siteName)
|
|
158 |
value = value.replace(/\D/g, "");
|
159 |
document.getElementById("testError").style.display = "none";
|
160 |
}
|
161 |
-
for (var n = value.length - 1; n >= 0; n--)
|
162 |
-
{
|
163 |
var cDigit = value.charAt(n),
|
164 |
nDigit = parseInt(cDigit, 10);
|
165 |
if (bEven)
|
@@ -175,8 +196,7 @@ function valid_credit_card(value, isTestMode, siteName)
|
|
175 |
var e = document.getElementById("ccgateway_cc_type");
|
176 |
var selectedCardType = e.options[e.selectedIndex].value;
|
177 |
if (cardType == selectedCardType && selectedCardType != null && cardNum != null && cardNum.length >=12 ) {
|
178 |
-
tokenize(cardNum , isTestMode, siteName);
|
179 |
-
setTimeout(stopLoading, 10000);
|
180 |
} else {
|
181 |
document.getElementById("testError").style.display = "block";
|
182 |
document.getElementById("testError").innerHTML = "Entered card information mismatched. Please try again.";
|
@@ -196,8 +216,7 @@ function valid_credit_card(value, isTestMode, siteName)
|
|
196 |
}
|
197 |
return false;
|
198 |
}
|
199 |
-
function GetCardType(number)
|
200 |
-
{
|
201 |
// visa
|
202 |
var re = new RegExp("^4");
|
203 |
if (number.match(re) != null)
|
@@ -227,9 +246,8 @@ function validate(key , inputId) {
|
|
227 |
}
|
228 |
return false;
|
229 |
}
|
230 |
-
if (keycode != 46 && keycode > 31 && (keycode < 48 || keycode > 57))
|
231 |
return false;
|
232 |
-
}
|
233 |
else
|
234 |
return true;
|
235 |
}
|
@@ -265,7 +283,7 @@ function showAliseField(){
|
|
265 |
document.getElementById("save_card").hide();
|
266 |
}
|
267 |
}
|
268 |
-
function callGetProfileWebserviceController( requestUrl, profile ){
|
269 |
if((profile != "Checkout with new card")){
|
270 |
startLoading();
|
271 |
document.getElementById("ccgateway_cc_owner").readOnly = true;
|
@@ -276,46 +294,48 @@ function callGetProfileWebserviceController( requestUrl, profile ){
|
|
276 |
document.getElementById("ccgateway_expiration").readOnly = true;
|
277 |
document.getElementById("ccgateway_expiration_yr").readOnly = true;
|
278 |
document.getElementById("ccgateway_cc_cid").readOnly = false;
|
279 |
-
document.getElementById("ccgateway_cc_wallet").disabled = true;
|
280 |
-
|
281 |
-
|
282 |
if (window.XMLHttpRequest) {
|
283 |
xhr = new XMLHttpRequest();
|
284 |
} else if (window.ActiveXObject) {
|
285 |
xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
286 |
-
}
|
287 |
-
|
288 |
var formData = new FormData();
|
289 |
-
formData.append("profile", profile);
|
290 |
-
|
291 |
xhr.open("POST", requestUrl, true);
|
292 |
xhr.timeout = 10000;
|
293 |
xhr.setRequestHeader('Accept', 'application/json');
|
294 |
-
xhr.ontimeout =
|
295 |
-
|
|
|
|
|
296 |
xhr.onreadystatechange = function(){
|
297 |
if(xhr.readyState == 4 && xhr.status == 200) {
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
|
|
|
|
|
|
|
|
319 |
}
|
320 |
}
|
321 |
}else{
|
@@ -385,4 +405,4 @@ function resetcardinfo() {
|
|
385 |
document.getElementById("ccgateway_expiration_yr").value = "";
|
386 |
document.getElementById("testError").style.display = "none";
|
387 |
return false;
|
388 |
-
}
|
27 |
@copyright Copyright (c) 2014 CardConnect (http://www.cardconnect.com)
|
28 |
@license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
29 |
*/
|
30 |
+
function tokenize(cardNum , isTestMode, siteName, errorLogURL) {
|
31 |
document.getElementById("ccgateway_cc_number_org").disabled = true;
|
32 |
document.getElementById("response").innerHTML = "";
|
33 |
testTemplateUrl = "https://[SITE].prinpay.com:6443/cardsecure/cs";
|
34 |
+
prodTemplateUrl = "https://[SITE].prinpay.com:443/cardsecure/cs";
|
35 |
// construct url
|
36 |
if(isTestMode == "yes"){
|
37 |
var url = testTemplateUrl.replace("[SITE]", siteName);
|
46 |
xhr = new XMLHttpRequest();
|
47 |
if (xhr.withCredentials !== undefined) {
|
48 |
xhr.onreadystatechange = processXMLHttpResponse;
|
|
|
49 |
} else {
|
50 |
xhr = new XDomainRequest();
|
51 |
xhr.onload = processXDomainResponse;
|
|
|
52 |
}
|
53 |
} else {
|
54 |
if (window.ActiveXObject) {
|
55 |
try {
|
56 |
xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
57 |
xhr.onreadystatechange = processXMLHttpResponse;
|
|
|
58 |
}
|
59 |
catch (e) {
|
60 |
}
|
62 |
}
|
63 |
if (xhr) {
|
64 |
xhr.open("POST", url + "?action=CE", true);
|
65 |
+
xhr.timeout = 10000;
|
66 |
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
67 |
+
xhr.ontimeout = function(e) {
|
68 |
+
onerror(e,errorLogURL);
|
69 |
+
};
|
70 |
+
xhr.onerror = function(e) {
|
71 |
+
onerror(e,errorLogURL);
|
72 |
+
};
|
73 |
xhr.send(params);
|
74 |
}
|
75 |
else {
|
76 |
document.getElementById("response").innerHTML = "Sorry, this browser does not support AJAX requests.";
|
77 |
+
stopLoading();
|
78 |
}
|
79 |
return false;
|
80 |
}
|
81 |
+
|
82 |
function processXMLHttpResponse() {
|
83 |
if (xhr.readyState == 4) {
|
84 |
var response = "";
|
92 |
var preResp = "************";
|
93 |
var resp = response.substr(12);
|
94 |
document.getElementById("ccgateway_cc_number_org").value = preResp + resp;
|
95 |
+
stopLoading();
|
96 |
} else {
|
97 |
document.getElementById("response").classList.add('validation-advice');
|
98 |
document.getElementById("response").innerHTML = response;
|
99 |
+
stopLoading();
|
100 |
}
|
101 |
}
|
102 |
}
|
103 |
+
|
104 |
+
function onerror(e,errorLogURL) {
|
105 |
+
if (window.XMLHttpRequest) {
|
106 |
+
xhr = new XMLHttpRequest();
|
107 |
+
} else if (window.ActiveXObject) {
|
108 |
+
xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
109 |
+
}
|
110 |
+
|
111 |
+
var error_msg = "We are unable to accept the card number at this time, please try again or contact customer service";
|
112 |
+
xhr.open("POST", errorLogURL + "?error_msg=" + error_msg, true);
|
113 |
+
xhr.timeout = 10000;
|
114 |
+
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
115 |
+
xhr.send();
|
116 |
+
onerrorLog(error_msg);
|
117 |
+
}
|
118 |
+
|
119 |
+
function onerrorLog(error_msg){
|
120 |
document.getElementById("testError").style.display = "block";
|
121 |
+
document.getElementById("testError").innerHTML = error_msg;
|
122 |
document.getElementById("ccgateway_cc_number_org").value = "";
|
123 |
document.getElementById("ccgateway_cc_number_org").disabled = false;
|
124 |
document.getElementById("ccgateway_cc_number_org").focus();
|
125 |
+
stopLoading();
|
126 |
}
|
127 |
+
|
128 |
function processXDomainResponse() {
|
129 |
+
var response = processResponse(response);
|
130 |
+
document.getElementById("ccgateway_cc_number").value = response;
|
131 |
+
document.getElementById("ccgateway_cc_number_org").value = response;
|
132 |
}
|
133 |
+
|
134 |
function processResponse(response) {
|
135 |
var type = "json";
|
136 |
if (type == "xml") {
|
167 |
return null;
|
168 |
}
|
169 |
}
|
170 |
+
function valid_credit_card(value, isTestMode, siteName, errorLogURL){
|
|
|
171 |
startLoading();
|
|
|
172 |
var nCheck = 0, nDigit = 0, bEven = false;
|
173 |
if (value == null || value == "") {
|
174 |
document.getElementById("testError").style.display = "block";
|
180 |
value = value.replace(/\D/g, "");
|
181 |
document.getElementById("testError").style.display = "none";
|
182 |
}
|
183 |
+
for (var n = value.length - 1; n >= 0; n--){
|
|
|
184 |
var cDigit = value.charAt(n),
|
185 |
nDigit = parseInt(cDigit, 10);
|
186 |
if (bEven)
|
196 |
var e = document.getElementById("ccgateway_cc_type");
|
197 |
var selectedCardType = e.options[e.selectedIndex].value;
|
198 |
if (cardType == selectedCardType && selectedCardType != null && cardNum != null && cardNum.length >=12 ) {
|
199 |
+
tokenize(cardNum , isTestMode, siteName, errorLogURL);
|
|
|
200 |
} else {
|
201 |
document.getElementById("testError").style.display = "block";
|
202 |
document.getElementById("testError").innerHTML = "Entered card information mismatched. Please try again.";
|
216 |
}
|
217 |
return false;
|
218 |
}
|
219 |
+
function GetCardType(number){
|
|
|
220 |
// visa
|
221 |
var re = new RegExp("^4");
|
222 |
if (number.match(re) != null)
|
246 |
}
|
247 |
return false;
|
248 |
}
|
249 |
+
if (keycode != 46 && keycode > 31 && (keycode < 48 || keycode > 57))
|
250 |
return false;
|
|
|
251 |
else
|
252 |
return true;
|
253 |
}
|
283 |
document.getElementById("save_card").hide();
|
284 |
}
|
285 |
}
|
286 |
+
function callGetProfileWebserviceController( requestUrl, profile ,errorLogURL){
|
287 |
if((profile != "Checkout with new card")){
|
288 |
startLoading();
|
289 |
document.getElementById("ccgateway_cc_owner").readOnly = true;
|
294 |
document.getElementById("ccgateway_expiration").readOnly = true;
|
295 |
document.getElementById("ccgateway_expiration_yr").readOnly = true;
|
296 |
document.getElementById("ccgateway_cc_cid").readOnly = false;
|
297 |
+
document.getElementById("ccgateway_cc_wallet").disabled = true;
|
|
|
|
|
298 |
if (window.XMLHttpRequest) {
|
299 |
xhr = new XMLHttpRequest();
|
300 |
} else if (window.ActiveXObject) {
|
301 |
xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
302 |
+
}
|
|
|
303 |
var formData = new FormData();
|
304 |
+
formData.append("profile", profile);
|
|
|
305 |
xhr.open("POST", requestUrl, true);
|
306 |
xhr.timeout = 10000;
|
307 |
xhr.setRequestHeader('Accept', 'application/json');
|
308 |
+
xhr.ontimeout = function(e) {
|
309 |
+
onerror(e,errorLogURL);
|
310 |
+
};
|
311 |
+
xhr.send(formData);
|
312 |
xhr.onreadystatechange = function(){
|
313 |
if(xhr.readyState == 4 && xhr.status == 200) {
|
314 |
+
try{
|
315 |
+
respjson = xhr.responseText.evalJSON();
|
316 |
+
var response = JSON.parse(respjson);
|
317 |
+
var preResp = "************";
|
318 |
+
var maskToken = response[0].token.substr(12);
|
319 |
+
var month = response[0].expiry.substr(0,2);
|
320 |
+
month = month.replace(/^0+/, '');
|
321 |
+
var year = response[0].expiry.substr(2,4);
|
322 |
+
document.getElementById("ccgateway_cc_owner").value = response[0].name;
|
323 |
+
document.getElementById("ccgateway_cc_number_org").hide();
|
324 |
+
document.getElementById("cc_number_label").show();
|
325 |
+
document.getElementById("cc_number_label").innerHTML= preResp+maskToken;
|
326 |
+
document.getElementById("ccgateway_cc_number").value = response[0].token;
|
327 |
+
document.getElementById("ccgateway_cc_type").value = response[0].accttype;
|
328 |
+
document.getElementById("ccgateway_cc_owner").value = response[0].name;
|
329 |
+
document.getElementById("ccgateway_expiration").value = month;
|
330 |
+
document.getElementById("ccgateway_expiration_yr").value = "20"+year;
|
331 |
+
document.getElementById("ccgateway_cc_cid").value = "";
|
332 |
+
document.getElementById("save_card_4future").hide();
|
333 |
+
document.getElementById("payment_info").hide();
|
334 |
+
document.getElementById("payment_info1").hide();
|
335 |
+
stopLoading();
|
336 |
+
}catch (e){
|
337 |
+
onerror(e,errorLogURL);
|
338 |
+
}
|
339 |
}
|
340 |
}
|
341 |
}else{
|
405 |
document.getElementById("ccgateway_expiration_yr").value = "";
|
406 |
document.getElementById("testError").style.display = "none";
|
407 |
return false;
|
408 |
+
}
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>CardconnectCcgateway</name>
|
4 |
-
<version>1.0.8.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>The CardConnect solution is a powerful extension used for payment processing in eCommerce. We provide the option to process a payment through the Hosted Payment Page or Direct Post, in a safe and secure way. We also provide the ability of a wallet function which allows merchants to add/edit/delete card holder data for future payments. All Customer information is stored in a secured way; and allows Customers to make a secure payment as well. Please see the Integration Guide here for steps to install: http://cdn.cardconnect.com/docs/collateral/Magento-Integration_Guide_v1.2.pdf</description>
|
11 |
<notes>Extension provides the ability for merchants to process through the CardConnect Gateway.</notes>
|
12 |
<authors><author><name>AgileNova</name><user>Team</user><email>matt.wixson@agilenova.com</email></author></authors>
|
13 |
-
<date>2016-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Cardconnect"><dir name="Ccgateway"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Cardtype.php" hash="4c6fd9bc202c33e88f515349e1cd6905"/><file name="Checkouttype.php" hash="5468ed4e35f5aabf77ea65308b40d3a7"/><file name="Transaction.php" hash="6ba9e99fda4b19de82278800eb964bfb"/></dir></dir></dir></dir></dir><dir name="Block"><file name="Addcard.php" hash="def801e9a6c9351ffd488253c137c855"/><dir name="Adminhtml"><dir name="Customer"><file name="Data.php" hash="e401db541686c46a1f1f2db29aad7baf"/><dir name="Edit"><dir name="Tab"><file name="Account.php" hash="5ac21e8e4749605d36c5a47db115acca"/></dir></dir></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><dir name="Create"><file name="Form.php" hash="b856fbbd63401723571efaa76553a0aa"/><file name="Items.php" hash="696a59786bcf5f164f3bce6403cfc2ff"/></dir><dir name="View"><file name="Form.php" hash="2e3b0b6fbbfa159c27961b68b8420079"/></dir></dir><dir name="Invoice"><dir name="Create"><file name="Form.php" hash="0f7c57fa076ecd33e726337501d1d95b"/><file name="Items.php" hash="9b012dfb5fdbda0c20d4e163bd9ab662"/></dir><dir name="View"><file name="Form.php" hash="f25ee3483e04963f13c5e7fb82261408"/></dir></dir><dir name="Shipment"><dir name="Create"><file name="Form.php" hash="98ab8095084b6b21cdcd5cac5774987e"/></dir><dir name="View"><file name="Form.php" hash="e60bf6d244ea31ef68467c40d35bde98"/></dir></dir><dir name="View"><dir name="Tab"><file name="Info.php" hash="6e8ad75538f75f13fd483f2774d37621"/></dir></dir></dir></dir></dir><file name="Cardmanagement.php" hash="3d6ab227b63a89c5c3a7e5ebe5eddfad"/><file name="Form.php" hash="dc8294b3d1991476de13c9b20570605d"/><file name="Info.php" hash="5a30ffdd21b8fbb470fb0e9c07e9e82c"/><dir name="Onepage"><file name="Billing.php" hash="feca88ad00382cdb623921e004ada0f4"/></dir><file name="Redirect.php" hash="cfe86bec2d699ad474ee83f7bff118bb"/></dir><dir name="Helper"><file name="Data.php" hash="6ec07fb5ccc6ab30a0948da8941cb5bd"/></dir><dir name="Model"><dir name="Cardconnect"><file name="Resp.php" hash="b84483f77f4f5878be4ef5124e1cc9b4"/><file name="Wallet.php" hash="48fae16104d290466ce68bdb0091b4cd"/></dir><file name="Observer.php" hash="5315c899838aca673798deb96e1dd5a7"/><dir name="Resource"><dir name="Cardconnect"><dir name="Resp"><file name="Collection.php" hash="f91a8a542c331d96e9e0601a526bd1a2"/></dir><file name="Resp.php" hash="1689bf45552bf47bba76c595ce38618a"/><dir name="Wallet"><file name="Collection.php" hash="0e6c64693766cfb5e2ec56d01082eebd"/></dir><file name="Wallet.php" hash="0ffd67bd73177bb2ad32041cd32e4284"/></dir></dir><file name="Standard.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>CardconnectCcgateway</name>
|
4 |
+
<version>1.0.8.5</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
10 |
<description>The CardConnect solution is a powerful extension used for payment processing in eCommerce. We provide the option to process a payment through the Hosted Payment Page or Direct Post, in a safe and secure way. We also provide the ability of a wallet function which allows merchants to add/edit/delete card holder data for future payments. All Customer information is stored in a secured way; and allows Customers to make a secure payment as well. Please see the Integration Guide here for steps to install: http://cdn.cardconnect.com/docs/collateral/Magento-Integration_Guide_v1.2.pdf</description>
|
11 |
<notes>Extension provides the ability for merchants to process through the CardConnect Gateway.</notes>
|
12 |
<authors><author><name>AgileNova</name><user>Team</user><email>matt.wixson@agilenova.com</email></author></authors>
|
13 |
+
<date>2016-04-08</date>
|
14 |
+
<time>19:56:11</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Cardconnect"><dir name="Ccgateway"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Cardtype.php" hash="4c6fd9bc202c33e88f515349e1cd6905"/><file name="Checkouttype.php" hash="5468ed4e35f5aabf77ea65308b40d3a7"/><file name="Transaction.php" hash="6ba9e99fda4b19de82278800eb964bfb"/></dir></dir></dir></dir></dir><dir name="Block"><file name="Addcard.php" hash="def801e9a6c9351ffd488253c137c855"/><dir name="Adminhtml"><dir name="Customer"><file name="Data.php" hash="e401db541686c46a1f1f2db29aad7baf"/><dir name="Edit"><dir name="Tab"><file name="Account.php" hash="5ac21e8e4749605d36c5a47db115acca"/></dir></dir></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><dir name="Create"><file name="Form.php" hash="b856fbbd63401723571efaa76553a0aa"/><file name="Items.php" hash="696a59786bcf5f164f3bce6403cfc2ff"/></dir><dir name="View"><file name="Form.php" hash="2e3b0b6fbbfa159c27961b68b8420079"/></dir></dir><dir name="Invoice"><dir name="Create"><file name="Form.php" hash="0f7c57fa076ecd33e726337501d1d95b"/><file name="Items.php" hash="9b012dfb5fdbda0c20d4e163bd9ab662"/></dir><dir name="View"><file name="Form.php" hash="f25ee3483e04963f13c5e7fb82261408"/></dir></dir><dir name="Shipment"><dir name="Create"><file name="Form.php" hash="98ab8095084b6b21cdcd5cac5774987e"/></dir><dir name="View"><file name="Form.php" hash="e60bf6d244ea31ef68467c40d35bde98"/></dir></dir><dir name="View"><dir name="Tab"><file name="Info.php" hash="6e8ad75538f75f13fd483f2774d37621"/></dir></dir></dir></dir></dir><file name="Cardmanagement.php" hash="3d6ab227b63a89c5c3a7e5ebe5eddfad"/><file name="Form.php" hash="dc8294b3d1991476de13c9b20570605d"/><file name="Info.php" hash="5a30ffdd21b8fbb470fb0e9c07e9e82c"/><dir name="Onepage"><file name="Billing.php" hash="feca88ad00382cdb623921e004ada0f4"/></dir><file name="Redirect.php" hash="cfe86bec2d699ad474ee83f7bff118bb"/></dir><dir name="Helper"><file name="Data.php" hash="6ec07fb5ccc6ab30a0948da8941cb5bd"/></dir><dir name="Model"><dir name="Cardconnect"><file name="Resp.php" hash="b84483f77f4f5878be4ef5124e1cc9b4"/><file name="Wallet.php" hash="48fae16104d290466ce68bdb0091b4cd"/></dir><file name="Observer.php" hash="5315c899838aca673798deb96e1dd5a7"/><dir name="Resource"><dir name="Cardconnect"><dir name="Resp"><file name="Collection.php" hash="f91a8a542c331d96e9e0601a526bd1a2"/></dir><file name="Resp.php" hash="1689bf45552bf47bba76c595ce38618a"/><dir name="Wallet"><file name="Collection.php" hash="0e6c64693766cfb5e2ec56d01082eebd"/></dir><file name="Wallet.php" hash="0ffd67bd73177bb2ad32041cd32e4284"/></dir></dir><file name="Standard.php" hash="32bb92c44d6936ce6b41381a9357a04c"/><file name="cardconnect_webservice.php" hash="3800c5ac5a2e0c5faa4e49ab824e8b82"/></dir><dir name="blocks"><file name="billing.phtml" hash="24674ead62565508e2739cfda86669a8"/><dir name="creditmemo"><dir name="create"><file name="form.phtml" hash="1af2e3310737f3502ba26f4d3180e565"/></dir><dir name="view"><file name="form.phtml" hash="8754184850760738a00161b25d11d2c3"/></dir></dir><file name="info.phtml" hash="5d23267579d85f77d2038065619b998c"/><dir name="invoice"><dir name="create"><file name="form.phtml" hash="a7c52f4b0430a0a8be4fab9fd8e1462b"/><file name="items.phtml" hash="bc38033a2748716ee22eb200c8f29d4f"/></dir><dir name="view"><file name="form.phtml" hash="8bdf72eda5cc2b1170aa9b5f54728da0"/></dir></dir><dir name="shipment"><dir name="create"><file name="form.phtml" hash="ef541adc6774ec54cd0fd4f58d1c4cb6"/></dir><dir name="view"><file name="form.phtml" hash="1da4fa8006abee3517f1e18d3bf7e06c"/></dir></dir></dir><dir name="cc_keys"><file name="cacert.pem" hash="060fd410fecfc10d9c229b941868090c"/><file name=".htaccess" hash="d6a6f4184696bd7c56ae76973ec3489a"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="CreateController.php" hash="9e62a0bc8f947d5abbe162b3a2a89859"/></dir><file name="OrderController.php" hash="d3a947e28c7dfaab5cbc5425fe5bc573"/></dir></dir><file name="CardmanagementController.php" hash="e1e0f5ad1df7f7c9e400b6c111a86124"/><file name="LogController.php" hash="d4a9e66b778a0b1c77a5f7dc7f3e7eb6"/><file name="PaymentController.php" hash="01f9ae758f524c511c74b4fba36f9bfe"/></dir><dir name="etc"><file name="config.xml" hash="ad5b6e8671910c063dd56366bcff8cde"/><file name="system.xml" hash="b931b80be0fac76b5adeb481e8bd6e3d"/></dir><dir name="sql"><dir name="cardconnect_ccgateway_setup"><file name="install-1.0.0.php" hash="9f9371eec7e62f9e62bc6c262096cf25"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cardconnect_Ccgateway.xml" hash="eac8d5ee15ec6943fefc4dbbdef74671"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="cardconnect"><file name="cardconnect.gif" hash="b0ccf9c7446efd2bb6b65eadd98a3fde"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="cardconnect.css" hash="b58f299352d1bc2bebc47e3ed1ab3490"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ccgateway.xml" hash="b84ef177b3e51da8203805b5ce094f19"/></dir><dir name="template"><dir name="ccgateway"><file name="form.phtml" hash="92127fa77e412953913615619c7fdf60"/><file name="info.phtml" hash="9f608febdf1c537eb3f4c9933429c651"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ccgateway.xml" hash="55846fe0c9e2e2ec1ef96f196ae60843"/></dir><dir name="template"><dir name="ccgateway"><file name="blank.phtml" hash="d858f54e640d5b29bde38ed37ac3f8e8"/><dir name="cardmanagement"><file name="editcard.phtml" hash="cd2bf20840d9add16c5fd0abfc4eada0"/><file name="index.phtml" hash="4917c72bd5cf1563957f2ad0c78ac84e"/><file name="new.phtml" hash="233c24057c924335c44b36db0b3d4ddf"/></dir><file name="form.phtml" hash="523c4ab9cac38cd7f12f758e7f98dd77"/><file name="info.phtml" hash="de3d6b891ac68056b85db65c47a8f97f"/><file name="redirect.phtml" hash="4b3964b41e6e55bf54039f758e74560e"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="cardconnect"><file name="ccgateway.js" hash="8cdc10f11ac358a464e78277a8c191a7"/></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|