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

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