Qualityunit_Pap - Version 1.0.2

Version Notes

- currency issue fixed
- status of partial refunds fixed
- stable version

Download this release

Release Info

Developer Quality Unit, LLC
Extension Qualityunit_Pap
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/local/Qualityunit/Pap/Block/Saletracking.php CHANGED
@@ -53,6 +53,7 @@ class Qualityunit_Pap_Block_SaleTracking extends Mage_Core_Block_Text {
53
  sale$i.setTotalCost('".$item['totalcost']."');
54
  sale$i.setOrderID('".$item['orderid']."($i)');
55
  sale$i.setProductID('".$item['productid']."');
 
56
  sale$i.setCurrency('".(Mage::app()->getStore()->getBaseCurrencyCode())."');\n";
57
 
58
  if (!empty($item['data1'])) $sale_tracker .= "sale$i.setData1('".$item['data1']."');\n";
53
  sale$i.setTotalCost('".$item['totalcost']."');
54
  sale$i.setOrderID('".$item['orderid']."($i)');
55
  sale$i.setProductID('".$item['productid']."');
56
+ sale$i.setStatus('".$item['status']."');
57
  sale$i.setCurrency('".(Mage::app()->getStore()->getBaseCurrencyCode())."');\n";
58
 
59
  if (!empty($item['data1'])) $sale_tracker .= "sale$i.setData1('".$item['data1']."');\n";
app/code/local/Qualityunit/Pap/Model/Observer.php CHANGED
@@ -12,31 +12,41 @@ class Qualityunit_Pap_Model_Observer {
12
  if (!$config->isConfigured()) return false;
13
 
14
  try {
15
- if ($order->getStatus() == 'holded') {
 
16
  Mage::getModel('pap/pap')->setOrderStatus($order, $this->pending);
 
17
  }
18
 
19
  if ($order->getStatus() == 'canceled') {
20
  Mage::getModel('pap/pap')->setOrderStatus($order, $this->declined);
 
21
  }
22
 
23
  // refund
24
- if (($order->getBaseTotalPaid() > 0) && ($order->getBaseTotalPaid() <= ($order->getBaseTotalRefunded() + $order->getBaseTotalCanceled()))) {
25
  Mage::getModel('pap/pap')->setOrderStatus($order, $this->declined);
 
26
  }
27
 
28
- // partial refund
29
- if (($order->getBaseTotalPaid() > 0) && ($order->getBaseTotalRefunded() > 0 || $order->getBaseTotalCanceled() > 0)) {
30
- Mage::getModel('pap/pap')->setOrderStatus($order, $this->pending);
31
- }
32
-
33
- if($order->getStatus() == 'complete') {
34
  if ($order->getBaseTotalPaid() > 0) { // was paid
35
- Mage::getModel('pap/pap')->setOrderStatus($order, $this->approved);
 
 
 
36
  }
37
  else { // completed but not paid
38
  Mage::getModel('pap/pap')->setOrderStatus($order, $this->pending);
39
  }
 
 
 
 
 
 
 
40
  }
41
  }
42
  catch (Exception $e) {
@@ -46,6 +56,20 @@ class Qualityunit_Pap_Model_Observer {
46
  return $this;
47
  }
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  public function thankYouPageViewed($observer) {
50
  $quoteId = Mage::getSingleton('checkout/session')->getLastQuoteId();
51
  $block = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('pap_saletracking');
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) {
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');
app/code/local/Qualityunit/Pap/Model/Pap.php CHANGED
@@ -5,12 +5,6 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
5
  public $pending = 'P';
6
  public $approved = 'A';
7
 
8
- /*protected function _init($resourceModel) {
9
- Mage::getSingleton('pap/config')->includePapAPI();
10
-
11
- $this->_setResourceModel($resourceModel);
12
- }*/
13
-
14
  public function getSession() {
15
  if (($this->papSession != '') && ($this->papSession != null)) {
16
  return $this->papSession;
@@ -32,7 +26,7 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
32
  return $this->papSession;
33
  }
34
 
35
- public function setOrderStatus($order, $status) {
36
  Mage::log('Postaffiliatepro: Changing status of order '.$order->getIncrementId()." to '$status'");
37
  $session = $this->getSession();
38
 
@@ -42,46 +36,99 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
42
  }
43
 
44
  $request = new Pap_Api_TransactionsGrid($session);
45
-
46
  $request->addFilter('orderid', Gpf_Data_Filter::LIKE, $order->getIncrementId().'(%');
47
- $request->sendNow();
48
-
49
- $grid = $request->getGrid();
50
- $recordset = $grid->getRecordset();
51
- $total = $recordset->getSize();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  $transaction = new Pap_Api_Transaction($session);
54
- if ($total == 0) {
55
- $loop = count($order->getAllVisibleItems());
56
-
57
- if ($status == $this->approved) {
58
- $transaction->setOrderID($order->getIncrementId());
59
- $transaction->approveByOrderId('');
60
- for ($i = 0; $i < $loop; $i++) {
61
- $transaction->setOrderID($order->getIncrementId()."($i)");
 
 
 
 
62
  $transaction->approveByOrderId('');
63
  }
64
- }
65
- if ($status == $this->declined) {
66
- $transaction->setOrderID($order->getIncrementId());
67
- $transaction->declineByOrderId('');
68
- for ($i = 0; $i < $loop; $i++) {
69
- $transaction->setOrderID($order->getIncrementId()."($i)");
70
  $transaction->declineByOrderId('');
71
  }
72
  }
73
  return;
74
  }
75
 
76
- foreach($recordset as $record) {
77
- if ($status == $record->get('rstatus')) continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
- $transaction->setTransid($record->get('transid'));
80
- $transaction->load();
81
- $transaction->setDateapproved(($order['dateapproved']) ? $order['dateapproved'] : now());
82
- $transaction->setStatus($status);
83
- $transaction->save();
 
84
  }
 
85
  }
86
 
87
  public function getOrderSaleDetails($order) {
@@ -91,9 +138,11 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
91
  $couponcode = $quote->getCouponCode();
92
 
93
  $sales = array();
 
94
 
95
  if ($config->getPerProduct()) { // per product tracking
96
  $items = $order->getAllVisibleItems();
 
97
  foreach($items as $i=>$item) {
98
  $productid = $item->getProductId();
99
  $product = Mage::getModel('catalog/product')->load($productid);
@@ -106,6 +155,7 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
106
  $sales[$i]['orderid'] = $order->getIncrementId();
107
  $sales[$i]['productid'] = $product->getSku();
108
  $sales[$i]['couponcode'] = $couponcode;
 
109
 
110
  for ($n = 1; $n < 6; $n++) {
111
  if ($config->getData($n)) {
@@ -117,13 +167,14 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
117
  else { // per order tracking
118
  $sales[0] = array();
119
 
120
- $subtotal = $order->getSubtotal();
121
  $discount = abs($order->getBaseDiscountAmount());
122
 
123
  $sales[0]['totalcost'] = $subtotal - $discount;
124
  $sales[0]['orderid'] = $order->getIncrementId();
125
  $sales[0]['productid'] = null;
126
  $sales[0]['couponcode'] = $couponcode;
 
127
 
128
  for ($n = 1; $n < 6; $n++) {
129
  if ($config->getData($n)) {
@@ -178,6 +229,7 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
178
  $sale->setTotalCost($item['totalcost']);
179
  $sale->setOrderID($item['orderid']."($i)");
180
  $sale->setProductID($item['productid']);
 
181
  if ($item['couponcode']) $sale->setCouponCode($item['couponcode']);
182
  if ($item['data1']) $sale->setData1($item['data1']);
183
  if ($item['data2']) $sale->setData2($item['data2']);
5
  public $pending = 'P';
6
  public $approved = 'A';
7
 
 
 
 
 
 
 
8
  public function getSession() {
9
  if (($this->papSession != '') && ($this->papSession != null)) {
10
  return $this->papSession;
26
  return $this->papSession;
27
  }
28
 
29
+ public function setOrderStatus($order, $status, $refunded = array()) {
30
  Mage::log('Postaffiliatepro: Changing status of order '.$order->getIncrementId()." to '$status'");
31
  $session = $this->getSession();
32
 
36
  }
37
 
38
  $request = new Pap_Api_TransactionsGrid($session);
 
39
  $request->addFilter('orderid', Gpf_Data_Filter::LIKE, $order->getIncrementId().'(%');
40
+ $request->setLimit(0, 900);
41
+ try {
42
+ $request->sendNow();
43
+ $grid = $request->getGrid();
44
+ $recordset = $grid->getRecordset();
45
+
46
+ $ids = array();
47
+ $refundIDs = array();
48
+ $approveIDs = array();
49
+ foreach($recordset as $record) {
50
+ if (count($refunded)) {
51
+ if ($status == 'A') {
52
+ if (in_array($record->get('productid'), $refunded)) {
53
+ $refundIDs[] = $record->get('id');
54
+ }
55
+ else {
56
+ $approveIDs[] = $record->get('id');
57
+ }
58
+ continue;
59
+ }
60
+ elseif ($status == 'D') {
61
+ if (in_array($record->get('productid'), $refunded)) {
62
+ $refundIDs[] = $record->get('id');
63
+ }
64
+ continue;
65
+ }
66
+ }
67
+ $ids[] = $record->get('id');
68
+ }
69
+ }
70
+ catch (Exception $e) {
71
+ Mage::log('An API error while searching for the order with postfix: '.$e->getMessage());
72
+ return false;
73
+ }
74
 
75
  $transaction = new Pap_Api_Transaction($session);
76
+ if (count($refundIDs) == 0 && count($approveIDs) == 0 && count($ids) == 0) {
77
+ $items = $order->getAllVisibleItems();
78
+ foreach ($items as $i => $item) {
79
+ $productid = $item->getProductId();
80
+ $product = Mage::getModel('catalog/product')->load($productid);
81
+
82
+ $transaction->setOrderID($order->getIncrementId()."($i)");
83
+ if ($status == $this->approved) {
84
+ if (count($refunded) && in_array($product->getSku(), $refunded)) { // if we are refunding only specific order items
85
+ $transaction->declineByOrderId('');
86
+ continue;
87
+ }
88
  $transaction->approveByOrderId('');
89
  }
90
+ if ($status == $this->declined) {
91
+ if (count($refunded) && !in_array($product->getSku(), $refunded)) { // if we are refunding only specific order items
92
+ continue;
93
+ }
 
 
94
  $transaction->declineByOrderId('');
95
  }
96
  }
97
  return;
98
  }
99
 
100
+ try {
101
+ Mage::log('We will be changing status of IDs: '.print_r($ids,true));
102
+ $request = new Gpf_Rpc_FormRequest('Pap_Merchants_Transaction_TransactionsForm', 'changeStatus', $session);
103
+ if (!empty($refundIDs)) {
104
+ $request->addParam('ids',new Gpf_Rpc_Array($refundIDs));
105
+ $request->addParam('status','D');
106
+ $request->sendNow();
107
+ }
108
+ if (!empty($approveIDs)) {
109
+ $request->addParam('ids',new Gpf_Rpc_Array($approveIDs));
110
+ $request->addParam('status','A');
111
+ $request->sendNow();
112
+ }
113
+ $request->addParam('ids',new Gpf_Rpc_Array($ids));
114
+ $request->addParam('status',$status);
115
+ $request->sendNow();
116
+ return true;
117
+ }
118
+ catch (Exception $e) {
119
+ Mage::log('API error while status changing: '.$e->getMessage());
120
+ return false;
121
+ }
122
+ }
123
 
124
+ private function getStatus($state) {
125
+ if ($state === Mage_Sales_Model_Order::STATE_PENDING_PAYMENT || $state === Mage_Sales_Model_Order::STATE_NEW || $state === Mage_Sales_Model_Order::STATE_PROCESSING) {
126
+ return $this->pending;
127
+ }
128
+ if ($state === Mage_Sales_Model_Order::STATE_COMPLETE) {
129
+ return $this->approved;
130
  }
131
+ return $this->declined;
132
  }
133
 
134
  public function getOrderSaleDetails($order) {
138
  $couponcode = $quote->getCouponCode();
139
 
140
  $sales = array();
141
+ $status = $this->getStatus($order->getState());
142
 
143
  if ($config->getPerProduct()) { // per product tracking
144
  $items = $order->getAllVisibleItems();
145
+
146
  foreach($items as $i=>$item) {
147
  $productid = $item->getProductId();
148
  $product = Mage::getModel('catalog/product')->load($productid);
155
  $sales[$i]['orderid'] = $order->getIncrementId();
156
  $sales[$i]['productid'] = $product->getSku();
157
  $sales[$i]['couponcode'] = $couponcode;
158
+ $sales[$i]['status'] = $status;
159
 
160
  for ($n = 1; $n < 6; $n++) {
161
  if ($config->getData($n)) {
167
  else { // per order tracking
168
  $sales[0] = array();
169
 
170
+ $subtotal = $order->getBaseSubtotal();
171
  $discount = abs($order->getBaseDiscountAmount());
172
 
173
  $sales[0]['totalcost'] = $subtotal - $discount;
174
  $sales[0]['orderid'] = $order->getIncrementId();
175
  $sales[0]['productid'] = null;
176
  $sales[0]['couponcode'] = $couponcode;
177
+ $sales[0]['status'] = $status;
178
 
179
  for ($n = 1; $n < 6; $n++) {
180
  if ($config->getData($n)) {
229
  $sale->setTotalCost($item['totalcost']);
230
  $sale->setOrderID($item['orderid']."($i)");
231
  $sale->setProductID($item['productid']);
232
+ $sale->setStatus($item['status']);
233
  if ($item['couponcode']) $sale->setCouponCode($item['couponcode']);
234
  if ($item['data1']) $sale->setData1($item['data1']);
235
  if ($item['data2']) $sale->setData2($item['data2']);
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: 2015-04-23 06:21:54
13
- * PAP version: 5.3.26.6, GPF version: 1.3.12.0
14
  *
15
  */
16
 
@@ -2210,6 +2210,11 @@ if (!class_exists('Gpf_Rpc_Form', false)) {
2210
  return $record->get(self::FIELD_VALUE);
2211
  }
2212
 
 
 
 
 
 
2213
  public function getFieldError($name) {
2214
  $record = $this->fields->getRecord($name);
2215
  return $record->get(self::FIELD_ERROR);
@@ -3547,7 +3552,7 @@ if (!class_exists('Gpf_Api_Session', false)) {
3547
  * @return boolean true if user was successfully logged
3548
  */
3549
  private function authenticateRequest($username, $password, $authtoken, $roleType = self::MERCHANT, $languageCode = null) {
3550
- $request = new Gpf_Rpc_FormRequest(self::AUTHENTICATE_CLASS_NAME, self::AUTHENTICATE_METHOD_NAME, $this);
3551
  $request->setUrl($this->url);
3552
  if ($username != '' && $password != '') {
3553
  $request->setField('username', $username);
@@ -3592,7 +3597,7 @@ if (!class_exists('Gpf_Api_Session', false)) {
3592
  * @return string version of installed application
3593
  */
3594
  public function getAppVersion() {
3595
- $request = new Gpf_Rpc_FormRequest(self::AUTHENTICATE_CLASS_NAME, "getAppVersion");
3596
  $request->setUrl($this->url);
3597
 
3598
  try {
@@ -3647,6 +3652,10 @@ if (!class_exists('Gpf_Api_Session', false)) {
3647
  return $url . '&S=' . $this->getSessionId();
3648
  }
3649
 
 
 
 
 
3650
  /**
3651
  * Check API version
3652
  * (has to be protected because of Drupal integration)
@@ -3710,6 +3719,11 @@ if (!class_exists('Gpf_Rpc_Json', false)) {
3710
  * Behavior switch for Services_JSON::decode()
3711
  */
3712
  const SERVICES_JSON_SUPPRESS_ERRORS = 32;
 
 
 
 
 
3713
 
3714
  /**
3715
  * constructs a new JSON instance
@@ -3731,6 +3745,8 @@ if (!class_exists('Gpf_Rpc_Json', false)) {
3731
  {
3732
  $this->use = $use;
3733
  }
 
 
3734
 
3735
  /**
3736
  * convert a string from one UTF-16 char to one UTF-8 char
@@ -4387,6 +4403,21 @@ if (!class_exists('Gpf_Rpc_Json', false)) {
4387
  }
4388
  return false;
4389
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4390
  }
4391
 
4392
  class Gpf_Rpc_Json_Error {
@@ -4453,6 +4484,10 @@ if (!class_exists('Pap_Api_Object', false)) {
4453
  const FIELD_VALUE = "value";
4454
  const FIELD_ERROR = "error";
4455
  const FIELD_VALUES = "values";
 
 
 
 
4456
 
4457
  /**
4458
  * @var Gpf_Data_IndexedRecordSet
@@ -4467,14 +4502,16 @@ if (!class_exists('Pap_Api_Object', false)) {
4467
  $header->add(self::FIELD_NAME);
4468
  $header->add(self::FIELD_VALUE);
4469
  $header->add(self::FIELD_VALUES);
 
4470
  $header->add(self::FIELD_ERROR);
4471
 
4472
  $this->fields->setHeader($header);
4473
  }
4474
 
4475
- public function setField($name, $value) {
4476
  $record = $this->fields->createRecord($name);
4477
  $record->set(self::FIELD_VALUE, $value);
 
4478
 
4479
  $this->fields->add($record);
4480
  }
@@ -4484,7 +4521,7 @@ if (!class_exists('Pap_Api_Object', false)) {
4484
  $record = $this->fields->getRecord($name);
4485
  return $record->get(self::FIELD_VALUE);
4486
  } catch(Exception $e) {
4487
- return '';
4488
  }
4489
  }
4490
 
@@ -4525,7 +4562,7 @@ if (!class_exists('Pap_Api_Object', false)) {
4525
  protected function fillFieldsToGridRequest($request) {
4526
  foreach($this->fields as $field) {
4527
  if($field->get(self::FIELD_VALUE) != '') {
4528
- $request->addFilter($field->get(self::FIELD_NAME), "L", $field->get(self::FIELD_VALUE));
4529
  }
4530
  }
4531
  }
@@ -4587,7 +4624,7 @@ if (!class_exists('Pap_Api_Object', false)) {
4587
  $request = new Gpf_Rpc_FormRequest($this->class, $method, $this->session);
4588
  $this->beforeCallRequest($request);
4589
  foreach($this->getFields() as $field) {
4590
- if($field->get(self::FIELD_VALUE) != null) {
4591
  $request->setField($field->get(self::FIELD_NAME), $field->get(self::FIELD_VALUE));
4592
  }
4593
  }
@@ -4654,6 +4691,9 @@ if (!class_exists('Pap_Api_Object', false)) {
4654
 
4655
  return $this->callRequest("add");
4656
  }
 
 
 
4657
 
4658
  protected function beforeCallRequest(Gpf_Rpc_FormRequest $request) {
4659
  }
@@ -4694,11 +4734,7 @@ if (!class_exists('Pap_Api_BannersGrid', false)) {
4694
  if (!class_exists('Pap_Api_Affiliate', false)) {
4695
  class Pap_Api_Affiliate extends Pap_Api_Object {
4696
 
4697
- const OPERATOR_EQUALS = '=';
4698
- const OPERATOR_LIKE = 'L';
4699
-
4700
  private $dataValues = null;
4701
- private $equalsFields = array();
4702
 
4703
  public function __construct(Gpf_Api_Session $session) {
4704
  if($session->getRoleType() == Gpf_Api_Session::AFFILIATE) {
@@ -4709,20 +4745,9 @@ if (!class_exists('Pap_Api_Affiliate', false)) {
4709
 
4710
  parent::__construct($session);
4711
 
4712
- $this->addEqualField('username');
4713
-
4714
  $this->getDataFields();
4715
  }
4716
 
4717
- private function addEqualField($name) {
4718
- $this->equalsFields[] = $name;
4719
- $testObj= new StdClass();
4720
- }
4721
-
4722
- private function getEqualFields() {
4723
- return $this->equalsFields;
4724
- }
4725
-
4726
  public function getUserid() { return $this->getField("userid"); }
4727
  public function setUserid($value) {
4728
  $this->setField("userid", $value);
@@ -4731,11 +4756,8 @@ if (!class_exists('Pap_Api_Affiliate', false)) {
4731
 
4732
  public function getRefid() { return $this->getField("refid"); }
4733
 
4734
- public function setRefid($value, $operator = self::OPERATOR_LIKE) {
4735
- $this->setField('refid', $value);
4736
- if ($operator == self::OPERATOR_EQUALS) {
4737
- $this->addEqualField('refid');
4738
- }
4739
  }
4740
 
4741
  public function getStatus() { return $this->getField("rstatus"); }
@@ -4753,13 +4775,12 @@ if (!class_exists('Pap_Api_Affiliate', false)) {
4753
  public function getPhoto() { return $this->getField("photo"); }
4754
  public function setPhoto($value) { $this->setField("photo", $value); }
4755
 
 
 
4756
  public function getUsername() { return $this->getField("username"); }
4757
 
4758
- public function setUsername($value, $operator = self::OPERATOR_LIKE) {
4759
- $this->setField('username', $value);
4760
- if ($operator == self::OPERATOR_EQUALS) {
4761
- $this->addEqualField('username');
4762
- }
4763
  }
4764
 
4765
  public function getPassword() { return $this->getField("rpassword"); }
@@ -4767,20 +4788,14 @@ if (!class_exists('Pap_Api_Affiliate', false)) {
4767
 
4768
  public function getFirstname() { return $this->getField("firstname"); }
4769
 
4770
- public function setFirstname($value, $operator = self::OPERATOR_LIKE) {
4771
- $this->setField('firstname', $value);
4772
- if ($operator == self::OPERATOR_EQUALS) {
4773
- $this->addEqualField('firstname');
4774
- }
4775
  }
4776
 
4777
  public function getLastname() { return $this->getField("lastname"); }
4778
 
4779
- public function setLastname($value, $operator = self::OPERATOR_LIKE) {
4780
- $this->setField('lastname', $value);
4781
- if ($operator == self::OPERATOR_EQUALS) {
4782
- $this->addEqualField('lastname');
4783
- }
4784
  }
4785
 
4786
  public function getParentUserId() { return $this->getField("parentuserid"); }
@@ -4792,18 +4807,19 @@ if (!class_exists('Pap_Api_Affiliate', false)) {
4792
  public function getNotificationEmail() { return $this->getField("notificationemail"); }
4793
  public function setNotificationEmail($value) { $this->setField("notificationemail", $value); }
4794
 
4795
- public function enableCreateSignupReferralCommissions() { $this->setField("createSignupReferralComm", Gpf::YES); }
 
 
 
 
4796
 
4797
  public function getData($index) {
4798
  $this->checkIndex($index);
4799
  return $this->getField("data$index");
4800
  }
4801
- public function setData($index, $value, $operator = self::OPERATOR_LIKE) {
4802
  $this->checkIndex($index);
4803
- $this->setField("data$index", $value);
4804
- if ($operator == self::OPERATOR_EQUALS) {
4805
- $this->addEqualField('data' . $index);
4806
- }
4807
  }
4808
 
4809
  public function setPayoutOptionField($code, $value) {
@@ -4871,18 +4887,6 @@ if (!class_exists('Pap_Api_Affiliate', false)) {
4871
  return new Pap_Api_AffiliatesGrid($this->getSession());
4872
  }
4873
 
4874
- protected function fillFieldsToGridRequest($request) {
4875
- foreach(parent::getFields() as $field) {
4876
- if($field->get(self::FIELD_VALUE) != '') {
4877
- $operator = self::OPERATOR_LIKE;
4878
- if (in_array($field->get(self::FIELD_NAME), $this->getEqualFields())) {
4879
- $operator = self::OPERATOR_EQUALS;
4880
- }
4881
- $request->addFilter($field->get(self::FIELD_NAME), $operator, $field->get(self::FIELD_VALUE));
4882
- }
4883
- }
4884
- }
4885
-
4886
  /**
4887
  * retrieves names and states of data1..data25 fields
4888
  *
@@ -4971,6 +4975,8 @@ if (!class_exists('Pap_Api_TransactionsGrid', false)) {
4971
 
4972
  if (!class_exists('Pap_Api_Transaction', false)) {
4973
  class Pap_Api_Transaction extends Pap_Api_Object {
 
 
4974
 
4975
  private $dataValues = null;
4976
 
@@ -5015,34 +5021,50 @@ if (!class_exists('Pap_Api_Transaction', false)) {
5015
  public function setCountryCode($value) { $this->setField("countrycode", $value); }
5016
 
5017
  public function getDateInserted() { return $this->getField("dateinserted"); }
5018
- public function setDateInserted($value) { $this->setField("dateinserted", $value); }
 
 
5019
 
5020
  public function getDateApproved() { return $this->getField("dateapproved"); }
5021
- public function setDateApproved($value) { $this->setField("dateapproved", $value); }
 
 
5022
 
5023
  public function getPayoutStatus() { return $this->getField("payoutstatus"); }
5024
  public function setPayoutStatus($value) { $this->setField("payoutstatus", $value); }
5025
 
5026
  public function getPayoutHistoryId() { return $this->getField("payouthistoryid"); }
5027
- public function setPayoutHistoryId($value) { $this->setField("payouthistoryid", $value); }
 
 
5028
 
5029
  public function getRefererUrl() { return $this->getField("refererurl"); }
5030
- public function setRefererUrl($value) { $this->setField("refererurl", $value); }
 
 
5031
 
5032
  public function getIp() { return $this->getField("ip"); }
5033
- public function setIp($value) { $this->setField("ip", $value); }
 
 
5034
 
5035
  public function getBrowser() { return $this->getField("browser"); }
5036
- public function setBrowser($value) { $this->setField("browser", $value); }
 
 
5037
 
5038
  public function getCommission() { return $this->getField("commission"); }
5039
  public function setCommission($value) { $this->setField("commission", $value); }
5040
 
5041
  public function getOrderId() { return $this->getField("orderid"); }
5042
- public function setOrderId($value) { $this->setField("orderid", $value); }
 
 
5043
 
5044
  public function getProductId() { return $this->getField("productid"); }
5045
- public function setProductId($value) { $this->setField("productid", $value); }
 
 
5046
 
5047
  public function getTotalCost() { return $this->getField("totalcost"); }
5048
  public function setTotalCost($value) { $this->setField("totalcost", $value); }
@@ -5051,37 +5073,57 @@ if (!class_exists('Pap_Api_Transaction', false)) {
5051
  public function setRecurringCommid($value) { $this->setField("recurringcommid", $value); }
5052
 
5053
  public function getFirstClickTime() { return $this->getField("firstclicktime"); }
5054
- public function setFirstClickTime($value) { $this->setField("firstclicktime", $value); }
 
 
5055
 
5056
  public function getFirstClickReferer() { return $this->getField("firstclickreferer"); }
5057
- public function setFirstClickReferer($value) { $this->setField("firstclickreferer", $value); }
 
 
5058
 
5059
  public function getFirstClickIp() { return $this->getField("firstclickip"); }
5060
- public function setFirstClickIp($value) { $this->setField("firstclickip", $value); }
 
 
5061
 
5062
  public function getFirstClickData1() { return $this->getField("firstclickdata1"); }
5063
- public function setFirstClickData1($value) { $this->setField("firstclickdata1", $value); }
 
 
5064
 
5065
  public function getFirstClickData2() { return $this->getField("firstclickdata2"); }
5066
- public function setFirstClickData2($value) { $this->setField("firstclickdata2", $value); }
 
 
5067
 
5068
  public function getClickCount() { return $this->getField("clickcount"); }
5069
  public function setClickCount($value) { $this->setField("clickcount", $value); }
5070
 
5071
  public function getLastClickTime() { return $this->getField("lastclicktime"); }
5072
- public function setLastClickTime($value) { $this->setField("lastclicktime", $value); }
 
 
5073
 
5074
  public function getLastClickReferer() { return $this->getField("lastclickreferer"); }
5075
- public function setLastClickReferer($value) { $this->setField("lastclickreferer", $value); }
 
 
5076
 
5077
  public function getLastClickIp() { return $this->getField("lastclickip"); }
5078
- public function setLastClickIp($value) { $this->setField("lastclickip", $value); }
 
 
5079
 
5080
  public function getLastClickData1() { return $this->getField("lastclickdata1"); }
5081
- public function setLastClickData1($value) { $this->setField("lastclickdata1", $value); }
 
 
5082
 
5083
  public function getLastClickData2() { return $this->getField("lastclickdata2"); }
5084
- public function setLastClickData2($value) { $this->setField("lastclickdata2", $value); }
 
 
5085
 
5086
  public function getTrackMethod() { return $this->getField("trackmethod"); }
5087
  public function setTrackMethod($value) { $this->setField("trackmethod", $value); }
@@ -5105,10 +5147,14 @@ if (!class_exists('Pap_Api_Transaction', false)) {
5105
  public function setCommTypeId($value) { $this->setField("commtypeid", $value); }
5106
 
5107
  public function getMerchantNote() { return $this->getField("merchantnote"); }
5108
- public function setMerchantNote($value) { $this->setField("merchantnote", $value); }
 
 
5109
 
5110
  public function getSystemNote() { return $this->getField("systemnote"); }
5111
- public function setSystemNote($value) { $this->setField("systemnote", $value); }
 
 
5112
 
5113
  public function getParentTransactionId() { return $this->getField("parenttransid"); }
5114
  public function setParentTransactionId($value) { $this->setField("parenttransid", $value); }
@@ -5117,9 +5163,9 @@ if (!class_exists('Pap_Api_Transaction', false)) {
5117
  $this->checkIndex($index);
5118
  return $this->getField("data$index");
5119
  }
5120
- public function setData($index, $value) {
5121
  $this->checkIndex($index);
5122
- $this->setField("data$index", $value);
5123
  }
5124
 
5125
  /**
@@ -5207,6 +5253,9 @@ if (!class_exists('Pap_Api_Transaction', false)) {
5207
  if($this->getMultiTierCreation() == '') {
5208
  $this->setMultiTierCreation('N');
5209
  }
 
 
 
5210
  }
5211
 
5212
  protected function getPrimaryKey() {
@@ -6188,14 +6237,14 @@ if (!class_exists('Pap_Api_ClickTracker', false)) {
6188
 
6189
  if (!class_exists('Pap_Api_RecurringCommission', false)) {
6190
  class Pap_Api_RecurringCommission extends Pap_Api_Object {
6191
-
6192
  public function __construct(Gpf_Api_Session $session) {
6193
  parent::__construct($session);
6194
  $this->class = 'Pap_Features_RecurringCommissions_RecurringCommissionsForm';
6195
  }
6196
 
6197
- public function setOrderId($value) {
6198
- $this->setField('orderid', $value);
6199
  }
6200
 
6201
  public function setTotalCost($value) {
@@ -6212,8 +6261,8 @@ if (!class_exists('Pap_Api_RecurringCommission', false)) {
6212
 
6213
  protected function getGridRequest() {
6214
  return new Pap_Api_RecurringCommissionsGrid($this->getSession());
6215
- }
6216
-
6217
  public function createCommissions() {
6218
  $request = new Gpf_Rpc_ActionRequest('Pap_Features_RecurringCommissions_RecurringCommissionsForm',
6219
  'createCommissions', $this->getSession());
@@ -6229,6 +6278,19 @@ if (!class_exists('Pap_Api_RecurringCommission', false)) {
6229
  throw new Gpf_Exception($action->getErrorMessage());
6230
  }
6231
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
6232
  }
6233
 
6234
  } //end Pap_Api_RecurringCommission
@@ -6367,6 +6429,19 @@ if (!class_exists('Pap_Api_PayoutsHistoryGrid', false)) {
6367
 
6368
  } //end Pap_Api_PayoutsHistoryGrid
6369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6370
  if (!class_exists('Gpf_Net_Http_Client', false)) {
6371
  class Gpf_Net_Http_Client extends Gpf_Net_Http_ClientBase {
6372
 
@@ -6380,6 +6455,6 @@ if (!class_exists('Gpf_Net_Http_Client', false)) {
6380
  }
6381
  /*
6382
  VERSION
6383
- 33062c712167aba963c8a8af731bdcf0
6384
  */
6385
  ?>
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: 2015-10-29 10:16:38
13
+ * PAP version: 5.4.20.6, GPF version: 1.3.28.0
14
  *
15
  */
16
 
2210
  return $record->get(self::FIELD_VALUE);
2211
  }
2212
 
2213
+ public function getFieldValues($name) {
2214
+ $record = $this->fields->getRecord($name);
2215
+ return $record->get(self::FIELD_VALUES);
2216
+ }
2217
+
2218
  public function getFieldError($name) {
2219
  $record = $this->fields->getRecord($name);
2220
  return $record->get(self::FIELD_ERROR);
3552
  * @return boolean true if user was successfully logged
3553
  */
3554
  private function authenticateRequest($username, $password, $authtoken, $roleType = self::MERCHANT, $languageCode = null) {
3555
+ $request = new Gpf_Rpc_FormRequest($this->getAuthenticateClassName(), self::AUTHENTICATE_METHOD_NAME, $this);
3556
  $request->setUrl($this->url);
3557
  if ($username != '' && $password != '') {
3558
  $request->setField('username', $username);
3597
  * @return string version of installed application
3598
  */
3599
  public function getAppVersion() {
3600
+ $request = new Gpf_Rpc_FormRequest($this->getAuthenticateClassName(), "getAppVersion");
3601
  $request->setUrl($this->url);
3602
 
3603
  try {
3652
  return $url . '&S=' . $this->getSessionId();
3653
  }
3654
 
3655
+ protected function getAuthenticateClassName() {
3656
+ return self::AUTHENTICATE_CLASS_NAME;
3657
+ }
3658
+
3659
  /**
3660
  * Check API version
3661
  * (has to be protected because of Drupal integration)
3719
  * Behavior switch for Services_JSON::decode()
3720
  */
3721
  const SERVICES_JSON_SUPPRESS_ERRORS = 32;
3722
+
3723
+ /**
3724
+ * @var Gpf_Rpc_Json
3725
+ */
3726
+ private static $instance;
3727
 
3728
  /**
3729
  * constructs a new JSON instance
3745
  {
3746
  $this->use = $use;
3747
  }
3748
+
3749
+
3750
 
3751
  /**
3752
  * convert a string from one UTF-16 char to one UTF-8 char
4403
  }
4404
  return false;
4405
  }
4406
+
4407
+ public static function encodeStatic($var) {
4408
+ return self::getInstance()->encode($var);
4409
+ }
4410
+
4411
+ public static function decodeStatic($var) {
4412
+ return self::getInstance()->decode($var);
4413
+ }
4414
+
4415
+ private static function getInstance() {
4416
+ if (self::$instance === null) {
4417
+ self::$instance = new self;
4418
+ }
4419
+ return self::$instance;
4420
+ }
4421
  }
4422
 
4423
  class Gpf_Rpc_Json_Error {
4484
  const FIELD_VALUE = "value";
4485
  const FIELD_ERROR = "error";
4486
  const FIELD_VALUES = "values";
4487
+ const FIELD_OPERATOR = 'operator';
4488
+
4489
+ const OPERATOR_EQUALS = '=';
4490
+ const OPERATOR_LIKE = 'L';
4491
 
4492
  /**
4493
  * @var Gpf_Data_IndexedRecordSet
4502
  $header->add(self::FIELD_NAME);
4503
  $header->add(self::FIELD_VALUE);
4504
  $header->add(self::FIELD_VALUES);
4505
+ $header->add(self::FIELD_OPERATOR);
4506
  $header->add(self::FIELD_ERROR);
4507
 
4508
  $this->fields->setHeader($header);
4509
  }
4510
 
4511
+ public function setField($name, $value, $operator = self::OPERATOR_EQUALS) {
4512
  $record = $this->fields->createRecord($name);
4513
  $record->set(self::FIELD_VALUE, $value);
4514
+ $record->set(self::FIELD_OPERATOR, $operator);
4515
 
4516
  $this->fields->add($record);
4517
  }
4521
  $record = $this->fields->getRecord($name);
4522
  return $record->get(self::FIELD_VALUE);
4523
  } catch(Exception $e) {
4524
+ return null;
4525
  }
4526
  }
4527
 
4562
  protected function fillFieldsToGridRequest($request) {
4563
  foreach($this->fields as $field) {
4564
  if($field->get(self::FIELD_VALUE) != '') {
4565
+ $request->addFilter($field->get(self::FIELD_NAME), $field->get(self::FIELD_OPERATOR), $field->get(self::FIELD_VALUE));
4566
  }
4567
  }
4568
  }
4624
  $request = new Gpf_Rpc_FormRequest($this->class, $method, $this->session);
4625
  $this->beforeCallRequest($request);
4626
  foreach($this->getFields() as $field) {
4627
+ if($field->get(self::FIELD_VALUE) !== null) {
4628
  $request->setField($field->get(self::FIELD_NAME), $field->get(self::FIELD_VALUE));
4629
  }
4630
  }
4691
 
4692
  return $this->callRequest("add");
4693
  }
4694
+
4695
+ protected function fillEmptyRecord() {
4696
+ }
4697
 
4698
  protected function beforeCallRequest(Gpf_Rpc_FormRequest $request) {
4699
  }
4734
  if (!class_exists('Pap_Api_Affiliate', false)) {
4735
  class Pap_Api_Affiliate extends Pap_Api_Object {
4736
 
 
 
 
4737
  private $dataValues = null;
 
4738
 
4739
  public function __construct(Gpf_Api_Session $session) {
4740
  if($session->getRoleType() == Gpf_Api_Session::AFFILIATE) {
4745
 
4746
  parent::__construct($session);
4747
 
 
 
4748
  $this->getDataFields();
4749
  }
4750
 
 
 
 
 
 
 
 
 
 
4751
  public function getUserid() { return $this->getField("userid"); }
4752
  public function setUserid($value) {
4753
  $this->setField("userid", $value);
4756
 
4757
  public function getRefid() { return $this->getField("refid"); }
4758
 
4759
+ public function setRefid($value, $operator = self::OPERATOR_EQUALS) {
4760
+ $this->setField('refid', $value, $operator);
 
 
 
4761
  }
4762
 
4763
  public function getStatus() { return $this->getField("rstatus"); }
4775
  public function getPhoto() { return $this->getField("photo"); }
4776
  public function setPhoto($value) { $this->setField("photo", $value); }
4777
 
4778
+ public function getAuthToken() { return $this->getField('authtoken'); }
4779
+
4780
  public function getUsername() { return $this->getField("username"); }
4781
 
4782
+ public function setUsername($value, $operator = self::OPERATOR_EQUALS) {
4783
+ $this->setField('username', $value, $operator);
 
 
 
4784
  }
4785
 
4786
  public function getPassword() { return $this->getField("rpassword"); }
4788
 
4789
  public function getFirstname() { return $this->getField("firstname"); }
4790
 
4791
+ public function setFirstname($value, $operator = self::OPERATOR_EQUALS) {
4792
+ $this->setField('firstname', $value, $operator);
 
 
 
4793
  }
4794
 
4795
  public function getLastname() { return $this->getField("lastname"); }
4796
 
4797
+ public function setLastname($value, $operator = self::OPERATOR_EQUALS) {
4798
+ $this->setField('lastname', $value, $operator);
 
 
 
4799
  }
4800
 
4801
  public function getParentUserId() { return $this->getField("parentuserid"); }
4807
  public function getNotificationEmail() { return $this->getField("notificationemail"); }
4808
  public function setNotificationEmail($value) { $this->setField("notificationemail", $value); }
4809
 
4810
+ public function getLanguage() { return $this->getField('lang'); }
4811
+ public function setLanguage($value) { $this->setField('lang', $value); }
4812
+
4813
+ public function disableSignupBonus() { $this->setField('createSignupComm', Gpf::NO); }
4814
+ public function disableReferralCommissions() { $this->setField('createReferralComm', Gpf::NO); }
4815
 
4816
  public function getData($index) {
4817
  $this->checkIndex($index);
4818
  return $this->getField("data$index");
4819
  }
4820
+ public function setData($index, $value, $operator = self::OPERATOR_EQUALS) {
4821
  $this->checkIndex($index);
4822
+ $this->setField("data$index", $value, $operator);
 
 
 
4823
  }
4824
 
4825
  public function setPayoutOptionField($code, $value) {
4887
  return new Pap_Api_AffiliatesGrid($this->getSession());
4888
  }
4889
 
 
 
 
 
 
 
 
 
 
 
 
 
4890
  /**
4891
  * retrieves names and states of data1..data25 fields
4892
  *
4975
 
4976
  if (!class_exists('Pap_Api_Transaction', false)) {
4977
  class Pap_Api_Transaction extends Pap_Api_Object {
4978
+
4979
+ const TRACKING_METHOD_MANUAL_COMMISSION = 'M';
4980
 
4981
  private $dataValues = null;
4982
 
5021
  public function setCountryCode($value) { $this->setField("countrycode", $value); }
5022
 
5023
  public function getDateInserted() { return $this->getField("dateinserted"); }
5024
+ public function setDateInserted($value, $operator = self::OPERATOR_EQUALS) {
5025
+ $this->setField("dateinserted", $value, $operator);
5026
+ }
5027
 
5028
  public function getDateApproved() { return $this->getField("dateapproved"); }
5029
+ public function setDateApproved($value, $operator = self::OPERATOR_EQUALS) {
5030
+ $this->setField("dateapproved", $value, $operator);
5031
+ }
5032
 
5033
  public function getPayoutStatus() { return $this->getField("payoutstatus"); }
5034
  public function setPayoutStatus($value) { $this->setField("payoutstatus", $value); }
5035
 
5036
  public function getPayoutHistoryId() { return $this->getField("payouthistoryid"); }
5037
+ public function setPayoutHistoryId($value, $operator = self::OPERATOR_EQUALS) {
5038
+ $this->setField("payouthistoryid", $value, $operator);
5039
+ }
5040
 
5041
  public function getRefererUrl() { return $this->getField("refererurl"); }
5042
+ public function setRefererUrl($value, $operator = self::OPERATOR_EQUALS) {
5043
+ $this->setField("refererurl", $value, $operator);
5044
+ }
5045
 
5046
  public function getIp() { return $this->getField("ip"); }
5047
+ public function setIp($value, $operator = self::OPERATOR_EQUALS) {
5048
+ $this->setField("ip", $value, $operator);
5049
+ }
5050
 
5051
  public function getBrowser() { return $this->getField("browser"); }
5052
+ public function setBrowser($value, $operator = self::OPERATOR_EQUALS) {
5053
+ $this->setField("browser", $value, $operator);
5054
+ }
5055
 
5056
  public function getCommission() { return $this->getField("commission"); }
5057
  public function setCommission($value) { $this->setField("commission", $value); }
5058
 
5059
  public function getOrderId() { return $this->getField("orderid"); }
5060
+ public function setOrderId($value, $operator = self::OPERATOR_EQUALS) {
5061
+ $this->setField("orderid", $value, $operator);
5062
+ }
5063
 
5064
  public function getProductId() { return $this->getField("productid"); }
5065
+ public function setProductId($value, $operator = self::OPERATOR_EQUALS) {
5066
+ $this->setField("productid", $value, $operator);
5067
+ }
5068
 
5069
  public function getTotalCost() { return $this->getField("totalcost"); }
5070
  public function setTotalCost($value) { $this->setField("totalcost", $value); }
5073
  public function setRecurringCommid($value) { $this->setField("recurringcommid", $value); }
5074
 
5075
  public function getFirstClickTime() { return $this->getField("firstclicktime"); }
5076
+ public function setFirstClickTime($value, $operator = self::OPERATOR_EQUALS) {
5077
+ $this->setField("firstclicktime", $value, $operator);
5078
+ }
5079
 
5080
  public function getFirstClickReferer() { return $this->getField("firstclickreferer"); }
5081
+ public function setFirstClickReferer($value, $operator = self::OPERATOR_EQUALS) {
5082
+ $this->setField("firstclickreferer", $value, $operator);
5083
+ }
5084
 
5085
  public function getFirstClickIp() { return $this->getField("firstclickip"); }
5086
+ public function setFirstClickIp($value, $operator = self::OPERATOR_EQUALS) {
5087
+ $this->setField("firstclickip", $value, $operator);
5088
+ }
5089
 
5090
  public function getFirstClickData1() { return $this->getField("firstclickdata1"); }
5091
+ public function setFirstClickData1($value, $operator = self::OPERATOR_EQUALS) {
5092
+ $this->setField("firstclickdata1", $value, $operator);
5093
+ }
5094
 
5095
  public function getFirstClickData2() { return $this->getField("firstclickdata2"); }
5096
+ public function setFirstClickData2($value, $operator = self::OPERATOR_EQUALS) {
5097
+ $this->setField("firstclickdata2", $value, $operator);
5098
+ }
5099
 
5100
  public function getClickCount() { return $this->getField("clickcount"); }
5101
  public function setClickCount($value) { $this->setField("clickcount", $value); }
5102
 
5103
  public function getLastClickTime() { return $this->getField("lastclicktime"); }
5104
+ public function setLastClickTime($value, $operator = self::OPERATOR_EQUALS) {
5105
+ $this->setField("lastclicktime", $value, $operator);
5106
+ }
5107
 
5108
  public function getLastClickReferer() { return $this->getField("lastclickreferer"); }
5109
+ public function setLastClickReferer($value, $operator = self::OPERATOR_EQUALS) {
5110
+ $this->setField("lastclickreferer", $value, $operator);
5111
+ }
5112
 
5113
  public function getLastClickIp() { return $this->getField("lastclickip"); }
5114
+ public function setLastClickIp($value, $operator = self::OPERATOR_EQUALS) {
5115
+ $this->setField("lastclickip", $value, $operator);
5116
+ }
5117
 
5118
  public function getLastClickData1() { return $this->getField("lastclickdata1"); }
5119
+ public function setLastClickData1($value, $operator = self::OPERATOR_EQUALS) {
5120
+ $this->setField("lastclickdata1", $value, $operator);
5121
+ }
5122
 
5123
  public function getLastClickData2() { return $this->getField("lastclickdata2"); }
5124
+ public function setLastClickData2($value, $operator = self::OPERATOR_EQUALS) {
5125
+ $this->setField("lastclickdata2", $value, $operator);
5126
+ }
5127
 
5128
  public function getTrackMethod() { return $this->getField("trackmethod"); }
5129
  public function setTrackMethod($value) { $this->setField("trackmethod", $value); }
5147
  public function setCommTypeId($value) { $this->setField("commtypeid", $value); }
5148
 
5149
  public function getMerchantNote() { return $this->getField("merchantnote"); }
5150
+ public function setMerchantNote($value, $operator = self::OPERATOR_EQUALS) {
5151
+ $this->setField("merchantnote", $value, $operator);
5152
+ }
5153
 
5154
  public function getSystemNote() { return $this->getField("systemnote"); }
5155
+ public function setSystemNote($value, $operator = self::OPERATOR_EQUALS) {
5156
+ $this->setField("systemnote", $value, $operator);
5157
+ }
5158
 
5159
  public function getParentTransactionId() { return $this->getField("parenttransid"); }
5160
  public function setParentTransactionId($value) { $this->setField("parenttransid", $value); }
5163
  $this->checkIndex($index);
5164
  return $this->getField("data$index");
5165
  }
5166
+ public function setData($index, $value, $operator = self::OPERATOR_EQUALS) {
5167
  $this->checkIndex($index);
5168
+ $this->setField("data$index", $value, $operator);
5169
  }
5170
 
5171
  /**
5253
  if($this->getMultiTierCreation() == '') {
5254
  $this->setMultiTierCreation('N');
5255
  }
5256
+ if($this->getTrackMethod() == '') {
5257
+ $this->setTrackMethod(self::TRACKING_METHOD_MANUAL_COMMISSION);
5258
+ }
5259
  }
5260
 
5261
  protected function getPrimaryKey() {
6237
 
6238
  if (!class_exists('Pap_Api_RecurringCommission', false)) {
6239
  class Pap_Api_RecurringCommission extends Pap_Api_Object {
6240
+
6241
  public function __construct(Gpf_Api_Session $session) {
6242
  parent::__construct($session);
6243
  $this->class = 'Pap_Features_RecurringCommissions_RecurringCommissionsForm';
6244
  }
6245
 
6246
+ public function setOrderId($value, $operator = self::OPERATOR_EQUALS) {
6247
+ $this->setField('orderid', $value, $operator);
6248
  }
6249
 
6250
  public function setTotalCost($value) {
6261
 
6262
  protected function getGridRequest() {
6263
  return new Pap_Api_RecurringCommissionsGrid($this->getSession());
6264
+ }
6265
+
6266
  public function createCommissions() {
6267
  $request = new Gpf_Rpc_ActionRequest('Pap_Features_RecurringCommissions_RecurringCommissionsForm',
6268
  'createCommissions', $this->getSession());
6278
  throw new Gpf_Exception($action->getErrorMessage());
6279
  }
6280
  }
6281
+
6282
+ public function createCommissionsReturnIds() {
6283
+ $request = new Gpf_Rpc_DataRequest('Pap_Features_RecurringCommissions_RecurringCommissionsForm',
6284
+ 'createCommissionsReturnIds', $this->getSession());
6285
+ $request->addParam('id', $this->getId());
6286
+ $request->addParam('orderid', $this->getField('orderid'));
6287
+ $request->addParam('totalcost', $this->getField('totalcost'));
6288
+ if ($this->getSession()->getSessionId() == '') {
6289
+ $request->addParam('initSession', Gpf::YES);
6290
+ }
6291
+ $request->sendNow();
6292
+ return $request->getData()->getValue(Gpf_Rpc_Action::IDS);
6293
+ }
6294
  }
6295
 
6296
  } //end Pap_Api_RecurringCommission
6429
 
6430
  } //end Pap_Api_PayoutsHistoryGrid
6431
 
6432
+ if (!class_exists('Pap_Api_Session', false)) {
6433
+ class Pap_Api_Session extends Gpf_Api_Session {
6434
+
6435
+ const AUTHENTICATE_CLASS_NAME = 'Pap_Api_AuthService';
6436
+
6437
+
6438
+ protected function getAuthenticateClassName() {
6439
+ return self::AUTHENTICATE_CLASS_NAME;
6440
+ }
6441
+ }
6442
+
6443
+ } //end Pap_Api_Session
6444
+
6445
  if (!class_exists('Gpf_Net_Http_Client', false)) {
6446
  class Gpf_Net_Http_Client extends Gpf_Net_Http_ClientBase {
6447
 
6455
  }
6456
  /*
6457
  VERSION
6458
+ dd3e251e05f78b1e2ce51e07991dc8f9
6459
  */
6460
  ?>
package.xml CHANGED
@@ -1,19 +1,21 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Qualityunit_Pap</name>
4
- <version>1.0.1</version>
5
- <stability>beta</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
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.&#xD;
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>A minor bug fixed for customer name to work properly in sale tracking extra data fields.</notes>
 
 
13
  <authors><author><name>Quality Unit, LLC</name><user>support</user><email>support@qualityunit.com</email></author></authors>
14
- <date>2015-10-13</date>
15
- <time>05:24:05</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="a1a70e021c623040796d925afbf52324"/></dir></dir></dir></dir><file name="Clicktracking.php" hash="8ee426151206030457e080ef23ce953b"/><dir name="Paypal"><file name="Redirect.php" hash="c6c83477cfe5da045be89eff12b8e54d"/></dir><file name="Saletracking.php" hash="7870a42a1f49efe4cef19780daf6fc6a"/></dir><dir name="Helper"><file name="Data.php" hash="6418f45f1484fd4f676933a8af96cef5"/></dir><dir name="Model"><dir name="Checkout"><file name="Observer.php" hash="eeeb25d90b801c6352568c25e3154942"/></dir><dir name="Config"><dir name="Source"><file name="CustomVariables.php" hash="491d5166055c6a7c9f03a0e3c92bdb7d"/><file name="TrackSales.php" hash="1af0c801457e4b31f55fde6ad12e7b67"/></dir></dir><file name="Config.php" hash="0a6d8bf59b6b89bb23305bdbb0a593c6"/><file name="Ipn.php" hash="410b6493a4f3fd451698d56bc0eced94"/><file name="Observer.php" hash="117c2e4b7c51cf8cf693c3d32476b191"/><file name="Pap.php" hash="7efad14ea41d46b2bb4d844d713c5ee7"/><file name="Paypal.php" hash="39cbba74d089c1460f2404d8128cfb0b"/></dir><dir name="etc"><file name="config.xml" hash="83dfad5b4fcf7863e25f230ed96f3c50"/><file name="system.xml" hash="b62157df3c30e4496c635d203a33abe9"/></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="2c0943ada797ca04b0b32b58de7257a2"/></dir></target><target name="magelib"><dir name="PAP"><file name="PapApi.class.php" hash="e24aa77969afb50c12678f7236887406"/></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>
17
  <compatible/>
18
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Qualityunit_Pap</name>
4
+ <version>1.0.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>
8
  <extends/>
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.&#xD;
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>- currency issue fixed&#xD;
13
+ - status of partial refunds fixed&#xD;
14
+ - stable version</notes>
15
  <authors><author><name>Quality Unit, LLC</name><user>support</user><email>support@qualityunit.com</email></author></authors>
16
+ <date>2015-11-10</date>
17
+ <time>13:04:31</time>
18
+ <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="a1a70e021c623040796d925afbf52324"/></dir></dir></dir></dir><file name="Clicktracking.php" hash="8ee426151206030457e080ef23ce953b"/><dir name="Paypal"><file name="Redirect.php" hash="c6c83477cfe5da045be89eff12b8e54d"/></dir><file name="Saletracking.php" hash="b7e5c50972b856a87c2d24903235e502"/></dir><dir name="Helper"><file name="Data.php" hash="6418f45f1484fd4f676933a8af96cef5"/></dir><dir name="Model"><dir name="Checkout"><file name="Observer.php" hash="eeeb25d90b801c6352568c25e3154942"/></dir><dir name="Config"><dir name="Source"><file name="CustomVariables.php" hash="491d5166055c6a7c9f03a0e3c92bdb7d"/><file name="TrackSales.php" hash="1af0c801457e4b31f55fde6ad12e7b67"/></dir></dir><file name="Config.php" hash="0a6d8bf59b6b89bb23305bdbb0a593c6"/><file name="Ipn.php" hash="410b6493a4f3fd451698d56bc0eced94"/><file name="Observer.php" hash="82e1daf72693410bc4619151d03554e7"/><file name="Pap.php" hash="d895b416806bbf6a64347047d4506a07"/><file name="Paypal.php" hash="39cbba74d089c1460f2404d8128cfb0b"/></dir><dir name="etc"><file name="config.xml" hash="83dfad5b4fcf7863e25f230ed96f3c50"/><file name="system.xml" hash="b62157df3c30e4496c635d203a33abe9"/></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="2c0943ada797ca04b0b32b58de7257a2"/></dir></target><target name="magelib"><dir name="PAP"><file name="PapApi.class.php" hash="ce27fd295878c080532cb029ffa0c482"/></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>
19
  <compatible/>
20
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
21
  </package>