1.0.2 • Published 4 years ago
@cabt/cabtconnectionmodule v1.0.2
CABT Connection module
This doc reffers to the connection module of our system
Installation
> npm i @cabt/cabtconnectionmodule
How to connect with our real time server
- Import the connection class
import CABTClient from 'cabt/cabtconnectionmodule';
- make a connetion
const CABTClientConnection = new CABTClient(settingObject);
** Here setting object will provided by us.
Pushing Order data to our system
Schema for order data
const OrderSchema = {
OrderPrice: 100,
DeliveryAddress: 'full address here',
DeliveryLatLang: { lat: '12121', lang: 'zxczc' },
PickUpAddress: 'full address here',
PickUpLatLang: { lat: '12121', lang: 'zxczc' },
CustomerDetails:
{
firstname: 'test',
lastname: 'test',
emailId: 'test@test.com',
phoneNumber: +91999999999
},
OrderDetails: [{
qty: 1,
productname: 'testProduct'
}]
}
CABTClientConnection.pushOrderDetails(OrderSchema);
Our Event System On Order
Order Pushed
CABTClientConnection.on('order_pushed', (data) => {
// Your bussiness logic here
})
Order Accepted
CABTClientConnection.on('order_accepted', (data) => {
// Your bussiness logic here
})
OTP Verification Event & Functions
When our rider will eneter the OTP in our App
CABTClientConnection.on('otp_verification_resive_event', (data) => {
// Your bussiness logic for verifing the OTP
})
When you pass the verification
const OTPConfermationObject = {
riderID: 'test_rider_001',
status: true
}
CABTClientConnection.pushOTPVerificationStatus(OTPConfermationObject);
Event for rider location
CABTClientConnection.on('rider_location', (data) => {
// Your business logic.
})
Order Delivery
CABTClientConnection.on('order_deliverd', (data) => {
// Your Bussiness logic
})