vds/ipprot_nova/IpadClient.js

/**
 * @fileoverview This file is generated by BoosterClientGenerator, do not edit.
 *               If this file needs to change consider updating the exporter
 *               code and re-run the export.
 *
 * @author anders.rejdebrant@spark-vision.com (Anders Rejdebrant)
 */

goog.provide('spv.vds.ipprot_nova.IpadClient');

goog.require('goog.events.EventTarget');
goog.require('goog.json');
goog.require('goog.net.Jsonp');
goog.require('goog.net.XhrIo');
goog.require('goog.Uri.QueryData');
goog.require('spv.ds.ipprot_nova.output.PdfGenerationResult');
goog.require('spv.vds.ipprot_nova.input.SendBopUpdateFlag');
goog.require('spv.vds.ipprot_nova.loanextension.Loan');
goog.require('spv.vds.ipprot_nova.output.CareCustomerOrderResult');
goog.require('spv.vds.ipprot_nova.output.ConfigQuickInfoResult');
goog.require('spv.vds.ipprot_nova.output.MailRequestResult');
goog.require('spv.vds.ipprot_nova.output.TacdisResult');
goog.require('spv.vds.ipprot_nova.pricemode.AttemptSetPriceModeResult');
goog.require('spv.vds.ipprot_nova.pricemode.PriceModeResult');
goog.require('spv.vds.ipprot_nova.pricemodeextensionhandler.VdsPriceMode');
goog.require('spv.vds.ipprot_nova.protocol.LeasingOutput');
goog.require('spv.vds.ipprot_nova.retailerdatahandler.VolvoRetailer');
goog.require('spv.vds.ipprot_nova.specification.CarSpecification');
goog.require('spv.vds.ipprot_nova.specification.ItemProperties');
goog.require('spv.vds.ipprot_nova.specification.LeasingParameters');
goog.require('spv.vds.ipprot_nova.specification.VolvoItemType');
goog.require('spv.vds.ipprot_nova.volvocampaigns.CampaignCollection');
goog.require('spv.vds.ipprot_nova.volvocompanycarsextensions.CCInputView');



/**
 * @constructor
 * @struct
 * @param {string} service_url
 * @param {boolean} use_jsonp
 */
spv.vds.ipprot_nova.IpadClient = function(
	service_url,
	use_jsonp)
{
	this._service_url = service_url;
	if (use_jsonp)
	{
	    this._send_http_request = spv.vds.ipprot_nova.IpadClient.sendJsonpHttpRequest;
	    this._api_name = 'jsonp';
	}
	else
	{
	    this._send_http_request = spv.vds.ipprot_nova.IpadClient.sendJsonHttpRequest;
	    this._api_name = 'api';
	}
};




