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

payment-sandbox

v1.0.6

Published

支付回调沙箱:解密加密参数,构造回调报文,发送到 JSON / Redis / Pulsar

Readme

payment-sandbox

支付回调沙箱工具。从加密的交易参数中还原订单信息,构造标准支付回调报文,JSON 输出、发送到 Redis 或 Pulsar,用于本地调试支付回调处理逻辑。

安装

npm install -g payment-sandbox

快速开始

第一步:配置

# 配置解密密钥(md5Key)
payment-sandbox config key

# 配置默认接收方式(json / redis / pulsar)
payment-sandbox config mode

# 配置 Pulsar Tenant(默认 PC)
payment-sandbox config tenant

# 配置 Redis 连接
payment-sandbox config redis

# 配置 Pulsar 连接
payment-sandbox config pulsar

# 查看当前配置
payment-sandbox config

配置保存在 ~/.payment-sandbox/config.json,一次配置,到处复用。所有配置项敲回车表示不修改当前值。

第二步:发送回调

payment-sandbox send

交互流程:

  1. 粘贴加密交易参数(自动解密并预览 module / category / innerOrderNo)
  2. 选择回调结果(successful / failed / pending)
  3. 选择 isKeytop(Y / N,默认 Y)
  4. 选择 paymentMethod(或 random 随机)
  5. 选择 paymentType(或 random 随机)
  6. 选择 bankType(或 random 随机)

工具会按照全局配置的接收方式发送回调,并输出提取信息和发送结果。

命令一览

| 命令 | 说明 | |---|---| | payment-sandbox | 查看当前配置 | | payment-sandbox config | 查看当前配置 | | payment-sandbox config key | 配置 md5Key | | payment-sandbox config mode | 配置默认接收方式 | | payment-sandbox config tenant | 配置 Pulsar Tenant(默认 PC) | | payment-sandbox config redis | 配置 Redis 连接 | | payment-sandbox config pulsar | 配置 Pulsar 连接 | | payment-sandbox send | 发送支付回调 |

项目级 Profile

如果不同项目使用不同的加密规则或 topic 模板,可以在项目目录放置 payment-sandbox.json(或 profiles/project-profile.json),工具会自动加载并与默认配置合并。

参考模板:profiles/project-profile.example.json

注意payment-sandbox.json 通常包含项目密钥,不要提交到代码仓库。

接收方式

| 方式 | 说明 | |---|---| | json | 将回调报文输出到终端,不发送任何网络请求,适合快速验证 | | redis | 通过 PUBLISH / LPUSH / RPUSH 发送到指定 topic | | pulsar | 通过 pulsar-client 发布到指定 topic |

本地接收测试

如果需要本地 HTTP 端点接收回调:

node $(npm root -g)/payment-sandbox/scripts/mock-receiver.js --port 8080 --path /callback

无头模式

也可以直接传入 JSON 文件执行,适合脚本调用:

node $(npm root -g)/payment-sandbox/scripts/run-sandbox.js --input input.json

input.json 格式参考:examples/manual-input.json

License

ISC