Ejemplo n.º 1
0
def get_tar(applyNo):
    data = get_date()
    filename = applyNo + "_" + data + ".tar"
    tar = tarfile.open(
        "D:\\Python_work\\walnuts_api\\api_test\\img\\" + filename, "w")
    tar.add("D:\\Python_work\\walnuts_api\\api_test\\img\\1.jpg",
            arcname=applyNo + "_idcard_01.jpg")
    tar.add("D:\\Python_work\\walnuts_api\\api_test\\img\\2.jpg",
            arcname=applyNo + "_idcard_02.jpg")
    tar.add("D:\\Python_work\\walnuts_api\\api_test\\img\\3.jpg",
            arcname=applyNo + "_face.jpg")
    tar.close()
    return filename
Ejemplo n.º 2
0
 def PATSCMSS8002(self):
     '''乐信提前还款试算'''
     seqno = generate_random_num(17)
     calseqno = "LN" + generate_random_num(12)
     date = get_date()
     header = {
         "api_id": "PATSCMSS8002",
         "country": "cn",
         "calseqno": seqno,
         "dapplication": "81001",
         "service": "PATSCMSS8002",
         "callseqno": seqno,
         "dgroup": "onl01",
         "dversion": "1.0",
         "busiseqno": seqno,
         "Content-Type": "application/json"
     }
     data = {
         "input": {
             "loanNo": "",
             "channelCode": "",
             "repayType": "",
             "mode": "",
             "repayAmt": "",
             "paymentApplyNo": "",
         },
         "comm_req": {
             "trantm": "752512",
             "initiator_system": "301",
             "app_version": "1.0",
             "trxn_branch": "77710",
             "call_seq": calseqno,
             "trxn_teller": "95068241",
             "sponsor_system": "810",
             "auth_user_id": "587046",
             "servtp": "TE",
             "sys_version": "1.0",
             "inpudt": date,
             "servno": "004",
             "busi_seq": seqno,
             "page_start": "1",
             "trxn_seq": seqno,
             "tranbr": date,
             "trandt": date,
             "longitude": "31.2579921",
             "page_size": "10",
             "orderSeq": calseqno,
             "phone_type": "0",
             "initiator_date": date,
             "inpucd": "985",
             "busisq": seqno,
             "rsa_key": "77777777777777",
             "inpusq": calseqno,
             "corpno": "985",
             "ip_address": "127.0.0.1",
             "busi_org_id": "025",
             "busiseqno": seqno,
             "terminal_os_type": "0",
             "tranus": "xadmin",
             "initiator_seq": calseqno,
             "pageIndex": "1",
             "pageno": "1",
             "pgsize": "1",
             "callseqno": calseqno,
             "channel_id": "LXIN"
         }
     }
     return Requester(headers=header, json=data)
Ejemplo n.º 3
0
 def PATSCMSS6001(self, applyNo):
     '''借款申请-标准'''
     seqno = generate_random_num(17)
     calseqno = "LN" + generate_random_num(12)
     date = get_date()
     applyTime = get_time()
     paymentApplyNo = "L" + generate_random_num(13)
     """报文头信息"""
     header = {
         "api_id": "PATSCMSS6001",
         "country": "cn",
         "calseqno": seqno,
         "dapplication": "81001",
         "service": "PATSCMSS6001",
         "callseqno": seqno,
         "dgroup": "onl01",
         "dversion": "1.0",
         "busiseqno": seqno,
         "Content-Type": "application/json"
     }
     data = {
         "applyNo": applyNo,
         "paymentApplyNo": paymentApplyNo,
         "channelCode": "LXIN",
         "userId": "",
         "applyTime": applyTime,
         "prodCode": "02050015",
         "applyAmt": "2000",
         "applTnr": "12",
         "repytp": "1",
         "intRate": "",
         "loanPurpose": "",
         "insureNo": "",
         "busiScen": "0",
         "extInfo": {
             "busiType": "3"
         },
         "comm_req": {
             "trantm": "752512",
             "initiator_system": "301",
             "app_version": "1.0",
             "trxn_branch": "77710",
             "call_seq": calseqno,
             "trxn_teller": "95068241",
             "sponsor_system": "810",
             "auth_user_id": "587046",
             "servtp": "TE",
             "sys_version": "1.0",
             "inpudt": date,
             "servno": "004",
             "busi_seq": seqno,
             "page_start": "1",
             "trxn_seq": seqno,
             "tranbr": date,
             "trandt": date,
             "longitude": "31.2579921",
             "page_size": "10",
             "orderSeq": calseqno,
             "phone_type": "0",
             "initiator_date": date,
             "inpucd": "985",
             "busisq": seqno,
             "rsa_key": "77777777777777",
             "inpusq": calseqno,
             "corpno": "985",
             "ip_address": "127.0.0.1",
             "busi_org_id": "025",
             "busiseqno": seqno,
             "terminal_os_type": "0",
             "tranus": "xadmin",
             "initiator_seq": calseqno,
             "pageIndex": "1",
             "pageno": "1",
             "pgsize": "1",
             "callseqno": calseqno,
             "channel_id": "LXIN"
         }
     }
     return Requester(headers=header, json=data)
