Code Duplication    Length = 21-22 lines in 2 locations

catalog/includes/apps/braintree/modules/CC/CC.php 1 location

@@ 149-170 (lines=22) @@
146
    }
147
148
    function migrate($OSCOM_PayPal) {
149
      if ( defined('MODULE_PAYMENT_BRAINTREE_CC_TRANSACTION_SERVER') ) {
150
        $server = (MODULE_PAYMENT_BRAINTREE_CC_TRANSACTION_SERVER == 'Live') ? '' : 'SANDBOX_';
151
152
        if ( defined('MODULE_PAYMENT_BRAINTREE_CC_MERCHANT_ID') && defined('MODULE_PAYMENT_BRAINTREE_CC_PUBLIC_KEY') && defined('MODULE_PAYMENT_BRAINTREE_CC_PRIVATE_KEY') ) {
153
          if ( tep_not_null(MODULE_PAYMENT_BRAINTREE_CC_MERCHANT_ID) && tep_not_null(MODULE_PAYMENT_BRAINTREE_CC_PUBLIC_KEY) && tep_not_null(MODULE_PAYMENT_BRAINTREE_CC_PRIVATE_KEY) ) {
154
            if ( !defined('OSCOM_APP_PAYPAL_BRAINTREE_' . $server . 'MERCHANT_ID') || !tep_not_null(constant('OSCOM_APP_PAYPAL_BRAINTREE_' . $server . 'MERCHANT_ID')) ) {
155
              if ( !defined('OSCOM_APP_PAYPAL_BRAINTREE_' . $server . 'PUBLIC_KEY') || !tep_not_null(constant('OSCOM_APP_PAYPAL_BRAINTREE_' . $server . 'PUBLIC_KEY')) ) {
156
                if ( !defined('OSCOM_APP_PAYPAL_BRAINTREE_' . $server . 'PRIVATE_KEY') || !tep_not_null(constant('OSCOM_APP_PAYPAL_BRAINTREE_' . $server . 'PRIVATE_KEY')) ) {
157
                  $OSCOM_PayPal->saveParameter('OSCOM_APP_PAYPAL_BRAINTREE_' . $server . 'MERCHANT_ID', MODULE_PAYMENT_BRAINTREE_CC_MERCHANT_ID);
158
                  $OSCOM_PayPal->saveParameter('OSCOM_APP_PAYPAL_BRAINTREE_' . $server . 'PUBLIC_KEY', MODULE_PAYMENT_BRAINTREE_CC_PUBLIC_KEY);
159
                  $OSCOM_PayPal->saveParameter('OSCOM_APP_PAYPAL_BRAINTREE_' . $server . 'PRIVATE_KEY', MODULE_PAYMENT_BRAINTREE_CC_PRIVATE_KEY);
160
                }
161
              }
162
            }
163
          }
164
165
          $OSCOM_PayPal->deleteParameter('MODULE_PAYMENT_BRAINTREE_CC_MERCHANT_ID');
166
          $OSCOM_PayPal->deleteParameter('MODULE_PAYMENT_BRAINTREE_CC_PUBLIC_KEY');
167
          $OSCOM_PayPal->deleteParameter('MODULE_PAYMENT_BRAINTREE_CC_PRIVATE_KEY');
168
          $OSCOM_PayPal->deleteParameter('MODULE_PAYMENT_BRAINTREE_CC_CLIENT_KEY');
169
        }
170
      }
171
172
      if ( defined('MODULE_PAYMENT_BRAINTREE_CC_TRANSACTION_SERVER') ) {
173
        $server = (MODULE_PAYMENT_BRAINTREE_CC_TRANSACTION_SERVER == 'Live') ? '' : 'SANDBOX_';

catalog/includes/apps/paypal/modules/DP/DP.php 1 location

@@ 97-117 (lines=21) @@
94
    function migrate($OSCOM_PayPal) {
95
      $is_payflow = false;
96
97
      if ( defined('MODULE_PAYMENT_PAYPAL_PRO_DP_TRANSACTION_SERVER') ) {
98
        $server = (MODULE_PAYMENT_PAYPAL_PRO_DP_TRANSACTION_SERVER == 'Live') ? 'LIVE' : 'SANDBOX';
99
100
        if ( defined('MODULE_PAYMENT_PAYPAL_PRO_DP_API_USERNAME') && defined('MODULE_PAYMENT_PAYPAL_PRO_DP_API_PASSWORD') && defined('MODULE_PAYMENT_PAYPAL_PRO_DP_API_SIGNATURE') ) {
101
          if ( tep_not_null(MODULE_PAYMENT_PAYPAL_PRO_DP_API_USERNAME) && tep_not_null(MODULE_PAYMENT_PAYPAL_PRO_DP_API_PASSWORD) && tep_not_null(MODULE_PAYMENT_PAYPAL_PRO_DP_API_SIGNATURE) ) {
102
            if ( !defined('OSCOM_APP_PAYPAL_' . $server . '_API_USERNAME') || !tep_not_null(constant('OSCOM_APP_PAYPAL_' . $server . '_API_USERNAME')) ) {
103
              if ( !defined('OSCOM_APP_PAYPAL_' . $server . '_API_PASSWORD') || !tep_not_null(constant('OSCOM_APP_PAYPAL_' . $server . '_API_PASSWORD')) ) {
104
                if ( !defined('OSCOM_APP_PAYPAL_' . $server . '_API_SIGNATURE') || !tep_not_null(constant('OSCOM_APP_PAYPAL_' . $server . '_API_SIGNATURE')) ) {
105
                  $OSCOM_PayPal->saveParameter('OSCOM_APP_PAYPAL_' . $server . '_API_USERNAME', MODULE_PAYMENT_PAYPAL_PRO_DP_API_USERNAME);
106
                  $OSCOM_PayPal->saveParameter('OSCOM_APP_PAYPAL_' . $server . '_API_PASSWORD', MODULE_PAYMENT_PAYPAL_PRO_DP_API_PASSWORD);
107
                  $OSCOM_PayPal->saveParameter('OSCOM_APP_PAYPAL_' . $server . '_API_SIGNATURE', MODULE_PAYMENT_PAYPAL_PRO_DP_API_SIGNATURE);
108
                }
109
              }
110
            }
111
          }
112
113
          $OSCOM_PayPal->deleteParameter('MODULE_PAYMENT_PAYPAL_PRO_DP_API_USERNAME');
114
          $OSCOM_PayPal->deleteParameter('MODULE_PAYMENT_PAYPAL_PRO_DP_API_PASSWORD');
115
          $OSCOM_PayPal->deleteParameter('MODULE_PAYMENT_PAYPAL_PRO_DP_API_SIGNATURE');
116
        }
117
      }
118
119
      if ( defined('MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_TRANSACTION_SERVER') ) {
120
        $is_payflow = true;