Your Car Loan Embedded

ASP Wrapper for RESTful Service Documentation

To make the integration of the RESTful finance calulation service as simple as possible we have also created a VBScript class which consumes the service that you can simply drop into your existing ASP Classic project.

Here you will find the neccessary files and documentation needed to integrate this class into your project.

Download

The neccessary files and tests can be downloaded in ZIP format below. The tests have been provided as futher examples of how to use the YcleCalculation class.

Version 0.2.0 - 23/05/2008

Including In Project

Once you have downloaded the required files simply extract them into your current project in a separate 'ycle' folder and include the following code block into all pages that will be required to do a finance calculation.
<!--#include file="ycle/YcleCalculation.class.asp"-->

Initialising The Object

To initialise the object you simply need to added the following code block.
Dim ycle
Set ycle = new YcleCalculation
ycle.DealerName = "DealerName"
In the above code block the DealerName will be supplied to you by us; this simply needs to be inserted as a string value.

Calling The Service

There are 8 available public functions in the YcleCalculation class, each detailed below.

The following function descriptions are using the format detailed below.
Function Name( Required Parameter, Optional Parameter )

Calculate

The Calculate function has the following parameters and will perform a basic HP (Hire Purchase) calculation returning the calculation response XML as a string.
Calculate( cashPrice, regDate )
ycle.Calculate( 25500, "01/05/2008" )
Parameter Description And Formatting

Calculate With Rate

The CalculateWithRate function has the following parameters and will perform a HP (Hire Purchase) calculation using the supplied rate returning the calculation response XML as a string.
CalculateWithRate( cashPrice, regDate, rateType, rate )
ycle.CalculateWithRate( 15000, "01/05/2008", ycle.APR, 10.1 )
ycle.CalculateWithRate( 25500, "01/05/2008", ycle.Commission, 125 )
Parameter Description And Formatting

Calculate With Finance Options

The CalculateWithFinanceOptions function has the following parameters and will perform a HP (Hire Purchase) calculation using the supplied finance options returning the calculation response XML as a string.
CalculateWithFinanceOptions( cashPrice, regDate, deposit, term )
ycle.CalculateWithFinanceOptions( 25500, "01/05/2008", 1250, 36 )
ycle.CalculateWithFinanceOptions( 15000, "01/05/2008", 1250, 24 )
Parameter Description And Formatting

Calculate With Finance Options And Rate

The CalculateWithFinanceOptionsAndRate function has the following parameters and will perform a HP (Hire Purchase) calculation using the supplied finance options and rate returning the calculation response XML as a string.
CalculateWithFinanceOptionsAndRate( cashPrice, regDate, deposit, term rateType, rate )
ycle.CalculateWithFinanceOptionsAndRate( 15000, "01/05/2008", 1250, 36, ycle.APR, 10.1 )
ycle.CalculateWithFinanceOptionsAndRate( 25500, "01/05/2008", 1250, 24, ycle.Commission, 125 )
Parameter Description And Formatting

Calculate With RV

The CalculateRV function has the following parameters and will perform a basic HP (Hire Purchase) and RV (Residual Value) based calculation returning the calculation response XML as a string.
CalculateRV( cashPrice, regDate, currentMileage, capCode )
ycle.CalculateRV( 25500, "01/05/2008", 12500, 'FOKA13ZC73HPIM' )
ycle.CalculateRV( 25500, "01/04/2008", 1200, 35165 )
Parameter Description And Formatting

Calculate With RV And Rate

The CalculateRVWithRate function has the following parameters and will perform a HP (Hire Purchase) and RV (Residual Value) based calculation using the supplied rate returning the calculation response XML as a string.
CalculateRVWithRate( cashPrice, regDate, currentMileage, capCode, rateType, rate )
ycle.CalculateRVWithRate( 25500, "01/05/2008", 12500, 'FOKA13ZC73HPIM', ycle.APR, 9.8 );
ycle.CalculateRVWithRate( 15000, "01/05/2008", 16500, 35165, ycle.Commission, 150 );
Parameter Description And Formatting

Calculate With RV And Finance Options

The CalculateRVWithFinanceOptions function has the following parameters and will perform a HP (Hire Purchase) and RV (Residual Value) based calculation using the supplied finance options returning the calculation response XML as a string.
CalculateRVWithFinanceOptions( cashPrice, regDate, currentMileage, capCode, deposit, annualMileage, term )
ycle.CalculateRVWithFinanceOptions( 25500, "01/05/2008", 12500, 'FOKA13ZC73HPIM', 1000, 10000, 36 )
ycle.CalculateRVWithFinanceOptions( 15000, "01/05/2008", 16500, 35165, 500, 12000, 24 )
Parameter Description And Formatting