Ejemplo n.º 4
0
 def PATSCMSS5005(self):
     '''乐信授信申请'''
     seqno = generate_random_num(17)
     calseqno = "LN" + generate_random_num(12)
     name = get_name()
     mobile = get_tel()
     mail = get_email()
     cardNo = "6216610200016587010"
     applyNo = generate_random_num(18)
     userid = "user" + generate_random_num(9)
     random_sex = random.randint(1, 2)
     applyTime = get_time()
     date = get_date()
     idnumber = IdNumber.generate_id(random_sex)
     birthDate = IdNumber(idnumber).get_birthday()
     """影像件上传155 SFTP"""
     tar = get_tar(applyNo=applyNo)
     src = "D:\\Python_work\\walnuts_api\\api_test\\img\\" + tar
     # path = "/upload/LXIN/photo/20201208/" + tar
     path = "/upload/LXIN/photo/" + date + "/" + tar
     upload_LXIN(src, path)
     time.sleep(1)
     os.remove(src)
     """报文头信息"""
     header = {
         "api_id": "PATSCMSS5005",
         "country": "cn",
         "calseqno": seqno,
         "dapplication": "81001",
         "service": "PATSCMSS5005",
         "callseqno": calseqno,
         "dgroup": "onl01",
         "dversion": "1.0",
         "busiseqno": calseqno,
         "Content-Type": "application/json"
     }
     data = {
         "input": {
             "applyNo": applyNo,
             "channelCode": "LXIN",
             "applyTime": applyTime,
             "prodCode": "LXIN001",
             "applyAmt": "20000",
             "applyPeriod": "12",
             "userInfo": {
                 "userId":
                 userid,
                 "custName":
                 name,
                 "certNo":
                 idnumber,
                 "gender":
                 random_sex,
                 "cardNo":
                 cardNo,
                 "mobileNo":
                 mobile,
                 "emaill":
                 mail,
                 "certType":
                 "101",
                 "certValidStart":
                 "20200810",
                 "certValidEnd":
                 "99991231",
                 "birthDate":
                 birthDate,
                 "marryStatus":
                 "10",
                 "eduLevel":
                 "010",
                 "degree":
                 "5",
                 "monthIncome":
                 "5",
                 "inctry":
                 "156",
                 "liveStatus":
                 "5",
                 "liveYear":
                 "5",
                 "liveAddProvince":
                 "上海",
                 "liveAddCity":
                 "上海",
                 "liveAddArea":
                 "黄浦",
                 "liveAddress":
                 "滇池路81号嘉煜外滩中心",
                 "cardTpye":
                 "C",
                 "workInfo": {
                     "empName": "上海中银消费",
                     "empTelNo": "010-88888888",
                     "empIndustry": "J",
                     "empProp": "0",
                     "workAddProvince": "上海",
                     "workAddCity": "上海",
                     "workAddArea": "黄浦",
                     "workAddDetail": "滇池路74号中银消费",
                     "empZipCode": "200120",
                     "profession": "0",
                     "jobTit": "9",
                     "jobPos": "9",
                 },
                 "emergList": [{
                     "emergName": "马保国",
                     "emergRelation": "PARENT",
                     "emergTel": "15936617570",
                     "emergCertNo": "440300196308081042"
                 }]
             }
         },
         "comm_req": {
             "trantm": "752512",
             "initiator_system": "301",
             "app_version": "1.0",
             "trxn_branch": "77710",
             "call_seq": calseqno,
             "trxn_teller": "95068241",
             "sponsor_system": "810",
             "auth_user_id": "587046",
             "servtp": "TE",
             "sys_version": "1.0",
             "inpudt": date,
             "servno": "004",
             "busi_seq": seqno,
             "page_start": "1",
             "trxn_seq": seqno,
             "tranbr": date,
             "trandt": date,
             "longitude": "31.2579921",
             "page_size": "10",
             "orderSeq": calseqno,
             "phone_type": "0",
             "initiator_date": date,
             "inpucd": "985",
             "busisq": seqno,
             "rsa_key": "77777777777777",
             "inpusq": calseqno,
             "corpno": "985",
             "ip_address": "127.0.0.1",
             "busi_org_id": "025",
             "busiseqno": seqno,
             "terminal_os_type": "0",
             "tranus": "xadmin",
             "initiator_seq": calseqno,
             "pageIndex": "1",
             "pageno": "1",
             "pgsize": "1",
             "callseqno": calseqno,
             "channel_id": "LXIN"
         }
     }
     return Requester(headers=header, json=data)
Ejemplo n.º 5
0
    def VIPS_apply(self):
        '''授信申请接口加密'''
        seqno = generate_random_str(9)
        userBirthDate = get_birthday()
        todaydate = get_date()

        # 客户信息
        custName = get_name()  # 客户名称
        usertel = get_tel()  # 电话号码
        spname = get_name()  # 配偶名称
        emergTel = get_tel()  # 配偶联系安话
        email = get_email()  # 邮件地址
        random_sex = random.randint(0, 1)
        idnumber = IdNumber.generate_id(random_sex)  # 客户身份证号码
        # 申请单号
        referno = "BO" + generate_random_num(16)
        """影像件上传"""
        applyImgPath = "/lttsdata/ICMS/VIPS" + referno + "/1.jpg"
        src_file = '/img\\'
        src_file = rename(src_file, referno)
        src_file = src_file + "\\1.jpg"
        upload(src_file, applyImgPath)

        data = {
            "header": {
                "requestNo": seqno,
                "timestamp": seqno,
                "merchantId": "VIP",
            },
            "body": {
                "openAccountOrderNo": referno,
                "userBaseInfo": {
                    "userName": custName,
                    "userMobile": usertel,
                    "idType": "0",
                    "userIdNo": idnumber,
                    "userIdIssueOrg": "公安局",
                    "userIdStartDate": "20180916",
                    "userIdExpiryDate": "20280916",
                    "userNation": "01",
                    "userSex": random_sex + 1,
                    "userBirthDate": userBirthDate,
                    "education": "DOCTOR",
                    "userMaritalStatus": "MARRIED_NO_CHILDREN",
                    "userOccupation": "020403",
                    "userCardNo": "622202649761688358",
                    "userCardType": "10",
                    "spouseName": spname,
                    "spouseMobile": emergTel,
                    "spouseCertType": "0",
                    "spouseIdNo": "110101199210015111",
                    "spouseExpiryDate": "20280916",
                    "spouseCorp": "上海市棉花糖厂",
                    "userCorp": "上海市棉花糖厂",
                    "userCorpAddr": "上海市浦东新区蓝天路778号",
                    "userCorpType": "",
                    "userCorpZip": "",
                    "userEmail": email,
                    "userResidenceAddrProvince": "上海市",
                    "userResidenceAddrCity": "上海市",
                    "userResidenceAddrCounty": "浦东新区",
                    "userResidenceAddr": "上海市浦东新区蓝天路233号",
                    "userLiveAddrProvince": "上海市",
                    "userLiveAddrCity": "上海市",
                    "userLiveAddrCounty": "浦东新区",
                    "userLiveAddr": "上海市浦东新区蓝天路233号",
                    "userLiveZip": "200120",
                    "userLiveStatus": "TENEMENT",
                },
                "contactInfo": {
                    "emergencyContactName": spname,
                    "emergencyContactMobile": emergTel,
                    "emergencyContactRelType": "SPOUSE",
                },
                "incomeInfo": {
                    "monthIncome": "6",
                    "yearIncome": "",
                    "familyIncom": "",
                    "moreIncome": "",
                    "taxIdCode": "",
                },
                "riskInfo": {
                    "limit": "20000",
                    "dailyIntRate": "",
                    "yearIntRate": "0.237600",
                    "vipApplyScore": "",
                },
                "extraInfo": {
                    "bizDate": todaydate,
                    "ocrType": "01",
                }
            }
        }

        return Requester(json=data)