ManuSquall / paps-sdk

A nodejs integration of paps.sn API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Coverage Status License Npm version Npm downloads .github/workflows/integrate.yml Issues PR

Paps API integration

Fully tested API integration of https://paps.sn with typescript

Gain some extra time by using this library if you're looking looking forward to integrate delivery system on your website.

Usage

Development

cp sample.env .env
// modify .env to match your credentials at developers.paps.sn

// lint
yarn lint

// build before pushing to make sure everything is working
yarn build

// run the tests
yarn test

NodeJS

const Paps = require('node-paps')
const dotenv = require('dotenv')
dotenv.config()
const { NODE_ENV, PAPS_API_KEY, PAPS_API_URL } = process.env
const IN_PRODUCTION = NODE_ENV === 'production'

const paps = new Paps({
  apiKey: PAPS_API_KEY,
  test: !IN_PRODUCTION,
  url: PAPS_API_URL
})
// use as you want
// paps.createPickup({...})
// paps.createPickupAndDelivery({...})
// paps.createDelivery({...})
// paps.viewTask({...})
// paps.viewTasks({...})

Typescript

import Paps from 'node-paps'
import dotenv from 'dotenv'
dotenv.config()
const { NODE_ENV, PAPS_API_KEY, PAPS_API_URL } = process.env
const IN_PRODUCTION = NODE_ENV === 'production'

const paps = new Paps({
  apiKey: PAPS_API_KEY,
  test: !IN_PRODUCTION,
  url: PAPS_API_URL
})
// use as you want
// paps.createPickup({...})
// paps.createPickupAndDelivery({...})
// paps.createDelivery({...})
// paps.viewTask({...})
// paps.viewTasks({...})

Documentation

You want some doc ? Read the tests

TODO

  • tests: cover all use cases
  • get the support team at paps.sn to clarify some API response
  • use mock instead of hitting real endpoint

License

Contributors

Babacar Cissé DIA

About

A nodejs integration of paps.sn API

License:MIT License


Languages

Language:TypeScript 97.3%Language:JavaScript 2.5%Language:Shell 0.2%