chore: initialize tuhui repository
This commit is contained in:
60
backend/app/ysm_sdk/tmp/quick_test.py
Normal file
60
backend/app/ysm_sdk/tmp/quick_test.py
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
易收米支付SDK快速测试
|
||||
|
||||
简单的支付功能测试脚本
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import time
|
||||
from pay import create_payment
|
||||
|
||||
async def quick_payment_test():
|
||||
"""快速支付测试"""
|
||||
print("易收米支付快速测试")
|
||||
print("=" * 40)
|
||||
|
||||
# 配置信息 - 请替换为你的真实配置
|
||||
appid = 'YSMcd16b45d'
|
||||
appsecret = '899850e778e8d2b53e4c4a4e88695688'
|
||||
|
||||
# 生成测试订单号
|
||||
order_id = f"test_{int(time.time())}"
|
||||
|
||||
print(f"创建测试订单: {order_id}")
|
||||
print(f"金额: 0.01元")
|
||||
print(f"支付类型: 微信内支付")
|
||||
|
||||
try:
|
||||
# 创建支付订单
|
||||
pay_url = await create_payment(
|
||||
appid=appid,
|
||||
appsecret=appsecret,
|
||||
order_id=order_id,
|
||||
description="测试商品",
|
||||
amount=1, # 1分钱
|
||||
notify_url="http://your-domain.com/notify",
|
||||
nopay_url="http://your-domain.com/cancel",
|
||||
callback_url="http://your-domain.com/success",
|
||||
pay_type=1
|
||||
)
|
||||
|
||||
if pay_url:
|
||||
print("支付订单创建成功!")
|
||||
print(f"支付链接: {pay_url}")
|
||||
print()
|
||||
print("使用说明:")
|
||||
print(" 1. 复制上方链接到微信中打开")
|
||||
print(" 2. 完成支付测试")
|
||||
print(" 3. 可以使用query.py查询订单状态")
|
||||
|
||||
else:
|
||||
print("支付订单创建失败")
|
||||
|
||||
except Exception as e:
|
||||
print(f"创建支付时出错: {str(e)}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(quick_payment_test())
|
||||
Reference in New Issue
Block a user