Commit 6e1e9ed8fd7286ba760df822528407dc42f22157

Authored by liujiqiang
1 parent fcf11dfd

测试用例进门缴费防重功能适配

commons/api/entranceFeeBillList/entranceFeeBillList.py
... ... @@ -12,7 +12,7 @@
12 12 import json,time,random,re
13 13 from commons.scripts import dealContentType as dct
14 14 from commons.scripts import jsonToUrlcode
15   -# from commons.MySession import my
  15 +from commons.api.entranceFeeBillList import jmsfToken as jT
16 16 from bs4 import BeautifulSoup
17 17 import urllib.parse
18 18  
... ... @@ -219,10 +219,11 @@ def get_calculateRes(session=None,host="",autocompletecartype=None,**kwargs):
219 219 res = session.useHeadersRequests("post", url=url,data=data,headers=headers)
220 220 return res
221 221  
222   -def do_doPay(session=None,host="",autocompletecartype=None,fee_str="",**kwargs):
  222 +def do_doPay(session=None,host="",jmsfToken=None,autocompletecartype=None,fee_str="",**kwargs):
223 223 """进门单缴费"""
224 224 url = host + "/entranceTrade/doPay.action"
225 225 headers = dct.urlCode()
  226 + headers["jmsf_duplicate_commit_token"]=jmsfToken
226 227  
227 228 data = {"protocolId": "", "pwd": "{pwd}", "clientRedirectTag": "", "viewType": "pay", "optType": "{optType}",
228 229 "optUrl": "", "correctInfo": "{correctInfo}", "weightType": "{weightType}", "id": "{orderId}",
... ... @@ -405,7 +406,14 @@ def do_payOrder(session=None,host="http://test.jmsf.diligrp.com:8385",attrName="
405 406 receivableAmount = receivable
406 407 tareWeightDate = tareWeightDate
407 408  
408   - aa = do_doPay(session=session,host=host, autocompletecartype=autocompletecartype, fee_str=fee_str, pwd=pwd, optType=optType,
  409 + # 获取防重token
  410 + tAmount = chargeTotalAmountYuan
  411 + jmsfToken = jT.get_jmsfDuplicateCommitToken(session=session,host=host,cardNo=ic,fundId=accountId,amount=tAmount,
  412 + customerName=customerName,entranceId=orderId)
  413 + print("jmsfToken",jmsfToken)
  414 +
  415 + aa = do_doPay(session=session,host=host,jmsfToken=jmsfToken, autocompletecartype=autocompletecartype, fee_str=fee_str,
  416 + pwd=pwd, optType=optType,
409 417 weightType=weightType, id=id, goodsId=goodsId, number=number, created=created, status=status,
410 418 source=source,
411 419 correctDiscount=correctDiscount, totalAmount=totalAmount, customerId=customerId,
... ...
commons/api/entranceFeeBillList/jmsfToken.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/10/9 13:32
  4 +# @Author : Ljq
  5 +# @File : jmsfToken.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +
  10 +"""
  11 +
  12 +import json,time,random
  13 +import re
  14 +
  15 +from commons.scripts import dealContentType as dct
  16 +# from commons.MySession import sessionSy
  17 +
  18 +def get_jmsfDuplicateCommitToken(session=None,host="",**kwargs):
  19 + """进门防重接口"""
  20 + url = host + "/pay/index.action"
  21 + headers = dct.jsonCode()
  22 + params = {"bizType":"30","htmlRequest":"1","cardNo":"888810032426","fundId":"107575","amount":"45","customerName":"******","entranceId":"7471"}
  23 + params = dict(params,**kwargs)
  24 + res = session.useHeadersRequests(method="get", url=url, params=params,headers=headers)
  25 + jmsf_duplicate_commit_token = re.findall('name="token" id="token" value="(.*?)">',res.text)[0]
  26 + return jmsf_duplicate_commit_token
  27 +
  28 +# host = "http://test.jmsf.diligrp.com:8385"
  29 +# session = sessionSy
  30 +# res = get_jmsfDuplicateCommitToken(session=session,host=host)
  31 +# print(res)
0 32 \ No newline at end of file
... ...
commons/api/entranceFeeBillList/operationDoFreeze.py
... ... @@ -13,13 +13,15 @@ import json,time, re
13 13 from commons.scripts import dealContentType as dct
14 14 from commons.scripts import jsonToUrlcode
15 15 from commons.api.entranceFeeBillList import entranceFeeBillList as eFBL
  16 +from commons.api.entranceFeeBillList import jmsfToken as jT
16 17 from bs4 import BeautifulSoup
17 18 import urllib.parse
18 19  
19   -def do_doFreeze(session=None,host="",autocompletecartype=None,fee_str="",**kwargs):
  20 +def do_doFreeze(session=None,host="",jmsfToken=None,autocompletecartype=None,fee_str="",**kwargs):
20 21 """进门单缴费"""
21 22 url = host + "/entranceTrade/doFreeze.action"
22 23 headers = dct.urlCode()
  24 + headers["jmsf_duplicate_commit_token"]=jmsfToken
23 25  
24 26 data = {"protocolId": "", "pwd": "{pwd}", "clientRedirectTag": "", "viewType": "pay", "optType": "{optType}",
25 27 "optUrl": "", "correctInfo": "{correctInfo}", "weightType": "{weightType}", "id": "{orderId}",
... ... @@ -197,7 +199,14 @@ def do_freezeOrder(session=None,host="http://test.jmsf.diligrp.com:8385",attrNam
197 199 receivableAmount = receivable
198 200 tareWeightDate = tareWeightDate
199 201  
200   - aa = do_doFreeze(session=session,host=host, autocompletecartype=autocompletecartype, fee_str=fee_str, pwd=pwd, optType=optType,
  202 + # 获取防重token
  203 + tAmount = freezeMoneySymbol
  204 + htmlRequest = 2
  205 + jmsfToken = jT.get_jmsfDuplicateCommitToken(session=session,host=host,cardNo=ic,fundId=accountId,amount=tAmount,
  206 + customerName=customerName,entranceId=orderId,htmlRequest=htmlRequest)
  207 + print("jmsfToken",jmsfToken)
  208 +
  209 + aa = do_doFreeze(session=session,host=host,jmsfToken=jmsfToken, autocompletecartype=autocompletecartype, fee_str=fee_str, pwd=pwd, optType=optType,
201 210 weightType=weightType, id=id, goodsId=goodsId, number=number, created=created, status=status,
202 211 source=source,
203 212 correctDiscount=correctDiscount, totalAmount=totalAmount, customerId=customerId,
... ...