#!/usr/bin/perl
# opensrs client conf file for wsb services.

# Please note, that this version of the client code requires the Date::Calc
# perl module. Please review the client code documentation for more details.
#
# The Impact of this one is that noone will be able to install the
# client code without this.

###################### CASES #######################################
	#Note to reseller.
	
	#Please choose the scenario that applies to your business model.
	#And make the associated changes to this config file.

	#Scenario 1:
	#Each customer will have their own RWI2 username
	#They will be permitted to have more than one Website Builder Account under
	#that RWI2 user.

	#Dflt_enable_rwi2=> 1

	#Dflt_rwi2_username=> '',
	#Dflt_rwi2_password=> '',
	
	
	#Scenario 2:
	#One RWI2 user is used across all customers
	#Each customer will have only one website Builder account

	#Dflt_enable_rwi2=> 0

	#Dflt_rwi2_username=> 'oneusername'
	#Dflt_rwi2_password=> 'onepassword'

	
	#Scenario 3:
	#Each customer has both an RWI2 username and Website Builder account,
	#which are identical.
	#Each customer will have only one website builder account

	#Dflt_enable_rwi2=> 0

	#Dflt_rwi2_username=> '',
	#Dflt_rwi2_password=> '',	
	
######################################################################
                                                                                                                                                             
use vars qw(%WSB %DEFAULT_VALUES $VARIANT_1 $VARIANT_2 $VARIANT_3 );

%WSB = (
                                                                                                                                                            
	# boolean: 1 is true, 0 is false
	debug => 0,
	process_immediate => 1,
	NUM_ITEMS_PER_PAGE => 50, # max num of domains displayed on a page.
	F_VERIFY_CC => 0, # verify credit card info.
	F_SHOW_CC_FIELDS => 1, # show credit card fields to get credit card info.
	PROTOCOL_VERSION => '1.4',
);

# Values that are fed as hardcoded input into the application.
%DEFAULT_VALUES = (

	# Always mandatory, please note this is the brand of which all customers
	#will be created beneath
	dflt_brand_name => 't535mdbtest1',
		
	dflt_enable_rwi2   => 0,
			
	#either none or both must be present!
	dflt_rwi2_username => '', 
	dflt_rwi2_password => '',	
	
	# Enabling settings
			
	#defaulted on, so that your customers can manage their accounts, by setting
	#to 0, they will only be able to order not manage account
	dflt_enable_manage => 1,
	
        dflt_enable_send_password => 1,
	
	#defaulted on to allow the ability for your customers to change their
	#passwords, if you enable this, it is in your best interest to disable
	#password changing on the builder itself. Go to wsbadmin.com and remove this
	#setting.
	dflt_enable_update_password => 1,
	
	# 0- do not allow the user to set or manage. For update don't even show the button. Default to the conf time setting dflt_expiry_year_period.
	# 1- then allow the user to set, and manage the expiry date, and default it to 1 year from now.
	dflt_enable_set_expiry_date => 0,
	
	# If dflt_enable_set_expiry_date = 1, flag dflt_expiry_period is not used.
	# 0- no expiry;
	# 1- 1 year from creation date. 
	dflt_expiry_period => 1,
	
	dflt_enable_upgrade_package => 1,
	
	dflt_enable_update_settings => 1,
	
	dflt_enable_go_live => 1,
	
	dflt_set_percentage_price => 0,
	
	dflt_test_ftp => 1,
	
	dflt_enable_client_messaging => 0,
	
	dflt_price_percentage => 0,
	
	# If this flag is 0, all FTP settings MUST be in config. FTP fields and and Test FTP button are not shown.
	# If this flag is 1, display FTP settings that are in config and don't allow to update them.
	dflt_enable_update_ftp => 1,
	
	dflt_ftp_server => '', 
	
	dflt_ftp_port => '',
	
	dflt_ftp_username => '',
	
	dflt_ftp_password => '',
	
	dflt_ftp_default_directory => '', #ex: /public_html
	
	dflt_ftp_index_filename => '', 
	
	dflt_terms_url => '', 

	#If you have a package comparison grid
	#on your website, you may link to it here.	
	dflt_package_comparison_url => '',
	# you may copy content of this page, but do not use link to this page
	#dflt_package_comparison_url => 'https://rrc.tucows.com/wholesale_services/webpublishing/websitebuilder/comparison_grid',
	
	dflt_languages => {
                en => 'English',
                es => 'Spanish',
                nl => 'Dutch',
                de => 'German',
                it => 'Italian',
                fr => 'French'
        },
	
	dflt_packages => [
		{
			key => 'ecomm',
			sell => 1,
			name => "Ecommerce Website",
			offertrial => 1,
			price => '250', # cents
		},
		{
			key => 'smallbus',
			sell => 1,
			name => "Small Business Website",
			offertrial => 1,
			price => '150', # cents
		},
		{
			key => 'personal',
			sell => 0,
			name => "Personal Website",
			offertrial => 1,
			price => '100', # cents
		},
		{ 
			key => 'starterweb',
			sell => 1,
			name => "Starter Website",
			offertrial => 1,
			price => '75', # cents
		},
		{
			key => 'buscard',
			sell => 1,
			name => "Business Card",
			offertrial => 0,
			price => '10', # cents
		},

	],
		
	# End User messaging, configured in client.
	dflt_message_data => {
		create_live => {
			subject => 'Account is Live Subject', 
		},
		create_trial => {
			subject => 'Account is Trial Subject',
		},
		upgrade_package => {
			subject => 'Upgrade Package Subject',		
		},
		go_live => {
			subject => 'Go Live Subject',				
		},	
	},	

);
# Verify credit card only if credit card fields are shown for informaion gathering and the order is processed, not just saves.
$WSB{F_VERIFY_CC} = $WSB{F_VERIFY_CC} && $WSB{F_SHOW_CC_FIELDS} && $WSB{process_immediate};

$VARIANT_1 = $DEFAULT_VALUES{dflt_enable_rwi2};
$VARIANT_2 = ! $DEFAULT_VALUES{dflt_enable_rwi2} && $DEFAULT_VALUES{dflt_rwi2_username};
$VARIANT_3 = ! $DEFAULT_VALUES{dflt_enable_rwi2} && ! $DEFAULT_VALUES{dflt_rwi2_username};

if ( !$DEFAULT_VALUES{dflt_brand_name}) {
    print "Configuration file error: Mandatory Brand Name is missing."; 
    exit;
}

if ( !$DEFAULT_VALUES{dflt_enable_update_ftp} && 
	(!$DEFAULT_VALUES{dflt_ftp_server} || !$DEFAULT_VALUES{dflt_ftp_port} || 
	!$DEFAULT_VALUES{dflt_ftp_username} || !$DEFAULT_VALUES{dflt_ftp_password} || 
	!$DEFAULT_VALUES{dflt_ftp_default_directory} || !$DEFAULT_VALUES{dflt_ftp_index_filename})) {
    print "Configuration file error: All FTP fields must be present in the config when dflt_enable_update_ftp = 0."; 
    exit;
}

1;
