class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.create = Tra.Create(driver) self.common = Common(driver) self.driver = driver def query_domain(self, terminal): log.info("查询支付域名") Home(self.driver).mer_domain() time.sleep(0.5) self.query.input_terminal(terminal) self.common.click_query() time.sleep(0.5) res = self.query.get_res_null() # 判断是否存在域名绑定的终端号 if res == "没有找到相关记录,请重新输入条件进行查询 .": return res return "" def create_domain(self, account, terminal, domain_name): log.info("新增支付域名") Home(self.driver).mer_domain() time.sleep(0.5) self.query.click_create() time.sleep(0.5) self.create.input_mer_no(account) self.create.select_terminal(terminal) self.create.select_md_name(domain_name) self.create.select_client_type("PC端") self.common.click_submit() self.common.confirm_alert()
class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.create_obj = Tra.Create(driver) self.common = Common(driver) self.driver = driver def query_pay_id(self, pay_id): log.info("查询支付ID:{}".format(pay_id)) Home(self.driver).risk_monitor() self.query.input_pay_id(pay_id) self.common.click_query() def get_counterfeit(self, val): # 获取伪冒状态 return self.query.get_table_val(1, val) def create(self, pay_id, reason): log.info("新增伪冒") time.sleep(0.5) self.common.click_mids() self.query.click_counterfeit() time.sleep(0.5) self.create_obj.input_pay_id(pay_id) self.create_obj.input_uo_time() self.create_obj.select_reason(reason) self.common.click_submit()
class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.create = Tra.Create(driver) self.common = Common(driver) self.driver = driver def query_agent(self, account): log.info("查询账户绑定代理商") Home(self.driver).agent_merchant() time.sleep(0.5) self.query.input_mer_no(account) self.common.click_query() time.sleep(0.5) res = self.query.get_res_null() if res == "没有找到相关记录,请重新输入条件进行查询 .": return res return "" def create_agent(self, account, terminal): log.info("创建账户绑定代理商") Home(self.driver).agent_merchant() time.sleep(0.5) self.query.click_create() time.sleep(1) self.create.input_agent_no("1002") self.create.input_mer_no(account) self.create.select_terminal(terminal) self.common.click_submit()
class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.create = Tra.Create(driver) self.common = Common(driver) self.driver = driver def query_subject(self, bank, subject, settle): log.info("查询主体信息") Home(self.driver).subject_info() time.sleep(0.5) self.query.select_bank_name(bank) self.query.select_subject(subject) self.query.select_settle(settle) self.common.click_query() time.sleep(0.5) res = self.query.get_res_null() if res == "没有找到相关记录,请重新输入条件进行查询 .": return res return "" def create_subject(self, data_dict): log.info("创建主体信息") Home(self.driver).subject_info() time.sleep(0.5) self.query.click_create() time.sleep(0.5) for item in data_dict: if item == "银行名称": self.create.select_bank_name(data_dict[item]) elif item == "通道主体": self.create.select_channel(data_dict[item]) elif item == "结算主体": self.create.select_settle(data_dict[item]) self.common.click_submit()
class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.create = Tra.Create(driver) self.verify = Tra.Verify(driver) self.common = Common(driver) self.driver = driver def query_contract(self, account): log.info("查询合同信息") Home(self.driver).merchant_contract() time.sleep(0.5) self.query.input_mer_no(account) self.common.click_query() time.sleep(0.5) # 判断是否审核/复核合同信息 res = self.common.get_table_val("1", "状态") if res == "已审核": return "1" elif res == "已复核(成功)": return "2" return "" def create_contract(self, account): log.info("新增合同信息") Home(self.driver).merchant_contract() time.sleep(0.5) self.query.click_create() time.sleep(0.5) self.create.input_mer_no(account) self.create.select_init_date() self.create.select_end_date() self.create.click_auto_renew() self.create.select_contract_type("a101") self.create.select_start_date() self.common.click_submit() def verify_contract(self, account): log.info("复核合同信息") Home(self.driver).merchant_contract() time.sleep(0.5) self.query.input_mer_no(account) self.common.click_query() self.common.click_mids() self.query.click_verify() # 判断是否出现警告框 is_alert = self.common.confirm_alert() if not is_alert: self.verify.select_status("已复核(成功)") self.common.click_submit()
class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.create = Tra.Create(driver) self.common = Common(driver) self.driver = driver def query_channel(self, terminal, channel, card_type): log.info("查询终端号通道绑定: 查询终端号和卡种") Home(self.driver).terminal_to_channel() time.sleep(0.5) self.query.input_terminal(terminal) # 选择通道 self.query.select_channel(channel.split("(")[0]) # 不存在通道绑定的卡种 lack_list = [] for val in card_type.split(","): val_str = val.strip() log.info("卡种: {}".format(val_str)) self.query.select_card(val_str) self.common.click_query() time.sleep(0.5) # 判断是否存在此终端号和卡种的扣率 res = self.query.get_res_null() if res == "没有找到相关记录,请重新输入条件进行查询 .": lack_list.append(val) return lack_list def bind_channel(self, account, terminal, paymethod, card_type, bank_code, channel): log.info("终端号绑定通道") Home(self.driver).terminal_to_channel() time.sleep(0.5) self.query.click_create() time.sleep(1) self.create.input_mer_no(account) self.create.select_terminal(terminal) self.create.select_pay_method(paymethod) self.create.select_card(card_type) self.create.select_bank(bank_code) self.create.select_channel(channel) self.create.select_pay_type("首次收款") self.create.select_open_author("是") self.create.select_auto_author("是") self.create.select_bind("正常") self.common.click_submit() self.common.confirm_alert()
class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.common = Common(driver) self.driver = driver def query_pay_id(self, pay_id): log.info("查询支付ID") Home(self.driver).formal_query() self.query.input_pay_id(pay_id) self.common.click_query() def get_trade_status(self, val): # 获取交易状态 ele_val = self.common.get_table_val(2, val) return self.driver.get_attrval( (5, "xpath", ele_val["状态栏"] + "/img[1]"), "title")
class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.create = Tra.Create(driver) self.common = Common(driver) self.driver = driver def query_paybank(self, code): log.info("查询支付银行") Home(self.driver).pay_bank() time.sleep(0.5) self.query.input_bank_code(code) self.common.click_query() time.sleep(0.5) res = self.query.get_res_null() if res == "没有找到相关记录,请重新输入条件进行查询 .": return res return "" def create_paybank(self, data_dict): log.info("创建支付银行") Home(self.driver).pay_bank() time.sleep(0.5) self.query.click_create() time.sleep(0.5) text_list = [ "银行代码", "银行名称", "银行支付URL", "银行自动对账URL", "银行退款URL", "银行校验URL", "银行后台管理网址", "提交地址", "对账地址", "接收地址", "退款地址", "调用方法名", "备注" ] radio_list = ["是否直连", "是否参与结算", "是否开启交易监控", "是否支持退款"] select_list = ["支付方式"] for item in data_dict: if item in text_list: self.create.input_text(item, data_dict[item]) elif item in radio_list: self.create.click_radio(item, data_dict[item]) elif item in select_list: self.create.select_item(item, data_dict[item]) elif item == "支持国家": for str_val in data_dict[item].split(","): self.create.click_bank_country(str_val) self.common.click_submit()
class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.create = Tra.Create(driver) self.common = Common(driver) self.driver = driver def query_param(self, method, bank, channel): log.info("查询通道参数配置") Home(self.driver).channel_param() time.sleep(0.5) self.query.select_pay_method(method) self.query.select_bank_name(bank) self.query.select_channel_name(channel) self.common.click_query() time.sleep(0.5) res = self.query.get_res_null() if res == "没有找到相关记录,请重新输入条件进行查询 .": return res return "" def create_param(self, data_dict): log.info("创建通道参数配置") Home(self.driver).channel_param() time.sleep(0.5) self.query.click_create() time.sleep(0.5) text_list = [ "参数值1", "参数值2", "参数值3", "参数值4", "参数值5", "参数值5", "参数值6", "参数值7", "参数值8", "MPI特殊参数1", "MPI特殊参数2", "MPI特殊参数3", "MPI特殊参数4", "MPI特殊参数5", "备注" ] select_list = ["支付方式", "银行名称", "通道名称", "通道币种"] for item in data_dict: if item in select_list: self.create.select_item(item, data_dict[item]) elif item in text_list: self.create.input_text(item, data_dict[item]) self.common.click_submit()
class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.assign = Tra.Assign(driver) self.common = Common(driver) self.driver = driver def get_account(self): log.info("获取账户号") Home(self.driver).merchant_info() time.sleep(0.5) self.common.click_query() return self.common.get_table_val("1", "账户") def query_account(self, account): Home(self.driver).merchant_info() time.sleep(0.5) self.query.input_mer_no(account) self.common.click_query() res = self.common.get_table_val("1", "状态") if res == "正常": return "1" elif res == "未激活": return "0" log.info("获取账户状态{}".format(res)) return "" def assign_roles(self, account): log.info("分配角色权限") Home(self.driver).merchant_info() time.sleep(0.5) self.query.input_mer_no(account) self.common.click_query() self.common.click_mids() self.query.click_assign() self.assign.click_all() self.common.click_submit() def active_account(self, account): log.info("激活账户") Home(self.driver).merchant_info() time.sleep(0.5) self.query.input_mer_no(account) self.common.click_query() self.common.click_mids() self.query.click_active() self.common.click_confirm()
class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.review_obj = Tra.Review(driver) self.verify_obj = Tra.Verify(driver) self.common = Common(driver) self.driver = driver def query_abn_type(self, pay_id, abn_type): log.info("查询支付ID和异常类型:{}".format(abn_type)) Home(self.driver).abn_query() self.query.input_pay_id(pay_id) self.query.select_abn_type(abn_type) self.common.click_query() def get_query_result(self, val): # 获取查询结果 return self.common.get_table_val(1, val) def review(self): log.info("异常交易查询 - 审核") time.sleep(0.5) self.common.click_mids() self.query.click_review() time.sleep(0.5) self.review_obj.select_status("通过") self.common.click_submit() def verify(self): log.info("异常交易查询 - 复核") time.sleep(0.5) self.common.click_mids() self.query.click_verify() time.sleep(0.5) self.verify_obj.select_status("通过") self.common.click_submit()
class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.create = Tra.Create(driver) self.common = Common(driver) self.driver = driver def query_pay_method(self, pay_name): log.info("查询支付方式") Home(self.driver).pay_method() time.sleep(0.5) self.query.input_pay_name(pay_name) self.common.click_query() time.sleep(0.5) res = self.query.get_res_null() if res == "没有找到相关记录,请重新输入条件进行查询 .": return res return "" def create_pay_method(self, data_dict): log.info("创建支付方式") Home(self.driver).pay_method() time.sleep(0.5) self.query.click_create() time.sleep(0.5) text_list = [ "支付名称", "显示名称", "支付链接", "附加支付链接", "校验URL", "Logo Url", "排序", "备注" ] for item in data_dict: if item == "支付方式类别": self.create.select_pay_method(data_dict[item]) else: for text in text_list: if item == text: self.create.input_text(item, data_dict[item]) self.common.click_submit()
class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.create = Tra.Create(driver) self.modify = Tra.Modify(driver) self.common = Common(driver) self.driver = driver def get_terminal(self, account): log.info("获取终端号") Home(self.driver).terminal_query() time.sleep(0.5) self.query.input_mer_no(account) self.common.click_query() return self.common.get_table_val("1", "终端号") def query_terminal(self, terminal): Home(self.driver).terminal_query() time.sleep(0.5) self.query.input_terminal(terminal) self.common.click_query() time.sleep(0.5) log.info("查询终端号是否存在") # 判断终端号是否存在 return self.query.get_res_null() def query_list(self, terminal, name): Home(self.driver).terminal_query() time.sleep(0.5) self.query.input_terminal(terminal) self.common.click_query() time.sleep(0.5) res = self.common.get_table_val("1", name) log.info("获取{}: {}".format(name, res)) return res def modify_terminal(self, terminal, inf_type): log.info("修改终端号") Home(self.driver).terminal_query() time.sleep(0.5) self.query.input_terminal(terminal) self.common.click_query() time.sleep(0.5) self.common.click_mids() self.query.click_modify() time.sleep(0.5) self.modify.input_secure_code("12345678") self.modify.select_inf_type(inf_type) self.modify.select_bus_type("商户行业") self.modify.click_ip_no() self.modify.input_pay_times() self.modify.select_model("推送和正常返回") self.common.click_submit() self.common.confirm_alert() def create_terminal(self, account, inf_type): log.info("新增终端号") Home(self.driver).terminal_query() time.sleep(0.5) self.query.click_create() time.sleep(0.5) self.create.input_mer_no(account) self.create.input_secure_code("12345678") self.create.select_inf_type(inf_type) self.create.select_bus_type("商户行业") self.create.click_ip_no() self.create.input_pay_times() self.create.select_model("推送和正常返回") self.common.click_submit() self.common.confirm_alert() def active_terminal(self, terminal): log.info("激活终端号") Home(self.driver).terminal_query() time.sleep(0.5) self.query.input_terminal(terminal) self.common.click_query() time.sleep(0.5) self.common.click_mids() self.query.click_active() self.common.confirm_alert() def start_terminal(self, terminal): log.info("启用终端号") Home(self.driver).terminal_query() time.sleep(0.5) self.query.input_terminal(terminal) self.common.click_query() time.sleep(0.5) self.common.click_mids() self.query.click_start() time.sleep(0.5) self.common.confirm_alert()
class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.create = Tra.Create(driver) self.common = Common(driver) self.driver = driver def query_web_white(self, terminal): log.info("查询网址白名单") Home(self.driver).merweb_white() time.sleep(0.5) self.query.input_terminal(terminal) self.common.click_query() time.sleep(0.5) # 判断是否存在网址白名单的终端号 res = self.query.get_res_null() if res == "没有找到相关记录,请重新输入条件进行查询 .": return res else: res = self.common.get_table_val("1", "状态") if res == "已审核": return "1" elif res == "待处理": return "0" return "" def create_web_white(self, account, terminal): log.info("新增网址白名单") Home(self.driver).merweb_white() time.sleep(0.5) self.query.click_create() time.sleep(0.5) self.create.input_mer_no(account) self.create.click_terminal(terminal) self.create.input_websit("www.baidu.com") self.common.click_submit() self.common.confirm_alert() def review_web_white(self, terminal): log.info("审核网址白名单") Home(self.driver).merweb_white() time.sleep(0.5) self.query.input_terminal(terminal) self.common.click_query() time.sleep(0.5) self.common.click_mids() self.query.click_review() # 判断是否出现警告框 is_alert = self.common.confirm_alert() if not is_alert: self.common.click_submit() def verify_web_white(self, terminal): log.info("复核网址白名单") Home(self.driver).merweb_white() time.sleep(0.5) self.query.input_terminal(terminal) self.common.click_query() time.sleep(0.5) self.common.click_mids() self.query.click_verify() # 判断是否出现警告框 is_alert = self.common.confirm_alert() if not is_alert: self.common.click_submit()
class Action(object): def __init__(self, driver): self.common = Common(driver) self.query = Tra.Query(driver) self.apply = Tra.Apply(driver) self.driver = driver def apply_protest(self, pay_id, sub_type, abn_type, amount, protest): log.info("申请拒付") # 查询支付ID Home(self.driver).abn_apply() self.query.input_pay_id(pay_id) self.common.click_query() # 申请拒付 self.common.click_mids() self.query.click_apply() self.apply.select_sub_type(sub_type) self.apply.select_abn_type(abn_type) self.apply.input_amount(amount) self.apply.input_arn() self.apply.input_repaly_time() self.apply.select_protest_reason(protest) self.common.click_submit() def apply_freeze(self, pay_id, sub_type, abn_type, amount): log.info("申请调单") # 查询支付ID Home(self.driver).abn_apply() self.query.input_pay_id(pay_id) self.common.click_query() # 申请调单 self.common.click_mids() self.query.click_apply() self.apply.select_sub_type(sub_type) self.apply.select_abn_type(abn_type) self.apply.input_amount(amount) self.apply.input_arn() self.apply.input_repaly_time() self.apply.input_reason("autotest") self.common.click_submit() def apply_appeal_success(self, pay_id, sub_type, abn_type): log.info("申请申诉成功") # 查询支付ID Home(self.driver).abn_apply() self.query.input_pay_id(pay_id) self.common.click_query() # 申请申诉成功 self.common.click_mids() self.query.click_apply() self.apply.select_sub_type(sub_type) self.apply.select_abn_type(abn_type) self.common.click_submit() def query_refund(self, pay_id, refund): log.info("查询支付ID和退款状态") Home(self.driver).abn_apply() self.query.input_pay_id(pay_id) self.query.select_draw_back(refund) self.common.click_query() def query_protest(self, pay_id, protest): log.info("查询支付ID和拒付状态") Home(self.driver).abn_apply() self.query.input_pay_id(pay_id) self.query.select_ref_pay(protest) self.common.click_query() def query_freeze(self, pay_id, freeze): log.info("查询支付ID和调单状态") Home(self.driver).abn_apply() self.query.input_pay_id(pay_id) self.query.select_freeze(freeze) self.common.click_query()
class Action(object): def __init__(self, driver): self.query = Tra.Query(driver) self.create = Tra.Create(driver) self.common = Common(driver) self.driver = driver def query_channel(self, name): log.info("查询通道信息") Home(self.driver).channel_info() time.sleep(0.5) self.query.select_channel_name(name) return self.query.is_val() def get_channel_info(self, name, item): log.info("获取通道信息: {}".format(item)) Home(self.driver).channel_info() time.sleep(0.5) self.query.select_channel_name(name, flag=True) self.common.click_query() return self.common.get_table_val("1", item) def create_channel(self, data_dict): log.info("创建通道") Home(self.driver).channel_info() time.sleep(0.5) self.query.click_create() time.sleep(0.5) text_list = [ "通道名称", "通道账户", "自动对账用户名", "自动对账用户密码", "通道进入码", "通道安全码", "预留一", "预留二", "账单地址", "MCC", "账单地址白名单", "账单地址附加值1", "账单地址附加值1白名单", "账单地址附加值2", "最小交易金额", "最大交易金额", "结算银行", "通道后台管理员账号", "通道后台管理员密码", "单笔手续费金额", "通道保证金比率", "通道标识", "备注" ] radio_list = [ "银行通道是否为3方接口", "是否支持DCC", "是否延时通道", "是否支持3方接口", "是否支持2.5方接口", "是否支持2方接口", "是否支持退款", "是否支持部分退款", "是否支持部分拒付", "是否支持预授权", "是否3D通道", "是否启用我司自有MPI", "跳转银行付款链接", "是否支持撤销", "失败订单是否收取手续费", "结算前成功订单全额异常是否收取手续费", "结算后成功订单全额异常是否收取手续费", "结算前是否收取异常金额的手续费", "结算后是否收取异常金额的手续费" ] select_list = ["银行名称", "最小(大)交易金额币种", "单笔手续费币种", "通道主体"] for item in data_dict: if item in text_list: self.create.input_text(item, data_dict[item]) elif item in radio_list: self.create.click_radio(item, data_dict[item]) elif item in select_list: self.create.select_item(item, data_dict[item]) elif item == "卡种扣率": item_rate = data_dict[item].split(",") for rate_val in item_rate: self.create.select_rate(rate_val) elif item == "通道币种": item_mutli = data_dict[item].split(",") if len(item_mutli) > 1: self.create.click_cur_type("多币种") time.sleep(0.5) for str_val in item_mutli: self.create.select_mutli_currency(str_val) else: # self.create.click_cur_type("单币种") self.create.select_single_currency(item_mutli[0]) self.common.click_submit()