---
# System prepended metadata

title: Negative Surge Visibility API Doc

---

Negative Surge Visibility API Doc 
===
# v2.1
### Endpoint: `Pricing-Offers`
- **URL:** /v1/me/rides/pricing-offers?current_lat=x&current_lon=y
- **Method:** GET
- **HEADERS**

| KEY                |   VALUE            |  Data Type
| -----------------  |    -----------     |    ---------
| Content-Type |   application/json       |  String
| Authorization |   Bearer {{toekn}}       |  String
| city-id |   {{city-id}}       |  int
| country-id |   {{country-id}}       |  int

- **Query Param**

| KEY                |   VALUE            |  Data Type    | Option
| -----------------  |    -----------     |   --------- | --------    |
| current_lat      |   {{current_lat}}            |  float    | required |
| current_lon      |   {{current_lon}}            |  float    |  required|

**Response**:

- response with 200
- response 500 (Continue the regular work-flow)
```json
{
    "is_negative_surge_applied_bike": true,
    "is_negative_surge_applied_car": true,
    "is_negative_surge_applied_auto": true,
    "surge_message" : {
        "bn": "less fare",
        "en": "less fare",
        "ne": "less fare"
    },
    "is_discount_available_bike": false,
    "is_discount_available_car": false,
    "is_discount_available_auto": false,
    "discount_message": {
        "bn": "",
        "en": "",
        "ne": ""
    }
}
```

| KEY                |   VALUE            |  Data Type    | Option
| -----------------  |    -----------     |   --------- | --------    |
| is_negative_surge_applied_bike      |   {{is_negative_surge_applied_bike}}            |  bool    | required |
| is_negative_surge_applied_car      |   {{is_negative_surge_applied_car}}            |  bool    | required |
| is_negative_surge_applied_auto      |   {{is_negative_surge_applied_auto}}            |  bool    | required |
| is_discount_available_bike      |   {{is_discount_available_bike}}            |  bool    | required |
| is_discount_available_car      |   {{is_discount_available_car}}            |  bool    | required |
| is_discount_available_auto     |   {{is_discount_available_auto}}            |  bool    | required |
| surge_message      |   {{surge_message}}            |  bool    | optional(will be available when negative_surge is applied) |
| discount_message      |   {{discount_message}}            |  bool    | optional(will be available when discount is applied) |
| bn      |   {{bn}}            |  string    |  |
| en      |   {{en}}            |  string    |  |
| ne      |   {{ne}}            |  string    |  |


## Endpoint: `estimation`
- **URL:** /v2/me/rides/estimation?lang=en|bn|ne
- **Method:** POST
- **HEADERS**

| KEY                |   VALUE            |  Data Type
| -----------------  |    -----------     |    ---------
| Content-Type |   application/json       |  String
| Authorization |   Bearer {{token}}       |  String

### Request Payload: (No Changes)
### Response:
- response with 200
```json
{ 
    "bike": {
        "estimated_fare": 416,
        "estimated_fare_applied_promo": 208,
        "is_applied_promo": true,
        "is_negative_surge_applied": false,
        "is_surge_applied": true,
        "surge":{ // new key, Will be available if the surge is applied
         "applied_pickup": false,
         "applied_dropoff": true,
        }
    },
    "car": {
        "estimated_fare": 1355,
        "estimated_fare_applied_promo": 0,
        "is_applied_promo": false,
        "is_negative_surge_applied": true,
        "is_surge_applied": false,
    },
    "carlite": null,
    "lite": null,
    "intercity": {
        "bike": null,
        "car": null,
        "carlite": null,
        "lite": null
    },
}
```

# v2.2
## Endpoint: `ride-create`
- **URL:** /v2/me/rides
- **Method:** POST
- **HEADERS**

| KEY                |   VALUE            |  Data Type
| -----------------  |    -----------     |    ---------
| Content-Type |   application/json       |  String
| Authorization |   Bearer {{toekn}}       |  String


### Request Payload: (No Changes)
### Response:
- response with 200
- 
```json
{
    "hashed_id": "43GJ9P",
    "ride_id": "z1ci99jioebh",
    "success": true,
    "server_time": 1618916873,
    "fare_saved": 20,//nullable
}
```

## Endpoint: Active Rides (user)
- **URL:** `/v1/me/rides/open?with=user/driver`
- **Method:** **GET**
- **HEADERS:**

| KEY                |   VALUE            |  Data Type
| -----------------  |    -----------     |    ---------
| Content-Type |   application/json       |  String
| Authorization |   Bearer {{token}}       |  String

- **Response:**
- response with 200
```json=
{
    "estimated_fare": 416,
    "estimated_fare_applied_promo": 208,
    "seen_with_promo_applied": true,
    "fare_saved": 20,//nullable
}
```


Deployment Plan
===
- Rides-governor
    - Add the following keys into rides-governor/config file
        ```yaml
        h3zone:
          ttl: 1000
          resolution: 9
        ```
    - Merge 'feature/negative-surge-visibility' into master

- Rides-Core
    - Merge 'feature/negative-surge-visibility' into master
    


