feat: 分俱乐部付呗收款通道,默认仍走微信直连
小程序前端仍传 wechat;后台可切换 wechat/fubei,支持配置多套付呗并退款按原通道路由。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -858,6 +858,16 @@ class KefuPlatformRefundView(APIView):
|
||||
:param transaction_id: 微信支付订单号(优先使用)
|
||||
:return: {'code': 0, 'msg': '成功', 'refund_id': 'xxx'} 或 {'code': 非0, 'msg': '错误信息'}
|
||||
"""
|
||||
from jituan.services.pay_refund_router import try_fubei_refund
|
||||
from jituan.services.wechat_pay import club_id_from_order
|
||||
fb = try_fubei_refund(
|
||||
out_trade_no=dingdan_id,
|
||||
amount_yuan=jine,
|
||||
club_id=club_id_from_order(dingdan_id),
|
||||
)
|
||||
if fb is not None:
|
||||
return fb
|
||||
|
||||
# 获取配置
|
||||
appid = getattr(settings, 'WEIXIN_APPID', '')
|
||||
mch_id = getattr(settings, 'WEIXIN_MCHID', '')
|
||||
|
||||
@@ -233,6 +233,20 @@ class FaKuanPayView(APIView):
|
||||
else:
|
||||
raise Exception('未知的支付类型')
|
||||
|
||||
from jituan.constants import FUBEI_BIZ_CZJILU
|
||||
from jituan.services.mini_pay_router import maybe_create_fubei_jsapi_params
|
||||
fb_params = maybe_create_fubei_jsapi_params(
|
||||
club_id=pay_club,
|
||||
out_trade_no=dingdanid,
|
||||
amount_yuan=jine,
|
||||
body=PAY_DESCRIPTION,
|
||||
openid=openid,
|
||||
notify_url=NOTIFY_URL,
|
||||
biz_type=FUBEI_BIZ_CZJILU,
|
||||
)
|
||||
if fb_params is not None:
|
||||
return fb_params
|
||||
|
||||
nonce_str = ''.join(random.choices(string.ascii_letters + string.digits, k=32))
|
||||
total_fee = yuan_to_fen(jine)
|
||||
trade_type = 'JSAPI'
|
||||
@@ -720,6 +734,21 @@ class KaohePayView(APIView):
|
||||
else:
|
||||
raise Exception('未知支付类型')
|
||||
|
||||
from jituan.constants import FUBEI_BIZ_CZJILU
|
||||
from jituan.services.mini_pay_router import maybe_create_fubei_jsapi_params
|
||||
_club = resolve_club_id_for_write(self.request, self.request.user)
|
||||
fb_params = maybe_create_fubei_jsapi_params(
|
||||
club_id=_club,
|
||||
out_trade_no=dingdanid,
|
||||
amount_yuan=jine,
|
||||
body=PAY_DESCRIPTION,
|
||||
openid=openid,
|
||||
notify_url=NOTIFY_URL,
|
||||
biz_type=FUBEI_BIZ_CZJILU,
|
||||
)
|
||||
if fb_params is not None:
|
||||
return fb_params
|
||||
|
||||
nonce_str = ''.join(random.choices(string.ascii_letters + string.digits, k=32))
|
||||
total_fee = yuan_to_fen(jine)
|
||||
trade_type = 'JSAPI'
|
||||
|
||||
Reference in New Issue
Block a user