Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Y
yingtz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楼超奇
yingtz
Commits
2d546897
Commit
2d546897
authored
Jun 13, 2016
by
RobertDing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ADD - 绑定银行卡
parent
aecd254e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
4 deletions
+108
-4
.gitignore
.gitignore
+2
-0
borrow.py
borrow.py
+85
-0
request.py
request.py
+6
-3
settings.py
settings.py
+15
-1
No files found.
.gitignore
0 → 100644
View file @
2d546897
__pycache__
*.swp
borrow.py
0 → 100644
View file @
2d546897
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Author : RobertDing
# E-mail : robertdingx@gmail.com
# Date : 16/06/13 21:19:05
# Desc : 借款相关接口测试
#
import
json
import
datetime
import
request
import
settings
req
=
request
.
Request
(
'apiBorrower'
)
class
RunHelper
(
object
):
def
run
(
self
):
print
(
self
.
params
)
content
=
req
.
handler
(
self
.
endpoint
)(
**
self
.
params
)
raw
=
json
.
loads
(
content
)
print
(
raw
)
class
Register
(
RunHelper
):
def
__init__
(
self
):
self
.
params
=
{
'mobile'
:
'18518756705'
,
'password'
:
'88889999'
,
'channel'
:
settings
.
CHANNEL
,
#'partnerId': 'wx12313',
'idType'
:
1
,
'idNo'
:
'412725199208183032'
,
'name'
:
'丁英才'
,
'sendPassword'
:
0
,
}
self
.
endpoint
=
'registerAndVerify'
class
CheckBank
(
RunHelper
):
def
__init__
(
self
):
self
.
params
=
{
'uid'
:
settings
.
UID
,
'bank'
:
'CCB'
,
'cardNo'
:
'6225096554333'
,
'phone'
:
'18518756705'
,
'province'
:
'广东'
,
'city'
:
'广州'
,
}
self
.
endpoint
=
'checkSecureBank'
pass
class
BindBank
(
RunHelper
):
def
__init__
(
self
):
self
.
params
=
{
'uid'
:
settings
.
UID
,
'verifiedData'
:
json
.
dumps
(
settings
.
verifiedData
),
'smsCode'
:
settings
.
SMSCODE
}
self
.
endpoint
=
'bindSecureBank'
pass
class
CreateLoad
(
RunHelper
):
def
__init__
(
self
):
self
.
params
=
{
'uid'
:
settings
.
UID
,
'type'
:
123
,
'applyTime'
:
int
(
datetime
.
datetime
.
now
()
.
timestamp
()),
'amount'
:
10000
,
'periodType'
:
30
,
'periods'
:
1
,
'repayType'
:
2
,
}
self
.
endpoint
=
'createLoan'
pass
request.py
View file @
2d546897
...
...
@@ -24,7 +24,8 @@ class Request(object):
URL
=
settings
.
BASE_URL
def
__init__
(
self
):
def
__init__
(
self
,
subject
):
self
.
subject
=
subject
yingtz_key
=
base64
.
b64decode
(
open
(
settings
.
YINGTZ_KEY_TEST
)
.
read
())
self
.
yingtz_key
=
RSA
.
importKey
(
yingtz_key
)
self
.
gmei_key
=
RSA
.
importKey
(
open
(
settings
.
GMEI_PRIVATE_KEY_PKCS8
)
.
read
())
...
...
@@ -34,9 +35,11 @@ class Request(object):
def
_fetch
(
**
kwargs
):
params
=
self
.
encrypt_param
(
kwargs
)
resp
=
requests
.
post
(
self
.
URL
+
endpoint
,
data
=
params
)
url
=
settings
.
BASE_URL
.
format
(
subject
=
self
.
subject
,
endpoint
=
endpoint
)
resp
=
requests
.
post
(
url
,
data
=
params
)
content
=
self
.
decrypt
(
resp
.
content
)
return
content
return
str
(
content
,
encoding
=
'utf8'
)
return
_fetch
def
encrypt_param
(
self
,
params
):
...
...
settings.py
View file @
2d546897
...
...
@@ -7,7 +7,7 @@
# Desc :
#
BASE_URL
=
'http://www.xiaoying.com/api/
apiBorrower/
'
BASE_URL
=
'http://www.xiaoying.com/api/
{subject}/{endpoint}
'
MD5KEY
=
bytes
(
'74ba4d7ad1d5bc705e6c96bbf599c3f1'
,
encoding
=
'utf8'
)
PARTNER
=
'WEI_ZHENG_FEN_QI'
...
...
@@ -16,3 +16,17 @@ YINGTZ_KEY_TEST = 'yingtz_key_test.pem'
YINGTZ_KEY_PROD
=
'yingtz_key_prod.pem'
GMEI_PRIVATE_KEY
=
'gmei_private_key.pem'
GMEI_PRIVATE_KEY_PKCS8
=
'gmei_private_key_pkcs8.pem'
UID
=
69013645522124800
verifiedData
=
{
'cardNo'
:
'6225096554333'
,
'ticket'
:
'69014705305616384'
,
'phone'
:
'18518756705'
,
'bankName'
:
'中国建设银行'
,
'bankCode'
:
'CCB'
,
'quickPay'
:
False
}
SMSCODE
=
'298578'
CARDID
=
'104599'
BANKCARDID
=
'1112864'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment