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.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.8 to 1.0.8.2
app/code/community/Cardconnect/Ccgateway/Model/.Standard.php.swp
DELETED
Binary file
|
app/code/community/Cardconnect/Ccgateway/Model/Standard.php
CHANGED
@@ -1,1088 +1,1088 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* @brief Defines the class representing CardConnect webservices
|
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 |
-
Magento
|
16 |
-
*
|
17 |
-
NOTICE OF LICENSE
|
18 |
-
*
|
19 |
-
This source file is subject to the Open Software License (OSL 3.0)
|
20 |
-
that is bundled with this package in the file LICENSE.txt.
|
21 |
-
It is also available through the world-wide-web at this URL:
|
22 |
-
http://opensource.org/licenses/osl-3.0.php
|
23 |
-
If you did not receive a copy of the license and are unable to
|
24 |
-
obtain it through the world-wide-web, please send an email
|
25 |
-
to license@magentocommerce.com so we can send you a copy immediately.
|
26 |
-
*
|
27 |
-
@category Cardconnect
|
28 |
-
@package Cardconnect_Ccgateway
|
29 |
-
@copyright Copyright (c) 2014 CardConnect (http://www.cardconnect.com)
|
30 |
-
@license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
31 |
-
*/
|
32 |
-
require('cardconnect_webservice.php');
|
33 |
-
|
34 |
-
class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abstract {
|
35 |
-
|
36 |
-
protected $_code = 'ccgateway';
|
37 |
-
protected $_isGateway = true;
|
38 |
-
protected $_canAuthorize = true;
|
39 |
-
protected $_canCapture = true;
|
40 |
-
protected $_canVoid = true;
|
41 |
-
protected $_canUseInternal = true;
|
42 |
-
protected $_canUseCheckout = true;
|
43 |
-
protected $_canUseForMultishipping = true;
|
44 |
-
protected $_canCapturePartial = true;
|
45 |
-
protected $_canRefundInvoicePartial = true;
|
46 |
-
protected $_canRefund = true;
|
47 |
-
protected $_paymentMethod = 'standard';
|
48 |
-
protected $_formBlockType = 'ccgateway/form';
|
49 |
-
protected $_infoBlockType = 'ccgateway/info';
|
50 |
-
protected $_redirectBlockType = 'ccgateway/redirect';
|
51 |
-
protected $_order;
|
52 |
-
protected $_canCancelInvoice = true;
|
53 |
-
protected $_canSaveCc = true;
|
54 |
protected $_cclength = 0;
|
55 |
|
56 |
-
|
57 |
-
protected function _construct() {
|
58 |
-
parent::_construct();
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Return payment url type string
|
63 |
-
*
|
64 |
-
* @return string
|
65 |
-
*/
|
66 |
-
public function getUrl() {
|
67 |
-
|
68 |
-
$isTestMode = Mage::getModel('ccgateway/standard')->getConfigData('test_mode');
|
69 |
-
switch ($isTestMode) {
|
70 |
-
case 0:
|
71 |
-
$_url = 'https://securepayments.cardconnect.com/hpp/payment/';
|
72 |
-
break;
|
73 |
-
default:
|
74 |
-
$_url = 'https://securepaymentstest.cardconnect.com/hpp/payment/';
|
75 |
-
break;
|
76 |
-
}
|
77 |
-
|
78 |
-
return $_url;
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Return webservices keys location type string
|
83 |
-
*
|
84 |
-
* @return string
|
85 |
-
*/
|
86 |
-
public function getKeysLocation() {
|
87 |
-
|
88 |
-
$keys_location = Mage::getModuleDir('', 'Cardconnect_Ccgateway') . '/cc_keys/';
|
89 |
-
|
90 |
-
return $keys_location;
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Check capture availability
|
95 |
-
*
|
96 |
-
* @return bool
|
97 |
-
*/
|
98 |
-
public function canCapture() {
|
99 |
-
$order = $this->getOrder();
|
100 |
-
$tranType = $this->getConfigData('checkout_trans', $order->getStoreId());
|
101 |
-
if ($tranType == "authorize_capture") {
|
102 |
-
$_canCapture = false;
|
103 |
-
} else {
|
104 |
-
$_canCapture = true;
|
105 |
-
}
|
106 |
-
|
107 |
-
return $_canCapture;
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Get order model
|
112 |
-
*
|
113 |
-
* @return Mage_Sales_Model_Order
|
114 |
-
*/
|
115 |
-
public function getOrder() {
|
116 |
-
if (!$this->_order) {
|
117 |
-
$this->_order = $this->getInfoInstance()->getOrder();
|
118 |
-
}
|
119 |
-
return $this->_order;
|
120 |
-
}
|
121 |
-
|
122 |
-
public function getOrderPlaceRedirectUrl() {
|
123 |
-
return Mage::getUrl('ccgateway/payment/redirect');
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Get Payment transaction type
|
128 |
-
*/
|
129 |
-
public function getPaymentTransactionType() {
|
130 |
-
$checkout_trans = $this->getConfigData('checkout_trans');
|
131 |
-
|
132 |
-
return $checkout_trans;
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* Return payment method type string
|
137 |
-
*
|
138 |
-
* @return string
|
139 |
-
*/
|
140 |
-
public function getPaymentMethodType() {
|
141 |
-
return $this->_paymentMethod;
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Check refund availability
|
146 |
-
*
|
147 |
-
* @return bool
|
148 |
-
*/
|
149 |
-
public function canRefund() {
|
150 |
-
|
151 |
-
$_canRefund = true;
|
152 |
-
|
153 |
-
return $_canRefund;
|
154 |
-
}
|
155 |
-
|
156 |
-
/**
|
157 |
-
* prepare params array to send it to gateway page via POST
|
158 |
-
*
|
159 |
-
* NOTE: Currency is not a parameter, it is configured by CardConnect in the merchant profile.
|
160 |
-
*
|
161 |
-
* @return array
|
162 |
-
*/
|
163 |
-
public function getFormFields() {
|
164 |
-
|
165 |
-
// get transaction amount and currency
|
166 |
-
if ($this->getConfigData('currency')) {
|
167 |
-
$price = number_format($this->getOrder()->getGrandTotal(), 2, '.', '');
|
168 |
-
} else {
|
169 |
-
$price = number_format($this->getOrder()->getBaseGrandTotal(), 2, '.', '');
|
170 |
-
}
|
171 |
-
|
172 |
-
$billing = $this->getOrder()->getBillingAddress();
|
173 |
-
|
174 |
-
$ccArray = array(
|
175 |
-
'ccId' => $this->getConfigData('card_id'), /* CardConnect Id */
|
176 |
-
'ccSite' => $this->getConfigData('site_name'), /* Site Name */
|
177 |
-
'ccDisplayAddress' => $this->getConfigData('address'), /* Display Address */
|
178 |
-
'ccCapture' => $this->getConfigData('checkout_trans'), /* Checkout Transaction Type */
|
179 |
-
'ccTokenize' => $this->getConfigData('tokenize'), /* Tokenize */
|
180 |
-
'ccDisplayCvv' => $this->getConfigData('display'), /* Display CVV */
|
181 |
-
'ccAmount' => $price, /* Transaction Amount */
|
182 |
-
'ccName' => Mage::helper('core')->removeAccents($billing->getFirstname()
|
183 |
-
. ' ' . $billing->getLastname()), /* Account Name */
|
184 |
-
'ccAddress' => Mage::helper('core')->removeAccents($billing->getStreet(1)), /* Account street address */
|
185 |
-
'ccCity' => Mage::helper('core')->removeAccents($billing->getCity()), /* Account city */
|
186 |
-
'ccState' => $billing->getRegionCode(), /* US State, Mexican State, Canadian Province, etc. */
|
187 |
-
'ccCountry' => $billing->getCountry(), /* Account country */
|
188 |
-
'ccZip' => $billing->getPostcode(), /* Account postal code */
|
189 |
-
'ccCardTypes' => $this->getConfigData('card_type'),
|
190 |
-
'ccOrderId' => Mage::getSingleton('checkout/session')->getLastRealOrderId(), /* Order Id */
|
191 |
-
'ccCssUrl' => $this->getConfigData('css'), /* CSS URL */
|
192 |
-
'ccPostbackUrl' => Mage::getUrl('ccgateway/payment/response'), /* Postback URL */
|
193 |
-
'ccAsync' => $this->getConfigData('validation'), /* Immediate Validation */
|
194 |
-
'ccCancel' => $this->getConfigData('cancel'), /* Cancel Button enable flag */
|
195 |
-
);
|
196 |
-
|
197 |
-
return $ccArray;
|
198 |
-
}
|
199 |
-
|
200 |
-
/**
|
201 |
-
* Assign data to info model instance
|
202 |
-
*
|
203 |
-
* @param mixed $data
|
204 |
-
* @return Mage_Payment_Model_Info
|
205 |
-
*/
|
206 |
-
public function assignData($data) {
|
207 |
-
if (!($data instanceof Varien_Object)) {
|
208 |
-
$data = new Varien_Object($data);
|
209 |
-
}
|
210 |
-
|
211 |
-
Mage::getSingleton('core/session')->setCcOwner($data->getCcOwner());
|
212 |
-
Mage::getSingleton('core/session')->setCcNumber($data->getCcNumber());
|
213 |
-
Mage::getSingleton('core/session')->setCcType($data->getCcType());
|
214 |
-
Mage::getSingleton('core/session')->setCcExpMonth($data->getCcExpMonth());
|
215 |
-
Mage::getSingleton('core/session')->setCcExpYear($data->getCcExpYear());
|
216 |
-
Mage::getSingleton('core/session')->setCcCid($data->getCcCid());
|
217 |
-
|
218 |
-
$value['profile_name'] = "";
|
219 |
-
foreach ($data as $value) {
|
220 |
-
if (isset($value['profile_name']) || @$value['profile_name'] != "Checkout with new card") {
|
221 |
-
Mage::getSingleton('core/session')->setCcProfileid(@$value['profile_name']);
|
222 |
-
}
|
223 |
-
}
|
224 |
-
|
225 |
-
$info = $this->getInfoInstance();
|
226 |
-
$info->setCcType($data->getCcType())
|
227 |
-
->setCcOwner($data->getCcOwner())
|
228 |
-
->setCcLast4(substr($data->getCcNumber(), -4))
|
229 |
-
->setCcNumber($data->getCcNumber())
|
230 |
-
->setCcCid($data->getCcCid())
|
231 |
-
->setCcExpMonth($data->getCcExpMonth())
|
232 |
-
->setCcExpYear($data->getCcExpYear())
|
233 |
-
->setCcSsIssue($data->getCcSsIssue())
|
234 |
-
->setCcSsStartMonth($data->getCcSsStartMonth())
|
235 |
-
->setCcSsStartYear($data->getCcSsStartYear())
|
236 |
-
;
|
237 |
-
return $this;
|
238 |
-
}
|
239 |
-
|
240 |
-
/**
|
241 |
-
* Prepare info instance for save
|
242 |
-
*
|
243 |
-
* @return Mage_Payment_Model_Abstract
|
244 |
-
*/
|
245 |
-
public function prepareSave() {
|
246 |
-
$info = $this->getInfoInstance();
|
247 |
-
if ($this->_canSaveCc) {
|
248 |
$_cclength = strlen($info->getCcNumber());
|
249 |
if (is_numeric($info->getCcNumber()) && $_cclength < 20) {
|
250 |
$info->setCcNumberEnc($info->encrypt($info->getCcNumber()));
|
251 |
} else {
|
252 |
-
$info->setCcCidEnc($info->encrypt($info->getCcCid()));
|
253 |
return $this;
|
254 |
}
|
255 |
-
}
|
256 |
-
|
257 |
-
$info->setCcCidEnc($info->encrypt($info->getCcCid()));
|
258 |
-
|
259 |
-
return $this;
|
260 |
-
}
|
261 |
-
|
262 |
-
/** For Authorization * */
|
263 |
-
public function authService($order, $authAmount = "", $status = "") {
|
264 |
-
|
265 |
-
$orderId = $order->getIncrementId();
|
266 |
-
$merchid = $this->getConfigData('merchant' , $order->getStoreId());
|
267 |
-
|
268 |
-
if (empty($status)) {
|
269 |
-
$ccOwner = Mage::getSingleton('core/session')->getCcOwner();
|
270 |
-
$ccNumber = Mage::getSingleton('core/session')->getCcNumber();
|
271 |
-
$ccType = Mage::getSingleton('core/session')->getCcType();
|
272 |
-
$ccExpiry = Mage::getSingleton('core/session')->getCcExpMonth() . substr(Mage::getSingleton('core/session')->getCcExpYear(), 2);
|
273 |
-
$ccCvv2 = Mage::getSingleton('core/session')->getCcCid();
|
274 |
-
$price = number_format($order->getBaseGrandTotal(), 2, '.', '');
|
275 |
-
$profileId = Mage::getSingleton('core/session')->getCcProfileid();
|
276 |
-
} else {
|
277 |
-
// For Pratial Shipment Reauthorization
|
278 |
-
$quote_id = $order->getQuoteId();
|
279 |
-
$collection = Mage::getModel('sales/quote_payment')->getCollection()
|
280 |
-
->addFieldToFilter('quote_id', array('eq' => $quote_id));
|
281 |
-
|
282 |
-
foreach ($collection as $data) {
|
283 |
-
$ccOwner = $data->getData("cc_owner");
|
284 |
-
$ccType = $data->getData("cc_type");
|
285 |
$ccNumber = Mage::helper('core')->decrypt($data->getData("cc_number_enc"));
|
286 |
-
$ccExpiry = $data->getData("cc_exp_month") . substr($data->getData("cc_exp_year"), 2);
|
287 |
$ccCvv2 = Mage::helper('core')->decrypt($data->getData("cc_cid_enc"));
|
288 |
-
}
|
289 |
-
$price = $authAmount;
|
290 |
-
}
|
291 |
-
|
292 |
-
|
293 |
-
$billing = $order->getBillingAddress();
|
294 |
-
|
295 |
-
if (empty($status) || $status == "authFull") {
|
296 |
-
$checkout_trans = $this->getPaymentTransactionType();
|
297 |
-
} else {
|
298 |
-
$checkout_trans = "authorize_capture";
|
299 |
-
}
|
300 |
-
|
301 |
-
if ($checkout_trans == "authorize_capture") {
|
302 |
-
$captureStatus = "Y";
|
303 |
-
} else {
|
304 |
-
$captureStatus = "N";
|
305 |
-
}
|
306 |
-
|
307 |
-
if (strlen($ccExpiry) < 4) {
|
308 |
-
$ccExpiry = "0" . $ccExpiry;
|
309 |
-
}
|
310 |
-
|
311 |
-
if (!empty($profileId)) {
|
312 |
-
$param = array(
|
313 |
-
'profileid' => $profileId,
|
314 |
-
'order_id' => $orderId,
|
315 |
-
'currency_value' => $price,
|
316 |
-
'cvv_val' => $ccCvv2,
|
317 |
-
'ecomind' => "E",
|
318 |
-
'capture' => $captureStatus,
|
319 |
-
'tokenize' => 'Y');
|
320 |
-
} else {
|
321 |
-
$param = array(
|
322 |
-
'merchid' => $merchid,
|
323 |
-
'acc_type' => $ccType,
|
324 |
-
'order_id' => $orderId,
|
325 |
-
'acc_num' => $ccNumber,
|
326 |
-
'expirydt' => $ccExpiry,
|
327 |
-
'currency_value' => $price,
|
328 |
-
'currency' => "USD",
|
329 |
-
'cc_owner' => $ccOwner,
|
330 |
-
'billing_street_address' => $billing->getStreet(1),
|
331 |
-
'billing_city' => $billing->getCity(),
|
332 |
-
'billing_state' => $billing->getRegionCode(),
|
333 |
-
'billing_country' => $billing->getCountry(),
|
334 |
-
'billing_postcode' => $billing->getPostcode(),
|
335 |
-
'ecomind' => "E",
|
336 |
-
'cvv_val' => $ccCvv2,
|
337 |
-
'track' => null,
|
338 |
-
'capture' => $captureStatus,
|
339 |
-
'tokenize' => 'Y');
|
340 |
-
}
|
341 |
-
|
342 |
-
$cc = Mage::helper('ccgateway')->getCardConnectWebService($order);
|
343 |
-
$resp = $cc->authService($param);
|
344 |
-
|
345 |
-
if (empty($status)) {
|
346 |
-
Mage::getSingleton('core/session')->unsCcOwner();
|
347 |
-
Mage::getSingleton('core/session')->unsCcNumber();
|
348 |
-
Mage::getSingleton('core/session')->unsCcType();
|
349 |
-
Mage::getSingleton('core/session')->unsCcExpMonth();
|
350 |
-
Mage::getSingleton('core/session')->unsCcExpYear();
|
351 |
-
Mage::getSingleton('core/session')->unsCcCid();
|
352 |
-
Mage::getSingleton('core/session')->unsCcProfileid();
|
353 |
-
}
|
354 |
-
|
355 |
-
if ($resp != "") {
|
356 |
-
$response = json_decode($resp, true);
|
357 |
-
|
358 |
-
$response['orderid'] = $orderId;
|
359 |
-
|
360 |
-
if (!empty($status)) {
|
361 |
-
$response['action'] = $checkout_trans;
|
362 |
-
$response['merchid'] = $merchid;
|
363 |
-
$response['setlstat'] = "";
|
364 |
-
$response['voidflag'] = "";
|
365 |
-
|
366 |
-
// Save Partial Authorization Response data
|
367 |
-
$this->saveResponseData($response);
|
368 |
-
if($response['respcode']==00){
|
369 |
-
// Set custom order status
|
370 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_processing', $response['resptext'])->save();
|
371 |
-
}else{
|
372 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_reject', $response['resptext'])->save();
|
373 |
-
$response= array('resptext' => "CardConnect_Error");
|
374 |
-
}
|
375 |
-
}
|
376 |
-
} else {
|
377 |
-
$myLogMessage = "CC Authorization : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
378 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
379 |
-
|
380 |
-
// Set custom order status
|
381 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_reject', "Invalid response from CardConnect.")->save();
|
382 |
-
$response= array('resptext' => "CardConnect_Error");
|
383 |
-
|
384 |
-
}
|
385 |
-
|
386 |
-
|
387 |
-
return $response;
|
388 |
-
}
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
/** For capture * */
|
393 |
-
public function capture(Varien_Object $payment, $amount) {
|
394 |
-
|
395 |
-
if (!$this->canCapture()) {
|
396 |
-
return $this;
|
397 |
-
}
|
398 |
-
|
399 |
-
if ($amount <= 0) {
|
400 |
-
Mage::throwException(Mage::helper('ccgateway')->__('Invalid amount for capture.'));
|
401 |
-
}
|
402 |
-
$order = $payment->getOrder();
|
403 |
-
$orderId = $order->increment_id;
|
404 |
-
$fullAuthorizedAmount = $order->getBaseGrandTotal();
|
405 |
-
if (strpos('.', $amount) == "") {
|
406 |
-
$amount = number_format($amount, 2);
|
407 |
-
$fullAuthorizedAmount = number_format($fullAuthorizedAmount, 2);
|
408 |
-
}
|
409 |
-
$amount = str_replace(",", "", $amount);
|
410 |
-
$fullAuthorizedAmount = str_replace(",", "", $fullAuthorizedAmount);
|
411 |
-
|
412 |
-
$canCapture = $this->checkCaptureOnceDone($orderId);
|
413 |
-
if ($canCapture == TRUE) {
|
414 |
-
$this->authService($order, $amount, "authPartial");
|
415 |
-
} else {
|
416 |
-
$retref = $this->getRetrefReferenceNumber($orderId);
|
417 |
-
$authCode = $this->getAuthCode($orderId);
|
418 |
-
$checkout_trans = $this->getPaymentTransactionType();
|
419 |
-
$merchid = $this->getConfigData('merchant' , $payment->getOrder()->getStoreId());
|
420 |
-
|
421 |
-
$cc = Mage::helper('ccgateway')->getCardConnectWebService($order);
|
422 |
-
|
423 |
-
if ($fullAuthorizedAmount == $amount) {
|
424 |
-
$resp = $cc->captureService($retref, $authCode, $amount, $orderId);
|
425 |
-
} else {
|
426 |
-
$amountForVoid = $fullAuthorizedAmount - $amount;
|
427 |
-
$this->voidService($order, $amountForVoid, "Partial");
|
428 |
-
$resp = $cc->captureService($retref, $authCode, $amount, $orderId);
|
429 |
-
}
|
430 |
-
|
431 |
-
if ($resp != "") {
|
432 |
-
if ($checkout_trans != "authorize_capture") {
|
433 |
-
$response = json_decode($resp, true);
|
434 |
-
|
435 |
-
$response['action'] = "Capture";
|
436 |
-
$response['orderid'] = $orderId;
|
437 |
-
$response['merchid'] = $merchid;
|
438 |
-
$response['authcode'] = "";
|
439 |
-
$response['voidflag'] = "";
|
440 |
-
|
441 |
-
// Save Capture Response data
|
442 |
-
$this->saveResponseData($response);
|
443 |
-
// Set custom order status
|
444 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, 'cardconnect_capture', $response['setlstat'])->save();
|
445 |
-
}
|
446 |
-
} else {
|
447 |
-
$myLogMessage = "CC Capture : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
448 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
449 |
-
|
450 |
-
// Set custom order status
|
451 |
-
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', "Invalid response from CardConnect.")->save();
|
452 |
-
$errorMsg = "Unable to perform operation. Please consult the Magento log for additional information.";
|
453 |
-
Mage::throwException($errorMsg);
|
454 |
-
|
455 |
-
}
|
456 |
-
}
|
457 |
-
|
458 |
-
return $this;
|
459 |
-
}
|
460 |
-
|
461 |
-
// Check capture once performed for an order
|
462 |
-
function checkCaptureOnceDone($orderId) {
|
463 |
-
|
464 |
-
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->getCollection()
|
465 |
-
->addFieldToFilter('CC_ORDERID', array('eq' => $orderId))
|
466 |
-
->addFieldToSelect('CC_ACTION');
|
467 |
-
|
468 |
-
$cc_action = array();
|
469 |
-
foreach ($collection as $data) {
|
470 |
-
$cc_action[] = $data->getData('CC_ACTION');
|
471 |
-
}
|
472 |
-
if (in_array("Capture", $cc_action)) {
|
473 |
-
$c_status = TRUE;
|
474 |
-
} else {
|
475 |
-
$c_status = FALSE;
|
476 |
-
}
|
477 |
-
|
478 |
-
return $c_status;
|
479 |
-
}
|
480 |
-
|
481 |
-
// Void function using web services
|
482 |
-
public function voidService($order, $partialAmount = "", $action = "") {
|
483 |
-
|
484 |
-
$orderId = $order->getIncrementId();
|
485 |
-
$retref = $this->getRetrefReferenceNumber($orderId);
|
486 |
-
if (empty($partialAmount)) {
|
487 |
-
$amount = $order->getBaseGrandTotal();
|
488 |
-
} else {
|
489 |
-
$amount = $partialAmount;
|
490 |
-
}
|
491 |
-
|
492 |
-
if (strpos('.', $amount) == "") {
|
493 |
-
$amount = number_format($amount, 2);
|
494 |
-
}
|
495 |
-
$amount = str_replace(",", "", $amount);
|
496 |
-
|
497 |
-
$cc = Mage::helper('ccgateway')->getCardConnectWebService($order);
|
498 |
-
$resp = $cc->voidService($retref, $amount);
|
499 |
-
|
500 |
-
if ($resp != "") {
|
501 |
-
$response = json_decode($resp, true);
|
502 |
-
$response['action'] = "Void";
|
503 |
-
$response['orderid'] = $orderId;
|
504 |
-
$response['setlstat'] = "";
|
505 |
-
$response['voidflag'] = "";
|
506 |
-
|
507 |
-
// Save Void Response data
|
508 |
-
$this->saveResponseData($response);
|
509 |
-
|
510 |
-
if (empty($action)) {
|
511 |
-
// Set custom order status
|
512 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_void', $response['resptext'])->save();
|
513 |
-
}
|
514 |
-
} else {
|
515 |
-
$myLogMessage = "CC Void : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
516 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
517 |
-
|
518 |
-
// Set custom order status
|
519 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_reject', "Invalid response from CardConnect.")->save();
|
520 |
-
|
521 |
-
$errorMsg = "Unable to perform operation. Please consult the Magento log for additional information.";
|
522 |
-
Mage::throwException($errorMsg);
|
523 |
-
|
524 |
-
}
|
525 |
-
|
526 |
-
return $response;
|
527 |
-
}
|
528 |
-
|
529 |
-
// Check the Capture status for a current order
|
530 |
-
public function getVoidStatus($order) {
|
531 |
-
|
532 |
-
$orderId = $order->getIncrementId();
|
533 |
-
|
534 |
-
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->getCollection()
|
535 |
-
->addFieldToFilter('CC_ORDERID', array('eq' => $orderId))
|
536 |
-
->addFieldToSelect('CC_ACTION');
|
537 |
-
|
538 |
-
$cc_action = array();
|
539 |
-
foreach ($collection as $data) {
|
540 |
-
$cc_action[] = $data->getData('CC_ACTION');
|
541 |
-
}
|
542 |
-
if (in_array("Void", $cc_action)) {
|
543 |
-
$c_status = false;
|
544 |
-
} else {
|
545 |
-
$c_status = true;
|
546 |
-
}
|
547 |
-
|
548 |
-
return $c_status;
|
549 |
-
}
|
550 |
-
|
551 |
-
// Check payment settlement satatus before refund
|
552 |
-
|
553 |
-
public function processBeforeRefund($invoice, $payment) {
|
554 |
-
$order = $payment->getOrder();
|
555 |
-
$orderId = $order->increment_id;
|
556 |
-
$retref = $this->getRetrefReferenceNumber($orderId, "Refund");
|
557 |
-
|
558 |
-
$cc = Mage::helper('ccgateway')->getCardConnectWebService($order);
|
559 |
-
|
560 |
-
$resp = $cc->inquireService($retref);
|
561 |
-
$response = json_decode($resp, true);
|
562 |
-
|
563 |
-
if ($response['setlstat'] == "Accepted") {
|
564 |
-
$status = "true";
|
565 |
-
Mage::log('Txn settled for your order Id: ' . $orderId);
|
566 |
-
} else {
|
567 |
-
$status = "false";
|
568 |
-
Mage::throwException("Refund cannot be processed, transaction should be settled first.");
|
569 |
-
}
|
570 |
-
|
571 |
-
return $this;
|
572 |
-
}
|
573 |
-
|
574 |
-
// Refund function using web services
|
575 |
-
|
576 |
-
public function refund(Varien_Object $payment, $amount) {
|
577 |
-
|
578 |
-
if (!$this->canRefund()) {
|
579 |
-
return $this;
|
580 |
-
}
|
581 |
-
|
582 |
-
$order = $payment->getOrder();
|
583 |
-
$orderId = $order->increment_id;
|
584 |
-
$retref = $this->getRetrefReferenceNumber($orderId, "Refund");
|
585 |
-
$merchid = $this->getConfigData('merchant' , $payment->getOrder()->getStoreId());
|
586 |
-
|
587 |
-
if ($amount <= 0) {
|
588 |
-
Mage::throwException(Mage::helper('ccgateway')->__('Invalid amount for refund.'));
|
589 |
-
}
|
590 |
-
|
591 |
-
if (strpos('.', $amount) == "") {
|
592 |
-
$amount = number_format($amount, 2);
|
593 |
-
}
|
594 |
-
|
595 |
-
$amount = str_replace(",", "", $amount);
|
596 |
-
|
597 |
-
$cc = Mage::helper('ccgateway')->getCardConnectWebService($order);
|
598 |
-
$resp = $cc->refundService($retref, $amount);
|
599 |
-
|
600 |
-
if ($resp != "") {
|
601 |
-
$response = json_decode($resp, true);
|
602 |
-
|
603 |
-
$response['action'] = "Refund";
|
604 |
-
$response['orderid'] = $orderId;
|
605 |
-
$response['merchid'] = $merchid;
|
606 |
-
$response['setlstat'] = "";
|
607 |
-
$response['authcode'] = "";
|
608 |
-
$response['voidflag'] = "";
|
609 |
-
|
610 |
-
// Save Refund Response data
|
611 |
-
$this->saveResponseData($response);
|
612 |
-
// Set custom order status
|
613 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_refund', $response['resptext'])->save();
|
614 |
-
} else {
|
615 |
-
|
616 |
-
$myLogMessage = "CC Refund : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
617 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
618 |
-
|
619 |
-
// Set custom order status
|
620 |
-
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', "Invalid response from CardConnect.")->save();
|
621 |
-
$errorMsg = "Unable to perform operation. Please consult the Magento log for additional information.";
|
622 |
-
Mage::throwException($errorMsg);
|
623 |
-
|
624 |
-
}
|
625 |
-
|
626 |
-
return $this;
|
627 |
-
}
|
628 |
-
|
629 |
-
// Inquire function using web services
|
630 |
-
public function inquireService($orderId) {
|
631 |
-
|
632 |
-
$order = Mage::getModel('sales/order');
|
633 |
-
$order->loadByIncrementId($orderId);
|
634 |
-
$responseData = $this->getResponseDataByOrderId($orderId);
|
635 |
-
$cc_password = $this->getConfigData('password', $order->getStoreId());
|
636 |
-
|
637 |
-
|
638 |
-
$response = "";
|
639 |
-
$errorMsg = 0;
|
640 |
-
$message = "";
|
641 |
-
|
642 |
-
if ($cc_password != "") {
|
643 |
-
if ($responseData->count() != 0) {
|
644 |
-
foreach ($responseData as $data) {
|
645 |
-
$ccId = $data->getData('CC_ID');
|
646 |
-
$ccAction = $data->getData('CC_ACTION');
|
647 |
-
$retref = $data->getData('CC_RETREF');
|
648 |
-
$order_amount = $data->getData('CC_AMT');
|
649 |
-
$setlstat = $data->getData('CC_SETLSTAT');
|
650 |
-
|
651 |
-
$cc = Mage::helper('ccgateway')->getCardConnectWebService($order);
|
652 |
-
$resp = $cc->inquireService($retref);
|
653 |
-
$response = json_decode($resp, true);
|
654 |
-
if (!empty($response)) {
|
655 |
-
if (abs($response['amount']) == $order_amount || abs($response['amount']) == '0.00') {
|
656 |
-
if ($response['setlstat'] == 'Accepted' || $response['setlstat'] == 'Voided') {
|
657 |
-
if ($ccAction == 'Refund') {
|
658 |
-
$order->setState(Mage_Sales_Model_Order::STATE_REFUNDED, 'cardconnect_refund', $response['setlstat'])->save();
|
659 |
-
}
|
660 |
-
if ($ccAction == 'authorize' || $ccAction == 'authorize_capture') {
|
661 |
-
if ($response['setlstat'] == 'Voided') {
|
662 |
-
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_void', $response['setlstat'])->save();
|
663 |
-
} else if ($response['setlstat'] == 'Accepted') {
|
664 |
-
$order->setState(Mage_Sales_Model_Order::STATE_COMPLETE, 'cardconnect_txn_settled', $response['setlstat'])->save();
|
665 |
-
}
|
666 |
-
}
|
667 |
-
if ($ccAction == 'Void') {
|
668 |
-
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_void', $response['setlstat'])->save();
|
669 |
-
}
|
670 |
-
} else if ($response['setlstat'] == 'Rejected') {
|
671 |
-
// Do not update order status for refund
|
672 |
-
}
|
673 |
-
|
674 |
-
$stat = strpos($setlstat, $response['setlstat']);
|
675 |
-
if ($stat !== false) {
|
676 |
-
$message = "status matched";
|
677 |
-
Mage::log('Current status matched with Inquire status');
|
678 |
-
} else if ($response['setlstat'] !== 'Authorized' && $response['setlstat'] !== 'Queued for Capture' && $response['setlstat'] !== '' && $response['setlstat'] !== 'Refunded') {
|
679 |
-
$fields = array('CC_SETLSTAT' => $response['setlstat']);
|
680 |
-
$this->updateAfterInquireService($fields, $ccId);
|
681 |
-
}
|
682 |
-
} else if ($ccAction == 'Refund') {
|
683 |
-
$cmp_setlstat = strpos($response['setlstat'], $setlstat);
|
684 |
-
if ($cmp_setlstat !== false) {
|
685 |
-
$message = "status matched";
|
686 |
-
Mage::log('Current Refund status matched with Inquire status');
|
687 |
-
} else {
|
688 |
-
$fields = array('CC_SETLSTAT' => $response['setlstat']);
|
689 |
-
$this->updateAfterInquireService($fields, $ccId);
|
690 |
-
}
|
691 |
-
}
|
692 |
-
} else {
|
693 |
-
$errorMsg = 1;
|
694 |
-
$myLogMessage = "CC Inquire : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
695 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
696 |
-
|
697 |
-
}
|
698 |
-
}
|
699 |
-
} else {
|
700 |
-
$message = "status matched";
|
701 |
-
}
|
702 |
-
} else {
|
703 |
-
Mage::log("Unable to get decrypted password");
|
704 |
-
}
|
705 |
-
|
706 |
-
if ($message == "status matched") {
|
707 |
-
$message = "Current status matched with Inquire status";
|
708 |
-
} else if ($errorMsg == 1) {
|
709 |
-
$message = "There is some problem in inquire services";
|
710 |
-
} else {
|
711 |
-
$message = "Successfully Inquired";
|
712 |
-
}
|
713 |
-
|
714 |
-
return $message;
|
715 |
-
}
|
716 |
-
|
717 |
-
// Create Profile webservices
|
718 |
-
function createProfileService($paymentInformation) {
|
719 |
-
|
720 |
-
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
721 |
-
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
722 |
-
$ccUserId = $customerData->getId();
|
723 |
-
}
|
724 |
-
|
725 |
-
$ccCardName = $paymentInformation['cc_profile_name'];
|
726 |
-
$ccExpiry = $paymentInformation['cc_exp_month'] . substr($paymentInformation['cc_exp_year'], 2);
|
727 |
-
if (strlen($ccExpiry) < 4) {
|
728 |
-
$ccExpiry = "0" . $ccExpiry;
|
729 |
-
}
|
730 |
-
|
731 |
-
$profrequest = array(
|
732 |
-
'defaultacct' => "N",
|
733 |
-
'profile' => "",
|
734 |
-
'profileupdate' => "N",
|
735 |
-
'account' => $paymentInformation['cc_number'],
|
736 |
-
'accttype' => $paymentInformation['cc_type'],
|
737 |
-
'expiry' => $ccExpiry,
|
738 |
-
'name' => $paymentInformation['cc_owner'],
|
739 |
-
'address' => $paymentInformation['cc_street'],
|
740 |
-
'city' => $paymentInformation['cc_city'],
|
741 |
-
'region' => $paymentInformation['cc_region'],
|
742 |
-
'country' => $paymentInformation['cc_country'],
|
743 |
-
'phone' => $paymentInformation['cc_telephone'],
|
744 |
-
'postal' => $paymentInformation['cc_postcode']
|
745 |
-
);
|
746 |
-
|
747 |
-
$cc = Mage::helper('ccgateway')->getCardConnectWebService();
|
748 |
-
$resp = $cc->createProfileService($profrequest);
|
749 |
-
|
750 |
-
if ($resp != "") {
|
751 |
-
$response = json_decode($resp, true);
|
752 |
-
|
753 |
-
if ($response['resptext'] == "Profile Saved") {
|
754 |
-
$response['ccUserId'] = $ccUserId;
|
755 |
-
$response['ccCardName'] = $ccCardName;
|
756 |
-
if ($this->hasWalletCard($response['ccUserId']) == "Yes") {
|
757 |
-
$response['defaultacct'] = "N";
|
758 |
-
} else {
|
759 |
-
$response['defaultacct'] = "Y";
|
760 |
-
}
|
761 |
-
|
762 |
-
// Save Refund Response data
|
763 |
-
$this->saveResponseData($response, "Wallat");
|
764 |
-
}
|
765 |
-
} else {
|
766 |
-
$myLogMessage = "CC Create Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
767 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
768 |
-
$response= array('resptext' => "CardConnect_Error");
|
769 |
-
}
|
770 |
-
|
771 |
-
return $response;
|
772 |
-
}
|
773 |
-
|
774 |
-
// Function for Get Profile webservices
|
775 |
-
function getProfileWebService($profileId, $cc_id) {
|
776 |
-
|
777 |
-
$cc = Mage::helper('ccgateway')->getCardConnectWebService();
|
778 |
-
|
779 |
-
$resp = $cc->getProfileService($profileId);
|
780 |
-
if (!empty($resp) && $cc_id != "") {
|
781 |
-
$resource = Mage::getSingleton('core/resource');
|
782 |
-
$readConnection = $resource->getConnection('core_read');
|
783 |
-
$getTable = $resource->getTableName('cardconnect_wallet');
|
784 |
-
|
785 |
-
$selQry = "SELECT CC_CARD_NAME FROM {$getTable} WHERE CC_ID=" . $cc_id;
|
786 |
-
$rsCard = $readConnection->fetchRow($selQry);
|
787 |
-
$resp = json_decode($resp, true);
|
788 |
-
$resp[] = $rsCard['CC_CARD_NAME'];
|
789 |
-
} else {
|
790 |
-
$myLogMessage = "CC Get Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
791 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
792 |
-
$resp[] = array('resptext' => "CardConnect_Error");
|
793 |
-
|
794 |
-
}
|
795 |
-
|
796 |
-
return $resp;
|
797 |
-
}
|
798 |
-
|
799 |
-
// Function for Get Profile webservices Checkout
|
800 |
-
function getProfileWebServiceCheckout($profileId) {
|
801 |
-
|
802 |
-
$cc = Mage::helper('ccgateway')->getCardConnectWebService();
|
803 |
-
$resp = $cc->getProfileService($profileId);
|
804 |
-
if (empty($resp)) {
|
805 |
-
$myLogMessage = "CC Get Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
806 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
807 |
-
$resp[] = array('resptext' => "CardConnect_Error");
|
808 |
-
}
|
809 |
-
|
810 |
-
return $resp;
|
811 |
-
}
|
812 |
-
|
813 |
-
// Function for Delete Profile webservices
|
814 |
-
|
815 |
-
function deleteWalletDataService($profileRowId, $ccUserId= "") {
|
816 |
-
|
817 |
-
if(empty($ccUserId)){
|
818 |
-
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
819 |
-
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
820 |
-
$ccUserId = $customerData->getId();
|
821 |
-
}
|
822 |
-
}
|
823 |
-
|
824 |
-
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_wallet')->getCollection()
|
825 |
-
->addFieldToFilter('CC_ID', array('eq' => $profileRowId))
|
826 |
-
->addFieldToFilter('CC_USER_ID', array('eq' => $ccUserId))
|
827 |
-
->addFieldToSelect("*");
|
828 |
-
|
829 |
-
foreach ($collection as $data) {
|
830 |
-
$ccProfileId = $data->getData('CC_PROFILEID');
|
831 |
-
$tokenNum = $data->getData('CC_MASK');
|
832 |
-
}
|
833 |
-
|
834 |
-
|
835 |
-
if (!empty($tokenNum)) {
|
836 |
-
$cc = Mage::helper('ccgateway')->getCardConnectWebService();
|
837 |
-
$resp = $cc->deleteProfileService($ccProfileId);
|
838 |
-
|
839 |
-
if (!empty($resp)) {
|
840 |
-
$response = json_decode($resp, true);
|
841 |
-
|
842 |
-
if (($response['resptext'] === "Profile Deleted") || ($response['resptext'] === "Profile not found")) {
|
843 |
-
$resource = Mage::getSingleton('core/resource');
|
844 |
-
$writeConnection = $resource->getConnection('core_write');
|
845 |
-
|
846 |
-
$getTable = $resource->getTableName('cardconnect_wallet');
|
847 |
-
// Query to delete cardconnect_wallet table
|
848 |
-
$delQry = "DELETE FROM {$getTable} WHERE CC_ID=" . $profileRowId." AND CC_USER_ID=". $ccUserId;
|
849 |
-
$writeConnection->query($delQry);
|
850 |
-
$msg = "Card has been deleted successfully.";
|
851 |
-
} else {
|
852 |
-
$msg = "We are unable to perform the requested action, please contact customer service.";
|
853 |
-
$myLogMessage = "CC Delete Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
854 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
855 |
-
$myMessage = "CC Delete Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$response['resptext'];
|
856 |
-
Mage::log($myMessage, Zend_Log::ERR , "cc.log" );
|
857 |
-
}
|
858 |
-
} else {
|
859 |
-
$myLogMessage = "CC Delete Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
860 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
861 |
-
$msg = "We are unable to perform the requested action, please contact customer service.";
|
862 |
-
}
|
863 |
-
}else{
|
864 |
-
$myLogMessage = "CC Delete Profile Service : ". __FILE__ . " @ " . __LINE__;
|
865 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
866 |
-
$msg = "We are unable to perform the requested action, please contact customer service.";
|
867 |
-
}
|
868 |
-
|
869 |
-
return $msg;
|
870 |
-
}
|
871 |
-
|
872 |
-
// Update Profile webservices
|
873 |
-
function updateProfileService($paymentInformation) {
|
874 |
-
$username = $this->getConfigData('username');
|
875 |
-
$merchid = $this->getConfigData('merchant');
|
876 |
-
$cc_password = $this->getConfigData('password');
|
877 |
-
|
878 |
-
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
879 |
-
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
880 |
-
$ccUserId = $customerData->getId();
|
881 |
-
$ccCardName = $paymentInformation['cc_profile_name'];
|
882 |
-
$cc_id = $paymentInformation['wallet_id'];
|
883 |
-
}
|
884 |
-
|
885 |
-
$ccExpiry = $paymentInformation['cc_exp_month'] . substr($paymentInformation['cc_exp_year'], 2);
|
886 |
-
if (strlen($ccExpiry) < 4) {
|
887 |
-
$ccExpiry = "0" . $ccExpiry;
|
888 |
-
}
|
889 |
-
|
890 |
-
|
891 |
-
$profrequest = array(
|
892 |
-
'defaultacct' => $paymentInformation['defaultacct'],
|
893 |
-
'profile' => $paymentInformation['profile'],
|
894 |
-
'profileupdate' => $paymentInformation['profileupdate'],
|
895 |
-
'account' => $paymentInformation['cc_number'],
|
896 |
-
'accttype' => $paymentInformation['cc_type'],
|
897 |
-
'expiry' => $ccExpiry,
|
898 |
-
'name' => $paymentInformation['cc_owner'],
|
899 |
-
'address' => $paymentInformation['cc_street'],
|
900 |
-
'city' => $paymentInformation['cc_city'],
|
901 |
-
'region' => $paymentInformation['cc_region'],
|
902 |
-
'country' => $paymentInformation['cc_country'],
|
903 |
-
'phone' => $paymentInformation['cc_telephone'],
|
904 |
-
'postal' => $paymentInformation['cc_postcode']
|
905 |
-
);
|
906 |
-
|
907 |
-
|
908 |
-
$cc = Mage::helper('ccgateway')->getCardConnectWebService();
|
909 |
-
$resp = $cc->createProfileService($profrequest);
|
910 |
-
if ($resp != "") {
|
911 |
-
$response = json_decode($resp, true);
|
912 |
-
if ($response['resptext'] == "Profile Saved") {
|
913 |
-
$fields = array('CC_CARD_NAME' => $ccCardName, 'CC_MASK' => $response['token']);
|
914 |
-
$connectionWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
|
915 |
-
$connectionWrite->beginTransaction();
|
916 |
-
$where = $connectionWrite->quoteInto('CC_ID =?', $cc_id);
|
917 |
-
$connectionWrite->update('cardconnect_wallet', $fields, $where);
|
918 |
-
$connectionWrite->commit();
|
919 |
-
$response = "Profile Updated";
|
920 |
-
} else {
|
921 |
-
$errorMessage = "There is some problem in update profile. Due to " . $response['resptext'];
|
922 |
-
Mage::log($errorMessage, Zend_Log::ERR, "cc.log");
|
923 |
-
}
|
924 |
-
} else {
|
925 |
-
$myLogMessage = "CC Update Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
926 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
927 |
-
}
|
928 |
-
|
929 |
-
|
930 |
-
return $response;
|
931 |
-
}
|
932 |
-
|
933 |
-
// Check has wallet card
|
934 |
-
function hasWalletCard($customerID) {
|
935 |
-
|
936 |
-
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_wallet')->getCollection()
|
937 |
-
->addFieldToFilter('CC_USER_ID', array('eq' => $customerID))
|
938 |
-
->addFieldToSelect("CC_USER_ID");
|
939 |
-
|
940 |
-
$ccProfileId = "";
|
941 |
-
foreach ($collection as $data) {
|
942 |
-
$ccProfileId = $data->getData('CC_USER_ID');
|
943 |
-
}
|
944 |
-
|
945 |
-
if ($ccProfileId != null) {
|
946 |
-
$msg = "Yes";
|
947 |
-
} else {
|
948 |
-
$msg = "No";
|
949 |
-
}
|
950 |
-
|
951 |
-
return $msg;
|
952 |
-
}
|
953 |
-
|
954 |
-
// function for get data from response table by order id
|
955 |
-
|
956 |
-
public function getResponseDataByOrderId($orderId) {
|
957 |
-
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->getCollection()
|
958 |
-
->addFieldToFilter('CC_ORDERID', array('eq' => $orderId))
|
959 |
-
->addFieldToFilter('CC_SETLSTAT', array(
|
960 |
-
array('nin' => array('Accepted', 'Voided')),
|
961 |
-
array('null' => true),
|
962 |
-
)
|
963 |
-
);
|
964 |
-
|
965 |
-
return $collection;
|
966 |
-
}
|
967 |
-
|
968 |
-
// Update response table after Inquire webservices
|
969 |
-
protected function updateAfterInquireService($fields, $ccgateway_id) {
|
970 |
-
|
971 |
-
$connectionWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
|
972 |
-
$connectionWrite->beginTransaction();
|
973 |
-
$where = $connectionWrite->quoteInto('CC_ID =?', $ccgateway_id);
|
974 |
-
$connectionWrite->update('cardconnect_resp', $fields, $where);
|
975 |
-
$connectionWrite->commit();
|
976 |
-
|
977 |
-
return $this;
|
978 |
-
}
|
979 |
-
|
980 |
-
// Save response date to ccgateway table
|
981 |
-
public function saveResponseData($response, $table = "") {
|
982 |
-
|
983 |
-
|
984 |
-
if ($table == "Wallat") {
|
985 |
-
$ccMask = substr_replace(@$response['token'], '************', 0, 12);
|
986 |
-
|
987 |
-
$data = array('CC_USER_ID' => $response['ccUserId'], /* Checkout Transaction Type */
|
988 |
-
'CC_PROFILEID' => $response['profileid'], /* Retrieval Reference Number */
|
989 |
-
'CC_ACCTID' => $response['acctid'], /* Capture Amount */
|
990 |
-
'CC_MASK' => $ccMask, /* Masked number */
|
991 |
-
'CC_CARD_NAME' => $response['ccCardName'], /* Order Id */
|
992 |
-
'CC_DEFAULT_CARD' => @$response['defaultacct'], /* Token */
|
993 |
-
'CC_CREATED' => now() /* Request's response time */
|
994 |
-
);
|
995 |
-
$model = Mage::getModel('cardconnect_ccgateway/cardconnect_wallet')->setData($data);
|
996 |
-
} else {
|
997 |
-
$retref = $response['retref'];
|
998 |
-
// $ccToken = @$response['token'];
|
999 |
if (!empty($response['token'])){
|
1000 |
$ccToken = @$response['token'];
|
1001 |
} else {
|
1002 |
$ccToken ="";
|
1003 |
}
|
1004 |
|
1005 |
-
|
1006 |
-
$data = array('CC_ACTION' => $response['action'], /* Checkout Transaction Type */
|
1007 |
-
'CC_RETREF' => "$retref", /* Retrieval Reference Number */
|
1008 |
-
'CC_AMT' => @$response['amount'], /* Capture Amount */
|
1009 |
-
'CC_AUTHCODE' => @$response['authcode'], /* Authorization code */
|
1010 |
-
'CC_ORDERID' => $response['orderid'], /* Order Id */
|
1011 |
-
'CC_TOKEN' => $ccToken, /* Token */
|
1012 |
-
'CC_AVSRESP' => @$response['avsresp'], /* AVS Result */
|
1013 |
-
'CC_CVVRESP' => @$response['cvvresp'], /* CVV Result */
|
1014 |
-
'CC_RESPTEXT' => $response['resptext'], /* Response Description */
|
1015 |
-
'CC_MERCHID' => @$response['merchid'], /* Merchant Id */
|
1016 |
-
'CC_RESPPROC' => $response['respproc'], /* Response Processor */
|
1017 |
-
'CC_RESPCODE' => $response['respcode'], /* Response Code */
|
1018 |
-
'CC_RESPSTAT' => $response['respstat'], /* Response Status */
|
1019 |
-
'CC_SETLSTAT' => @$response['setlstat'], /* settlement Status */
|
1020 |
-
'CC_VOIDED' => $response['voidflag'], /* Void Flag */
|
1021 |
-
'CC_CREATED' => now() /* Request's response time */
|
1022 |
-
);
|
1023 |
-
$model = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->setData($data);
|
1024 |
-
}
|
1025 |
-
$model->save();
|
1026 |
-
}
|
1027 |
-
|
1028 |
-
// Function for get Authcode
|
1029 |
-
public function getAuthCode($currentOrderId) {
|
1030 |
-
|
1031 |
-
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->getCollection()
|
1032 |
-
->addFieldToFilter('CC_ORDERID', array('eq' => $currentOrderId))
|
1033 |
-
->addFieldToSelect('CC_AUTHCODE');
|
1034 |
-
|
1035 |
-
$authDesc = "";
|
1036 |
-
foreach ($collection as $data) {
|
1037 |
-
$authDesc = $data->getData('CC_AUTHCODE');
|
1038 |
-
}
|
1039 |
-
|
1040 |
-
return $authDesc;
|
1041 |
-
}
|
1042 |
-
|
1043 |
-
// Function for get retref refrence number
|
1044 |
-
public function getRetrefReferenceNumber($currentOrderId, $action = "") {
|
1045 |
-
|
1046 |
-
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->getCollection()
|
1047 |
-
->addFieldToFilter('CC_ORDERID', array('eq' => $currentOrderId))
|
1048 |
-
->addFieldToSelect('CC_RETREF');
|
1049 |
-
if ($action !== "Refund") {
|
1050 |
-
$collection->setOrder('CC_CREATED', 'DESC');
|
1051 |
-
}
|
1052 |
-
$collection->getSelect()->limit(1);
|
1053 |
-
|
1054 |
-
$retrefRefrenceNumber = "";
|
1055 |
-
foreach ($collection as $data) {
|
1056 |
-
$retrefRefrenceNumber = $data->getData('CC_RETREF');
|
1057 |
-
}
|
1058 |
-
|
1059 |
-
return $retrefRefrenceNumber;
|
1060 |
-
}
|
1061 |
-
|
1062 |
-
/**
|
1063 |
-
* Retrieve information from payment configuration
|
1064 |
-
*
|
1065 |
-
* @param string $field
|
1066 |
-
* @param int|string|null|Mage_Core_Model_Store $storeId
|
1067 |
-
*
|
1068 |
-
* @return mixed
|
1069 |
-
*/
|
1070 |
-
public function getConfigData($field, $storeId = null)
|
1071 |
-
{
|
1072 |
-
|
1073 |
-
$path = 'payment/'.$this->getCode().'/'.$field;
|
1074 |
-
|
1075 |
-
if(empty($storeId)){
|
1076 |
-
if(Mage::app()->getStore()->getCode() == Mage_Core_Model_Store::ADMIN_CODE) {
|
1077 |
-
$storeId = Mage::getSingleton('adminhtml/session_quote')->getStoreId();
|
1078 |
-
return Mage::getStoreConfig($path, $storeId);
|
1079 |
-
}else {
|
1080 |
-
return Mage:: getStoreConfig($path);
|
1081 |
-
}
|
1082 |
-
}else{
|
1083 |
-
return Mage::getStoreConfig($path, $storeId);
|
1084 |
-
}
|
1085 |
-
}
|
1086 |
-
|
1087 |
-
|
1088 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @brief Defines the class representing CardConnect webservices
|
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 |
+
Magento
|
16 |
+
*
|
17 |
+
NOTICE OF LICENSE
|
18 |
+
*
|
19 |
+
This source file is subject to the Open Software License (OSL 3.0)
|
20 |
+
that is bundled with this package in the file LICENSE.txt.
|
21 |
+
It is also available through the world-wide-web at this URL:
|
22 |
+
http://opensource.org/licenses/osl-3.0.php
|
23 |
+
If you did not receive a copy of the license and are unable to
|
24 |
+
obtain it through the world-wide-web, please send an email
|
25 |
+
to license@magentocommerce.com so we can send you a copy immediately.
|
26 |
+
*
|
27 |
+
@category Cardconnect
|
28 |
+
@package Cardconnect_Ccgateway
|
29 |
+
@copyright Copyright (c) 2014 CardConnect (http://www.cardconnect.com)
|
30 |
+
@license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
31 |
+
*/
|
32 |
+
require('cardconnect_webservice.php');
|
33 |
+
|
34 |
+
class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abstract {
|
35 |
+
|
36 |
+
protected $_code = 'ccgateway';
|
37 |
+
protected $_isGateway = true;
|
38 |
+
protected $_canAuthorize = true;
|
39 |
+
protected $_canCapture = true;
|
40 |
+
protected $_canVoid = true;
|
41 |
+
protected $_canUseInternal = true;
|
42 |
+
protected $_canUseCheckout = true;
|
43 |
+
protected $_canUseForMultishipping = true;
|
44 |
+
protected $_canCapturePartial = true;
|
45 |
+
protected $_canRefundInvoicePartial = true;
|
46 |
+
protected $_canRefund = true;
|
47 |
+
protected $_paymentMethod = 'standard';
|
48 |
+
protected $_formBlockType = 'ccgateway/form';
|
49 |
+
protected $_infoBlockType = 'ccgateway/info';
|
50 |
+
protected $_redirectBlockType = 'ccgateway/redirect';
|
51 |
+
protected $_order;
|
52 |
+
protected $_canCancelInvoice = true;
|
53 |
+
protected $_canSaveCc = true;
|
54 |
protected $_cclength = 0;
|
55 |
|
56 |
+
|
57 |
+
protected function _construct() {
|
58 |
+
parent::_construct();
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Return payment url type string
|
63 |
+
*
|
64 |
+
* @return string
|
65 |
+
*/
|
66 |
+
public function getUrl() {
|
67 |
+
|
68 |
+
$isTestMode = Mage::getModel('ccgateway/standard')->getConfigData('test_mode');
|
69 |
+
switch ($isTestMode) {
|
70 |
+
case 0:
|
71 |
+
$_url = 'https://securepayments.cardconnect.com/hpp/payment/';
|
72 |
+
break;
|
73 |
+
default:
|
74 |
+
$_url = 'https://securepaymentstest.cardconnect.com/hpp/payment/';
|
75 |
+
break;
|
76 |
+
}
|
77 |
+
|
78 |
+
return $_url;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Return webservices keys location type string
|
83 |
+
*
|
84 |
+
* @return string
|
85 |
+
*/
|
86 |
+
public function getKeysLocation() {
|
87 |
+
|
88 |
+
$keys_location = Mage::getModuleDir('', 'Cardconnect_Ccgateway') . '/cc_keys/';
|
89 |
+
|
90 |
+
return $keys_location;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Check capture availability
|
95 |
+
*
|
96 |
+
* @return bool
|
97 |
+
*/
|
98 |
+
public function canCapture() {
|
99 |
+
$order = $this->getOrder();
|
100 |
+
$tranType = $this->getConfigData('checkout_trans', $order->getStoreId());
|
101 |
+
if ($tranType == "authorize_capture") {
|
102 |
+
$_canCapture = false;
|
103 |
+
} else {
|
104 |
+
$_canCapture = true;
|
105 |
+
}
|
106 |
+
|
107 |
+
return $_canCapture;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Get order model
|
112 |
+
*
|
113 |
+
* @return Mage_Sales_Model_Order
|
114 |
+
*/
|
115 |
+
public function getOrder() {
|
116 |
+
if (!$this->_order) {
|
117 |
+
$this->_order = $this->getInfoInstance()->getOrder();
|
118 |
+
}
|
119 |
+
return $this->_order;
|
120 |
+
}
|
121 |
+
|
122 |
+
public function getOrderPlaceRedirectUrl() {
|
123 |
+
return Mage::getUrl('ccgateway/payment/redirect');
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Get Payment transaction type
|
128 |
+
*/
|
129 |
+
public function getPaymentTransactionType() {
|
130 |
+
$checkout_trans = $this->getConfigData('checkout_trans');
|
131 |
+
|
132 |
+
return $checkout_trans;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Return payment method type string
|
137 |
+
*
|
138 |
+
* @return string
|
139 |
+
*/
|
140 |
+
public function getPaymentMethodType() {
|
141 |
+
return $this->_paymentMethod;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Check refund availability
|
146 |
+
*
|
147 |
+
* @return bool
|
148 |
+
*/
|
149 |
+
public function canRefund() {
|
150 |
+
|
151 |
+
$_canRefund = true;
|
152 |
+
|
153 |
+
return $_canRefund;
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* prepare params array to send it to gateway page via POST
|
158 |
+
*
|
159 |
+
* NOTE: Currency is not a parameter, it is configured by CardConnect in the merchant profile.
|
160 |
+
*
|
161 |
+
* @return array
|
162 |
+
*/
|
163 |
+
public function getFormFields() {
|
164 |
+
|
165 |
+
// get transaction amount and currency
|
166 |
+
if ($this->getConfigData('currency')) {
|
167 |
+
$price = number_format($this->getOrder()->getGrandTotal(), 2, '.', '');
|
168 |
+
} else {
|
169 |
+
$price = number_format($this->getOrder()->getBaseGrandTotal(), 2, '.', '');
|
170 |
+
}
|
171 |
+
|
172 |
+
$billing = $this->getOrder()->getBillingAddress();
|
173 |
+
|
174 |
+
$ccArray = array(
|
175 |
+
'ccId' => $this->getConfigData('card_id'), /* CardConnect Id */
|
176 |
+
'ccSite' => $this->getConfigData('site_name'), /* Site Name */
|
177 |
+
'ccDisplayAddress' => $this->getConfigData('address'), /* Display Address */
|
178 |
+
'ccCapture' => $this->getConfigData('checkout_trans'), /* Checkout Transaction Type */
|
179 |
+
'ccTokenize' => $this->getConfigData('tokenize'), /* Tokenize */
|
180 |
+
'ccDisplayCvv' => $this->getConfigData('display'), /* Display CVV */
|
181 |
+
'ccAmount' => $price, /* Transaction Amount */
|
182 |
+
'ccName' => Mage::helper('core')->removeAccents($billing->getFirstname()
|
183 |
+
. ' ' . $billing->getLastname()), /* Account Name */
|
184 |
+
'ccAddress' => Mage::helper('core')->removeAccents($billing->getStreet(1)), /* Account street address */
|
185 |
+
'ccCity' => Mage::helper('core')->removeAccents($billing->getCity()), /* Account city */
|
186 |
+
'ccState' => $billing->getRegionCode(), /* US State, Mexican State, Canadian Province, etc. */
|
187 |
+
'ccCountry' => $billing->getCountry(), /* Account country */
|
188 |
+
'ccZip' => $billing->getPostcode(), /* Account postal code */
|
189 |
+
'ccCardTypes' => $this->getConfigData('card_type'),
|
190 |
+
'ccOrderId' => Mage::getSingleton('checkout/session')->getLastRealOrderId(), /* Order Id */
|
191 |
+
'ccCssUrl' => $this->getConfigData('css'), /* CSS URL */
|
192 |
+
'ccPostbackUrl' => Mage::getUrl('ccgateway/payment/response'), /* Postback URL */
|
193 |
+
'ccAsync' => $this->getConfigData('validation'), /* Immediate Validation */
|
194 |
+
'ccCancel' => $this->getConfigData('cancel'), /* Cancel Button enable flag */
|
195 |
+
);
|
196 |
+
|
197 |
+
return $ccArray;
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Assign data to info model instance
|
202 |
+
*
|
203 |
+
* @param mixed $data
|
204 |
+
* @return Mage_Payment_Model_Info
|
205 |
+
*/
|
206 |
+
public function assignData($data) {
|
207 |
+
if (!($data instanceof Varien_Object)) {
|
208 |
+
$data = new Varien_Object($data);
|
209 |
+
}
|
210 |
+
|
211 |
+
Mage::getSingleton('core/session')->setCcOwner($data->getCcOwner());
|
212 |
+
Mage::getSingleton('core/session')->setCcNumber($data->getCcNumber());
|
213 |
+
Mage::getSingleton('core/session')->setCcType($data->getCcType());
|
214 |
+
Mage::getSingleton('core/session')->setCcExpMonth($data->getCcExpMonth());
|
215 |
+
Mage::getSingleton('core/session')->setCcExpYear($data->getCcExpYear());
|
216 |
+
Mage::getSingleton('core/session')->setCcCid($data->getCcCid());
|
217 |
+
|
218 |
+
$value['profile_name'] = "";
|
219 |
+
foreach ($data as $value) {
|
220 |
+
if (isset($value['profile_name']) || @$value['profile_name'] != "Checkout with new card") {
|
221 |
+
Mage::getSingleton('core/session')->setCcProfileid(@$value['profile_name']);
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
$info = $this->getInfoInstance();
|
226 |
+
$info->setCcType($data->getCcType())
|
227 |
+
->setCcOwner($data->getCcOwner())
|
228 |
+
->setCcLast4(substr($data->getCcNumber(), -4))
|
229 |
+
->setCcNumber($data->getCcNumber())
|
230 |
+
->setCcCid($data->getCcCid())
|
231 |
+
->setCcExpMonth($data->getCcExpMonth())
|
232 |
+
->setCcExpYear($data->getCcExpYear())
|
233 |
+
->setCcSsIssue($data->getCcSsIssue())
|
234 |
+
->setCcSsStartMonth($data->getCcSsStartMonth())
|
235 |
+
->setCcSsStartYear($data->getCcSsStartYear())
|
236 |
+
;
|
237 |
+
return $this;
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Prepare info instance for save
|
242 |
+
*
|
243 |
+
* @return Mage_Payment_Model_Abstract
|
244 |
+
*/
|
245 |
+
public function prepareSave() {
|
246 |
+
$info = $this->getInfoInstance();
|
247 |
+
if ($this->_canSaveCc) {
|
248 |
$_cclength = strlen($info->getCcNumber());
|
249 |
if (is_numeric($info->getCcNumber()) && $_cclength < 20) {
|
250 |
$info->setCcNumberEnc($info->encrypt($info->getCcNumber()));
|
251 |
} else {
|
252 |
+
$info->setCcCidEnc($info->encrypt($info->getCcCid()));
|
253 |
return $this;
|
254 |
}
|
255 |
+
}
|
256 |
+
|
257 |
+
$info->setCcCidEnc($info->encrypt($info->getCcCid()));
|
258 |
+
|
259 |
+
return $this;
|
260 |
+
}
|
261 |
+
|
262 |
+
/** For Authorization * */
|
263 |
+
public function authService($order, $authAmount = "", $status = "") {
|
264 |
+
|
265 |
+
$orderId = $order->getIncrementId();
|
266 |
+
$merchid = $this->getConfigData('merchant' , $order->getStoreId());
|
267 |
+
|
268 |
+
if (empty($status)) {
|
269 |
+
$ccOwner = Mage::getSingleton('core/session')->getCcOwner();
|
270 |
+
$ccNumber = Mage::getSingleton('core/session')->getCcNumber();
|
271 |
+
$ccType = Mage::getSingleton('core/session')->getCcType();
|
272 |
+
$ccExpiry = Mage::getSingleton('core/session')->getCcExpMonth() . substr(Mage::getSingleton('core/session')->getCcExpYear(), 2);
|
273 |
+
$ccCvv2 = Mage::getSingleton('core/session')->getCcCid();
|
274 |
+
$price = number_format($order->getBaseGrandTotal(), 2, '.', '');
|
275 |
+
$profileId = Mage::getSingleton('core/session')->getCcProfileid();
|
276 |
+
} else {
|
277 |
+
// For Pratial Shipment Reauthorization
|
278 |
+
$quote_id = $order->getQuoteId();
|
279 |
+
$collection = Mage::getModel('sales/quote_payment')->getCollection()
|
280 |
+
->addFieldToFilter('quote_id', array('eq' => $quote_id));
|
281 |
+
|
282 |
+
foreach ($collection as $data) {
|
283 |
+
$ccOwner = $data->getData("cc_owner");
|
284 |
+
$ccType = $data->getData("cc_type");
|
285 |
$ccNumber = Mage::helper('core')->decrypt($data->getData("cc_number_enc"));
|
286 |
+
$ccExpiry = $data->getData("cc_exp_month") . substr($data->getData("cc_exp_year"), 2);
|
287 |
$ccCvv2 = Mage::helper('core')->decrypt($data->getData("cc_cid_enc"));
|
288 |
+
}
|
289 |
+
$price = $authAmount;
|
290 |
+
}
|
291 |
+
|
292 |
+
|
293 |
+
$billing = $order->getBillingAddress();
|
294 |
+
|
295 |
+
if (empty($status) || $status == "authFull") {
|
296 |
+
$checkout_trans = $this->getPaymentTransactionType();
|
297 |
+
} else {
|
298 |
+
$checkout_trans = "authorize_capture";
|
299 |
+
}
|
300 |
+
|
301 |
+
if ($checkout_trans == "authorize_capture") {
|
302 |
+
$captureStatus = "Y";
|
303 |
+
} else {
|
304 |
+
$captureStatus = "N";
|
305 |
+
}
|
306 |
+
|
307 |
+
if (strlen($ccExpiry) < 4) {
|
308 |
+
$ccExpiry = "0" . $ccExpiry;
|
309 |
+
}
|
310 |
+
|
311 |
+
if (!empty($profileId)) {
|
312 |
+
$param = array(
|
313 |
+
'profileid' => $profileId,
|
314 |
+
'order_id' => $orderId,
|
315 |
+
'currency_value' => $price,
|
316 |
+
'cvv_val' => $ccCvv2,
|
317 |
+
'ecomind' => "E",
|
318 |
+
'capture' => $captureStatus,
|
319 |
+
'tokenize' => 'Y');
|
320 |
+
} else {
|
321 |
+
$param = array(
|
322 |
+
'merchid' => $merchid,
|
323 |
+
'acc_type' => $ccType,
|
324 |
+
'order_id' => $orderId,
|
325 |
+
'acc_num' => $ccNumber,
|
326 |
+
'expirydt' => $ccExpiry,
|
327 |
+
'currency_value' => $price,
|
328 |
+
'currency' => "USD",
|
329 |
+
'cc_owner' => $ccOwner,
|
330 |
+
'billing_street_address' => $billing->getStreet(1),
|
331 |
+
'billing_city' => $billing->getCity(),
|
332 |
+
'billing_state' => $billing->getRegionCode(),
|
333 |
+
'billing_country' => $billing->getCountry(),
|
334 |
+
'billing_postcode' => $billing->getPostcode(),
|
335 |
+
'ecomind' => "E",
|
336 |
+
'cvv_val' => $ccCvv2,
|
337 |
+
'track' => null,
|
338 |
+
'capture' => $captureStatus,
|
339 |
+
'tokenize' => 'Y');
|
340 |
+
}
|
341 |
+
|
342 |
+
$cc = Mage::helper('ccgateway')->getCardConnectWebService($order);
|
343 |
+
$resp = $cc->authService($param);
|
344 |
+
|
345 |
+
if (empty($status)) {
|
346 |
+
Mage::getSingleton('core/session')->unsCcOwner();
|
347 |
+
Mage::getSingleton('core/session')->unsCcNumber();
|
348 |
+
Mage::getSingleton('core/session')->unsCcType();
|
349 |
+
Mage::getSingleton('core/session')->unsCcExpMonth();
|
350 |
+
Mage::getSingleton('core/session')->unsCcExpYear();
|
351 |
+
Mage::getSingleton('core/session')->unsCcCid();
|
352 |
+
Mage::getSingleton('core/session')->unsCcProfileid();
|
353 |
+
}
|
354 |
+
|
355 |
+
if ($resp != "") {
|
356 |
+
$response = json_decode($resp, true);
|
357 |
+
|
358 |
+
$response['orderid'] = $orderId;
|
359 |
+
|
360 |
+
if (!empty($status)) {
|
361 |
+
$response['action'] = $checkout_trans;
|
362 |
+
$response['merchid'] = $merchid;
|
363 |
+
$response['setlstat'] = "";
|
364 |
+
$response['voidflag'] = "";
|
365 |
+
|
366 |
+
// Save Partial Authorization Response data
|
367 |
+
$this->saveResponseData($response);
|
368 |
+
if($response['respcode']==00){
|
369 |
+
// Set custom order status
|
370 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_processing', $response['resptext'])->save();
|
371 |
+
}else{
|
372 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_reject', $response['resptext'])->save();
|
373 |
+
$response= array('resptext' => "CardConnect_Error");
|
374 |
+
}
|
375 |
+
}
|
376 |
+
} else {
|
377 |
+
$myLogMessage = "CC Authorization : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
378 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
379 |
+
|
380 |
+
// Set custom order status
|
381 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_reject', "Invalid response from CardConnect.")->save();
|
382 |
+
$response= array('resptext' => "CardConnect_Error");
|
383 |
+
|
384 |
+
}
|
385 |
+
|
386 |
+
|
387 |
+
return $response;
|
388 |
+
}
|
389 |
+
|
390 |
+
|
391 |
+
|
392 |
+
/** For capture * */
|
393 |
+
public function capture(Varien_Object $payment, $amount) {
|
394 |
+
|
395 |
+
if (!$this->canCapture()) {
|
396 |
+
return $this;
|
397 |
+
}
|
398 |
+
|
399 |
+
if ($amount <= 0) {
|
400 |
+
Mage::throwException(Mage::helper('ccgateway')->__('Invalid amount for capture.'));
|
401 |
+
}
|
402 |
+
$order = $payment->getOrder();
|
403 |
+
$orderId = $order->increment_id;
|
404 |
+
$fullAuthorizedAmount = $order->getBaseGrandTotal();
|
405 |
+
if (strpos('.', $amount) == "") {
|
406 |
+
$amount = number_format($amount, 2);
|
407 |
+
$fullAuthorizedAmount = number_format($fullAuthorizedAmount, 2);
|
408 |
+
}
|
409 |
+
$amount = str_replace(",", "", $amount);
|
410 |
+
$fullAuthorizedAmount = str_replace(",", "", $fullAuthorizedAmount);
|
411 |
+
|
412 |
+
$canCapture = $this->checkCaptureOnceDone($orderId);
|
413 |
+
if ($canCapture == TRUE) {
|
414 |
+
$this->authService($order, $amount, "authPartial");
|
415 |
+
} else {
|
416 |
+
$retref = $this->getRetrefReferenceNumber($orderId);
|
417 |
+
$authCode = $this->getAuthCode($orderId);
|
418 |
+
$checkout_trans = $this->getPaymentTransactionType();
|
419 |
+
$merchid = $this->getConfigData('merchant' , $payment->getOrder()->getStoreId());
|
420 |
+
|
421 |
+
$cc = Mage::helper('ccgateway')->getCardConnectWebService($order);
|
422 |
+
|
423 |
+
if ($fullAuthorizedAmount == $amount) {
|
424 |
+
$resp = $cc->captureService($retref, $authCode, $amount, $orderId);
|
425 |
+
} else {
|
426 |
+
$amountForVoid = $fullAuthorizedAmount - $amount;
|
427 |
+
$this->voidService($order, $amountForVoid, "Partial");
|
428 |
+
$resp = $cc->captureService($retref, $authCode, $amount, $orderId);
|
429 |
+
}
|
430 |
+
|
431 |
+
if ($resp != "") {
|
432 |
+
if ($checkout_trans != "authorize_capture") {
|
433 |
+
$response = json_decode($resp, true);
|
434 |
+
|
435 |
+
$response['action'] = "Capture";
|
436 |
+
$response['orderid'] = $orderId;
|
437 |
+
$response['merchid'] = $merchid;
|
438 |
+
$response['authcode'] = "";
|
439 |
+
$response['voidflag'] = "";
|
440 |
+
|
441 |
+
// Save Capture Response data
|
442 |
+
$this->saveResponseData($response);
|
443 |
+
// Set custom order status
|
444 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, 'cardconnect_capture', $response['setlstat'])->save();
|
445 |
+
}
|
446 |
+
} else {
|
447 |
+
$myLogMessage = "CC Capture : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
448 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
449 |
+
|
450 |
+
// Set custom order status
|
451 |
+
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', "Invalid response from CardConnect.")->save();
|
452 |
+
$errorMsg = "Unable to perform operation. Please consult the Magento log for additional information.";
|
453 |
+
Mage::throwException($errorMsg);
|
454 |
+
|
455 |
+
}
|
456 |
+
}
|
457 |
+
|
458 |
+
return $this;
|
459 |
+
}
|
460 |
+
|
461 |
+
// Check capture once performed for an order
|
462 |
+
function checkCaptureOnceDone($orderId) {
|
463 |
+
|
464 |
+
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->getCollection()
|
465 |
+
->addFieldToFilter('CC_ORDERID', array('eq' => $orderId))
|
466 |
+
->addFieldToSelect('CC_ACTION');
|
467 |
+
|
468 |
+
$cc_action = array();
|
469 |
+
foreach ($collection as $data) {
|
470 |
+
$cc_action[] = $data->getData('CC_ACTION');
|
471 |
+
}
|
472 |
+
if (in_array("Capture", $cc_action)) {
|
473 |
+
$c_status = TRUE;
|
474 |
+
} else {
|
475 |
+
$c_status = FALSE;
|
476 |
+
}
|
477 |
+
|
478 |
+
return $c_status;
|
479 |
+
}
|
480 |
+
|
481 |
+
// Void function using web services
|
482 |
+
public function voidService($order, $partialAmount = "", $action = "") {
|
483 |
+
|
484 |
+
$orderId = $order->getIncrementId();
|
485 |
+
$retref = $this->getRetrefReferenceNumber($orderId);
|
486 |
+
if (empty($partialAmount)) {
|
487 |
+
$amount = $order->getBaseGrandTotal();
|
488 |
+
} else {
|
489 |
+
$amount = $partialAmount;
|
490 |
+
}
|
491 |
+
|
492 |
+
if (strpos('.', $amount) == "") {
|
493 |
+
$amount = number_format($amount, 2);
|
494 |
+
}
|
495 |
+
$amount = str_replace(",", "", $amount);
|
496 |
+
|
497 |
+
$cc = Mage::helper('ccgateway')->getCardConnectWebService($order);
|
498 |
+
$resp = $cc->voidService($retref, $amount);
|
499 |
+
|
500 |
+
if ($resp != "") {
|
501 |
+
$response = json_decode($resp, true);
|
502 |
+
$response['action'] = "Void";
|
503 |
+
$response['orderid'] = $orderId;
|
504 |
+
$response['setlstat'] = "";
|
505 |
+
$response['voidflag'] = "";
|
506 |
+
|
507 |
+
// Save Void Response data
|
508 |
+
$this->saveResponseData($response);
|
509 |
+
|
510 |
+
if (empty($action)) {
|
511 |
+
// Set custom order status
|
512 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_void', $response['resptext'])->save();
|
513 |
+
}
|
514 |
+
} else {
|
515 |
+
$myLogMessage = "CC Void : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
516 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
517 |
+
|
518 |
+
// Set custom order status
|
519 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_reject', "Invalid response from CardConnect.")->save();
|
520 |
+
|
521 |
+
$errorMsg = "Unable to perform operation. Please consult the Magento log for additional information.";
|
522 |
+
Mage::throwException($errorMsg);
|
523 |
+
|
524 |
+
}
|
525 |
+
|
526 |
+
return $response;
|
527 |
+
}
|
528 |
+
|
529 |
+
// Check the Capture status for a current order
|
530 |
+
public function getVoidStatus($order) {
|
531 |
+
|
532 |
+
$orderId = $order->getIncrementId();
|
533 |
+
|
534 |
+
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->getCollection()
|
535 |
+
->addFieldToFilter('CC_ORDERID', array('eq' => $orderId))
|
536 |
+
->addFieldToSelect('CC_ACTION');
|
537 |
+
|
538 |
+
$cc_action = array();
|
539 |
+
foreach ($collection as $data) {
|
540 |
+
$cc_action[] = $data->getData('CC_ACTION');
|
541 |
+
}
|
542 |
+
if (in_array("Void", $cc_action)) {
|
543 |
+
$c_status = false;
|
544 |
+
} else {
|
545 |
+
$c_status = true;
|
546 |
+
}
|
547 |
+
|
548 |
+
return $c_status;
|
549 |
+
}
|
550 |
+
|
551 |
+
// Check payment settlement satatus before refund
|
552 |
+
|
553 |
+
public function processBeforeRefund($invoice, $payment) {
|
554 |
+
$order = $payment->getOrder();
|
555 |
+
$orderId = $order->increment_id;
|
556 |
+
$retref = $this->getRetrefReferenceNumber($orderId, "Refund");
|
557 |
+
|
558 |
+
$cc = Mage::helper('ccgateway')->getCardConnectWebService($order);
|
559 |
+
|
560 |
+
$resp = $cc->inquireService($retref);
|
561 |
+
$response = json_decode($resp, true);
|
562 |
+
|
563 |
+
if ($response['setlstat'] == "Accepted") {
|
564 |
+
$status = "true";
|
565 |
+
Mage::log('Txn settled for your order Id: ' . $orderId);
|
566 |
+
} else {
|
567 |
+
$status = "false";
|
568 |
+
Mage::throwException("Refund cannot be processed, transaction should be settled first.");
|
569 |
+
}
|
570 |
+
|
571 |
+
return $this;
|
572 |
+
}
|
573 |
+
|
574 |
+
// Refund function using web services
|
575 |
+
|
576 |
+
public function refund(Varien_Object $payment, $amount) {
|
577 |
+
|
578 |
+
if (!$this->canRefund()) {
|
579 |
+
return $this;
|
580 |
+
}
|
581 |
+
|
582 |
+
$order = $payment->getOrder();
|
583 |
+
$orderId = $order->increment_id;
|
584 |
+
$retref = $this->getRetrefReferenceNumber($orderId, "Refund");
|
585 |
+
$merchid = $this->getConfigData('merchant' , $payment->getOrder()->getStoreId());
|
586 |
+
|
587 |
+
if ($amount <= 0) {
|
588 |
+
Mage::throwException(Mage::helper('ccgateway')->__('Invalid amount for refund.'));
|
589 |
+
}
|
590 |
+
|
591 |
+
if (strpos('.', $amount) == "") {
|
592 |
+
$amount = number_format($amount, 2);
|
593 |
+
}
|
594 |
+
|
595 |
+
$amount = str_replace(",", "", $amount);
|
596 |
+
|
597 |
+
$cc = Mage::helper('ccgateway')->getCardConnectWebService($order);
|
598 |
+
$resp = $cc->refundService($retref, $amount);
|
599 |
+
|
600 |
+
if ($resp != "") {
|
601 |
+
$response = json_decode($resp, true);
|
602 |
+
|
603 |
+
$response['action'] = "Refund";
|
604 |
+
$response['orderid'] = $orderId;
|
605 |
+
$response['merchid'] = $merchid;
|
606 |
+
$response['setlstat'] = "";
|
607 |
+
$response['authcode'] = "";
|
608 |
+
$response['voidflag'] = "";
|
609 |
+
|
610 |
+
// Save Refund Response data
|
611 |
+
$this->saveResponseData($response);
|
612 |
+
// Set custom order status
|
613 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_refund', $response['resptext'])->save();
|
614 |
+
} else {
|
615 |
+
|
616 |
+
$myLogMessage = "CC Refund : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
617 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
618 |
+
|
619 |
+
// Set custom order status
|
620 |
+
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', "Invalid response from CardConnect.")->save();
|
621 |
+
$errorMsg = "Unable to perform operation. Please consult the Magento log for additional information.";
|
622 |
+
Mage::throwException($errorMsg);
|
623 |
+
|
624 |
+
}
|
625 |
+
|
626 |
+
return $this;
|
627 |
+
}
|
628 |
+
|
629 |
+
// Inquire function using web services
|
630 |
+
public function inquireService($orderId) {
|
631 |
+
|
632 |
+
$order = Mage::getModel('sales/order');
|
633 |
+
$order->loadByIncrementId($orderId);
|
634 |
+
$responseData = $this->getResponseDataByOrderId($orderId);
|
635 |
+
$cc_password = $this->getConfigData('password', $order->getStoreId());
|
636 |
+
|
637 |
+
|
638 |
+
$response = "";
|
639 |
+
$errorMsg = 0;
|
640 |
+
$message = "";
|
641 |
+
|
642 |
+
if ($cc_password != "") {
|
643 |
+
if ($responseData->count() != 0) {
|
644 |
+
foreach ($responseData as $data) {
|
645 |
+
$ccId = $data->getData('CC_ID');
|
646 |
+
$ccAction = $data->getData('CC_ACTION');
|
647 |
+
$retref = $data->getData('CC_RETREF');
|
648 |
+
$order_amount = $data->getData('CC_AMT');
|
649 |
+
$setlstat = $data->getData('CC_SETLSTAT');
|
650 |
+
|
651 |
+
$cc = Mage::helper('ccgateway')->getCardConnectWebService($order);
|
652 |
+
$resp = $cc->inquireService($retref);
|
653 |
+
$response = json_decode($resp, true);
|
654 |
+
if (!empty($response)) {
|
655 |
+
if (abs($response['amount']) == $order_amount || abs($response['amount']) == '0.00') {
|
656 |
+
if ($response['setlstat'] == 'Accepted' || $response['setlstat'] == 'Voided') {
|
657 |
+
if ($ccAction == 'Refund') {
|
658 |
+
$order->setState(Mage_Sales_Model_Order::STATE_REFUNDED, 'cardconnect_refund', $response['setlstat'])->save();
|
659 |
+
}
|
660 |
+
if ($ccAction == 'authorize' || $ccAction == 'authorize_capture') {
|
661 |
+
if ($response['setlstat'] == 'Voided') {
|
662 |
+
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_void', $response['setlstat'])->save();
|
663 |
+
} else if ($response['setlstat'] == 'Accepted') {
|
664 |
+
$order->setState(Mage_Sales_Model_Order::STATE_COMPLETE, 'cardconnect_txn_settled', $response['setlstat'])->save();
|
665 |
+
}
|
666 |
+
}
|
667 |
+
if ($ccAction == 'Void') {
|
668 |
+
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_void', $response['setlstat'])->save();
|
669 |
+
}
|
670 |
+
} else if ($response['setlstat'] == 'Rejected') {
|
671 |
+
// Do not update order status for refund
|
672 |
+
}
|
673 |
+
|
674 |
+
$stat = strpos($setlstat, $response['setlstat']);
|
675 |
+
if ($stat !== false) {
|
676 |
+
$message = "status matched";
|
677 |
+
Mage::log('Current status matched with Inquire status');
|
678 |
+
} else if ($response['setlstat'] !== 'Authorized' && $response['setlstat'] !== 'Queued for Capture' && $response['setlstat'] !== '' && $response['setlstat'] !== 'Refunded') {
|
679 |
+
$fields = array('CC_SETLSTAT' => $response['setlstat']);
|
680 |
+
$this->updateAfterInquireService($fields, $ccId);
|
681 |
+
}
|
682 |
+
} else if ($ccAction == 'Refund') {
|
683 |
+
$cmp_setlstat = strpos($response['setlstat'], $setlstat);
|
684 |
+
if ($cmp_setlstat !== false) {
|
685 |
+
$message = "status matched";
|
686 |
+
Mage::log('Current Refund status matched with Inquire status');
|
687 |
+
} else {
|
688 |
+
$fields = array('CC_SETLSTAT' => $response['setlstat']);
|
689 |
+
$this->updateAfterInquireService($fields, $ccId);
|
690 |
+
}
|
691 |
+
}
|
692 |
+
} else {
|
693 |
+
$errorMsg = 1;
|
694 |
+
$myLogMessage = "CC Inquire : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
695 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
696 |
+
|
697 |
+
}
|
698 |
+
}
|
699 |
+
} else {
|
700 |
+
$message = "status matched";
|
701 |
+
}
|
702 |
+
} else {
|
703 |
+
Mage::log("Unable to get decrypted password");
|
704 |
+
}
|
705 |
+
|
706 |
+
if ($message == "status matched") {
|
707 |
+
$message = "Current status matched with Inquire status";
|
708 |
+
} else if ($errorMsg == 1) {
|
709 |
+
$message = "There is some problem in inquire services";
|
710 |
+
} else {
|
711 |
+
$message = "Successfully Inquired";
|
712 |
+
}
|
713 |
+
|
714 |
+
return $message;
|
715 |
+
}
|
716 |
+
|
717 |
+
// Create Profile webservices
|
718 |
+
function createProfileService($paymentInformation) {
|
719 |
+
|
720 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
721 |
+
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
722 |
+
$ccUserId = $customerData->getId();
|
723 |
+
}
|
724 |
+
|
725 |
+
$ccCardName = $paymentInformation['cc_profile_name'];
|
726 |
+
$ccExpiry = $paymentInformation['cc_exp_month'] . substr($paymentInformation['cc_exp_year'], 2);
|
727 |
+
if (strlen($ccExpiry) < 4) {
|
728 |
+
$ccExpiry = "0" . $ccExpiry;
|
729 |
+
}
|
730 |
+
|
731 |
+
$profrequest = array(
|
732 |
+
'defaultacct' => "N",
|
733 |
+
'profile' => "",
|
734 |
+
'profileupdate' => "N",
|
735 |
+
'account' => $paymentInformation['cc_number'],
|
736 |
+
'accttype' => $paymentInformation['cc_type'],
|
737 |
+
'expiry' => $ccExpiry,
|
738 |
+
'name' => $paymentInformation['cc_owner'],
|
739 |
+
'address' => $paymentInformation['cc_street'],
|
740 |
+
'city' => $paymentInformation['cc_city'],
|
741 |
+
'region' => $paymentInformation['cc_region'],
|
742 |
+
'country' => $paymentInformation['cc_country'],
|
743 |
+
'phone' => $paymentInformation['cc_telephone'],
|
744 |
+
'postal' => $paymentInformation['cc_postcode']
|
745 |
+
);
|
746 |
+
|
747 |
+
$cc = Mage::helper('ccgateway')->getCardConnectWebService();
|
748 |
+
$resp = $cc->createProfileService($profrequest);
|
749 |
+
|
750 |
+
if ($resp != "") {
|
751 |
+
$response = json_decode($resp, true);
|
752 |
+
|
753 |
+
if ($response['resptext'] == "Profile Saved") {
|
754 |
+
$response['ccUserId'] = $ccUserId;
|
755 |
+
$response['ccCardName'] = $ccCardName;
|
756 |
+
if ($this->hasWalletCard($response['ccUserId']) == "Yes") {
|
757 |
+
$response['defaultacct'] = "N";
|
758 |
+
} else {
|
759 |
+
$response['defaultacct'] = "Y";
|
760 |
+
}
|
761 |
+
|
762 |
+
// Save Refund Response data
|
763 |
+
$this->saveResponseData($response, "Wallat");
|
764 |
+
}
|
765 |
+
} else {
|
766 |
+
$myLogMessage = "CC Create Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
767 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
768 |
+
$response= array('resptext' => "CardConnect_Error");
|
769 |
+
}
|
770 |
+
|
771 |
+
return $response;
|
772 |
+
}
|
773 |
+
|
774 |
+
// Function for Get Profile webservices
|
775 |
+
function getProfileWebService($profileId, $cc_id) {
|
776 |
+
|
777 |
+
$cc = Mage::helper('ccgateway')->getCardConnectWebService();
|
778 |
+
|
779 |
+
$resp = $cc->getProfileService($profileId);
|
780 |
+
if (!empty($resp) && $cc_id != "") {
|
781 |
+
$resource = Mage::getSingleton('core/resource');
|
782 |
+
$readConnection = $resource->getConnection('core_read');
|
783 |
+
$getTable = $resource->getTableName('cardconnect_wallet');
|
784 |
+
|
785 |
+
$selQry = "SELECT CC_CARD_NAME FROM {$getTable} WHERE CC_ID=" . $cc_id;
|
786 |
+
$rsCard = $readConnection->fetchRow($selQry);
|
787 |
+
$resp = json_decode($resp, true);
|
788 |
+
$resp[] = $rsCard['CC_CARD_NAME'];
|
789 |
+
} else {
|
790 |
+
$myLogMessage = "CC Get Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
791 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
792 |
+
$resp[] = array('resptext' => "CardConnect_Error");
|
793 |
+
|
794 |
+
}
|
795 |
+
|
796 |
+
return $resp;
|
797 |
+
}
|
798 |
+
|
799 |
+
// Function for Get Profile webservices Checkout
|
800 |
+
function getProfileWebServiceCheckout($profileId) {
|
801 |
+
|
802 |
+
$cc = Mage::helper('ccgateway')->getCardConnectWebService();
|
803 |
+
$resp = $cc->getProfileService($profileId);
|
804 |
+
if (empty($resp)) {
|
805 |
+
$myLogMessage = "CC Get Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
806 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
807 |
+
$resp[] = array('resptext' => "CardConnect_Error");
|
808 |
+
}
|
809 |
+
|
810 |
+
return $resp;
|
811 |
+
}
|
812 |
+
|
813 |
+
// Function for Delete Profile webservices
|
814 |
+
|
815 |
+
function deleteWalletDataService($profileRowId, $ccUserId= "") {
|
816 |
+
|
817 |
+
if(empty($ccUserId)){
|
818 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
819 |
+
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
820 |
+
$ccUserId = $customerData->getId();
|
821 |
+
}
|
822 |
+
}
|
823 |
+
|
824 |
+
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_wallet')->getCollection()
|
825 |
+
->addFieldToFilter('CC_ID', array('eq' => $profileRowId))
|
826 |
+
->addFieldToFilter('CC_USER_ID', array('eq' => $ccUserId))
|
827 |
+
->addFieldToSelect("*");
|
828 |
+
|
829 |
+
foreach ($collection as $data) {
|
830 |
+
$ccProfileId = $data->getData('CC_PROFILEID');
|
831 |
+
$tokenNum = $data->getData('CC_MASK');
|
832 |
+
}
|
833 |
+
|
834 |
+
|
835 |
+
if (!empty($tokenNum)) {
|
836 |
+
$cc = Mage::helper('ccgateway')->getCardConnectWebService();
|
837 |
+
$resp = $cc->deleteProfileService($ccProfileId);
|
838 |
+
|
839 |
+
if (!empty($resp)) {
|
840 |
+
$response = json_decode($resp, true);
|
841 |
+
|
842 |
+
if (($response['resptext'] === "Profile Deleted") || ($response['resptext'] === "Profile not found")) {
|
843 |
+
$resource = Mage::getSingleton('core/resource');
|
844 |
+
$writeConnection = $resource->getConnection('core_write');
|
845 |
+
|
846 |
+
$getTable = $resource->getTableName('cardconnect_wallet');
|
847 |
+
// Query to delete cardconnect_wallet table
|
848 |
+
$delQry = "DELETE FROM {$getTable} WHERE CC_ID=" . $profileRowId." AND CC_USER_ID=". $ccUserId;
|
849 |
+
$writeConnection->query($delQry);
|
850 |
+
$msg = "Card has been deleted successfully.";
|
851 |
+
} else {
|
852 |
+
$msg = "We are unable to perform the requested action, please contact customer service.";
|
853 |
+
$myLogMessage = "CC Delete Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
854 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
855 |
+
$myMessage = "CC Delete Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$response['resptext'];
|
856 |
+
Mage::log($myMessage, Zend_Log::ERR , "cc.log" );
|
857 |
+
}
|
858 |
+
} else {
|
859 |
+
$myLogMessage = "CC Delete Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
860 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
861 |
+
$msg = "We are unable to perform the requested action, please contact customer service.";
|
862 |
+
}
|
863 |
+
}else{
|
864 |
+
$myLogMessage = "CC Delete Profile Service : ". __FILE__ . " @ " . __LINE__;
|
865 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
866 |
+
$msg = "We are unable to perform the requested action, please contact customer service.";
|
867 |
+
}
|
868 |
+
|
869 |
+
return $msg;
|
870 |
+
}
|
871 |
+
|
872 |
+
// Update Profile webservices
|
873 |
+
function updateProfileService($paymentInformation) {
|
874 |
+
$username = $this->getConfigData('username');
|
875 |
+
$merchid = $this->getConfigData('merchant');
|
876 |
+
$cc_password = $this->getConfigData('password');
|
877 |
+
|
878 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
879 |
+
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
880 |
+
$ccUserId = $customerData->getId();
|
881 |
+
$ccCardName = $paymentInformation['cc_profile_name'];
|
882 |
+
$cc_id = $paymentInformation['wallet_id'];
|
883 |
+
}
|
884 |
+
|
885 |
+
$ccExpiry = $paymentInformation['cc_exp_month'] . substr($paymentInformation['cc_exp_year'], 2);
|
886 |
+
if (strlen($ccExpiry) < 4) {
|
887 |
+
$ccExpiry = "0" . $ccExpiry;
|
888 |
+
}
|
889 |
+
|
890 |
+
|
891 |
+
$profrequest = array(
|
892 |
+
'defaultacct' => $paymentInformation['defaultacct'],
|
893 |
+
'profile' => $paymentInformation['profile'],
|
894 |
+
'profileupdate' => $paymentInformation['profileupdate'],
|
895 |
+
'account' => $paymentInformation['cc_number'],
|
896 |
+
'accttype' => $paymentInformation['cc_type'],
|
897 |
+
'expiry' => $ccExpiry,
|
898 |
+
'name' => $paymentInformation['cc_owner'],
|
899 |
+
'address' => $paymentInformation['cc_street'],
|
900 |
+
'city' => $paymentInformation['cc_city'],
|
901 |
+
'region' => $paymentInformation['cc_region'],
|
902 |
+
'country' => $paymentInformation['cc_country'],
|
903 |
+
'phone' => $paymentInformation['cc_telephone'],
|
904 |
+
'postal' => $paymentInformation['cc_postcode']
|
905 |
+
);
|
906 |
+
|
907 |
+
|
908 |
+
$cc = Mage::helper('ccgateway')->getCardConnectWebService();
|
909 |
+
$resp = $cc->createProfileService($profrequest);
|
910 |
+
if ($resp != "") {
|
911 |
+
$response = json_decode($resp, true);
|
912 |
+
if ($response['resptext'] == "Profile Saved") {
|
913 |
+
$fields = array('CC_CARD_NAME' => $ccCardName, 'CC_MASK' => $response['token']);
|
914 |
+
$connectionWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
|
915 |
+
$connectionWrite->beginTransaction();
|
916 |
+
$where = $connectionWrite->quoteInto('CC_ID =?', $cc_id);
|
917 |
+
$connectionWrite->update('cardconnect_wallet', $fields, $where);
|
918 |
+
$connectionWrite->commit();
|
919 |
+
$response = "Profile Updated";
|
920 |
+
} else {
|
921 |
+
$errorMessage = "There is some problem in update profile. Due to " . $response['resptext'];
|
922 |
+
Mage::log($errorMessage, Zend_Log::ERR, "cc.log");
|
923 |
+
}
|
924 |
+
} else {
|
925 |
+
$myLogMessage = "CC Update Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
926 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
927 |
+
}
|
928 |
+
|
929 |
+
|
930 |
+
return $response;
|
931 |
+
}
|
932 |
+
|
933 |
+
// Check has wallet card
|
934 |
+
function hasWalletCard($customerID) {
|
935 |
+
|
936 |
+
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_wallet')->getCollection()
|
937 |
+
->addFieldToFilter('CC_USER_ID', array('eq' => $customerID))
|
938 |
+
->addFieldToSelect("CC_USER_ID");
|
939 |
+
|
940 |
+
$ccProfileId = "";
|
941 |
+
foreach ($collection as $data) {
|
942 |
+
$ccProfileId = $data->getData('CC_USER_ID');
|
943 |
+
}
|
944 |
+
|
945 |
+
if ($ccProfileId != null) {
|
946 |
+
$msg = "Yes";
|
947 |
+
} else {
|
948 |
+
$msg = "No";
|
949 |
+
}
|
950 |
+
|
951 |
+
return $msg;
|
952 |
+
}
|
953 |
+
|
954 |
+
// function for get data from response table by order id
|
955 |
+
|
956 |
+
public function getResponseDataByOrderId($orderId) {
|
957 |
+
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->getCollection()
|
958 |
+
->addFieldToFilter('CC_ORDERID', array('eq' => $orderId))
|
959 |
+
->addFieldToFilter('CC_SETLSTAT', array(
|
960 |
+
array('nin' => array('Accepted', 'Voided')),
|
961 |
+
array('null' => true),
|
962 |
+
)
|
963 |
+
);
|
964 |
+
|
965 |
+
return $collection;
|
966 |
+
}
|
967 |
+
|
968 |
+
// Update response table after Inquire webservices
|
969 |
+
protected function updateAfterInquireService($fields, $ccgateway_id) {
|
970 |
+
|
971 |
+
$connectionWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
|
972 |
+
$connectionWrite->beginTransaction();
|
973 |
+
$where = $connectionWrite->quoteInto('CC_ID =?', $ccgateway_id);
|
974 |
+
$connectionWrite->update('cardconnect_resp', $fields, $where);
|
975 |
+
$connectionWrite->commit();
|
976 |
+
|
977 |
+
return $this;
|
978 |
+
}
|
979 |
+
|
980 |
+
// Save response date to ccgateway table
|
981 |
+
public function saveResponseData($response, $table = "") {
|
982 |
+
|
983 |
+
|
984 |
+
if ($table == "Wallat") {
|
985 |
+
$ccMask = substr_replace(@$response['token'], '************', 0, 12);
|
986 |
+
|
987 |
+
$data = array('CC_USER_ID' => $response['ccUserId'], /* Checkout Transaction Type */
|
988 |
+
'CC_PROFILEID' => $response['profileid'], /* Retrieval Reference Number */
|
989 |
+
'CC_ACCTID' => $response['acctid'], /* Capture Amount */
|
990 |
+
'CC_MASK' => $ccMask, /* Masked number */
|
991 |
+
'CC_CARD_NAME' => $response['ccCardName'], /* Order Id */
|
992 |
+
'CC_DEFAULT_CARD' => @$response['defaultacct'], /* Token */
|
993 |
+
'CC_CREATED' => now() /* Request's response time */
|
994 |
+
);
|
995 |
+
$model = Mage::getModel('cardconnect_ccgateway/cardconnect_wallet')->setData($data);
|
996 |
+
} else {
|
997 |
+
$retref = $response['retref'];
|
998 |
+
// $ccToken = @$response['token'];
|
999 |
if (!empty($response['token'])){
|
1000 |
$ccToken = @$response['token'];
|
1001 |
} else {
|
1002 |
$ccToken ="";
|
1003 |
}
|
1004 |
|
1005 |
+
|
1006 |
+
$data = array('CC_ACTION' => $response['action'], /* Checkout Transaction Type */
|
1007 |
+
'CC_RETREF' => "$retref", /* Retrieval Reference Number */
|
1008 |
+
'CC_AMT' => @$response['amount'], /* Capture Amount */
|
1009 |
+
'CC_AUTHCODE' => @$response['authcode'], /* Authorization code */
|
1010 |
+
'CC_ORDERID' => $response['orderid'], /* Order Id */
|
1011 |
+
'CC_TOKEN' => $ccToken, /* Token */
|
1012 |
+
'CC_AVSRESP' => @$response['avsresp'], /* AVS Result */
|
1013 |
+
'CC_CVVRESP' => @$response['cvvresp'], /* CVV Result */
|
1014 |
+
'CC_RESPTEXT' => $response['resptext'], /* Response Description */
|
1015 |
+
'CC_MERCHID' => @$response['merchid'], /* Merchant Id */
|
1016 |
+
'CC_RESPPROC' => $response['respproc'], /* Response Processor */
|
1017 |
+
'CC_RESPCODE' => $response['respcode'], /* Response Code */
|
1018 |
+
'CC_RESPSTAT' => $response['respstat'], /* Response Status */
|
1019 |
+
'CC_SETLSTAT' => @$response['setlstat'], /* settlement Status */
|
1020 |
+
'CC_VOIDED' => $response['voidflag'], /* Void Flag */
|
1021 |
+
'CC_CREATED' => now() /* Request's response time */
|
1022 |
+
);
|
1023 |
+
$model = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->setData($data);
|
1024 |
+
}
|
1025 |
+
$model->save();
|
1026 |
+
}
|
1027 |
+
|
1028 |
+
// Function for get Authcode
|
1029 |
+
public function getAuthCode($currentOrderId) {
|
1030 |
+
|
1031 |
+
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->getCollection()
|
1032 |
+
->addFieldToFilter('CC_ORDERID', array('eq' => $currentOrderId))
|
1033 |
+
->addFieldToSelect('CC_AUTHCODE');
|
1034 |
+
|
1035 |
+
$authDesc = "";
|
1036 |
+
foreach ($collection as $data) {
|
1037 |
+
$authDesc = $data->getData('CC_AUTHCODE');
|
1038 |
+
}
|
1039 |
+
|
1040 |
+
return $authDesc;
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
// Function for get retref refrence number
|
1044 |
+
public function getRetrefReferenceNumber($currentOrderId, $action = "") {
|
1045 |
+
|
1046 |
+
$collection = Mage::getModel('cardconnect_ccgateway/cardconnect_resp')->getCollection()
|
1047 |
+
->addFieldToFilter('CC_ORDERID', array('eq' => $currentOrderId))
|
1048 |
+
->addFieldToSelect('CC_RETREF');
|
1049 |
+
if ($action !== "Refund") {
|
1050 |
+
$collection->setOrder('CC_CREATED', 'DESC');
|
1051 |
+
}
|
1052 |
+
$collection->getSelect()->limit(1);
|
1053 |
+
|
1054 |
+
$retrefRefrenceNumber = "";
|
1055 |
+
foreach ($collection as $data) {
|
1056 |
+
$retrefRefrenceNumber = $data->getData('CC_RETREF');
|
1057 |
+
}
|
1058 |
+
|
1059 |
+
return $retrefRefrenceNumber;
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
/**
|
1063 |
+
* Retrieve information from payment configuration
|
1064 |
+
*
|
1065 |
+
* @param string $field
|
1066 |
+
* @param int|string|null|Mage_Core_Model_Store $storeId
|
1067 |
+
*
|
1068 |
+
* @return mixed
|
1069 |
+
*/
|
1070 |
+
public function getConfigData($field, $storeId = null)
|
1071 |
+
{
|
1072 |
+
|
1073 |
+
$path = 'payment/'.$this->getCode().'/'.$field;
|
1074 |
+
|
1075 |
+
if(empty($storeId)){
|
1076 |
+
if(Mage::app()->getStore()->getCode() == Mage_Core_Model_Store::ADMIN_CODE) {
|
1077 |
+
$storeId = Mage::getSingleton('adminhtml/session_quote')->getStoreId();
|
1078 |
+
return Mage::getStoreConfig($path, $storeId);
|
1079 |
+
}else {
|
1080 |
+
return Mage:: getStoreConfig($path);
|
1081 |
+
}
|
1082 |
+
}else{
|
1083 |
+
return Mage::getStoreConfig($path, $storeId);
|
1084 |
+
}
|
1085 |
+
}
|
1086 |
+
|
1087 |
+
|
1088 |
+
}
|
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.
|
39 |
</Cardconnect_Ccgateway>
|
40 |
</modules>
|
41 |
<global>
|
35 |
<config>
|
36 |
<modules>
|
37 |
<Cardconnect_Ccgateway>
|
38 |
+
<version>1.0.8.2</version>
|
39 |
</Cardconnect_Ccgateway>
|
40 |
</modules>
|
41 |
<global>
|
package.xml
CHANGED
@@ -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>2015-12-
|
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="7e142307517c59a3b5b07dbbc4cae6e8"/><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>
|
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>2015-12-31</date>
|
14 |
+
<time>07:55:51</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="7e142307517c59a3b5b07dbbc4cae6e8"/><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="64bb8be78aa98e9cecc70010e2bf7b50"/><file name="cardconnect_webservice.php" hash="baa5a5999739784325d0523a98a8b723"/></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="b0847bee66b63d057500a06d2102d034"/></dir><file name="OrderController.php" hash="d3a947e28c7dfaab5cbc5425fe5bc573"/></dir></dir><file name="CardmanagementController.php" hash="e1e0f5ad1df7f7c9e400b6c111a86124"/><file name="PaymentController.php" hash="a4b36228a9f94c8323f3aacc9d6fa4fa"/></dir><dir name="etc"><file name="config.xml" hash="a996cbbb244237de68b5f64545fc47ae"/><file name="system.xml" hash="b931b80be0fac76b5adeb481e8bd6e3d"/></dir><dir name="sql"><dir name="cardconnect_ccgateway_setup"><file name="install-1.0.0.php" hash="c0d54dd38b639fb7577848d5c18a9b80"/></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="522f720341d93ed2b6da4c77bd94529b"/><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="4c3702b8459fb83f135efa2da6d89653"/><file name="index.phtml" hash="4917c72bd5cf1563957f2ad0c78ac84e"/><file name="new.phtml" hash="918fbb5c43137a1823ffee604570c561"/></dir><file name="form.phtml" hash="cfb468ebe4b5383a3d1d38dc4369cce1"/><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="22b23a6677cf6b5c0a9c38e84accc9e1"/></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>
|