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 🙏

© 2024 – Pkg Stats / Ryan Hefner

coa-allin-pay

v1.7.5

Published

通联支付SDK for Node.js

Downloads

104

Readme

coa-allin-pay

GitHub license npm version npm downloads PRs Welcome

通联支付 SDK for Node.js

通联支付是一家综合支付和金融服务提供商,详见 官方网站

说明

  • 本 SDK 主要自用,封装了大部分经常使用到的接口服务,更多的内容后续会根据实际使用情况添加。如果你也正好需要,欢迎一块补充。
  • 服务的方法名称和通联接口文档完全对应,如果你有通联的接口文档,可以直接对照文档直接使用,避免不少踩坑的过程。

快速开始

安装

yarn add coa-allin-pay

直接使用

import { AllinPayBin, AllinPayMemberService, AllinPayMerchantService, AllinPayOrderService } from 'coa-allin-pay'

// 相关配置
const config = {
  endpoint: 'https://fintech.allinpay.com', // 通商云的服务地址
  notify: 'https://example.com', // 自己的通知地址
  accountSetNo: '2000100', // 子账户集
  sysId: '19022700000304000000', // 客户编号
  privateKey: 'XXXXXXXXXXXXXXXXXXXXXXX', // 商户私钥
  allinPublicKey: 'XXXXXXXXXXXXXXXXXXXXX', // 通商云公钥
  bankPrivateKey: 'XXXXXXXXXXXXXXXXXXXXX', // 银行私钥
}

// 初始化配置实例
const bin = new AllinPayBin(config)

// 成员相关服务
const memberService = new AllinPayMemberService(bin)

// 商户相关服务
const merchantService = new AllinPayMerchantService(bin)

// 订单相关服务
const orderService = new AllinPayOrderService(bin)

三个服务的具体用法可详见通联接口文档

自定义 BIN 方法

根据实际需要可以重写部分 bin 方法。可用于记录错误请求日志、推送通知日志等

// 定义一个自定义BIN类
class CustomBin extends AllinPayBin {
  // 推送通知
  onBackReceive(body) {
    // do something
    console.log(body)
  }

  // 请求记录
  onRequest(param, response) {
    // do something
    console.log(param, response)
  }

  // 请求失败
  onRequestError(param, response, error) {
    // do something
    console.log(param, response, error)
  }
}

// 初始化配置实例
const bin = new CustomBin(config)

// 使用成员相关服务
const memberService = new AllinPayMemberService(bin)