To make the integration of the RESTful finance calulation service as simple as possible we have also created a PHP class which consumes the service
that you can simply drop into your existing PHP project.
Here you will find the neccessary files and documentation needed to integrate this class into your project.
Calling The Service
There are 4 available public function 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,
rateType,
rate
)
Calculate( 25500, 20080501 );
Calculate( 15000, 20080501, $this->ycle->RateType->Apr, 10.1 );
Calculate( 25500, 20080401, $this->ycle->RateType->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,
rateType,
rate
)
CalculateWithFinanceOptions( 25500, 20080501, 1250, 36 );
CalculateWithFinanceOptions( 15000, 20080501, 1250, 24, $this->ycle->RateType->Apr, 10.1 );
CalculateWithFinanceOptions( 25500, 20080401, 1250, 54, $this->ycle->RateType->Commission, 125 );
Parameter Description And Formatting
Calculate With RV
The
CalculateWithRV 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.
CalculateWithRV(
cashPrice,
regDate,
currentMileage,
capCode,
rateType,
rate
)
CalculateWithRV( 25500, 20080501, 12500, 'FOKA13ZC73HPIM' );
CalculateWithRV( 15000, 20080501, 16500, 35165, $this->ycle->RateType->Apr, 10.1 );
CalculateWithRV( 25500, 20080401, 1200, 'FOKA13ZC73HPIM', $this->ycle->RateType->Commission, 125 );
Parameter Description And Formatting
Calculate With RV And Finance Options
The
CalculateWithRVAndFinanceOptions 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.
CalculateWithRVAndFinanceOptions(
cashPrice,
regDate,
currentMileage,
capCode,
deposit,
annualMileage,
term,
rateType,
rate
)
CalculateWithRVAndFinanceOptions( 25500, 20080501, 12500, 'FOKA13ZC73HPIM', 3000, 12000, 36 );
CalculateWithRVAndFinanceOptions( 15000, 20080501, 16500, 35165, 3000, 12000, 36, ¬ $this->ycle->RateType->Apr, 10.1 );
CalculateWithRVAndFinanceOptions( 25500, 20080401, 1200, 'FOKA13ZC73HPIM', 3000, 12000, 36, ¬ $this->ycle->RateType->Commission, 125 );
Parameter Description And Formatting
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 numeric value of 8 digits in length, in the SortableDateFormat known as ISO 8601, typically defined as yyyyMMdd.
20081225 (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.
$this->ycle->RateType->Apr
$this->ycle->RateType->Commission
$this->ycle->RateType->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)