Konduto - Version 1.5.1

Version Notes

- Magento EE compatibilty
- Improved compatibility with third-party payment modules
- Bugfixes

Download this release

Release Info

Developer Konduto
Extension Konduto
Version 1.5.1
Comparing to
See all releases


Code changes from version 1.4.0 to 1.5.1

app/code/community/Konduto/Score/Helper/Order.php CHANGED
@@ -4,21 +4,23 @@ class Konduto_Score_Helper_Order extends Mage_Core_Helper_Abstract {
4
 
5
  public function getOrderData($order, $visitor = NULL) {
6
  if ($visitor == NULL) { $visitor = $this->getVisitorId(); }
7
- $billing = $order->getBillingAddress()->getData();
 
 
 
 
 
 
 
8
  $shipping = $order->getShippingAddress()->getData();
9
- $od = $order->getId();
10
- $odm = Mage::getModel('sales/order')->load($od);
11
-
12
  if ($odm->getCustomerId() == '' || $odm->getCustomerId() == NULL) { $customer_id = $odm->getCustomerEmail(); }
13
  else { $customer_id = $odm->getCustomerId(); }
14
-
15
- $data['id'] = substr($od,0,100);
16
  $data['total_amount'] = (float) $odm->getGrandTotal();
17
  $data['shipping_amount'] = (float) $odm->getShippingAmount();
18
  $data['tax_amount'] = (float) $odm->getTaxAmount();
19
- $data['currency'] = $odm->getOrderCurrencyCode();
20
- $data['visitor'] = $visitor;
21
- $data['ip'] = $odm->getRemoteIp();
22
  $data['customer'] = array(
23
  'id' => substr($customer_id,0,100),
24
  'name' => substr($odm->getCustomerFirstname() . " " . $odm->getCustomerLastname(),0,100),
@@ -28,6 +30,7 @@ class Konduto_Score_Helper_Order extends Mage_Core_Helper_Abstract {
28
  if (!($odm->getCustomerTaxvat() == NULL || $odm->getCustomerTaxvat() == " ")) {
29
  $data['customer']['tax_id'] = substr($odm->getCustomerTaxvat(),0,100);
30
  }
 
31
  $data['billing'] = array(
32
  'name' => substr($billing['firstname'] . " " . $billing['lastname'],0,100),
33
  'address1' => substr($billing['street'],0,100),
@@ -44,14 +47,6 @@ class Konduto_Score_Helper_Order extends Mage_Core_Helper_Abstract {
44
  'zip' => substr($shipping['postcode'],0,100),
45
  'country' => substr($shipping['country_id'],0,100)
46
  );
47
-
48
- $paymet = $this->getPaymentDetails($odm);
49
- if ($paymet['include'] == true) {
50
- unset($paymet['include']);
51
- $data['payment'][] = $paymet;
52
- }
53
- else { return; }
54
-
55
  $items = $order->getAllItems();
56
  foreach ($items as $item) {
57
  if ($item->getQtyToInvoice() > 0) {
@@ -65,37 +60,50 @@ class Konduto_Score_Helper_Order extends Mage_Core_Helper_Abstract {
65
  );
66
  }
67
  }
68
- $data['shopping_cart'] = $shopping_cart;
69
- // removing null and blanks
70
  $data = array_filter($data);
71
  foreach ($data as $key => $value) {
72
- if(is_array($value)){
73
  $data[$key] = array_filter($value);
74
  }
75
  }
76
-
77
- $response = $this->fireRequest($data);
78
  }
79
 
80
- public function fireRequest($data) {
81
- $id = $data['id'];
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  $data = json_encode($data);
83
  $header = array();
84
  $header[] = 'Content-type: application/json; charset=utf-8';
85
- $header[] = 'X-Requested-With: Magento';
86
  $mode = Mage::getStoreConfig('scoreoptions/messages/mode');
87
  if ($mode == 1) {
88
  $private = Mage::getStoreConfig('scoreoptions/messages/productionprikey');
 
89
  } else {
90
  $private = Mage::getStoreConfig('scoreoptions/messages/sandboxprikey');
 
91
  }
92
- $sslVerify = ($mode == 1 ? true : false);
93
- $pwd = $private;
94
  $curl = curl_init();
95
  curl_setopt_array($curl, array(
96
  CURLOPT_RETURNTRANSFER => 1,
97
  CURLOPT_URL => 'https://api.konduto.com/v1/orders',
98
- CURLOPT_USERPWD => $pwd,
99
  CURLOPT_POST => 1,
100
  CURLOPT_POSTFIELDS => $data,
101
  CURLOPT_HTTPHEADER => $header,
@@ -110,54 +118,43 @@ class Konduto_Score_Helper_Order extends Mage_Core_Helper_Abstract {
110
  } catch (Exception $ex) {
111
  $resp = 'curlError = ' . curl_error($curl);
112
  }
113
- $save = $this->saveData($data, $resp, $id);
114
  if (Mage::getStoreConfig("scoreoptions/messages/debug")) {
115
- Mage::log('request==>' . $data, NULL, 'konduto.log');
116
- Mage::log('response==>' . $resp, null, 'konduto.log');
 
 
 
 
 
117
  }
118
- return $resp;
119
  }
120
 
121
- public function getPaymentDetails($model) {
122
- $payment = $model->getPayment();
123
- $instance = $payment->getMethodInstance();
124
- $ccNumber = $instance->getInfoInstance()->getCcNumber();
125
  $cc_six = substr($ccNumber, 0, 6);
126
-
127
- if ((strlen($payment->getCcExpMonth()) == 1) && ($payment->getCcExpYear())) {
128
- $expiration_date = "0" . $payment->getCcExpMonth() . $payment->getCcExpYear();
129
- }
130
- else if ((strlen($payment->getCcExpMonth()) == 2) && ($payment->getCcExpYear())) {
131
- $expiration_date = $payment->getCcExpMonth() . $payment->getCcExpYear();
132
- }
133
- else { $expiration_date = null; }
134
-
135
- $ret = array(
136
- "type" => "credit",
137
- "status" => "pending",
138
- "expiration_date" => $expiration_date
139
- );
140
-
141
  switch ($payment->getMethod()) {
142
  case 'authorizenet':
143
  $ret["include"] = true;
144
  $cards_data = array_values($payment->getAdditionalInformation('authorize_cards'));
145
  $card_data = $cards_data[0];
146
  $ret['last4'] = $card_data['cc_last4'];
147
- $credit_card_company = $card_data['cc_type'];
148
  break;
149
 
150
  case 'paypal_direct':
151
  $ret["include"] = true;
152
  $ret['last4'] = $payment->getCcLast4();
153
- $credit_card_company = $payment->getCcType();
154
  break;
155
 
156
  case 'sagepaydirectpro':
157
  $ret["include"] = true;
158
  $sage = $model->getSagepayInfo();
159
  $ret['last4'] = $sage->getData('last_four_digits');
160
- $credit_card_company = $sage->getData('card_type');
161
  break;
162
 
163
  case 'paypal_express':
@@ -167,16 +164,19 @@ class Konduto_Score_Helper_Order extends Mage_Core_Helper_Abstract {
167
  break;
168
 
169
  default:
170
- $ret["last4"] = $payment->getCcLast4();
171
- if (($ret["last4"]) && (strlen($ret["last4"]) > 0)) { $ret["include"] = true; }
172
- $credit_card_company = $payment->getCcType();
173
  break;
174
  }
175
 
176
- if ((is_string($cc_six)) && (strlen($cc_six)==6)) { $ret["bin"] = $cc_six; }
 
 
 
 
177
  return $ret;
178
  }
179
-
180
  public function getVisitorId() {
181
  $cookie = json_decode($_COOKIE['_kdt'], true);
182
  return $cookie['i'];
@@ -184,12 +184,10 @@ class Konduto_Score_Helper_Order extends Mage_Core_Helper_Abstract {
184
 
185
  public function saveData($data, $resp, $id) {
186
  $model = Mage::getModel('score/score');
187
-
188
  $collection = $model->getCollection()->addFieldToFilter('order_no', $id);
189
  if ($collection->getFirstItem()->getScoreId()) {
190
  $model->setScoreId($collection->getFirstItem()->getScoreId());
191
  }
192
-
193
  if ($resp != NULL) {
194
  $response = json_decode($resp, true);
195
  if (isset($response['order']) && isset($response['order']['score'])) {
@@ -198,16 +196,16 @@ class Konduto_Score_Helper_Order extends Mage_Core_Helper_Abstract {
198
  $score = '';
199
  }
200
  if (isset($response['order']) && isset($response['order']['recommendation'])) {
201
- $reccmond = $response['order']['recommendation'];
202
  } else {
203
- $reccmond = '';
204
  }
205
  $model->setResponse($resp);
206
- $model->setRecommendation($reccmond);
207
  $model->setScore($score);
208
  }
209
  if ($data != NULL) {
210
- $model->setRequest($data);
211
  }
212
  $model->setOrderNo($id);
213
  $model->setVisitorId($this->getVisitorId());
@@ -220,4 +218,4 @@ class Konduto_Score_Helper_Order extends Mage_Core_Helper_Abstract {
220
  }
221
  }
222
 
223
- }
4
 
5
  public function getOrderData($order, $visitor = NULL) {
6
  if ($visitor == NULL) { $visitor = $this->getVisitorId(); }
7
+ $odm = Mage::getModel('sales/quote')->load($order->getQuoteId());
8
+ $order_id = "Try-".$order->getIncrementId()."-".uniqid();
9
+ $currency = $odm->getQuoteCurrencyCode();
10
+ $payment = $this->getPaymentDetails($order);
11
+ if (!$payment['include']) { return; }
12
+ $payment['status'] = "declined";
13
+ unset($payment['include']);
14
+ $billing = $order->getBillingAddress()->getData();
15
  $shipping = $order->getShippingAddress()->getData();
 
 
 
16
  if ($odm->getCustomerId() == '' || $odm->getCustomerId() == NULL) { $customer_id = $odm->getCustomerEmail(); }
17
  else { $customer_id = $odm->getCustomerId(); }
18
+ $data['id'] = substr($order_id,0,100);
 
19
  $data['total_amount'] = (float) $odm->getGrandTotal();
20
  $data['shipping_amount'] = (float) $odm->getShippingAmount();
21
  $data['tax_amount'] = (float) $odm->getTaxAmount();
22
+ $data['currency'] = $currency;
23
+ $data['visitor'] = substr($visitor,0,100);
 
24
  $data['customer'] = array(
25
  'id' => substr($customer_id,0,100),
26
  'name' => substr($odm->getCustomerFirstname() . " " . $odm->getCustomerLastname(),0,100),
30
  if (!($odm->getCustomerTaxvat() == NULL || $odm->getCustomerTaxvat() == " ")) {
31
  $data['customer']['tax_id'] = substr($odm->getCustomerTaxvat(),0,100);
32
  }
33
+ $data['payment'][] = $payment;
34
  $data['billing'] = array(
35
  'name' => substr($billing['firstname'] . " " . $billing['lastname'],0,100),
36
  'address1' => substr($billing['street'],0,100),
47
  'zip' => substr($shipping['postcode'],0,100),
48
  'country' => substr($shipping['country_id'],0,100)
49
  );
 
 
 
 
 
 
 
 
50
  $items = $order->getAllItems();
51
  foreach ($items as $item) {
52
  if ($item->getQtyToInvoice() > 0) {
60
  );
61
  }
62
  }
63
+ if (is_array($shopping_cart)) { $data['shopping_cart'] = $shopping_cart; }
64
+ // removing false, null and blanks
65
  $data = array_filter($data);
66
  foreach ($data as $key => $value) {
67
+ if (is_array($value)){
68
  $data[$key] = array_filter($value);
69
  }
70
  }
71
+ $data['analyze'] = false;
72
+ Mage::getSingleton('core/session')->setScoreData(serialize($data));
73
  }
74
 
75
+ public function setOrderPayment($order) {
76
+ $data = unserialize(Mage::getSingleton('core/session')->getScoreData());
77
+ $data['id'] = $order->getIncrementId();
78
+ $data['payment'][0]['status'] = "pending";
79
+ $data['analyze'] = true;
80
+ $data['oid'] = $order->getId();
81
+ Mage::getSingleton('core/session')->setScoreData(serialize($data));
82
+ }
83
+
84
+ public function fireRequest() {
85
+ $data = unserialize(Mage::getSingleton('core/session')->getScoreData());
86
+ if (isset($data['oid'])) {
87
+ $oid = $data['oid'];
88
+ unset($data['oid']);
89
+ }
90
  $data = json_encode($data);
91
  $header = array();
92
  $header[] = 'Content-type: application/json; charset=utf-8';
93
+ $header[] = 'X-Requested-With: Magento v1.5.2';
94
  $mode = Mage::getStoreConfig('scoreoptions/messages/mode');
95
  if ($mode == 1) {
96
  $private = Mage::getStoreConfig('scoreoptions/messages/productionprikey');
97
+ $sslVerify = true;
98
  } else {
99
  $private = Mage::getStoreConfig('scoreoptions/messages/sandboxprikey');
100
+ $sslVerify = false;
101
  }
 
 
102
  $curl = curl_init();
103
  curl_setopt_array($curl, array(
104
  CURLOPT_RETURNTRANSFER => 1,
105
  CURLOPT_URL => 'https://api.konduto.com/v1/orders',
106
+ CURLOPT_USERPWD => $private,
107
  CURLOPT_POST => 1,
108
  CURLOPT_POSTFIELDS => $data,
109
  CURLOPT_HTTPHEADER => $header,
118
  } catch (Exception $ex) {
119
  $resp = 'curlError = ' . curl_error($curl);
120
  }
 
121
  if (Mage::getStoreConfig("scoreoptions/messages/debug")) {
122
+ Mage::log('request==>' . $data, null, 'konduto.log');
123
+ Mage::log('response=>' . $resp, null, 'konduto.log');
124
+ }
125
+
126
+ if (isset($oid)) {
127
+ $save = $this->saveData($data, $resp, $oid);
128
+ Mage::getSingleton('core/session')->unsScoreAttempt();
129
  }
 
130
  }
131
 
132
+ public function getPaymentDetails($order, $ret=array()) {
133
+ $payment = $order->getPayment();
134
+ $cc = $payment->getCcNumber();
135
+ $ccNumber = is_numeric($cc) ? $cc : Mage::helper('core')->decrypt($cc);
136
  $cc_six = substr($ccNumber, 0, 6);
137
+ $ret["type"] = "credit";
138
+ if (($payment->getCcExpMonth()) && ($payment->getCcExpYear())) {
139
+ $ret["expiration_date"] = sprintf("%02d", $payment->getCcExpMonth()) . $payment->getCcExpYear();
140
+ }
 
 
 
 
 
 
 
 
 
 
 
141
  switch ($payment->getMethod()) {
142
  case 'authorizenet':
143
  $ret["include"] = true;
144
  $cards_data = array_values($payment->getAdditionalInformation('authorize_cards'));
145
  $card_data = $cards_data[0];
146
  $ret['last4'] = $card_data['cc_last4'];
 
147
  break;
148
 
149
  case 'paypal_direct':
150
  $ret["include"] = true;
151
  $ret['last4'] = $payment->getCcLast4();
 
152
  break;
153
 
154
  case 'sagepaydirectpro':
155
  $ret["include"] = true;
156
  $sage = $model->getSagepayInfo();
157
  $ret['last4'] = $sage->getData('last_four_digits');
 
158
  break;
159
 
160
  case 'paypal_express':
164
  break;
165
 
166
  default:
167
+ $ret["last4"] = substr($ccNumber, -4);
168
+ if (($ret["last4"]) && (strlen($ret["last4"]) == 4)) { $ret["include"] = true; }
 
169
  break;
170
  }
171
 
172
+ if ((is_string($cc_six)) && (strlen($cc_six) == 6)) {
173
+ $ret["bin"] = $cc_six;
174
+ $ret["include"] = true;
175
+ }
176
+
177
  return $ret;
178
  }
179
+
180
  public function getVisitorId() {
181
  $cookie = json_decode($_COOKIE['_kdt'], true);
182
  return $cookie['i'];
184
 
185
  public function saveData($data, $resp, $id) {
186
  $model = Mage::getModel('score/score');
 
187
  $collection = $model->getCollection()->addFieldToFilter('order_no', $id);
188
  if ($collection->getFirstItem()->getScoreId()) {
189
  $model->setScoreId($collection->getFirstItem()->getScoreId());
190
  }
 
191
  if ($resp != NULL) {
192
  $response = json_decode($resp, true);
193
  if (isset($response['order']) && isset($response['order']['score'])) {
196
  $score = '';
197
  }
198
  if (isset($response['order']) && isset($response['order']['recommendation'])) {
199
+ $recommendation = $response['order']['recommendation'];
200
  } else {
201
+ $recommendation = '';
202
  }
203
  $model->setResponse($resp);
204
+ $model->setRecommendation($recommendation);
205
  $model->setScore($score);
206
  }
207
  if ($data != NULL) {
208
+ $model->setRequest(json_encode($data));
209
  }
210
  $model->setOrderNo($id);
211
  $model->setVisitorId($this->getVisitorId());
218
  }
219
  }
220
 
221
+ }
app/code/community/Konduto/Score/Model/Observer.php CHANGED
@@ -23,14 +23,32 @@ class Konduto_Score_Model_Observer {
23
  $evt->getEvent()->getLayout()->getUpdate()->addHandle('konduto_'.$tag);
24
  }
25
 
26
- public function getScore(Varien_Event_Observer $evt) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  $helper = Mage::helper('score/order');
28
  $order = $evt->getEvent()->getOrder();
29
- if (Mage::getStoreConfig("scoreoptions/messages/activate") && Mage::getStoreConfig("scoreoptions/messages/reviewaction") == 3) {
 
30
  $response = $helper->getOrderData($order);
31
- } elseif ((Mage::getStoreConfig("scoreoptions/messages/activate") && Mage::getStoreConfig("scoreoptions/messages/reviewaction") == 2)) {
32
- $od = $order->getId();
33
- $helper->saveData(NULL, NULL, $od);
34
  }
35
  return;
36
  }
23
  $evt->getEvent()->getLayout()->getUpdate()->addHandle('konduto_'.$tag);
24
  }
25
 
26
+ public function setScorePayment(Varien_Event_Observer $evt) {
27
+ $helper = Mage::helper('score/order');
28
+ $order = $evt->getEvent()->getOrder();
29
+ if (Mage::getStoreConfig("scoreoptions/messages/activate")) {
30
+ $response = $helper->setOrderPayment($order);
31
+ }
32
+ return;
33
+ }
34
+
35
+ public function sendScoreRequest(Varien_Event_Observer $evt) {
36
+ if (Mage::getSingleton('core/session')->getScorePrepared()) {
37
+ $helper = Mage::helper('score/order');
38
+ if (Mage::getStoreConfig("scoreoptions/messages/activate")) {
39
+ $response = $helper->fireRequest();
40
+ }
41
+ Mage::getSingleton('core/session')->unsScorePrepared();
42
+ return;
43
+ }
44
+ }
45
+
46
+ public function prepareScore(Varien_Event_Observer $evt) {
47
  $helper = Mage::helper('score/order');
48
  $order = $evt->getEvent()->getOrder();
49
+ Mage::getSingleton('core/session')->setScorePrepared(true);
50
+ if (Mage::getStoreConfig("scoreoptions/messages/activate")) {
51
  $response = $helper->getOrderData($order);
 
 
 
52
  }
53
  return;
54
  }
app/code/community/Konduto/Score/controllers/Adminhtml/ScoreController.php CHANGED
@@ -17,7 +17,7 @@ class Konduto_Score_Adminhtml_ScoreController extends Mage_Adminhtml_Controller_
17
  $visitor = $model->getFirstItem()->getVisitorId();
18
  $order = Mage::getModel('sales/order')->load($orderId);
19
  try {
20
- $setScore = Mage::helper('score/order')->getOrderData($order, $visitor);
21
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('score')->__('Konduto score updated'));
22
  } catch (Exception $e) {
23
  Mage::getSingleton('adminhtml/session')->addError(Mage::helper('score')->__('Konduto score cannot be updated'));
17
  $visitor = $model->getFirstItem()->getVisitorId();
18
  $order = Mage::getModel('sales/order')->load($orderId);
19
  try {
20
+ $setScore = Mage::helper('score/order')->getOrderData($order, "approved", $visitor);
21
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('score')->__('Konduto score updated'));
22
  } catch (Exception $e) {
23
  Mage::getSingleton('adminhtml/session')->addError(Mage::helper('score')->__('Konduto score cannot be updated'));
app/code/community/Konduto/Score/etc/config.xml CHANGED
@@ -109,6 +109,7 @@
109
  <adminhtml>
110
  <rewrite>
111
  <sales_order_grid>Konduto_Score_Block_Adminhtml_Order_Grid</sales_order_grid>
 
112
  </rewrite>
113
  </adminhtml>
114
  </blocks>
@@ -127,16 +128,34 @@
127
  </tag_konduto>
128
  </observers>
129
  </controller_action_layout_load_before>
130
- <sales_order_place_before>
131
  <observers>
132
  <get_konduto_score>
133
  <type>singleton</type>
134
  <class>Konduto_Score_Model_Observer</class>
135
- <method>getScore</method>
136
  </get_konduto_score>
137
  </observers>
138
- </sales_order_place_before>
139
- <core_block_abstract_to_html_before>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  <observers>
141
  <konduto_invoice>
142
  <type>singleton</type>
@@ -150,7 +169,7 @@
150
  </konduto_order_page>
151
  </observers>
152
  </core_block_abstract_to_html_before>
153
- <!-- <sales_order_invoice_register>
154
  <observers>
155
  <invoice_save>
156
  <type>singleton</type>
109
  <adminhtml>
110
  <rewrite>
111
  <sales_order_grid>Konduto_Score_Block_Adminhtml_Order_Grid</sales_order_grid>
112
+ <sales_order_view_info>Konduto_Score_Block_Sales_Order_View_Score</sales_order_view_info>
113
  </rewrite>
114
  </adminhtml>
115
  </blocks>
128
  </tag_konduto>
129
  </observers>
130
  </controller_action_layout_load_before>
131
+ <sales_model_service_quote_submit_before>
132
  <observers>
133
  <get_konduto_score>
134
  <type>singleton</type>
135
  <class>Konduto_Score_Model_Observer</class>
136
+ <method>prepareScore</method>
137
  </get_konduto_score>
138
  </observers>
139
+ </sales_model_service_quote_submit_before>
140
+ <sales_model_service_quote_submit_success>
141
+ <observers>
142
+ <get_konduto_score>
143
+ <type>singleton</type>
144
+ <class>Konduto_Score_Model_Observer</class>
145
+ <method>setScorePayment</method>
146
+ </get_konduto_score>
147
+ </observers>
148
+ </sales_model_service_quote_submit_success>
149
+ <controller_action_postdispatch_checkout>
150
+ <observers>
151
+ <get_konduto_score>
152
+ <type>singleton</type>
153
+ <class>Konduto_Score_Model_Observer</class>
154
+ <method>sendScoreRequest</method>
155
+ </get_konduto_score>
156
+ </observers>
157
+ </controller_action_postdispatch_checkout>
158
+ <!-- <core_block_abstract_to_html_before>
159
  <observers>
160
  <konduto_invoice>
161
  <type>singleton</type>
169
  </konduto_order_page>
170
  </observers>
171
  </core_block_abstract_to_html_before>
172
+ <sales_order_invoice_register>
173
  <observers>
174
  <invoice_save>
175
  <type>singleton</type>
app/design/frontend/base/default/layout/score.xml CHANGED
@@ -3,6 +3,7 @@
3
 
4
  <konduto_js>
5
  <reference name="footer">
 
6
  <block type="core/template" name="scorejs" template="score/score.phtml" before="-"/>
7
  </reference>
8
  </konduto_js>
@@ -102,9 +103,6 @@
102
  </action>
103
  </block>
104
  </reference>
105
- <reference name="footer">
106
- <block type="core/template" name="scoreIdjs" template="score/getId.phtml" after="-"/>
107
- </reference>
108
  </konduto_checkout_cart_index>
109
 
110
  <konduto_customer_account_index>
3
 
4
  <konduto_js>
5
  <reference name="footer">
6
+ <action method="setCacheLifetime"><s>0</s></action>
7
  <block type="core/template" name="scorejs" template="score/score.phtml" before="-"/>
8
  </reference>
9
  </konduto_js>
103
  </action>
104
  </block>
105
  </reference>
 
 
 
106
  </konduto_checkout_cart_index>
107
 
108
  <konduto_customer_account_index>
app/design/frontend/base/default/template/score/getId.phtml DELETED
@@ -1,17 +0,0 @@
1
- <?php ?>
2
- <script type="text/javascript">
3
- function kdt_id() {
4
- var visitor_id = getKondutoID();
5
-
6
- var cname = 'score_visiter_id';
7
- var cvalue = visitor_id;
8
- var exdays = 1;
9
-
10
- var d = new Date();
11
- d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
12
- var expires = "expires=" + d.toGMTString();
13
- document.cookie = cname + "=" + cvalue + "; " + expires;
14
- }
15
- Event.observe(window, "load", kdt_id);
16
-
17
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/score/score.phtml CHANGED
@@ -1,17 +1,26 @@
1
  <?php
2
- $mode = Mage::getStoreConfig('scoreoptions/messages/mode');
3
- if ($mode == 1) { $public = Mage::getStoreConfig('scoreoptions/messages/productionpublickey'); }
4
- else { $public = Mage::getStoreConfig('scoreoptions/messages/sandboxpublickey'); }
 
 
 
 
 
 
 
5
  ?>
6
-
7
  <script type="text/javascript">
8
  var __kdt = __kdt || [];
9
- __kdt.push({"public_key": "<?php echo $public ?>"});
 
 
 
10
  (function() {
11
- var kdt = document.createElement("script");
12
- kdt.id = "kdtjs"; kdt.type = "text/javascript"; kdt.async = true;
13
- kdt.src = "https://d46w1m9rlmw15.cloudfront.net/k.js";
14
- var s = document.getElementsByTagName("body")[0];
15
- s.parentNode.insertBefore(kdt, s);
16
  })();
17
  </script>
1
  <?php
2
+ $public = '';
3
+ if (Mage::getStoreConfig("scoreoptions/messages/activate")) {
4
+ $mode = Mage::getStoreConfig('scoreoptions/messages/mode');
5
+ if ($mode == 1) { $public = Mage::getStoreConfig('scoreoptions/messages/productionpublickey'); }
6
+ else { $public = Mage::getStoreConfig('scoreoptions/messages/sandboxpublickey'); }
7
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
8
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
9
+ $customerId = $customerData->getId();
10
+ }
11
+ }
12
  ?>
 
13
  <script type="text/javascript">
14
  var __kdt = __kdt || [];
15
+ __kdt.push({"public_key":"<?php echo $public ?>"});
16
+ <?php if (isset($customerId)): ?>
17
+ __kdt.push({"customer_id":"<?php echo $customerId ?>"});
18
+ <?php endif; ?>
19
  (function() {
20
+ var kdt = document.createElement("script");
21
+ kdt.id = "kdtjs"; kdt.type = "text/javascript"; kdt.async = true;
22
+ kdt.src = "https://d46w1m9rlmw15.cloudfront.net/k.js";
23
+ var s = document.getElementsByTagName("body")[0];
24
+ s.parentNode.insertBefore(kdt, s);
25
  })();
26
  </script>
package.xml CHANGED
@@ -1,18 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Konduto</name>
4
- <version>1.4.0</version>
5
  <stability>stable</stability>
6
  <license>OSLv3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Konduto fraud detection service integration</summary>
10
  <description>Konduto is a fraud detection service that helps e-commerce merchants spot fraud with Buying Behavior</description>
11
- <notes>- Improved layout compatibility with other modules</notes>
12
- <authors><author><name>Konduto</name><user>konduto</user><email>magentoconnect@konduto.com</email></author><author><name>Excellence Technologies</name><user>manish</user><email>manish@excellencetechnologies.in</email></author></authors>
13
- <date>2014-09-19</date>
14
- <time>21:15:48</time>
15
- <contents><target name="magecommunity"><dir name="Konduto"><dir name="Score"><dir name="Block"><dir name="Adminhtml"><dir name="Order"><file name="Grid.php" hash="7ca27f1f6cfb61b5658ecf6bfdf83466"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="View"><file name="Score.php" hash="5690f0e18f102bf2a1747708e81d2d6f"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="4eb1e86fb4c5f3833f5d055d594b6a16"/><file name="Order.php" hash="953e22602d419ce41d13e5d5903ce8c2"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Score"><file name="Collection.php" hash="2dedf14be82d224d6d8f56fe1a4fa5fc"/></dir><file name="Score.php" hash="938cbb8ae489bc9b0c39e75ca0f180f1"/></dir><file name="Observer.php" hash="7ac25d54857ce561266422f6d39bc985"/><file name="Score.php" hash="d9f8efdb0b45bbb00c0faf62e23c2b26"/><dir name="System"><file name="Review.php" hash="141b400a28bf7f280f2bddf582eb4949"/><file name="Save.php" hash="8e059419faa31fe0f5592651436ff092"/><file name="Select.php" hash="7af3a6cc2f51f3c503385406d381307a"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ScoreController.php" hash="7d4fbada790473cd7a5a896ef15c0795"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="df125e243e6163fcd0a4c1401c0e18c6"/><file name="config.xml" hash="679c14a9f0fe98d034a5cf1d5cb6989b"/><file name="system.xml" hash="9946ce3210bb4b8a3cbe9761ad2604e1"/></dir><dir name="sql"><dir name="score_setup"><file name="mysql4-install-0.1.0.php" hash="81b07a2cfb4bb6910166e1f6cfa9a838"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="pt_BR"><file name="Konduto_Score.csv" hash="58c42a8ccf3b8c982546f11336cde45b"/></dir></target><target name="mageetc"><dir name="modules"><file name="Konduto_Score.xml" hash="c549e42d553ccdeeb1e1ff8e7af82194"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="score.xml" hash="435c86b572cddcc6f92a683709acb22d"/></dir><dir name="template"><dir name="score"><dir name="sales"><dir name="order"><dir name="view"><file name="info.phtml" hash="26738627adec425585f59334aea405bb"/><file name="score.phtml" hash="d119d621d868c815f705c615bd1b1db2"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="score.xml" hash="ebf71497e044f4d4cc84a09d952f637d"/></dir><dir name="template"><dir name="score"><file name="getId.phtml" hash="e3df324fdf29fa9c48ed02a799458d51"/><file name="product.phtml" hash="70f95845a94de6aee51a7711633bebc5"/><file name="score.phtml" hash="7a031dbc59e542264fc3c7386b0e1a06"/></dir></dir></dir></dir></dir></target></contents>
 
 
16
  <compatible/>
17
- <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.5.1.0</min><max>1.8.1.0</max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Konduto</name>
4
+ <version>1.5.1</version>
5
  <stability>stable</stability>
6
  <license>OSLv3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Konduto fraud detection service integration</summary>
10
  <description>Konduto is a fraud detection service that helps e-commerce merchants spot fraud with Buying Behavior</description>
11
+ <notes>- Magento EE compatibilty&#xD;
12
+ - Improved compatibility with third-party payment modules&#xD;
13
+ - Bugfixes</notes>
14
+ <authors><author><name>Konduto</name><user>konduto</user><email>magentoconnect@konduto.com</email></author></authors>
15
+ <date>2014-10-24</date>
16
+ <time>13:35:26</time>
17
+ <contents><target name="magecommunity"><dir name="Konduto"><dir name="Score"><dir name="Block"><dir name="Adminhtml"><dir name="Order"><file name="Grid.php" hash="7ca27f1f6cfb61b5658ecf6bfdf83466"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="View"><file name="Score.php" hash="5690f0e18f102bf2a1747708e81d2d6f"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="4eb1e86fb4c5f3833f5d055d594b6a16"/><file name="Order.php" hash="fc32ca9d0cf2fedd38d7630be3f5104f"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Score"><file name="Collection.php" hash="2dedf14be82d224d6d8f56fe1a4fa5fc"/></dir><file name="Score.php" hash="938cbb8ae489bc9b0c39e75ca0f180f1"/></dir><file name="Observer.php" hash="fb000b208a7e6e5ed409d46b5bf60b9b"/><file name="Score.php" hash="d9f8efdb0b45bbb00c0faf62e23c2b26"/><dir name="System"><file name="Review.php" hash="141b400a28bf7f280f2bddf582eb4949"/><file name="Save.php" hash="8e059419faa31fe0f5592651436ff092"/><file name="Select.php" hash="7af3a6cc2f51f3c503385406d381307a"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ScoreController.php" hash="f82feac7c2074c32f5254c5c7b915c01"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="df125e243e6163fcd0a4c1401c0e18c6"/><file name="config.xml" hash="dbcd1729c8260b211b5d967c55b6f5bf"/><file name="system.xml" hash="9946ce3210bb4b8a3cbe9761ad2604e1"/></dir><dir name="sql"><dir name="score_setup"><file name="mysql4-install-0.1.0.php" hash="81b07a2cfb4bb6910166e1f6cfa9a838"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Konduto_Score.xml" hash="c549e42d553ccdeeb1e1ff8e7af82194"/></dir></target><target name="magelocale"><dir name="pt_BR"><file name="Konduto_Score.csv" hash="58c42a8ccf3b8c982546f11336cde45b"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="score.xml" hash="435c86b572cddcc6f92a683709acb22d"/></dir><dir name="template"><dir name="score"><dir name="sales"><dir name="order"><dir name="view"><file name="info.phtml" hash="26738627adec425585f59334aea405bb"/><file name="score.phtml" hash="d119d621d868c815f705c615bd1b1db2"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="score.xml" hash="29dd16ae1e2303ad342d318ce60da80a"/></dir><dir name="template"><dir name="score"><file name="product.phtml" hash="70f95845a94de6aee51a7711633bebc5"/><file name="score.phtml" hash="16f9fbc2c3fb185da563c5ba24dd558a"/></dir></dir></dir></dir></dir></target></contents>
18
  <compatible/>
19
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.5.0.1</min><max>1.9.0.1</max></package></required></dependencies>
20
  </package>