New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

@webileapps/routing-v1

Package Overview
Dependencies
Maintainers
3
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webileapps/routing-v1

Recursive payment gateway routing engine and DSL validator

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
8
-73.33%
Maintainers
3
Weekly downloads
 
Created
Source

@webileapps/routing-v1

Recursive payment gateway routing engine and DSL validator.

Install

npm install @webileapps/routing-v1

Usage

const { RecursiveRoutingEngine } = require('@webileapps/routing-v1');

const engine = new RecursiveRoutingEngine();
engine.loadRawRules({
  rules: [
    {
      id: 'upi-lumpsum',
      name: 'UPI Lumpsum',
      conditions: {
        transactionType: { operator: 'equals', value: 'Lumpsum' },
        paymentMode: { operator: 'equals', value: 'UPI' }
      },
      gatewayDistribution: [
        { gatewayId: 'PineLabs', percentage: 60 },
        { gatewayId: 'BillDesk', percentage: 40 }
      ]
    }
  ],
  fallbackRule: [{ gatewayId: 'fallback', percentage: 100 }]
});

const result = engine.routePayment({
  transactionType: 'Lumpsum',
  paymentMode: 'UPI',
  amount: 5000,
  bank: 'HDFC'
});
console.log(result.selectedGateway);

Validator

const { RoutingDSLValidator } = require('@webileapps/routing-v1');
const path = require('path');

// Validate a JSON rules file
const validator = new RoutingDSLValidator(path.join(__dirname, 'rules.json'));
validator.validateConfig(path.join(__dirname, 'rules.json')).then(({ isValid, messages }) => {
  console.log(isValid, messages);
});

Files

  • engine: require('@webileapps/routing-v1/engine')
  • validator: require('@webileapps/routing-v1/validator')
  • schema: require('@webileapps/routing-v1/schema')

License

MIT

Keywords

routing

FAQs

Package last updated on 25 Aug 2025

Related posts