/**
 * @param {string} session_id
 * @param {spv.vds.ipprot_nova.pricemodeextensionhandler.VdsPriceMode} price_mode
 * @param {spv.vds.ipprot_nova.input.SendBopUpdateFlag} send_update
 * @param {function(spv.vds.ipprot_nova.pricemode.AttemptSetPriceModeResult)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.attempt_set_price_mode = function(
	session_id,
	price_mode,
	send_update,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/attempt_set_price_mode';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('price_mode', typeof(price_mode) == "object" ? goog.json.serialize(price_mode) : price_mode);
	query.set('send_update', typeof(send_update) == "object" ? goog.json.serialize(send_update) : send_update);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['attempt_set_price_mode']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {Function} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.disable_private_leasing = function(
	session_id,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/disable_private_leasing';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success();
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		true,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {Function} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.enable_private_leasing = function(
	session_id,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/enable_private_leasing';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success();
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		true,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {string} template_name
 * @param {string} retailer_id
 * @param {function(spv.ds.ipprot_nova.output.PdfGenerationResult)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.generate_retailer_html_for_pdf = function(
	session_id,
	template_name,
	retailer_id,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/generate_retailer_html_for_pdf';
	var http_method = 'GET';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('template_name', typeof(template_name) == "object" ? goog.json.serialize(template_name) : template_name);
	query.set('retailer_id', typeof(retailer_id) == "object" ? goog.json.serialize(retailer_id) : retailer_id);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['generate_retailer_html_for_pdf']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {function(spv.vds.ipprot_nova.specification.LeasingParameters)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.get_available_leasing_parameters = function(
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/get_available_leasing_parameters';
	var http_method = 'GET';
	var query = new goog.Uri.QueryData();
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['get_available_leasing_parameters']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {string} config_name
 * @param {function(spv.vds.ipprot_nova.output.ConfigQuickInfoResult)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.get_config_quick_info = function(
	session_id,
	config_name,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/get_config_quick_info';
	var http_method = 'GET';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('config_name', typeof(config_name) == "object" ? goog.json.serialize(config_name) : config_name);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['get_config_quick_info']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {function(spv.vds.ipprot_nova.pricemodeextensionhandler.VdsPriceMode)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.get_current_price_mode = function(
	session_id,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/get_current_price_mode';
	var http_method = 'GET';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['get_current_price_mode']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {function(spv.vds.ipprot_nova.protocol.LeasingOutput)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.get_leasing_params = function(
	session_id,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/get_leasing_params';
	var http_method = 'GET';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['get_leasing_params']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {function(spv.vds.ipprot_nova.loanextension.Loan)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.loan_get_current_loan = function(
	session_id,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/loan_get_current_loan';
	var http_method = 'GET';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['loan_get_current_loan']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {spv.vds.ipprot_nova.input.SendBopUpdateFlag} send_update
 * @param {function(spv.vds.ipprot_nova.loanextension.Loan)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.loan_reset = function(
	session_id,
	send_update,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/loan_reset';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('send_update', typeof(send_update) == "object" ? goog.json.serialize(send_update) : send_update);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['loan_reset']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {number} down_payment
 * @param {number} interest_rate
 * @param {number} number_of_months
 * @param {spv.vds.ipprot_nova.input.SendBopUpdateFlag} send_update
 * @param {function(spv.vds.ipprot_nova.loanextension.Loan)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.loan_set_loan_paramters = function(
	session_id,
	down_payment,
	interest_rate,
	number_of_months,
	send_update,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/loan_set_loan_paramters';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('down_payment', typeof(down_payment) == "object" ? goog.json.serialize(down_payment) : down_payment);
	query.set('interest_rate', typeof(interest_rate) == "object" ? goog.json.serialize(interest_rate) : interest_rate);
	query.set('number_of_months', typeof(number_of_months) == "object" ? goog.json.serialize(number_of_months) : number_of_months);
	query.set('send_update', typeof(send_update) == "object" ? goog.json.serialize(send_update) : send_update);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['loan_set_loan_paramters']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {string} customer_first_name
 * @param {string} customer_surname
 * @param {string} customer_email
 * @param {string} customer_phone
 * @param {string} preferred_contact_time
 * @param {string} preferred_contact_media
 * @param {boolean} want_quote
 * @param {boolean} want_newsletters
 * @param {string} mail_link_url
 * @param {string} retailer_id
 * @param {function(spv.vds.ipprot_nova.output.MailRequestResult)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.send_customer_mail_and_tacdis = function(
	session_id,
	customer_first_name,
	customer_surname,
	customer_email,
	customer_phone,
	preferred_contact_time,
	preferred_contact_media,
	want_quote,
	want_newsletters,
	mail_link_url,
	retailer_id,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/send_customer_mail_and_tacdis';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('customer_first_name', typeof(customer_first_name) == "object" ? goog.json.serialize(customer_first_name) : customer_first_name);
	query.set('customer_surname', typeof(customer_surname) == "object" ? goog.json.serialize(customer_surname) : customer_surname);
	query.set('customer_email', typeof(customer_email) == "object" ? goog.json.serialize(customer_email) : customer_email);
	query.set('customer_phone', typeof(customer_phone) == "object" ? goog.json.serialize(customer_phone) : customer_phone);
	query.set('preferred_contact_time', typeof(preferred_contact_time) == "object" ? goog.json.serialize(preferred_contact_time) : preferred_contact_time);
	query.set('preferred_contact_media', typeof(preferred_contact_media) == "object" ? goog.json.serialize(preferred_contact_media) : preferred_contact_media);
	query.set('want_quote', typeof(want_quote) == "object" ? goog.json.serialize(want_quote) : want_quote);
	query.set('want_newsletters', typeof(want_newsletters) == "object" ? goog.json.serialize(want_newsletters) : want_newsletters);
	query.set('mail_link_url', typeof(mail_link_url) == "object" ? goog.json.serialize(mail_link_url) : mail_link_url);
	query.set('retailer_id', typeof(retailer_id) == "object" ? goog.json.serialize(retailer_id) : retailer_id);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['send_customer_mail_and_tacdis']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {string} customer_first_name
 * @param {string} customer_surname
 * @param {string} customer_email
 * @param {string} customer_phone
 * @param {string} retailer_id
 * @param {function(spv.vds.ipprot_nova.output.TacdisResult)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.send_to_tacdis = function(
	session_id,
	customer_first_name,
	customer_surname,
	customer_email,
	customer_phone,
	retailer_id,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/send_to_tacdis';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('customer_first_name', typeof(customer_first_name) == "object" ? goog.json.serialize(customer_first_name) : customer_first_name);
	query.set('customer_surname', typeof(customer_surname) == "object" ? goog.json.serialize(customer_surname) : customer_surname);
	query.set('customer_email', typeof(customer_email) == "object" ? goog.json.serialize(customer_email) : customer_email);
	query.set('customer_phone', typeof(customer_phone) == "object" ? goog.json.serialize(customer_phone) : customer_phone);
	query.set('retailer_id', typeof(retailer_id) == "object" ? goog.json.serialize(retailer_id) : retailer_id);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['send_to_tacdis']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {spv.vds.ipprot_nova.pricemodeextensionhandler.VdsPriceMode} price_mode
 * @param {spv.vds.ipprot_nova.input.SendBopUpdateFlag} send_update
 * @param {string} optional_input
 * @param {function(spv.vds.ipprot_nova.pricemode.PriceModeResult)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.set_price_mode = function(
	session_id,
	price_mode,
	send_update,
	optional_input,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/set_price_mode';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('price_mode', typeof(price_mode) == "object" ? goog.json.serialize(price_mode) : price_mode);
	query.set('send_update', typeof(send_update) == "object" ? goog.json.serialize(send_update) : send_update);
	query.set('optional_input', typeof(optional_input) == "object" ? goog.json.serialize(optional_input) : optional_input);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['set_price_mode']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {string} business_group_retailer_id
 * @param {function(boolean)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.set_retailer_business_group = function(
	session_id,
	business_group_retailer_id,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/set_retailer_business_group';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('business_group_retailer_id', typeof(business_group_retailer_id) == "object" ? goog.json.serialize(business_group_retailer_id) : business_group_retailer_id);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['set_retailer_business_group']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {number} driving_distance
 * @param {spv.vds.ipprot_nova.input.SendBopUpdateFlag} send_update
 * @param {number} duration
 * @param {function(spv.vds.ipprot_nova.protocol.LeasingOutput)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.update_leasing_params = function(
	session_id,
	driving_distance,
	send_update,
	duration,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/update_leasing_params';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('driving_distance', typeof(driving_distance) == "object" ? goog.json.serialize(driving_distance) : driving_distance);
	query.set('send_update', typeof(send_update) == "object" ? goog.json.serialize(send_update) : send_update);
	query.set('duration', typeof(duration) == "object" ? goog.json.serialize(duration) : duration);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['update_leasing_params']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} feed_id
 * @param {function(spv.vds.ipprot_nova.volvocampaigns.CampaignCollection)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.vcamp_get_campaigns = function(
	feed_id,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/vcamp_get_campaigns';
	var http_method = 'GET';
	var query = new goog.Uri.QueryData();
	query.set('feed_id', typeof(feed_id) == "object" ? goog.json.serialize(feed_id) : feed_id);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['vcamp_get_campaigns']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {Function} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.vcomp_disable_company_car_prices = function(
	session_id,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/vcomp_disable_company_car_prices';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success();
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		true,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {Function} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.vcomp_enable_company_car_prices = function(
	session_id,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/vcomp_enable_company_car_prices';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success();
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		true,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {Object.<string, Object>} input_params
 * @param {spv.vds.ipprot_nova.input.SendBopUpdateFlag} send_update
 * @param {function(spv.vds.ipprot_nova.volvocompanycarsextensions.CCInputView)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.vcomp_update_input_params = function(
	session_id,
	input_params,
	send_update,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/vcomp_update_input_params';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('input_params', typeof(input_params) == "object" ? goog.json.serialize(input_params) : input_params);
	query.set('send_update', typeof(send_update) == "object" ? goog.json.serialize(send_update) : send_update);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['vcomp_update_input_params']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {Object} input_params
 * @param {spv.vds.ipprot_nova.input.SendBopUpdateFlag} send_update
 * @param {function(spv.vds.ipprot_nova.volvocompanycarsextensions.CCInputView)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.vcomp_update_input_params_2 = function(
	session_id,
	input_params,
	send_update,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/vcomp_update_input_params_2';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('input_params', typeof(input_params) == "object" ? goog.json.serialize(input_params) : input_params);
	query.set('send_update', typeof(send_update) == "object" ? goog.json.serialize(send_update) : send_update);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['vcomp_update_input_params_2']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {boolean} attachment
 * @param {Function} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.volvo_care_generate_customer_order_pdf = function(
	session_id,
	attachment,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/volvo_care_generate_customer_order_pdf';
	var http_method = 'GET';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('attachment', typeof(attachment) == "object" ? goog.json.serialize(attachment) : attachment);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success();
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		true,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {string} retid_delivery
 * @param {string} retid_sales
 * @param {string} cfirst_name
 * @param {string} clast_name
 * @param {string} cstreet
 * @param {string} ccity
 * @param {string} cpostal
 * @param {string} cphone
 * @param {string} cemail
 * @param {boolean} redirect
 * @param {boolean} attachment
 * @param {function(spv.vds.ipprot_nova.output.CareCustomerOrderResult)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.volvo_care_send_customer_order = function(
	session_id,
	retid_delivery,
	retid_sales,
	cfirst_name,
	clast_name,
	cstreet,
	ccity,
	cpostal,
	cphone,
	cemail,
	redirect,
	attachment,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/volvo_care_send_customer_order';
	var http_method = 'GET';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('retid_delivery', typeof(retid_delivery) == "object" ? goog.json.serialize(retid_delivery) : retid_delivery);
	query.set('retid_sales', typeof(retid_sales) == "object" ? goog.json.serialize(retid_sales) : retid_sales);
	query.set('cfirst_name', typeof(cfirst_name) == "object" ? goog.json.serialize(cfirst_name) : cfirst_name);
	query.set('clast_name', typeof(clast_name) == "object" ? goog.json.serialize(clast_name) : clast_name);
	query.set('cstreet', typeof(cstreet) == "object" ? goog.json.serialize(cstreet) : cstreet);
	query.set('ccity', typeof(ccity) == "object" ? goog.json.serialize(ccity) : ccity);
	query.set('cpostal', typeof(cpostal) == "object" ? goog.json.serialize(cpostal) : cpostal);
	query.set('cphone', typeof(cphone) == "object" ? goog.json.serialize(cphone) : cphone);
	query.set('cemail', typeof(cemail) == "object" ? goog.json.serialize(cemail) : cemail);
	query.set('redirect', typeof(redirect) == "object" ? goog.json.serialize(redirect) : redirect);
	query.set('attachment', typeof(attachment) == "object" ? goog.json.serialize(attachment) : attachment);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['volvo_care_send_customer_order']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {function(Array.<spv.vds.ipprot_nova.retailerdatahandler.VolvoRetailer>)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.vret_get_retailers = function(
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/vret_get_retailers';
	var http_method = 'GET';
	var query = new goog.Uri.QueryData();
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['vret_get_retailers']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} ids
 * @param {function(Array.<spv.vds.ipprot_nova.retailerdatahandler.VolvoRetailer>)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.vret_get_retailers_by_ids = function(
	ids,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/vret_get_retailers_by_ids';
	var http_method = 'GET';
	var query = new goog.Uri.QueryData();
	query.set('ids', typeof(ids) == "object" ? goog.json.serialize(ids) : ids);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['vret_get_retailers_by_ids']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {string} customer_first_name
 * @param {string} customer_surname
 * @param {string} customer_email
 * @param {string} customer_phone
 * @param {string} preferred_contact_time
 * @param {string} preferred_contact_media
 * @param {boolean} want_newsletter
 * @param {boolean} want_summary_pdf
 * @param {string} retailer_id
 * @param {string} mail_link_url
 * @param {function(spv.vds.ipprot_nova.output.MailRequestResult)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.vret_send_customer_and_retailer_mail = function(
	session_id,
	customer_first_name,
	customer_surname,
	customer_email,
	customer_phone,
	preferred_contact_time,
	preferred_contact_media,
	want_newsletter,
	want_summary_pdf,
	retailer_id,
	mail_link_url,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/vret_send_customer_and_retailer_mail';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('customer_first_name', typeof(customer_first_name) == "object" ? goog.json.serialize(customer_first_name) : customer_first_name);
	query.set('customer_surname', typeof(customer_surname) == "object" ? goog.json.serialize(customer_surname) : customer_surname);
	query.set('customer_email', typeof(customer_email) == "object" ? goog.json.serialize(customer_email) : customer_email);
	query.set('customer_phone', typeof(customer_phone) == "object" ? goog.json.serialize(customer_phone) : customer_phone);
	query.set('preferred_contact_time', typeof(preferred_contact_time) == "object" ? goog.json.serialize(preferred_contact_time) : preferred_contact_time);
	query.set('preferred_contact_media', typeof(preferred_contact_media) == "object" ? goog.json.serialize(preferred_contact_media) : preferred_contact_media);
	query.set('want_newsletter', typeof(want_newsletter) == "object" ? goog.json.serialize(want_newsletter) : want_newsletter);
	query.set('want_summary_pdf', typeof(want_summary_pdf) == "object" ? goog.json.serialize(want_summary_pdf) : want_summary_pdf);
	query.set('retailer_id', typeof(retailer_id) == "object" ? goog.json.serialize(retailer_id) : retailer_id);
	query.set('mail_link_url', typeof(mail_link_url) == "object" ? goog.json.serialize(mail_link_url) : mail_link_url);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['vret_send_customer_and_retailer_mail']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {string} customer_email
 * @param {boolean} want_newsletter
 * @param {boolean} want_summary_pdf
 * @param {string} mail_link_url
 * @param {function(spv.vds.ipprot_nova.output.MailRequestResult)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.vret_send_customer_mail = function(
	session_id,
	customer_email,
	want_newsletter,
	want_summary_pdf,
	mail_link_url,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/vret_send_customer_mail';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('customer_email', typeof(customer_email) == "object" ? goog.json.serialize(customer_email) : customer_email);
	query.set('want_newsletter', typeof(want_newsletter) == "object" ? goog.json.serialize(want_newsletter) : want_newsletter);
	query.set('want_summary_pdf', typeof(want_summary_pdf) == "object" ? goog.json.serialize(want_summary_pdf) : want_summary_pdf);
	query.set('mail_link_url', typeof(mail_link_url) == "object" ? goog.json.serialize(mail_link_url) : mail_link_url);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['vret_send_customer_mail']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} session_id
 * @param {string} customer_first_name
 * @param {string} customer_surname
 * @param {string} customer_address
 * @param {number} customer_zipcode
 * @param {string} customer_city
 * @param {string} customer_email
 * @param {string} customer_phone
 * @param {string} skype_name
 * @param {string} preferred_contact_media
 * @param {string} free_text
 * @param {string} retailer_id
 * @param {string} mail_link_url
 * @param {function(spv.vds.ipprot_nova.output.MailRequestResult)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.vret_send_volvo_care_retailer_mail = function(
	session_id,
	customer_first_name,
	customer_surname,
	customer_address,
	customer_zipcode,
	customer_city,
	customer_email,
	customer_phone,
	skype_name,
	preferred_contact_media,
	free_text,
	retailer_id,
	mail_link_url,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/vret_send_volvo_care_retailer_mail';
	var http_method = 'POST';
	var query = new goog.Uri.QueryData();
	query.set('session_id', typeof(session_id) == "object" ? goog.json.serialize(session_id) : session_id);
	query.set('customer_first_name', typeof(customer_first_name) == "object" ? goog.json.serialize(customer_first_name) : customer_first_name);
	query.set('customer_surname', typeof(customer_surname) == "object" ? goog.json.serialize(customer_surname) : customer_surname);
	query.set('customer_address', typeof(customer_address) == "object" ? goog.json.serialize(customer_address) : customer_address);
	query.set('customer_zipcode', typeof(customer_zipcode) == "object" ? goog.json.serialize(customer_zipcode) : customer_zipcode);
	query.set('customer_city', typeof(customer_city) == "object" ? goog.json.serialize(customer_city) : customer_city);
	query.set('customer_email', typeof(customer_email) == "object" ? goog.json.serialize(customer_email) : customer_email);
	query.set('customer_phone', typeof(customer_phone) == "object" ? goog.json.serialize(customer_phone) : customer_phone);
	query.set('skype_name', typeof(skype_name) == "object" ? goog.json.serialize(skype_name) : skype_name);
	query.set('preferred_contact_media', typeof(preferred_contact_media) == "object" ? goog.json.serialize(preferred_contact_media) : preferred_contact_media);
	query.set('free_text', typeof(free_text) == "object" ? goog.json.serialize(free_text) : free_text);
	query.set('retailer_id', typeof(retailer_id) == "object" ? goog.json.serialize(retailer_id) : retailer_id);
	query.set('mail_link_url', typeof(mail_link_url) == "object" ? goog.json.serialize(mail_link_url) : mail_link_url);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['vret_send_volvo_care_retailer_mail']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} model
 * @param {string} cis_id
 * @param {spv.vds.ipprot_nova.specification.VolvoItemType} item_type
 * @param {function(Array.<spv.vds.ipprot_nova.specification.ItemProperties>)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.vspec_get_item_properties = function(
	model,
	cis_id,
	item_type,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/vspec_get_item_properties';
	var http_method = 'GET';
	var query = new goog.Uri.QueryData();
	query.set('model', typeof(model) == "object" ? goog.json.serialize(model) : model);
	query.set('cis_id', typeof(cis_id) == "object" ? goog.json.serialize(cis_id) : cis_id);
	query.set('item_type', typeof(item_type) == "object" ? goog.json.serialize(item_type) : item_type);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['vspec_get_item_properties']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
 * @param {string} encoded_config
 * @param {string} encoding
 * @param {string} localization_id
 * @param {function(spv.vds.ipprot_nova.specification.CarSpecification)} on_success
 * @param {function(Error)} on_failure
 */
spv.vds.ipprot_nova.IpadClient.prototype.vspec_get_specification = function(
	encoded_config,
	encoding,
	localization_id,
	on_success,
	on_failure)
{
	var full_url = this._service_url + '/' + this._api_name + '/vspec_get_specification';
	var http_method = 'GET';
	var query = new goog.Uri.QueryData();
	query.set('encoded_config', typeof(encoded_config) == "object" ? goog.json.serialize(encoded_config) : encoded_config);
	query.set('encoding', typeof(encoding) == "object" ? goog.json.serialize(encoding) : encoding);
	query.set('localization_id', typeof(localization_id) == "object" ? goog.json.serialize(localization_id) : localization_id);
	/** @type {function(Object)} */
	var on_http_success = function(result_obj)
	{
		on_success(result_obj['vspec_get_specification']);
	}
	this._send_http_request(
		full_url,
		http_method,
		query,
		false,
		on_http_success,
		on_failure);
};




/**
* @export
* @struct
* @constructor
* @extends {Error}
*/
spv.vds.ipprot_nova.IpadClient.ProtocolError = function ProtocolError(error_carrier_object) {
	Error.call(this, error_carrier_object['message']);

	/**
	    * @nocollapse
	    * @type {string}
	    */
	this.name = error_carrier_object['name'];
	/**
	    * @nocollapse
	    * @type {string}
	    */
	this.status = error_carrier_object['status'];
	/**
	 * @nocollapse
	 * @type {string}
	 */
	this.sub_status = error_carrier_object['sub_status'];
	/**
	 * @nocollapse
	 * @type {string}
	 */
	this.message = error_carrier_object['message'];
	/**
	 * @nocollapse
	 * @type {Object}
	 */
	this.error_carrier = error_carrier_object;
}

