Last active
October 7, 2015 06:48
-
-
Save codeweavers/3122896 to your computer and use it in GitHub Desktop.
Finance Plugin - Basic New Vehicle Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" src="https://services.codeweavers.net/v2/script/FinancePlugin?key=YOUR_API_KEY"></script> | |
<script type='text/javascript'> | |
function loadPlugin() { | |
codeweavers.main({ // Required - object - The function the initialise the plugin | |
pluginContentDivId: 'PLUGIN_DIV_ID', // Required - string - The id of the element that the plugin will be injected into. | |
vehicle: { // Required - object - The vehicle details for the calculation. | |
type: 'car', // Required - string - The type of vehicle. Either; car, lcv or bike. | |
identifier: '57294', // Required - string - The vehicle identifier for this vehicle. | |
identifierType: 'CAPSHORTCODE', // Required - string - The type of the vehicle identifier. | |
isNew: false, // Required - bool - Whether the vehicle is new or used. | |
cashPrice: '9695', // Required - string - The cash price of the vehicle . | |
imageUrl: 'www.MyUrl.co.uk/Image/car.jpg', // Required - string - The image url of the vehicle. This will be used by the call to actions. | |
linkBackUrl: 'www.MyUrl.co.uk/car', // Required - string - The url for the vehicle details. | |
mileage: '12123', // Required for used - string - The current mileage of the vehicle. | |
options: [{ // Optional - object array - The options this vehicle comes equiped with. | |
description: 'Sunroof', // Required - string - The description of the option. | |
price: 550 // Required - The price of the option. | |
}], | |
accessories: [{ // Optional - object array - The accessories this vehicle comes equiped with. | |
description: 'Mud Flaps', // Required - string - The description of the accessory. | |
price: 50 // Required - number - The price of the accessory. | |
}], | |
registration: { // Required for used - object - The registration details for the vehicle. | |
// Either | |
year: 2002, // Required - number - The year the vehicle registered. | |
plate: '51', // Required - string - The plate of the vehicle. | |
// Or | |
date: '2013-02-07', // Required - string - The registration date of the vehicle in the format 'yyyy-mm-dd'. | |
number: 'BT02BCY' // Required - string - The registration number for the vehicle. | |
}, | |
technicalSpecification: { // Optional - The description of the vehicle. | |
manufacturer: 'BMW', // Optional - string - The manufacturer of the vehicle | |
description: '3 Series Diesel Touring 316d Sport 5dr', // Optional - string - The full description of the vehicle excluding manufacturer. | |
model: '3 Series', // Optional - string - The model of the vehicle. | |
variant: 'Diesel Touring', // Optional - string - The variant of the vehicle. | |
derivative: '316d Sport 5dr', // Optional - string - The derivative of the vehicle. | |
bodyStyle: 'hatchback', // Optional - string - The bodystyle of the vehicle e.g. hatchback, saloon, etc. | |
colour: 'Mahogany', // Optional - string - The colour of the vehicle. | |
doors: 5, // Optional - number - The number of doors that the vehicle has. | |
transmission: 'manual', // Optional - string - The transmission type of the vehicle e.g. manual, automatic, etc. | |
fuelType: 'diesel', // Optional - string - The fuel type of the vehicle e.g. petrol, diesel, electric, etc. | |
cO2Emissions: '135', // Optional - string - The CO2 emissions of the vehicle | |
engineCapacity: 1400 ,// Optional - number - The engine size for the vehicle e.g. 1400 for 1.4L | |
yearOfManufacture: 2014 // Optional - number - The year of manufacture of the vehicle e.g. 2014 | |
}, | |
dateVehicleEnteredStock: '2013-02-07' // Optional - string - This is the date the the dealer first received the vehicle | |
}, | |
dealer: 'Codeweavers Associated Plugin Dealer', // Optional - string - The associated dealer for this calculation. | |
emailFunction: function (emailer) { // Optional - function - This allows you to override the default email me this quote behaviour with your own implementation. If omitted the default plugin form will be used. | |
emailer.send({ // Required - object - This will send the email. | |
formValues: { // Required - object - The form values are captured by you and stored within a JavaScript object. | |
emailAddress: 'cwtest@codeweavers.net' // Required - string - The finance plug-in can handle any number of values, however the 'emailAddress' value is required. | |
}, | |
onSuccess: function (message) { }, // Optional - function - This method is called when an email has been successfully sent by the plug-in. The message parameter will contain a message that can be displayed to your user. | |
onError: function (message) { } // Optional - function - This method is called when there was an error sending the email. The message parameter will contain a message that can be displayed to your user. | |
}); | |
}, | |
defaultParameters: { // Optional - object - Sets the default values for the customer parameters . | |
deposit: { // Optional - object - The default values for the customer deposit. | |
defaultValue: '2500' // Optional - string - The default value for the deposit. | |
}, | |
term: { // Optional - object - The default value for the term, and the minimum and maxmum values for the drop down box. | |
defaultValue: 36, // Optional - number - The default value for the term. | |
minimumValue: 12, // Optional - number - The minumum value for the term dropdown box. | |
maximumValue: 60 // Optional - number - The maximum value for the term dropdown box. | |
}, | |
annualMileage: { // Optional - object - The default value for the annual mileage, and the minimum and maxmum values for the drop down box. | |
defaultValue: 18000, // Optional - number - The default value for the annual mileage. | |
minimumValue: 10000, // Optional - number - The minumum value for the annual mileage dropdown box. | |
maximumValue: 60000 // Optional - number - The maximum value for the annual mileage dropdown box. | |
} | |
}, | |
customerReference: 'customerReference', // Optional - string - The unique reference for this customer. | |
options: { // Optional - object - The options for the plugin | |
dontCalculateOnLoad: false, // Optional - bool - Setting this option to true will stop the plugin calculating when it first loads | |
disableAutomaticRecalculation: false, // Optional - bool - This can toggle off the automatic recalculation when a parameter is changed | |
recalculationFadeSpeed: 100, // Optional - number - The speed (in milliseconds) in which the plugin will fade in/out on a recalculation (Setting this value to 0 will stop the plugin from fading in/out) | |
recalculationFadeAmount: 100 // Optional - number - The amount (in percentage) in which the plugin will fade in/out on a recalculation (Setting this value to 0 will stop the plugin from fading in/out) | |
} | |
}); | |
} | |
</script> | |
</head> | |
<body onLoad = "loadPlugin()"> | |
<div id = "PLUGIN_DIV_ID"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment