Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TangKuPos
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王海
TangKuPos
Commits
992b09bd
Commit
992b09bd
authored
Mar 08, 2018
by
zhang_z
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支付module结构优化;
parent
57b9dc33
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
17 deletions
+32
-17
pay/src/main/java/com/xingdata/zxpay/api/Api.java
pay/src/main/java/com/xingdata/zxpay/api/Api.java
+4
-4
pay/src/main/java/com/xingdata/zxpay/api/Factory.java
pay/src/main/java/com/xingdata/zxpay/api/Factory.java
+14
-0
pay/src/main/java/com/xingdata/zxpay/pax/Api.java
pay/src/main/java/com/xingdata/zxpay/pax/Api.java
+5
-0
pay/src/main/java/com/xingdata/zxpay/pax/C.java
pay/src/main/java/com/xingdata/zxpay/pax/C.java
+3
-1
pay/src/main/java/com/xingdata/zxpay/pax/Factory.java
pay/src/main/java/com/xingdata/zxpay/pax/Factory.java
+4
-10
pay/src/main/java/com/xingdata/zxpay/pax/Service.java
pay/src/main/java/com/xingdata/zxpay/pax/Service.java
+2
-2
No files found.
pay/src/main/java/com/xingdata/zxpay/api/Api.java
View file @
992b09bd
...
@@ -3,7 +3,6 @@ package com.xingdata.zxpay.api;
...
@@ -3,7 +3,6 @@ package com.xingdata.zxpay.api;
import
android.support.annotation.NonNull
;
import
android.support.annotation.NonNull
;
import
com.xingdata.zxpay.C
;
import
com.xingdata.zxpay.C
;
import
com.xingdata.zxpay.PayCenter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -18,7 +17,7 @@ import okhttp3.logging.HttpLoggingInterceptor;
...
@@ -18,7 +17,7 @@ import okhttp3.logging.HttpLoggingInterceptor;
import
retrofit2.Retrofit
;
import
retrofit2.Retrofit
;
import
retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
;
import
retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
;
public
class
Api
{
public
abstract
class
Api
{
protected
Retrofit
retrofit
;
protected
Retrofit
retrofit
;
protected
Api
()
{
protected
Api
()
{
...
@@ -61,8 +60,9 @@ public class Api {
...
@@ -61,8 +60,9 @@ public class Api {
.
client
(
okHttpClient
)
.
client
(
okHttpClient
)
.
addCallAdapterFactory
(
RxJava2CallAdapterFactory
.
create
())
.
addCallAdapterFactory
(
RxJava2CallAdapterFactory
.
create
())
.
addConverterFactory
(
ConverterFactory
.
create
())
.
addConverterFactory
(
ConverterFactory
.
create
())
.
baseUrl
(
PayCenter
.
getInstance
().
mShopppp
.
getHshopKeyUnipay
())
.
baseUrl
(
getBaseUrl
())
.
build
();
.
build
();
}
}
protected
abstract
String
getBaseUrl
();
}
}
pay/src/main/java/com/xingdata/zxpay/api/Factory.java
0 → 100644
View file @
992b09bd
package
com
.
xingdata
.
zxpay
.
api
;
import
io.reactivex.Observable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.schedulers.Schedulers
;
public
class
Factory
{
protected
static
<
T
>
Observable
<
T
>
run
(
Observable
<
T
>
observable
)
{
return
observable
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
());
}
}
pay/src/main/java/com/xingdata/zxpay/pax/Api.java
View file @
992b09bd
...
@@ -17,4 +17,9 @@ public class Api extends com.xingdata.zxpay.api.Api {
...
@@ -17,4 +17,9 @@ public class Api extends com.xingdata.zxpay.api.Api {
super
();
super
();
service
=
retrofit
.
create
(
Service
.
class
);
service
=
retrofit
.
create
(
Service
.
class
);
}
}
@Override
protected
String
getBaseUrl
()
{
return
C
.
BASE_URL
;
}
}
}
pay/src/main/java/com/xingdata/zxpay/pax/C.java
View file @
992b09bd
...
@@ -2,7 +2,9 @@ package com.xingdata.zxpay.pax;
...
@@ -2,7 +2,9 @@ package com.xingdata.zxpay.pax;
class
C
{
class
C
{
final
static
String
URL
=
"/tps/api/instrans"
;
final
static
String
BASE_URL
=
"http://114.55.31.38:8008"
;
final
static
String
ACTION
=
"/tps/api/instrans"
;
/**
/**
* 当前交易成功
* 当前交易成功
...
...
pay/src/main/java/com/xingdata/zxpay/pax/Factory.java
View file @
992b09bd
...
@@ -5,16 +5,15 @@ import com.alibaba.fastjson.JSON;
...
@@ -5,16 +5,15 @@ import com.alibaba.fastjson.JSON;
import
com.xingdata.zxpay.api.Response
;
import
com.xingdata.zxpay.api.Response
;
import
io.reactivex.Observable
;
import
io.reactivex.Observable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.schedulers.Schedulers
;
public
class
Factory
{
public
class
Factory
extends
com
.
xingdata
.
zxpay
.
api
.
Factory
{
public
static
Observable
<
com
.
xingdata
.
zxpay
.
api
.
Response
>
pay
(
String
a
,
String
b
)
{
public
static
Observable
<
com
.
xingdata
.
zxpay
.
api
.
Response
>
pay
(
String
a
,
String
b
)
{
Request
request
=
new
Request
();
Request
request
=
new
Request
();
request
.
setReserved
(
a
);
request
.
setReserved
(
a
);
request
.
setMethod
(
b
);
request
.
setMethod
(
b
);
return
run
(
Api
.
getInstance
().
service
.
query
(
request
))
return
run
(
Api
.
getInstance
().
service
.
action
(
request
))
.
flatMap
(
response
->
Observable
.
just
(
new
Response
(
JSON
.
toJSONString
(
response
))));
.
flatMap
(
response
->
Observable
.
just
(
new
Response
(
JSON
.
toJSONString
(
response
))));
}
}
...
@@ -22,13 +21,8 @@ public class Factory {
...
@@ -22,13 +21,8 @@ public class Factory {
Request
request
=
new
Request
();
Request
request
=
new
Request
();
request
.
setAgentId
(
c
);
request
.
setAgentId
(
c
);
request
.
setExpTime
(
d
);
request
.
setExpTime
(
d
);
return
Api
.
getInstance
().
service
.
query
(
request
);
return
Api
.
getInstance
().
service
.
action
(
request
);
}
}
static
<
T
>
Observable
<
T
>
run
(
Observable
<
T
>
observable
)
{
return
observable
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
());
}
}
}
pay/src/main/java/com/xingdata/zxpay/pax/Service.java
View file @
992b09bd
...
@@ -6,6 +6,6 @@ import retrofit2.http.POST;
...
@@ -6,6 +6,6 @@ import retrofit2.http.POST;
public
interface
Service
{
public
interface
Service
{
@POST
(
C
.
URL
)
@POST
(
C
.
ACTION
)
Observable
<
Response
>
query
(
@Body
com
.
xingdata
.
zxpay
.
pax
.
Request
request
);
Observable
<
Response
>
action
(
@Body
com
.
xingdata
.
zxpay
.
pax
.
Request
request
);
}
}
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