2.1.1 • Published 4 years ago

beba-node-sdk v2.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

beba-node-sdk

Introduction

This is Beba Node SDK, a product of Anzil Software Ltd for Node.js/Javascript developers to help integrate Pickup and delivery services into their applications easily. The package uses REST API that is documented on https://www.pikieglobal.com/docs.

Installation

npm install beba-node-sdk

Configuration

Set custom environment variables for BEBA_CLIENT_KEY, BEBA_CLIENT_SECRET and BEBA_ENV (i.e live or sandbox) using the export command using the keys you received when registering your application from the developer portal. You can Register for a developer account and get your client_id and secret at Beba Developer Portal.

From linux/mac terminal type

export BEBA_CLIENT_KEY= YOUR_API_CLIENT_KEY export BEBA_CLIENT_SECRET=YOUR_API_CLIENT_SECRET export BEBA_ENV = sandbox

For Windows users check this link for setup instructions

Callback Responses You should be able to register callback urls where the callback responses will be sent.

Usage

  • Require 'beba-node-sdk' in your file.

    var beba = require('beba-node-sdk');

Get Couriers

  • This is used to fetch couriers and drivers based on country and service category

    const request_options= {
        "country_code": " ",
        "category_id":" ",
      };
    
      beba.getCouriers(request_options,function(data){
          console.log(data);
      })

Get Specific Courier

  • This is used to fetch a specific couriers based on courier_id

    const request_options= {
        "courier_id": " ",
      };
    
      beba.getSpecificCourier(request_options,function(data){
          console.log(data);
      })

Get Specific Driver

  • This is used to fetch a specific driver based on driver_id

    const request_options= {
        "driver_id": "",
      };
    
      beba.getSpecificDriver(request_options,function(data){
          console.log(data);
      })

Get Shipping Rate

  • This is used to estimate shipping rate based on pickup and delivery coordinates(distance)

    const request_options= {
        "pickup_latitude":" ",
        "pickup_longitude":" ",
        "delivery_latitude":"",
        "delivery_longitude":" ",
      };
    
    beba.getRates(request_options,function(data){
          console.log(data);
      })

Get Countries

  • This is used to obtain list of beba supported countries

    const request_options={};
    beba.getCountries(request_options,function(data){
           console.log(data);
      })

Get Service Categories

  • This is used to obtain list of all supported services on beba Platform

    const request_options={};
    beba.getServices(request_options,function(data){
           console.log(data);
      })

Get Payment Options

  • This is used to obtain list of payment methods available per country

    const request_options={
           "country_code":""
           };
    beba.getPaymentOptions(request_options,function(data){
           console.log(data);
      })

Get Order Status

  • This is used to obtain the status of an order based on unique order id

    const request_options={
           "unique_id":""  
       };
    beba.getOrderStatus(request_options,function(data){
           console.log(data);
      })

Get Order Detail

  • This is used to obtain the order detail as well as tracking information of an order based on unique id

    const request_options={
           "unique_id":""  
       };
    beba.getOrderDetail(request_options,function(data){
           console.log(data);
      })

Get Nearby Drivers

  • This is used to obtain details of nearby drivers based on radius and current location.
const request_options= {
        "radius": " ",
        "current_latitude": " ",
        "current_longitude": " "
      };

beba.getNearbyDrivers(request_options,function(data){
      console.log(data);
 })

Get Nearby Couriers

  • This is used to obtain details of nearby couriers based on radius and current location.
const request_options= {
        "radius": "",
        "current_latitude": "",
        "current_longitude": ""
      };
beba.getNearbyCouriers(request_options,function(data){
      console.log(data);
 })

Create Shipment

  • This is used to create a shipment request
let item_detail = [
    {
        item_name: "Beef Fry",
        item_quantity: 2,
        unit_cost: 40,
        unit_weight: "",
        unit_volume: "",
    },
    {
        item_name: "Ugali Matumbo",
        item_quantity: 5,
        unit_cost: 50,
        unit_weight: "",
        unit_volume: "",
    },
    {
        item_name: "Italian Pizza",
        item_quantity: 6,
        unit_cost: 20,
        unit_weight: "",
        unit_volume: "",
    },
];


const request_options={
    "unique_id": "45684e0b-8c73-41be-a118-fc7ab1c17694",
    "service_id": "1",
    "customer_name" : "Jane Doe",
    "customer_phone" : "254721123456",
    "customer_email" : "janedoe@gmail.com",
    "pickup_address" : "Safari Park Fly Over, Thika Road, Nairobi, Kenya",
    "pickup_country" : "KENYA",
    "pickup_latitude" : "-1.2256562",
    "pickup_longitude" : "36.88495850000004",
    "customer_city" : "Nairobi, Kenya",
    "business_name" : "ABC Hotel",
    "business_phone" : "254721174236",
    "business_email" : "johndoe@gmail.com",
    "delivery_address" : "Naivas, Outer Ring Road, Nairobi, Kenya",
    "delivery_country" : "KENYA",
    "delivery_latitude" : "-1.2476927",
    "delivery_longitude" : "36.872455",
    "business_city" : "Nairobi , Kenya",
    "courier_id" : "12",
    "driver_id" : "",
    "courier_type" : "1"
    "item_detail" : item_detail,
    "business_hours": "8.00 AM - 5.00 PM",
    "order_value"  : "700",
    "shipping_mode"  : "1",
    "currency_code"  : "KES",
  };

  beba.createShipment(request_options,function(data){
        console.log(data);
    })

Cancel Shipment

  • This is used to cancel shipment based on unique order id

    const request_options={
           "unique_id":" " 
       };
    beba.cancelShipment(request_options,function(data){
           console.log(data);
      })

Reference

REST API Reference

Support

Need support using this package:-

  • api-feedback@pikieglobal.com

Contributors

If you wish to be added as a contributor to this project let us know.

Security

If you discover any security related issues, please email api-feedback@pikieglobal.com

2.1.1

4 years ago

2.1.0

4 years ago

2.0.10

4 years ago

2.0.9

4 years ago

2.0.8

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago