Exemplo n.º 1
0
def saveLinkManInfo(tel, channel):
    # 获取客户编号
    customer_id = Mysql.selectwithparams(business,
                                         RequestDataSql.getcustomerid, tel)[0]
    # 登陆
    login(tel, channel)
    # 联系人信息保存接口
    r = Appapi.upLinkMan(RequestDataSql.upLinkMandata(customer_id))
    Appapi.apiprint('联系人信息保存接口', RequestDataSql.upLinkMandata(customer_id), r)
Exemplo n.º 2
0
def savePersonInfo(tel, channel):
    # 获取客户编号
    customer_id = Mysql.selectwithparams(business,
                                         RequestDataSql.getcustomerid, tel)[0]
    # 登陆
    login(tel, channel)
    r = Appapi.addPersonInfo(RequestDataSql.addPersonInfodata(customer_id))
    Appapi.apiprint('个人信息保存接口', RequestDataSql.addPersonInfodata(customer_id),
                    r)
Exemplo n.º 3
0
def saveuserinfo(name, card, tel, channel):
    # 清除锦程方该客户额度
    JCapi.JCmoveLimitByName(name)
    id = register(tel, channel)
    # 登陆
    login(tel, channel)
    # 申请产品
    r = Appapi.applyProduct(RequestDataSql.applyProductdata(id))
    Appapi.apiprint('申请产品', RequestDataSql.applyProductdata(id), r)
    # 保存身份证、个人信息、联系人信息
    saveauthentication(tel, channel)
    saveauthenticationmock(name, card, tel)
    savePersonInfo(tel, channel)
    saveLinkManInfo(tel, channel)
Exemplo n.º 4
0
def login(tel, channel):
    if channel == 'Android':
        r = Appapi.login(RequestDataSql.androidlogindata(tel))
        Appapi.apiprint('登录', RequestDataSql.androidlogindata(tel), r)
    elif channel == 'IOS':
        r = Appapi.login(RequestDataSql.ioslogindata(tel))
        Appapi.apiprint('登录', RequestDataSql.ioslogindata(tel), r)
    elif channel == 'H5':
        r = Appapi.login(RequestDataSql.H5logindata(tel))
        Appapi.apiprint('登录', RequestDataSql.H5logindata(tel), r)
    else:
        print('暂不支持' + channel + '渠道')
Exemplo n.º 5
0
def credittimes(name, tel, channel):
    # 清除锦程方该客户额度
    JCapi.JCmoveLimitByName(name)
    # 获取客户编号
    customer_id = Mysql.selectwithparams(business,
                                         RequestDataSql.getcustomerid, tel)[0]
    # 清除拒绝原因
    Mysql.updatewithparams(business, RequestDataSql.deleterefusecode, tel)
    # 修改申请状态为拒绝
    Mysql.updatewithparams(business, RequestDataSql.updateapplystate, tel)
    # 修改额度为null
    Mysql.updatewithparams(business, RequestDataSql.updateamount, tel)
    # 修改channelcode已通过风控规则  APP -> 111
    Mysql.updatewithparams(business, RequestDataSql.updatechannelcode, tel)
    login(tel, channel)
    if channel == 'Android':
        r = Appapi.CreditForRisk(RequestDataSql.CreditForRiskdata(customer_id))
        Appapi.apiprint('安卓额度审批接口',
                        RequestDataSql.CreditForRiskdata(customer_id), r)
    elif channel == 'IOS':
        r = Appapi.CreditForIosRisk(
            RequestDataSql.CreditForIosRiskdata(customer_id))
        Appapi.apiprint('IOS额度审批接口',
                        RequestDataSql.CreditForIosRiskdata(customer_id), r)
    else:
        print('暂不支持' + channel + '渠道')
    time.sleep(5)
    GetResult.getcreditresult(tel)
Exemplo n.º 6
0
def register(tel, channel):
    # 清用户信息
    Mysql.deletecustomer(business, tel)
    # 注册获取验证码
    r1 = Appapi.reggetSmsCode(RequestDataSql.reggetSmsCodedata(tel))
    Appapi.apiprint('注册获取验证码', RequestDataSql.reggetSmsCodedata(tel), r1)
    time.sleep(2)
    smsCode = Mysql.selectwithparams(business, RequestDataSql.getsmscode,
                                     tel)[0]
    print('注册')
    if channel == 'Android':
        r2 = Appapi.doRegister(
            RequestDataSql.androiddoregisterdata(tel, smsCode))
    elif channel == 'IOS':
        r2 = Appapi.doRegister(RequestDataSql.iosdoregisterdata(tel, smsCode))
    elif channel == 'H5':
        r2 = Appapi.doRegister(RequestDataSql.H5doregisterdata(tel, smsCode))
    else:
        print('暂不支持' + channel + '渠道')
    print(r2.text)
    retCode = json.loads(r2.text)['retCode']
    retMsg = json.loads(r2.text)['retMsg']
    if retCode == 'FAIL':
        print('注册失败,提示信息: ' + retMsg + '\n')
    elif retCode == 'SUCCESS':
        print('注册成功' + '\n')
    time.sleep(2)
    id = Mysql.selectwithparams(business, RequestDataSql.getid, tel)[0]
    return id