goog.inherits(spv.vds.ipprot_nova.IpadClient.ProtocolError, Error);


(function() {

	var jsonp_timeout_ms = 60 * 1000 * 10;


/**
 * @private
 * @param {goog.Uri.QueryData} query
 * @return {string}
 */
spv.vds.ipprot_nova.IpadClient.makeSpecialQueryString = function(query) {
	var result = '';
	var keys = query.getKeys();
	for (var i = 0; i < keys.length; i++) {
		if (0 != i) {
			result += '&';
		}
		var key = keys[i];
		var val = query.get(key, '').toString();
		var val_enc = encodeURIComponent(val);
		result += keys[i] + '=' + val_enc;
	}
	return result;
}


/**
 * @private
 * @param {goog.net.XhrIo} xhr
 */
spv.vds.ipprot_nova.IpadClient.getProtocolErrorMessage = function(xhr) {
	var mess = 'protocol error: ' + xhr.getStatusText();
	mess += ', ' + xhr.getResponseText();
	return mess;
}


/**
 * @private
 * @param {goog.Uri.QueryData} query
 * @return {Object}
 */
spv.vds.ipprot_nova.IpadClient.makeJsonpPayload = function(query) {
	var result = {};
	var keys = query.getKeys();
	for (var i = 0; i < keys.length; i++) {
		var key = keys[i];
		result[key] = query.get(key);
	}
	var t = new Date().getTime();
	result['cachebuster'] = t;
	return result;
}


/**
 * @private
 * @param {Object} response
 * @return {Error}
 */
spv.vds.ipprot_nova.IpadClient.makeResponseError = function(response) {
	var message = 'Jsonp error: ';
	var error_carrier = spv.vds.ipprot_nova.IpadClient.getResponseErrorCarrier(response);
	if (null == error_carrier) {
		message += 'no error information available';
		return new Error(message);
	}

	return new spv.vds.ipprot_nova.IpadClient.ProtocolError(error_carrier);
}


/**
 * @private
 * @param {Object} response
 * @return {Object|null}
 */
spv.vds.ipprot_nova.IpadClient.getResponseErrorCarrier = function(response) {
	if (!response) {
		return null;
	}
	if (!response['error']) {
		return null;
	}
	return response['error'];
}


/**
 * @private
 * @param {Object} response
 * @return {boolean}
 */
spv.vds.ipprot_nova.IpadClient.hasErrorCarrier = function(response) {
	return null != spv.vds.ipprot_nova.IpadClient.getResponseErrorCarrier(response);
}


/**
 * @private
 * @param {string}             url
 * @param {string}             http_method
 * @param {goog.Uri.QueryData} query
 * @param {boolean}            return_is_void
 * @param {function(Object)}   on_success
 * @param {function(Error)}    on_failure
 */
spv.vds.ipprot_nova.IpadClient.sendJsonHttpRequest = function(
	url,
	http_method,
	query,
	return_is_void,
	on_success,
	on_failure) {
	var handleReply = replyHandler(return_is_void, on_success, on_failure);

	function xhrio_callback(e) {
		var xhr = e.target;
		if (!xhr.isSuccess()) {
			var statusCode = xhr.getStatus();
			var err = new Error("Protocol request failed: " + xhr.getStatusText());
			err.connectionStatusCode = statusCode;
			// Timeout will result in -1 and anything above 500 is about the server not being able to answer correctly.
			if (statusCode <= 0 || statusCode >= 501) {
				err.status = "ServiceUnavailable";
				return on_failure(err);
			}
			if (statusCode === 500) {
				err.status = "ServiceFailure";
				// no return, may have a response body.
			}
		}
		try {
			var reply = xhr.getResponseJson();
			handleReply(reply);
		} catch (response_err) {
			var dump = spv.vds.ipprot_nova.IpadClient.getProtocolErrorMessage(xhr);
			response_err.message += '\n' + dump;
			on_failure(response_err);
		}
	}

	if ('POST' == http_method || 'GET' == http_method) {
		var body_query = spv.vds.ipprot_nova.IpadClient.makeSpecialQueryString(query);
		goog.net.XhrIo.send(url, xhrio_callback, 'POST', body_query);
	} else {
		throw new Error('Method not supported: ' + http_method);
	}
};


/**
 * @private
 * @param {string}             url
 * @param {string}             http_method
 * @param {goog.Uri.QueryData} query
 * @param {boolean}            return_is_void
 * @param {function(Object)}   on_success
 * @param {function(Error)}    on_failure
 */
spv.vds.ipprot_nova.IpadClient.sendJsonpHttpRequest = function(
	url,
	http_method,
	query,
	return_is_void,
	on_success,
	on_failure) {
	var on_jsonp_reply = replyHandler(return_is_void, on_success, on_failure);
	var on_jsonp_error = function(response) {
		var jsonp_error = spv.vds.ipprot_nova.IpadClient.makeResponseError(response);
		on_failure(jsonp_error);
	};
	var payload = spv.vds.ipprot_nova.IpadClient.makeJsonpPayload(query);
	var jp = new goog.net.Jsonp(url);
	jp.setRequestTimeout(jsonp_timeout_ms);
	jp.send(payload, on_jsonp_reply, on_jsonp_error);
};


function replyHandler(
	return_is_void,
	on_success,
	on_failure) {
	return function(response) {
		try {
			if (spv.vds.ipprot_nova.IpadClient.hasErrorCarrier(response)) {
				var err = spv.vds.ipprot_nova.IpadClient.makeResponseError(response);
				throw err;
			}
			if (return_is_void) {
				on_success(null);
				return;
			}
			on_success(response);
		} catch (response_err) {
			on_failure(response_err);
		}
	}
}

})();