2026-08-06 20:39:45 +08:00
|
|
|
import requests
|
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
from yarl import URL
|
|
|
|
|
|
|
|
|
|
from wechat_微信支付证书.江苏六果科技服务商支付证书.江苏六果科技有限公司服务商支付参数 import six六果服务商支付参数
|
|
|
|
|
from wechat_项目工具包.微信支付工具包.微信支付类 import wechatPay
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class weiPay服务商电子发票(BaseModel):
|
|
|
|
|
# demo_必填: int = Field(..., description="描述") # 必传属发生
|
|
|
|
|
# demo_可选: Optional[int] = None # 可选值
|
|
|
|
|
# demo_默认值: int = Field(default=100001, description="描述") # 有默认值
|
|
|
|
|
# demo_联合类型: Literal["xiao", "zizi"] = Field(..., description="描述")
|
|
|
|
|
|
|
|
|
|
def model_post_init(self, __context):
|
2026-08-10 19:33:59 +08:00
|
|
|
pass
|
2026-08-06 20:39:45 +08:00
|
|
|
|
|
|
|
|
def 获取开通服务商电子发票能力邀请链接(self):
|
|
|
|
|
pass
|
|
|
|
|
uri = URL.build(
|
|
|
|
|
scheme='https',
|
|
|
|
|
host="api.mch.weixin.qq.com",
|
|
|
|
|
path="/v3/new-tax-control-fapiao/fapiaomerchant/getspinviteurl",
|
|
|
|
|
query={
|
|
|
|
|
"operation_type": "AUTH_BINDING",
|
2026-08-10 19:33:59 +08:00
|
|
|
"fapiao_mode": ["TENCENT_DIGITAL_TAX"], # 【开票模式】 邀请商户开通服务商电子发票的可选开票模式
|
2026-08-06 20:39:45 +08:00
|
|
|
"fapiao_ability_type_list": ["BASE_ABILITY"],
|
|
|
|
|
"invite_code": "code_20260805_123", # 必填 【服务商邀请code】 服务商邀请的唯一标识,由服务商生成,可根据邀请code查询邀请开通情况
|
|
|
|
|
# "sub_mchid": "1700383419"
|
2026-08-10 19:33:59 +08:00
|
|
|
"taxpayer_id": "91321202MAE608K31Q"
|
2026-08-06 20:39:45 +08:00
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
print(uri)
|
|
|
|
|
headers = wechatPay(payment=six六果服务商支付参数).构造签名串(uri=str(uri), method="GET")
|
2026-08-10 19:33:59 +08:00
|
|
|
headers.update({"Wechatpay-Serial": "1880A972F4400AF653A108F5F0C7A71585A4338E"})
|
2026-08-06 20:39:45 +08:00
|
|
|
getData = requests.get(url=uri, headers=headers)
|
|
|
|
|
print(getData.text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
pass
|
|
|
|
|
weiPay服务商电子发票().获取开通服务商电子发票能力邀请链接()
|