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

异步通知校验makeNotifyResponse schema验证失败问题 #46

Closed
keith666666 opened this issue Apr 6, 2019 · 1 comment
Closed

Comments

@keith666666
Copy link

版本信息

"version": "3.0.8",

原因

代码中的参数和alipay请求传送过来的参数不一致,导致schema验证失败.

分析

代码中的schema(alipay/src/validator/schema/notify.ts):

export const notifySchema: Joi.ObjectSchema = Joi.object({
  notify_time: Joi.string().required(),
  notify_type: Joi.string().required(),
  notify_id: Joi.string().required(),
  app_id: Joi.string().required(),
  version: Joi.string().required(),
  sign_type: Joi.string().required(),
  sign: Joi.string().required(),
  trade_no: Joi.string().required(),
  out_trade_no: Joi.string().required()
})

alipay请求传送的参数(取自alipay异步通知示例):

total_amount:2.00
buyer_id:2088102116773037
body:大乐透2.1
trade_no:2016071921001003030200089909
refund_fee:0.00
notify_time:2016-07-19 14:10:49
subject:大乐透2.1
sign_type:RSA2
charset:utf-8
notify_type:trade_status_sync
out_trade_no:0719141034-6418
gmt_close:2016-07-19 14:10:46
gmt_payment:2016-07-19 14:10:47
trade_status:TRADE_SUCCESS
version:1.0
sign:kPbQIjX+xQc8F0/A6/AocELIjhhZnGbcBN6G4MM/HmfWL4ZiHM6fWl5NQhzXJusaklZ1LFuMo+lHQUELAYeugH8LYFvxnNajOvZhuxNFbN2LhF0l/KL8ANtj8oyPM4NN7Qft2kWJTDJUpQOzCzNnV9hDxh5AaT9FPqRS6ZKxnzM=
gmt_create:2016-07-19 14:10:44
app_id:2015102700040153
seller_id:2088102119685838
notify_id:4a91b7a78a503640467525113fb7d8bg8e

服务器同步/异步通知参数说明

解决方案

  • 方法1: 完善代码中的schema
  • 方法2: 移除对异步通知对校验
@Luncher
Copy link
Owner

Luncher commented Apr 8, 2019

💯 谢谢

@Luncher Luncher closed this as completed Apr 8, 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

2 participants