Code Duplication    Length = 48-48 lines in 2 locations

catalog/includes/modules/payment/sage_pay_direct.php 1 location

@@ 18-65 (lines=48) @@
15
  class sage_pay_direct {
16
    var $code, $title, $description, $enabled;
17
18
    function __construct() {
19
      global $PHP_SELF, $order;
20
21
      $this->signature = 'sage_pay|sage_pay_direct|3.1|2.3';
22
      $this->api_version = '3.00';
23
24
      $this->code = 'sage_pay_direct';
25
      $this->title = OSCOM::getDef('module_payment_sage_pay_direct_text_title');
26
      $this->public_title = OSCOM::getDef('module_payment_sage_pay_direct_text_public_title');
27
      $this->description = OSCOM::getDef('module_payment_sage_pay_direct_text_description');
28
      $this->sort_order = defined('MODULE_PAYMENT_SAGE_PAY_DIRECT_SORT_ORDER') ? MODULE_PAYMENT_SAGE_PAY_DIRECT_SORT_ORDER : 0;
29
      $this->enabled = defined('MODULE_PAYMENT_SAGE_PAY_DIRECT_STATUS') && (MODULE_PAYMENT_SAGE_PAY_DIRECT_STATUS == 'True') ? true : false;
30
      $this->order_status = defined('MODULE_PAYMENT_SAGE_PAY_DIRECT_ORDER_STATUS_ID') && ((int)MODULE_PAYMENT_SAGE_PAY_DIRECT_ORDER_STATUS_ID > 0) ? (int)MODULE_PAYMENT_SAGE_PAY_DIRECT_ORDER_STATUS_ID : 0;
31
32
      if ( defined('MODULE_PAYMENT_SAGE_PAY_DIRECT_STATUS') ) {
33
        if ( MODULE_PAYMENT_SAGE_PAY_DIRECT_TRANSACTION_SERVER == 'Test' ) {
34
          $this->title .= ' [Test]';
35
          $this->public_title .= ' (' . $this->code . '; Test)';
36
        }
37
38
        $this->description .= $this->getTestLinkInfo();
39
      }
40
41
      if ( !function_exists('curl_init') ) {
42
        $this->description = '<div class="secWarning">' . OSCOM::getDef('module_payment_sage_pay_direct_error_admin_curl') . '</div>' . $this->description;
43
44
        $this->enabled = false;
45
      }
46
47
      if ( $this->enabled === true ) {
48
        if ( !tep_not_null(MODULE_PAYMENT_SAGE_PAY_DIRECT_VENDOR_LOGIN_NAME) ) {
49
          $this->description = '<div class="secWarning">' . OSCOM::getDef('module_payment_sage_pay_direct_error_admin_configuration') . '</div>' . $this->description;
50
51
          $this->enabled = false;
52
        }
53
      }
54
55
      if ( $this->enabled === true ) {
56
        if ( isset($order) && is_object($order) ) {
57
          $this->update_status();
58
        }
59
      }
60
61
      if ( defined('FILENAME_MODULES') && (basename($PHP_SELF) == 'modules.php') && isset($_GET['action']) && ($_GET['action'] == 'install') && isset($_GET['subaction']) && ($_GET['subaction'] == 'conntest') ) {
62
        echo $this->getTestConnectionResult();
63
        exit;
64
      }
65
    }
66
67
    function update_status() {
68
      global $order;

catalog/includes/modules/payment/sage_pay_server.php 1 location

@@ 19-66 (lines=48) @@
16
  class sage_pay_server {
17
    var $code, $title, $description, $enabled;
18
19
    function __construct() {
20
      global $PHP_SELF, $order;
21
22
      $this->signature = 'sage_pay|sage_pay_server|2.1|2.3';
23
      $this->api_version = '3.00';
24
25
      $this->code = 'sage_pay_server';
26
      $this->title = OSCOM::getDef('module_payment_sage_pay_server_text_title');
27
      $this->public_title = OSCOM::getDef('module_payment_sage_pay_server_text_public_title');
28
      $this->description = OSCOM::getDef('module_payment_sage_pay_server_text_description');
29
      $this->sort_order = defined('MODULE_PAYMENT_SAGE_PAY_SERVER_SORT_ORDER') ? MODULE_PAYMENT_SAGE_PAY_SERVER_SORT_ORDER : 0;
30
      $this->enabled = defined('MODULE_PAYMENT_SAGE_PAY_SERVER_STATUS') && (MODULE_PAYMENT_SAGE_PAY_SERVER_STATUS == 'True') ? true : false;
31
      $this->order_status = defined('MODULE_PAYMENT_SAGE_PAY_SERVER_ORDER_STATUS_ID') && ((int)MODULE_PAYMENT_SAGE_PAY_SERVER_ORDER_STATUS_ID > 0) ? (int)MODULE_PAYMENT_SAGE_PAY_SERVER_ORDER_STATUS_ID : 0;
32
33
      if ( defined('MODULE_PAYMENT_SAGE_PAY_SERVER_STATUS') ) {
34
        if ( MODULE_PAYMENT_SAGE_PAY_SERVER_TRANSACTION_SERVER == 'Test' ) {
35
          $this->title .= ' [Test]';
36
          $this->public_title .= ' (' . $this->code . '; Test)';
37
        }
38
39
        $this->description .= $this->getTestLinkInfo();
40
      }
41
42
      if ( !function_exists('curl_init') ) {
43
        $this->description = '<div class="secWarning">' . OSCOM::getDef('module_payment_sage_pay_server_error_admin_curl') . '</div>' . $this->description;
44
45
        $this->enabled = false;
46
      }
47
48
      if ( $this->enabled === true ) {
49
        if ( !tep_not_null(MODULE_PAYMENT_SAGE_PAY_SERVER_VENDOR_LOGIN_NAME) ) {
50
          $this->description = '<div class="secWarning">' . OSCOM::getDef('module_payment_sage_pay_server_error_admin_configuration') . '</div>' . $this->description;
51
52
          $this->enabled = false;
53
        }
54
      }
55
56
      if ( $this->enabled === true ) {
57
        if ( isset($order) && is_object($order) ) {
58
          $this->update_status();
59
        }
60
      }
61
62
      if ( defined('FILENAME_MODULES') && (basename($PHP_SELF) == 'modules.php') && isset($_GET['action']) && ($_GET['action'] == 'install') && isset($_GET['subaction']) && ($_GET['subaction'] == 'conntest') ) {
63
        echo $this->getTestConnectionResult();
64
        exit;
65
      }
66
    }
67
68
    function update_status() {
69
      global $order;