fix(pay): 移除支付沙盒模式 v2沙盒模式已下线

This commit is contained in:
xingc
2025-05-06 21:10:22 +08:00
parent 3a49fd1665
commit 4a111fcbdd
2 changed files with 15 additions and 15 deletions

View File

@@ -33,16 +33,17 @@ class BaseClient:
r = await self.session.request(
method, url, headers=headers, params=params, data=data, json=json, **kwargs
)
result = r.json()
if result.get('errcode'):
logger.debug('\n'.join([
f'method : {method}'
f'url : {url}'
f'params : {params}'
f'body : {data or json}'
f'response: {r.text}'
]))
raise WechatApiError('used result: {}'.format(result.get('errcode')))
if 'json' in r.headers.get('Content-Type') or '':
result = r.json()
if result.get('errcode'):
logger.debug('\n'.join([
f'method : {method}'
f'url : {url}'
f'params : {params}'
f'body : {data or json}'
f'response: {r.text}'
]))
raise WechatApiError('used result: {}'.format(result.get('errcode')))
return r
async def get(self, url, headers=None, params=None, **kwargs):
@@ -144,8 +145,6 @@ class WechatPayApi(BaseClient):
self.appi_key = app_key
self.notify_url = notify_url
self.base_url = 'https://api.mch.weixin.qq.com'
if debug:
self.base_url = f'{self.base_url}/sandboxnew'
super().__init__()
@staticmethod
@@ -178,6 +177,7 @@ class WechatPayApi(BaseClient):
total_fee: int,
create_ip: str,
):
"""https://pay.weixin.qq.com/doc/v2/merchant/4011936530"""
url = self.base_url + '/pay/unifiedorder'
params = {
'appid': self.appid,