q-koa 12.2.8 → 12.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,7 @@ exports.refund = async ({
30
30
  }) => {
31
31
  if (!ctx) throw new Error('?ctx')
32
32
  const { app, appName } = getAppByCtx(ctx)
33
+ const isPem = is_pem || lodash.get(app, 'appConfig.is_pem', false)
33
34
  const appConfig = getConfig(app)
34
35
  const { mchId, key, appId, partner_key } = await appConfig.getObject(
35
36
  pay_config
@@ -64,7 +65,7 @@ exports.refund = async ({
64
65
  appid: appId,
65
66
  mch_id: mchId,
66
67
  partner_key: key.length > 10 ? key : partner_key, // 微信商户平台API密钥
67
- ...(is_pem
68
+ ...(isPem
68
69
  ? {
69
70
  cert_pem: await fsPromise.readFile(
70
71
  path.resolve(
@@ -103,7 +104,7 @@ exports.refund = async ({
103
104
  }
104
105
 
105
106
  console.log(data)
106
- const { result_code, err_code_des, ...restData } = is_pem
107
+ const { result_code, err_code_des, ...restData } = isPem
107
108
  ? await wxpay.refund(data)
108
109
  : await payObj.refund(data)
109
110
  if (result_code === 'SUCCESS') {
@@ -143,6 +144,7 @@ exports.refundOnly = async ({
143
144
  }) => {
144
145
  if (!ctx) throw new Error('?ctx')
145
146
  const { app, appName } = getAppByCtx(ctx)
147
+ const isPem = is_pem || lodash.get(app, 'appConfig.is_pem', false)
146
148
  const appConfig = getConfig(app)
147
149
  const { mchId, key, appId, partner_key } = await appConfig.getObject(
148
150
  pay_config
@@ -168,7 +170,7 @@ exports.refundOnly = async ({
168
170
  appid: appId,
169
171
  mch_id: mchId,
170
172
  partner_key: key.length > 10 ? key : partner_key, // 微信商户平台API密钥
171
- ...(is_pem
173
+ ...(isPem
172
174
  ? {
173
175
  cert_pem: await fsPromise.readFile(
174
176
  path.resolve(
@@ -197,7 +199,7 @@ exports.refundOnly = async ({
197
199
  }
198
200
 
199
201
  console.log(data)
200
- const { result_code, err_code_des, ...restData } = (await is_pem)
202
+ const { result_code, err_code_des, ...restData } = (await isPem)
201
203
  ? await wxpay.refund(data)
202
204
  : await payObj.refund(data)
203
205
  if (result_code === 'SUCCESS') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "12.2.8",
3
+ "version": "12.3.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -54,7 +54,7 @@
54
54
  "sequelize": "^5.21.3",
55
55
  "static-koa-router": "^1.0.3",
56
56
  "wechat-oauth": "^1.5.0",
57
- "weixin-pay-fork": "^1.0.7",
57
+ "weixin-pay-fork": "^1.0.8",
58
58
  "node-uuid": "^1.4.8",
59
59
  "sha1": "^1.1.1",
60
60
  "redis": "^4.0.3",