Calculate With RV And Finance Options And Rate

The CalculateRVWithFinanceOptionsAndRate function has the following parameters and will perform a HP (Hire Purchase) and RV (Residual Value) based calculation using the supplied finance options and rate returning the calculation response XML as a string.
CalculateRVWithFinanceOptionsAndRate( cashPrice, regDate, currentMileage, capCode, deposit, annualMileage, term, rateType, rate )
ycle.CalculateRVWithFinanceOptionsAndRate( 25500, "01/05/2008", 12500, 'FOKA13ZC73HPIM', 1000, 10000, 36, ycle.APR, 9.8 )

ycle.CalculateRVWithFinanceOptionsAndRate( 15000, "01/05/2008", 16500, 35165, 500, 12000, 24, ycle.Commission, 100 )
Parameter Description And Formatting

Parameter Description And Formatting

Type Checking

As VBScript uses variant types it is not possible to enforce compile time type checking on function calls. We have therefore implemented our own type checking which will ensure that valid numbers and registration dates are passed through where they are needed for the implementation.

If you send through invalid types the library will write out an HTML comment into your rendered page indicating which type is incorrect.
<!-- The cash price you have provided is not a number -->
Examples of these can be seen by running the unit tests - as some of the tests purposely submit incorrect values these messages should appear in the unit test results frame

Cash Price

This needs to be a valid numeric value between 1000 and 1000000 (exclusive) with no currency signs or commas ( £ or , )
5999.00 (i.e. £5,999.00)

Registration Date

This needs to be a valid string representation of a date, typically of the format dd/mm/yyyy. The order of the month and day will be dependant of the Time settings on the server, so if this is set to a U.S. Time format, then the date will need to be in the format mm/dd/yyyy.
25/12/2008 (i.e. Christmas 2008)

Current Mileage

This needs to be a valid numeric value between 0 and 1000000 (exclusive)

Cap Code

This needs to be either a valid 14-20 digit CapCode or a valid numeric CapId between 1000 and 1000000 (exclusive)
FOKA13ZC73HPIM
35165

Deposit

This needs to be a valid numeric value between 0 and 1000000 (exclusive) with no currency signs or commas( £ or , )
1250.00 (i.e. £1,250.00)

Annual Mileage

This needs to be a valid numeric value between 6000 and 30000 rounded to the nearest thousand

Term Length

This needs to be a valid numeric value, expressed in months, between 24 and 60 inclusive.

Rate Type

A RateType property of the YcleCalulcation class has been created to make the selection easier. If supplied it needs to be one of the following values, however this is an optional parameter (unless Rate is supplied). If not supplied the default type will be used of Commission.
ycle.Apr
ycle.Commission
ycle.CustomerRate

Rate

This is optional. If not supplied the default of 0 will be used. If supplied this value will need to reflect either a commission or percentage depending on the selected option above. The value needs to be a valid numeric value with currency signs, commas and percentage signs (£ or , or %) removed.
100 (i.e. commission of £100)
7.9 (i.e. 7.9% or £7.90 dependant on rate type)

Unit Testing Suite

ASP Unit

This library has been created using Test Driven Development with the xUnit derivative for ASP known as ASPUnit. The full test suite is availble for use under the BSD license. Feel free to use the tests as further examples and for ensuring the library is working correctly on your system. To run the unit tests extract the test archive to a folder under your IIS webserver and point a Virtual Directory to the "src" source folder. The following URL should then open the unit test suite:
http://yourservername/yourvirtualdirectory/test/index.asp
Check the box marked "Show Passing Tests" and hit the "Run Tests" button. If everything is working you should get a list of successful tests in green.

Example File

The full source code also includes a basic example file that should perform a calculation and present the results as XML in a browser. This is the index.asp file in the app directory and can be reached by following the Virtual Directory setup as detailed above, and hitting the following URL:
http://yourservername/yourvirtualdirectory/app/index.asp

Open Source

Licensing

The ASP Classic Wrapper in VBScript for YourCarLoan Embedded is issued under the BSD License and can be updated and extended as needed. Please submit patches to support@codeweavers.net