Skip to content

Commit

Permalink
anti-fraud
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkerr committed Apr 19, 2015
1 parent 134b1d8 commit f9085aa
Show file tree
Hide file tree
Showing 12 changed files with 546 additions and 429 deletions.
1 change: 0 additions & 1 deletion upload/admin/controller/extension/fraud.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ public function getList() {

$this->load->language('fraud/' . $extension);


$data['extensions'][] = array(
'name' => $this->language->get('heading_title'),
'status' => $this->config->get($extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
Expand Down
119 changes: 119 additions & 0 deletions upload/admin/controller/fraud/maxmind.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?php
class ControllerFraudMaxMind extends Controller {
private $error = array();

public function index() {
$this->load->language('fraud/maxmind');

$this->document->setTitle($this->language->get('heading_title'));

$this->load->model('setting/setting');

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('maxmind', $this->request->post);

$this->session->data['success'] = $this->language->get('text_success');

$this->response->redirect($this->url->link('extension/fraud', 'token=' . $this->session->data['token'], 'SSL'));
}

$data['heading_title'] = $this->language->get('heading_title');

$data['text_edit'] = $this->language->get('text_edit');
$data['text_enabled'] = $this->language->get('text_enabled');
$data['text_disabled'] = $this->language->get('text_disabled');
$data['text_signup'] = $this->language->get('text_signup');

$data['entry_key'] = $this->language->get('entry_key');
$data['entry_score'] = $this->language->get('entry_score');
$data['entry_order_status'] = $this->language->get('entry_order_status');
$data['entry_status'] = $this->language->get('entry_status');

$data['help_score'] = $this->language->get('help_score');
$data['help_order_status'] = $this->language->get('help_order_status');

$data['button_save'] = $this->language->get('button_save');
$data['button_cancel'] = $this->language->get('button_cancel');

$data['tab_general'] = $this->language->get('tab_general');

if (isset($this->error['warning'])) {
$data['error_warning'] = $this->error['warning'];
} else {
$data['error_warning'] = '';
}

if (isset($this->error['key'])) {
$data['error_key'] = $this->error['key'];
} else {
$data['error_key'] = '';
}

$data['breadcrumbs'] = array();

$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')
);

$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_fraud'),
'href' => $this->url->link('extension/fraud', 'token=' . $this->session->data['token'], 'SSL')
);

$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('fraud/maxmind', 'token=' . $this->session->data['token'], 'SSL')
);

$data['action'] = $this->url->link('fraud/maxmind', 'token=' . $this->session->data['token'], 'SSL');

$data['cancel'] = $this->url->link('extension/fraud', 'token=' . $this->session->data['token'], 'SSL');

if (isset($this->request->post['maxmind_key'])) {
$data['maxmind_key'] = $this->request->post['maxmind_key'];
} else {
$data['maxmind_key'] = $this->config->get('maxmind_key');
}

if (isset($this->request->post['maxmind_score'])) {
$data['maxmind_score'] = $this->request->post['maxmind_score'];
} else {
$data['maxmind_score'] = $this->config->get('maxmind_score');
}

if (isset($this->request->post['maxmind_order_status_id'])) {
$data['maxmind_order_status_id'] = $this->request->post['maxmind_order_status_id'];
} else {
$data['maxmind_order_status_id'] = $this->config->get('maxmind_order_status_id');
}

$this->load->model('localisation/order_status');

$data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();

if (isset($this->request->post['maxmind_status'])) {
$data['maxmind_status'] = $this->request->post['maxmind_status'];
} else {
$data['maxmind_status'] = $this->config->get('maxmind_status');
}

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');

$this->response->setOutput($this->load->view('fraud/maxmind.tpl', $data));
}

