Version Notes
- option to turn off click tracking added
- option to turn off status changes added
- option to create an affiliate automatically
- added product ID condition for affiliate creation
Download this release
Release Info
| Developer | Quality Unit, LLC |
| Extension | Qualityunit_Pap |
| Version | 1.1.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.9 to 1.1.0
- app/code/local/Qualityunit/Pap/Block/Adminhtml/System/Config/Fieldset/Hint.php +1 -1
- app/code/local/Qualityunit/Pap/Block/Clicktracking.php +6 -1
- app/code/local/Qualityunit/Pap/Block/Saletracking.php +4 -2
- app/code/local/Qualityunit/Pap/Model/Checkout/Observer.php +1 -0
- app/code/local/Qualityunit/Pap/Model/Config.php +36 -2
- app/code/local/Qualityunit/Pap/Model/Config/Source/CustomVariables.php +26 -26
- app/code/local/Qualityunit/Pap/Model/Observer.php +81 -81
- app/code/local/Qualityunit/Pap/Model/Pap.php +66 -1
- app/code/local/Qualityunit/Pap/etc/config.xml +15 -9
- app/code/local/Qualityunit/Pap/etc/system.xml +52 -2
- app/etc/modules/Qualityunit_Pap.xml +1 -1
- lib/PAP/PapApi.class.php +291 -132
- package.xml +8 -5
app/code/local/Qualityunit/Pap/Block/Adminhtml/System/Config/Fieldset/Hint.php
CHANGED
|
@@ -15,7 +15,7 @@ class Qualityunit_Pap_Block_Adminhtml_System_Config_Fieldset_Hint
|
|
| 15 |
return $this->toHtml();
|
| 16 |
}
|
| 17 |
|
| 18 |
-
public function getPapVersion() {
|
| 19 |
return (string)Mage::getConfig()->getNode('modules/Qualityunit_Pap/version');
|
| 20 |
}
|
| 21 |
}
|
| 15 |
return $this->toHtml();
|
| 16 |
}
|
| 17 |
|
| 18 |
+
public function getPapVersion() {
|
| 19 |
return (string)Mage::getConfig()->getNode('modules/Qualityunit_Pap/version');
|
| 20 |
}
|
| 21 |
}
|
app/code/local/Qualityunit/Pap/Block/Clicktracking.php
CHANGED
|
@@ -7,6 +7,11 @@ class Qualityunit_Pap_Block_Clicktracking extends Mage_Core_Block_Text {
|
|
| 7 |
return '';
|
| 8 |
}
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
$url = $config->getInstallationPath();
|
| 11 |
$accountID = $config->getAPICredential('account');
|
| 12 |
|
|
@@ -29,7 +34,7 @@ class Qualityunit_Pap_Block_Clicktracking extends Mage_Core_Block_Text {
|
|
| 29 |
<!-- /Post Affiliate Pro integration snippet -->
|
| 30 |
');
|
| 31 |
}
|
| 32 |
-
|
| 33 |
return parent::_toHtml();
|
| 34 |
}
|
| 35 |
}
|
| 7 |
return '';
|
| 8 |
}
|
| 9 |
|
| 10 |
+
if (!$config->isClickTrackingEnabled()) {
|
| 11 |
+
Mage::log('Postaffiliatepro: Click tracking is turned off.');
|
| 12 |
+
return '';
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
$url = $config->getInstallationPath();
|
| 16 |
$accountID = $config->getAPICredential('account');
|
| 17 |
|
| 34 |
<!-- /Post Affiliate Pro integration snippet -->
|
| 35 |
');
|
| 36 |
}
|
| 37 |
+
|
| 38 |
return parent::_toHtml();
|
| 39 |
}
|
| 40 |
}
|
app/code/local/Qualityunit/Pap/Block/Saletracking.php
CHANGED
|
@@ -45,6 +45,8 @@ class Qualityunit_Pap_Block_SaleTracking extends Mage_Core_Block_Text {
|
|
| 45 |
if (!$order) continue;
|
| 46 |
}
|
| 47 |
|
|
|
|
|
|
|
| 48 |
$items = Mage::getModel('pap/pap')->getOrderSaleDetails($order);
|
| 49 |
foreach ($items as $i => $item) {
|
| 50 |
$sale_tracker .= "
|
|
@@ -62,13 +64,13 @@ class Qualityunit_Pap_Block_SaleTracking extends Mage_Core_Block_Text {
|
|
| 62 |
if (!empty($item['data4'])) $sale_tracker .= "sale$i.setData4('".$item['data4']."');\n";
|
| 63 |
if (!empty($item['data5'])) $sale_tracker .= "sale$i.setData5('".$item['data5']."');\n";
|
| 64 |
|
| 65 |
-
if ($config->
|
| 66 |
|
| 67 |
$sale_tracker .= '
|
| 68 |
PostAffTracker.register();';
|
| 69 |
}
|
| 70 |
}
|
| 71 |
-
|
| 72 |
$url = $config->getInstallationPath();
|
| 73 |
$this->addText('
|
| 74 |
<!-- Post Affiliate Pro integration snippet -->
|
| 45 |
if (!$order) continue;
|
| 46 |
}
|
| 47 |
|
| 48 |
+
Mage::getModel('pap/pap')->createAffiliate($order);
|
| 49 |
+
|
| 50 |
$items = Mage::getModel('pap/pap')->getOrderSaleDetails($order);
|
| 51 |
foreach ($items as $i => $item) {
|
| 52 |
$sale_tracker .= "
|
| 64 |
if (!empty($item['data4'])) $sale_tracker .= "sale$i.setData4('".$item['data4']."');\n";
|
| 65 |
if (!empty($item['data5'])) $sale_tracker .= "sale$i.setData5('".$item['data5']."');\n";
|
| 66 |
|
| 67 |
+
if ($config->isCouponTrackingEnabled()) $sale_tracker .= "sale$i.setCoupon('".$item['couponcode']."');\n";
|
| 68 |
|
| 69 |
$sale_tracker .= '
|
| 70 |
PostAffTracker.register();';
|
| 71 |
}
|
| 72 |
}
|
| 73 |
+
|
| 74 |
$url = $config->getInstallationPath();
|
| 75 |
$this->addText('
|
| 76 |
<!-- Post Affiliate Pro integration snippet -->
|
app/code/local/Qualityunit/Pap/Model/Checkout/Observer.php
CHANGED
|
@@ -15,6 +15,7 @@ class Qualityunit_Pap_Model_Checkout_Observer {
|
|
| 15 |
return false;
|
| 16 |
}
|
| 17 |
|
|
|
|
| 18 |
Mage::getModel('pap/pap')->registerOrderByID($lastOrderId);
|
| 19 |
}
|
| 20 |
|
| 15 |
return false;
|
| 16 |
}
|
| 17 |
|
| 18 |
+
Mage::getModel('pap/pap')->createAffiliate($lastOrderId, true);
|
| 19 |
Mage::getModel('pap/pap')->registerOrderByID($lastOrderId);
|
| 20 |
}
|
| 21 |
|
app/code/local/Qualityunit/Pap/Model/Config.php
CHANGED
|
@@ -67,17 +67,51 @@ class Qualityunit_Pap_Model_Config extends Mage_Core_Model_Config_Base {
|
|
| 67 |
return Mage::getStoreConfig('pap_config/tracking/data'.$n);
|
| 68 |
}
|
| 69 |
|
| 70 |
-
public function
|
| 71 |
if (Mage::getStoreConfigFlag('pap_config/tracking/perproduct')) {
|
| 72 |
return true;
|
| 73 |
}
|
| 74 |
return false;
|
| 75 |
}
|
| 76 |
|
| 77 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
if (Mage::getStoreConfigFlag('pap_config/tracking/coupontrack')) {
|
| 79 |
return true;
|
| 80 |
}
|
| 81 |
return false;
|
| 82 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
}
|
| 67 |
return Mage::getStoreConfig('pap_config/tracking/data'.$n);
|
| 68 |
}
|
| 69 |
|
| 70 |
+
public function isPerProductEnabled() {
|
| 71 |
if (Mage::getStoreConfigFlag('pap_config/tracking/perproduct')) {
|
| 72 |
return true;
|
| 73 |
}
|
| 74 |
return false;
|
| 75 |
}
|
| 76 |
|
| 77 |
+
public function isClickTrackingEnabled() {
|
| 78 |
+
if (Mage::getStoreConfigFlag('pap_config/tracking/trackclicks')) {
|
| 79 |
+
return true;
|
| 80 |
+
}
|
| 81 |
+
return false;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
public function isCouponTrackingEnabled() {
|
| 85 |
if (Mage::getStoreConfigFlag('pap_config/tracking/coupontrack')) {
|
| 86 |
return true;
|
| 87 |
}
|
| 88 |
return false;
|
| 89 |
}
|
| 90 |
+
|
| 91 |
+
public function isAutoStatusChangeEnabled() {
|
| 92 |
+
if (Mage::getStoreConfigFlag('pap_config/tracking/autostatuschange')) {
|
| 93 |
+
return true;
|
| 94 |
+
}
|
| 95 |
+
return false;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
public function isCreateAffiliateEnabled() {
|
| 100 |
+
if (Mage::getStoreConfigFlag('pap_config/affiliate/createaff')) {
|
| 101 |
+
return true;
|
| 102 |
+
}
|
| 103 |
+
return false;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
public function getCreateAffiliateProducts() {
|
| 107 |
+
$products = Mage::getStoreConfig('pap_config/affiliate/createaffproducts');
|
| 108 |
+
if ($products == '' || $products == null) {
|
| 109 |
+
return array();
|
| 110 |
+
}
|
| 111 |
+
if (strpos($products, ',') != false) {
|
| 112 |
+
$products = str_replace(', ', ',', $products);
|
| 113 |
+
$products = str_replace(' ,', ',', $products);
|
| 114 |
+
}
|
| 115 |
+
return explode(',',$products);
|
| 116 |
+
}
|
| 117 |
}
|
app/code/local/Qualityunit/Pap/Model/Config/Source/CustomVariables.php
CHANGED
|
@@ -1,27 +1,27 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Qualityunit_Pap_Model_Config_Source_CustomVariables {
|
| 3 |
-
public function toOptionArray() {
|
| 4 |
-
return array(
|
| 5 |
-
array('label'=>' ', 'value'=>'empty'),
|
| 6 |
-
array('label'=>'Item name', 'value'=>'itemName'),
|
| 7 |
-
array('label'=>'Item quantity', 'value'=>'itemQuantity'),
|
| 8 |
-
array('label'=>'Item price (multiplied by quantity, before discount)', 'value'=>'itemPrice'),
|
| 9 |
-
array('label'=>'Item SKU', 'value'=>'itemSKU'),
|
| 10 |
-
array('label'=>'Item weight (single item)', 'value'=>'itemWeight'),
|
| 11 |
-
array('label'=>'Item weight (multiplied by quantity)', 'value'=>'itemWeightAll'),
|
| 12 |
-
array('label'=>'Item cost (multiplied by quantity)', 'value'=>'itemCost'),
|
| 13 |
-
array('label'=>'Item discount (value)', 'value'=>'itemDiscount'),
|
| 14 |
-
array('label'=>'Item discount (percent)', 'value'=>'itemDiscountPercent'),
|
| 15 |
-
array('label'=>'Item total tax (value)', 'value'=>'itemTax'),
|
| 16 |
-
array('label'=>'Item total tax (percent)', 'value'=>'itemTaxPercent'),
|
| 17 |
-
array('label'=>'Product category ID', 'value'=>'productCategoryID'),
|
| 18 |
-
array('label'=>'Product URL', 'value'=>'productURL'),
|
| 19 |
-
array('label'=>'Store ID', 'value'=>'storeID'),
|
| 20 |
-
array('label'=>'Internal order ID', 'value'=>'internalOrderID'),
|
| 21 |
-
array('label'=>'Customer ID', 'value'=>'customerID'),
|
| 22 |
-
array('label'=>'Customer email', 'value'=>'customerEmail'),
|
| 23 |
-
array('label'=>'Customer name', 'value'=>'customerName'),
|
| 24 |
-
array('label'=>'Coupon code', 'value'=>'couponCode')
|
| 25 |
-
);
|
| 26 |
-
}
|
| 27 |
}
|
| 1 |
+
<?php
|
| 2 |
+
class Qualityunit_Pap_Model_Config_Source_CustomVariables {
|
| 3 |
+
public function toOptionArray() {
|
| 4 |
+
return array(
|
| 5 |
+
array('label'=>' ', 'value'=>'empty'),
|
| 6 |
+
array('label'=>'Item name', 'value'=>'itemName'),
|
| 7 |
+
array('label'=>'Item quantity', 'value'=>'itemQuantity'),
|
| 8 |
+
array('label'=>'Item price (multiplied by quantity, before discount)', 'value'=>'itemPrice'),
|
| 9 |
+
array('label'=>'Item SKU', 'value'=>'itemSKU'),
|
| 10 |
+
array('label'=>'Item weight (single item)', 'value'=>'itemWeight'),
|
| 11 |
+
array('label'=>'Item weight (multiplied by quantity)', 'value'=>'itemWeightAll'),
|
| 12 |
+
array('label'=>'Item cost (multiplied by quantity)', 'value'=>'itemCost'),
|
| 13 |
+
array('label'=>'Item discount (value)', 'value'=>'itemDiscount'),
|
| 14 |
+
array('label'=>'Item discount (percent)', 'value'=>'itemDiscountPercent'),
|
| 15 |
+
array('label'=>'Item total tax (value)', 'value'=>'itemTax'),
|
| 16 |
+
array('label'=>'Item total tax (percent)', 'value'=>'itemTaxPercent'),
|
| 17 |
+
array('label'=>'Product category ID', 'value'=>'productCategoryID'),
|
| 18 |
+
array('label'=>'Product URL', 'value'=>'productURL'),
|
| 19 |
+
array('label'=>'Store ID', 'value'=>'storeID'),
|
| 20 |
+
array('label'=>'Internal order ID', 'value'=>'internalOrderID'),
|
| 21 |
+
array('label'=>'Customer ID', 'value'=>'customerID'),
|
| 22 |
+
array('label'=>'Customer email', 'value'=>'customerEmail'),
|
| 23 |
+
array('label'=>'Customer name', 'value'=>'customerName'),
|
| 24 |
+
array('label'=>'Coupon code', 'value'=>'couponCode')
|
| 25 |
+
);
|
| 26 |
+
}
|
| 27 |
}
|
app/code/local/Qualityunit/Pap/Model/Observer.php
CHANGED
|
@@ -1,81 +1,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::log("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 |
-
return $this;
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
$refunded = array();
|
| 33 |
-
if ($order->getStatus() == 'complete') {
|
| 34 |
-
if ($order->getBaseTotalPaid() > 0) { // was paid
|
| 35 |
-
if ($order->getBaseTotalRefunded() > 0) { // partial refund handling
|
| 36 |
-
$refunded = $this->getRefundedItemIDs($order);
|
| 37 |
-
}
|
| 38 |
-
Mage::getModel('pap/pap')->setOrderStatus($order, $this->approved, $refunded);
|
| 39 |
-
}
|
| 40 |
-
else { // completed but not paid
|
| 41 |
-
Mage::getModel('pap/pap')->setOrderStatus($order, $this->pending);
|
| 42 |
-
}
|
| 43 |
-
return $this;
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
// if we are here, it's probably a partial refund
|
| 47 |
-
if ($order->getBaseTotalRefunded() > 0 || $order->getBaseTotalCanceled() > 0) {
|
| 48 |
-
$refunded = $this->getRefundedItemIDs($order);
|
| 49 |
-
Mage::getModel('pap/pap')->setOrderStatus($order, $this->declined, $refunded);
|
| 50 |
-
}
|
| 51 |
-
}
|
| 52 |
-
catch (Exception $e) {
|
| 53 |
-
Mage::getSingleton('adminhtml/session')->addWarning('A PAP API error occurred: '.$e->getMessage());
|
| 54 |
-
}
|
| 55 |
-
|
| 56 |
-
return $this;
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
private function getRefundedItemIDs($order) {
|
| 60 |
-
$refunded = array();
|
| 61 |
-
$items = $order->getAllVisibleItems();
|
| 62 |
-
|
| 63 |
-
foreach($items as $i=>$item) {
|
| 64 |
-
if ($item->getStatus() == 'Refunded') {
|
| 65 |
-
$productid = $item->getProductId();
|
| 66 |
-
$product = Mage::getModel('catalog/product')->load($productid);
|
| 67 |
-
$refunded[$i] = $product->getSku();
|
| 68 |
-
}
|
| 69 |
-
}
|
| 70 |
-
return $refunded;
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
public function thankYouPageViewed($observer) {
|
| 74 |
-
$quoteId = Mage::getSingleton('checkout/session')->getLastQuoteId();
|
| 75 |
-
$block = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('pap_saletracking');
|
| 76 |
-
if ($quoteId && ($block instanceof Mage_Core_Block_Abstract)) {
|
| 77 |
-
$quote = Mage::getModel('sales/quote')->load($quoteId);
|
| 78 |
-
$block->setQuote($quote);
|
| 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::log("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 |
+
return $this;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
$refunded = array();
|
| 33 |
+
if ($order->getStatus() == 'complete') {
|
| 34 |
+
if ($order->getBaseTotalPaid() > 0) { // was paid
|
| 35 |
+
if ($order->getBaseTotalRefunded() > 0) { // partial refund handling
|
| 36 |
+
$refunded = $this->getRefundedItemIDs($order);
|
| 37 |
+
}
|
| 38 |
+
Mage::getModel('pap/pap')->setOrderStatus($order, $this->approved, $refunded);
|
| 39 |
+
}
|
| 40 |
+
else { // completed but not paid
|
| 41 |
+
Mage::getModel('pap/pap')->setOrderStatus($order, $this->pending);
|
| 42 |
+
}
|
| 43 |
+
return $this;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
// if we are here, it's probably a partial refund
|
| 47 |
+
if ($order->getBaseTotalRefunded() > 0 || $order->getBaseTotalCanceled() > 0) {
|
| 48 |
+
$refunded = $this->getRefundedItemIDs($order);
|
| 49 |
+
Mage::getModel('pap/pap')->setOrderStatus($order, $this->declined, $refunded);
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
catch (Exception $e) {
|
| 53 |
+
Mage::getSingleton('adminhtml/session')->addWarning('A PAP API error occurred: '.$e->getMessage());
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
return $this;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
private function getRefundedItemIDs($order) {
|
| 60 |
+
$refunded = array();
|
| 61 |
+
$items = $order->getAllVisibleItems();
|
| 62 |
+
|
| 63 |
+
foreach($items as $i=>$item) {
|
| 64 |
+
if ($item->getStatus() == 'Refunded') {
|
| 65 |
+
$productid = $item->getProductId();
|
| 66 |
+
$product = Mage::getModel('catalog/product')->load($productid);
|
| 67 |
+
$refunded[$i] = $product->getSku();
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
return $refunded;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
public function thankYouPageViewed($observer) {
|
| 74 |
+
$quoteId = Mage::getSingleton('checkout/session')->getLastQuoteId();
|
| 75 |
+
$block = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('pap_saletracking');
|
| 76 |
+
if ($quoteId && ($block instanceof Mage_Core_Block_Abstract)) {
|
| 77 |
+
$quote = Mage::getModel('sales/quote')->load($quoteId);
|
| 78 |
+
$block->setQuote($quote);
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
}
|
app/code/local/Qualityunit/Pap/Model/Pap.php
CHANGED
|
@@ -30,6 +30,12 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
|
|
| 30 |
}
|
| 31 |
|
| 32 |
public function setOrderStatus($order, $status, $refunded = array()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
Mage::log('Postaffiliatepro: Changing status of order '.$order->getIncrementId()." to '$status'");
|
| 34 |
$session = $this->getSession();
|
| 35 |
|
|
@@ -150,7 +156,7 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
|
|
| 150 |
$sales = array();
|
| 151 |
$status = $this->getStatus($order->getState());
|
| 152 |
|
| 153 |
-
if ($config->
|
| 154 |
$items = $order->getAllVisibleItems();
|
| 155 |
|
| 156 |
foreach($items as $i=>$item) {
|
|
@@ -196,6 +202,65 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
|
|
| 196 |
return $sales;
|
| 197 |
}
|
| 198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
public function registerOrderByID($orderid, $realid = true) { // called from the checkout observer
|
| 200 |
$order = Mage::getModel('sales/order')->load($orderid);
|
| 201 |
if ($realid) {
|
| 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 |
|
| 156 |
$sales = array();
|
| 157 |
$status = $this->getStatus($order->getState());
|
| 158 |
|
| 159 |
+
if ($config->isPerProductEnabled()) { // per product tracking
|
| 160 |
$items = $order->getAllVisibleItems();
|
| 161 |
|
| 162 |
foreach($items as $i=>$item) {
|
| 202 |
return $sales;
|
| 203 |
}
|
| 204 |
|
| 205 |
+
public function createAffiliate($order, $onlyOrderID = false) {
|
| 206 |
+
$config = Mage::getSingleton('pap/config');
|
| 207 |
+
if (!$config->isCreateAffiliateEnabled()) {
|
| 208 |
+
Mage::log('Postaffiliatepro: Affiliate creation is not enabled.');
|
| 209 |
+
return false;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
if ($onlyOrderID) {
|
| 213 |
+
$order = Mage::getModel('sales/order')->load($order);
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
$products = $config->getCreateAffiliateProducts();
|
| 217 |
+
if (sizeof($products) > 0) {
|
| 218 |
+
// conditional only
|
| 219 |
+
$items = $order->getAllVisibleItems();
|
| 220 |
+
$search = false;
|
| 221 |
+
foreach($items as $i=>$item) {
|
| 222 |
+
if (in_array($item->getProductId(), $products)) {
|
| 223 |
+
$search = true;
|
| 224 |
+
break; // end of search, we have it
|
| 225 |
+
}
|
| 226 |
+
}
|
| 227 |
+
if (!$search) {
|
| 228 |
+
return false;
|
| 229 |
+
}
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
// create affiliate
|
| 233 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
| 234 |
+
|
| 235 |
+
$session = $this->getSession();
|
| 236 |
+
$affiliate = new Pap_Api_Affiliate($session);
|
| 237 |
+
$affiliate->setUsername($order->getCustomerEmail());
|
| 238 |
+
$affiliate->setFirstname($order->getCustomerFirstname());
|
| 239 |
+
$affiliate->setLastname($order->getCustomerLastname());
|
| 240 |
+
$affiliate->setVisitorId(@$_COOKIE['PAPVisitorId']);
|
| 241 |
+
|
| 242 |
+
$address = $customer->getPrimaryAddress('default_billing');
|
| 243 |
+
if (!empty($address)) {
|
| 244 |
+
$addressArray = $address->getData();
|
| 245 |
+
$affiliate->setData(3,$addressArray['street']);
|
| 246 |
+
$affiliate->setData(4,$addressArray['city']);
|
| 247 |
+
$affiliate->setData(5,$addressArray['region']);
|
| 248 |
+
$affiliate->setData(6,$addressArray['country_id']);
|
| 249 |
+
$affiliate->setData(7,$addressArray['postcode']);
|
| 250 |
+
$affiliate->setData(8,$addressArray['telephone']);
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
try {
|
| 254 |
+
if ($affiliate->add()) {
|
| 255 |
+
Mage::log('Postaffiliatepro: Affiliate saved successfuly');
|
| 256 |
+
} else {
|
| 257 |
+
Mage::log('Postaffiliatepro: Cannot save affiliate: '.$affiliate->getMessage());
|
| 258 |
+
}
|
| 259 |
+
} catch (Exception $e) {
|
| 260 |
+
Mage::log('Postaffiliatepro: Error while communicating with PAP: '.$e->getMessage());
|
| 261 |
+
}
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
public function registerOrderByID($orderid, $realid = true) { // called from the checkout observer
|
| 265 |
$order = Mage::getModel('sales/order')->load($orderid);
|
| 266 |
if ($realid) {
|
app/code/local/Qualityunit/Pap/etc/config.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Qualityunit_Pap>
|
| 5 |
-
<version>1.0
|
| 6 |
</Qualityunit_Pap>
|
| 7 |
</modules>
|
| 8 |
<global>
|
|
@@ -138,15 +138,21 @@
|
|
| 138 |
<accountid>default1</accountid>
|
| 139 |
</api>
|
| 140 |
<tracking>
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
|
|
|
|
|
|
| 149 |
</tracking>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
</pap>
|
| 151 |
</default>
|
| 152 |
</config>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Qualityunit_Pap>
|
| 5 |
+
<version>1.1.0</version>
|
| 6 |
</Qualityunit_Pap>
|
| 7 |
</modules>
|
| 8 |
<global>
|
| 138 |
<accountid>default1</accountid>
|
| 139 |
</api>
|
| 140 |
<tracking>
|
| 141 |
+
<trackingmethod>javascript</trackingmethod>
|
| 142 |
+
<trackclicks>1</trackclicks>
|
| 143 |
+
<perproduct>1</perproduct>
|
| 144 |
+
<coupontrack>0</coupontrack>
|
| 145 |
+
<autostatuschange>1</autostatuschange>
|
| 146 |
+
<data1>empty</data1>
|
| 147 |
+
<data2>empty</data2>
|
| 148 |
+
<data3>empty</data3>
|
| 149 |
+
<data4>empty</data4>
|
| 150 |
+
<data5>empty</data5>
|
| 151 |
</tracking>
|
| 152 |
+
<affiliate>
|
| 153 |
+
<createaff>0</createaff>
|
| 154 |
+
<createaffproducts>0</createaffproducts>
|
| 155 |
+
</affiliate>
|
| 156 |
</pap>
|
| 157 |
</default>
|
| 158 |
</config>
|
app/code/local/Qualityunit/Pap/etc/system.xml
CHANGED
|
@@ -68,7 +68,7 @@
|
|
| 68 |
<tracking translate="label">
|
| 69 |
<label>Tracking</label>
|
| 70 |
<frontend_type>text</frontend_type>
|
| 71 |
-
<sort_order>
|
| 72 |
<show_in_default>1</show_in_default>
|
| 73 |
<show_in_website>1</show_in_website>
|
| 74 |
<show_in_store>1</show_in_store>
|
|
@@ -82,11 +82,21 @@
|
|
| 82 |
<show_in_website>1</show_in_website>
|
| 83 |
<show_in_store>1</show_in_store>
|
| 84 |
</trackingmethod>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
<perproduct translate="label">
|
| 86 |
<label>Per Product Commissions</label>
|
| 87 |
<frontend_type>select</frontend_type>
|
| 88 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 89 |
-
<sort_order>
|
| 90 |
<show_in_default>1</show_in_default>
|
| 91 |
<show_in_website>1</show_in_website>
|
| 92 |
<show_in_store>1</show_in_store>
|
|
@@ -102,6 +112,16 @@
|
|
| 102 |
<show_in_store>1</show_in_store>
|
| 103 |
<tooltip><![CDATA[Enabled with "Yes", the system will set a coupon code to the sale tracker.]]></tooltip>
|
| 104 |
</coupontrack>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
<data1 translate="label">
|
| 106 |
<label>Custom Data 1</label>
|
| 107 |
<frontend_type>select</frontend_type>
|
|
@@ -154,6 +174,36 @@
|
|
| 154 |
</data5>
|
| 155 |
</fields>
|
| 156 |
</tracking>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
</groups>
|
| 158 |
</pap_config>
|
| 159 |
</sections>
|
| 68 |
<tracking translate="label">
|
| 69 |
<label>Tracking</label>
|
| 70 |
<frontend_type>text</frontend_type>
|
| 71 |
+
<sort_order>20</sort_order>
|
| 72 |
<show_in_default>1</show_in_default>
|
| 73 |
<show_in_website>1</show_in_website>
|
| 74 |
<show_in_store>1</show_in_store>
|
| 82 |
<show_in_website>1</show_in_website>
|
| 83 |
<show_in_store>1</show_in_store>
|
| 84 |
</trackingmethod>
|
| 85 |
+
<trackclicks translate="label">
|
| 86 |
+
<label>Track clicks</label>
|
| 87 |
+
<frontend_type>select</frontend_type>
|
| 88 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 89 |
+
<sort_order>20</sort_order>
|
| 90 |
+
<show_in_default>1</show_in_default>
|
| 91 |
+
<show_in_website>1</show_in_website>
|
| 92 |
+
<show_in_store>1</show_in_store>
|
| 93 |
+
<tooltip><![CDATA[Choose whether the click tracking code should be automatically added to your site or not.]]></tooltip>
|
| 94 |
+
</trackclicks>
|
| 95 |
<perproduct translate="label">
|
| 96 |
<label>Per Product Commissions</label>
|
| 97 |
<frontend_type>select</frontend_type>
|
| 98 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 99 |
+
<sort_order>25</sort_order>
|
| 100 |
<show_in_default>1</show_in_default>
|
| 101 |
<show_in_website>1</show_in_website>
|
| 102 |
<show_in_store>1</show_in_store>
|
| 112 |
<show_in_store>1</show_in_store>
|
| 113 |
<tooltip><![CDATA[Enabled with "Yes", the system will set a coupon code to the sale tracker.]]></tooltip>
|
| 114 |
</coupontrack>
|
| 115 |
+
<autostatuschange translate="label">
|
| 116 |
+
<label>Update commission status</label>
|
| 117 |
+
<frontend_type>select</frontend_type>
|
| 118 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 119 |
+
<sort_order>35</sort_order>
|
| 120 |
+
<show_in_default>1</show_in_default>
|
| 121 |
+
<show_in_website>1</show_in_website>
|
| 122 |
+
<show_in_store>1</show_in_store>
|
| 123 |
+
<tooltip><![CDATA[Orders change status e.g. when paid or cancelled, or refunded. Do you want the commission to change status accordingly?]]></tooltip>
|
| 124 |
+
</autostatuschange>
|
| 125 |
<data1 translate="label">
|
| 126 |
<label>Custom Data 1</label>
|
| 127 |
<frontend_type>select</frontend_type>
|
| 174 |
</data5>
|
| 175 |
</fields>
|
| 176 |
</tracking>
|
| 177 |
+
<affiliate translate="label">
|
| 178 |
+
<label>Affiliate creation</label>
|
| 179 |
+
<frontend_type>text</frontend_type>
|
| 180 |
+
<sort_order>30</sort_order>
|
| 181 |
+
<show_in_default>1</show_in_default>
|
| 182 |
+
<show_in_website>1</show_in_website>
|
| 183 |
+
<show_in_store>1</show_in_store>
|
| 184 |
+
<fields>
|
| 185 |
+
<createaff translate="label">
|
| 186 |
+
<label>Create affiliate</label>
|
| 187 |
+
<frontend_type>select</frontend_type>
|
| 188 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 189 |
+
<sort_order>10</sort_order>
|
| 190 |
+
<show_in_default>1</show_in_default>
|
| 191 |
+
<show_in_website>1</show_in_website>
|
| 192 |
+
<show_in_store>1</show_in_store>
|
| 193 |
+
<tooltip><![CDATA[An affiliate account would be created automatically for every customer making and order in your store.]]></tooltip>
|
| 194 |
+
</createaff>
|
| 195 |
+
<createaffproducts translate="label">
|
| 196 |
+
<label>Create on specific product</label>
|
| 197 |
+
<frontend_type>text</frontend_type>
|
| 198 |
+
<sort_order>20</sort_order>
|
| 199 |
+
<show_in_default>1</show_in_default>
|
| 200 |
+
<show_in_website>1</show_in_website>
|
| 201 |
+
<show_in_store>1</show_in_store>
|
| 202 |
+
<depends><createaff>1</createaff></depends>
|
| 203 |
+
<tooltip><![CDATA[An affiliate account will only be created if a customer ordered a specific product (defined by product ID). No product defined means affiliate will be created for any product. Use comma separator for more products.]]></tooltip>
|
| 204 |
+
</createaffproducts>
|
| 205 |
+
</fields>
|
| 206 |
+
</affiliate>
|
| 207 |
</groups>
|
| 208 |
</pap_config>
|
| 209 |
</sections>
|
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.0
|
| 8 |
</Qualityunit_Pap>
|
| 9 |
</modules>
|
| 10 |
</config>
|
| 4 |
<Qualityunit_Pap>
|
| 5 |
<active>true</active>
|
| 6 |
<codePool>local</codePool>
|
| 7 |
+
<version>1.1.0</version>
|
| 8 |
</Qualityunit_Pap>
|
| 9 |
</modules>
|
| 10 |
</config>
|
lib/PAP/PapApi.class.php
CHANGED
|
@@ -9,8 +9,8 @@
|
|
| 9 |
* Version 1.0 (the "License"); you may not use this file except in compliance
|
| 10 |
* with the License. You may obtain a copy of the License at
|
| 11 |
* http://www.qualityunit.com/licenses/gpf
|
| 12 |
-
* Generated on:
|
| 13 |
-
* PAP version: 5.
|
| 14 |
*
|
| 15 |
*/
|
| 16 |
|
|
@@ -159,6 +159,8 @@ if (!class_exists('Gpf_Rpc_Server', false)) {
|
|
| 159 |
*/
|
| 160 |
private $dataDecoder;
|
| 161 |
|
|
|
|
|
|
|
| 162 |
public function __construct() {
|
| 163 |
}
|
| 164 |
|
|
@@ -177,6 +179,9 @@ if (!class_exists('Gpf_Rpc_Server', false)) {
|
|
| 177 |
*/
|
| 178 |
public function executeAndEcho($request = '') {
|
| 179 |
$response = $this->encodeResponse($this->execute($request));
|
|
|
|
|
|
|
|
|
|
| 180 |
Gpf_ModuleBase::startGzip();
|
| 181 |
echo $response;
|
| 182 |
Gpf_ModuleBase::flushGzip();
|
|
@@ -201,6 +206,13 @@ if (!class_exists('Gpf_Rpc_Server', false)) {
|
|
| 201 |
} catch (Exception $e) {
|
| 202 |
return new Gpf_Rpc_ExceptionResponse($e);
|
| 203 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
return $response;
|
| 205 |
}
|
| 206 |
|
|
@@ -940,7 +952,7 @@ if (!interface_exists('Gpf_Templates_HasAttributes', false)) {
|
|
| 940 |
if (!class_exists('Gpf_Data_RecordHeader', false)) {
|
| 941 |
class Gpf_Data_RecordHeader extends Gpf_Object {
|
| 942 |
private $ids = array();
|
| 943 |
-
|
| 944 |
/**
|
| 945 |
* Create Record header object
|
| 946 |
*
|
|
@@ -950,24 +962,27 @@ if (!class_exists('Gpf_Data_RecordHeader', false)) {
|
|
| 950 |
if($headerArray === null) {
|
| 951 |
return;
|
| 952 |
}
|
| 953 |
-
|
| 954 |
if (!$this->isIterable($headerArray)) {
|
| 955 |
$e = new Gpf_Exception('');
|
| 956 |
-
Gpf_Log::error('Not correct header for RecordHeader, trace: '.$e->getTraceAsString());
|
| 957 |
-
|
| 958 |
return;
|
| 959 |
}
|
| 960 |
-
|
| 961 |
foreach ($headerArray as $id) {
|
| 962 |
$this->add($id);
|
| 963 |
}
|
| 964 |
}
|
| 965 |
-
|
| 966 |
public function contains($id) {
|
| 967 |
return array_key_exists($id, $this->ids);
|
| 968 |
}
|
| 969 |
|
| 970 |
public function add($id) {
|
|
|
|
|
|
|
|
|
|
| 971 |
if($this->contains($id)) {
|
| 972 |
return;
|
| 973 |
}
|
|
@@ -985,7 +1000,7 @@ if (!class_exists('Gpf_Data_RecordHeader', false)) {
|
|
| 985 |
}
|
| 986 |
return $this->ids[$id];
|
| 987 |
}
|
| 988 |
-
|
| 989 |
public function getSize() {
|
| 990 |
return count($this->ids);
|
| 991 |
}
|
|
@@ -997,7 +1012,7 @@ if (!class_exists('Gpf_Data_RecordHeader', false)) {
|
|
| 997 |
}
|
| 998 |
return $response;
|
| 999 |
}
|
| 1000 |
-
|
| 1001 |
public function toObject() {
|
| 1002 |
$result = array();
|
| 1003 |
foreach ($this->ids as $columnId => $columnIndex) {
|
|
@@ -1005,7 +1020,7 @@ if (!class_exists('Gpf_Data_RecordHeader', false)) {
|
|
| 1005 |
}
|
| 1006 |
return $result;
|
| 1007 |
}
|
| 1008 |
-
|
| 1009 |
private function isIterable($var) {
|
| 1010 |
return (is_array($var) || $var instanceof Traversable || $var instanceof stdClass);
|
| 1011 |
}
|
|
@@ -1481,6 +1496,20 @@ if (!class_exists('Gpf_Data_RecordSet', false)) {
|
|
| 1481 |
}
|
| 1482 |
}
|
| 1483 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1484 |
/**
|
| 1485 |
* Creates shalow copy of recordset containing only headers
|
| 1486 |
*
|
|
@@ -1517,9 +1546,9 @@ if (!class_exists('Gpf_Data_RecordSet', false)) {
|
|
| 1517 |
|
| 1518 |
private function compare($value1, $value2) {
|
| 1519 |
if ($this->sortType == Gpf_Data_RecordSet::SORT_ASC) {
|
| 1520 |
-
return ($value1 < $value2) ? -1 : 1;
|
| 1521 |
}
|
| 1522 |
-
return ($value1 < $value2) ? 1 : -1;
|
| 1523 |
}
|
| 1524 |
}
|
| 1525 |
|
|
@@ -1539,6 +1568,10 @@ if (!class_exists('Gpf_Data_IndexedRecordSet', false)) {
|
|
| 1539 |
}
|
| 1540 |
|
| 1541 |
public function addRecord(Gpf_Data_Record $record) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1542 |
$this->_array[$record->get($this->key)] = $record;
|
| 1543 |
}
|
| 1544 |
|
|
@@ -1616,7 +1649,7 @@ if (!class_exists('Gpf_Net_Http_Request', false)) {
|
|
| 1616 |
private $query = '';
|
| 1617 |
private $fragment = '';
|
| 1618 |
private $cookies = '';
|
| 1619 |
-
|
| 1620 |
private $maxTimeout = null;
|
| 1621 |
|
| 1622 |
private $body = '';
|
|
@@ -1631,20 +1664,16 @@ if (!class_exists('Gpf_Net_Http_Request', false)) {
|
|
| 1631 |
}
|
| 1632 |
|
| 1633 |
public function getCookiesString() {
|
| 1634 |
-
$cookies = '';
|
| 1635 |
if (!is_array($this->cookies)) {
|
| 1636 |
-
return
|
| 1637 |
-
}
|
| 1638 |
-
foreach ($this->cookies as $key => $value) {
|
| 1639 |
-
$cookies .= "$key=$value; ";
|
| 1640 |
}
|
| 1641 |
-
return $cookies;
|
| 1642 |
}
|
| 1643 |
-
|
| 1644 |
public function getMaxTimeout() {
|
| 1645 |
return $this->maxTimeout;
|
| 1646 |
}
|
| 1647 |
-
|
| 1648 |
public function setMaxTimeout($timeout) {
|
| 1649 |
$this->maxTimeout = $timeout;
|
| 1650 |
}
|
|
@@ -2014,7 +2043,7 @@ if (!class_exists('Gpf_Net_Http_ClientBase', false)) {
|
|
| 2014 |
@curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
|
| 2015 |
if ($request->getHttpPassword() != '' && $request->getHttpUser() != '') {
|
| 2016 |
@curl_setopt($session, CURLOPT_USERPWD, $request->getHttpUser() . ":" . $request->getHttpPassword());
|
| 2017 |
-
@curl_setopt($
|
| 2018 |
}
|
| 2019 |
@curl_setopt ($session, CURLOPT_SSL_VERIFYHOST, 0);
|
| 2020 |
@curl_setopt ($session, CURLOPT_SSL_VERIFYPEER, 0);
|
|
@@ -2169,9 +2198,9 @@ if (!class_exists('Gpf_Rpc_Form', false)) {
|
|
| 2169 |
$header->add(self::FIELD_VALUES);
|
| 2170 |
$header->add(self::FIELD_ERROR);
|
| 2171 |
$this->fields->setHeader($header);
|
| 2172 |
-
|
| 2173 |
$this->validator = new Gpf_Rpc_Form_Validator_FormValidatorCollection($this);
|
| 2174 |
-
|
| 2175 |
if($params) {
|
| 2176 |
$this->loadFieldsFromArray($params->get("fields"));
|
| 2177 |
}
|
|
@@ -2185,21 +2214,21 @@ if (!class_exists('Gpf_Rpc_Form', false)) {
|
|
| 2185 |
public function addValidator(Gpf_Rpc_Form_Validator_Validator $validator, $fieldName, $fieldLabel = null) {
|
| 2186 |
$this->validator->addValidator($validator, $fieldName, $fieldLabel);
|
| 2187 |
}
|
| 2188 |
-
|
| 2189 |
/**
|
| 2190 |
* @return boolean
|
| 2191 |
*/
|
| 2192 |
public function validate() {
|
| 2193 |
return $this->validator->validate();
|
| 2194 |
}
|
| 2195 |
-
|
| 2196 |
public function loadFieldsFromArray($fields) {
|
| 2197 |
for ($i = 1; $i < count($fields); $i++) {
|
| 2198 |
$field = $fields[$i];
|
| 2199 |
$this->fields->add($field);
|
| 2200 |
}
|
| 2201 |
}
|
| 2202 |
-
|
| 2203 |
/**
|
| 2204 |
*
|
| 2205 |
* @return ArrayIterator
|
|
@@ -2207,30 +2236,30 @@ if (!class_exists('Gpf_Rpc_Form', false)) {
|
|
| 2207 |
public function getIterator() {
|
| 2208 |
return $this->fields->getIterator();
|
| 2209 |
}
|
| 2210 |
-
|
| 2211 |
public function addField($name, $value) {
|
| 2212 |
$record = $this->fields->createRecord($name);
|
| 2213 |
$record->set(self::FIELD_VALUE, $value);
|
| 2214 |
}
|
| 2215 |
-
|
| 2216 |
public function setField($name, $value, $values = null, $error = "") {
|
| 2217 |
$record = $this->fields->createRecord($name);
|
| 2218 |
$record->set(self::FIELD_VALUE, $value);
|
| 2219 |
$record->set(self::FIELD_VALUES, $values);
|
| 2220 |
$record->set(self::FIELD_ERROR, $error);
|
| 2221 |
}
|
| 2222 |
-
|
| 2223 |
public function setFieldError($name, $error) {
|
| 2224 |
$this->isError = true;
|
| 2225 |
$record = $this->fields->getRecord($name);
|
| 2226 |
$record->set(self::FIELD_ERROR, $error);
|
| 2227 |
}
|
| 2228 |
-
|
| 2229 |
public function getFieldValue($name) {
|
| 2230 |
$record = $this->fields->getRecord($name);
|
| 2231 |
return $record->get(self::FIELD_VALUE);
|
| 2232 |
}
|
| 2233 |
-
|
| 2234 |
public function getFieldValues($name) {
|
| 2235 |
$record = $this->fields->getRecord($name);
|
| 2236 |
return $record->get(self::FIELD_VALUES);
|
|
@@ -2240,11 +2269,11 @@ if (!class_exists('Gpf_Rpc_Form', false)) {
|
|
| 2240 |
$record = $this->fields->getRecord($name);
|
| 2241 |
return $record->get(self::FIELD_ERROR);
|
| 2242 |
}
|
| 2243 |
-
|
| 2244 |
public function existsField($name) {
|
| 2245 |
return $this->fields->existsRecord($name);
|
| 2246 |
}
|
| 2247 |
-
|
| 2248 |
public function load(Gpf_Data_Row $row) {
|
| 2249 |
foreach($row as $columnName => $columnValue) {
|
| 2250 |
$this->setField($columnName, $row->get($columnName));
|
|
@@ -2257,16 +2286,19 @@ if (!class_exists('Gpf_Rpc_Form', false)) {
|
|
| 2257 |
public function getFields() {
|
| 2258 |
return $this->fields;
|
| 2259 |
}
|
| 2260 |
-
|
| 2261 |
-
public function fill(Gpf_Data_Row $row) {
|
| 2262 |
foreach ($this->fields as $field) {
|
|
|
|
|
|
|
|
|
|
| 2263 |
try {
|
| 2264 |
$row->set($field->get(self::FIELD_NAME), $field->get(self::FIELD_VALUE));
|
| 2265 |
} catch (Exception $e) {
|
| 2266 |
}
|
| 2267 |
}
|
| 2268 |
}
|
| 2269 |
-
|
| 2270 |
public function toObject() {
|
| 2271 |
$response = new stdClass();
|
| 2272 |
$response->fields = $this->fields->toObject();
|
|
@@ -2279,57 +2311,59 @@ if (!class_exists('Gpf_Rpc_Form', false)) {
|
|
| 2279 |
}
|
| 2280 |
return $response;
|
| 2281 |
}
|
| 2282 |
-
|
| 2283 |
public function loadFromObject(stdClass $object) {
|
| 2284 |
if ($object->success == Gpf::YES) {
|
| 2285 |
$this->setInfoMessage($object->message);
|
| 2286 |
} else {
|
| 2287 |
$this->setErrorMessage($object->message);
|
| 2288 |
}
|
| 2289 |
-
|
| 2290 |
$this->fields = new Gpf_Data_IndexedRecordSet(self::FIELD_NAME);
|
| 2291 |
$this->fields->loadFromObject($object->fields);
|
| 2292 |
}
|
| 2293 |
-
|
| 2294 |
public function toText() {
|
| 2295 |
-
|
|
|
|
|
|
|
| 2296 |
}
|
| 2297 |
|
| 2298 |
public function setErrorMessage($message) {
|
| 2299 |
$this->isError = true;
|
| 2300 |
$this->errorMessage = $message;
|
| 2301 |
}
|
| 2302 |
-
|
| 2303 |
public function getErrorMessage() {
|
| 2304 |
if ($this->isError) {
|
| 2305 |
return $this->errorMessage;
|
| 2306 |
}
|
| 2307 |
return "";
|
| 2308 |
}
|
| 2309 |
-
|
| 2310 |
public function setInfoMessage($message) {
|
| 2311 |
$this->infoMessage = $message;
|
| 2312 |
}
|
| 2313 |
-
|
| 2314 |
public function setSuccessful() {
|
| 2315 |
$this->isError = false;
|
| 2316 |
}
|
| 2317 |
-
|
| 2318 |
public function getInfoMessage() {
|
| 2319 |
if ($this->isError) {
|
| 2320 |
return "";
|
| 2321 |
}
|
| 2322 |
return $this->infoMessage;
|
| 2323 |
}
|
| 2324 |
-
|
| 2325 |
-
|
| 2326 |
/**
|
| 2327 |
* @return boolean
|
| 2328 |
*/
|
| 2329 |
public function isSuccessful() {
|
| 2330 |
return !$this->isError;
|
| 2331 |
}
|
| 2332 |
-
|
| 2333 |
/**
|
| 2334 |
* @return boolean
|
| 2335 |
*/
|
|
@@ -2882,6 +2916,7 @@ if (!class_exists('Gpf_Rpc_Action', false)) {
|
|
| 2882 |
private $infoMessage = "";
|
| 2883 |
private $successCount = 0;
|
| 2884 |
private $errorCount = 0;
|
|
|
|
| 2885 |
/**
|
| 2886 |
* @var Gpf_Rpc_Params
|
| 2887 |
*/
|
|
@@ -2914,6 +2949,14 @@ if (!class_exists('Gpf_Rpc_Action', false)) {
|
|
| 2914 |
return $this->params->exists($name);
|
| 2915 |
}
|
| 2916 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2917 |
protected function getRequestIdsIterator() {
|
| 2918 |
$json = new Gpf_Rpc_Json();
|
| 2919 |
$requestParams = new Gpf_Rpc_Params($json->decode($this->params->get(self::IDS_REQUEST)));
|
|
@@ -2928,6 +2971,7 @@ if (!class_exists('Gpf_Rpc_Action', false)) {
|
|
| 2928 |
public function toObject() {
|
| 2929 |
$response = new stdClass();
|
| 2930 |
$response->success = Gpf::YES;
|
|
|
|
| 2931 |
|
| 2932 |
$response->errorMessage = "";
|
| 2933 |
if ($this->errorCount > 0) {
|
|
@@ -2943,6 +2987,10 @@ if (!class_exists('Gpf_Rpc_Action', false)) {
|
|
| 2943 |
return $response;
|
| 2944 |
}
|
| 2945 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2946 |
public function loadFromObject(stdClass $object) {
|
| 2947 |
$this->errorMessage = $object->errorMessage;
|
| 2948 |
$this->infoMessage = $object->infoMessage;
|
|
@@ -3876,9 +3924,9 @@ if (!class_exists('Gpf_Rpc_Json', false)) {
|
|
| 3876 |
* @return mixed JSON string representation of input var or an error if a problem occurs
|
| 3877 |
* @access public
|
| 3878 |
*/
|
| 3879 |
-
public function encode($var) {
|
| 3880 |
if ($this->isJsonEncodeEnabled()) {
|
| 3881 |
-
return @json_encode($var);
|
| 3882 |
}
|
| 3883 |
switch (gettype($var)) {
|
| 3884 |
case 'boolean':
|
|
@@ -3928,7 +3976,11 @@ if (!class_exists('Gpf_Rpc_Json', false)) {
|
|
| 3928 |
case $ord_var_c == 0x2F:
|
| 3929 |
case $ord_var_c == 0x5C:
|
| 3930 |
// double quote, slash, slosh
|
| 3931 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3932 |
break;
|
| 3933 |
|
| 3934 |
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
|
@@ -4020,7 +4072,11 @@ if (!class_exists('Gpf_Rpc_Json', false)) {
|
|
| 4020 |
|
| 4021 |
// treat as a JSON object
|
| 4022 |
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
|
| 4023 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4024 |
|
| 4025 |
foreach($properties as $property) {
|
| 4026 |
if(Gpf_Rpc_Json::isError($property)) {
|
|
@@ -4030,9 +4086,14 @@ if (!class_exists('Gpf_Rpc_Json', false)) {
|
|
| 4030 |
|
| 4031 |
return '{' . join(',', $properties) . '}';
|
| 4032 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4033 |
|
| 4034 |
// treat it like a regular array
|
| 4035 |
-
$elements = array_map(array($this, 'encode'), $var);
|
| 4036 |
|
| 4037 |
foreach($elements as $element) {
|
| 4038 |
if(Gpf_Rpc_Json::isError($element)) {
|
|
@@ -4044,10 +4105,14 @@ if (!class_exists('Gpf_Rpc_Json', false)) {
|
|
| 4044 |
|
| 4045 |
case 'object':
|
| 4046 |
$vars = get_object_vars($var);
|
| 4047 |
-
|
|
|
|
|
|
|
|
|
|
| 4048 |
$properties = array_map(array($this, 'name_value'),
|
| 4049 |
array_keys($vars),
|
| 4050 |
-
array_values($vars)
|
|
|
|
| 4051 |
|
| 4052 |
foreach($properties as $property) {
|
| 4053 |
if(Gpf_Rpc_Json::isError($property)) {
|
|
@@ -4074,15 +4139,15 @@ if (!class_exists('Gpf_Rpc_Json', false)) {
|
|
| 4074 |
* @return string JSON-formatted name-value pair, like '"name":value'
|
| 4075 |
* @access private
|
| 4076 |
*/
|
| 4077 |
-
function name_value($name, $value)
|
| 4078 |
{
|
| 4079 |
-
$encoded_value = $this->encode($value);
|
| 4080 |
|
| 4081 |
if(Gpf_Rpc_Json::isError($encoded_value)) {
|
| 4082 |
return $encoded_value;
|
| 4083 |
}
|
| 4084 |
|
| 4085 |
-
return $this->encode(strval($name)) . ':' . $encoded_value;
|
| 4086 |
}
|
| 4087 |
|
| 4088 |
/**
|
|
@@ -4429,8 +4494,8 @@ if (!class_exists('Gpf_Rpc_Json', false)) {
|
|
| 4429 |
return false;
|
| 4430 |
}
|
| 4431 |
|
| 4432 |
-
public static function encodeStatic($var) {
|
| 4433 |
-
return self::getInstance()->encode($var);
|
| 4434 |
}
|
| 4435 |
|
| 4436 |
public static function decodeStatic($var) {
|
|
@@ -4607,7 +4672,7 @@ if (!class_exists('Pap_Api_Object', false)) {
|
|
| 4607 |
throw new Exception("No rows found!");
|
| 4608 |
}
|
| 4609 |
if($grid->getTotalCount() > 1) {
|
| 4610 |
-
throw new Exception("Too
|
| 4611 |
}
|
| 4612 |
$recordset = $grid->getRecordset();
|
| 4613 |
|
|
@@ -4728,20 +4793,35 @@ if (!class_exists('Pap_Api_Object', false)) {
|
|
| 4728 |
|
| 4729 |
if (!class_exists('Pap_Api_AffiliatesGrid', false)) {
|
| 4730 |
class Pap_Api_AffiliatesGrid extends Gpf_Rpc_GridRequest {
|
| 4731 |
-
|
| 4732 |
private $dataValues = null;
|
| 4733 |
-
|
| 4734 |
public function __construct(Gpf_Api_Session $session) {
|
| 4735 |
if($session->getRoleType() == Gpf_Api_Session::AFFILIATE) {
|
| 4736 |
throw new Exception("This class can be used only by merchant!");
|
| 4737 |
} else {
|
| 4738 |
-
parent::__construct("
|
| 4739 |
}
|
| 4740 |
}
|
| 4741 |
}
|
| 4742 |
|
| 4743 |
} //end Pap_Api_AffiliatesGrid
|
| 4744 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4745 |
if (!class_exists('Pap_Api_BannersGrid', false)) {
|
| 4746 |
class Pap_Api_BannersGrid extends Gpf_Rpc_GridRequest {
|
| 4747 |
|
|
@@ -4761,16 +4841,30 @@ if (!class_exists('Pap_Api_Affiliate', false)) {
|
|
| 4761 |
|
| 4762 |
private $dataValues = null;
|
| 4763 |
|
|
|
|
|
|
|
|
|
|
| 4764 |
public function __construct(Gpf_Api_Session $session) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4765 |
if($session->getRoleType() == Gpf_Api_Session::AFFILIATE) {
|
| 4766 |
-
$this->class =
|
| 4767 |
} else {
|
| 4768 |
-
$this->class =
|
| 4769 |
}
|
| 4770 |
-
|
| 4771 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4772 |
|
| 4773 |
-
|
|
|
|
| 4774 |
}
|
| 4775 |
|
| 4776 |
public function getUserid() { return $this->getField("userid"); }
|
|
@@ -4781,7 +4875,7 @@ if (!class_exists('Pap_Api_Affiliate', false)) {
|
|
| 4781 |
|
| 4782 |
public function getRefid() { return $this->getField("refid"); }
|
| 4783 |
|
| 4784 |
-
public function setRefid($value, $operator = self::OPERATOR_EQUALS) {
|
| 4785 |
$this->setField('refid', $value, $operator);
|
| 4786 |
}
|
| 4787 |
|
|
@@ -4826,6 +4920,9 @@ if (!class_exists('Pap_Api_Affiliate', false)) {
|
|
| 4826 |
public function getParentUserId() { return $this->getField("parentuserid"); }
|
| 4827 |
public function setParentUserId($value) { $this->setField("parentuserid", $value); }
|
| 4828 |
|
|
|
|
|
|
|
|
|
|
| 4829 |
public function getIp() { return $this->getField("ip"); }
|
| 4830 |
public function setIp($value) { $this->setField("ip", $value); }
|
| 4831 |
|
|
@@ -4854,48 +4951,34 @@ if (!class_exists('Pap_Api_Affiliate', false)) {
|
|
| 4854 |
public function getDataName($index) {
|
| 4855 |
$this->checkIndex($index);
|
| 4856 |
$dataField = "data$index";
|
| 4857 |
-
|
|
|
|
|
|
|
| 4858 |
if(!is_array($this->dataValues) || !isset($this->dataValues[$dataField])) {
|
| 4859 |
return '';
|
| 4860 |
}
|
| 4861 |
-
|
| 4862 |
return $this->dataValues[$dataField]['name'];
|
| 4863 |
}
|
| 4864 |
|
| 4865 |
public function getDataStatus($index) {
|
| 4866 |
$this->checkIndex($index);
|
| 4867 |
$dataField = "data$index";
|
| 4868 |
-
|
|
|
|
|
|
|
| 4869 |
if(!is_array($this->dataValues) || !isset($this->dataValues[$dataField])) {
|
| 4870 |
return 'U';
|
| 4871 |
}
|
| 4872 |
-
|
| 4873 |
-
return $this->dataValues[$dataField]['status'];
|
| 4874 |
-
}
|
| 4875 |
|
| 4876 |
-
|
| 4877 |
-
$params = new Gpf_Rpc_Params();
|
| 4878 |
-
$params->add('ids', array($this->getUserid()));
|
| 4879 |
-
return $this->sendActionRequest('Pap_Merchants_User_AffiliateForm', 'sendSignupConfirmation', $params);
|
| 4880 |
-
}
|
| 4881 |
-
|
| 4882 |
-
/**
|
| 4883 |
-
* @param $campaignID
|
| 4884 |
-
* @param $sendNotification
|
| 4885 |
-
*/
|
| 4886 |
-
public function assignToPrivateCampaign($campaignID, $sendNotification = false) {
|
| 4887 |
-
$params = new Gpf_Rpc_Params();
|
| 4888 |
-
$params->add('campaignId', $campaignID);
|
| 4889 |
-
$params->add('sendNotification', ($sendNotification ? Gpf::YES : Gpf::NO));
|
| 4890 |
-
$params->add('ids', array($this->getUserid()));
|
| 4891 |
-
return $this->sendActionRequest('Pap_Db_UserInCommissionGroup', 'addUsers', $params);
|
| 4892 |
}
|
| 4893 |
|
| 4894 |
private function checkIndex($index) {
|
| 4895 |
if(!is_numeric($index) || $index > 25 || $index < 1) {
|
| 4896 |
throw new Exception("Incorrect index '$index', it must be between 1 and 25");
|
| 4897 |
}
|
| 4898 |
-
|
| 4899 |
return true;
|
| 4900 |
}
|
| 4901 |
|
|
@@ -4904,35 +4987,59 @@ if (!class_exists('Pap_Api_Affiliate', false)) {
|
|
| 4904 |
$this->setField("agreeWithTerms", Gpf::YES);
|
| 4905 |
}
|
| 4906 |
|
| 4907 |
-
protected function getPrimaryKey() {
|
| 4908 |
-
return "userid";
|
| 4909 |
-
}
|
| 4910 |
-
|
| 4911 |
-
protected function getGridRequest() {
|
| 4912 |
-
return new Pap_Api_AffiliatesGrid($this->getSession());
|
| 4913 |
-
}
|
| 4914 |
-
|
| 4915 |
/**
|
| 4916 |
* retrieves names and states of data1..data25 fields
|
| 4917 |
*
|
| 4918 |
*/
|
| 4919 |
protected function getDataFields() {
|
| 4920 |
-
$request = new Gpf_Rpc_RecordsetRequest(
|
| 4921 |
-
$request->addParam(
|
| 4922 |
-
$request->addParam(
|
| 4923 |
-
|
| 4924 |
try {
|
| 4925 |
$request->sendNow();
|
| 4926 |
} catch(Exception $e) {
|
| 4927 |
-
throw new Exception(
|
| 4928 |
}
|
| 4929 |
-
|
| 4930 |
$recordset = $request->getRecordSet();
|
| 4931 |
$this->dataValues = array();
|
| 4932 |
foreach($recordset as $record) {
|
| 4933 |
-
$this->dataValues[$record->get(
|
| 4934 |
-
$this->dataValues[$record->get(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4935 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4936 |
}
|
| 4937 |
|
| 4938 |
private function sendActionRequest($className, $method, Gpf_Rpc_Params $params) {
|
|
@@ -4944,10 +5051,60 @@ if (!class_exists('Pap_Api_Affiliate', false)) {
|
|
| 4944 |
protected function beforeCallRequest(Gpf_Rpc_FormRequest $request) {
|
| 4945 |
$request->addParam('isFromApi', Gpf::YES);
|
| 4946 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4947 |
}
|
| 4948 |
|
| 4949 |
} //end Pap_Api_Affiliate
|
| 4950 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4951 |
if (!class_exists('Pap_Api_TransactionsGrid', false)) {
|
| 4952 |
class Pap_Api_TransactionsGrid extends Gpf_Rpc_GridRequest {
|
| 4953 |
|
|
@@ -5284,7 +5441,7 @@ if (!class_exists('Pap_Api_Transaction', false)) {
|
|
| 5284 |
}
|
| 5285 |
|
| 5286 |
protected function getPrimaryKey() {
|
| 5287 |
-
return "
|
| 5288 |
}
|
| 5289 |
|
| 5290 |
protected function getGridRequest() {
|
|
@@ -5529,7 +5686,7 @@ if (!class_exists('Pap_Tracking_Request', false)) {
|
|
| 5529 |
protected $logger;
|
| 5530 |
|
| 5531 |
function __construct() {
|
| 5532 |
-
$this->request = $_REQUEST;
|
| 5533 |
}
|
| 5534 |
|
| 5535 |
public function parseUrl($url) {
|
|
@@ -5545,7 +5702,7 @@ if (!class_exists('Pap_Tracking_Request', false)) {
|
|
| 5545 |
foreach ($args as $arg) {
|
| 5546 |
$parts = explode('=', $arg, 2);
|
| 5547 |
if (count($parts) == 2) {
|
| 5548 |
-
$this->
|
| 5549 |
}
|
| 5550 |
}
|
| 5551 |
}
|
|
@@ -5592,7 +5749,7 @@ if (!class_exists('Pap_Tracking_Request', false)) {
|
|
| 5592 |
|
| 5593 |
public function setRawExtraData($i, $value) {
|
| 5594 |
$extraDataParamName = $this->getExtraDataParamName($i);
|
| 5595 |
-
$this->
|
| 5596 |
}
|
| 5597 |
|
| 5598 |
/**
|
|
@@ -5607,11 +5764,7 @@ if (!class_exists('Pap_Tracking_Request', false)) {
|
|
| 5607 |
return $value;
|
| 5608 |
}
|
| 5609 |
|
| 5610 |
-
|
| 5611 |
-
if (!isset($this->request[$paramName])) {
|
| 5612 |
-
return '';
|
| 5613 |
-
}
|
| 5614 |
-
return $this->request[$paramName];
|
| 5615 |
}
|
| 5616 |
|
| 5617 |
/**
|
|
@@ -5626,24 +5779,21 @@ if (!class_exists('Pap_Tracking_Request', false)) {
|
|
| 5626 |
return $value;
|
| 5627 |
}
|
| 5628 |
|
| 5629 |
-
|
| 5630 |
-
if (!isset($this->request[$paramName])) {
|
| 5631 |
-
return '';
|
| 5632 |
-
}
|
| 5633 |
-
return $this->request[$paramName];
|
| 5634 |
}
|
| 5635 |
|
| 5636 |
-
public function getClickData1ParamName() {
|
| 5637 |
return Gpf_Settings::get(Pap_Settings::PARAM_NAME_EXTRA_DATA.'1');
|
| 5638 |
}
|
| 5639 |
|
| 5640 |
-
public function getClickData2ParamName() {
|
| 5641 |
return Gpf_Settings::get(Pap_Settings::PARAM_NAME_EXTRA_DATA.'2');
|
| 5642 |
}
|
| 5643 |
|
| 5644 |
public function getRefererUrl() {
|
| 5645 |
-
|
| 5646 |
-
|
|
|
|
| 5647 |
}
|
| 5648 |
if (isset($_SERVER['HTTP_REFERER'])) {
|
| 5649 |
return self::decodeRefererUrl($_SERVER['HTTP_REFERER']);
|
|
@@ -5679,7 +5829,8 @@ if (!class_exists('Pap_Tracking_Request', false)) {
|
|
| 5679 |
}
|
| 5680 |
|
| 5681 |
public function getLinkStyle() {
|
| 5682 |
-
|
|
|
|
| 5683 |
return Pap_Tracking_ClickTracker::LINKMETHOD_REDIRECT;
|
| 5684 |
}
|
| 5685 |
return Pap_Tracking_ClickTracker::LINKMETHOD_URLPARAMETERS;
|
|
@@ -5701,6 +5852,7 @@ if (!class_exists('Pap_Tracking_Request', false)) {
|
|
| 5701 |
}
|
| 5702 |
|
| 5703 |
public function getRequestParameter($paramName) {
|
|
|
|
| 5704 |
if (!isset($this->request[$paramName])) {
|
| 5705 |
return '';
|
| 5706 |
}
|
|
@@ -5708,7 +5860,7 @@ if (!class_exists('Pap_Tracking_Request', false)) {
|
|
| 5708 |
}
|
| 5709 |
|
| 5710 |
public function setRequestParameter($paramName, $value) {
|
| 5711 |
-
$this->request[$paramName] = $value;
|
| 5712 |
}
|
| 5713 |
|
| 5714 |
static public function getRotatorBannerParamName() {
|
|
@@ -5895,7 +6047,14 @@ if (!class_exists('Pap_Api_Tracker', false)) {
|
|
| 5895 |
throw new Exception("This class can be used only by merchant!");
|
| 5896 |
}
|
| 5897 |
$this->session = $session;
|
| 5898 |
-
$this->visitorId =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5899 |
}
|
| 5900 |
|
| 5901 |
public function setVisitorId($visitorId) {
|
|
@@ -6489,6 +6648,6 @@ if (!class_exists('Gpf_Net_Http_Client', false)) {
|
|
| 6489 |
}
|
| 6490 |
/*
|
| 6491 |
VERSION
|
| 6492 |
-
|
| 6493 |
*/
|
| 6494 |
?>
|
| 9 |
* Version 1.0 (the "License"); you may not use this file except in compliance
|
| 10 |
* with the License. You may obtain a copy of the License at
|
| 11 |
* http://www.qualityunit.com/licenses/gpf
|
| 12 |
+
* Generated on: 2016-11-16 23:17:01
|
| 13 |
+
* PAP version: 5.5.15.11, GPF version: 1.3.39.0
|
| 14 |
*
|
| 15 |
*/
|
| 16 |
|
| 159 |
*/
|
| 160 |
private $dataDecoder;
|
| 161 |
|
| 162 |
+
private $isStripHtmlTags = false;
|
| 163 |
+
|
| 164 |
public function __construct() {
|
| 165 |
}
|
| 166 |
|
| 179 |
*/
|
| 180 |
public function executeAndEcho($request = '') {
|
| 181 |
$response = $this->encodeResponse($this->execute($request));
|
| 182 |
+
if ($this->isStripHtmlTags) {
|
| 183 |
+
$response = strip_tags($response);
|
| 184 |
+
}
|
| 185 |
Gpf_ModuleBase::startGzip();
|
| 186 |
echo $response;
|
| 187 |
Gpf_ModuleBase::flushGzip();
|
| 206 |
} catch (Exception $e) {
|
| 207 |
return new Gpf_Rpc_ExceptionResponse($e);
|
| 208 |
}
|
| 209 |
+
if (!$this->isFormRequest($request)) {
|
| 210 |
+
Gpf_Http::setHeader('Content-Type', 'application/json; charset=utf-8');
|
| 211 |
+
} else {
|
| 212 |
+
if ($response instanceof Gpf_Rpc_Form && $params->get(self::FORM_RESPONSE) != self::HANDLER_WINDOW_NAME) {
|
| 213 |
+
$this->isStripHtmlTags = true;
|
| 214 |
+
}
|
| 215 |
+
}
|
| 216 |
return $response;
|
| 217 |
}
|
| 218 |
|
| 952 |
if (!class_exists('Gpf_Data_RecordHeader', false)) {
|
| 953 |
class Gpf_Data_RecordHeader extends Gpf_Object {
|
| 954 |
private $ids = array();
|
| 955 |
+
|
| 956 |
/**
|
| 957 |
* Create Record header object
|
| 958 |
*
|
| 962 |
if($headerArray === null) {
|
| 963 |
return;
|
| 964 |
}
|
| 965 |
+
|
| 966 |
if (!$this->isIterable($headerArray)) {
|
| 967 |
$e = new Gpf_Exception('');
|
| 968 |
+
Gpf_Log::error('Not correct header: '.var_export($headerArray, true).' for RecordHeader, trace: '.$e->getTraceAsString());
|
| 969 |
+
|
| 970 |
return;
|
| 971 |
}
|
| 972 |
+
|
| 973 |
foreach ($headerArray as $id) {
|
| 974 |
$this->add($id);
|
| 975 |
}
|
| 976 |
}
|
| 977 |
+
|
| 978 |
public function contains($id) {
|
| 979 |
return array_key_exists($id, $this->ids);
|
| 980 |
}
|
| 981 |
|
| 982 |
public function add($id) {
|
| 983 |
+
if (!is_numeric($id) && !is_string($id)) {
|
| 984 |
+
throw new Gpf_Exception('Value cannot be used as key of array: '.var_export($id, true));
|
| 985 |
+
}
|
| 986 |
if($this->contains($id)) {
|
| 987 |
return;
|
| 988 |
}
|
| 1000 |
}
|
| 1001 |
return $this->ids[$id];
|
| 1002 |
}
|
| 1003 |
+
|
| 1004 |
public function getSize() {
|
| 1005 |
return count($this->ids);
|
| 1006 |
}
|
| 1012 |
}
|
| 1013 |
return $response;
|
| 1014 |
}
|
| 1015 |
+
|
| 1016 |
public function toObject() {
|
| 1017 |
$result = array();
|
| 1018 |
foreach ($this->ids as $columnId => $columnIndex) {
|
| 1020 |
}
|
| 1021 |
return $result;
|
| 1022 |
}
|
| 1023 |
+
|
| 1024 |
private function isIterable($var) {
|
| 1025 |
return (is_array($var) || $var instanceof Traversable || $var instanceof stdClass);
|
| 1026 |
}
|
| 1496 |
}
|
| 1497 |
}
|
| 1498 |
|
| 1499 |
+
/**
|
| 1500 |
+
* @param String $headerColumn
|
| 1501 |
+
* @param String $value
|
| 1502 |
+
* @return boolean
|
| 1503 |
+
*/
|
| 1504 |
+
public function existsRecordValue($headerColumn, $value) {
|
| 1505 |
+
foreach ($this->_array as $record) {
|
| 1506 |
+
if ($record->get($headerColumn) == $value) {
|
| 1507 |
+
return true;
|
| 1508 |
+
}
|
| 1509 |
+
}
|
| 1510 |
+
return false;
|
| 1511 |
+
}
|
| 1512 |
+
|
| 1513 |
/**
|
| 1514 |
* Creates shalow copy of recordset containing only headers
|
| 1515 |
*
|
| 1546 |
|
| 1547 |
private function compare($value1, $value2) {
|
| 1548 |
if ($this->sortType == Gpf_Data_RecordSet::SORT_ASC) {
|
| 1549 |
+
return (strtolower($value1) < strtolower($value2)) ? -1 : 1;
|
| 1550 |
}
|
| 1551 |
+
return (strtolower($value1) < strtolower($value2)) ? 1 : -1;
|
| 1552 |
}
|
| 1553 |
}
|
| 1554 |
|
| 1568 |
}
|
| 1569 |
|
| 1570 |
public function addRecord(Gpf_Data_Record $record) {
|
| 1571 |
+
$keyValue = $record->get($this->key);
|
| 1572 |
+
if (!is_numeric($keyValue) && !is_string($keyValue)) {
|
| 1573 |
+
throw new Gpf_Exception('Value cannot be used as key of array: '.var_export($keyValue, true));
|
| 1574 |
+
}
|
| 1575 |
$this->_array[$record->get($this->key)] = $record;
|
| 1576 |
}
|
| 1577 |
|
| 1649 |
private $query = '';
|
| 1650 |
private $fragment = '';
|
| 1651 |
private $cookies = '';
|
| 1652 |
+
|
| 1653 |
private $maxTimeout = null;
|
| 1654 |
|
| 1655 |
private $body = '';
|
| 1664 |
}
|
| 1665 |
|
| 1666 |
public function getCookiesString() {
|
|
|
|
| 1667 |
if (!is_array($this->cookies)) {
|
| 1668 |
+
return '';
|
|
|
|
|
|
|
|
|
|
| 1669 |
}
|
| 1670 |
+
return urldecode(http_build_query($this->cookies, '', ';'));
|
| 1671 |
}
|
| 1672 |
+
|
| 1673 |
public function getMaxTimeout() {
|
| 1674 |
return $this->maxTimeout;
|
| 1675 |
}
|
| 1676 |
+
|
| 1677 |
public function setMaxTimeout($timeout) {
|
| 1678 |
$this->maxTimeout = $timeout;
|
| 1679 |
}
|
| 2043 |
@curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
|
| 2044 |
if ($request->getHttpPassword() != '' && $request->getHttpUser() != '') {
|
| 2045 |
@curl_setopt($session, CURLOPT_USERPWD, $request->getHttpUser() . ":" . $request->getHttpPassword());
|
| 2046 |
+
@curl_setopt($session, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
| 2047 |
}
|
| 2048 |
@curl_setopt ($session, CURLOPT_SSL_VERIFYHOST, 0);
|
| 2049 |
@curl_setopt ($session, CURLOPT_SSL_VERIFYPEER, 0);
|
| 2198 |
$header->add(self::FIELD_VALUES);
|
| 2199 |
$header->add(self::FIELD_ERROR);
|
| 2200 |
$this->fields->setHeader($header);
|
| 2201 |
+
|
| 2202 |
$this->validator = new Gpf_Rpc_Form_Validator_FormValidatorCollection($this);
|
| 2203 |
+
|
| 2204 |
if($params) {
|
| 2205 |
$this->loadFieldsFromArray($params->get("fields"));
|
| 2206 |
}
|
| 2214 |
public function addValidator(Gpf_Rpc_Form_Validator_Validator $validator, $fieldName, $fieldLabel = null) {
|
| 2215 |
$this->validator->addValidator($validator, $fieldName, $fieldLabel);
|
| 2216 |
}
|
| 2217 |
+
|
| 2218 |
/**
|
| 2219 |
* @return boolean
|
| 2220 |
*/
|
| 2221 |
public function validate() {
|
| 2222 |
return $this->validator->validate();
|
| 2223 |
}
|
| 2224 |
+
|
| 2225 |
public function loadFieldsFromArray($fields) {
|
| 2226 |
for ($i = 1; $i < count($fields); $i++) {
|
| 2227 |
$field = $fields[$i];
|
| 2228 |
$this->fields->add($field);
|
| 2229 |
}
|
| 2230 |
}
|
| 2231 |
+
|
| 2232 |
/**
|
| 2233 |
*
|
| 2234 |
* @return ArrayIterator
|
| 2236 |
public function getIterator() {
|
| 2237 |
return $this->fields->getIterator();
|
| 2238 |
}
|
| 2239 |
+
|
| 2240 |
public function addField($name, $value) {
|
| 2241 |
$record = $this->fields->createRecord($name);
|
| 2242 |
$record->set(self::FIELD_VALUE, $value);
|
| 2243 |
}
|
| 2244 |
+
|
| 2245 |
public function setField($name, $value, $values = null, $error = "") {
|
| 2246 |
$record = $this->fields->createRecord($name);
|
| 2247 |
$record->set(self::FIELD_VALUE, $value);
|
| 2248 |
$record->set(self::FIELD_VALUES, $values);
|
| 2249 |
$record->set(self::FIELD_ERROR, $error);
|
| 2250 |
}
|
| 2251 |
+
|
| 2252 |
public function setFieldError($name, $error) {
|
| 2253 |
$this->isError = true;
|
| 2254 |
$record = $this->fields->getRecord($name);
|
| 2255 |
$record->set(self::FIELD_ERROR, $error);
|
| 2256 |
}
|
| 2257 |
+
|
| 2258 |
public function getFieldValue($name) {
|
| 2259 |
$record = $this->fields->getRecord($name);
|
| 2260 |
return $record->get(self::FIELD_VALUE);
|
| 2261 |
}
|
| 2262 |
+
|
| 2263 |
public function getFieldValues($name) {
|
| 2264 |
$record = $this->fields->getRecord($name);
|
| 2265 |
return $record->get(self::FIELD_VALUES);
|
| 2269 |
$record = $this->fields->getRecord($name);
|
| 2270 |
return $record->get(self::FIELD_ERROR);
|
| 2271 |
}
|
| 2272 |
+
|
| 2273 |
public function existsField($name) {
|
| 2274 |
return $this->fields->existsRecord($name);
|
| 2275 |
}
|
| 2276 |
+
|
| 2277 |
public function load(Gpf_Data_Row $row) {
|
| 2278 |
foreach($row as $columnName => $columnValue) {
|
| 2279 |
$this->setField($columnName, $row->get($columnName));
|
| 2286 |
public function getFields() {
|
| 2287 |
return $this->fields;
|
| 2288 |
}
|
| 2289 |
+
|
| 2290 |
+
public function fill(Gpf_Data_Row $row, array $writableFields = array()) {
|
| 2291 |
foreach ($this->fields as $field) {
|
| 2292 |
+
if (count($writableFields) > 0 && !in_array($field->get(self::FIELD_NAME), $writableFields)) {
|
| 2293 |
+
continue;
|
| 2294 |
+
}
|
| 2295 |
try {
|
| 2296 |
$row->set($field->get(self::FIELD_NAME), $field->get(self::FIELD_VALUE));
|
| 2297 |
} catch (Exception $e) {
|
| 2298 |
}
|
| 2299 |
}
|
| 2300 |
}
|
| 2301 |
+
|
| 2302 |
public function toObject() {
|
| 2303 |
$response = new stdClass();
|
| 2304 |
$response->fields = $this->fields->toObject();
|
| 2311 |
}
|
| 2312 |
return $response;
|
| 2313 |
}
|
| 2314 |
+
|
| 2315 |
public function loadFromObject(stdClass $object) {
|
| 2316 |
if ($object->success == Gpf::YES) {
|
| 2317 |
$this->setInfoMessage($object->message);
|
| 2318 |
} else {
|
| 2319 |
$this->setErrorMessage($object->message);
|
| 2320 |
}
|
| 2321 |
+
|
| 2322 |
$this->fields = new Gpf_Data_IndexedRecordSet(self::FIELD_NAME);
|
| 2323 |
$this->fields->loadFromObject($object->fields);
|
| 2324 |
}
|
| 2325 |
+
|
| 2326 |
public function toText() {
|
| 2327 |
+
ob_start();
|
| 2328 |
+
var_dump($this->toObject());
|
| 2329 |
+
return ob_get_clean();
|
| 2330 |
}
|
| 2331 |
|
| 2332 |
public function setErrorMessage($message) {
|
| 2333 |
$this->isError = true;
|
| 2334 |
$this->errorMessage = $message;
|
| 2335 |
}
|
| 2336 |
+
|
| 2337 |
public function getErrorMessage() {
|
| 2338 |
if ($this->isError) {
|
| 2339 |
return $this->errorMessage;
|
| 2340 |
}
|
| 2341 |
return "";
|
| 2342 |
}
|
| 2343 |
+
|
| 2344 |
public function setInfoMessage($message) {
|
| 2345 |
$this->infoMessage = $message;
|
| 2346 |
}
|
| 2347 |
+
|
| 2348 |
public function setSuccessful() {
|
| 2349 |
$this->isError = false;
|
| 2350 |
}
|
| 2351 |
+
|
| 2352 |
public function getInfoMessage() {
|
| 2353 |
if ($this->isError) {
|
| 2354 |
return "";
|
| 2355 |
}
|
| 2356 |
return $this->infoMessage;
|
| 2357 |
}
|
| 2358 |
+
|
| 2359 |
+
|
| 2360 |
/**
|
| 2361 |
* @return boolean
|
| 2362 |
*/
|
| 2363 |
public function isSuccessful() {
|
| 2364 |
return !$this->isError;
|
| 2365 |
}
|
| 2366 |
+
|
| 2367 |
/**
|
| 2368 |
* @return boolean
|
| 2369 |
*/
|
| 2916 |
private $infoMessage = "";
|
| 2917 |
private $successCount = 0;
|
| 2918 |
private $errorCount = 0;
|
| 2919 |
+
private $isFinished = true;
|
| 2920 |
/**
|
| 2921 |
* @var Gpf_Rpc_Params
|
| 2922 |
*/
|
| 2949 |
return $this->params->exists($name);
|
| 2950 |
}
|
| 2951 |
|
| 2952 |
+
/**
|
| 2953 |
+
*
|
| 2954 |
+
* @return Gpf_Rpc_Params
|
| 2955 |
+
*/
|
| 2956 |
+
public function getParams() {
|
| 2957 |
+
return $this->params;
|
| 2958 |
+
}
|
| 2959 |
+
|
| 2960 |
protected function getRequestIdsIterator() {
|
| 2961 |
$json = new Gpf_Rpc_Json();
|
| 2962 |
$requestParams = new Gpf_Rpc_Params($json->decode($this->params->get(self::IDS_REQUEST)));
|
| 2971 |
public function toObject() {
|
| 2972 |
$response = new stdClass();
|
| 2973 |
$response->success = Gpf::YES;
|
| 2974 |
+
$response->finished = $this->isFinished ? Gpf::YES : Gpf::NO;
|
| 2975 |
|
| 2976 |
$response->errorMessage = "";
|
| 2977 |
if ($this->errorCount > 0) {
|
| 2987 |
return $response;
|
| 2988 |
}
|
| 2989 |
|
| 2990 |
+
public function setNotFinished() {
|
| 2991 |
+
$this->isFinished = false;
|
| 2992 |
+
}
|
| 2993 |
+
|
| 2994 |
public function loadFromObject(stdClass $object) {
|
| 2995 |
$this->errorMessage = $object->errorMessage;
|
| 2996 |
$this->infoMessage = $object->infoMessage;
|
| 3924 |
* @return mixed JSON string representation of input var or an error if a problem occurs
|
| 3925 |
* @access public
|
| 3926 |
*/
|
| 3927 |
+
public function encode($var, $options = null) {
|
| 3928 |
if ($this->isJsonEncodeEnabled()) {
|
| 3929 |
+
return @json_encode($var, $options);
|
| 3930 |
}
|
| 3931 |
switch (gettype($var)) {
|
| 3932 |
case 'boolean':
|
| 3976 |
case $ord_var_c == 0x2F:
|
| 3977 |
case $ord_var_c == 0x5C:
|
| 3978 |
// double quote, slash, slosh
|
| 3979 |
+
if ($options == JSON_UNESCAPED_SLASHES && $ord_var_c == 0x2F) {
|
| 3980 |
+
$ascii .= $var{$c};
|
| 3981 |
+
} else {
|
| 3982 |
+
$ascii .= '\\'.$var{$c};
|
| 3983 |
+
}
|
| 3984 |
break;
|
| 3985 |
|
| 3986 |
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
| 4072 |
|
| 4073 |
// treat as a JSON object
|
| 4074 |
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
|
| 4075 |
+
$optionsArray = array();
|
| 4076 |
+
for ($i = 0; $i < count($var); $i++) {
|
| 4077 |
+
$optionsArray[] = $options;
|
| 4078 |
+
}
|
| 4079 |
+
$properties = array_map(array($this, 'name_value'), array_keys($var), array_values($var), $optionsArray);
|
| 4080 |
|
| 4081 |
foreach($properties as $property) {
|
| 4082 |
if(Gpf_Rpc_Json::isError($property)) {
|
| 4086 |
|
| 4087 |
return '{' . join(',', $properties) . '}';
|
| 4088 |
}
|
| 4089 |
+
|
| 4090 |
+
$optionsArray = array();
|
| 4091 |
+
for ($i = 0; $i < count($var); $i++) {
|
| 4092 |
+
$optionsArray[] = $options;
|
| 4093 |
+
}
|
| 4094 |
|
| 4095 |
// treat it like a regular array
|
| 4096 |
+
$elements = array_map(array($this, 'encode'), $var, $optionsArray);
|
| 4097 |
|
| 4098 |
foreach($elements as $element) {
|
| 4099 |
if(Gpf_Rpc_Json::isError($element)) {
|
| 4105 |
|
| 4106 |
case 'object':
|
| 4107 |
$vars = get_object_vars($var);
|
| 4108 |
+
$optionsArray = array();
|
| 4109 |
+
for ($i = 0; $i < count($vars); $i++) {
|
| 4110 |
+
$optionsArray[] = $options;
|
| 4111 |
+
}
|
| 4112 |
$properties = array_map(array($this, 'name_value'),
|
| 4113 |
array_keys($vars),
|
| 4114 |
+
array_values($vars),
|
| 4115 |
+
$optionsArray);
|
| 4116 |
|
| 4117 |
foreach($properties as $property) {
|
| 4118 |
if(Gpf_Rpc_Json::isError($property)) {
|
| 4139 |
* @return string JSON-formatted name-value pair, like '"name":value'
|
| 4140 |
* @access private
|
| 4141 |
*/
|
| 4142 |
+
function name_value($name, $value, $options = null)
|
| 4143 |
{
|
| 4144 |
+
$encoded_value = $this->encode($value, $options);
|
| 4145 |
|
| 4146 |
if(Gpf_Rpc_Json::isError($encoded_value)) {
|
| 4147 |
return $encoded_value;
|
| 4148 |
}
|
| 4149 |
|
| 4150 |
+
return $this->encode(strval($name), $options) . ':' . $encoded_value;
|
| 4151 |
}
|
| 4152 |
|
| 4153 |
/**
|
| 4494 |
return false;
|
| 4495 |
}
|
| 4496 |
|
| 4497 |
+
public static function encodeStatic($var, $options = null) {
|
| 4498 |
+
return self::getInstance()->encode($var, $options);
|
| 4499 |
}
|
| 4500 |
|
| 4501 |
public static function decodeStatic($var) {
|
| 4672 |
throw new Exception("No rows found!");
|
| 4673 |
}
|
| 4674 |
if($grid->getTotalCount() > 1) {
|
| 4675 |
+
throw new Exception("Too many rows found!");
|
| 4676 |
}
|
| 4677 |
$recordset = $grid->getRecordset();
|
| 4678 |
|
| 4793 |
|
| 4794 |
if (!class_exists('Pap_Api_AffiliatesGrid', false)) {
|
| 4795 |
class Pap_Api_AffiliatesGrid extends Gpf_Rpc_GridRequest {
|
| 4796 |
+
|
| 4797 |
private $dataValues = null;
|
| 4798 |
+
|
| 4799 |
public function __construct(Gpf_Api_Session $session) {
|
| 4800 |
if($session->getRoleType() == Gpf_Api_Session::AFFILIATE) {
|
| 4801 |
throw new Exception("This class can be used only by merchant!");
|
| 4802 |
} else {
|
| 4803 |
+
parent::__construct("Pap_Merchants_User_TopAffiliatesGrid", "getRows", $session);
|
| 4804 |
}
|
| 4805 |
}
|
| 4806 |
}
|
| 4807 |
|
| 4808 |
} //end Pap_Api_AffiliatesGrid
|
| 4809 |
|
| 4810 |
+
if (!class_exists('Pap_Api_AffiliatesGridSimple', false)) {
|
| 4811 |
+
class Pap_Api_AffiliatesGridSimple extends Gpf_Rpc_GridRequest {
|
| 4812 |
+
private $dataValues = null;
|
| 4813 |
+
|
| 4814 |
+
public function __construct(Gpf_Api_Session $session) {
|
| 4815 |
+
if ($session->getRoleType() == Gpf_Api_Session::AFFILIATE) {
|
| 4816 |
+
throw new Exception('This class can be used only by merchant!');
|
| 4817 |
+
} else {
|
| 4818 |
+
parent::__construct('Pap_Merchants_User_AffiliatesGridSimple', 'getRows', $session);
|
| 4819 |
+
}
|
| 4820 |
+
}
|
| 4821 |
+
}
|
| 4822 |
+
|
| 4823 |
+
} //end Pap_Api_AffiliatesGridSimple
|
| 4824 |
+
|
| 4825 |
if (!class_exists('Pap_Api_BannersGrid', false)) {
|
| 4826 |
class Pap_Api_BannersGrid extends Gpf_Rpc_GridRequest {
|
| 4827 |
|
| 4841 |
|
| 4842 |
private $dataValues = null;
|
| 4843 |
|
| 4844 |
+
const CLASS_NAME_AFFILIATE = 'Pap_Affiliates_Profile_PersonalDetailsForm';
|
| 4845 |
+
const CLASS_NAME_MERCHANT = 'Pap_Merchants_User_AffiliateForm';
|
| 4846 |
+
|
| 4847 |
public function __construct(Gpf_Api_Session $session) {
|
| 4848 |
+
parent::__construct($session);
|
| 4849 |
+
$this->initClass($session);
|
| 4850 |
+
}
|
| 4851 |
+
|
| 4852 |
+
protected function initClass(Gpf_Api_Session $session) {
|
| 4853 |
if($session->getRoleType() == Gpf_Api_Session::AFFILIATE) {
|
| 4854 |
+
$this->class = self::CLASS_NAME_AFFILIATE;
|
| 4855 |
} else {
|
| 4856 |
+
$this->class = self::CLASS_NAME_MERCHANT;
|
| 4857 |
}
|
| 4858 |
+
}
|
| 4859 |
+
|
| 4860 |
+
private function initDataFields() {
|
| 4861 |
+
if ($this->dataValues === null) {
|
| 4862 |
+
$this->getDataFields();
|
| 4863 |
+
}
|
| 4864 |
+
}
|
| 4865 |
|
| 4866 |
+
protected function getPrimaryKey() {
|
| 4867 |
+
return "userid";
|
| 4868 |
}
|
| 4869 |
|
| 4870 |
public function getUserid() { return $this->getField("userid"); }
|
| 4875 |
|
| 4876 |
public function getRefid() { return $this->getField("refid"); }
|
| 4877 |
|
| 4878 |
+
public function setRefid($value, $operator = self::OPERATOR_EQUALS) {
|
| 4879 |
$this->setField('refid', $value, $operator);
|
| 4880 |
}
|
| 4881 |
|
| 4920 |
public function getParentUserId() { return $this->getField("parentuserid"); }
|
| 4921 |
public function setParentUserId($value) { $this->setField("parentuserid", $value); }
|
| 4922 |
|
| 4923 |
+
public function getVisitorId() { return $this->getField("visitorId"); }
|
| 4924 |
+
public function setVisitorId($value) { $this->setField("visitorId", $value); }
|
| 4925 |
+
|
| 4926 |
public function getIp() { return $this->getField("ip"); }
|
| 4927 |
public function setIp($value) { $this->setField("ip", $value); }
|
| 4928 |
|
| 4951 |
public function getDataName($index) {
|
| 4952 |
$this->checkIndex($index);
|
| 4953 |
$dataField = "data$index";
|
| 4954 |
+
|
| 4955 |
+
$this->initDataFields();
|
| 4956 |
+
|
| 4957 |
if(!is_array($this->dataValues) || !isset($this->dataValues[$dataField])) {
|
| 4958 |
return '';
|
| 4959 |
}
|
| 4960 |
+
|
| 4961 |
return $this->dataValues[$dataField]['name'];
|
| 4962 |
}
|
| 4963 |
|
| 4964 |
public function getDataStatus($index) {
|
| 4965 |
$this->checkIndex($index);
|
| 4966 |
$dataField = "data$index";
|
| 4967 |
+
|
| 4968 |
+
$this->initDataFields();
|
| 4969 |
+
|
| 4970 |
if(!is_array($this->dataValues) || !isset($this->dataValues[$dataField])) {
|
| 4971 |
return 'U';
|
| 4972 |
}
|
|
|
|
|
|
|
|
|
|
| 4973 |
|
| 4974 |
+
return $this->dataValues[$dataField]['status'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4975 |
}
|
| 4976 |
|
| 4977 |
private function checkIndex($index) {
|
| 4978 |
if(!is_numeric($index) || $index > 25 || $index < 1) {
|
| 4979 |
throw new Exception("Incorrect index '$index', it must be between 1 and 25");
|
| 4980 |
}
|
| 4981 |
+
|
| 4982 |
return true;
|
| 4983 |
}
|
| 4984 |
|
| 4987 |
$this->setField("agreeWithTerms", Gpf::YES);
|
| 4988 |
}
|
| 4989 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4990 |
/**
|
| 4991 |
* retrieves names and states of data1..data25 fields
|
| 4992 |
*
|
| 4993 |
*/
|
| 4994 |
protected function getDataFields() {
|
| 4995 |
+
$request = new Gpf_Rpc_RecordsetRequest('Gpf_Db_Table_FormFields', 'getFields', $this->getSession());
|
| 4996 |
+
$request->addParam('formId', 'affiliateForm');
|
| 4997 |
+
$request->addParam('status', $this->getDataFieldStatuses());
|
| 4998 |
+
|
| 4999 |
try {
|
| 5000 |
$request->sendNow();
|
| 5001 |
} catch(Exception $e) {
|
| 5002 |
+
throw new Exception('Cannot load datafields. Error: '.$e->getMessage());
|
| 5003 |
}
|
| 5004 |
+
|
| 5005 |
$recordset = $request->getRecordSet();
|
| 5006 |
$this->dataValues = array();
|
| 5007 |
foreach($recordset as $record) {
|
| 5008 |
+
$this->dataValues[$record->get('code')]['name'] = $record->get("name");
|
| 5009 |
+
$this->dataValues[$record->get('code')]['status'] = $record->get("status");
|
| 5010 |
+
}
|
| 5011 |
+
}
|
| 5012 |
+
|
| 5013 |
+
public function sendConfirmationEmail() {
|
| 5014 |
+
if($this->getSession()->getRoleType() == Gpf_Api_Session::AFFILIATE) {
|
| 5015 |
+
throw new Exception('Insufficient privileges');
|
| 5016 |
+
}
|
| 5017 |
+
$params = new Gpf_Rpc_Params();
|
| 5018 |
+
$params->add('ids', array($this->getUserid()));
|
| 5019 |
+
return $this->sendActionRequest('Pap_Merchants_User_AffiliateForm', 'sendSignupConfirmation', $params);
|
| 5020 |
+
}
|
| 5021 |
+
|
| 5022 |
+
/**
|
| 5023 |
+
* @param $campaignID
|
| 5024 |
+
* @param $sendNotification
|
| 5025 |
+
*/
|
| 5026 |
+
public function assignToPrivateCampaign($campaignID, $sendNotification = false) {
|
| 5027 |
+
if($this->getSession()->getRoleType() == Gpf_Api_Session::AFFILIATE) {
|
| 5028 |
+
throw new Exception('Insufficient privileges');
|
| 5029 |
}
|
| 5030 |
+
$params = new Gpf_Rpc_Params();
|
| 5031 |
+
$params->add('campaignId', $campaignID);
|
| 5032 |
+
$params->add('sendNotification', ($sendNotification ? Gpf::YES : Gpf::NO));
|
| 5033 |
+
$params->add('ids', array($this->getUserid()));
|
| 5034 |
+
return $this->sendActionRequest('Pap_Db_UserInCommissionGroup', 'addUsers', $params);
|
| 5035 |
+
}
|
| 5036 |
+
|
| 5037 |
+
protected function getGridRequest() {
|
| 5038 |
+
return new Pap_Api_AffiliatesGrid($this->getSession());
|
| 5039 |
+
}
|
| 5040 |
+
|
| 5041 |
+
protected function getDataFieldStatuses() {
|
| 5042 |
+
return 'M,O,P,R,S,W';
|
| 5043 |
}
|
| 5044 |
|
| 5045 |
private function sendActionRequest($className, $method, Gpf_Rpc_Params $params) {
|
| 5051 |
protected function beforeCallRequest(Gpf_Rpc_FormRequest $request) {
|
| 5052 |
$request->addParam('isFromApi', Gpf::YES);
|
| 5053 |
}
|
| 5054 |
+
|
| 5055 |
+
public function add() {
|
| 5056 |
+
if ($this->class == self::CLASS_NAME_AFFILIATE) {
|
| 5057 |
+
throw new Gpf_Exception('Not implemented');
|
| 5058 |
+
}
|
| 5059 |
+
return parent::add();
|
| 5060 |
+
}
|
| 5061 |
}
|
| 5062 |
|
| 5063 |
} //end Pap_Api_Affiliate
|
| 5064 |
|
| 5065 |
+
if (!class_exists('Pap_Api_AffiliateSignup', false)) {
|
| 5066 |
+
class Pap_Api_AffiliateSignup extends Pap_Api_Affiliate {
|
| 5067 |
+
|
| 5068 |
+
public function __construct(Gpf_Api_Session $session) {
|
| 5069 |
+
parent::__construct($session);
|
| 5070 |
+
}
|
| 5071 |
+
|
| 5072 |
+
protected function initClass(Gpf_Api_Session $session) {
|
| 5073 |
+
$this->class = 'Pap_Signup_AffiliateForm';
|
| 5074 |
+
}
|
| 5075 |
+
|
| 5076 |
+
protected function getDataFieldStatuses() {
|
| 5077 |
+
return 'M,O,S,W';
|
| 5078 |
+
}
|
| 5079 |
+
|
| 5080 |
+
public function sendConfirmationEmail() {
|
| 5081 |
+
throw new Gpf_Exception('Not implemented');
|
| 5082 |
+
}
|
| 5083 |
+
|
| 5084 |
+
public function assignToPrivateCampaign($campaignID, $sendNotification = false) {
|
| 5085 |
+
throw new Gpf_Exception('Not implemented');
|
| 5086 |
+
}
|
| 5087 |
+
|
| 5088 |
+
protected function getGridRequest() {
|
| 5089 |
+
throw new Gpf_Exception('Not implemented');
|
| 5090 |
+
}
|
| 5091 |
+
|
| 5092 |
+
public function save() {
|
| 5093 |
+
throw new Gpf_Exception('Not implemented');
|
| 5094 |
+
}
|
| 5095 |
+
|
| 5096 |
+
public function load() {
|
| 5097 |
+
throw new Gpf_Exception('Not implemented');
|
| 5098 |
+
}
|
| 5099 |
+
|
| 5100 |
+
protected function beforeCallRequest(Gpf_Rpc_FormRequest $request) {
|
| 5101 |
+
parent::beforeCallRequest($request);
|
| 5102 |
+
$request->addParam('initSession', Gpf::YES);
|
| 5103 |
+
}
|
| 5104 |
+
}
|
| 5105 |
+
|
| 5106 |
+
} //end Pap_Api_AffiliateSignup
|
| 5107 |
+
|
| 5108 |
if (!class_exists('Pap_Api_TransactionsGrid', false)) {
|
| 5109 |
class Pap_Api_TransactionsGrid extends Gpf_Rpc_GridRequest {
|
| 5110 |
|
| 5441 |
}
|
| 5442 |
|
| 5443 |
protected function getPrimaryKey() {
|
| 5444 |
+
return "id";
|
| 5445 |
}
|
| 5446 |
|
| 5447 |
protected function getGridRequest() {
|
| 5686 |
protected $logger;
|
| 5687 |
|
| 5688 |
function __construct() {
|
| 5689 |
+
$this->request = array_change_key_case($_REQUEST, CASE_LOWER);
|
| 5690 |
}
|
| 5691 |
|
| 5692 |
public function parseUrl($url) {
|
| 5702 |
foreach ($args as $arg) {
|
| 5703 |
$parts = explode('=', $arg, 2);
|
| 5704 |
if (count($parts) == 2) {
|
| 5705 |
+
$this->setRequestParameter($parts[0], $parts[1]);
|
| 5706 |
}
|
| 5707 |
}
|
| 5708 |
}
|
| 5749 |
|
| 5750 |
public function setRawExtraData($i, $value) {
|
| 5751 |
$extraDataParamName = $this->getExtraDataParamName($i);
|
| 5752 |
+
$this->setRequestParameter($extraDataParamName, $value);
|
| 5753 |
}
|
| 5754 |
|
| 5755 |
/**
|
| 5764 |
return $value;
|
| 5765 |
}
|
| 5766 |
|
| 5767 |
+
return $this->getRequestParameter(self::getClickData1ParamName());
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5768 |
}
|
| 5769 |
|
| 5770 |
/**
|
| 5779 |
return $value;
|
| 5780 |
}
|
| 5781 |
|
| 5782 |
+
return $this->getRequestParameter(self::getClickData2ParamName());
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5783 |
}
|
| 5784 |
|
| 5785 |
+
public static function getClickData1ParamName() {
|
| 5786 |
return Gpf_Settings::get(Pap_Settings::PARAM_NAME_EXTRA_DATA.'1');
|
| 5787 |
}
|
| 5788 |
|
| 5789 |
+
public static function getClickData2ParamName() {
|
| 5790 |
return Gpf_Settings::get(Pap_Settings::PARAM_NAME_EXTRA_DATA.'2');
|
| 5791 |
}
|
| 5792 |
|
| 5793 |
public function getRefererUrl() {
|
| 5794 |
+
$referrerurlParam = $this->getRequestParameter(self::PARAM_REFERRERURL_NAME);
|
| 5795 |
+
if ($referrerurlParam != '') {
|
| 5796 |
+
return self::decodeRefererUrl($referrerurlParam);
|
| 5797 |
}
|
| 5798 |
if (isset($_SERVER['HTTP_REFERER'])) {
|
| 5799 |
return self::decodeRefererUrl($_SERVER['HTTP_REFERER']);
|
| 5829 |
}
|
| 5830 |
|
| 5831 |
public function getLinkStyle() {
|
| 5832 |
+
$paramLinkStyle = $this->getRequestParameter(self::PARAM_LINK_STYLE);
|
| 5833 |
+
if ($paramLinkStyle !== '1') {
|
| 5834 |
return Pap_Tracking_ClickTracker::LINKMETHOD_REDIRECT;
|
| 5835 |
}
|
| 5836 |
return Pap_Tracking_ClickTracker::LINKMETHOD_URLPARAMETERS;
|
| 5852 |
}
|
| 5853 |
|
| 5854 |
public function getRequestParameter($paramName) {
|
| 5855 |
+
$paramName = strtolower($paramName);
|
| 5856 |
if (!isset($this->request[$paramName])) {
|
| 5857 |
return '';
|
| 5858 |
}
|
| 5860 |
}
|
| 5861 |
|
| 5862 |
public function setRequestParameter($paramName, $value) {
|
| 5863 |
+
$this->request[strtolower($paramName)] = $value;
|
| 5864 |
}
|
| 5865 |
|
| 5866 |
static public function getRotatorBannerParamName() {
|
| 6047 |
throw new Exception("This class can be used only by merchant!");
|
| 6048 |
}
|
| 6049 |
$this->session = $session;
|
| 6050 |
+
$this->visitorId = $this->getVisitorIdFromCookie();
|
| 6051 |
+
}
|
| 6052 |
+
|
| 6053 |
+
private function getVisitorIdFromCookie() {
|
| 6054 |
+
if (!isset($_COOKIE[self::VISITOR_COOKIE_NAME])) {
|
| 6055 |
+
return '';
|
| 6056 |
+
}
|
| 6057 |
+
return $_COOKIE[self::VISITOR_COOKIE_NAME];
|
| 6058 |
}
|
| 6059 |
|
| 6060 |
public function setVisitorId($visitorId) {
|
| 6648 |
}
|
| 6649 |
/*
|
| 6650 |
VERSION
|
| 6651 |
+
63132c59d004fc08ec74ea8e3b0b20a0
|
| 6652 |
*/
|
| 6653 |
?>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Qualityunit_Pap</name>
|
| 4 |
-
<version>1.0
|
| 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,14 @@
|
|
| 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>2016-
|
| 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="
|
| 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.1.0</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>- option to turn off click tracking added
|
| 13 |
+
- option to turn off status changes added
|
| 14 |
+
- option to create an affiliate automatically
|
| 15 |
+
- added product ID condition for affiliate creation</notes>
|
| 16 |
<authors><author><name>Quality Unit, LLC</name><user>support</user><email>support@qualityunit.com</email></author></authors>
|
| 17 |
+
<date>2016-11-18</date>
|
| 18 |
+
<time>10:49:04</time>
|
| 19 |
+
<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="18514fdd4c0efba91d7644965679940b"/><dir name="Paypal"><file name="Redirect.php" hash="163f906979f1fa74c49954f76c32cd48"/></dir><file name="Saletracking.php" hash="12ee6aaa99e272ce7e92d1964a8632f6"/></dir><dir name="Helper"><file name="Data.php" hash="7d2adc731fa282df27b81990cc8ae634"/></dir><dir name="Model"><dir name="Checkout"><file name="Observer.php" hash="59a9bff60fd34d2eec459b2aef2c7fc3"/></dir><dir name="Config"><dir name="Source"><file name="CustomVariables.php" hash="efeddbe739ca3a193dda0d5c19b55d15"/><file name="TrackSales.php" hash="1af0c801457e4b31f55fde6ad12e7b67"/></dir></dir><file name="Config.php" hash="40917e2e2e1f69cbc4b3773337820ca0"/><file name="Observer.php" hash="13fbbfb3f4c4e863cb9e2b296385761a"/><file name="Pap.php" hash="6b21599b6159614f53724d4a9eb36a08"/><file name="Paypal.php" hash="253bcb6a212495cfa838ee05cc606f3e"/><file name="PaypalIpn.php" hash="268b92124ac73a3fb35572e3002a6e81"/><file name="Validateapi.php" hash="2a90e74dc6a137a8960df465f17711ca"/></dir><dir name="etc"><file name="config.xml" hash="6a48a9f61639b1d1a5a1a2b6dd54dfce"/><file name="system.xml" hash="ddd4f6e142671e356c8d7056fd6b01e1"/></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="f56fd417224620989cc3084536b6fd44"/></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>
|
| 20 |
<compatible/>
|
| 21 |
<dependencies><required><php><min>5.2.0</min><max>7.5.0</max></php></required></dependencies>
|
| 22 |
</package>
|
