npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@webdevarif/couriers

v1.0.1

Published

Universal courier service integration package with fraud checking capabilities

Readme

@webdevarif/couriers

A universal courier service integration package with fraud checking capabilities for Steadfast and Pathao courier services.

Features

  • 🚚 Steadfast Courier Integration - Complete API integration for Steadfast courier services
  • 📦 Pathao Courier Integration - Full support for Pathao courier services
  • 🛡️ Fraud Detection - Advanced fraud checking based on delivery history
  • 📱 Phone Number Validation - Bangladeshi mobile number validation and sanitization
  • 🔧 Configurable - Environment-based configuration management
  • 📊 Risk Assessment - Comprehensive risk scoring and recommendations
  • 🎯 TypeScript Support - Full TypeScript definitions included

Installation

npm install @webdevarif/couriers
# or
yarn add @webdevarif/couriers
# or
pnpm add @webdevarif/couriers

Environment Variables

Create a .env file with the following variables:

# Steadfast Configuration
STEADFAST_COURIER_BASE_URL=https://portal.steadfast.com.bd
STEADFAST_COURIER_API_KEY=your_api_key
STEADFAST_COURIER_SECRET_KEY=your_secret_key
STEADFAST_COURIER_TRACK_URL=https://track.steadfast.com.bd

# Pathao Configuration
PATHAO_COURIER_BASE_URL=https://api-hermes.pathao.com
PATHAO_COURIER_CLIENT_ID=your_client_id
PATHAO_COURIER_CLIENT_SECRET=your_client_secret
PATHAO_COURIER_USERNAME=your_username
PATHAO_COURIER_PASSWORD=your_password
PATHAO_COURIER_GRANT_TYPE=password

# General Configuration
COURIER_TIMEOUT=30000
COURIER_ENABLE_LOGGING=true

Quick Start

Basic Usage

import { CourierService } from '@webdevarif/couriers';

// Initialize the service
const courierService = new CourierService();

// Create a Steadfast order
const orderData = {
  invoice: 'INV-001',
  recipient_name: 'John Doe',
  recipient_phone: '01712345678',
  recipient_address: '123 Main Street, Dhanmondi',
  recipient_city: 'Dhaka',
  recipient_area: 'Dhanmondi',
  recipient_zone: 'Zone 1',
  delivery_type: '48',
  item_type: 'Electronics',
  item_quantity: 1,
  item_weight: 0.5,
  item_description: 'Smartphone',
  item_price: 25000
};

const result = await courierService.createSteadfastOrder(orderData);
console.log(result);

Fraud Checking

import { FraudCheckService } from '@webdevarif/couriers';

const fraudService = new FraudCheckService();

// Check for fraud
const fraudData = {
  phone: '01712345678',
  name: 'John Doe',
  address: '123 Main Street, Dhanmondi',
  city: 'Dhaka',
  area: 'Dhanmondi',
  zone: 'Zone 1'
};

const fraudResult = await fraudService.checkFraud(fraudData);
console.log(fraudResult.data?.riskLevel); // 'LOW', 'MEDIUM', 'HIGH', or 'CRITICAL'

Individual Services

import { SteadfastService, PathaoService } from '@webdevarif/couriers';

// Steadfast only
const steadfastService = new SteadfastService({
  baseUrl: 'https://portal.steadfast.com.bd',
  apiKey: 'your_api_key',
  secretKey: 'your_secret_key',
  timeout: 30000,
  enableLogging: true
});

// Pathao only
const pathaoService = new PathaoService({
  baseUrl: 'https://api-hermes.pathao.com',
  clientId: 'your_client_id',
  clientSecret: 'your_client_secret',
  username: 'your_username',
  password: 'your_password',
  grantType: 'password',
  timeout: 30000,
  enableLogging: true
});

API Reference

CourierService

Main service class that provides access to all courier functionality.

Methods

  • createSteadfastOrder(orderData) - Create a Steadfast order
  • trackSteadfastOrder(consignmentId) - Track a Steadfast order
  • checkSteadfastBalance() - Check Steadfast account balance
  • createPathaoOrder(orderData) - Create a Pathao order
  • trackPathaoOrder(consignmentId) - Track a Pathao order
  • checkFraud(data) - Perform fraud check
  • addDeliveryHistory(phone, isSuccessful, orderValue) - Update delivery history

FraudCheckService

Advanced fraud detection based on delivery history and patterns.

Methods

  • checkFraud(data) - Analyze fraud risk
  • addDeliveryHistory(history) - Add delivery history
  • updateDeliveryHistory(phone, isSuccessful, orderValue) - Update history
  • getDeliveryHistory(phone) - Get customer history
  • getAllDeliveryHistory() - Get all history data

Risk Assessment

The fraud check system analyzes:

  • Phone Number Validation - Format and validity checks
  • Delivery History - Success and cancellation rates
  • Order Patterns - Frequency and timing analysis
  • Address Completeness - Location detail validation
  • Risk Scoring - 0-100 scale with recommendations

Risk Levels

  • LOW (0-24): Safe to process
  • MEDIUM (25-49): Monitor closely
  • HIGH (50-69): Require verification
  • CRITICAL (70+): Block order

Error Handling

All methods return a ServiceResponse object:

interface ServiceResponse<T = any> {
  success: boolean;
  data?: T;
  error?: string;
  message?: string;
}

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support, email [email protected] or create an issue on GitHub.