protected function validate() {
if (!$this->user->hasPermission('modify', 'fraud/maxmind')) {
$this->error['warning'] = $this->language->get('error_permission');
}

if (!$this->request->post['maxmind_key']) {
$this->error['key'] = $this->language->get('error_key');
}

return !$this->error;
}
}
32 changes: 0 additions & 32 deletions upload/admin/controller/setting/setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ public function index() {
$data['entry_mail_smtp_port'] = $this->language->get('entry_mail_smtp_port');
$data['entry_mail_smtp_timeout'] = $this->language->get('entry_mail_smtp_timeout');
$data['entry_mail_alert'] = $this->language->get('entry_mail_alert');
$data['entry_fraud_detection'] = $this->language->get('entry_fraud_detection');
$data['entry_fraud_key'] = $this->language->get('entry_fraud_key');
$data['entry_fraud_score'] = $this->language->get('entry_fraud_score');
$data['entry_fraud_status'] = $this->language->get('entry_fraud_status');
$data['entry_secure'] = $this->language->get('entry_secure');
$data['entry_shared'] = $this->language->get('entry_shared');
$data['entry_robots'] = $this->language->get('entry_robots');
Expand Down Expand Up @@ -211,9 +207,6 @@ public function index() {
$data['help_mail_parameter'] = $this->language->get('help_mail_parameter');
$data['help_mail_smtp_hostname'] = $this->language->get('help_mail_smtp_hostname');
$data['help_mail_alert'] = $this->language->get('help_mail_alert');
$data['help_fraud_detection'] = $this->language->get('help_fraud_detection');
$data['help_fraud_score'] = $this->language->get('help_fraud_score');
$data['help_fraud_status'] = $this->language->get('help_fraud_status');
$data['help_secure'] = $this->language->get('help_secure');
$data['help_shared'] = $this->language->get('help_shared');
$data['help_robots'] = $this->language->get('help_robots');
Expand All @@ -238,7 +231,6 @@ public function index() {
$data['tab_image'] = $this->language->get('tab_image');
$data['tab_ftp'] = $this->language->get('tab_ftp');
$data['tab_mail'] = $this->language->get('tab_mail');
$data['tab_fraud'] = $this->language->get('tab_fraud');
$data['tab_server'] = $this->language->get('tab_server');
$data['tab_google'] = $this->language->get('tab_google');

Expand Down Expand Up @@ -1177,30 +1169,6 @@ public function index() {
$data['config_mail_alert'] = $this->config->get('config_mail_alert');
}

if (isset($this->request->post['config_fraud_detection'])) {
$data['config_fraud_detection'] = $this->request->post['config_fraud_detection'];
} else {
$data['config_fraud_detection'] = $this->config->get('config_fraud_detection');
}

if (isset($this->request->post['config_fraud_key'])) {
$data['config_fraud_key'] = $this->request->post['config_fraud_key'];
} else {
$data['config_fraud_key'] = $this->config->get('config_fraud_key');
}

if (isset($this->request->post['config_fraud_score'])) {
$data['config_fraud_score'] = $this->request->post['config_fraud_score'];
} else {
$data['config_fraud_score'] = $this->config->get('config_fraud_score');
}

if (isset($this->request->post['config_fraud_status_id'])) {
$data['config_fraud_status_id'] = $this->request->post['config_fraud_status_id'];
} else {
$data['config_fraud_status_id'] = $this->config->get('config_fraud_status_id');
}

if (isset($this->request->post['config_secure'])) {
$data['config_secure'] = $this->request->post['config_secure'];
} else {
Expand Down
1 change: 0 additions & 1 deletion upload/admin/language/english/english.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@
$_['tab_discount'] = 'Discount';
$_['tab_general'] = 'General';
$_['tab_history'] = 'History';
$_['tab_fraud'] = 'Fraud';
$_['tab_ftp'] = 'FTP';
$_['tab_ip'] = 'IP Addresses';
$_['tab_links'] = 'Links';
Expand Down
1 change: 0 additions & 1 deletion upload/admin/language/english/feed/google_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// Text
$_['text_feed'] = 'Feeds';
$_['text_success'] = 'Success: You have modified Google Base feed!';
$_['text_list'] = 'Layout List';
$_['text_edit'] = 'Edit Google Base';

// Entry
Expand Down
23 changes: 23 additions & 0 deletions upload/admin/language/english/fraud/maxmind.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
// Heading
$_['heading_title'] = 'MaxMind Anti-Fraud';

// Text
$_['text_fraud'] = 'Anti-Fraud';
$_['text_success'] = 'Success: You have modified MaxMind anti-fraud!';
$_['text_edit'] = 'Edit MaxMind Anti-Fraud';
$_['text_signup'] = 'MaxMind is a fraud detection service. If you don\'t have a license key you can <a href="http://www.maxmind.com/?rId=opencart" target="_blank"><u>sign up here</u></a>.';

// Entry
$_['entry_key'] = 'MaxMind License Key';
$_['entry_score'] = 'Risk Score';
$_['entry_order_status'] = 'Order Status';
$_['entry_status'] = 'Status';

// Help
$_['help_score'] = 'The higher the score the more likely the order is fraudulent. Set a score between 0 - 100.';
$_['help_order_status'] = 'Orders that have a score over your set risk score will be assigned this order status and will not be allowed to reach the complete status automatically.';

// Error
$_['error_permission'] = 'Warning: You do not have permission to modify MaxMind anti-fraud!';
$_['error_key'] = 'License Key Required!';
26 changes: 13 additions & 13 deletions upload/admin/language/english/payment/cheque.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<?php
// Heading
$_['heading_title'] = 'Cheque / Money Order';
$_['heading_title'] = 'Cheque / Money Order';

// Text
$_['text_payment'] = 'Payment';
$_['text_success'] = 'Success: You have modified cheque / money order account details!';
$_['text_edit'] = 'Edit Cheque / Money Order';
$_['text_payment'] = 'Payment';
$_['text_success'] = 'Success: You have modified cheque / money order account details!';
$_['text_edit'] = 'Edit Cheque / Money Order';

// Entry
$_['entry_payable'] = 'Payable To';
$_['entry_total'] = 'Total';
$_['entry_order_status'] = 'Order Status';
$_['entry_geo_zone'] = 'Geo Zone';
$_['entry_status'] = 'Status';
$_['entry_sort_order'] = 'Sort Order';
$_['entry_payable'] = 'Payable To';
$_['entry_total'] = 'Total';
$_['entry_order_status'] = 'Order Status';
$_['entry_geo_zone'] = 'Geo Zone';
$_['entry_status'] = 'Status';
$_['entry_sort_order'] = 'Sort Order';

// Help
$_['help_total'] = 'The checkout total the order must reach before this payment method becomes active.';
$_['help_total'] = 'The checkout total the order must reach before this payment method becomes active.';

// Error
$_['error_permission'] = 'Warning: You do not have permission to modify payment cheque / money order!';
$_['error_payable'] = 'Payable To Required!';
$_['error_permission'] = 'Warning: You do not have permission to modify payment cheque / money order!';
$_['error_payable'] = 'Payable To Required!';
100 changes: 50 additions & 50 deletions upload/admin/language/english/payment/firstdata_remote.php
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
<?php
// Heading
$_['heading_title'] = 'First Data EMEA Web Service API';
$_['heading_title'] = 'First Data EMEA Web Service API';

// Text
$_['text_firstdata_remote'] = '<img src="view/image/payment/firstdata.png" alt="First Data" title="First Data" style="border: 1px solid #EEEEEE;" />';
$_['text_payment'] = 'Payment';
$_['text_success'] = 'Success: You have modified First Data account details!';
$_['text_edit'] = 'Edit First Data EMEA Web Service API';
$_['text_card_type'] = 'Card type';
$_['text_enabled'] = 'Enabled';
$_['text_merchant_id'] = 'Store ID';
$_['text_subaccount'] = 'Subaccount';
$_['text_user_id'] = 'User ID';
$_['text_capture_ok'] = 'Capture was successful';
$_['text_capture_ok_order'] = 'Capture was successful, order status updated to success - settled';
$_['text_refund_ok'] = 'Refund was successful';
$_['text_refund_ok_order'] = 'Refund was successful, order status updated to refunded';
$_['text_void_ok'] = 'Void was successful, order status updated to voided';
$_['text_settle_auto'] = 'Sale';
$_['text_settle_delayed'] = 'Pre auth';
$_['text_mastercard'] = 'Mastercard';
$_['text_visa'] = 'Visa';
$_['text_diners'] = 'Diners';
$_['text_amex'] = 'American Express';
$_['text_maestro'] = 'Maestro';
$_['text_payment_info'] = 'Payment information';
$_['text_capture_status'] = 'Payment captured';
$_['text_void_status'] = 'Payment voided';
$_['text_refund_status'] = 'Payment refunded';
$_['text_order_ref'] = 'Order ref';
$_['text_order_total'] = 'Total authorised';
$_['text_total_captured'] = 'Total captured';
$_['text_transactions'] = 'Transactions';
$_['text_column_amount'] = 'Amount';
$_['text_column_type'] = 'Type';
$_['text_column_date_added'] = 'Created';
$_['text_confirm_void'] = 'Are you sure you want to void the payment?';
$_['text_confirm_capture'] = 'Are you sure you want to capture the payment?';
$_['text_confirm_refund'] = 'Are you sure you want to refund the payment?';
$_['text_firstdata_remote'] = '<img src="view/image/payment/firstdata.png" alt="First Data" title="First Data" style="border: 1px solid #EEEEEE;" />';
$_['text_payment'] = 'Payment';
$_['text_success'] = 'Success: You have modified First Data account details!';
$_['text_edit'] = 'Edit First Data EMEA Web Service API';
$_['text_card_type'] = 'Card type';
$_['text_enabled'] = 'Enabled';
$_['text_merchant_id'] = 'Store ID';
$_['text_subaccount'] = 'Subaccount';
$_['text_user_id'] = 'User ID';
$_['text_capture_ok'] = 'Capture was successful';
$_['text_capture_ok_order'] = 'Capture was successful, order status updated to success - settled';
$_['text_refund_ok'] = 'Refund was successful';
$_['text_refund_ok_order'] = 'Refund was successful, order status updated to refunded';
$_['text_void_ok'] = 'Void was successful, order status updated to voided';
$_['text_settle_auto'] = 'Sale';
$_['text_settle_delayed'] = 'Pre auth';
$_['text_mastercard'] = 'Mastercard';
$_['text_visa'] = 'Visa';
$_['text_diners'] = 'Diners';
$_['text_amex'] = 'American Express';
$_['text_maestro'] = 'Maestro';
$_['text_payment_info'] = 'Payment information';
$_['text_capture_status'] = 'Payment captured';
$_['text_void_status'] = 'Payment voided';
$_['text_refund_status'] = 'Payment refunded';
$_['text_order_ref'] = 'Order ref';
$_['text_order_total'] = 'Total authorised';
$_['text_total_captured'] = 'Total captured';
$_['text_transactions'] = 'Transactions';
$_['text_column_amount'] = 'Amount';
$_['text_column_type'] = 'Type';
$_['text_column_date_added'] = 'Created';
$_['text_confirm_void'] = 'Are you sure you want to void the payment?';
$_['text_confirm_capture'] = 'Are you sure you want to capture the payment?';
$_['text_confirm_refund'] = 'Are you sure you want to refund the payment?';

// Entry
$_['entry_certificate_path'] = 'Certificate path';
$_['entry_certificate_key_path'] = 'Private key path';
$_['entry_certificate_key_pw'] = 'Private key password';
$_['entry_certificate_ca_path'] = 'CA path';
$_['entry_merchant_id'] = 'Store ID';
$_['entry_user_id'] = 'User ID';
$_['entry_password'] = 'Password';
$_['entry_total'] = 'Total';
$_['entry_sort_order'] = 'Sort order';
$_['entry_geo_zone'] = 'Geo zone';
$_['entry_status'] = 'Status';
$_['entry_debug'] = 'Debug logging';
$_['entry_auto_settle'] = 'Settlement type';
$_['entry_status_success_settled'] = 'Success - settled';
$_['entry_certificate_path'] = 'Certificate path';
$_['entry_certificate_key_path'] = 'Private key path';
$_['entry_certificate_key_pw'] = 'Private key password';
$_['entry_certificate_ca_path'] = 'CA path';
$_['entry_merchant_id'] = 'Store ID';
$_['entry_user_id'] = 'User ID';
$_['entry_password'] = 'Password';
$_['entry_total'] = 'Total';
$_['entry_sort_order'] = 'Sort order';
$_['entry_geo_zone'] = 'Geo zone';
$_['entry_status'] = 'Status';
$_['entry_debug'] = 'Debug logging';
$_['entry_auto_settle'] = 'Settlement type';
$_['entry_status_success_settled'] = 'Success - settled';
$_['entry_status_success_unsettled'] = 'Success - not settled';
$_['entry_status_decline'] = 'Decline';
$_['entry_status_void'] = 'Voided';
Expand Down
7 changes: 0 additions & 7 deletions upload/admin/language/english/setting/setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@
$_['entry_mail_smtp_password'] = 'SMTP Password';
$_['entry_mail_smtp_port'] = 'SMTP Port';
$_['entry_mail_smtp_timeout'] = 'SMTP Timeout';
$_['entry_fraud_detection'] = 'Use MaxMind Fraud Detection System';
$_['entry_fraud_key'] = 'MaxMind License Key';
$_['entry_fraud_score'] = 'MaxMind Risk Score';
$_['entry_fraud_status'] = 'MaxMind Fraud Order Status';
$_['entry_secure'] = 'Use SSL';
$_['entry_shared'] = 'Use Shared Sessions';
$_['entry_robots'] = 'Robots';
Expand Down Expand Up @@ -186,9 +182,6 @@
$_['help_mail_parameter'] = 'When using \'Mail\', additional mail parameters can be added here (e.g. -f email@storeaddress.com).';
$_['help_mail_smtp_hostname'] = 'Add \'tls://\' prefix if security connection is required. (e.g. tls://smtp.gmail.com).';
$_['help_mail_alert'] = 'Any additional emails you want to receive the alert email, in addition to the main store email. (comma separated).';
$_['help_fraud_detection'] = 'MaxMind is a fraud detection service. If you don\'t have a license key you can <a href="http://www.maxmind.com/?rId=opencart" target="_blank"><u>sign up here</u></a>. Once you have obtained a key, copy and paste it into the field below.';
$_['help_fraud_score'] = 'The higher the score the more likely the order is fraudulent. Set a score between 0 - 100.';
$_['help_fraud_status'] = 'Orders over your set score will be assigned this order status and will not be allowed to reach the complete status automatically.';
$_['help_secure'] = 'To use SSL check with your host if a SSL certificate is installed and add the SSL URL to the catalog and admin config files.';
$_['help_shared'] = 'Try to share the session cookie between stores so the cart can be passed between different domains.';
$_['help_robots'] = 'A list of web crawler user agents that shared sessions will not be used with. Use separate lines for each user agent.';
Expand Down
Loading

0 comments on commit f9085aa

Please sign in to comment.