Version Notes
Async Mode as mandatory.
Download this release
Release Info
Developer | ClearSale Dev Team |
Extension | ClearSale_Total |
Version | 1.1.3 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.1.3
- app/code/community/Clearsale/Total/Model/Authorizenet.php +15 -16
- app/code/community/Clearsale/Total/Model/Observer.php +93 -202
- app/code/community/Clearsale/Total/Model/Utils/Status.php +2 -0
- app/code/community/Clearsale/Total/etc/config.xml +8 -3
- app/code/community/Clearsale/Total/sql/total_setup/mysql4-install-1.1.3.php +11 -0
- app/design/frontend/base/default/template/total/getorderstatus.phtml +16 -5
- package.xml +6 -7
app/code/community/Clearsale/Total/Model/Authorizenet.php
CHANGED
@@ -4,26 +4,25 @@ class Clearsale_Total_Model_Authorizenet extends Mage_Paygate_Model_Authorizenet
|
|
4 |
{
|
5 |
protected function _registercard(varien_object $response, mage_sales_model_order_payment $payment)
|
6 |
{
|
7 |
-
|
8 |
try
|
9 |
{
|
10 |
|
11 |
-
$csLog = Mage::getSingleton('total/log');
|
12 |
-
$csLog->log("Teste");
|
13 |
-
|
14 |
-
$cardInfo = parent::_registercard($response,$payment);
|
15 |
-
|
16 |
-
$avs =$response->getAvsResultCode();
|
17 |
-
|
18 |
-
$responseCode = $response->getCardCodeResponseCode();
|
19 |
-
|
20 |
-
$payment->setAdditionalInformation('clearsaleCCAvs', $avs);
|
21 |
-
$payment->setAdditionalInformation('clearsaleCCResponseCode', $responseCode);
|
22 |
-
return $cardInfo;
|
23 |
-
|
24 |
-
}catch (Exception $e) {
|
25 |
$csLog = Mage::getSingleton('total/log');
|
26 |
-
$csLog->log(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
}
|
4 |
{
|
5 |
protected function _registercard(varien_object $response, mage_sales_model_order_payment $payment)
|
6 |
{
|
|
|
7 |
try
|
8 |
{
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
$csLog = Mage::getSingleton('total/log');
|
11 |
+
$csLog->log("CreditCard Information");
|
12 |
+
|
13 |
+
$cardInfo = parent::_registercard($response,$payment);
|
14 |
+
|
15 |
+
$avs =$response->getAvsResultCode();
|
16 |
+
|
17 |
+
$responseCode = $response->getCardCodeResponseCode();
|
18 |
+
|
19 |
+
$payment->setAdditionalInformation('clearsaleCCAvs', $avs);
|
20 |
+
$payment->setAdditionalInformation('clearsaleCCResponseCode', $responseCode);
|
21 |
+
return $cardInfo;
|
22 |
+
|
23 |
+
}catch (Exception $e) {
|
24 |
+
$csLog = Mage::getSingleton('total/log');
|
25 |
+
$csLog->log($e->getMessage());
|
26 |
}
|
27 |
|
28 |
}
|
app/code/community/Clearsale/Total/Model/Observer.php
CHANGED
@@ -14,84 +14,50 @@ class Clearsale_Total_Model_Order_Entity_RequestOrder
|
|
14 |
class Clearsale_Total_Model_Observer
|
15 |
{
|
16 |
|
17 |
-
public function
|
18 |
{
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
|
23 |
-
{
|
24 |
-
|
25 |
-
$order = new Mage_Sales_Model_Order();
|
26 |
-
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
27 |
-
$order->loadByIncrementId($incrementId);
|
28 |
-
$isReanalysis = false;
|
29 |
-
$payment = $order->getPayment();
|
30 |
-
$environment = Mage::getStoreConfig("clearsale_total/general/environment");
|
31 |
-
$analysisLocation = Mage::getStoreConfig("clearsale_total/general/analysislocation");
|
32 |
-
$CreditcardMethods = explode(",", Mage::getStoreConfig("clearsale_total/general/credicardmethod"));
|
33 |
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
{
|
36 |
-
$authBO = Mage::getModel('total/auth_business_object');
|
37 |
-
$authResponse = $authBO->login($environment);
|
38 |
-
$clearSaleOrder = $this->toClearsaleOrderObject($order,$isReanalysis,$analysisLocation);
|
39 |
-
$requestOrder = new Clearsale_Total_Model_Order_Entity_RequestOrder();
|
40 |
-
$requestOrder->ApiKey = Mage::getStoreConfig("clearsale_total/general/key");
|
41 |
-
$requestOrder->LoginToken = $authResponse->Token->Value;
|
42 |
-
$requestOrder->AnalysisLocation = $analysisLocation;
|
43 |
-
$requestOrder->Orders[0] = $clearSaleOrder;
|
44 |
-
|
45 |
-
$orderBO = Mage::getModel('total/order_business_object');
|
46 |
-
|
47 |
-
$response = $orderBO->send($requestOrder,$environment);
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
}
|
59 |
-
}
|
60 |
-
}
|
61 |
-
else if($response->Body)
|
62 |
-
{
|
63 |
-
if(strpos(strtolower($response->Body),"exists"))
|
64 |
-
{
|
65 |
-
$orderStatus = new Clearsale_Total_Model_Order_Entity_Status();
|
66 |
-
$orderStatus->ID = $incrementId;
|
67 |
-
$orderStatus->Status = "AMA";
|
68 |
-
$orderStatus->Score = "";
|
69 |
-
$orderBO->save($orderStatus);
|
70 |
-
}
|
71 |
-
}
|
72 |
-
else
|
73 |
-
{
|
74 |
-
$message[1] = $response->Body;
|
75 |
-
$orderBO->createOrderControl($order->getRealOrderId(),json_encode($message));
|
76 |
-
}
|
77 |
}
|
78 |
}
|
79 |
-
|
80 |
-
catch
|
81 |
-
|
82 |
-
$csLog = Mage::getSingleton('total/log');
|
83 |
-
$csLog->log($e->getMessage());
|
84 |
-
$message = array();
|
85 |
-
$message[1] = $e->getMessage();
|
86 |
-
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
87 |
-
$orderBO = Mage::getModel('total/order_business_object');
|
88 |
-
$orderBO->createOrderControl($incrementId,json_encode($message));
|
89 |
-
|
90 |
}
|
91 |
-
|
92 |
-
|
93 |
}
|
94 |
-
|
95 |
public function getClearsaleOrderStatus()
|
96 |
{
|
97 |
$isActive = Mage::getStoreConfig("clearsale_total/general/active");
|
@@ -392,9 +358,16 @@ class Clearsale_Total_Model_Observer
|
|
392 |
|
393 |
$clearsaleOrder->TotalOrder = $order->getGrandTotal();
|
394 |
$clearsaleOrder->TotalItems = $TotalItems;
|
395 |
-
$clearsaleOrder->TotalShipping = $order->getShippingInclTax();
|
396 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
|
|
|
398 |
|
399 |
return $clearsaleOrder;
|
400 |
|
@@ -443,8 +416,7 @@ class Clearsale_Total_Model_Observer
|
|
443 |
return 4;
|
444 |
}
|
445 |
}
|
446 |
-
|
447 |
-
|
448 |
public function getCategoryName($product)
|
449 |
{
|
450 |
$categoryIds = $product->getCategoryIds();
|
@@ -531,23 +503,23 @@ class Clearsale_Total_Model_Observer
|
|
531 |
|
532 |
public function sendSpecificOrder($orderId)
|
533 |
{
|
|
|
534 |
try {
|
535 |
$isActive = Mage::getStoreConfig("clearsale_total/general/active");
|
536 |
|
537 |
if ($isActive)
|
538 |
{
|
539 |
-
|
540 |
$order = new Mage_Sales_Model_Order();
|
541 |
$order->loadByIncrementId($orderId);
|
542 |
-
$
|
543 |
-
$storeId = $order->getStoreId();
|
544 |
-
$payment = $order->getPayment();
|
545 |
-
$environment = Mage::getStoreConfig("clearsale_total/general/environment",$storeId);
|
546 |
-
$analysisLocation = Mage::getStoreConfig("clearsale_total/general/analysislocation",$storeId);
|
547 |
-
$CreditcardMethods = explode(",", Mage::getStoreConfig("clearsale_total/general/credicardmethod"));
|
548 |
-
|
549 |
-
if (in_array($payment->getMethodInstance()->getCode(), $CreditcardMethods))
|
550 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
551 |
$authBO = Mage::getModel('total/auth_business_object');
|
552 |
$authResponse = $authBO->login($environment);
|
553 |
$clearSaleOrder = $this->toClearsaleOrderObject($order,$isReanalysis,$analysisLocation);
|
@@ -558,16 +530,17 @@ class Clearsale_Total_Model_Observer
|
|
558 |
$requestOrder->Orders[0] = $clearSaleOrder;
|
559 |
|
560 |
$orderBO = Mage::getModel('total/order_business_object');
|
561 |
-
|
562 |
$response = $orderBO->send($requestOrder,$environment);
|
563 |
|
|
|
564 |
return $response;
|
565 |
}
|
566 |
}
|
567 |
}
|
568 |
catch (Exception $e) {
|
569 |
|
570 |
-
|
571 |
$csLog->log($e->getMessage());
|
572 |
}
|
573 |
|
@@ -613,146 +586,64 @@ class Clearsale_Total_Model_Observer
|
|
613 |
}
|
614 |
}
|
615 |
|
616 |
-
public function getOrderAll()
|
617 |
-
{
|
618 |
-
require_once('app/Mage.php');
|
619 |
-
Mage::app();
|
620 |
-
|
621 |
-
$isActive = Mage::getStoreConfig("clearsale_total/general/active");
|
622 |
-
|
623 |
-
|
624 |
-
if ($isActive)
|
625 |
-
{
|
626 |
-
try
|
627 |
-
{
|
628 |
-
|
629 |
-
$time = time();
|
630 |
-
$to = date('Y-m-d H:i:s', $time);
|
631 |
-
$lastTime = $time - 86400; // 60*60*24
|
632 |
-
$from = date('Y-m-d H:i:s', $lastTime);
|
633 |
-
|
634 |
-
echo "lastTime $lastTime <br />";
|
635 |
-
|
636 |
-
$orders = Mage::getModel('sales/order')->getCollection()
|
637 |
-
->addFieldToFilter('status', array('null' => true))
|
638 |
-
->addAttributeToFilter('created_at', array('from' => $from, 'to' => $to));
|
639 |
-
|
640 |
-
if($orders)
|
641 |
-
{
|
642 |
-
foreach ($orders as $order) {
|
643 |
-
|
644 |
-
$storeId = $order->getStoreId();
|
645 |
-
|
646 |
-
$environment = Mage::getStoreConfig("clearsale_total/general/environment",$storeId);
|
647 |
-
$analysisLocation = Mage::getStoreConfig("clearsale_total/general/analysislocation",$storeId);
|
648 |
-
$authBO = Mage::getModel('total/auth_business_object');
|
649 |
-
$authResponse = $authBO->login($environment);
|
650 |
-
$orderBO = Mage::getModel('total/order_business_object');
|
651 |
-
|
652 |
-
if($authResponse)
|
653 |
-
{
|
654 |
-
$orderId = $order->getRealOrderId();
|
655 |
-
$requestOrder = Mage::getModel('total/order_entity_requestorder');
|
656 |
-
$requestOrder->ApiKey = Mage::getStoreConfig("clearsale_total/general/key",$storeId);
|
657 |
-
$requestOrder->LoginToken = $authResponse->Token->Value;;
|
658 |
-
$requestOrder->AnalysisLocation = $analysisLocation;
|
659 |
-
$requestOrder->Orders = array();
|
660 |
-
$requestOrder->Orders[0] = $orderId;
|
661 |
-
$ResponseOrder = $orderBO->get($requestOrder,$environment);
|
662 |
-
$orderBO->Update($ResponseOrder->Orders[0]);
|
663 |
-
}
|
664 |
-
|
665 |
-
}
|
666 |
-
}
|
667 |
-
}
|
668 |
-
catch (Exception $e)
|
669 |
-
{
|
670 |
-
$csLog = Mage::getSingleton('total/log');
|
671 |
-
$csLog->log($e->getMessage());
|
672 |
-
}
|
673 |
-
}
|
674 |
|
675 |
-
|
676 |
-
|
677 |
-
public function retry()
|
678 |
{
|
679 |
-
|
680 |
-
require_once('app/Mage.php');
|
681 |
Mage::app();
|
682 |
|
683 |
$isActive = Mage::getStoreConfig("clearsale_total/general/active");
|
684 |
-
|
685 |
-
|
686 |
|
687 |
if ($isActive)
|
688 |
-
{
|
689 |
-
|
690 |
$orderBO = Mage::getModel('total/order_business_object');
|
691 |
|
692 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
693 |
|
694 |
if($orders)
|
695 |
{
|
696 |
-
foreach ($orders as $
|
697 |
{
|
698 |
-
|
699 |
{
|
700 |
-
|
701 |
-
|
702 |
-
$attemps = $orderControl["attempts"];
|
703 |
-
|
704 |
-
$message = $orderControl["diagnostics"];
|
705 |
-
$messages = array();
|
706 |
-
$messages = json_decode($message,true);
|
707 |
-
$attemps = $attemps + 1;
|
708 |
-
|
709 |
-
$response = $this->sendSpecificOrder($orderId);
|
710 |
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
|
715 |
-
|
716 |
-
{
|
717 |
-
if($orderResponse->Orders)
|
718 |
{
|
719 |
-
|
720 |
-
|
721 |
}
|
722 |
-
|
723 |
-
}
|
724 |
-
else if($response->Body)
|
725 |
-
{
|
726 |
-
$csLog = Mage::getSingleton('total/log');
|
727 |
-
$csLog->log("Atualizando o pedido 1");
|
728 |
-
if(strpos(strtolower($response->Body),"exists"))
|
729 |
-
{
|
730 |
-
$csLog->log("Atualizando o pedido 2");
|
731 |
-
$orderStatus = new Clearsale_Total_Model_Order_Entity_Status();
|
732 |
-
$orderStatus->ID = $orderControl["order_id"];
|
733 |
-
$orderStatus->Status = "AMA";
|
734 |
-
$orderStatus->Score = "";
|
735 |
-
$orderBO->save($orderStatus);
|
736 |
-
$orderBO->setOrderControl($orderStatus->ID,true,$attemps,$message);
|
737 |
-
}
|
738 |
-
}
|
739 |
-
else
|
740 |
{
|
741 |
-
$
|
742 |
-
|
743 |
-
$
|
|
|
|
|
|
|
744 |
}
|
745 |
-
} catch (Exception $e)
|
746 |
-
{
|
747 |
-
$csLog = Mage::getSingleton('total/log');
|
748 |
-
$csLog->log($e->getMessage());
|
749 |
}
|
750 |
-
|
751 |
-
|
|
|
|
|
752 |
}
|
753 |
-
|
754 |
-
|
755 |
}
|
756 |
}
|
757 |
-
|
|
|
758 |
}
|
14 |
class Clearsale_Total_Model_Observer
|
15 |
{
|
16 |
|
17 |
+
public function create($evt)
|
18 |
{
|
19 |
+
$csLog = Mage::getSingleton('total/log');
|
20 |
+
try {
|
21 |
|
22 |
+
$isActive = Mage::getStoreConfig("clearsale_total/general/active");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
+
if ($isActive)
|
25 |
+
{
|
26 |
+
$csLog->log('gravar pedido');
|
27 |
+
$session = Mage::getSingleton("core/session")->getEncryptedSessionId();
|
28 |
+
$orderBO = Mage::getModel('total/order_business_object');
|
29 |
+
$magentoOrder = $evt->getOrder();//new Mage_Sales_Model_Order();
|
30 |
+
$orderID = $magentoOrder->getRealOrderId();//Mage::getSingleton('checkout/session')->getQuoteId();
|
31 |
+
//$magentoOrder->loadByIncrementId($orderID);
|
32 |
+
$payment = $magentoOrder->getPayment();
|
33 |
+
$csStatus = array('pending_clearsale','approved_clearsale','reproved_clearsale','canceled_clearsale','analysing_clearsale');
|
34 |
+
$CreditcardMethods = explode(",", Mage::getStoreConfig("clearsale_total/general/credicardmethod"));
|
35 |
+
$magentoStatus = $magentoOrder->getStatus();
|
36 |
+
|
37 |
+
$csLog->log('Status : ' . $magentoStatus . ' ID: ' . $orderID );
|
38 |
+
|
39 |
+
if($payment)
|
40 |
+
{
|
41 |
+
if (!in_array($magentoStatus,$csStatus))
|
42 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
+
if (in_array($payment->getMethodInstance()->getCode(), $CreditcardMethods))
|
45 |
+
{
|
46 |
+
$order = new Clearsale_Total_Model_Order_Entity_Status();
|
47 |
+
$payment->setAdditionalInformation('clearsaleSessionID', $session);
|
48 |
+
$order->ID = $orderID;
|
49 |
+
$order->Status = 'PED';
|
50 |
+
$orderBO->save($order);
|
51 |
+
$csLog->log('gravar pedido - OK');
|
52 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
}
|
55 |
+
}
|
56 |
+
}catch(Exception $e){
|
57 |
+
$csLog->log($e->getMessage());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
|
|
|
|
59 |
}
|
60 |
+
|
61 |
public function getClearsaleOrderStatus()
|
62 |
{
|
63 |
$isActive = Mage::getStoreConfig("clearsale_total/general/active");
|
358 |
|
359 |
$clearsaleOrder->TotalOrder = $order->getGrandTotal();
|
360 |
$clearsaleOrder->TotalItems = $TotalItems;
|
361 |
+
$clearsaleOrder->TotalShipping = $order->getShippingInclTax();
|
362 |
+
|
363 |
+
$sessionID = $payment->getAdditionalInformation('clearsaleSessionID');
|
364 |
+
|
365 |
+
if(empty($sessionID))
|
366 |
+
{
|
367 |
+
$sessionID = session_id();
|
368 |
+
}
|
369 |
|
370 |
+
$clearsaleOrder->SessionID = $sessionID;
|
371 |
|
372 |
return $clearsaleOrder;
|
373 |
|
416 |
return 4;
|
417 |
}
|
418 |
}
|
419 |
+
|
|
|
420 |
public function getCategoryName($product)
|
421 |
{
|
422 |
$categoryIds = $product->getCategoryIds();
|
503 |
|
504 |
public function sendSpecificOrder($orderId)
|
505 |
{
|
506 |
+
$csLog = Mage::getSingleton('total/log');
|
507 |
try {
|
508 |
$isActive = Mage::getStoreConfig("clearsale_total/general/active");
|
509 |
|
510 |
if ($isActive)
|
511 |
{
|
512 |
+
$csLog->log('Enviar Order ->' . $orderId);
|
513 |
$order = new Mage_Sales_Model_Order();
|
514 |
$order->loadByIncrementId($orderId);
|
515 |
+
if(!empty($order))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
516 |
{
|
517 |
+
$isReanalysis = false;
|
518 |
+
$storeId = $order->getStoreId();
|
519 |
+
$payment = $order->getPayment();
|
520 |
+
$environment = Mage::getStoreConfig("clearsale_total/general/environment",$storeId);
|
521 |
+
$analysisLocation = Mage::getStoreConfig("clearsale_total/general/analysislocation",$storeId);
|
522 |
+
$CreditcardMethods = explode(",", Mage::getStoreConfig("clearsale_total/general/credicardmethod"));
|
523 |
$authBO = Mage::getModel('total/auth_business_object');
|
524 |
$authResponse = $authBO->login($environment);
|
525 |
$clearSaleOrder = $this->toClearsaleOrderObject($order,$isReanalysis,$analysisLocation);
|
530 |
$requestOrder->Orders[0] = $clearSaleOrder;
|
531 |
|
532 |
$orderBO = Mage::getModel('total/order_business_object');
|
533 |
+
|
534 |
$response = $orderBO->send($requestOrder,$environment);
|
535 |
|
536 |
+
$csLog->log('<br />Enviar Order ->' . $orderId . ' OK ');
|
537 |
return $response;
|
538 |
}
|
539 |
}
|
540 |
}
|
541 |
catch (Exception $e) {
|
542 |
|
543 |
+
|
544 |
$csLog->log($e->getMessage());
|
545 |
}
|
546 |
|
586 |
}
|
587 |
}
|
588 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
|
590 |
+
public function sendPendingOrders()
|
|
|
|
|
591 |
{
|
592 |
+
require_once('app/Mage.php');
|
|
|
593 |
Mage::app();
|
594 |
|
595 |
$isActive = Mage::getStoreConfig("clearsale_total/general/active");
|
596 |
+
|
|
|
597 |
|
598 |
if ($isActive)
|
599 |
+
{
|
600 |
+
$csLog = Mage::getSingleton('total/log');
|
601 |
$orderBO = Mage::getModel('total/order_business_object');
|
602 |
|
603 |
+
$time = time();
|
604 |
+
$to = date('Y-m-d H:i:s', $time);
|
605 |
+
$lastTime = $time - 86400; // 60*60*24
|
606 |
+
$from = date('Y-m-d H:i:s', $lastTime);
|
607 |
+
|
608 |
+
$orders = Mage::getModel('sales/order')->getCollection()
|
609 |
+
->addFieldToFilter('status', 'pending_clearsale')
|
610 |
+
->addAttributeToFilter('created_at', array('from' => $from, 'to' => $to));
|
611 |
|
612 |
if($orders)
|
613 |
{
|
614 |
+
foreach ($orders as $order)
|
615 |
{
|
616 |
+
try
|
617 |
{
|
618 |
+
$orderId = $order->getRealOrderId();
|
619 |
+
$response = $this->sendSpecificOrder($orderId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
620 |
|
621 |
+
if($response->HttpCode == 200)
|
622 |
+
{
|
623 |
+
$orderResponse = json_decode($response->Body);
|
624 |
|
625 |
+
if($orderResponse)
|
|
|
|
|
626 |
{
|
627 |
+
if(!empty($orderResponse->Orders))
|
628 |
+
$orderBO->Update($orderResponse->Orders[0]);
|
629 |
}
|
630 |
+
}else if(strpos(strtolower($response->Body),"exists"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
631 |
{
|
632 |
+
$csLog->log('atualizar pedido');
|
633 |
+
$orderStatus = new Clearsale_Total_Model_Order_Entity_Status();
|
634 |
+
$orderStatus->ID = $orderId;
|
635 |
+
$orderStatus->Status = 'AMA';
|
636 |
+
$orderBO->Update($orderStatus);
|
637 |
+
$csLog->log('atualizar pedido - OK');
|
638 |
}
|
|
|
|
|
|
|
|
|
639 |
}
|
640 |
+
catch (Exception $e) {
|
641 |
+
$csLog->log($e->getMessage());
|
642 |
+
}
|
643 |
+
}
|
644 |
}
|
|
|
|
|
645 |
}
|
646 |
}
|
647 |
+
|
648 |
+
|
649 |
}
|
app/code/community/Clearsale/Total/Model/Utils/Status.php
CHANGED
@@ -4,6 +4,7 @@ class Clearsale_Total_Model_Utils_Status
|
|
4 |
{
|
5 |
public function toMagentoStatus($clearSaleStatus)
|
6 |
{
|
|
|
7 |
switch($clearSaleStatus)
|
8 |
{
|
9 |
case "NVO" :
|
@@ -16,6 +17,7 @@ public function toMagentoStatus($clearSaleStatus)
|
|
16 |
case "APM" :
|
17 |
case "APA" : $status = "approved_clearsale";break;
|
18 |
case "CAN" : $status = "canceled_clearsale";break;
|
|
|
19 |
break;
|
20 |
}
|
21 |
|
4 |
{
|
5 |
public function toMagentoStatus($clearSaleStatus)
|
6 |
{
|
7 |
+
$status = '';
|
8 |
switch($clearSaleStatus)
|
9 |
{
|
10 |
case "NVO" :
|
17 |
case "APM" :
|
18 |
case "APA" : $status = "approved_clearsale";break;
|
19 |
case "CAN" : $status = "canceled_clearsale";break;
|
20 |
+
case "PED" : $status = "pending_clearsale";break;
|
21 |
break;
|
22 |
}
|
23 |
|
app/code/community/Clearsale/Total/etc/config.xml
CHANGED
@@ -24,6 +24,11 @@
|
|
24 |
</clearsaleorderdiagnostic>
|
25 |
</entities>
|
26 |
</total_mysql4>
|
|
|
|
|
|
|
|
|
|
|
27 |
</models>
|
28 |
<blocks>
|
29 |
<total>
|
@@ -67,15 +72,15 @@
|
|
67 |
</clearsale_total>
|
68 |
</observers>
|
69 |
</sales_order_payment_place_start>
|
70 |
-
<
|
71 |
<observers>
|
72 |
<clearsale_total>
|
73 |
<type>singleton</type>
|
74 |
<class>Clearsale_Total_Model_Observer</class>
|
75 |
-
<method>
|
76 |
</clearsale_total>
|
77 |
</observers>
|
78 |
-
</
|
79 |
</events>
|
80 |
<frontend>
|
81 |
<routers>
|
24 |
</clearsaleorderdiagnostic>
|
25 |
</entities>
|
26 |
</total_mysql4>
|
27 |
+
<paygate>
|
28 |
+
<rewrite>
|
29 |
+
<authorizenet>Clearsale_Total_Model_Authorizenet</authorizenet>
|
30 |
+
</rewrite>
|
31 |
+
</paygate>
|
32 |
</models>
|
33 |
<blocks>
|
34 |
<total>
|
72 |
</clearsale_total>
|
73 |
</observers>
|
74 |
</sales_order_payment_place_start>
|
75 |
+
<sales_order_save_after>
|
76 |
<observers>
|
77 |
<clearsale_total>
|
78 |
<type>singleton</type>
|
79 |
<class>Clearsale_Total_Model_Observer</class>
|
80 |
+
<method>create</method>
|
81 |
</clearsale_total>
|
82 |
</observers>
|
83 |
+
</sales_order_save_after>
|
84 |
</events>
|
85 |
<frontend>
|
86 |
<routers>
|
app/code/community/Clearsale/Total/sql/total_setup/mysql4-install-1.1.3.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
|
5 |
+
$status = Mage::getModel('sales/order_status');
|
6 |
+
$status->setStatus('pending_clearsale');
|
7 |
+
$status->setLabel('Pending ClearSale');
|
8 |
+
$status->save();
|
9 |
+
|
10 |
+
$installer->endSetup();
|
11 |
+
|
app/design/frontend/base/default/template/total/getorderstatus.phtml
CHANGED
@@ -15,11 +15,22 @@ if ($isActive)
|
|
15 |
|
16 |
if($apikey == $_GET["apikey"])
|
17 |
{
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
}
|
24 |
}
|
25 |
}
|
15 |
|
16 |
if($apikey == $_GET["apikey"])
|
17 |
{
|
18 |
+
if($_GET["action"])
|
19 |
+
{
|
20 |
+
$obj = Mage::getModel('total/observer');
|
21 |
+
$action = $_GET["action"];
|
22 |
+
if($action == 'get')
|
23 |
+
{
|
24 |
+
echo "Buscar<br />";
|
25 |
+
$obj->getClearsaleOrderStatus();
|
26 |
+
}else if($action= 'send')
|
27 |
+
{
|
28 |
+
echo "Enviar<br />";
|
29 |
+
$obj->sendPendingOrders();
|
30 |
+
}
|
31 |
+
|
32 |
+
echo "OK";
|
33 |
+
}
|
34 |
}
|
35 |
}
|
36 |
}
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ClearSale_Total</name>
|
4 |
-
<version>1.1.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL</license>
|
7 |
<channel>community</channel>
|
@@ -13,13 +13,12 @@ Because of the nature of the market the country was born in, considered one of t
|
|
13 |
We offer a 100% chargeback guarantee and a fully outsourced fraud management solution. We give you the final decision: (a) to sell - the order has a minimum risk of becoming a chargeback or (b) do not sell - we already checked the order and know that that order is a fraudulent one. As no order is automatically turned down, these orders have to be analyzed by people with special skills and training to detect subtle details to avoid turning down good customers.
|
14 |
We charge a fixed % only for approved transactions, regardless of whether the decision was automatic or not. The more orders we approve and the lower our client’s chargebacks, the more Clearsale benefits. We also have an incentive to increase our instant decisions, since this improves our cost structure and the buying experience of our clients. 
|
15 |
More than offering tools, Clearsale is always looking for the optimum balance between chargeback losses, orders rejected and response time.</description>
|
16 |
-
<notes>
|
17 |
-

|
18 |
</notes>
|
19 |
-
<authors><author><name>
|
20 |
-
<date>2016-
|
21 |
-
<time>08:
|
22 |
-
<contents><target name="magecommunity"><dir name="Clearsale"><dir name="Total"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="View.php" hash="92bdbfdd90c3b7e1040252bf15950dd1"/><file name="testimonial.txt" hash="c3e091a20252d989f80da96ffecd74ae"/></dir></dir><file name="Totalbackend.php" hash="8bb5082623943fa6686af41de4f25119"/></dir></dir><dir name="Helper"><file name="Data.php" hash="e2372ddf1f40626c1b85549d78f3eed2"/></dir><dir name="Model"><dir name="Auth"><dir name="Business"><file name="Object.php" hash="a75e924d9fde7432a39a87483799ded3"/></dir><dir name="Entity"><file name="Credentials.php" hash="a0c74f0eb00025a4fa0ea1a5632cff25"/><file name="RequestAuth.php" hash="3b07965ef09be73b7ad672b97efb2a82"/><file name="ResponseAuth.php" hash="d4236e408c52abc32b19b90c2ae9ed67"/><file name="Token.php" hash="ab6b05a2b1bafe66bf42ef1c68a74008"/></dir></dir><file name="Authorizenet.php" hash="
|
23 |
<compatible/>
|
24 |
<dependencies><required><php><min>4.4.1</min><max>5.6.13</max></php></required></dependencies>
|
25 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ClearSale_Total</name>
|
4 |
+
<version>1.1.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL</license>
|
7 |
<channel>community</channel>
|
13 |
We offer a 100% chargeback guarantee and a fully outsourced fraud management solution. We give you the final decision: (a) to sell - the order has a minimum risk of becoming a chargeback or (b) do not sell - we already checked the order and know that that order is a fraudulent one. As no order is automatically turned down, these orders have to be analyzed by people with special skills and training to detect subtle details to avoid turning down good customers.
|
14 |
We charge a fixed % only for approved transactions, regardless of whether the decision was automatic or not. The more orders we approve and the lower our client’s chargebacks, the more Clearsale benefits. We also have an incentive to increase our instant decisions, since this improves our cost structure and the buying experience of our clients. 
|
15 |
More than offering tools, Clearsale is always looking for the optimum balance between chargeback losses, orders rejected and response time.</description>
|
16 |
+
<notes>Async Mode as mandatory.
|
|
|
17 |
</notes>
|
18 |
+
<authors><author><name>ClearSale Dev Team</name><user>clearsale_dev</user><email>support@clear.sale</email></author></authors>
|
19 |
+
<date>2016-12-21</date>
|
20 |
+
<time>08:13:49</time>
|
21 |
+
<contents><target name="magecommunity"><dir name="Clearsale"><dir name="Total"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="View.php" hash="92bdbfdd90c3b7e1040252bf15950dd1"/><file name="testimonial.txt" hash="c3e091a20252d989f80da96ffecd74ae"/></dir></dir><file name="Totalbackend.php" hash="8bb5082623943fa6686af41de4f25119"/></dir></dir><dir name="Helper"><file name="Data.php" hash="e2372ddf1f40626c1b85549d78f3eed2"/></dir><dir name="Model"><dir name="Auth"><dir name="Business"><file name="Object.php" hash="a75e924d9fde7432a39a87483799ded3"/></dir><dir name="Entity"><file name="Credentials.php" hash="a0c74f0eb00025a4fa0ea1a5632cff25"/><file name="RequestAuth.php" hash="3b07965ef09be73b7ad672b97efb2a82"/><file name="ResponseAuth.php" hash="d4236e408c52abc32b19b90c2ae9ed67"/><file name="Token.php" hash="ab6b05a2b1bafe66bf42ef1c68a74008"/></dir></dir><file name="Authorizenet.php" hash="f4d4e0d623d4a642c9a3ded859bb4168"/><dir name="Gateway"><file name="Authorizenet.php" hash="5facb6fd677fde085625bb510dab13e1"/></dir><file name="Log.php" hash="4ef1d30b39450a84919284b093b3f9b8"/><dir name="Mysql4"><dir name="Clearsaleorderdiagnostic"><file name="Collection.php" hash="5ecea4a48d5eb3b2bcd7cc413b40c9e9"/></dir><file name="Clearsaleorderdiagnostic.php" hash="cd81082bccda08a7f5725f24dc56fb19"/></dir><file name="Observer.php" hash="ac7f0c18fa726d7899079d540b618820"/><dir name="Order"><dir name="Business"><file name="Object.php" hash="31fb1bed92a1169a48370efaf23e8095"/></dir><dir name="Entity"><file name="Address.php" hash="75efca7d3a5b595aeca5171ba944f15c"/><file name="CustomField.php" hash="bfbe2c97fa78575a887d470d864dd723"/><file name="Diagnostic.php" hash="d96e05ff7fad3f619418b30729bec133"/><file name="Item.php" hash="9fe1b333deb3c7651c33e8ea0a769352"/><file name="Order.php" hash="74d8d917208014ad32c0ec22c8bd5874"/><file name="Payment.php" hash="f76c5abf01a17350fb10d06ac5b8e451"/><file name="Person.php" hash="19492db5e1a66cdff3a3725712dd55ff"/><file name="Phone.php" hash="9a47b48b2915685ea978e0d44c732dfc"/><file name="ResponseOrder.php" hash="78f0fa0225acccd8bae760576f2b584c"/><file name="Status.php" hash="de2201c06c9109ba28ae37eea9cc5a98"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Analysislocation"><file name="Values.php" hash="2bea7b2d240748262997c5255147dc43"/></dir><dir name="Cron"><file name="Values.php" hash="0039f5f91e8b31e46197cfc91f1db96f"/></dir><dir name="Environment"><file name="Values.php" hash="d2716bd93c212bb1717d7951a552eff3"/></dir><dir name="OrderStatus"><file name="Values.php" hash="2bff6581aa0320b3067b6914b86ac0f2"/></dir><dir name="Paymentmethod"><file name="Values.php" hash="00023fd6ebb78fc692cfe5f4d8757257"/></dir></dir></dir></dir><dir name="Utils"><file name="HttpHelper.php" hash="c1035d3caa764ff7a8b74fefc7a85440"/><file name="HttpMessage.php" hash="81a7aab4bf241d7e9838a8edacf772e9"/><file name="Status.php" hash="14afbf39cdec95fe1e3707455a85735f"/></dir><file name="app - Atalho.lnk" hash="4604eb44c9c8fdb3fc6e3f82ab86eb21"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="TotalbackendController.php" hash="246df39ec4bc19f9a65f57d6f4d5ff20"/></dir><file name="IndexController.php" hash="dd6c505031b4278d6a57179d7245d217"/><dir name="Integration"><file name="IndexController.php" hash="8eb2f144d0eaa9bef40e476f9c28c311"/></dir></dir><dir name="etc"><file name="config.xml" hash="581049b83e4e6159493c3d1ebe12afde"/><file name="system.xml" hash="821337cc4f8ec348c45f21d0084e6a3d"/></dir><dir name="sql"><dir name="total_setup"><file name="mysql4-install-1.0.1.php" hash="dc54c04d5b5f2f7715a24dbca414dcac"/><file name="mysql4-install-1.1.3.php" hash="9c252bf70ba58fa5cb9766b036dba693"/><file name="mysql4-upgrade-1.0.3-1.1.0.php" hash="e4e7907b576eb2543e2ee9078e4927d4"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="total.xml" hash="b20fb23ff3df99b69874c8b6513b148f"/></dir><dir name="template"><dir name="total"><file name="totalbackend.phtml" hash="38c275932ab4a801ade0572d16b3ca0c"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="total.xml" hash="1677f62474494d918fd012da57f6cb54"/></dir><dir name="template"><dir name="total"><file name="fingerprint.phtml" hash="7ec23ab40ab28a0fc7f77d1421041721"/><file name="getorderstatus.phtml" hash="ff5c297a1a594607024888293181557e"/><file name="mapper.phtml" hash="6b3b2c690d4c0509d497fc94433aaab9"/><file name="meta_account_create.phtml" hash="9942098ce07732b0011e513da0fea91b"/><file name="meta_account_edit.phtml" hash="9f992ff686789d059a9a5ff4801e3884"/><file name="meta_cart.phtml" hash="013250fb64b4dc6cf50082898c345657"/><file name="meta_checkout.phtml" hash="10e00a4bc18f4e07050fd440d3c3f290"/><file name="meta_contact.phtml" hash="7eef5f6c488368ca91dc43827f6d4fdc"/><file name="meta_home.phtml" hash="e53aeefb23c4e4b3a1380c659d49494e"/><file name="meta_pass_fail.phtml" hash="1404a1f3c07d0574fce666b72f770e32"/><file name="meta_password_reset.phtml" hash="a6ecdc56b080695e03499cad8f93dea5"/><file name="meta_product.html" hash="21e064ad8b3b6c8587b4e48a229a97b0"/><file name="meta_purchase_confirmation.phtml" hash="2ee03b7ee3f60bd1489c103020b215ab"/><file name="meta_search.phtml" hash="c452fede6e703b549bc939f7a28bab50"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Clearsale_Total.xml" hash="f43234d3956fbbbe0a6d8c90fd59b3e7"/></dir></target><target name="mage"><dir name="js"><dir name="clearsale"><dir name="total"><dir name="Graphs"><file name="graph-data.js" hash="6871eca20564813f7ecf413fc7478883"/></dir><dir name="Plugin"><file name="morris.min.js" hash="fadac462637afd6cdc0cb0a0137629af"/><file name="raphael.min.js" hash="df3aee40d12beaa16159fa297d28c132"/></dir><file name="bootstrap.min.js" hash="046ba2b5f4cff7d2eaaa1af55caa9fd8"/><file name="formats.js" hash="6084ce895fb54436ecc842d78751b53d"/><file name="jquery-1.11.1.js" hash="8101d596b2b8fa35fe3a634ea342d7c3"/><file name="jquery-2.1.1.min.js" hash="e40ec2161fe7993196f23c8a07346306"/><file name="jquery.clearsale.js" hash="94e83745ccf9ab784331e181c029bd9b"/><file name="jquery.js" hash="3c9137d88a00b1ae0b41ff6a70571615"/><file name="noconflict.js" hash="3179f2255b046d5f2e9a71e365287bef"/><file name="timeago.js" hash="b1e1d1a0576a9a952d2fdac4c3dd321f"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="clearsale"><dir name="font"><file name="klavikalight-osf-webfont.eot" hash="70c694623ae6e600d65b17cb767ec64a"/><file name="klavikalight-osf-webfont.svg" hash="318c533f3c8563ca910f9b74bb0acf41"/><file name="klavikalight-osf-webfont.ttf" hash="53adda2104cc31f2e2d332e372bd020e"/><file name="klavikalight-osf-webfont.woff" hash="2a0466f4aa6715c05dff3a62c37bec3d"/><file name="klavikalight-osf-webfont.woff2" hash="85bbd3b7ba594c02340da194b5b2d1b3"/><file name="klavikalight-plain-webfont.eot" hash="b83fe7b442d00705780147aa583d34f9"/><file name="klavikalight-plain-webfont.svg" hash="a0f73c6fc6dffbf3d18c63ec6c3b5191"/><file name="klavikalight-plain-webfont.ttf" hash="94609b6db82cfc5adb6a4b29603f551d"/><file name="klavikalight-plain-webfont.woff" hash="f704cce62e9b346845cc1111cc0f604b"/><file name="klavikalight-plain-webfont.woff2" hash="bcf62c18730f756a848bc1cb5b631bd3"/><file name="klavikamedium-osf-webfont.eot" hash="a6435da6686dfe15caf1b7b916a71d96"/><file name="klavikamedium-osf-webfont.svg" hash="c4ebeb1cb0df09e2717345b233555855"/><file name="klavikamedium-osf-webfont.ttf" hash="290323eee0539406adde3637294bae2b"/><file name="klavikamedium-osf-webfont.woff" hash="f35c8871e39ae9bad7b173bf02c2c111"/><file name="klavikamedium-osf-webfont.woff2" hash="d43a2625c3252dcf5405617c058be2b6"/><file name="klavikaregular-osf-webfont.eot" hash="8146f953bb696559fd3c277dad2e3075"/><file name="klavikaregular-osf-webfont.svg" hash="fa60750a7d4c93ed7a621e67321140cd"/><file name="klavikaregular-osf-webfont.ttf" hash="de531bd4e7e99df5d672bc253b886969"/><file name="klavikaregular-osf-webfont.woff" hash="f168b99aad67559207101a9a792f6a24"/><file name="klavikaregular-osf-webfont.woff2" hash="4d45eb7fd558c191c91bc0da5190784e"/></dir><dir name="total"><file name="app.css" hash="437bd0c5441986efc8ce0a53eeb4654f"/><file name="bootstrap.css" hash="d2ab08de4855f3f73d2ecec6da794293"/><file name="bootstrap.min.css" hash="3ab3438f85ad9f9e27e1af1facf0a9c4"/><file name="dashboard.css" hash="547897957c8a66d307a36ea9ae3c2fe0"/><dir name="fonts"><file name="Material-Design-Iconic-Font.eot" hash="83d896ed524d89eb7cb1273e26be3ea6"/><file name="Material-Design-Iconic-Font.svg" hash="6383f1e33e4159197aa854dfac4676e1"/><file name="Material-Design-Iconic-Font.ttf" hash="aa1af632841550199ebdf0c3cc1e47a6"/><file name="Material-Design-Iconic-Font.woff" hash="a2a1ba89e7f9d29f7d5aee76e8b9f7ab"/></dir><file name="material-design-iconic-font.min.css" hash="ed31cc228d731ae1f667d440cc00fceb"/><file name="morris.css" hash="36e70bf949fcdb7d0fe55fc16ce86445"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="."><file name="clearsalegetorders.php" hash="6012a01a456a3a26256a8a75c1c269eb"/><file name="clearsaleretry.php" hash="a5cd59cc326cd5a7b125567901477b03"/></dir></target></contents>
|
22 |
<compatible/>
|
23 |
<dependencies><required><php><min>4.4.1</min><max>5.6.13</max></php></required></dependencies>
|
24 |
</package>
|