update pay ui
This commit is contained in:
@@ -175,10 +175,13 @@ class AlipayPay:
|
|||||||
dict: 包含支付URL的响应
|
dict: 包含支付URL的响应
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
# 金额格式化为两位小数(支付宝要求)
|
||||||
|
formatted_amount = f"{float(total_amount):.2f}"
|
||||||
|
|
||||||
# 业务参数
|
# 业务参数
|
||||||
biz_content = {
|
biz_content = {
|
||||||
'out_trade_no': out_trade_no,
|
'out_trade_no': out_trade_no,
|
||||||
'total_amount': str(total_amount),
|
'total_amount': formatted_amount,
|
||||||
'subject': subject,
|
'subject': subject,
|
||||||
'product_code': 'FAST_INSTANT_TRADE_PAY', # 电脑网站支付固定值
|
'product_code': 'FAST_INSTANT_TRADE_PAY', # 电脑网站支付固定值
|
||||||
'timeout_express': timeout_express,
|
'timeout_express': timeout_express,
|
||||||
@@ -209,7 +212,7 @@ class AlipayPay:
|
|||||||
|
|
||||||
# 日志输出到 stderr,避免影响 subprocess JSON 输出
|
# 日志输出到 stderr,避免影响 subprocess JSON 输出
|
||||||
import sys
|
import sys
|
||||||
print(f"[AlipayPay] Order created: {out_trade_no}, amount: {total_amount}", file=sys.stderr)
|
print(f"[AlipayPay] Order created: {out_trade_no}, amount: {formatted_amount}", file=sys.stderr)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'success': True,
|
'success': True,
|
||||||
|
|||||||
5
app.py
5
app.py
@@ -2770,8 +2770,11 @@ def create_alipay_order():
|
|||||||
subject = f"VFr-{plan_display_name}"
|
subject = f"VFr-{plan_display_name}"
|
||||||
body = f"价值前沿订阅服务-{plan_display_name}"
|
body = f"价值前沿订阅服务-{plan_display_name}"
|
||||||
|
|
||||||
|
# 金额格式化为两位小数(支付宝要求)
|
||||||
|
amount_str = f"{float(amount):.2f}"
|
||||||
|
|
||||||
create_result = subprocess.run(
|
create_result = subprocess.run(
|
||||||
[sys.executable, script_path, 'create', order.order_no, str(float(amount)), subject, body],
|
[sys.executable, script_path, 'create', order.order_no, amount_str, subject, body],
|
||||||
capture_output=True, text=True, timeout=60
|
capture_output=True, text=True, timeout=60
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user