Skip to content

Marketplace Components

Marketplace components

Marketplace Home

CommerceHomeFragment is the fragment displayed by default when opening Marketplace Home. CommerceHomeFragment offers the following capabilities:

  • Switch between Marketplace Home and Order History screens.
  • Displays the shopping cart badge number when there are items added in the food shopping cart and the order is not completed.
  • Request the food brands available and displays them to the user.
  • Performs search for stores when clicking on a certain brand.

Switch between Marketplace Home and Order History

CommerceHomeFragment offers the possibility to switch tabs between Marketplace Home screen and Order History screen through the top-left buttons in the image below:


Displays the shopping cart badge number

CommerceHomeFragment displays a shopping cart badge number containing the number of items in the food shopping cart for an order that has not been placed yet, but started.

Note

In order to have the full functionality, the Voice integration is mandatory.

Request the food brands

CommerceHomeFragment displays the available food brands inside MarketplaceFragment. The food brands information is read from SharedPreferences so that they can be displayed instantly on the UI, but this data is constantly updated with the server data.

When clicking on a food brand picture logo, a search for available stores is performed. Depending of the navigation state, the search is performed along the navigation route(when in active navigation) or based on user's location(when in free drive).

The navigation state is retrieved from the ContextService and the corresponding request/response are defined below:

Navigation status request intent

1
2
3
4
val assistantIntent =Intent("com.telenav.assistant.GET_DOMAIN_CONTEXT_ACTION")
assistantIntent.putExtra("domain","UDE")
assistantIntent.putExtra("request_id",RandomID())
assistantIntent.putExtra("source","app")

Navigation status response intent

1
2
3
val responseIntent = Intent("com.telenav.assistant.GET_DOMAIN_CONTEXT_ACTION")
responseIntent.putExtra("domain", "UDE")
responseIntent.putExtra("context", "NavContextPropertiesModel")

where Data class NavContextPropertiesModel contains information about the context properties.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
data class NavContextPropertiesModel(
    /**
     * The CVP location
     */
    @SerializedName("location")
    val location: ContextServiceLocation? = null,
    /**
     * The type of driving: free or navigation
     */
    @SerializedName("drive_mode")
    val driveMode: DriveMode? = null,
    /**
     * Estimated Time of Arrival in seconds
     */
    @SerializedName("eta")
    val eta: Int? = null,
    /**
     * List of route points, if under navigation
     */
    @SerializedName("route_list")
    val routeList: List<GeoLocation>? = null,
    /**
     * List of destinations, if under navigation
     */
    @SerializedName("destination_list")
    val destinationList: List<FoodStore>? = null
) : Serializable {

    enum class DriveMode {
        @SerializedName("free")
        FREE,
        @SerializedName("navigation")
        NAVIGATION
    }
}

/**
 * Data class which contains information about the location provided by Context Service
 */
data class ContextServiceLocation(

    /**
     * The latitude of the location
     */
    @SerializedName(value = "latitudeInDegrees")
    val latitude: Double = 0.0,

    /**
     * The longitude of the location
     */
    @SerializedName(value = "longitudeInDegrees")
    val longitude: Double = 0.0
) : Serializable

data class GeoLocation(

    /**
     * The latitude of the location
     */
    @SerializedName(value = "lat")
    val latitude: Double = 0.0,

    /**
     * The longitude of the location
     */
    @SerializedName(value = "lon")
    val longitude: Double = 0.0
) : Serializable

Once the Search results are available, Commerce sends an intent containing the search data:

Search results intent

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
val showFoodResultsIntent =Intent("telenav://app.maps/nav/search/show")
showFoodResultsIntent.putExtra("api",1 )
showFoodResultsIntent.putExtra("source","app")
showFoodResultsIntent.putExtra("request_id",RandomID())
showFoodResultsIntent.putExtra("original_domain","ICC_FOOD")
showFoodResultsIntent.putExtra("enable_sorting",true)
showFoodResultsIntent.putExtra("enable_touch",true)
showFoodResultsIntent.putExtra("radius",50)

val geo = URLEncoder.encode("geo:lat,lon","utf-8")
showFoodResultsIntent.putExtra("location", geo)
showFoodResultsIntent.putExtra("query", "MOD Pizza")
showFoodResultsIntent.putExtra("brand", Gson().toJson(brandData))
showFoodResultsIntent.putExtra("search_result", Gson().toJson(brandResultsData))

Note

In case there are some item in the food shopping cart when a brand is clicked, the user has the possibility to start a new order or continue the order that is pending.

Order history

OrderHistoryFragment displays the order history of the logged in user. In case no user is authenticated, an information message is displayed.


Each order history entry provides the basic information about the order, as follows:

Parking order

The Parking order includes the following:

  • parking icon
  • start date and duration
  • the "Canceled" label when having a canceled order
  • the price of the parking reservation


Food order

The Food order includes the following:

  • food brand icon
  • creation date or time
  • items in the shopping cart
  • the quantity for multiple items
  • total price of the order


Order details

Parking reservation details

ParkingOrderDetailsFragment displays the detailed information about a parking reservation. There are 4 types of parking reservation states. Depending on each state, the displayed information is slightly different.

Past reservations displays the following information:

  • creation date
  • payment information(paid amount, card type and last 4 digits of the card)
  • started at
  • duration
  • parking address
  • drive/Add a stop button


Canceled reservations displays the following information:

  • creation date
  • payment information(paid amount, card type and last 4 digits of the card)
  • booked on
  • booking interval
  • parking address
  • drive/add a stop button


In progress reservations displays the following information:

  • creation date
  • payment information(paid amount, card type and last 4 digits of the card)
  • started at
  • remaining
  • parking address
  • drive/add a stop button


Upcoming reservations displays the following information:

  • creation date
  • payment information(paid amount, card type and last 4 digits of the card)
  • starts at
  • duration
  • parking address
  • drive/add a stop button
  • cancel reservation button

Any upcoming reservation will display a button offering the possibility to be canceled, up to one minute before it starts. If the user selects the Cancel reservation button, a confirmation popup is displayed so the user can confirm the cancellation intention or reject it.

The Drive/Add a stop button is used to navigate to the restaurant's address, when the user is in free drive or added as a stop to the current navigation if the user has an active navigation on. In order to obtain the navigation status, a request intent is sent to ContextService(its documentation can be found at Request the food brands).

Food order details

FoodOrderDetailsFragment displays the detailed information about a food order:

  • date and time of the order
  • restaurant information: logo, name and address
  • the list of items and their quantities
  • total price
  • drive/add a stop button

The Drive/Add a stop button is used to navigate to the restaurant's address, when the user is in free drive or added as a stop to the current navigation if the user has an active navigation on. In order to obtain the navigation status, an request intent is sent to ContextService(its documentation can be found at Request the food brands).