<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

global $fbbttm_checkoutobj,$fbbttm_helperobj;

$availmethod = $fbbttm_checkoutobj->fbbttm_get_payment_method_list();

$paypalmode = $fbbttm_helperobj->fbbttm_get_setting_tablekeyval('fbbttm_payment_mode');

if(!empty($availmethod)){
  if(in_array('fbbttm_stripe_method_status',$availmethod)){
		
	  $stripedata = $fbbttm_checkoutobj->fbbttm_get_payment_methodkey('fieldkey','fbbttm_stripe_api','fbbttm_stripe_scretkey');

	  $stripepublickey = (!empty($stripedata['fbbttm_stripe_api'])) ? $stripedata['fbbttm_stripe_api']:'';
	   $stripeseceretkey = (!empty($stripedata['fbbttm_stripe_scretkey'])) ? $stripedata['fbbttm_stripe_scretkey']:'';
	
		if (!defined('FBBTTM_STRIPE_SECRET_KEY')) define('FBBTTM_STRIPE_SECRET_KEY', $stripeseceretkey);
		if (!defined('FBBTTM_STRIPE_PUBLIC_KEY')) define('FBBTTM_STRIPE_PUBLIC_KEY', $stripepublickey);
	
	}
}

if(!empty($availmethod)){
  if(in_array('fbbttm_paypal_method_status',$availmethod)){

	$paypalmode = $fbbttm_checkoutobj->fbbttm_get_payment_methodkey('fieldkey','fbbttm_payment_mode');

	$paypalmode = $paypalmode['fbbttm_payment_mode'];


	if ($paypalmode == 'sandbox') {
        define('FBBTTM_PAYPAL_SANDBOX', TRUE);
    }
    else {
        define('FBBTTM_PAYPAL_SANDBOX', FALSE);
    }

	$paypaldata = $fbbttm_checkoutobj->fbbttm_get_payment_methodkey('fieldkey','fbbttm_paypalid','fbbttm_paypalapi','fbbttm_payment_email','fbbttm_api_username');

	$paypal_client_id = (!empty($paypaldata['fbbttm_paypalid'])) ? $paypaldata['fbbttm_paypalid'] : '';
	$paypal_client_secret = (!empty($paypaldata['fbbttm_paypalapi'])) ? $paypaldata['fbbttm_paypalapi'] : '';

		if(FBBTTM_PAYPAL_SANDBOX == TRUE){
	        define('FBBTTM_PAYPAL_SANDBOX_CLIENT_ID',$paypal_client_id); 
	        define('FBBTTM_PAYPAL_SANDBOX_CLIENT_SECRET', $paypal_client_secret); 
	        define('FBBTTM_PAYPAL_PROD_CLIENT_ID', ''); 
	        define('FBBTTM_PAYPAL_PROD_CLIENT_SECRET', ''); 
	    }
	    else{
	        define('FBBTTM_PAYPAL_SANDBOX_CLIENT_ID',''); 
	        define('FBBTTM_PAYPAL_SANDBOX_CLIENT_SECRET', ''); 
	        define('FBBTTM_PAYPAL_PROD_CLIENT_ID', $paypal_client_id); 
	        define('FBBTTM_PAYPAL_PROD_CLIENT_SECRET', $paypal_client_secret); 
	    }


	}


	
}

?>