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
341c51ce
Commit
341c51ce
authored
Apr 19, 2018
by
zhang_z
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交;
parent
9a4a1882
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
26 deletions
+43
-26
.idea/caches/build_file_checksums.ser
.idea/caches/build_file_checksums.ser
+0
-0
pay/src/main/java/com/xingdata/zxpay/pax/PaxFactory.java
pay/src/main/java/com/xingdata/zxpay/pax/PaxFactory.java
+42
-26
pay/src/main/res/values/strings.xml
pay/src/main/res/values/strings.xml
+1
-0
No files found.
.idea/caches/build_file_checksums.ser
0 → 100644
View file @
341c51ce
File added
pay/src/main/java/com/xingdata/zxpay/pax/Factory.java
→
pay/src/main/java/com/xingdata/zxpay/pax/
Pax
Factory.java
View file @
341c51ce
...
...
@@ -3,28 +3,45 @@ package com.xingdata.zxpay.pax;
import
android.util.SparseArray
;
import
com.alibaba.fastjson.JSON
;
import
com.blankj.utilcode.util.TimeUtils
;
import
com.xingdata.zxpay.PayCenter
;
import
com.xingdata.zxpay.
api.RetryHelper
;
import
com.xingdata.zxpay.
model.Shopppp
;
import
java.text.SimpleDateFormat
;
import
java.util.Locale
;
import
io.reactivex.Observable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.schedulers.Schedulers
;
public
class
Factory
extends
com
.
xingdata
.
zxpay
.
api
.
Factory
{
public
class
Pax
Factory
extends
com
.
xingdata
.
zxpay
.
api
.
Factory
{
private
static
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyymmddhhmmss"
,
Locale
.
getDefault
());
private
static
SparseArray
<
String
>
orderMap
=
new
SparseArray
<>();
private
PaxFactory
()
{
mShopppp
=
JSON
.
parseObject
(
PayCenter
.
getInstance
().
mShoppppJson
,
Shopppp
.
class
);
}
private
static
class
PaxFactoryHolder
{
private
static
final
PaxFactory
INSTANCE
=
new
PaxFactory
();
}
public
static
<
T
>
Observable
<
T
>
run
(
Observable
<
T
>
observable
)
{
return
observable
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
retryWhen
(
new
RetryHelper
(
C
.
RETRY_COUNT
,
C
.
RETRY_DELAY_TIME
));
public
static
PaxFactory
getInstance
()
{
return
PaxFactory
.
PaxFactoryHolder
.
INSTANCE
;
}
/**
* 交易基本信息
*/
Shopppp
mShopppp
;
/**
* 时间
*/
private
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyymmddhhmmss"
,
Locale
.
getDefault
());
/**
* 订单
*/
private
SparseArray
<
String
>
orderMap
=
new
SparseArray
<>();
/**
* 条码支付
*
...
...
@@ -33,21 +50,21 @@ public class Factory extends com.xingdata.zxpay.api.Factory {
* @param totalAmount 总金额(单位元)
* @return 交易结果
*/
public
static
Observable
<
com
.
xingdata
.
zxpay
.
api
.
Response
>
microPay
(
int
payChannel
,
String
authCode
,
String
totalAmount
)
{
public
Observable
<
com
.
xingdata
.
zxpay
.
api
.
Response
>
microPay
(
int
payChannel
,
String
authCode
,
String
totalAmount
)
{
Request
request
=
Request
.
create
(
C
.
METHOD
.
MICROPAY
);
request
.
setOutTransactionNo
(
PayCenter
.
getInstance
().
mShopppp
.
getPosppp
().
getHposTrace
());
request
.
setOutTransactionNo
(
mShopppp
.
getPosppp
().
getHposTrace
());
request
.
setTimeStart
(
TimeUtils
.
getNowString
(
format
));
request
.
setAuthCode
(
authCode
);
request
.
setTotalAmount
(
totalAmount
);
switch
(
payChannel
)
{
case
com
.
xingdata
.
zxpay
.
C
.
PAY_CHANNEL
.
ALI
:
request
.
setKey
(
PayCenter
.
getInstance
().
mShopppp
.
getHshopKeyAlipay
());
request
.
setKey
(
mShopppp
.
getHshopKeyAlipay
());
break
;
case
com
.
xingdata
.
zxpay
.
C
.
PAY_CHANNEL
.
WECHAT
:
request
.
setKey
(
PayCenter
.
getInstance
().
mShopppp
.
getHshopKeyWechat
());
request
.
setKey
(
mShopppp
.
getHshopKeyWechat
());
break
;
case
com
.
xingdata
.
zxpay
.
C
.
PAY_CHANNEL
.
BANK
:
request
.
setKey
(
PayCenter
.
getInstance
().
mShopppp
.
getHshopKeyUnipay
());
request
.
setKey
(
mShopppp
.
getHshopKeyUnipay
());
break
;
}
request
.
sign
();
...
...
@@ -63,27 +80,26 @@ public class Factory extends com.xingdata.zxpay.api.Factory {
* @param totalAmount 支付金额
* @return 交易结果
*/
public
static
Observable
<
com
.
xingdata
.
zxpay
.
api
.
Response
>
qrPay
(
int
payChannel
,
String
totalAmount
)
{
public
Observable
<
com
.
xingdata
.
zxpay
.
api
.
Response
>
qrPay
(
int
payChannel
,
String
totalAmount
)
{
Request
request
=
Request
.
create
(
C
.
METHOD
.
QRPAY
);
request
.
setOutTransactionNo
(
PayCenter
.
getInstance
().
mShopppp
.
getPosppp
().
getHposTrace
());
request
.
setOutTransactionNo
(
mShopppp
.
getPosppp
().
getHposTrace
());
request
.
setTimeStart
(
TimeUtils
.
getNowString
(
format
));
request
.
setTotalAmount
(
totalAmount
);
switch
(
payChannel
)
{
case
com
.
xingdata
.
zxpay
.
C
.
PAY_CHANNEL
.
ALI
:
request
.
setTradeType
(
C
.
TRADE_TYPE
.
ALI
);
request
.
setKey
(
PayCenter
.
getInstance
().
mShopppp
.
getHshopKeyAlipay
());
request
.
setKey
(
mShopppp
.
getHshopKeyAlipay
());
break
;
case
com
.
xingdata
.
zxpay
.
C
.
PAY_CHANNEL
.
WECHAT
:
request
.
setTradeType
(
C
.
TRADE_TYPE
.
WECHAT
);
request
.
setKey
(
PayCenter
.
getInstance
().
mShopppp
.
getHshopKeyWechat
());
request
.
setKey
(
mShopppp
.
getHshopKeyWechat
());
break
;
case
com
.
xingdata
.
zxpay
.
C
.
PAY_CHANNEL
.
BANK
:
request
.
setTradeType
(
C
.
TRADE_TYPE
.
UNION
);
request
.
setKey
(
PayCenter
.
getInstance
().
mShopppp
.
getHshopKeyUnipay
());
request
.
setKey
(
mShopppp
.
getHshopKeyUnipay
());
break
;
}
request
.
sign
();
return
run
(
Api
.
getInstance
().
service
.
action
(
request
))
.
map
(
new
ResultFilter
())
.
doFinally
(()
->
orderMap
.
put
(
request
.
getOutTransactionNo
(),
request
.
getTimeStart
()));
...
...
@@ -95,19 +111,19 @@ public class Factory extends com.xingdata.zxpay.api.Factory {
*
* @return 查询结果
*/
public
static
Observable
<
com
.
xingdata
.
zxpay
.
api
.
Response
>
query
(
int
payChannel
)
{
public
Observable
<
com
.
xingdata
.
zxpay
.
api
.
Response
>
query
(
int
payChannel
)
{
Request
request
=
Request
.
create
(
C
.
METHOD
.
QUERY
);
request
.
setOutTransactionNo
(
PayCenter
.
getInstance
().
mShopppp
.
getPosppp
().
getHposTrace
());
request
.
setOutTransactionNo
(
mShopppp
.
getPosppp
().
getHposTrace
());
request
.
setTimeStart
(
orderMap
.
get
(
request
.
getOutTransactionNo
()));
switch
(
payChannel
)
{
case
com
.
xingdata
.
zxpay
.
C
.
PAY_CHANNEL
.
ALI
:
request
.
setKey
(
PayCenter
.
getInstance
().
mShopppp
.
getHshopKeyAlipay
());
request
.
setKey
(
mShopppp
.
getHshopKeyAlipay
());
break
;
case
com
.
xingdata
.
zxpay
.
C
.
PAY_CHANNEL
.
WECHAT
:
request
.
setKey
(
PayCenter
.
getInstance
().
mShopppp
.
getHshopKeyWechat
());
request
.
setKey
(
mShopppp
.
getHshopKeyWechat
());
break
;
case
com
.
xingdata
.
zxpay
.
C
.
PAY_CHANNEL
.
BANK
:
request
.
setKey
(
PayCenter
.
getInstance
().
mShopppp
.
getHshopKeyUnipay
());
request
.
setKey
(
mShopppp
.
getHshopKeyUnipay
());
break
;
}
request
.
sign
();
...
...
pay/src/main/res/values/strings.xml
View file @
341c51ce
<resources>
<string
name=
"app_name"
>
pay
</string>
<string
name=
"unknown_channels"
>
未知渠道
</string>
</resources>
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