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

@jashine/unipay-poslink

v1.0.0

Published

银联: 扫码支付-被扫

Downloads

11

Readme

Install with:

npm i @jashine/unipay-poslink

Usage Example

const PosLink = require("@jashine/unipay-poslink");

//初始化实例
const posLink = new PosLink({
  gateWay: "https://test-api-open.chinaums.com/v2/poslink/transaction/",
  appid: "f0ec96ad2c3848b5b810e7aadf369e2f",
  appkey: "775481e2556e4564985f5439a5e6a277",
});

//支付
const res = await posLink.pay({
  merchantCode: "123456789900081",
  terminalCode: "00810001",
  transactionAmount: 1,
  transactionCurrencyCode: 156,
  merchantOrderId: "3235212201121929209721434193",
  merchantRemark: "测试单",
  payMode: "CODE_SCAN",
  payCode: "用户手机上的付款码",
  storeId: 128,
});

//交易查询
const res = await posLink.query({
  merchantCode: "123456789900081",
  terminalCode: "00810001",
  // 银商订单号(微信支付里的商户单号,二选一)
  // originalOrderId: "20220119173246100021724711",
  // 商户订单号(商户系统生成的订单号,二选一)
  merchantOrderId:'3235212201121929209721434193'
});

//支付撤销
const res = await posLink.voidpayment(
  {
    merchantCode: '123456789900081',
    terminalCode: '00810001',
    // 银商订单号(微信支付里的商户单号,二选一)
    // originalOrderId: '20220119173246100021724711',
    // 商户订单号(商户系统生成的订单号,二选一)
    merchantOrderId:'3235212201121929209721434193'
  }
);

//退款
const res = await posLink.refund({
  merchantCode: "123456789900081",
  terminalCode: "00810001",
  // refundRequestId: uuidv4().replace(new RegExp('-','gm'), ""),
  refundRequestId: "b73587b0cbed4991gf4530879f3ee643",
  // originalOrderId: "20220119173246100021724711",
  transactionAmount: 1,
  merchantRemark: "我要退款",
  // 商户订单号
  merchantOrderId:'3625202201122919209721444193'
});

//退款查询
const res = await posLink.queryRefund({
  merchantCode: "123456789900081",
  terminalCode: "00810001",
  // originalOrderId: "20220119173246100021724711",
  merchantOrderId:'3625202201122919209721444193',
  refundRequestId: "b73587b0cbed4991gf4530879f3ee643",
});

//统一请求方法,设置msgType的值请求相关的接口,包含所有请求功能,msgType的值根据文档填写,例:支付pay
const res = await posLink.request({
    msgType: 'pay',
    merchantCode: '123456789900081',
    terminalCode: '00810001',
    transactionAmount: 2,
    transactionCurrencyCode: 156,
    merchantOrderId: '3625202201122919209721444193',
    merchantRemark: '测试单',
    payMode: 'CODE_SCAN',
    payCode: '用户手机上的付款码',
    storeId: 1,
  }
);