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
9a4a1882
Commit
9a4a1882
authored
Apr 19, 2018
by
zhang_z
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新POS支付;
parent
4eae0d7d
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
337 additions
and
243 deletions
+337
-243
app/src/main/java/com/xingdata/zzdpos/C.java
app/src/main/java/com/xingdata/zzdpos/C.java
+45
-0
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettleActivity.java
...in/java/com/xingdata/zzdpos/ui/settle/SettleActivity.java
+2
-2
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettleContract.java
...in/java/com/xingdata/zzdpos/ui/settle/SettleContract.java
+1
-1
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettlePresenter.java
...n/java/com/xingdata/zzdpos/ui/settle/SettlePresenter.java
+187
-184
pay/src/main/java/com/xingdata/zxpay/C.java
pay/src/main/java/com/xingdata/zxpay/C.java
+28
-5
pay/src/main/java/com/xingdata/zxpay/PayCenter.java
pay/src/main/java/com/xingdata/zxpay/PayCenter.java
+38
-19
pay/src/main/java/com/xingdata/zxpay/api/Factory.java
pay/src/main/java/com/xingdata/zxpay/api/Factory.java
+9
-1
pay/src/main/java/com/xingdata/zxpay/pax/Api.java
pay/src/main/java/com/xingdata/zxpay/pax/Api.java
+1
-3
pay/src/main/java/com/xingdata/zxpay/pax/C.java
pay/src/main/java/com/xingdata/zxpay/pax/C.java
+0
-10
pay/src/main/java/com/xingdata/zxpay/pax/Request.java
pay/src/main/java/com/xingdata/zxpay/pax/Request.java
+3
-11
pay/src/main/java/com/xingdata/zxpay/pax/Response.java
pay/src/main/java/com/xingdata/zxpay/pax/Response.java
+20
-6
pay/src/main/java/com/xingdata/zxpay/pax/ResultFilter.java
pay/src/main/java/com/xingdata/zxpay/pax/ResultFilter.java
+3
-1
No files found.
app/src/main/java/com/xingdata/zzdpos/C.java
View file @
9a4a1882
...
...
@@ -661,4 +661,49 @@ public class C {
public
static
final
int
USED
=
2
;
public
static
final
int
INVALID
=
3
;
}
/**
* 支付系统
*/
public
final
class
PAY_SYSTEM
{
/**
* 当前支付系统
*/
public
static
final
int
CURRENT
=
PAX
.
APP
;
/**
* 浙星
*/
public
static
final
int
ZX
=
100101
;
/**
* 拉卡拉
*/
public
static
final
int
LKL
=
100201
;
/**
* 百富
*/
public
final
class
PAX
{
/**
* 统一支付APP
*/
public
static
final
int
APP
=
100301
;
/**
* 接口
*/
public
static
final
int
API
=
100302
;
}
/**
* 交易类型
*/
public
final
class
Trans_Type
{
public
static
final
int
Trans_Type_Return
=
0
;
public
static
final
int
Trans_Type_Recharge
=
1
;
}
}
}
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettleActivity.java
View file @
9a4a1882
...
...
@@ -186,9 +186,9 @@ public class SettleActivity extends BaseActivity<SettlePresenter, ActivitySettle
}
@Override
public
void
showPayFailFragment
(
Throwable
throwable
,
Saleorder
saleorder
)
{
public
void
showPayFailFragment
(
String
throwable
,
Saleorder
saleorder
)
{
if
(
throwable
!=
null
)
{
LogUtils
.
e
(
throwable
.
getMessage
()
);
LogUtils
.
e
(
throwable
);
}
this
.
start
(
mPayResultFragment
.
setResult
(
false
).
setSaleorder
(
saleorder
));
this
.
showTitleBarByTitleMode
(
C
.
TITLE_MODE
.
TEXT
);
...
...
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettleContract.java
View file @
9a4a1882
...
...
@@ -125,7 +125,7 @@ interface SettleContract {
* @param throwable 错误信息
* @param saleorder 订单信息
*/
void
showPayFailFragment
(
Throwable
throwable
,
Saleorder
saleorder
);
void
showPayFailFragment
(
String
throwable
,
Saleorder
saleorder
);
/**
* 显示支付中页面
...
...
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettlePresenter.java
View file @
9a4a1882
This diff is collapsed.
Click to expand it.
pay/src/main/java/com/xingdata/zxpay/C.java
View file @
9a4a1882
...
...
@@ -54,7 +54,9 @@ public class C {
public
final
static
int
QUERY
=
400
;
}
/**
* 支付渠道
*/
public
final
class
PAY_CHANNEL
{
public
static
final
int
CASH
=
1
;
public
static
final
int
WECHAT
=
2
;
...
...
@@ -65,13 +67,34 @@ public class C {
}
/**
*
渠道
*
支付系统
*/
static
final
class
HOST
{
final
class
PAY_SYSTEM
{
/**
* 浙星
*/
static
final
int
ZX
=
100101
;
/**
*
惠尔丰平台的渠道编号
*
拉卡拉
*/
final
static
int
PAX
=
100000
;
static
final
int
LKL
=
100201
;
/**
* 百富
*/
final
class
PAX
{
/**
* 统一支付APP
*/
static
final
int
APP
=
100301
;
/**
* 接口
*/
static
final
int
API
=
100302
;
}
}
/**
...
...
pay/src/main/java/com/xingdata/zxpay/PayCenter.java
View file @
9a4a1882
package
com
.
xingdata
.
zxpay
;
import
com.
alibaba.fastjson.JSON
;
import
com.
blankj.utilcode.util.Utils
;
import
com.xingdata.zxpay.api.Response
;
import
com.xingdata.zxpay.model.Shopppp
;
import
com.xingdata.zxpay.pax.Factory
;
import
com.xingdata.zxpay.pax.PaxFactory
;
import
io.reactivex.Observable
;
...
...
@@ -19,12 +18,32 @@ public class PayCenter {
}
/**
*
交易基本信息
*
支付系统
*/
p
ublic
Shopppp
mShopppp
;
p
rivate
int
mPaySystem
;
public
PayCenter
init
(
String
json
)
{
mShopppp
=
JSON
.
parseObject
(
json
,
Shopppp
.
class
);
/**
* 支付信息
*/
public
String
mShoppppJson
;
/**
* 设置支付信息
*/
public
PayCenter
setPayKey
(
String
json
)
{
mShoppppJson
=
json
;
return
this
;
}
/**
* 初始化
*
* @param paySystem 支付系统
* @return this
*/
public
PayCenter
init
(
int
paySystem
)
{
this
.
mPaySystem
=
paySystem
;
return
this
;
}
...
...
@@ -37,11 +56,11 @@ public class PayCenter {
* @return 支付结果的Observable
*/
public
Observable
<
Response
>
pay
(
int
payChannel
,
String
payCode
,
Long
orderAmt
)
{
switch
(
m
Shopppp
.
getHost
().
getHostMapId
()
)
{
case
C
.
HOST
.
PAX
:
return
Factory
.
microPay
(
payChannel
,
payCode
,
Util
.
fenToYuan
(
orderAmt
));
switch
(
m
PaySystem
)
{
case
C
.
PAY_SYSTEM
.
PAX
.
API
:
return
PaxFactory
.
getInstance
()
.
microPay
(
payChannel
,
payCode
,
Util
.
fenToYuan
(
orderAmt
));
default
:
return
Observable
.
just
(
new
Response
(
C
.
PAY_STATE
.
FAIL_CUSTOM
,
"未知渠道"
));
return
Observable
.
just
(
new
Response
(
C
.
PAY_STATE
.
FAIL_CUSTOM
,
Utils
.
getApp
().
getResources
().
getString
(
R
.
string
.
unknown_channels
)
));
}
}
...
...
@@ -54,11 +73,11 @@ public class PayCenter {
* @return 支付结果的Observable
*/
public
Observable
<
Response
>
pay
(
int
payChannel
,
Long
orderAmt
)
{
switch
(
m
Shopppp
.
getHost
().
getHostMapId
()
)
{
case
C
.
HOST
.
PAX
:
return
Factory
.
qrPay
(
payChannel
,
Util
.
fenToYuan
(
orderAmt
));
switch
(
m
PaySystem
)
{
case
C
.
PAY_SYSTEM
.
PAX
.
API
:
return
PaxFactory
.
getInstance
()
.
qrPay
(
payChannel
,
Util
.
fenToYuan
(
orderAmt
));
default
:
return
Observable
.
just
(
new
Response
(
C
.
PAY_STATE
.
FAIL_CUSTOM
,
"未知渠道"
));
return
Observable
.
just
(
new
Response
(
C
.
PAY_STATE
.
FAIL_CUSTOM
,
Utils
.
getApp
().
getResources
().
getString
(
R
.
string
.
unknown_channels
)
));
}
}
...
...
@@ -69,11 +88,11 @@ public class PayCenter {
* @return 查询结果的Observable
*/
public
Observable
<
Response
>
query
(
int
payChannel
)
{
switch
(
m
Shopppp
.
getHost
().
getHostMapId
()
)
{
case
C
.
HOST
.
PAX
:
return
Factory
.
query
(
payChannel
);
switch
(
m
PaySystem
)
{
case
C
.
PAY_SYSTEM
.
PAX
.
API
:
return
PaxFactory
.
getInstance
()
.
query
(
payChannel
);
default
:
return
Observable
.
just
(
new
Response
(
C
.
PAY_STATE
.
FAIL_CUSTOM
,
"未知渠道"
));
return
Observable
.
just
(
new
Response
(
C
.
PAY_STATE
.
FAIL_CUSTOM
,
Utils
.
getApp
().
getResources
().
getString
(
R
.
string
.
unknown_channels
)
));
}
}
}
pay/src/main/java/com/xingdata/zxpay/api/Factory.java
View file @
9a4a1882
package
com
.
xingdata
.
zxpay
.
api
;
public
class
Factory
{
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 @
9a4a1882
package
com
.
xingdata
.
zxpay
.
pax
;
import
com.xingdata.zxpay.PayCenter
;
class
Api
extends
com
.
xingdata
.
zxpay
.
api
.
Api
{
Service
service
;
...
...
@@ -21,6 +19,6 @@ class Api extends com.xingdata.zxpay.api.Api {
@Override
protected
String
getBaseUrl
()
{
return
Pa
yCenter
.
getInstance
().
mShopppp
.
getHost
().
getHostAddr
();
return
Pa
xFactory
.
getInstance
().
mShopppp
.
getHost
().
getHostAddr
();
}
}
pay/src/main/java/com/xingdata/zxpay/pax/C.java
View file @
9a4a1882
...
...
@@ -6,16 +6,6 @@ class C {
*/
static
final
String
VERSION
=
"V1.0"
;
/**
* 重试次数
*/
static
final
int
RETRY_COUNT
=
6
;
/**
* 重试延迟时间
*/
static
final
int
RETRY_DELAY_TIME
=
5
*
1000
;
/**
* 测试数据
*/
...
...
pay/src/main/java/com/xingdata/zxpay/pax/Request.java
View file @
9a4a1882
...
...
@@ -3,7 +3,6 @@ package com.xingdata.zxpay.pax;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.blankj.utilcode.util.EncryptUtils
;
import
com.xingdata.zxpay.PayCenter
;
class
Request
{
...
...
@@ -14,9 +13,9 @@ class Request {
this
.
signType
=
C
.
SIGN_TYPE
.
MD5
;
this
.
version
=
C
.
VERSION
;
this
.
agentId
=
Pa
yCenter
.
getInstance
().
mShopppp
.
getHost
().
getHostAcqCode
();
this
.
mchId
=
Pa
yCenter
.
getInstance
().
mShopppp
.
getPosppp
().
getHshopNo
();
this
.
terId
=
Pa
yCenter
.
getInstance
().
mShopppp
.
getPosppp
().
getHposNo
();
this
.
agentId
=
Pa
xFactory
.
getInstance
().
mShopppp
.
getHost
().
getHostAcqCode
();
this
.
mchId
=
Pa
xFactory
.
getInstance
().
mShopppp
.
getPosppp
().
getHshopNo
();
this
.
terId
=
Pa
xFactory
.
getInstance
().
mShopppp
.
getPosppp
().
getHposNo
();
}
/**
...
...
@@ -147,7 +146,6 @@ class Request {
@JSONField
(
name
=
"sign"
)
private
String
sign
;
String
getVersion
()
{
return
version
;
}
...
...
@@ -204,7 +202,6 @@ class Request {
this
.
timeStart
=
timeStart
;
}
String
getSubject
()
{
return
subject
;
}
...
...
@@ -213,7 +210,6 @@ class Request {
this
.
subject
=
subject
;
}
String
getBody
()
{
return
body
;
}
...
...
@@ -238,7 +234,6 @@ class Request {
this
.
authCode
=
authCode
;
}
String
getCurrency
()
{
return
currency
;
}
...
...
@@ -255,7 +250,6 @@ class Request {
this
.
totalAmount
=
totalAmount
;
}
String
getFeeAmount
()
{
return
feeAmount
;
}
...
...
@@ -264,7 +258,6 @@ class Request {
this
.
feeAmount
=
feeAmount
;
}
String
getReserved
()
{
return
reserved
;
}
...
...
@@ -273,7 +266,6 @@ class Request {
this
.
reserved
=
reserved
;
}
String
getExpTime
()
{
return
expTime
;
}
...
...
pay/src/main/java/com/xingdata/zxpay/pax/Response.java
View file @
9a4a1882
...
...
@@ -33,13 +33,27 @@ class Response {
@JSONField
(
name
=
"msg"
)
private
String
msg
;
public
Long
getTime_start
()
{
return
time_start
;
}
public
void
setTime_start
(
Long
time_start
)
{
this
.
time_start
=
time_start
;
}
/**
* 交易时间
*/
@JSONField
(
name
=
"time_start"
)
private
Long
time_start
;
/**
* 二维码地址
*/
@JSONField
(
name
=
"code_url"
)
private
String
codeUrl
;
String
getMethod
()
{
public
String
getMethod
()
{
return
method
;
}
...
...
@@ -47,7 +61,7 @@ class Response {
this
.
method
=
method
;
}
String
getAgentId
()
{
public
String
getAgentId
()
{
return
agentId
;
}
...
...
@@ -55,7 +69,7 @@ class Response {
this
.
agentId
=
agentId
;
}
String
getMchId
()
{
public
String
getMchId
()
{
return
mchId
;
}
...
...
@@ -63,7 +77,7 @@ class Response {
this
.
mchId
=
mchId
;
}
String
getCode
()
{
public
String
getCode
()
{
return
code
;
}
...
...
@@ -71,7 +85,7 @@ class Response {
this
.
code
=
code
;
}
String
getMsg
()
{
public
String
getMsg
()
{
return
msg
;
}
...
...
@@ -79,7 +93,7 @@ class Response {
this
.
msg
=
msg
;
}
String
getCodeUrl
()
{
public
String
getCodeUrl
()
{
return
codeUrl
;
}
...
...
pay/src/main/java/com/xingdata/zxpay/pax/ResultFilter.java
View file @
9a4a1882
package
com
.
xingdata
.
zxpay
.
pax
;
import
com.alibaba.fastjson.JSON
;
import
io.reactivex.functions.Function
;
class
ResultFilter
implements
Function
<
Response
,
com
.
xingdata
.
zxpay
.
api
.
Response
>
{
...
...
@@ -24,7 +26,7 @@ class ResultFilter implements Function<Response, com.xingdata.zxpay.api.Response
}
switch
(
response
.
getMethod
())
{
case
C
.
METHOD
.
QRPAY
:
r
.
setBody
(
response
.
getCodeUrl
(
));
r
.
setBody
(
JSON
.
toJSONString
(
response
));
break
;
}
return
r
;
...
...
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