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
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