Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tride/grab-handler

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tride/grab-handler - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

63

index.js

@@ -0,1 +1,2 @@

require('dotenv').config()
const { create } = require("axios");

@@ -15,4 +16,7 @@ const ms = require("ms");

}
this.baseURL = process.env.NODE_ENV == 'development' ? process.env.DEV_BASE_URL + '/grab' : 'https://p.grabtaxi.com'
this.grabBase = create({
baseURL: "https://p.grabtaxi.com",
baseURL: this.baseURL,
responseType: "json",

@@ -145,3 +149,58 @@ timeout: 10000,

async rideStatus(rideId) {
return await this.grabBase.get(`/api/passenger/v3/rides/${rideId}/status`);
return this.grabBase
.get(`/api/passenger/v3/rides/${rideId}/status`)
.then(response => {
const { data } = response
const driver = {
name: "Dummy Driver",
rating: 4.8,
pictureUrl: "http://google.com",
phoneNumber: "081234567890",
vehicle: {
plate: "B 1234 AA",
name: "Honda Vario"
}
}
const payload = {
service: 'grab',
requestId: rideId,
driver
}
let status = data.status ? data.status.toLowerCase() : data.reason.toLowerCase()
if (status == 'allocated' && data.activeStepIndex > 0)
status = 'on_the_way'
const result = {
'allocating': {
status: 'processing',
...payload
},
'unallocated': {
status: 'not_found',
...payload
},
'allocated': {
status: 'accepted',
...payload
},
'cancelled': {
status: 'canceled',
...payload
},
'on_the_way': {
status: 'on_the_way',
...payload
},
'completed': {
status: 'completed',
...payload
}
}
return result[status]
})
}

@@ -148,0 +207,0 @@

2

package.json
{
"name": "@tride/grab-handler",
"version": "0.4.3",
"version": "0.4.4",
"main": "index.js",

@@ -5,0 +5,0 @@ "repository": "git@github.com:trride/grab-handler.git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc