public function save()
 {
     global $current_section;
     if ($current_section) {
         $method = $this->methods[$current_section];
         $settings = $method->get_settings();
     }
     SLP_Admin_Settings::save_fields($settings);
 }
 public static function get_settings_pages()
 {
     if (empty(self::$settings)) {
         $settings = array();
         include_once 'class-slp-settings-page.php';
         $settings[] = (include_once 'class-slp-general-settings.php');
         $settings[] = (include_once 'class-slp-shipping-method-settings.php');
         //$settings[] = include_once( 'class-slp-reports.php' );
         self::$settings = apply_filters('slp_get_settings_pages', $settings);
     }
     return self::$settings;
 }
	public function setting_page() {
		include_once( 'class-slp-admin-settings.php' );	
		SLP_Admin_Settings::output();	
	}
 public function save()
 {
     $settings = $this->get_settings();
     SLP_Admin_Settings::save_fields($settings);
 }
	public function get_auth() {
		$this->settings = $this->init_settings();
		
		$params = array(
			'Credentials' => array(
				'IntegrationID' 	=> $this->integration_id,
				'Username'		=> $this->settings['username'],
				'Password'		=> $this->settings['password']
			)
		);	
	
		//Make connection to Stamps.com server. Catch exception if error occurs
		try{
			
			//check if debug option is enabled
			$this->endpoint_url = $this->settings['debug'] == 'yes' ? $this->wsdl['test'] : $this->wsdl['production'];	
			
			//Create new SoapClient connection for Stamps API access
			$this->stamps = new SoapClient( $this->endpoint_url, array( 'exceptions' => false ) );
			
			//Validate login credentials
			//Stamps.com login failed.
			if( is_soap_fault( $auth = $this->stamps->AuthenticateUser( $params ) ) ) {
				
				//Ensure we are on the USPS setting page
				if( isset( $_GET['section'] ) && $_GET['section'] === 'usps' ) {
					
					//display login failure
					SLP_Admin_Settings::add_error( 'Login Failed. Please enter valid credentials below.' );
				} 
				
				return false;
				
			//Stamps.com login successful
			} else {
				
				//get account info and store in global variable
				$this->get_account( $auth );
				
				//update we are on the USPS settings page. 
				if( isset( $_GET['section'] ) && $_GET['section'] === 'usps' ) {
					
					//get and display user welcome text and login success
					$firstname = $this->account_info->AccountInfo->MeterPhysicalAddress->FirstName;
			   		SLP_Admin_Settings::add_message( 'Login Successful. Welcome back ' . $firstname  . ' and thank you for using Shipping Label Pro.' );
				}
				
				return true;
			}
		
		//catch all other errors and display to user.
		} catch ( Exception $e )  {
			slp_ajax_functions::error_handler( __FUNCTION__, __CLASS__, __LINE__, $e );
		}	
	}