init
This commit is contained in:
69
wechat_pay_config.py
Normal file
69
wechat_pay_config.py
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
微信支付真实配置文件
|
||||
请根据您的微信商户平台信息填写
|
||||
"""
|
||||
|
||||
# 微信支付配置 - 请替换为您的真实信息
|
||||
WECHAT_PAY_CONFIG = {
|
||||
# 基础配置
|
||||
'app_id': 'wx0edeaab76d4fa414', # 微信公众平台AppID
|
||||
'mch_id': '1718543833', # 微信支付商户号
|
||||
'api_key': '141a5753c42526bb44bc44d6c4277664', # 微信商户平台设置的API密钥
|
||||
|
||||
# 证书文件路径
|
||||
'cert_path': './certs/apiclient_cert.pem',
|
||||
'key_path': './certs/apiclient_key.pem',
|
||||
|
||||
# 回调配置
|
||||
'notify_url': 'https://valuefrontier.cn/api/payment/wechat/callback',
|
||||
|
||||
# 其他配置
|
||||
'sign_type': 'MD5',
|
||||
'trade_type': 'NATIVE'
|
||||
}
|
||||
|
||||
# 配置验证函数
|
||||
def validate_config():
|
||||
"""验证配置是否完整"""
|
||||
issues = []
|
||||
|
||||
if WECHAT_PAY_CONFIG['app_id'].startswith('wx你的'):
|
||||
issues.append("❌ app_id 还是示例值,请替换为真实的微信AppID")
|
||||
|
||||
if WECHAT_PAY_CONFIG['mch_id'].startswith('你的'):
|
||||
issues.append("❌ mch_id 还是示例值,请替换为真实的商户号")
|
||||
|
||||
if WECHAT_PAY_CONFIG['api_key'].startswith('你的'):
|
||||
issues.append("❌ api_key 还是示例值,请替换为真实的32位API密钥")
|
||||
|
||||
# 检查证书文件
|
||||
import os
|
||||
for key in ['cert_path', 'key_path']:
|
||||
if not os.path.exists(WECHAT_PAY_CONFIG[key]):
|
||||
issues.append(f"❌ 证书文件不存在: {WECHAT_PAY_CONFIG[key]}")
|
||||
|
||||
return len(issues) == 0, issues
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("微信支付配置验证")
|
||||
print("=" * 50)
|
||||
|
||||
is_valid, issues = validate_config()
|
||||
|
||||
if is_valid:
|
||||
print("✅ 配置验证通过!")
|
||||
else:
|
||||
print("⚠️ 配置存在问题:")
|
||||
for issue in issues:
|
||||
print(f" {issue}")
|
||||
|
||||
print("\n📋 配置步骤:")
|
||||
print("1. 登录微信商户平台 (pay.weixin.qq.com)")
|
||||
print("2. 获取AppID和商户号")
|
||||
print("3. 在API安全中设置32位API密钥")
|
||||
print("4. 下载证书文件并放到 ./certs/ 文件夹")
|
||||
print("5. 更新本文件中的配置信息")
|
||||
|
||||
print("=" * 50)
|
||||
Reference in New Issue
Block a user