Exemplo n.º 7
0
def loan(tel, periods, amount, channel):
    # 获取用户编号、客户编号
    id = Mysql.selectwithparams(business, RequestDataSql.getid, tel)[0]
    customer_id = Mysql.selectwithparams(business, RequestDataSql.getcustomerid, tel)[0]
    # 登陆
    login(tel, channel)
    # 交易密码校验接口
    r = Appapi.checkPayPassword(RequestDataSql.checkPayPassworddata(customer_id))
    Appapi.apiprint('交易密码校验接口', RequestDataSql.checkPayPassworddata(customer_id), r)
    # 申请进件接口
    r = Appapi.createOrder(RequestDataSql.createOrderdata(customer_id, periods, amount))
    Appapi.apiprint('申请进件接口', RequestDataSql.createOrderdata(customer_id, periods, amount), r)
    # 查询放款审批结果
    time.sleep(5)
    GetResult.getloanresult(tel)
Exemplo n.º 8
0
def bankcard(tel, channel):
    # 获取用户编号、客户编号
    id = Mysql.selectwithparams(business, RequestDataSql.getid, tel)[0]
    customer_id = Mysql.selectwithparams(business, RequestDataSql.getcustomerid, tel)[0]
    # 登陆
    login(tel, channel)
    # 银行卡OCR识别接口
    r = Appapi.bankCard(RequestDataSql.bankCarddata())
    Appapi.apiprint('银行卡OCR识别接口', RequestDataSql.bankCarddata(), r)
    bank_card_number = r.json().get('retData').get('bank_card_number')
    # 保存OCR次数
    r = Appapi.sendOCRTime(RequestDataSql.sendOCRTimedata(id, '4'))
    Appapi.apiprint('保存OCR次数', RequestDataSql.sendOCRTimedata(id, '4'), r)
    # 绑卡发送验证码接口
    r = Appapi.bindCardSendSmsCode(RequestDataSql.bindCardSendSmsCodedata(tel, customer_id, bank_card_number))
    Appapi.apiprint('绑卡发送验证码接口', RequestDataSql.bindCardSendSmsCodedata(tel, customer_id, bank_card_number), r)
    request_no = r.json().get('retData')
    # 绑卡校验验证码接口
    r = Appapi.bindCardCheckSmsCode(RequestDataSql.bindCardCheckSmsCodedata(tel, customer_id, request_no, bank_card_number))
    Appapi.apiprint('绑卡校验验证码接口', RequestDataSql.bindCardCheckSmsCodedata(tel, customer_id, request_no, bank_card_number), r)
    # 修改银行卡自动还款接口
    bankcard_id = Mysql.selectwithparams(business, RequestDataSql.getbankid, tel)[0]
    r = Appapi.updateBank(RequestDataSql.updateBankdata(bankcard_id))
    Appapi.apiprint('修改银行卡自动还款接口', RequestDataSql.updateBankdata(bankcard_id), r)
    # 设置支付密码接口 交易密码=111111
    r = Appapi.updatePassWord(RequestDataSql.updatePassWorddata(customer_id))
    Appapi.apiprint('设置支付密码接口', RequestDataSql.updatePassWorddata(customer_id), r)
