Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

企业付款查询报错 #95

Closed
mengkeys opened this issue Jul 18, 2019 · 8 comments
Closed

企业付款查询报错 #95

mengkeys opened this issue Jul 18, 2019 · 8 comments

Comments

@mengkeys
Copy link

模块信息

  • 版本: 2.1.18
  • 函数: transfersQuery
  • 参数: partner_trade_no
  • 模拟: 201907110951141700

函数调用

const config = {...};
const api = new tenpay(config);
api.transfersQuery({
    partner_trade_no: '201907110951141700'
}).then((resp) => {
    console.log(resp);
}).catch((error) => {
    console.error(error)
});

错误信息

{ Error: too long, POST https://api.mch.weixin.qq.com/mmpaymkttransfers/gettransferinfo -1 (connected: false, keepalive socket: false, socketHandledRequests: 0, socketHandledResponses: 0)
headers: {}
    at Object.createSecureContext (_tls_common.js:210:19)
    at Object.connect (_tls_wrap.js:1127:48)
    at Agent.createConnection (https.js:120:22)
    at Agent.createSocket (_http_agent.js:227:26)
    at Agent.addRequest (_http_agent.js:185:10)
    at new ClientRequest (_http_client.js:249:16)
    at Object.request (https.js:289:10)
    at Object.requestWithCallback (/home/user/Programs/NodeJS/tenpay-demo/node_modules/urllib/lib/urllib.js:969:19)
    at /home/user/Programs/NodeJS/tenpay-demo/node_modules/urllib/lib/urllib.js:159:13
    at new Promise (<anonymous>)
  data: undefined,
  path: '/mmpaymkttransfers/gettransferinfo',
  status: -1,
  headers: {},
  res:
   { status: -1,
     statusCode: -1,
     statusMessage: null,
     headers: {},
     size: 0,
     aborted: false,
     rt: 9,
     keepAliveSocket: false,
     data: undefined,
     requestUrls:
      [ 'https://api.mch.weixin.qq.com/mmpaymkttransfers/gettransferinfo' ],
     timing: null,
     remoteAddress: '',
     remotePort: '',
     socketHandledRequests: 0,
     socketHandledResponses: 0 } }
@mengkeys mengkeys mentioned this issue Jul 18, 2019
7 tasks
@befinal
Copy link
Owner

befinal commented Jul 18, 2019

检查证书是否正确,然后检查网络

@mengkeys
Copy link
Author

@befinal 证书应该没问题,APP付款就是用的这个模块, 都是OK的,网络嘛,肯定也是正常

@Qixingchen
Copy link

收款不需要证书

@befinal
Copy link
Owner

befinal commented Jul 18, 2019

企业付款和企业付款查询都需要证书

@mengkeys
Copy link
Author

@befinal p12证书也配置了

@befinal
Copy link
Owner

befinal commented Aug 1, 2019

找到错误原因了吗?

@mengkeys
Copy link
Author

mengkeys commented Aug 7, 2019

@befinal 用postman进行测试是没问题,应该是包中的urllib包的request方法报错的

@mengkeys
Copy link
Author

mengkeys commented Aug 7, 2019

@befinal 可以了,读入证书的时候加了个ascii参数(用了其他包的配置代码)导致的
postman 测了一遍OK
request 包测了一遍 报相同的错误, 排除urllib包错误的可能
后面检查了下实例化的配置,去除多余的ascii选项后OK了,可能之前用到的操作都没有用到pfx证书吧

@mengkeys mengkeys closed this as completed Aug 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants