def jdpay_wap(): env_name, root_url, live_key, app_id = datagen.get_current_env() url = "{0}/v1/charges".format(root_url) # request body charge = Model.ChargeBase.ChargeDict charge['order_no'] = random_str(10) charge['subject'] = 'TestOrder4jdpay_wap' charge['body'] = 'appletest4Pay' charge['amount'] = 10 charge['channel'] = 'jdpay_wap' charge['currency'] = 'cny' charge['client_ip'] = '127.0.0.1' id = [('id', app_id)] extra = [("success_url", "http://pingxx.com"), ("fail_url", "htpps://pingxx.com")] charge['app'] = dict(id) charge['extra'] = dict(extra) mycharge = APIClient._http_call(url, "post", "json", "json", None, {"Authorization": "Bearer {0}".format(live_key)}, 30, **charge) print(mycharge) sshCmd.ssh_cmd("114.215.237.77", "56f27c2B", "echo "">/var/www/example/ziteng") threading._start_new_thread(sshCmd.ssh_cmd("114.215.237.77", "56f27c2B", "echo "">/var/www/example/ziteng")) time.sleep(5) Forward.forward_json(mycharge) ret = sshCmd.ssh_cmd("114.215.237.77", "56f27c2B", "echo "">/var/www/example/ziteng") print ret if int(filter(lambda x: x.isdigit(), ret)) > 1: print "The charge file had updated on %s" % ctime() else: print "forward the charge to update file again..." threading._start_new_thread(sshCmd.ssh_cmd("114.215.237.77", "56f27c2B", "echo "">/var/www/example/ziteng")) time.sleep(2) Forward.forward_json(mycharge)
def yeepay_wap(): env_name, root_url, live_key, app_id = datagen.get_current_env() url = "{0}/v1/charges".format(root_url) # request body charge = Model.ChargeBase.ChargeDict() charge['order_no'] = random_str(10) charge['subject'] = "TestOrder4YeepayWap" charge['body'] = "appletesting4Pay" charge['amount'] = 10 charge['channel'] = "yeepay_wap" charge['currency'] = "cny" charge['client_ip'] = "127.0.0.1" id = [("id", app_id)] extra = [("product_category", "1"), ("identity_id", "d2:bf:11:78:09:69"), ("identity_type", "0"), ("terminal_type", "1"), ("terminal_id", "d2:bf:11:78:09:69"), ("user_ua", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:36.0) Gecko/20100101 Firefox/36.0"), ("result_url", "https://pingxx.com")] charge['extra'] = dict(extra) charge['app'] = dict(id) myCharge = APIClient._http_call(url, "post", "json", "json", None, {"Authorization": "Bearer {0}".format(live_key)}, 30, **charge) print(myCharge) sshCmd.ssh_cmd("114.215.237.77", "56f27c2B", "echo "">/var/www/example/ziteng.php") threading._start_new_thread(sshCmd.ssh_cmd, ("114.215.237.77", "56f27c2B", "php /var/www/example/client4ziteng.php")) time.sleep(5) Forward.forward_json(myCharge) ret = sshCmd.ssh_cmd("114.215.237.77", "56f27c2B", "echo $(stat -c %s /var/www/example/ziteng.php)") print ret if int(filter(lambda x: x.isdigit(), ret)) > 1: print "The charge file had updated on %s" % ctime() else: print "forward the charge to update the file again..." threading._start_new_thread(sshCmd.ssh_cmd, ("114.215.237.77", "56f27c2B", "php /var/www/example/client4ziteng.php")) time.sleep(2) Forward.forward_json(myCharge)
def bfb_wap(): env_name, root_url, live_key, app_id = datagen.get_current_env() url = "{0}/v1/charges".format(root_url) # request body charge = Model.ChargeBase.ChargeDict() charge['order_no'] = random_str(10) charge['subject'] = "TestOrder4bfbWap" charge['body'] = "appletesting4Pay" charge['amount'] = 10 charge['channel'] = "bfb_wap" charge['currency'] = "cny" charge['client_ip'] = "127.0.0.1" id = [("id", app_id)] extra = [("result_url", "http://pingxx.com"), ("bfb_login", "false")] charge['extra'] = dict(extra) charge['app'] = dict(id) myCharge = APIClient._http_call(url, "POST", "json", "json", None, {"Authorization": "Bearer {0}".format(live_key)}, 30, **charge) print(myCharge) sshCmd.ssh_cmd("114.215.237.77", "56f27c2B", "echo "">/var/www/example/ziteng.php") threading._start_new_thread(sshCmd.ssh_cmd, ("114.215.237.77", "56f27c2B", "php /var/www/example/client4ziteng.php")) time.sleep(5) Forward.forward_json(myCharge) ret = sshCmd.ssh_cmd("114.215.237.77", "56f27c2B", "echo $(stat -c %s /var/www/example/ziteng.php)") print ret if int(filter(lambda x: x.isdigit(), ret)) > 1: print "The charge file had updated on %s" % ctime() else: print "forward the charge to update the file again..." threading._start_new_thread(sshCmd.ssh_cmd, ("114.215.237.77", "56f27c2B", "php /var/www/example/client4ziteng.php")) time.sleep(2) Forward.forward_json(myCharge)