Exemplo n.º 9
0
def saveauthentication(tel, channel):
    # 修改锦程系统时间为当前时间
    date = datetime.datetime.now().strftime('%Y%m%d')
    JCapi.JCsetCurrentDate(date)
    time.sleep(1)
    # 获取用户编号
    id = Mysql.selectwithparams(business, RequestDataSql.getid, tel)[0]
    # 登陆
    login(tel, channel)
    # 身份证正面OCR识别 刘童的身份证
    r1 = Appapi.idCardFront(RequestDataSql.idCardFrontdata())
    Appapi.apiprint('身份证正面OCR识别', RequestDataSql.idCardFrontdata(), r1)
    # 获取身份证识别信息
    person_name = r1.json().get('retData').get('result').get('name')
    card = r1.json().get('retData').get('result').get('number')
    customer_id = r1.json().get('retData').get('customer_id')
    card_register_address = r1.json().get('retData').get('result').get(
        'address')
    Zcard_src = r1.json().get('retData').get('Zcard_src')
    # 保存OCR次数
    r = Appapi.sendOCRTime(RequestDataSql.sendOCRTimedata(id, '1'))
    Appapi.apiprint('保存OCR次数', RequestDataSql.sendOCRTimedata(id, '1'), r)
    # 身份证反面OCR识别 刘童的身份证
    r2 = Appapi.idCardBack(RequestDataSql.idCardBackdata())
    Appapi.apiprint('身份证反面OCR识别', RequestDataSql.idCardBackdata(), r2)
    # 获取身份证识别信息
    sign_date = r2.json().get('retData').get('result').get('sign_date')
    expiry_date = r2.json().get('retData').get('result').get('expiry_date')
    card_effective_time = sign_date + '-' + expiry_date
    Fcard_src = r2.json().get('retData').get('Fcard_src')
    # 保存OCR次数
    r = Appapi.sendOCRTime(RequestDataSql.sendOCRTimedata(id, '2'))
    Appapi.apiprint('保存OCR次数', RequestDataSql.sendOCRTimedata(id, '2'), r)
    # 保存身份信息
    r = Appapi.saveIndentityInfo(
        RequestDataSql.saveIndentityInfodata(person_name, card, id,
                                             customer_id, card_effective_time,
                                             card_register_address, Zcard_src,
                                             Fcard_src))
    Appapi.apiprint(
        '保存身份信息',
        RequestDataSql.saveIndentityInfodata(person_name, card, id,
                                             customer_id, card_effective_time,
                                             card_register_address, Zcard_src,
                                             Fcard_src), r)
Exemplo n.º 10
0
def credit(name, card, tel, channel):
    # 清除锦程方该客户额度
    JCapi.JCmoveLimitByName(name)
    id = register(tel, channel)
    # 登陆
    login(tel, channel)
    # 申请产品
    r = Appapi.applyProduct(RequestDataSql.applyProductdata(id))
    Appapi.apiprint('申请产品', RequestDataSql.applyProductdata(id), r)
    # 保存身份证、个人信息、联系人信息
    saveauthentication(tel, channel)
    saveauthenticationmock(name, card, tel)
    savePersonInfo(tel, channel)
    saveLinkManInfo(tel, channel)
    # 获取客户编号
    customer_id = Mysql.selectwithparams(business,
                                         RequestDataSql.getcustomerid, tel)[0]
    # 登陆
    login(tel, channel)
    if channel == 'Android':
        # 保存设备信息及地理位置信息
        r = Appapi.addDeviceInfo(
            RequestDataSql.androidaddDeviceInfodata(customer_id))
        Appapi.apiprint('保存设备信息及地理位置信息接口',
                        RequestDataSql.androidaddDeviceInfodata(customer_id),
                        r)
        # 保存通话记录接口
        r = Appapi.saveCallRecord(
            RequestDataSql.androidsaveCallRecorddata(customer_id))
        Appapi.apiprint('保存通话记录接口',
                        RequestDataSql.androidsaveCallRecorddata(customer_id),
                        r)
    elif channel == 'IOS':
        r = Appapi.addDeviceInfo(
            RequestDataSql.iosaddDeviceInfodata(customer_id))
        Appapi.apiprint('保存设备信息及地理位置信息接口',
                        RequestDataSql.iosaddDeviceInfodata(customer_id), r)
    else:
        print('暂不支持' + channel + '渠道')
    # 安心签开户
    r = Appapi.getAnXinQianAccount(
        RequestDataSql.getAnXinQianAccountdata(customer_id))
    Appapi.apiprint('安心签开户',
                    RequestDataSql.getAnXinQianAccountdata(customer_id), r)
    # 人脸识别
    print('后台更新数据mock人脸识别' + '\n')
    mockfacesql = 'UPDATE mag_customer SET ALTER_TIME = "20190823172433", oss_face_key ="alp02/53b1754f1b928ecda45112401e2e3b91_20190925143347515.jpg", face_src ="https://ronghuialp.oss-cn-shenzhen.aliyuncs.com/alp02/7dbbbcdec97fa205bc1ded9a57fda42d_20190823172433200.jpg?Expires=1566552333&OSSAccessKeyId=LTAIvE2cfCGXURWc&Signature=ra4iAtrGeddIUF7Lu7pn05sdQd4%3D", person_face_state="1", person_face_complete="100", face_liveness_score = "1.0", face_verify_score= "1", face_verify_result ="1" WHERE ID = "' + customer_id + '"'
    Mysql.updatewithoutparams(business, mockfacesql)
    # # 修改channelcode已通过风控规则  APP -> 111
    # Mysql.updatewithparams(business, RequestDataSql.updatechannelcode, tel)
    if channel == 'Android':
        r = Appapi.CreditForRisk(RequestDataSql.CreditForRiskdata(customer_id))
        Appapi.apiprint('安卓额度审批接口',
                        RequestDataSql.CreditForRiskdata(customer_id), r)
    elif channel == 'IOS':
        r = Appapi.CreditForIosRisk(
            RequestDataSql.CreditForIosRiskdata(customer_id))
        Appapi.apiprint('IOS额度审批接口',
                        RequestDataSql.CreditForIosRiskdata(customer_id), r)
    else:
        print('暂不支持' + channel + '渠道')
    time.sleep(5)
    GetResult.getcreditresult(tel)
