IMS SDK Product Document
  • Getting Started
    • iOS
      • Requirements
      • Importing the SDK
      • Permissions
      • Initializing the SDK
      • Using the SDK
        • Using Push Notifications
          • Push notification certificate and profile creation guide
    • Android
      • Requirements
      • Import the SDK
      • Permissions
      • Obfuscation
      • Initialize the SDK
      • Using the SDK
        • Trip Detection and Recording
          • Trip Manager Configuration
            • Using TripDetector.AWARENESS
            • Trip Manager Device Support
          • Trip Manager Control
          • Trip Manager Status
        • Bluetooth and Other Devices
    • React Native
      • Requirements
      • Import the SDK
      • Permissions
      • Initialize the SDK
        • Android
        • iOS
      • Using the SDK
        • Trip Manager
        • Device service
    • Flutter
      • Requirements
      • Import the SDK
      • Permissions
      • Initialize the SDK
      • Using the SDK
  • Security
  • App misuse
  • Time Driven Without Phone
  • DriveSync Portal
    • Requirement
    • User
    • Device
    • Driving Alert
    • Push Notification
    • Invitations
    • Subscription
    • Trip
    • Location
    • Driving Summary
    • Discount
    • Scoring
    • Vehicle
    • Leaderboard
    • Rewards
    • Submit consent to EULA
    • Legal documents and FAQ
    • Named Driver
    • Wedge
  • Known Issues
    • iOS
    • Android
      • 1.17.0
      • 1.18.0
      • 1.22.0
  • Releases
    • 1.13.0
      • iOS
      • Android
    • 1.14.0
      • Android
    • 1.15.0
      • iOS
      • Android
    • 1.15.1
    • 1.16.0
      • iOS
      • Android
    • 1.17.0
      • iOS
      • Android
    • 1.18
      • iOS
      • Android
    • 1.18.1
    • 1.19.0
      • iOS
      • Android
    • 1.20.0
      • Android
      • iOS
    • 1.21.0
      • Android
      • iOS
    • 1.22.0
      • Android
      • iOS
    • 1.23.0
      • Android
      • iOS
    • 1.24.0
      • Android
      • iOS
    • 1.24.1
      • iOS
  • Migration
    • iOS
      • 1.15.x -> 1.16.0
      • 1.16.0 -> 1.17.0
      • 1.17.0 -> 1.18.0
      • 1.18.0 -> 1.19.0
      • 1.19.0 -> 1.20.0
      • 1.20.0 -> 1.21.0
      • 1.21.0 -> 1.22.0
      • 1.22.0 -> 1.23.0
      • 1.23.0 -> 1.24.0
      • 1.24.0 -> 1.24.1
    • Android
      • 1.15.x -> 1.16
      • 1.16 -> 1.17
      • 1.17 -> 1.18
      • 1.18 -> 1.19
      • 1.19 -> 1.20
      • 1.20 -> 1.21
      • 1.21 -> 1.22
      • 1.22 -> 1.23
      • 1.23 -> 1.24
  • Support
Powered by GitBook
On this page
  • Discount
  • Discount Metadata
  • Discount by vehicle
  1. DriveSync Portal

Discount

Handles Discount related requests with IMS web services.

PreviousDriving SummaryNextScoring

Last updated 5 months ago

Discount

The SDK allows for the host application to retrieve discount related data, which in turn can be used by the host application to fetch data from the Discount system (see documentation for the Discount).

This service will return the current discount and projected discount, alongside some useful discount information. Discount values may not always be available due to insufficient driving data.

To fetch discount data, the following API can be used.

Concrete example

let service = DiscountService()
service.fetchDiscount(then: { discount in
    guard !discount.value.isEmpty else {
        // failure
        return
    }
    completionHandler(.success(discount.value))
})
val discountService = DiscountService()
discountService.fetchDiscount() { result: Result<DiscountMetaData>? ->
     if (result?.value == null || result.throwable != null) {
            // failure
        } else {
            // Success
           val discountMetaData: DiscountMetaData = result?.value
            completionHandler(discountMetaData)
        }

 }

Discount Metadata

Represents the mapping between scores ranges and discounts. The mappings of scores are represented as Ranges of Doubles to be consistent with the scoring values.

Any valid user on the DriveSync system (identified via the Identityset during ) should be able to know how discount is calculated (score ranges vs discounts), so that driver knows how his/her driving style affecting his/her discount.

To fetch discount mapping data, the following API can be used.

Concrete example

let service = DiscountMetadataService()
service.fetchDiscountMetadata(then: { discount in
    guard !discount.value.isEmpty else {
        // failure
        return
    }
    completionHandler(.success(discount.value))
})
val discountMetadataService = DiscountMetadataService()
discountMetadataService.fetchMapping() { result: Result<List<DiscountMapping>>? ->
    val discountMappings = result?.value
    val error = result?.throwable
    if (discountMappings != null) {
        // Success
        completionHandler(discountMappings)
    } else if (error != null) {
        // Failure
        errorHandler(error)
    }
}

Discount by vehicle

The SDK allows for the host application to retrieve discount related data by vehicle, which in turn can be used by the host application to fetch data from the Discount system (see documentation for the Discount).

This service will return the current discount and projected discount, alongside some useful discount information. Discount values may not always be available due to insufficient driving data.

Required information

vehicleId: Since each account can be linked to multiple vehicles, vehicle ID is passed.

To fetch discount data by vehicle, the following API can be used.

Concrete example

val discountService = DiscountService()
discountService.fetchDiscountByVehicle(vehicleId) { result: Result<DiscountMetaData>? ->
     if (result?.value == null || result.throwable != null) {
            // failure
        } else {
            // Success
           val discountMetaData: DiscountMetaData = result?.value
            completionHandler(discountMetaData)
        }

 }
SDK initialization