changeCard.py
1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#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