Exemplo n.º 11
0
def advancerepay(tel, applyno, prepayAmt, repayresult):
    # 获取用户编号、客户编号
    id = Mysql.selectwithparams(business, RequestDataSql.getid, tel)[0]
    customer_id = Mysql.selectwithparams(business,
                                         RequestDataSql.getcustomerid, tel)[0]
    jcLtNo = Mysql.selectwithparams(business, RequestDataSql.getjcLtNo, tel)[0]
    state = Mysql.selectwithparams(
        business, 'select state from mag_order where applNo=%s', applyno)[0]
    if state == '6':
        # 登录
        r = Appapi.login(RequestDataSql.androidlogindata(tel))
        Appapi.apiprint('登录', RequestDataSql.androidlogindata(tel), r)
        # # 借据还款接口
        # r = Appapi.repayreceipt(RequestDataSql.repayreceiptdata(jcLtNo))
        # Appapi.apiprint('借据还款接口', RequestDataSql.repayreceiptdata(jcLtNo), r)
        # 判断借据日期是否是当天
        r = Appapi.isCanRepay(RequestDataSql.isCanRepaydata(applyno))
        Appapi.apiprint('判断借据日期是否是当天', RequestDataSql.isCanRepaydata(applyno),
                        r)
        # 还款计划查询接口
        r = Appapi.repaymentPlanList(
            RequestDataSql.repaymentPlanListdata(applyno))
        Appapi.apiprint('还款计划查询接口',
                        RequestDataSql.repaymentPlanListdata(applyno), r)
        # 显示银行卡信息接口
        r = Appapi.getBank(RequestDataSql.getBankdata(customer_id))
        Appapi.apiprint('显示银行卡信息接口', RequestDataSql.getBankdata(customer_id),
                        r)
        # 提前还款金额计算接口
        r = Appapi.partRepayTry(
            RequestDataSql.partRepayTrydata(applyno, prepayAmt))
        Appapi.apiprint('提前还款金额计算接口',
                        RequestDataSql.partRepayTrydata(applyno, prepayAmt), r)
        repaymentAmount = r.json().get('retData').get('repaymentAmount')
        # 线上还款接口
        r = Appapi.directRepay(
            RequestDataSql.directRepaydata(applyno, repaymentAmount))
        Appapi.apiprint(
            '线上还款接口', RequestDataSql.directRepaydata(applyno, repaymentAmount),
            r)
        code = r.json.get('retData').get('code')
        if code == 'E0001':
            if repayresult == 'S':
                JCapi.JCrepaysetSuccess(applyno,
                                        repaymentAmount)  # 还款状态修改为成功等待回调
                time.sleep(60)
                state1 = Mysql.selectwithparams(
                    business,
                    'select state from mag_repayment_record where appl_no=%s order by create_time desc limit 1',
                    applyno)[0]
                if state1 == '1':
                    print('还款状态修改为成功已回调')
                else:
                    print('请查看还款状态修改为成功回调状态')
            elif repayresult == 'F':
                JCapi.JCrepaysetFail(applyno, repaymentAmount)  # 还款状态修改为成功等待回调
                time.sleep(60)
                state1 = Mysql.selectwithparams(
                    business,
                    'select state from mag_repayment_record where appl_no=%s order by create_time desc limit 1',
                    applyno)[0]
                if state1 == '2':
                    print('还款状态修改为失败已回调')
                else:
                    print('请查看还款状态修改为失败回调状态')
        else:
            print('线上还款异常了,看下日志吧')
    else:
        print('借据状态不是还款中,请查看')