Example #1
0
 def send_simulator_command(self):
     httpConfig = HttpConfig()
     data = {'PaymentID': 'MTIxNjMwMDAwMDgwMjk3OA=='}
     path, method = CmdReader().get_url_method_simulator()
     url = UrlParamPaser().get_url(path, data)
     httpConfig.set_url(url)
     httpConfig.set_headers(
         {'content-type': 'application/x-www-form-urlencoded'})
     return_json = httpConfig.req(method)
     return return_json
Example #2
0
 def send_receive_3d_command(self, html):
     soup = BeautifulSoup(html, 'html.parser')
     httpConfig = HttpConfig()
     strOrderInfo = soup.find('input', {'name': 'strOrderInfo'})["value"]
     strRsXML = soup.find('input', {'name': 'strRsXML'})["value"]
     data = {'strOrderInfo': strOrderInfo, 'strRsXML': strRsXML}
     path, method = CmdReader().get_url_method_3dReceive()
     url = UrlParamPaser().get_url(path, data)
     httpConfig.set_url(url)
     httpConfig.set_headers(
         {'content-type': 'application/x-www-form-urlencoded'})
     return_json = httpConfig.req(method)
     return return_json
Example #3
0
 def send_3d_auth_command(self, xml):
     strRqJson = parse_xml_to_json(xml)
     httpConfig = HttpConfig()
     byteStrRqJson = strRqJson.encode('UTF-8')
     strRq = base64.b64encode(byteStrRqJson)
     data = {'strRq': strRq, 'trans_pwd': '1'}
     path, method = CmdReader().get_url_method_3dAuth()
     url = UrlParamPaser().get_url(path, data)
     httpConfig.set_url(url)
     httpConfig.set_headers(
         {'content-type': 'application/x-www-form-urlencoded'})
     return_json = httpConfig.req(method)
     return return_json
Example #4
0
 def send_acceptpayment_command(self, data, transcode):
     httpConfig = HttpConfig()
     path, method = CmdReader().get_url_method_accept_payment()
     data = dict(sorted(data.items()))  # sorted dictionary by key
     checksum = get_checksum(data,
                             transcode)  # queryString+transcode取得checksum
     data.update({'checksum': checksum})
     url = UrlParamPaser().get_url(path, data)
     httpConfig.set_url(url)
     httpConfig.set_headers(
         {'content-type': 'application/x-www-form-urlencoded'})
     return_json = httpConfig.req(method)
     return return_json
Example #5
0
 def send_cancel_order_command(self, merchantnumber, ordernumber, timestamp,
                               transcode):
     httpConfig = HttpConfig()
     path, method = CmdReader().get_url_method_from_cancel_order()
     params = {
         'merchantnumber': merchantnumber,
         'ordernumber': ordernumber,
         'timestamp': timestamp
     }
     params = dict(sorted(params.items()))  # sorted dictionary by key
     checksum = get_checksum(params,
                             transcode)  # queryString+transcode取得checksum
     params.update({'checksum': checksum})
     url = UrlParamPaser().get_url(path, params)
     httpConfig.set_url(url)
     httpConfig.set_headers(
         {'content-type': 'application/x-www-form-urlencoded'})
     return_json = httpConfig.req(method)
     return return_json