Valuate Finance Plugin

Plugin options interface

interface PluginOptions {
  token?: string
  selector?: string
  onComplete?: (data: DAT2.Response.GetVehicleEvaluation['VXS']) => void
  onCompleteBackend?: (data: DAT2.Response.GetVehicleEvaluation['VXS']) => void
  onUpdate?: (data: DAT2.Response.GetVehicleEvaluation['VXS']) => void
  credentials?: {
    customerNumber: string
    user: string
    password: string
  }
  backdatedEvaluationData?: {
    evaluationDate: DAT2.Request.GetVehicleTargetDateEvaluationHistory['evaluationDate']
  }
  requestData: {
    datECode: string // 15 digits
    container: string // [country flag; 2 digits]+[number of container; 3 digits]
    mileage: number // numeric
    constructionTime: number // [4 digits; numeric]
    registrationDate: string
    restriction: string // 'APPRAISAL'
    save: string // TRUE, FALSE
    vatType?: 'R' | 'D' // R = Rule taxing, D = Difference taxing
    equipment: {
      equipmentPosition?: Array<{
        datEquipmentId?: number // numeric
      }>
    }
  }
  settings?: {
    country?: string
  }
}

Plugin example with UI

<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- load plugin styles -->
    <link
      href="https://plugins.wedat.eu/valuate-finance/plugin.css"
      rel="stylesheet"
    />
  </head>
  <body>
    <!-- element to which plugin will be rendered -->
    <div class="plugin"></div>

    <!-- load plugin JS synchronously -->
    <script src="https://plugins.wedat.eu/valuate-finance/plugin.js"></script>

    <!-- init plugin options in your JS file or inline JS like this -->
    <script>
      window.VALUATE_FINANCE_API.init({
        selector: '.plugin',
        onComplete: (values) => {
          console.log(values)
        },
        onCompleteBackend: (values) => {
          console.log(values)
        },
        onUpdate: (values) => {
          console.log(values)
        },
        requestData: {
          datECode: '012851200090002',
          container: 'IT008',
          mileage: 40000,
          constructionTime: 4728,
          registrationDate: '2010-02-26',
          restriction: 'APPRAISAL',
          save: 'TRUE',
          vatType: 'D',
          equipment: {
            equipmentPosition: [
              {
                datEquipmentId: 24085
              },
              {
                datEquipmentId: 68703
              },
              {
                datEquipmentId: 47518
              }
            ]
          }
        }
      })
    </script>
  </body>
</html>

Plugin example without UI

<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- no need to load styles -->
  </head>
  <body>
    <!-- load plugin JS synchronously -->
    <script src="https://plugins.wedat.eu/valuate-finance/plugin.js"></script>

    <!-- init plugin options in your JS file or inline JS like this -->
    <script>
      window.VALUATE_FINANCE_API.init({
        <!-- selector prop is not provided -->
        <!-- credentials or token are required -->
        credentials: {
          customerNumber: 'customerNumber',
          user: 'user',
          password: 'password'
        },
        onComplete: (values) => {
          // make what your want :)
          console.log(values)
        },
        onCompleteBackend: (values) => {
          // make what your want :)
          console.log(values)
        },
        requestData: {
          datECode: '012851200090002',
          container: 'IT008',
          mileage: 40000,
          constructionTime: 4728,
          registrationDate: '2010-02-26',
          restriction: 'APPRAISAL',
          save: 'TRUE',
          vatType: 'D',
          equipment: {
            equipmentPosition: [
              {
                datEquipmentId: 24085
              },
              {
                datEquipmentId: 68703
              },
              {
                datEquipmentId: 47518
              }
            ]
          }
        }
      })
    </script>
  </body>
</html>

Plugin example without UI for BackEnd request

<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- no need to load styles -->
  </head>
  <body>
    <!-- load plugin JS synchronously -->
    <script src="https://plugins.wedat.eu/valuate-finance/plugin.js"></script>

    <!-- init plugin options in your JS file or inline JS like this -->
    <script>
      window.VALUATE_FINANCE_API.init({
        <!-- selector prop is not provided -->
        <!-- credentials or token are required -->
        credentials: {
          customerNumber: 'customerNumber',
          user: 'user',
          password: 'password'
        },
        onCompleteBackend: (values) => {
          // make what your want :)
          console.log(values)
        },
        backdatedEvaluationData: {
          evaluationDate: '2020-02-26'
        },
        requestData: {
          datECode: '012851200090002',
          container: 'IT008',
          mileage: 40000,
          constructionTime: 4728,
          registrationDate: '2010-02-26',
          restriction: 'APPRAISAL',
          save: 'TRUE',
          vatType: 'D',
          equipment: {
            equipmentPosition: [
              {
                datEquipmentId: 24085
              },
              {
                datEquipmentId: 68703
              },
              {
                datEquipmentId: 47518
              }
            ]
          }
        }
      })
    </script>
  </body>
</html>