Version Notes
- logs separated from system.log file
- declining commissions that were paid out fixed
Download this release
Release Info
Developer | Quality Unit, LLC |
Extension | Qualityunit_Pap |
Version | 1.2.2 |
Comparing to | |
See all releases |
Code changes from version 1.2.1 to 1.2.2
- app/code/local/Qualityunit/Pap/Block/Clicktracking.php +2 -2
- app/code/local/Qualityunit/Pap/Block/Saletracking.php +3 -3
- app/code/local/Qualityunit/Pap/Helper/Data.php +12 -0
- app/code/local/Qualityunit/Pap/Model/Checkout/Observer.php +1 -1
- app/code/local/Qualityunit/Pap/Model/Config/Source/TrackSales.php +9 -9
- app/code/local/Qualityunit/Pap/Model/Observer.php +83 -81
- app/code/local/Qualityunit/Pap/Model/Pap.php +72 -16
- app/code/local/Qualityunit/Pap/Model/Paypal.php +1 -1
- app/code/local/Qualityunit/Pap/Model/PaypalIpn.php +5 -5
- app/code/local/Qualityunit/Pap/etc/config.xml +1 -1
- app/etc/modules/Qualityunit_Pap.xml +1 -1
- package.xml +6 -5
app/code/local/Qualityunit/Pap/Block/Clicktracking.php
CHANGED
@@ -3,12 +3,12 @@ class Qualityunit_Pap_Block_Clicktracking extends Mage_Core_Block_Text {
|
|
3 |
protected function _toHtml() {
|
4 |
$config = Mage::getSingleton('pap/config');
|
5 |
if (!$config->isConfigured()) {
|
6 |
-
Mage::log('Postaffiliatepro: The module is still not configured!');
|
7 |
return '';
|
8 |
}
|
9 |
|
10 |
if (!$config->isClickTrackingEnabled()) {
|
11 |
-
Mage::log('Postaffiliatepro: Click tracking is turned off.');
|
12 |
return '';
|
13 |
}
|
14 |
|
3 |
protected function _toHtml() {
|
4 |
$config = Mage::getSingleton('pap/config');
|
5 |
if (!$config->isConfigured()) {
|
6 |
+
Mage::helper('pap')->log('Postaffiliatepro: The module is still not configured!');
|
7 |
return '';
|
8 |
}
|
9 |
|
10 |
if (!$config->isClickTrackingEnabled()) {
|
11 |
+
Mage::helper('pap')->log('Postaffiliatepro: Click tracking is turned off.');
|
12 |
return '';
|
13 |
}
|
14 |
|
app/code/local/Qualityunit/Pap/Block/Saletracking.php
CHANGED
@@ -3,12 +3,12 @@ class Qualityunit_Pap_Block_SaleTracking extends Mage_Core_Block_Text {
|
|
3 |
protected function _toHtml() {
|
4 |
$config = Mage::getSingleton('pap/config');
|
5 |
if (!$config->isConfigured()) {
|
6 |
-
Mage::log('Postaffiliatepro: The module is still not configured!');
|
7 |
return '';
|
8 |
}
|
9 |
|
10 |
if ($config->getTrackingMethod() != 'javascript') {
|
11 |
-
Mage::log('Postaffiliatepro: JavaScript tracking not allowed.');
|
12 |
return '';
|
13 |
}
|
14 |
|
@@ -27,7 +27,7 @@ class Qualityunit_Pap_Block_SaleTracking extends Mage_Core_Block_Text {
|
|
27 |
}
|
28 |
|
29 |
if (empty($quoteId)) {
|
30 |
-
Mage::log('Postaffiliatepro: Could not find quote ID for order details.');
|
31 |
return '';
|
32 |
}
|
33 |
|
3 |
protected function _toHtml() {
|
4 |
$config = Mage::getSingleton('pap/config');
|
5 |
if (!$config->isConfigured()) {
|
6 |
+
Mage::helper('pap')->log('Postaffiliatepro: The module is still not configured!');
|
7 |
return '';
|
8 |
}
|
9 |
|
10 |
if ($config->getTrackingMethod() != 'javascript') {
|
11 |
+
Mage::helper('pap')->log('Postaffiliatepro: JavaScript tracking not allowed.');
|
12 |
return '';
|
13 |
}
|
14 |
|
27 |
}
|
28 |
|
29 |
if (empty($quoteId)) {
|
30 |
+
Mage::helper('pap')->log('Postaffiliatepro: Could not find quote ID for order details.');
|
31 |
return '';
|
32 |
}
|
33 |
|
app/code/local/Qualityunit/Pap/Helper/Data.php
CHANGED
@@ -18,4 +18,16 @@ class Qualityunit_Pap_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
18 |
public function config($field) {
|
19 |
return Mage::getStoreConfig('pap/general/' . $field);
|
20 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
18 |
public function config($field) {
|
19 |
return Mage::getStoreConfig('pap/general/' . $field);
|
20 |
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Write a log message
|
24 |
+
*
|
25 |
+
* @param mixed $message
|
26 |
+
* @return Mage_Core_Model_Log_Adapter
|
27 |
+
*/
|
28 |
+
public function log($message) {
|
29 |
+
//return Mage::getModel('core/log_adapter', 'PostAffiliatePro.log')->log($message);
|
30 |
+
Mage::log($message, null, 'PostAffiliatePro.log');
|
31 |
+
return;
|
32 |
+
}
|
33 |
}
|
app/code/local/Qualityunit/Pap/Model/Checkout/Observer.php
CHANGED
@@ -11,7 +11,7 @@ class Qualityunit_Pap_Model_Checkout_Observer {
|
|
11 |
|
12 |
$lastOrderId = $this->getOnepage()->getCheckout()->getLastOrderId();
|
13 |
if (!$lastOrderId) {
|
14 |
-
Mage::log('Postaffiliatepro: No order has been found.');
|
15 |
return false;
|
16 |
}
|
17 |
|
11 |
|
12 |
$lastOrderId = $this->getOnepage()->getCheckout()->getLastOrderId();
|
13 |
if (!$lastOrderId) {
|
14 |
+
Mage::helper('pap')->log('Postaffiliatepro: No order has been found.');
|
15 |
return false;
|
16 |
}
|
17 |
|
app/code/local/Qualityunit/Pap/Model/Config/Source/TrackSales.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
<?php
|
2 |
-
class Qualityunit_Pap_Model_Config_Source_TrackSales {
|
3 |
-
public function toOptionArray() {
|
4 |
-
return array(
|
5 |
-
array('label'=>'JavaScript tracking', 'value'=>'javascript'),
|
6 |
-
array('label'=>'API tracking', 'value'=>'api')
|
7 |
-
);
|
8 |
-
}
|
9 |
-
}
|
1 |
+
<?php
|
2 |
+
class Qualityunit_Pap_Model_Config_Source_TrackSales {
|
3 |
+
public function toOptionArray() {
|
4 |
+
return array(
|
5 |
+
array('label'=>'JavaScript tracking', 'value'=>'javascript'),
|
6 |
+
array('label'=>'API tracking', 'value'=>'api')
|
7 |
+
);
|
8 |
+
}
|
9 |
+
}
|
app/code/local/Qualityunit/Pap/Model/Observer.php
CHANGED
@@ -1,81 +1,83 @@
|
|
1 |
-
<?php
|
2 |
-
class Qualityunit_Pap_Model_Observer {
|
3 |
-
public $declined = 'D';
|
4 |
-
public $pending = 'P';
|
5 |
-
public $approved = 'A';
|
6 |
-
|
7 |
-
public function orderModified($observer) {
|
8 |
-
$event = $observer->getEvent();
|
9 |
-
$order = $event->getOrder();
|
10 |
-
|
11 |
-
$config = Mage::getSingleton('pap/config');
|
12 |
-
if (!$config->isConfigured()) return false;
|
13 |
-
|
14 |
-
try {
|
15 |
-
Mage::log(
|
16 |
-
if ($order->getStatus() == 'holded' || $order->getStatus() == 'pending') {
|
17 |
-
Mage::getModel('pap/pap')->setOrderStatus($order, $this->pending);
|
18 |
-
return $this;
|
19 |
-
}
|
20 |
-
|
21 |
-
if ($order->getStatus() == 'canceled') {
|
22 |
-
Mage::getModel('pap/pap')->setOrderStatus($order, $this->declined);
|
23 |
-
return $this;
|
24 |
-
}
|
25 |
-
|
26 |
-
// refund
|
27 |
-
if ($order->getStatus() == 'closed') {
|
28 |
-
Mage::getModel('pap/pap')->setOrderStatus($order, $this->declined);
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
if
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
$
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
}
|
|
|
|
1 |
+
<?php
|
2 |
+
class Qualityunit_Pap_Model_Observer {
|
3 |
+
public $declined = 'D';
|
4 |
+
public $pending = 'P';
|
5 |
+
public $approved = 'A';
|
6 |
+
|
7 |
+
public function orderModified($observer) {
|
8 |
+
$event = $observer->getEvent();
|
9 |
+
$order = $event->getOrder();
|
10 |
+
|
11 |
+
$config = Mage::getSingleton('pap/config');
|
12 |
+
if (!$config->isConfigured()) return false;
|
13 |
+
|
14 |
+
try {
|
15 |
+
Mage::helper('pap')->log('Postaffiliatepro: Transaction status changed to '.$order->getStatus());
|
16 |
+
if ($order->getStatus() == 'holded' || $order->getStatus() == 'pending') {
|
17 |
+
Mage::getModel('pap/pap')->setOrderStatus($order, $this->pending);
|
18 |
+
return $this;
|
19 |
+
}
|
20 |
+
|
21 |
+
if ($order->getStatus() == 'canceled') {
|
22 |
+
Mage::getModel('pap/pap')->setOrderStatus($order, $this->declined);
|
23 |
+
return $this;
|
24 |
+
}
|
25 |
+
|
26 |
+
// refund
|
27 |
+
if ($order->getStatus() == 'closed') {
|
28 |
+
//Mage::getModel('pap/pap')->setOrderStatus($order, $this->declined);
|
29 |
+
Mage::getModel('pap/pap')->refundCommissions($order);
|
30 |
+
return $this;
|
31 |
+
}
|
32 |
+
|
33 |
+
$refunded = array();
|
34 |
+
if ($order->getStatus() == 'complete') {
|
35 |
+
if ($order->getBaseTotalPaid() > 0) { // was paid
|
36 |
+
if ($order->getBaseTotalRefunded() > 0) { // partial refund handling
|
37 |
+
$refunded = $this->getRefundedItemIDs($order);
|
38 |
+
}
|
39 |
+
Mage::getModel('pap/pap')->setOrderStatus($order, $this->approved, $refunded);
|
40 |
+
}
|
41 |
+
else { // completed but not paid
|
42 |
+
Mage::getModel('pap/pap')->setOrderStatus($order, $this->pending);
|
43 |
+
}
|
44 |
+
return $this;
|
45 |
+
}
|
46 |
+
|
47 |
+
// if we are here, it's probably a partial refund
|
48 |
+
if ($order->getBaseTotalRefunded() > 0 || $order->getBaseTotalCanceled() > 0) {
|
49 |
+
$refunded = $this->getRefundedItemIDs($order);
|
50 |
+
//Mage::getModel('pap/pap')->setOrderStatus($order, $this->declined, $refunded);
|
51 |
+
Mage::getModel('pap/pap')->refundCommissions($order, $refunded);
|
52 |
+
}
|
53 |
+
}
|
54 |
+
catch (Exception $e) {
|
55 |
+
Mage::getSingleton('adminhtml/session')->addWarning('A PAP API error occurred: '.$e->getMessage());
|
56 |
+
}
|
57 |
+
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
|
61 |
+
private function getRefundedItemIDs($order) {
|
62 |
+
$refunded = array();
|
63 |
+
$items = $order->getAllVisibleItems();
|
64 |
+
|
65 |
+
foreach($items as $i=>$item) {
|
66 |
+
if ($item->getStatus() == 'Refunded') {
|
67 |
+
$productid = $item->getProductId();
|
68 |
+
$product = Mage::getModel('catalog/product')->load($productid);
|
69 |
+
$refunded[$i] = $product->getSku();
|
70 |
+
}
|
71 |
+
}
|
72 |
+
return $refunded;
|
73 |
+
}
|
74 |
+
|
75 |
+
public function thankYouPageViewed($observer) {
|
76 |
+
$quoteId = Mage::getSingleton('checkout/session')->getLastQuoteId();
|
77 |
+
$block = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('pap_saletracking');
|
78 |
+
if ($quoteId && ($block instanceof Mage_Core_Block_Abstract)) {
|
79 |
+
$quote = Mage::getModel('sales/quote')->load($quoteId);
|
80 |
+
$block->setQuote($quote);
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
app/code/local/Qualityunit/Pap/Model/Pap.php
CHANGED
@@ -20,7 +20,7 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
|
|
20 |
if (@!$session->login($username, $password)) {
|
21 |
$session = new Gpf_Api_Session(str_replace('http://','https://',$url));
|
22 |
if (@!$session->login($username, $password)) {
|
23 |
-
Mage::log('Postaffiliatepro: Could not initiate API session: '.$session->getMessage());
|
24 |
return null;
|
25 |
}
|
26 |
}
|
@@ -29,18 +29,74 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
|
|
29 |
return $this->papSession;
|
30 |
}
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
public function setOrderStatus($order, $status, $refunded = array()) {
|
33 |
$config = Mage::getSingleton('pap/config');
|
34 |
if (!$config->isAutoStatusChangeEnabled()) {
|
35 |
-
Mage::log('Postaffiliatepro: Automatic status change is not enabled.');
|
36 |
return false;
|
37 |
}
|
38 |
|
39 |
-
Mage::log('Postaffiliatepro: Changing status of order '.$order->getIncrementId()." to '$status'");
|
40 |
$session = $this->getSession();
|
41 |
|
42 |
if (empty($session)) {
|
43 |
-
Mage::log('Postaffiliatepro: The module is still not configured!');
|
44 |
return;
|
45 |
}
|
46 |
|
@@ -66,18 +122,18 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
|
|
66 |
}
|
67 |
continue;
|
68 |
}
|
69 |
-
elseif ($status == 'D') {
|
70 |
if (in_array($record->get('productid'), $refunded)) {
|
71 |
$refundIDs[] = $record->get('id');
|
72 |
}
|
73 |
continue;
|
74 |
-
}
|
75 |
}
|
76 |
$ids[] = $record->get('id');
|
77 |
}
|
78 |
}
|
79 |
catch (Exception $e) {
|
80 |
-
Mage::log('An API error while searching for the order with postfix: '.$e->getMessage());
|
81 |
return false;
|
82 |
}
|
83 |
|
@@ -107,7 +163,7 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
|
|
107 |
}
|
108 |
|
109 |
try {
|
110 |
-
Mage::log('We will be changing status of IDs: '.print_r($ids,true));
|
111 |
$request = new Gpf_Rpc_FormRequest('Pap_Merchants_Transaction_TransactionsForm', 'changeStatus', $session);
|
112 |
if (!empty($refundIDs)) {
|
113 |
$request->addParam('ids',new Gpf_Rpc_Array($refundIDs));
|
@@ -125,7 +181,7 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
|
|
125 |
return true;
|
126 |
}
|
127 |
catch (Exception $e) {
|
128 |
-
Mage::log('API error while status changing: '.$e->getMessage());
|
129 |
return false;
|
130 |
}
|
131 |
}
|
@@ -204,7 +260,7 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
|
|
204 |
public function createAffiliate($order, $onlyOrderID = false) {
|
205 |
$config = Mage::getSingleton('pap/config');
|
206 |
if (!$config->isCreateAffiliateEnabled()) {
|
207 |
-
Mage::log('Postaffiliatepro: Affiliate creation is not enabled.');
|
208 |
return false;
|
209 |
}
|
210 |
|
@@ -251,12 +307,12 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
|
|
251 |
|
252 |
try {
|
253 |
if ($affiliate->add()) {
|
254 |
-
Mage::log('Postaffiliatepro: Affiliate saved successfuly');
|
255 |
} else {
|
256 |
-
Mage::log('Postaffiliatepro: Cannot save affiliate: '.$affiliate->getMessage());
|
257 |
}
|
258 |
} catch (Exception $e) {
|
259 |
-
Mage::log('Postaffiliatepro: Error while communicating with PAP: '.$e->getMessage());
|
260 |
}
|
261 |
}
|
262 |
|
@@ -277,10 +333,10 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
|
|
277 |
$orderid = $order->getId();
|
278 |
}
|
279 |
else {
|
280 |
-
Mage::log('Postaffiliatepro: Order empty');
|
281 |
return false;
|
282 |
}
|
283 |
-
Mage::log("Postaffiliatepro: Loading details of order $orderid");
|
284 |
|
285 |
$items = $this->getOrderSaleDetails($order);
|
286 |
$this->registerSaleDetails($items, $visitorID);
|
@@ -297,7 +353,7 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
|
|
297 |
}
|
298 |
|
299 |
foreach ($items as $i => $item) {
|
300 |
-
Mage::log('Postaffiliatepro: Registering sale '.$item['orderid']."($i)");
|
301 |
|
302 |
$sale = $saleTracker->createSale();
|
303 |
$sale->setTotalCost($item['totalcost']);
|
20 |
if (@!$session->login($username, $password)) {
|
21 |
$session = new Gpf_Api_Session(str_replace('http://','https://',$url));
|
22 |
if (@!$session->login($username, $password)) {
|
23 |
+
Mage::helper('pap')->log('Postaffiliatepro: Could not initiate API session: '.$session->getMessage());
|
24 |
return null;
|
25 |
}
|
26 |
}
|
29 |
return $this->papSession;
|
30 |
}
|
31 |
|
32 |
+
public function refundCommissions($order, $refunded = array()) {
|
33 |
+
$config = Mage::getSingleton('pap/config');
|
34 |
+
if (!$config->isAutoStatusChangeEnabled()) {
|
35 |
+
Mage::helper('pap')->log('Postaffiliatepro: Automatic status change is not enabled.');
|
36 |
+
return false;
|
37 |
+
}
|
38 |
+
|
39 |
+
Mage::helper('pap')->log('Postaffiliatepro: Starting refund...');
|
40 |
+
$session = $this->getSession();
|
41 |
+
if (empty($session)) {
|
42 |
+
Mage::helper('pap')->log('Postaffiliatepro: The module is still not configured!');
|
43 |
+
return;
|
44 |
+
}
|
45 |
+
|
46 |
+
$request = new Pap_Api_TransactionsGrid($session);
|
47 |
+
$request->addFilter('orderid', Gpf_Data_Filter::LIKE, $order->getIncrementId().'(%');
|
48 |
+
$request->setLimit(0, 900);
|
49 |
+
try {
|
50 |
+
$request->sendNow();
|
51 |
+
$grid = $request->getGrid();
|
52 |
+
$recordset = $grid->getRecordset();
|
53 |
+
$refundIDs = array();
|
54 |
+
|
55 |
+
foreach($recordset as $record) {
|
56 |
+
if (count($refunded)) {
|
57 |
+
if (!in_array($record->get('productid'), $refunded)) {
|
58 |
+
continue;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
$refundIDs[] = $record->get('id');
|
62 |
+
}
|
63 |
+
} catch (Exception $e) {
|
64 |
+
Mage::helper('pap')->log('Postaffiliatepro: An API error while refunding order: '.$e->getMessage());
|
65 |
+
return false;
|
66 |
+
}
|
67 |
+
|
68 |
+
if (empty($refundIDs)) {
|
69 |
+
Mage::helper('pap')->log('Postaffiliatepro: There is nothing to refund!');
|
70 |
+
return;
|
71 |
+
}
|
72 |
+
|
73 |
+
$request = new Gpf_Rpc_FormRequest('Pap_Merchants_Transaction_TransactionsForm', 'makeRefundChargeback', $session);
|
74 |
+
$request->addParam('status', 'R');
|
75 |
+
$request->addParam('merchant_note', 'refunded from Magento API');
|
76 |
+
$request->addParam('refund_multitier', 'N');
|
77 |
+
$request->addParam('ids',new Gpf_Rpc_Array($refundIDs));
|
78 |
+
try {
|
79 |
+
Mage::helper('pap')->log('Postaffiliatepro: Trying to refund IDs: '.print_r($refundIDs, true));
|
80 |
+
$request->sendNow();
|
81 |
+
Mage::helper('pap')->log('Postaffiliatepro: Refund successful');
|
82 |
+
} catch(Exception $e){
|
83 |
+
Mage::helper('pap')->log('Postaffiliatepro: An error occurred while refunding: '.$e->getMessage());
|
84 |
+
}
|
85 |
+
return true;
|
86 |
+
}
|
87 |
+
|
88 |
public function setOrderStatus($order, $status, $refunded = array()) {
|
89 |
$config = Mage::getSingleton('pap/config');
|
90 |
if (!$config->isAutoStatusChangeEnabled()) {
|
91 |
+
Mage::helper('pap')->log('Postaffiliatepro: Automatic status change is not enabled.');
|
92 |
return false;
|
93 |
}
|
94 |
|
95 |
+
Mage::helper('pap')->log('Postaffiliatepro: Changing status of order '.$order->getIncrementId()." to '$status'");
|
96 |
$session = $this->getSession();
|
97 |
|
98 |
if (empty($session)) {
|
99 |
+
Mage::helper('pap')->log('Postaffiliatepro: The module is still not configured!');
|
100 |
return;
|
101 |
}
|
102 |
|
122 |
}
|
123 |
continue;
|
124 |
}
|
125 |
+
/*elseif ($status == 'D') {
|
126 |
if (in_array($record->get('productid'), $refunded)) {
|
127 |
$refundIDs[] = $record->get('id');
|
128 |
}
|
129 |
continue;
|
130 |
+
}*/
|
131 |
}
|
132 |
$ids[] = $record->get('id');
|
133 |
}
|
134 |
}
|
135 |
catch (Exception $e) {
|
136 |
+
Mage::helper('pap')->log('Postaffiliatepro: An API error while searching for the order with postfix: '.$e->getMessage());
|
137 |
return false;
|
138 |
}
|
139 |
|
163 |
}
|
164 |
|
165 |
try {
|
166 |
+
Mage::helper('pap')->log('Postaffiliatepro: We will be changing status of IDs: '.print_r($ids,true));
|
167 |
$request = new Gpf_Rpc_FormRequest('Pap_Merchants_Transaction_TransactionsForm', 'changeStatus', $session);
|
168 |
if (!empty($refundIDs)) {
|
169 |
$request->addParam('ids',new Gpf_Rpc_Array($refundIDs));
|
181 |
return true;
|
182 |
}
|
183 |
catch (Exception $e) {
|
184 |
+
Mage::helper('pap')->log('Postaffiliatepro: API error while status changing: '.$e->getMessage());
|
185 |
return false;
|
186 |
}
|
187 |
}
|
260 |
public function createAffiliate($order, $onlyOrderID = false) {
|
261 |
$config = Mage::getSingleton('pap/config');
|
262 |
if (!$config->isCreateAffiliateEnabled()) {
|
263 |
+
Mage::helper('pap')->log('Postaffiliatepro: Affiliate creation is not enabled.');
|
264 |
return false;
|
265 |
}
|
266 |
|
307 |
|
308 |
try {
|
309 |
if ($affiliate->add()) {
|
310 |
+
Mage::helper('pap')->log('Postaffiliatepro: Affiliate saved successfuly');
|
311 |
} else {
|
312 |
+
Mage::helper('pap')->log('Postaffiliatepro: Cannot save affiliate: '.$affiliate->getMessage());
|
313 |
}
|
314 |
} catch (Exception $e) {
|
315 |
+
Mage::helper('pap')->log('Postaffiliatepro: Error while communicating with PAP: '.$e->getMessage());
|
316 |
}
|
317 |
}
|
318 |
|
333 |
$orderid = $order->getId();
|
334 |
}
|
335 |
else {
|
336 |
+
Mage::helper('pap')->log('Postaffiliatepro: Order empty');
|
337 |
return false;
|
338 |
}
|
339 |
+
Mage::helper('pap')->log("Postaffiliatepro: Loading details of order $orderid");
|
340 |
|
341 |
$items = $this->getOrderSaleDetails($order);
|
342 |
$this->registerSaleDetails($items, $visitorID);
|
353 |
}
|
354 |
|
355 |
foreach ($items as $i => $item) {
|
356 |
+
Mage::helper('pap')->log('Postaffiliatepro: Registering sale '.$item['orderid']."($i)");
|
357 |
|
358 |
$sale = $saleTracker->createSale();
|
359 |
$sale->setTotalCost($item['totalcost']);
|
app/code/local/Qualityunit/Pap/Model/Paypal.php
CHANGED
@@ -29,7 +29,7 @@ class Qualityunit_Pap_Model_Paypal extends Mage_Paypal_Model_Standard {
|
|
29 |
}
|
30 |
}
|
31 |
catch (Exception $e) {
|
32 |
-
Mage::log('Postaffiliatepro: Exception while trying to log PayPal sale: '.$e->getMessage()
|
33 |
}
|
34 |
|
35 |
parent::ipnPostSubmit();
|
29 |
}
|
30 |
}
|
31 |
catch (Exception $e) {
|
32 |
+
Mage::helper('pap')->log('Postaffiliatepro: Exception while trying to log PayPal sale: '.$e->getMessage());
|
33 |
}
|
34 |
|
35 |
parent::ipnPostSubmit();
|
app/code/local/Qualityunit/Pap/Model/PaypalIpn.php
CHANGED
@@ -5,27 +5,27 @@ class Qualityunit_Pap_Model_PaypalIpn extends Mage_Paypal_Model_Ipn {
|
|
5 |
|
6 |
protected function _registerPaymentCapture($skipFraudDetection = false) {
|
7 |
try {
|
8 |
-
Mage::log('Postaffiliatepro: Loading PAP cookie from request');
|
9 |
|
10 |
$pap = Mage::getModel('pap/pap');
|
11 |
$visitorID = '';
|
12 |
if (isset($this->_request['pap_custom']) && ($this->_request['pap_custom'] != '')) {
|
13 |
$visitorID = $this->_request['pap_custom'];
|
14 |
}
|
15 |
-
|
16 |
$order = Mage::getModel('sales/order')->load($this->_request['custom']);
|
17 |
|
18 |
-
Mage::log("Postaffiliatepro: Starting registering sale for cookie '$visitorID'
|
19 |
if ($order == '') {
|
20 |
$pap->registerOrder($this->_getOrder(), $visitorID);
|
21 |
}
|
22 |
else {
|
23 |
$pap->registerOrder($order, $visitorID);
|
24 |
}
|
25 |
-
Mage::log('Postaffiliatepro: Sale registered successfully');
|
26 |
}
|
27 |
catch (Exception $e) {
|
28 |
-
Mage::log('Postaffiliatepro: An error occurred while registering PayPal sale: '.$e->getMessage());
|
29 |
}
|
30 |
|
31 |
parent::_registerPaymentCapture($skipFraudDetection);
|
5 |
|
6 |
protected function _registerPaymentCapture($skipFraudDetection = false) {
|
7 |
try {
|
8 |
+
Mage::helper('pap')->log('Postaffiliatepro: Loading PAP cookie from request');
|
9 |
|
10 |
$pap = Mage::getModel('pap/pap');
|
11 |
$visitorID = '';
|
12 |
if (isset($this->_request['pap_custom']) && ($this->_request['pap_custom'] != '')) {
|
13 |
$visitorID = $this->_request['pap_custom'];
|
14 |
}
|
15 |
+
|
16 |
$order = Mage::getModel('sales/order')->load($this->_request['custom']);
|
17 |
|
18 |
+
Mage::helper('pap')->log("Postaffiliatepro: Starting registering sale for cookie '$visitorID'");
|
19 |
if ($order == '') {
|
20 |
$pap->registerOrder($this->_getOrder(), $visitorID);
|
21 |
}
|
22 |
else {
|
23 |
$pap->registerOrder($order, $visitorID);
|
24 |
}
|
25 |
+
Mage::helper('pap')->log('Postaffiliatepro: Sale registered successfully');
|
26 |
}
|
27 |
catch (Exception $e) {
|
28 |
+
Mage::helper('pap')->log('Postaffiliatepro: An error occurred while registering PayPal sale: '.$e->getMessage());
|
29 |
}
|
30 |
|
31 |
parent::_registerPaymentCapture($skipFraudDetection);
|
app/code/local/Qualityunit/Pap/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Qualityunit_Pap>
|
5 |
-
<version>1.2.
|
6 |
</Qualityunit_Pap>
|
7 |
</modules>
|
8 |
<global>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Qualityunit_Pap>
|
5 |
+
<version>1.2.2</version>
|
6 |
</Qualityunit_Pap>
|
7 |
</modules>
|
8 |
<global>
|
app/etc/modules/Qualityunit_Pap.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<Qualityunit_Pap>
|
5 |
<active>true</active>
|
6 |
<codePool>local</codePool>
|
7 |
-
<version>1.2.
|
8 |
</Qualityunit_Pap>
|
9 |
</modules>
|
10 |
</config>
|
4 |
<Qualityunit_Pap>
|
5 |
<active>true</active>
|
6 |
<codePool>local</codePool>
|
7 |
+
<version>1.2.2</version>
|
8 |
</Qualityunit_Pap>
|
9 |
</modules>
|
10 |
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Qualityunit_Pap</name>
|
4 |
-
<version>1.2.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
|
7 |
<channel>community</channel>
|
@@ -9,11 +9,12 @@
|
|
9 |
<summary>The module makes an integration with Post Affiliate Pro or Post Affiliate Network an easy thing. A simple configuration with all the needed options helps you to make it working in seconds.</summary>
|
10 |
<description>The module makes an integration with Post Affiliate Pro or Post Affiliate Network an easy thing. A simple configuration with all the needed options helps you to make it working in seconds.
|
11 |
The module integrates sales, supports per product tracking, Coupon tracking and Lifetime Commission tracking. It also automatically approves and declines commissions when transaction status is changed.</description>
|
12 |
-
<notes>-
|
|
|
13 |
<authors><author><name>Quality Unit, LLC</name><user>support</user><email>support@qualityunit.com</email></author></authors>
|
14 |
-
<date>2017-
|
15 |
-
<time>
|
16 |
-
<contents><target name="magelocal"><dir name="Qualityunit"><dir name="Pap"><dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="dda7a8bb08c3ffe188c8b9612bd6d9fa"/></dir></dir></dir></dir><file name="Clicktracking.php" hash="
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.2.0</min><max>7.5.0</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Qualityunit_Pap</name>
|
4 |
+
<version>1.2.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>The module makes an integration with Post Affiliate Pro or Post Affiliate Network an easy thing. A simple configuration with all the needed options helps you to make it working in seconds.</summary>
|
10 |
<description>The module makes an integration with Post Affiliate Pro or Post Affiliate Network an easy thing. A simple configuration with all the needed options helps you to make it working in seconds.
|
11 |
The module integrates sales, supports per product tracking, Coupon tracking and Lifetime Commission tracking. It also automatically approves and declines commissions when transaction status is changed.</description>
|
12 |
+
<notes>- logs separated from system.log file
|
13 |
+
- declining commissions that were paid out fixed</notes>
|
14 |
<authors><author><name>Quality Unit, LLC</name><user>support</user><email>support@qualityunit.com</email></author></authors>
|
15 |
+
<date>2017-03-03</date>
|
16 |
+
<time>12:12:01</time>
|
17 |
+
<contents><target name="magelocal"><dir name="Qualityunit"><dir name="Pap"><dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="dda7a8bb08c3ffe188c8b9612bd6d9fa"/></dir></dir></dir></dir><file name="Clicktracking.php" hash="db2cbb097450c4843b2b26ac15666ad1"/><dir name="Paypal"><file name="Redirect.php" hash="163f906979f1fa74c49954f76c32cd48"/></dir><file name="Saletracking.php" hash="b6671f7f5781b19ae350fa8a2b00c209"/></dir><dir name="Helper"><file name="Data.php" hash="046ad675ad52e768c988866cd85f0676"/></dir><dir name="Model"><dir name="Checkout"><file name="Observer.php" hash="104d17125360eeca060fed791b3ebf9b"/></dir><dir name="Config"><dir name="Source"><file name="CustomVariables.php" hash="efeddbe739ca3a193dda0d5c19b55d15"/><file name="TrackSales.php" hash="356ed4f234035ac34ea986407f9c5a9a"/></dir></dir><file name="Config.php" hash="99ba8062a384014dff270f63164e9367"/><file name="Observer.php" hash="10c26da345fd8892afdb35050d754735"/><file name="Pap.php" hash="eed46b271e8786337971c99a13c0374e"/><file name="Paypal.php" hash="3391042ebc3706cbcf511fa3e468aa6d"/><file name="PaypalIpn.php" hash="d60ce94d2154a7d59bdc4ecc5adac77e"/><file name="Validateapi.php" hash="2a90e74dc6a137a8960df465f17711ca"/></dir><dir name="etc"><file name="config.xml" hash="b03eb28575dd7a615c8e54117c09ab2c"/><file name="system.xml" hash="e276577132675143bafcfdc09c618b36"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="pap.xml" hash="600ebb26e9af1c78ac0a5d22717d2cd2"/></dir><dir name="template"><dir name="pap"><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="cebb98c5c843a2921debea7cf98fdfe2"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="pap.xml" hash="167eddd9fa705fba71f8d3d2992a43cc"/></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="pap.xml" hash="167eddd9fa705fba71f8d3d2992a43cc"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Qualityunit_Pap.xml" hash="f1ef516961a67eb1268953be8c39ea54"/></dir></target><target name="magelib"><dir name="PAP"><file name="PapApi.class.php" hash="c72aff2ef36ea6ec91098c3a03ad6d93"/></dir></target><target name="mage"><dir name="lib"><dir name="PAP"><file name="README.txt" hash="2a279f64825e116dfd29c73fee9dabc8"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="pap"><file name="pap.css" hash="ff8a88a99075753b4a0ea9004d579a42"/><file name="pap-tab.png" hash="eef09c5b3777189e05b1702c463a9a33"/><file name="pap-logo.png" hash="e9053c44287a8d84801451ed69ef2f09"/></dir></dir></dir></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.2.0</min><max>7.5.0</max></php></required></dependencies>
|
20 |
</package>
|