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.6 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.8.5 to 1.0.8.6
- app/code/community/Cardconnect/Ccgateway/Model/Observer.php +10 -19
- app/code/community/Cardconnect/Ccgateway/Model/Standard.php +185 -76
- app/code/community/Cardconnect/Ccgateway/Model/cardconnect_webservice.php +1 -1
- app/code/community/Cardconnect/Ccgateway/controllers/Adminhtml/Sales/Order/CreateController.php +0 -5
- app/code/community/Cardconnect/Ccgateway/controllers/CardmanagementController.php +4 -4
- app/code/community/Cardconnect/Ccgateway/controllers/PaymentController.php +26 -7
- app/code/community/Cardconnect/Ccgateway/etc/config.xml +1 -1
- package.xml +4 -4
app/code/community/Cardconnect/Ccgateway/Model/Observer.php
CHANGED
|
@@ -51,15 +51,16 @@ class Cardconnect_Ccgateway_Model_Observer
|
|
| 51 |
public function implementOrderStatus($event)
|
| 52 |
{
|
| 53 |
$order = $event->getOrder();
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
if($
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
| 63 |
}
|
| 64 |
}
|
| 65 |
}
|
|
@@ -81,18 +82,8 @@ class Cardconnect_Ccgateway_Model_Observer
|
|
| 81 |
->addObject($invoice->getOrder())
|
| 82 |
->save();
|
| 83 |
|
| 84 |
-
$this->_changeOrderStatus($order);
|
| 85 |
return true;
|
| 86 |
}
|
| 87 |
-
|
| 88 |
-
private function _changeOrderStatus($order)
|
| 89 |
-
{
|
| 90 |
-
$statusMessage = '';
|
| 91 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
|
| 92 |
-
$order->save();
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
|
| 96 |
}
|
| 97 |
|
| 98 |
|
| 51 |
public function implementOrderStatus($event)
|
| 52 |
{
|
| 53 |
$order = $event->getOrder();
|
| 54 |
+
if ($this->_getPaymentMethod($order) == 'ccgateway') {
|
| 55 |
+
$checkout_trans = Mage::getModel('ccgateway/standard')->getConfigData('checkout_trans', $order->getStoreId());
|
| 56 |
+
$checkoutType = Mage::getModel('ccgateway/standard')->getConfigData('checkout_type', $order->getStoreId());
|
| 57 |
+
|
| 58 |
+
if ($checkoutType !== "tokenized_post") {
|
| 59 |
+
if ($checkout_trans == "authorize_capture") {
|
| 60 |
+
if ($order->getState() == 'processing') {
|
| 61 |
+
if ($order->canInvoice())
|
| 62 |
+
$this->_processOrderStatus($order);
|
| 63 |
+
}
|
| 64 |
}
|
| 65 |
}
|
| 66 |
}
|
| 82 |
->addObject($invoice->getOrder())
|
| 83 |
->save();
|
| 84 |
|
|
|
|
| 85 |
return true;
|
| 86 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
}
|
| 88 |
|
| 89 |
|
app/code/community/Cardconnect/Ccgateway/Model/Standard.php
CHANGED
|
@@ -279,7 +279,7 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 279 |
$price = number_format($order->getBaseGrandTotal(), 2, '.', '');
|
| 280 |
$profileId = Mage::getSingleton('core/session')->getCcProfileid();
|
| 281 |
} else {
|
| 282 |
-
// For
|
| 283 |
$quote_id = $order->getQuoteId();
|
| 284 |
$collection = Mage::getModel('sales/quote_payment')->getCollection()
|
| 285 |
->addFieldToFilter('quote_id', array('eq' => $quote_id));
|
|
@@ -370,37 +370,70 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 370 |
|
| 371 |
// Save Partial Authorization Response data
|
| 372 |
$this->saveResponseData($response);
|
| 373 |
-
if ($response['respcode']
|
| 374 |
// Set custom order status
|
| 375 |
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_processing', $response['resptext'])->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 377 |
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', $response['resptext'])->save();
|
| 378 |
$response = array('resptext' => "CardConnect_Error");
|
| 379 |
}
|
| 380 |
}
|
| 381 |
} else {
|
| 382 |
-
$
|
| 383 |
-
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
| 384 |
-
$timeout = strpos($myLogMessage, "errno=28");
|
| 385 |
-
|
| 386 |
if ($timeout !== false) {
|
| 387 |
-
|
| 388 |
-
Mage::
|
| 389 |
|
| 390 |
-
|
| 391 |
$response = array('resptext' => "CardConnect_Timeout_Error");
|
| 392 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 393 |
// Set custom order status
|
| 394 |
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', "Invalid response from CardConnect.")->save();
|
| 395 |
$response = array('resptext' => "CardConnect_Error");
|
| 396 |
}
|
| 397 |
}
|
| 398 |
-
|
| 399 |
-
|
| 400 |
return $response;
|
| 401 |
}
|
| 402 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 403 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 404 |
|
| 405 |
/** For capture * */
|
| 406 |
public function capture(Varien_Object $payment, $amount) {
|
|
@@ -454,27 +487,30 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 454 |
// Save Capture Response data
|
| 455 |
$this->saveResponseData($response);
|
| 456 |
// Set custom order status
|
| 457 |
-
$order->setState(Mage_Sales_Model_Order::
|
| 458 |
}
|
| 459 |
} else {
|
| 460 |
-
$
|
| 461 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
| 462 |
-
|
| 463 |
-
$timeout = strpos($myLogMessage, "errno=28");
|
| 464 |
-
|
| 465 |
if($timeout !== false){
|
| 466 |
-
|
|
|
|
|
|
|
|
|
|
| 467 |
|
| 468 |
-
$
|
| 469 |
|
| 470 |
$errorMsg = "Unable to perform operation at this time. Please consult the Magento log for additional information.";
|
| 471 |
Mage::throwException($errorMsg);
|
| 472 |
} else {
|
|
|
|
|
|
|
| 473 |
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
|
|
|
|
|
|
| 478 |
}
|
| 479 |
}
|
| 480 |
}
|
|
@@ -482,6 +518,28 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 482 |
return $this;
|
| 483 |
}
|
| 484 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 485 |
// Check capture once performed for an order
|
| 486 |
function checkCaptureOnceDone($orderId) {
|
| 487 |
|
|
@@ -535,31 +593,28 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 535 |
// Set custom order status
|
| 536 |
$order->setState($order->getState(), 'cardconnect_void', $response['resptext'])->save();
|
| 537 |
}
|
| 538 |
-
} else {
|
| 539 |
-
$myLogMessage = "CC Void : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
| 540 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
| 541 |
-
|
| 542 |
-
$timeout = strpos($myLogMessage, "errno=28");
|
| 543 |
|
|
|
|
|
|
|
|
|
|
| 544 |
if($timeout !== false){
|
| 545 |
-
|
|
|
|
| 546 |
|
| 547 |
-
$order->setState($order->getState(), 'cardconnect_timeout', "Timeout error response from CardConnect.")->save();
|
| 548 |
|
| 549 |
$errorMsg = "Unable to perform operation at this time. Please consult the Magento log for additional information.";
|
| 550 |
Mage::throwException($errorMsg);
|
| 551 |
} else {
|
|
|
|
|
|
|
| 552 |
|
| 553 |
-
|
| 554 |
-
$order->setState($order->getState(), 'cardconnect_reject', "Invalid response from CardConnect.")->save();
|
| 555 |
|
| 556 |
-
|
| 557 |
-
|
| 558 |
}
|
| 559 |
-
|
| 560 |
}
|
| 561 |
-
|
| 562 |
-
return $response;
|
| 563 |
}
|
| 564 |
|
| 565 |
// Check the Capture status for a current order
|
|
@@ -601,7 +656,7 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 601 |
Mage::log('Txn settled for your order Id: ' . $orderId);
|
| 602 |
} else {
|
| 603 |
$status = "false";
|
| 604 |
-
Mage::
|
| 605 |
}
|
| 606 |
|
| 607 |
return $this;
|
|
@@ -646,26 +701,28 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 646 |
// Save Refund Response data
|
| 647 |
$this->saveResponseData($response);
|
| 648 |
// Set custom order status
|
| 649 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 650 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 651 |
|
| 652 |
-
|
| 653 |
-
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
| 654 |
-
|
| 655 |
-
$timeout = strpos($myLogMessage, "errno=28");
|
| 656 |
-
|
| 657 |
-
if($timeout !== false){
|
| 658 |
-
Mage::log( "TIMEOUT ERROR " . $myLogMessage, Zend_Log::ERR , "cc.log" );
|
| 659 |
-
|
| 660 |
-
$order->setState($order->getState(), 'cardconnect_timeout', "Timeout error response from CardConnect.")->save();
|
| 661 |
-
|
| 662 |
$errorMsg = "Unable to perform operation at this time. Please consult the Magento log for additional information.";
|
| 663 |
Mage::throwException($errorMsg);
|
| 664 |
} else {
|
| 665 |
-
|
| 666 |
-
|
| 667 |
-
|
| 668 |
-
|
|
|
|
|
|
|
|
|
|
| 669 |
}
|
| 670 |
|
| 671 |
}
|
|
@@ -702,13 +759,14 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 702 |
if (abs($response['amount']) == $order_amount || abs($response['amount']) == '0.00') {
|
| 703 |
if ($response['setlstat'] == 'Accepted' || $response['setlstat'] == 'Voided') {
|
| 704 |
if ($ccAction == 'Refund') {
|
| 705 |
-
|
|
|
|
| 706 |
}
|
| 707 |
if ($ccAction == 'authorize' || $ccAction == 'authorize_capture') {
|
| 708 |
if ($response['setlstat'] == 'Voided') {
|
| 709 |
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_void', $response['setlstat'])->save();
|
| 710 |
} else if ($response['setlstat'] == 'Accepted') {
|
| 711 |
-
$order->setState(
|
| 712 |
}
|
| 713 |
}
|
| 714 |
if ($ccAction == 'Void') {
|
|
@@ -737,10 +795,23 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 737 |
}
|
| 738 |
}
|
| 739 |
} else {
|
| 740 |
-
$
|
| 741 |
-
$
|
| 742 |
-
|
|
|
|
|
|
|
|
|
|
| 743 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 744 |
}
|
| 745 |
}
|
| 746 |
} else {
|
|
@@ -753,7 +824,10 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 753 |
if ($message == "status matched") {
|
| 754 |
$message = "Current status matched with Inquire status";
|
| 755 |
} else if ($errorMsg == 1) {
|
| 756 |
-
$message = "
|
|
|
|
|
|
|
|
|
|
| 757 |
} else {
|
| 758 |
$message = "Successfully Inquired";
|
| 759 |
}
|
|
@@ -806,13 +880,22 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 806 |
$response['defaultacct'] = "Y";
|
| 807 |
}
|
| 808 |
|
| 809 |
-
// Save
|
| 810 |
$this->saveResponseData($response, "Wallat");
|
| 811 |
}
|
| 812 |
} else {
|
| 813 |
-
$
|
| 814 |
-
|
| 815 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 816 |
}
|
| 817 |
|
| 818 |
return $response;
|
|
@@ -834,10 +917,16 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 834 |
$resp = json_decode($resp, true);
|
| 835 |
$resp[] = $rsCard['CC_CARD_NAME'];
|
| 836 |
} else {
|
| 837 |
-
$
|
| 838 |
-
|
| 839 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 840 |
|
|
|
|
| 841 |
}
|
| 842 |
|
| 843 |
return $resp;
|
|
@@ -849,8 +938,15 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 849 |
$cc = Mage::helper('ccgateway')->getCardConnectWebService();
|
| 850 |
$resp = $cc->getProfileService($profileId);
|
| 851 |
if (empty($resp)) {
|
| 852 |
-
$
|
| 853 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 854 |
$resp[] = array('resptext' => "CardConnect_Error");
|
| 855 |
}
|
| 856 |
|
|
@@ -899,17 +995,25 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 899 |
$msg = "We are unable to perform the requested action, please contact customer service.";
|
| 900 |
$myLogMessage = "CC Delete Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
| 901 |
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
|
|
|
| 902 |
$myMessage = "CC Delete Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$response['resptext'];
|
| 903 |
Mage::log($myMessage, Zend_Log::ERR , "cc.log" );
|
| 904 |
}
|
| 905 |
} else {
|
| 906 |
-
$
|
| 907 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 908 |
$msg = "We are unable to perform the requested action, please contact customer service.";
|
| 909 |
}
|
| 910 |
-
}else{
|
| 911 |
-
$myLogMessage = "CC Delete Profile Service : ". __FILE__ . " @ " . __LINE__;
|
| 912 |
-
Mage::log($myLogMessage, Zend_Log::ERR
|
| 913 |
$msg = "We are unable to perform the requested action, please contact customer service.";
|
| 914 |
}
|
| 915 |
|
|
@@ -969,11 +1073,16 @@ class Cardconnect_Ccgateway_Model_Standard extends Mage_Payment_Model_Method_Abs
|
|
| 969 |
Mage::log($errorMessage, Zend_Log::ERR, "cc.log");
|
| 970 |
}
|
| 971 |
} else {
|
| 972 |
-
$
|
| 973 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 974 |
}
|
| 975 |
|
| 976 |
-
|
| 977 |
return $response;
|
| 978 |
}
|
| 979 |
|
| 279 |
$price = number_format($order->getBaseGrandTotal(), 2, '.', '');
|
| 280 |
$profileId = Mage::getSingleton('core/session')->getCcProfileid();
|
| 281 |
} else {
|
| 282 |
+
// For Partial Shipment Reauthorization
|
| 283 |
$quote_id = $order->getQuoteId();
|
| 284 |
$collection = Mage::getModel('sales/quote_payment')->getCollection()
|
| 285 |
->addFieldToFilter('quote_id', array('eq' => $quote_id));
|
| 370 |
|
| 371 |
// Save Partial Authorization Response data
|
| 372 |
$this->saveResponseData($response);
|
| 373 |
+
if ($response['respcode'] === "00") {
|
| 374 |
// Set custom order status
|
| 375 |
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_processing', $response['resptext'])->save();
|
| 376 |
+
|
| 377 |
+
if ($checkout_trans == "authorize_capture") {
|
| 378 |
+
if ($order->canInvoice())
|
| 379 |
+
$this->_processOrderStatus($order);
|
| 380 |
+
}
|
| 381 |
} else {
|
| 382 |
+
Mage::log("CC Authorization Error because response is : " . json_encode($response), Zend_Log::ERR, "cc.log");
|
| 383 |
+
|
| 384 |
+
$this->_cancelOrder($order);
|
| 385 |
+
|
| 386 |
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', $response['resptext'])->save();
|
| 387 |
$response = array('resptext' => "CardConnect_Error");
|
| 388 |
}
|
| 389 |
}
|
| 390 |
} else {
|
| 391 |
+
$timeout = strpos($cc->getLastErrorMessage(), "errno=28");
|
|
|
|
|
|
|
|
|
|
| 392 |
if ($timeout !== false) {
|
| 393 |
+
$myLogMessage = "CC Authorization Timeout : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 394 |
+
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
| 395 |
|
| 396 |
+
// Note: State is updated and Order is canceled by PaymentController
|
| 397 |
$response = array('resptext' => "CardConnect_Timeout_Error");
|
| 398 |
} else {
|
| 399 |
+
$myLogMessage = "CC Authorization Error : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 400 |
+
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
| 401 |
+
|
| 402 |
+
$this->_cancelOrder($order);
|
| 403 |
+
|
| 404 |
// Set custom order status
|
| 405 |
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', "Invalid response from CardConnect.")->save();
|
| 406 |
$response = array('resptext' => "CardConnect_Error");
|
| 407 |
}
|
| 408 |
}
|
|
|
|
|
|
|
| 409 |
return $response;
|
| 410 |
}
|
| 411 |
|
| 412 |
+
private function _processOrderStatus($order)
|
| 413 |
+
{
|
| 414 |
+
$invoice = $order->prepareInvoice();
|
| 415 |
+
$invoice->register()->capture();
|
| 416 |
+
Mage::getModel('core/resource_transaction')
|
| 417 |
+
->addObject($invoice)
|
| 418 |
+
->addObject($invoice->getOrder())
|
| 419 |
+
->save();
|
| 420 |
+
|
| 421 |
+
return true;
|
| 422 |
+
}
|
| 423 |
|
| 424 |
+
private function _cancelOrder($order)
|
| 425 |
+
{
|
| 426 |
+
// add order items back to inventory
|
| 427 |
+
$order->cancel();
|
| 428 |
+
|
| 429 |
+
// For each items in the orders, quantity invoiced should be set to zero
|
| 430 |
+
foreach ($order->getAllItems() as $item) {
|
| 431 |
+
$item->setData('qty_invoiced', 0);
|
| 432 |
+
$item->cancel();
|
| 433 |
+
$item->save();
|
| 434 |
+
}
|
| 435 |
+
$order->save();
|
| 436 |
+
}
|
| 437 |
|
| 438 |
/** For capture * */
|
| 439 |
public function capture(Varien_Object $payment, $amount) {
|
| 487 |
// Save Capture Response data
|
| 488 |
$this->saveResponseData($response);
|
| 489 |
// Set custom order status
|
| 490 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_capture', $response['setlstat'])->save();
|
| 491 |
}
|
| 492 |
} else {
|
| 493 |
+
$timeout = strpos($cc->getLastErrorMessage(), "errno=28");
|
|
|
|
|
|
|
|
|
|
|
|
|
| 494 |
if($timeout !== false){
|
| 495 |
+
$myLogMessage = "CC Capture Timeout : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
| 496 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
| 497 |
+
|
| 498 |
+
$order->setState($order->getState(), 'cardconnect_timeout', "Timeout error response on Capture from CardConnect.")->save();
|
| 499 |
|
| 500 |
+
$this->_resetInvoice($order);
|
| 501 |
|
| 502 |
$errorMsg = "Unable to perform operation at this time. Please consult the Magento log for additional information.";
|
| 503 |
Mage::throwException($errorMsg);
|
| 504 |
} else {
|
| 505 |
+
$myLogMessage = "CC Capture Error : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
| 506 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
| 507 |
|
| 508 |
+
$order->setState($order->getState(), 'cardconnect_reject', "Invalid response on Capture from CardConnect.")->save();
|
| 509 |
+
|
| 510 |
+
$this->_resetInvoice($order);
|
| 511 |
+
|
| 512 |
+
$errorMsg = "Unable to perform operation. Please consult the Magento log for additional information.";
|
| 513 |
+
Mage::throwException($errorMsg);
|
| 514 |
}
|
| 515 |
}
|
| 516 |
}
|
| 518 |
return $this;
|
| 519 |
}
|
| 520 |
|
| 521 |
+
/** For resetting capture flags in case of error * */
|
| 522 |
+
private function _resetInvoice($order) {
|
| 523 |
+
// Reset invoice flag
|
| 524 |
+
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_CANCEL, false);
|
| 525 |
+
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_HOLD, false);
|
| 526 |
+
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_UNHOLD, false);
|
| 527 |
+
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_EDIT, false);
|
| 528 |
+
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_CREDITMEMO, false);
|
| 529 |
+
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_INVOICE, false);
|
| 530 |
+
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_REORDER, false);
|
| 531 |
+
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_SHIP, false);
|
| 532 |
+
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_COMMENT, false);
|
| 533 |
+
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_PRODUCTS_PERMISSION_DENIED, false);
|
| 534 |
+
|
| 535 |
+
// For each items in the orders, quantity invoiced should be set to zero
|
| 536 |
+
foreach ($order->getAllItems() as $item) {
|
| 537 |
+
$item->setData('qty_invoiced', 0);
|
| 538 |
+
$item->save();
|
| 539 |
+
}
|
| 540 |
+
$order->save();
|
| 541 |
+
}
|
| 542 |
+
|
| 543 |
// Check capture once performed for an order
|
| 544 |
function checkCaptureOnceDone($orderId) {
|
| 545 |
|
| 593 |
// Set custom order status
|
| 594 |
$order->setState($order->getState(), 'cardconnect_void', $response['resptext'])->save();
|
| 595 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 596 |
|
| 597 |
+
return $response;
|
| 598 |
+
} else {
|
| 599 |
+
$timeout = strpos($cc->getLastErrorMessage(), "errno=28");
|
| 600 |
if($timeout !== false){
|
| 601 |
+
$myLogMessage = "CC Void Timeout : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
| 602 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
| 603 |
|
| 604 |
+
$order->setState($order->getState(), 'cardconnect_timeout', "Timeout error response on Void from CardConnect.")->save();
|
| 605 |
|
| 606 |
$errorMsg = "Unable to perform operation at this time. Please consult the Magento log for additional information.";
|
| 607 |
Mage::throwException($errorMsg);
|
| 608 |
} else {
|
| 609 |
+
$myLogMessage = "CC Void Error : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
| 610 |
+
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
| 611 |
|
| 612 |
+
$order->setState($order->getState(), 'cardconnect_reject', "Invalid response on Void from CardConnect.")->save();
|
|
|
|
| 613 |
|
| 614 |
+
$errorMsg = "Unable to perform operation. Please consult the Magento log for additional information.";
|
| 615 |
+
Mage::throwException($errorMsg);
|
| 616 |
}
|
|
|
|
| 617 |
}
|
|
|
|
|
|
|
| 618 |
}
|
| 619 |
|
| 620 |
// Check the Capture status for a current order
|
| 656 |
Mage::log('Txn settled for your order Id: ' . $orderId);
|
| 657 |
} else {
|
| 658 |
$status = "false";
|
| 659 |
+
Mage::log("Refund cannot be processed, transaction should be settled first.");
|
| 660 |
}
|
| 661 |
|
| 662 |
return $this;
|
| 701 |
// Save Refund Response data
|
| 702 |
$this->saveResponseData($response);
|
| 703 |
// Set custom order status
|
| 704 |
+
if ($response['respcode'] == "00") {
|
| 705 |
+
$order->setState($order->getState(), 'cardconnect_refund', $response['resptext'])->save();
|
| 706 |
+
} else {
|
| 707 |
+
$order->setState(Mage_Sales_Model_Order::STATE_COMPLETE, 'cardconnect_reject', $response['resptext'])->save();
|
| 708 |
+
}
|
| 709 |
} else {
|
| 710 |
+
$timeout = strpos($cc->getLastErrorMessage(), "errno=28");
|
| 711 |
+
if ($timeout !== false) {
|
| 712 |
+
$myLogMessage = "CC Refund Timeout : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 713 |
+
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
| 714 |
|
| 715 |
+
$order->setState(Mage_Sales_Model_Order::STATE_COMPLETE, 'cardconnect_timeout', "Timeout error response on Refund from CardConnect.")->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 716 |
$errorMsg = "Unable to perform operation at this time. Please consult the Magento log for additional information.";
|
| 717 |
Mage::throwException($errorMsg);
|
| 718 |
} else {
|
| 719 |
+
$myLogMessage = "CC Refund Error : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 720 |
+
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
| 721 |
+
|
| 722 |
+
// Set custom order status
|
| 723 |
+
$order->setState(Mage_Sales_Model_Order::STATE_COMPLETE, 'cardconnect_reject', "Invalid response on Refund from CardConnect.")->save();
|
| 724 |
+
$errorMsg = "Unable to perform operation. Please consult the Magento log for additional information.";
|
| 725 |
+
Mage::throwException($errorMsg);
|
| 726 |
}
|
| 727 |
|
| 728 |
}
|
| 759 |
if (abs($response['amount']) == $order_amount || abs($response['amount']) == '0.00') {
|
| 760 |
if ($response['setlstat'] == 'Accepted' || $response['setlstat'] == 'Voided') {
|
| 761 |
if ($ccAction == 'Refund') {
|
| 762 |
+
|
| 763 |
+
$order->setState($order->getState(), 'cardconnect_refund', $response['setlstat'])->save();
|
| 764 |
}
|
| 765 |
if ($ccAction == 'authorize' || $ccAction == 'authorize_capture') {
|
| 766 |
if ($response['setlstat'] == 'Voided') {
|
| 767 |
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_void', $response['setlstat'])->save();
|
| 768 |
} else if ($response['setlstat'] == 'Accepted') {
|
| 769 |
+
$order->setState($order->getState(), 'cardconnect_txn_settled', $response['setlstat'])->save();
|
| 770 |
}
|
| 771 |
}
|
| 772 |
if ($ccAction == 'Void') {
|
| 795 |
}
|
| 796 |
}
|
| 797 |
} else {
|
| 798 |
+
$timeout = strpos($cc->getLastErrorMessage(), "errno=28");
|
| 799 |
+
if ($timeout !== false) {
|
| 800 |
+
$errorMsg = 2;
|
| 801 |
+
|
| 802 |
+
$myLogMessage = "CC Inquire Timeout : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 803 |
+
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
| 804 |
|
| 805 |
+
$order->setState($order->getState(), 'cardconnect_timeout', "Timeout error response on Inquire from CardConnect.")->save();
|
| 806 |
+
}
|
| 807 |
+
else {
|
| 808 |
+
$errorMsg = 1;
|
| 809 |
+
|
| 810 |
+
$myLogMessage = "CC Inquire Error : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 811 |
+
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
| 812 |
+
|
| 813 |
+
// Note: We do not log inquire errors to transaction history
|
| 814 |
+
}
|
| 815 |
}
|
| 816 |
}
|
| 817 |
} else {
|
| 824 |
if ($message == "status matched") {
|
| 825 |
$message = "Current status matched with Inquire status";
|
| 826 |
} else if ($errorMsg == 1) {
|
| 827 |
+
$message = "Error while attempting to determine latest transaction status (Inquire)";
|
| 828 |
+
} else if ($errorMsg == 2) {
|
| 829 |
+
// For timeout in inquire
|
| 830 |
+
$message = "Unable to perform operation at this time. Please consult the Magento log for additional information.";
|
| 831 |
} else {
|
| 832 |
$message = "Successfully Inquired";
|
| 833 |
}
|
| 880 |
$response['defaultacct'] = "Y";
|
| 881 |
}
|
| 882 |
|
| 883 |
+
// Save Response data
|
| 884 |
$this->saveResponseData($response, "Wallat");
|
| 885 |
}
|
| 886 |
} else {
|
| 887 |
+
$timeout = strpos($cc->getLastErrorMessage(), "errno=28");
|
| 888 |
+
if ($timeout !== false) {
|
| 889 |
+
$myLogMessage = "CC Create Profile Service Timeout : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 890 |
+
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
| 891 |
+
|
| 892 |
+
$response = array('resptext' => "CardConnect_Timeout_Error");
|
| 893 |
+
} else {
|
| 894 |
+
$myLogMessage = "CC Create Profile Service Error : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 895 |
+
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
| 896 |
+
|
| 897 |
+
$response = array('resptext' => "CardConnect_Error");
|
| 898 |
+
}
|
| 899 |
}
|
| 900 |
|
| 901 |
return $response;
|
| 917 |
$resp = json_decode($resp, true);
|
| 918 |
$resp[] = $rsCard['CC_CARD_NAME'];
|
| 919 |
} else {
|
| 920 |
+
$timeout = strpos($cc->getLastErrorMessage(), "errno=28");
|
| 921 |
+
if ($timeout !== false) {
|
| 922 |
+
$myLogMessage = "CC Get Profile Service Timeout : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 923 |
+
}
|
| 924 |
+
else {
|
| 925 |
+
$myLogMessage = "CC Get Profile Service Error : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 926 |
+
}
|
| 927 |
+
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
| 928 |
|
| 929 |
+
$resp[] = array('resptext' => "CardConnect_Error");
|
| 930 |
}
|
| 931 |
|
| 932 |
return $resp;
|
| 938 |
$cc = Mage::helper('ccgateway')->getCardConnectWebService();
|
| 939 |
$resp = $cc->getProfileService($profileId);
|
| 940 |
if (empty($resp)) {
|
| 941 |
+
$timeout = strpos($cc->getLastErrorMessage(), "errno=28");
|
| 942 |
+
if ($timeout !== false) {
|
| 943 |
+
$myLogMessage = "CC Get Profile Service Timeout : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 944 |
+
}
|
| 945 |
+
else {
|
| 946 |
+
$myLogMessage = "CC Get Profile Service Error : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 947 |
+
}
|
| 948 |
+
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
| 949 |
+
|
| 950 |
$resp[] = array('resptext' => "CardConnect_Error");
|
| 951 |
}
|
| 952 |
|
| 995 |
$msg = "We are unable to perform the requested action, please contact customer service.";
|
| 996 |
$myLogMessage = "CC Delete Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$cc->getLastErrorMessage();
|
| 997 |
Mage::log($myLogMessage, Zend_Log::ERR , "cc.log" );
|
| 998 |
+
|
| 999 |
$myMessage = "CC Delete Profile Service : ". __FILE__ . " @ " . __LINE__ ." ".$response['resptext'];
|
| 1000 |
Mage::log($myMessage, Zend_Log::ERR , "cc.log" );
|
| 1001 |
}
|
| 1002 |
} else {
|
| 1003 |
+
$timeout = strpos($cc->getLastErrorMessage(), "errno=28");
|
| 1004 |
+
if ($timeout !== false) {
|
| 1005 |
+
$myLogMessage = "CC Delete Profile Service Timeout : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 1006 |
+
}
|
| 1007 |
+
else {
|
| 1008 |
+
$myLogMessage = "CC Delete Profile Service Error : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 1009 |
+
}
|
| 1010 |
+
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
| 1011 |
+
|
| 1012 |
$msg = "We are unable to perform the requested action, please contact customer service.";
|
| 1013 |
}
|
| 1014 |
+
} else {
|
| 1015 |
+
$myLogMessage = "CC Delete Profile Service : " . __FILE__ . " @ " . __LINE__;
|
| 1016 |
+
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
| 1017 |
$msg = "We are unable to perform the requested action, please contact customer service.";
|
| 1018 |
}
|
| 1019 |
|
| 1073 |
Mage::log($errorMessage, Zend_Log::ERR, "cc.log");
|
| 1074 |
}
|
| 1075 |
} else {
|
| 1076 |
+
$timeout = strpos($cc->getLastErrorMessage(), "errno=28");
|
| 1077 |
+
if ($timeout !== false) {
|
| 1078 |
+
$myLogMessage = "CC Update Profile Service Timeout : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 1079 |
+
}
|
| 1080 |
+
else {
|
| 1081 |
+
$myLogMessage = "CC Update Profile Service Error : " . __FILE__ . " @ " . __LINE__ . " " . $cc->getLastErrorMessage();
|
| 1082 |
+
}
|
| 1083 |
+
Mage::log($myLogMessage, Zend_Log::ERR, "cc.log");
|
| 1084 |
}
|
| 1085 |
|
|
|
|
| 1086 |
return $response;
|
| 1087 |
}
|
| 1088 |
|
app/code/community/Cardconnect/Ccgateway/Model/cardconnect_webservice.php
CHANGED
|
@@ -130,7 +130,7 @@ class CardConnectWebService
|
|
| 130 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
| 131 |
curl_setopt($curl, CURLOPT_COOKIESESSION, 1);
|
| 132 |
curl_setopt($curl, CURLOPT_NOSIGNAL, 1);
|
| 133 |
-
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT,30);
|
| 134 |
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
|
| 135 |
curl_setopt($curl, CURLOPT_POSTFIELDS, $postString);
|
| 136 |
|
| 130 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
| 131 |
curl_setopt($curl, CURLOPT_COOKIESESSION, 1);
|
| 132 |
curl_setopt($curl, CURLOPT_NOSIGNAL, 1);
|
| 133 |
+
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
|
| 134 |
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
|
| 135 |
curl_setopt($curl, CURLOPT_POSTFIELDS, $postString);
|
| 136 |
|
app/code/community/Cardconnect/Ccgateway/controllers/Adminhtml/Sales/Order/CreateController.php
CHANGED
|
@@ -78,7 +78,6 @@ class Cardconnect_Ccgateway_Adminhtml_Sales_Order_CreateController extends Mage_
|
|
| 78 |
$this->_getOrderCreateModel()->getQuote()->getPayment()->addData($paymentData);
|
| 79 |
}
|
| 80 |
|
| 81 |
-
|
| 82 |
$order = $this->_getOrderCreateModel()
|
| 83 |
->setIsValidate(true)
|
| 84 |
->importPostData($this->getRequest()->getPost('order'))
|
|
@@ -93,7 +92,6 @@ class Cardconnect_Ccgateway_Adminhtml_Sales_Order_CreateController extends Mage_
|
|
| 93 |
$this->makeCcPayment($order);
|
| 94 |
}
|
| 95 |
|
| 96 |
-
|
| 97 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
| 98 |
$this->_redirect('*/sales_order/view', array('order_id' => $order->getId()));
|
| 99 |
} else {
|
|
@@ -182,7 +180,4 @@ class Cardconnect_Ccgateway_Adminhtml_Sales_Order_CreateController extends Mage_
|
|
| 182 |
}
|
| 183 |
|
| 184 |
}
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
}
|
| 78 |
$this->_getOrderCreateModel()->getQuote()->getPayment()->addData($paymentData);
|
| 79 |
}
|
| 80 |
|
|
|
|
| 81 |
$order = $this->_getOrderCreateModel()
|
| 82 |
->setIsValidate(true)
|
| 83 |
->importPostData($this->getRequest()->getPost('order'))
|
| 92 |
$this->makeCcPayment($order);
|
| 93 |
}
|
| 94 |
|
|
|
|
| 95 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
| 96 |
$this->_redirect('*/sales_order/view', array('order_id' => $order->getId()));
|
| 97 |
} else {
|
| 180 |
}
|
| 181 |
|
| 182 |
}
|
|
|
|
|
|
|
|
|
|
| 183 |
}
|
app/code/community/Cardconnect/Ccgateway/controllers/CardmanagementController.php
CHANGED
|
@@ -78,7 +78,9 @@ class Cardconnect_Ccgateway_CardmanagementController extends Mage_Customer_Accou
|
|
| 78 |
$response = Mage::getModel('ccgateway/standard')->createProfileService($data);
|
| 79 |
if ($response['resptext'] == "Profile Saved") {
|
| 80 |
Mage::getSingleton('core/session')->addSuccess("Card has been added successfully.");
|
| 81 |
-
}else{
|
|
|
|
|
|
|
| 82 |
Mage::getSingleton('core/session')->addError(Mage::helper('ccgateway')->__("Unable to perform add card. Please, retry."));
|
| 83 |
}
|
| 84 |
$this->_redirect('customer/cardmanagement');
|
|
@@ -167,7 +169,7 @@ class Cardconnect_Ccgateway_CardmanagementController extends Mage_Customer_Accou
|
|
| 167 |
|
| 168 |
// Call function Create Profile webservices
|
| 169 |
$response = Mage::getModel('ccgateway/standard')->updateProfileService($param);
|
| 170 |
-
|
| 171 |
if ($response == "Profile Updated") {
|
| 172 |
Mage::getSingleton('core/session')->addSuccess("Card has been updated successfully.");
|
| 173 |
} else {
|
|
@@ -176,6 +178,4 @@ class Cardconnect_Ccgateway_CardmanagementController extends Mage_Customer_Accou
|
|
| 176 |
$this->_redirect('customer/cardmanagement');
|
| 177 |
|
| 178 |
}
|
| 179 |
-
|
| 180 |
-
|
| 181 |
}
|
| 78 |
$response = Mage::getModel('ccgateway/standard')->createProfileService($data);
|
| 79 |
if ($response['resptext'] == "Profile Saved") {
|
| 80 |
Mage::getSingleton('core/session')->addSuccess("Card has been added successfully.");
|
| 81 |
+
}else if ($response['resptext'] == "CardConnect_Timeout_Error"){
|
| 82 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('ccgateway')->__("Unable to perform add card at this time. Please, retry."));
|
| 83 |
+
} else {
|
| 84 |
Mage::getSingleton('core/session')->addError(Mage::helper('ccgateway')->__("Unable to perform add card. Please, retry."));
|
| 85 |
}
|
| 86 |
$this->_redirect('customer/cardmanagement');
|
| 169 |
|
| 170 |
// Call function Create Profile webservices
|
| 171 |
$response = Mage::getModel('ccgateway/standard')->updateProfileService($param);
|
| 172 |
+
|
| 173 |
if ($response == "Profile Updated") {
|
| 174 |
Mage::getSingleton('core/session')->addSuccess("Card has been updated successfully.");
|
| 175 |
} else {
|
| 178 |
$this->_redirect('customer/cardmanagement');
|
| 179 |
|
| 180 |
}
|
|
|
|
|
|
|
| 181 |
}
|
app/code/community/Cardconnect/Ccgateway/controllers/PaymentController.php
CHANGED
|
@@ -170,7 +170,7 @@ class Cardconnect_Ccgateway_PaymentController extends Mage_Core_Controller_Front
|
|
| 170 |
);
|
| 171 |
}
|
| 172 |
|
| 173 |
-
if ($errorCode
|
| 174 |
$statCVV = true; // false = Failure, true = Success
|
| 175 |
$statAVS = true; // false = Failure, true = Success
|
| 176 |
$voidOnAvs = Mage::getModel('ccgateway/standard')->getConfigData('void_avs' , $order->getStoreId());
|
|
@@ -202,14 +202,21 @@ class Cardconnect_Ccgateway_PaymentController extends Mage_Core_Controller_Front
|
|
| 202 |
$this->responseCancel($errorStat);
|
| 203 |
// Set custom order status
|
| 204 |
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', $errorDesc)->save();
|
|
|
|
|
|
|
| 205 |
}
|
| 206 |
} else {
|
| 207 |
$this->saveResponseData2ccgateway($data);
|
| 208 |
$this->responseSuccess($orderId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
// Set custom order status
|
| 210 |
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_processing', $errorDesc)->save();
|
| 211 |
}
|
| 212 |
-
} elseif ($errorCode
|
| 213 |
$errorStat = $response['respproc'] . $response['respcode'];
|
| 214 |
$this->responseCancel($errorStat);
|
| 215 |
$this->saveResponseData2ccgateway($data);
|
|
@@ -224,6 +231,18 @@ class Cardconnect_Ccgateway_PaymentController extends Mage_Core_Controller_Front
|
|
| 224 |
}
|
| 225 |
}
|
| 226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
// Save date to CardConnect responce table
|
| 228 |
protected function saveResponseData2ccgateway($data) {
|
| 229 |
|
|
@@ -285,19 +304,19 @@ class Cardconnect_Ccgateway_PaymentController extends Mage_Core_Controller_Front
|
|
| 285 |
|
| 286 |
$errorMsg = "";
|
| 287 |
if ($errorStat == "CVV") {
|
| 288 |
-
$session->addError(Mage::helper('ccgateway')->__('Error - Invalid
|
| 289 |
$errorMsg = "CVV does not match.";
|
| 290 |
-
Mage::log("Auto voided the transaction Due to CVV NO MATCH");
|
| 291 |
} elseif ($errorStat == "AVS") {
|
| 292 |
$session->addError(Mage::helper('ccgateway')->__('Error - Please check billing information , try again.'));
|
| 293 |
$errorMsg = "AVS does not match.";
|
| 294 |
-
Mage::log("Auto voided the transaction Due to AVS NO MATCH");
|
| 295 |
} elseif ($errorStat == "PPS62") {
|
| 296 |
$errorMsg = "Timeout error response from CardConnect.";
|
| 297 |
-
Mage::log("Error - Order process is timed out , try again.");
|
| 298 |
} else {
|
| 299 |
$errorMsg = Mage::helper('ccgateway')->matchResponseError($errorStat);
|
| 300 |
-
Mage:: log($errorStat . " :- " . $errorMsg);
|
| 301 |
$session->addError(Mage::helper('ccgateway')->__($errorMsg));
|
| 302 |
}
|
| 303 |
|
| 170 |
);
|
| 171 |
}
|
| 172 |
|
| 173 |
+
if ($errorCode === "00") {
|
| 174 |
$statCVV = true; // false = Failure, true = Success
|
| 175 |
$statAVS = true; // false = Failure, true = Success
|
| 176 |
$voidOnAvs = Mage::getModel('ccgateway/standard')->getConfigData('void_avs' , $order->getStoreId());
|
| 202 |
$this->responseCancel($errorStat);
|
| 203 |
// Set custom order status
|
| 204 |
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, 'cardconnect_reject', $errorDesc)->save();
|
| 205 |
+
$order->setData('canInvoice', false);
|
| 206 |
+
$order->save();
|
| 207 |
}
|
| 208 |
} else {
|
| 209 |
$this->saveResponseData2ccgateway($data);
|
| 210 |
$this->responseSuccess($orderId);
|
| 211 |
+
|
| 212 |
+
if ($cc_action == "authorize_capture") {
|
| 213 |
+
if ($order->canInvoice())
|
| 214 |
+
$this->_processOrderStatus($order);
|
| 215 |
+
}
|
| 216 |
// Set custom order status
|
| 217 |
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'cardconnect_processing', $errorDesc)->save();
|
| 218 |
}
|
| 219 |
+
} elseif ($errorCode === "02") {
|
| 220 |
$errorStat = $response['respproc'] . $response['respcode'];
|
| 221 |
$this->responseCancel($errorStat);
|
| 222 |
$this->saveResponseData2ccgateway($data);
|
| 231 |
}
|
| 232 |
}
|
| 233 |
|
| 234 |
+
private function _processOrderStatus($order)
|
| 235 |
+
{
|
| 236 |
+
$invoice = $order->prepareInvoice();
|
| 237 |
+
$invoice->register()->capture();
|
| 238 |
+
Mage::getModel('core/resource_transaction')
|
| 239 |
+
->addObject($invoice)
|
| 240 |
+
->addObject($invoice->getOrder())
|
| 241 |
+
->save();
|
| 242 |
+
|
| 243 |
+
return true;
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
// Save date to CardConnect responce table
|
| 247 |
protected function saveResponseData2ccgateway($data) {
|
| 248 |
|
| 304 |
|
| 305 |
$errorMsg = "";
|
| 306 |
if ($errorStat == "CVV") {
|
| 307 |
+
$session->addError(Mage::helper('ccgateway')->__('Error - Invalid payment information. Please verify the payment information and try again.'));
|
| 308 |
$errorMsg = "CVV does not match.";
|
| 309 |
+
Mage::log("Auto voided the transaction Due to CVV NO MATCH.", Zend_Log::ERR , "cc.log");
|
| 310 |
} elseif ($errorStat == "AVS") {
|
| 311 |
$session->addError(Mage::helper('ccgateway')->__('Error - Please check billing information , try again.'));
|
| 312 |
$errorMsg = "AVS does not match.";
|
| 313 |
+
Mage::log("Auto voided the transaction Due to AVS NO MATCH.", Zend_Log::ERR , "cc.log");
|
| 314 |
} elseif ($errorStat == "PPS62") {
|
| 315 |
$errorMsg = "Timeout error response from CardConnect.";
|
| 316 |
+
Mage::log("Error - Order process is timed out , try again.", Zend_Log::ERR , "cc.log");
|
| 317 |
} else {
|
| 318 |
$errorMsg = Mage::helper('ccgateway')->matchResponseError($errorStat);
|
| 319 |
+
Mage:: log($errorStat . " :- " . $errorMsg, Zend_Log::ERR , "cc.log");
|
| 320 |
$session->addError(Mage::helper('ccgateway')->__($errorMsg));
|
| 321 |
}
|
| 322 |
|
app/code/community/Cardconnect/Ccgateway/etc/config.xml
CHANGED
|
@@ -35,7 +35,7 @@ to license@magentocommerce.com so we can send you a copy immediately.
|
|
| 35 |
<config>
|
| 36 |
<modules>
|
| 37 |
<Cardconnect_Ccgateway>
|
| 38 |
-
<version>1.0.8.
|
| 39 |
</Cardconnect_Ccgateway>
|
| 40 |
</modules>
|
| 41 |
<global>
|
| 35 |
<config>
|
| 36 |
<modules>
|
| 37 |
<Cardconnect_Ccgateway>
|
| 38 |
+
<version>1.0.8.6</version>
|
| 39 |
</Cardconnect_Ccgateway>
|
| 40 |
</modules>
|
| 41 |
<global>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>CardconnectCcgateway</name>
|
| 4 |
-
<version>1.0.8.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -10,9 +10,9 @@
|
|
| 10 |
<description>The CardConnect solution is a powerful extension used for payment processing in eCommerce. We provide the option to process a payment through the Hosted Payment Page or Direct Post, in a safe and secure way. We also provide the ability of a wallet function which allows merchants to add/edit/delete card holder data for future payments. All Customer information is stored in a secured way; and allows Customers to make a secure payment as well. Please see the Integration Guide here for steps to install: http://cdn.cardconnect.com/docs/collateral/Magento-Integration_Guide_v1.2.pdf</description>
|
| 11 |
<notes>Extension provides the ability for merchants to process through the CardConnect Gateway.</notes>
|
| 12 |
<authors><author><name>AgileNova</name><user>Team</user><email>matt.wixson@agilenova.com</email></author></authors>
|
| 13 |
-
<date>2016-04-
|
| 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="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>CardconnectCcgateway</name>
|
| 4 |
+
<version>1.0.8.6</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 10 |
<description>The CardConnect solution is a powerful extension used for payment processing in eCommerce. We provide the option to process a payment through the Hosted Payment Page or Direct Post, in a safe and secure way. We also provide the ability of a wallet function which allows merchants to add/edit/delete card holder data for future payments. All Customer information is stored in a secured way; and allows Customers to make a secure payment as well. Please see the Integration Guide here for steps to install: http://cdn.cardconnect.com/docs/collateral/Magento-Integration_Guide_v1.2.pdf</description>
|
| 11 |
<notes>Extension provides the ability for merchants to process through the CardConnect Gateway.</notes>
|
| 12 |
<authors><author><name>AgileNova</name><user>Team</user><email>matt.wixson@agilenova.com</email></author></authors>
|
| 13 |
+
<date>2016-04-15</date>
|
| 14 |
+
<time>18:42:16</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="b2240c6e82a175b2370d185ca2bdca04"/><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="808cc6ef0b49e4d21db2eab668f184ed"/><file name="cardconnect_webservice.php" hash="01510f7dfd4bfcd740f93de58beae3bc"/></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="72e5ee75209c594f7c7d110ac3a7c308"/></dir><file name="OrderController.php" hash="d3a947e28c7dfaab5cbc5425fe5bc573"/></dir></dir><file name="CardmanagementController.php" hash="6ad38775df8386903f2a99f910dca636"/><file name="LogController.php" hash="d4a9e66b778a0b1c77a5f7dc7f3e7eb6"/><file name="PaymentController.php" hash="50c1e0cee2f041c25810d8fba76c652e"/></dir><dir name="etc"><file name="config.xml" hash="cd3badd41e952737b76090b8d13743c9"/><file name="system.xml" hash="b931b80be0fac76b5adeb481e8bd6e3d"/></dir><dir name="sql"><dir name="cardconnect_ccgateway_setup"><file name="install-1.0.0.php" hash="9f9371eec7e62f9e62bc6c262096cf25"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cardconnect_Ccgateway.xml" hash="eac8d5ee15ec6943fefc4dbbdef74671"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="cardconnect"><file name="cardconnect.gif" hash="b0ccf9c7446efd2bb6b65eadd98a3fde"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="cardconnect.css" hash="b58f299352d1bc2bebc47e3ed1ab3490"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ccgateway.xml" hash="b84ef177b3e51da8203805b5ce094f19"/></dir><dir name="template"><dir name="ccgateway"><file name="form.phtml" hash="92127fa77e412953913615619c7fdf60"/><file name="info.phtml" hash="9f608febdf1c537eb3f4c9933429c651"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ccgateway.xml" hash="55846fe0c9e2e2ec1ef96f196ae60843"/></dir><dir name="template"><dir name="ccgateway"><file name="blank.phtml" hash="d858f54e640d5b29bde38ed37ac3f8e8"/><dir name="cardmanagement"><file name="editcard.phtml" hash="cd2bf20840d9add16c5fd0abfc4eada0"/><file name="index.phtml" hash="4917c72bd5cf1563957f2ad0c78ac84e"/><file name="new.phtml" hash="233c24057c924335c44b36db0b3d4ddf"/></dir><file name="form.phtml" hash="523c4ab9cac38cd7f12f758e7f98dd77"/><file name="info.phtml" hash="de3d6b891ac68056b85db65c47a8f97f"/><file name="redirect.phtml" hash="4b3964b41e6e55bf54039f758e74560e"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="cardconnect"><file name="ccgateway.js" hash="8cdc10f11ac358a464e78277a8c191a7"/></dir></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
