Skip to content

Latest commit

 

History

History
86 lines (71 loc) · 2.48 KB

README.md

File metadata and controls

86 lines (71 loc) · 2.48 KB

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 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

Contributors

Babacar Cissé DIA