from typing import *
import base64
import os
import hashlib
import time
import requests
import xml.etree.ElementTree as ET
import logging


# 统一下单接口
URL_ACCESS_TOKEN: str = ...
URL_JS_TICKET: str = ...
UNIFIED_ORDER_URL: str = ...
SEND_REDPACK_URL: str = ...


class Weixin:
    appid: str
    appsecret: str
    mchid: str  # (支付必需)商户ID，微信商户平台(pay.weixin.qq.com)->产品中心->开发配置->商户号
    paykey: str  # (支付必需)签名用Key，微信商户平台(pay.weixin.qq.com)->账户中心->账户设置->API安全->密钥设置
    certpath: str  # (退款、发红包等必需)证书所在路径，此路径下需包含apiclient_cert.pem和apiclient_key.pem两个文件
    debug: bool  # 是否打印debug日志
    def __init__(self, *, appid: str, appsecret: str, mchid: str=..., paykey: str=..., certpath: str=..., debug: bool=...) -> None: ...
    @staticmethod
    def make_nonce() -> str: ...
    def create_unified_order_sign(self, params) -> str: ...
    def create_unified_order_xml(self, params) -> str: ...
    def debug_log(self, content) -> None: ...
    def request_prepay_and_get_jspay_sign(self, body, billno, fee, ip, openid, notifyurl) -> Dict: ...
    def send_redpack(self, billno, fee, ip, openid, send_name, wishing, act_name, remark) -> Dict: ...
    def access_token(self) -> Dict: ...
    def js_ticket(self, access_token) -> Dict: ...
    def config_sign(self, js_ticket, url) -> Dict: ...
    def payed(self, data: bytes) -> Dict: ...
