Click or drag to resize

TaxCalculatorServiceGetTax Method

OFV Kjøretøydata service

Tax calculation for new vehicle imported into Norway.

Returns object-tree with all taxes specified

Namespace:  OfvTaxData.Service
Assembly:  OfvTaxData.Service (in OfvTaxData.Service.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public TaxDTO GetTax(
	UserDTO user,
	int vehicleGroup,
	string date,
	int weight,
	int power,
	string co2,
	string nox,
	int fuel,
	int energysource,
	Nullable<int> batteryRange,
	string format
)

Parameters

user
Type: OfvService.DTO.LoginUserDTO
UserDTO
vehicleGroup
Type: SystemInt32
Vehiclegroup code for vehicle to calculate tax for
date
Type: SystemString
Current date or a date back inn time for history taxes
weight
Type: SystemInt32
Weight of vehicle without driver
power
Type: SystemInt32
Power of combustion engine (do not specify electric engine power or total power of combustion- and electric-engine)
co2
Type: SystemString
CO2 emission from combustion engine
nox
Type: SystemString
NOx emmission from combustion engine
fuel
Type: SystemInt32
Fuel code for combustion engine
energysource
Type: SystemInt32
Energysource code for vehicle
batteryRange
Type: SystemNullableInt32
Battery range for hybrid vehicle
format
Type: SystemString
json/xml - which format result will be delivered in.

Return Value

Type: TaxDTO
Return an object-tree of TaxItem, status of request and a description that gives any exceptions.
Remarks
To see at list of valid input values - run method GetAvailableInputValuesTax(UserDTO, String) using UserDTO as input.
Examples
Here`s an example on how to calculate tax for a vehicle.
Input
function callGetTax(serviceURI) {
    var jsonData = JSON.stringify(
        {
            "user": {
                "username": "username",
                "password": "encrypted password",
                "ipaddress": "internet ip-address of requester"
            },
            "vehicleGroup": 101,
            "date": "2018-06-01",
            "weight": 1000,
            "power": 100,
            "co2": 100,
            "nox": 10,
            "fuel": 1,
            "energysource": 2,
            "batteryRange": 50
        }
    );
    $.ajax({
        url: serviceURI + "/GetTax?format=json",
        type: "POST",
        data: jsonData,
        dataType: "json",
        contentType: "application/json; charset=utf-8",

        success: function (result) {
            alert(result.SendResult);
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert('ServiceError');
        }
    });
}
Output
{
    "success" : true,
    "data" : {
        "__type" : "TaxItem:#OfvService.DTO.Tax",
        "Heading" : "Personbil 2015",
        "Text" : "Sum",
        "Sum" : "44840",
        "Sorting" : -2,
        "Details" : [{
            "Level" : 1,
            "Heading" : "Avgifter",
            "Text" : "Sum avgifter",
            "Sum" : "44840",
            "Sorting" : -1,
            "Details" : [{
                "Level" : 2,
                "Heading" : "Avgifter",
                "Text" : "Sum engangsavgifter",
                "Sum" : "42440",
                "Details" : []
            }, {
                "Level" : 2,
                "Heading" : "Avgifter",
                "Text" : "Vrakpant",
                "Sum" : "2400",
                "Sorting" : 5000,
                "Details" : []
            }, {
                "Level" : 2,
                "Heading" : "Avgift for egenvekt",
                "Text" : "Sum",
                "Sum" : "39100",
                "Sorting" : 1000000,
                "Details" : [{
                    "Level" : 3,
                    "Heading" : "Avgift for egenvekt",
                    "Text" : "0-1150 (1000 x 39.10)",
                    "Sum" : "39100",
                    "Sorting" : 1000001
                }, {
                    "Level" : 3,
                    "Heading" : "Avgift for egenvekt",
                    "Text" : "1151-1400 (0 x 85.25)",
                    "Sum" : "0",
                    "Sorting" : 1000002
                }, {
                    "Level" : 3,
                    "Heading" : "Avgift for egenvekt",
                    "Text" : "1401-1500 (0 x 170.52)",
                    "Sum" : "0",
                    "Sorting" : 1000003
                }, {
                    "Level" : 3,
                    "Heading" : "Avgift for egenvekt",
                    "Text" : "1501- (0 x 198.31)",
                    "Sum" : "0",
                    "Sorting" : 1000004
                }
                ]
            }, {
                "Level" : 2,
                "Heading" : "Avgift for motoreffekt (kW)",
                "Text" : "Sum",
                "Sum" : "7351",
                "Sorting" : 2000000,
                "Details" : [{
                    "Level" : 3,
                    "Heading" : "Avgift for motoreffekt (kW)",
                    "Text" : "0-70 (70 x 0.00)",
                    "Sum" : "0",
                    "Sorting" : 2000001
                }, {
                    "Level" : 3,
                    "Heading" : "Avgift for motoreffekt (kW)",
                    "Text" : "71-100 (30 x 245.04)",
                    "Sum" : "7351",
                    "Sorting" : 2000002
                }, {
                    "Level" : 3,
                    "Heading" : "Avgift for motoreffekt (kW)",
                    "Text" : "101-140 (0 x 709.60)",
                    "Sum" : "0",
                    "Sorting" : 2000003
                }, {
                    "Level" : 3,
                    "Heading" : "Avgift for motoreffekt (kW)",
                    "Text" : "141- (0 x 1756.12)",
                    "Sum" : "0",
                    "Sorting" : 2000004
                }
                ]
            }, {
                "Level" : 2,
                "Heading" : "Avgift for Co2",
                "Text" : "Sum",
                "Sum" : "-4482",
                "Sorting" : 3000000,
                "Details" : [{
                    "Level" : 3,
                    "Heading" : "Avgift for Co2",
                    "Text" : "0-50 (0 x -1054.66)",
                    "Sum" : "0",
                    "Sorting" : 3000001
                }, {
                    "Level" : 3,
                    "Heading" : "Avgift for Co2",
                    "Text" : "51-105 (5 x -896.41)",
                    "Sum" : "-4482",
                    "Sorting" : 3000002
                }, {
                    "Level" : 3,
                    "Heading" : "Avgift for Co2",
                    "Text" : "0-105 (100 x 0.00)",
                    "Sum" : "0",
                    "Sorting" : 3000003
                }, {
                    "Level" : 3,
                    "Heading" : "Avgift for Co2",
                    "Text" : "106-120 (0 x 795.36)",
                    "Sum" : "0",
                    "Sorting" : 3000004
                }, {
                    "Level" : 3,
                    "Heading" : "Avgift for Co2",
                    "Text" : "121-160 (0 x 801.49)",
                    "Sum" : "0",
                    "Sorting" : 3000005
                }, {
                    "Level" : 3,
                    "Heading" : "Avgift for Co2",
                    "Text" : "161-230 (0 x 1868.43)",
                    "Sum" : "0",
                    "Sorting" : 3000006
                }, {
                    "Level" : 3,
                    "Heading" : "Avgift for Co2",
                    "Text" : "231- (0 x 2999.70)",
                    "Sum" : "0",
                    "Sorting" : 3000007
                }
                ]
            }, {
                "Level" : 2,
                "Heading" : "Avgift for NOx",
                "Text" : "Sum",
                "Sum" : "471",
                "Sorting" : 4000000,
                "Details" : [{
                    "Level" : 3,
                    "Heading" : "Avgift for NOx",
                    "Text" : "0- (10 x 47.11)",
                    "Sum" : "471",
                    "Sorting" : 4000001
                }
                ]
            }
            ]
        }
        ]
    }
}
See Also