changeCard.py 1.79 KB
#coding=utf-8

# @Time    : 2021/6/1 9:54
# @Author  : Ljq
# @File    : changeCard.py
# @Software: PyCharm


"""
    卡片换卡接口
"""

import requests
import json
import re
import time
from commons.scripts import dealContentType as dCT

def getSimpleInfo(gatewayHost=None,clientHeaders=None,cardNo=None):
    """获取卡片信息"""
    url = gatewayHost+f"/account-service/api/account/simpleInfo?cardNo={cardNo}"
    clientHeaders=dCT.jsonCT(clientHeaders)
    res = requests.get(url=url,headers=clientHeaders)
    return res


def getChangeCardFee(gatewayHost=None,clientHeaders=None):
    """获取卡片信息"""
    url = gatewayHost+"/card-web/card/getChangeCardFee.action"
    clientHeaders=dCT.jsonCT(clientHeaders)
    res = requests.get(url=url,headers=clientHeaders)
    return res

def checkCard(gatewayHost=None,clientHeaders=None,cardNo=None,cardType=10,customerId=None):
    """校验卡状态"""
    url = gatewayHost+f"/card-web/cardStorage/checkCard.action?cardNo={cardNo}&cardType={cardType}&customerId={customerId}"
    clientHeaders=dCT.jsonCT(clientHeaders)
    res = requests.get(url=url,headers=clientHeaders)
    return res

def changeCard(gatewayHost=None,clientHeaders=None,**kwargs):
    """

    :param gatewayHost:
    :param clientHeaders:
    :param kwargs: {"newCardNo":"888810026057","serviceFee":1000,"loginPwd":"111111",
                        "cardNo":"888810032426","accountId":104921,"customerId":131136}
    :return:
    """
    url = gatewayHost+"/card-web/card/changeCard.action"
    data={"newCardNo":"888810026057","serviceFee":1000,"loginPwd":"111111","cardNo":"888810032426","accountId":104921,"customerId":131136}
    clientHeaders=dCT.jsonCT(clientHeaders)
    data = dict(data,**kwargs)
    res = requests.post(url=url,headers=clientHeaders,data=json.dumps(data))
    return res