six_006
This commit is contained in:
@@ -54,11 +54,8 @@ class paymentCategory(sixpay六果科技公司):
|
||||
class wechatPay(BaseModel):
|
||||
payment: type[sixpay六果科技公司] | type[six六果服务商支付参数]
|
||||
|
||||
def 构造签名串(self, uri: str, body_data: dict | bytes | str | None = None,
|
||||
method: Optional[Literal["GET", "POST", "PATCH"]] = "POST",
|
||||
):
|
||||
def 构造签名串(self, uri: str, body_data: dict | bytes | str | None = None, method: Optional[Literal["GET", "POST", "PATCH"]] = "POST", ):
|
||||
"""
|
||||
|
||||
"""
|
||||
url_data = re.search(r'/v3.*', string=uri).group()
|
||||
shi_jian_chou = str(int(time.time())) # 时间戳
|
||||
@@ -101,16 +98,13 @@ class wechatPay(BaseModel):
|
||||
str_list = ",".join([f'{key}="{value}"' for key, value in data.items()])
|
||||
# 生成请求头
|
||||
Authorization = f"{s_with_space}{str_list}"
|
||||
headers = {
|
||||
"Content-Type": "application/json", "Authorization": Authorization,
|
||||
}
|
||||
headers = {"Content-Type": "application/json", "Authorization": Authorization, }
|
||||
# headers.update({"Wechatpay-Serial": self.payment.微信支付公钥ID})
|
||||
return headers
|
||||
|
||||
def getpay_jsapi(self, uri, body_data: dict | bytes | str | None = None, method: Optional[
|
||||
Literal["GET", "POST"]] = "POST",
|
||||
):
|
||||
|
||||
headers = self.构造签名串(uri=uri, body_data=body_data, method=method)
|
||||
# 发送请求
|
||||
response: Response = requests.post(url=uri, json=body_data, headers=headers)
|
||||
@@ -309,8 +303,8 @@ class wechatPay(BaseModel):
|
||||
@return:
|
||||
@rtype:
|
||||
"""
|
||||
public_key = RSA.import_key(self.payment.wechat_certificate)
|
||||
# public_key = RSA.import_key(self.payment.pem微信支付公钥)
|
||||
# public_key = RSA.import_key(self.payment.wechat_certificate)
|
||||
public_key = RSA.import_key(self.payment.pem微信支付公钥)
|
||||
Wechatpay_Timestamp = pydash.get(response_headers, "Wechatpay-Timestamp")
|
||||
Wechatpay_Nonce = pydash.get(response_headers, "Wechatpay-Nonce")
|
||||
Wechatpay_Signa = pydash.get(response_headers, "Wechatpay-Signature")
|
||||
|
||||
Reference in New Issue
Block a user