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
06a9cf74
Commit
06a9cf74
authored
Apr 19, 2018
by
zhang_z
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of 192.168.254.154:w525721508/TangKuPos
parents
8d6e5449
be649677
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
214 additions
and
62 deletions
+214
-62
app/src/main/java/com/xingdata/zzdpos/App.java
app/src/main/java/com/xingdata/zzdpos/App.java
+2
-2
app/src/main/java/com/xingdata/zzdpos/C.java
app/src/main/java/com/xingdata/zzdpos/C.java
+2
-1
app/src/main/java/com/xingdata/zzdpos/base/BaseActivity.java
app/src/main/java/com/xingdata/zzdpos/base/BaseActivity.java
+26
-2
app/src/main/java/com/xingdata/zzdpos/base/BaseDialog.java
app/src/main/java/com/xingdata/zzdpos/base/BaseDialog.java
+3
-2
app/src/main/res/values/strings.xml
app/src/main/res/values/strings.xml
+2
-0
neptune/src/main/java/com/xingdata/pay/neptune/NeptuneCenter.java
...src/main/java/com/xingdata/pay/neptune/NeptuneCenter.java
+23
-0
neptune/src/main/java/com/xingdata/pay/neptune/ipc/C.java
neptune/src/main/java/com/xingdata/pay/neptune/ipc/C.java
+6
-2
neptune/src/main/java/com/xingdata/pay/neptune/ipc/Factory.java
...e/src/main/java/com/xingdata/pay/neptune/ipc/Factory.java
+101
-51
neptune/src/main/java/com/xingdata/pay/neptune/ipc/IRequest.java
.../src/main/java/com/xingdata/pay/neptune/ipc/IRequest.java
+41
-1
neptune/src/main/java/com/xingdata/pay/neptune/ipc/ResultFilter.java
.../main/java/com/xingdata/pay/neptune/ipc/ResultFilter.java
+8
-1
No files found.
app/src/main/java/com/xingdata/zzdpos/App.java
View file @
06a9cf74
...
@@ -135,7 +135,7 @@ public class App extends Application {
...
@@ -135,7 +135,7 @@ public class App extends Application {
private
void
getPermissionYes
(
List
<
String
>
grantedPermissions
)
{
private
void
getPermissionYes
(
List
<
String
>
grantedPermissions
)
{
// 初始化日志保存文件夹
// 初始化日志保存文件夹
if
(!
INI
.
init
(
"TangKu"
))
{
if
(!
INI
.
init
(
"TangKu"
))
{
ToastUtils
.
showLong
(
"日志文件夹初始化失败"
);
ToastUtils
.
showLong
(
R
.
string
.
log_file_err
);
}
}
}
}
...
@@ -146,7 +146,7 @@ public class App extends Application {
...
@@ -146,7 +146,7 @@ public class App extends Application {
*/
*/
@PermissionNo
(
100
)
@PermissionNo
(
100
)
private
void
getPermissioNo
(
List
<
String
>
grantedPermissions
)
{
private
void
getPermissioNo
(
List
<
String
>
grantedPermissions
)
{
ToastUtils
.
showLong
(
"权限申请失败"
);
ToastUtils
.
showLong
(
R
.
string
.
app_permission_to_fail
);
}
}
...
...
app/src/main/java/com/xingdata/zzdpos/C.java
View file @
06a9cf74
...
@@ -646,8 +646,9 @@ public class C {
...
@@ -646,8 +646,9 @@ public class C {
public
static
final
String
SUCC
=
"0000"
;
public
static
final
String
SUCC
=
"0000"
;
}
}
public
final
class
SYSTEM
{
public
static
final
class
SYSTEM
{
public
static
final
String
DIALOGISDISMISS
=
"DIALOGISDISMISS"
;
public
static
final
String
DIALOGISDISMISS
=
"DIALOGISDISMISS"
;
public
static
boolean
mStateEnable
=
false
;
}
}
public
final
class
TRULE_STATUS
{
public
final
class
TRULE_STATUS
{
...
...
app/src/main/java/com/xingdata/zzdpos/base/BaseActivity.java
View file @
06a9cf74
...
@@ -4,6 +4,7 @@ import android.content.Context;
...
@@ -4,6 +4,7 @@ import android.content.Context;
import
android.databinding.DataBindingUtil
;
import
android.databinding.DataBindingUtil
;
import
android.databinding.ViewDataBinding
;
import
android.databinding.ViewDataBinding
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.PersistableBundle
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.support.v7.app.AppCompatDelegate
;
import
android.support.v7.app.AppCompatDelegate
;
import
android.view.KeyEvent
;
import
android.view.KeyEvent
;
...
@@ -63,10 +64,12 @@ public abstract class BaseActivity<P extends BasePresenter, B extends ViewDataBi
...
@@ -63,10 +64,12 @@ public abstract class BaseActivity<P extends BasePresenter, B extends ViewDataBi
if
(!(
this
instanceof
BaseView
))
{
if
(!(
this
instanceof
BaseView
))
{
throw
new
RuntimeException
(
getClass
().
getSimpleName
()
+
"需要实现继承自BaseView的行为接口"
);
throw
new
RuntimeException
(
getClass
().
getSimpleName
()
+
"需要实现继承自BaseView的行为接口"
);
}
}
if
(!(
this
.
getClass
().
getGenericSuperclass
()
instanceof
ParameterizedType
&&
((
ParameterizedType
)
(
this
.
getClass
().
getGenericSuperclass
())).
getActualTypeArguments
().
length
>
0
))
{
if
(!(
this
.
getClass
().
getGenericSuperclass
()
instanceof
ParameterizedType
&&
((
ParameterizedType
)
(
this
.
getClass
()
.
getGenericSuperclass
())).
getActualTypeArguments
().
length
>
0
))
{
throw
new
RuntimeException
(
getClass
().
getSimpleName
()
+
"在继承时,需要注明泛型类"
);
throw
new
RuntimeException
(
getClass
().
getSimpleName
()
+
"在继承时,需要注明泛型类"
);
}
}
Class
mPresenterClass
=
(
Class
)
((
ParameterizedType
)
(
this
.
getClass
().
getGenericSuperclass
())).
getActualTypeArguments
()[
0
];
Class
mPresenterClass
=
(
Class
)
((
ParameterizedType
)
(
this
.
getClass
().
getGenericSuperclass
())).
getActualTypeArguments
()
[
0
];
mPresenter
=
InstanceUtil
.
getInstance
(
mPresenterClass
);
mPresenter
=
InstanceUtil
.
getInstance
(
mPresenterClass
);
mPresenter
.
setIntent
(
getIntent
()).
setView
(
this
).
build
();
mPresenter
.
setIntent
(
getIntent
()).
setView
(
this
).
build
();
}
}
...
@@ -76,6 +79,8 @@ public abstract class BaseActivity<P extends BasePresenter, B extends ViewDataBi
...
@@ -76,6 +79,8 @@ public abstract class BaseActivity<P extends BasePresenter, B extends ViewDataBi
super
.
onDestroy
();
super
.
onDestroy
();
RxBus
.
get
().
unregister
(
mContext
);
RxBus
.
get
().
unregister
(
mContext
);
if
(
mPresenter
!=
null
)
mPresenter
.
onDetached
();
if
(
mPresenter
!=
null
)
mPresenter
.
onDetached
();
// 注销服务
// com.xingdata.pay.neptune.ipc.Factory.unBindService(this);
}
}
public
abstract
void
initView
();
public
abstract
void
initView
();
...
@@ -121,14 +126,33 @@ public abstract class BaseActivity<P extends BasePresenter, B extends ViewDataBi
...
@@ -121,14 +126,33 @@ public abstract class BaseActivity<P extends BasePresenter, B extends ViewDataBi
}
}
}
}
@Override
protected
void
onStart
()
{
C
.
SYSTEM
.
mStateEnable
=
true
;
super
.
onStart
();
}
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
C
.
SYSTEM
.
mStateEnable
=
true
;
if
(
SPUtils
.
getInstance
().
getBoolean
(
C
.
SYSTEM
.
DIALOGISDISMISS
))
{
if
(
SPUtils
.
getInstance
().
getBoolean
(
C
.
SYSTEM
.
DIALOGISDISMISS
))
{
mLoadingDialog
.
dismiss
();
mLoadingDialog
.
dismiss
();
}
}
super
.
onResume
();
super
.
onResume
();
}
}
@Override
public
void
onSaveInstanceState
(
Bundle
outState
,
PersistableBundle
outPersistentState
)
{
C
.
SYSTEM
.
mStateEnable
=
false
;
super
.
onSaveInstanceState
(
outState
,
outPersistentState
);
}
@Override
protected
void
onStop
()
{
C
.
SYSTEM
.
mStateEnable
=
false
;
super
.
onStop
();
}
@Override
@Override
public
void
pop
()
{
public
void
pop
()
{
if
(
getSupportFragmentManager
().
getFragments
().
size
()
>
1
)
{
if
(
getSupportFragmentManager
().
getFragments
().
size
()
>
1
)
{
...
...
app/src/main/java/com/xingdata/zzdpos/base/BaseDialog.java
View file @
06a9cf74
...
@@ -233,7 +233,7 @@ public abstract class BaseDialog<P extends BasePresenter, B extends ViewDataBind
...
@@ -233,7 +233,7 @@ public abstract class BaseDialog<P extends BasePresenter, B extends ViewDataBind
* @param mRecLen 自动关闭的时间
* @param mRecLen 自动关闭的时间
*/
*/
public
void
show
(
BaseActivity
activity
,
int
mRecLen
)
{
public
void
show
(
BaseActivity
activity
,
int
mRecLen
)
{
if
(
AppUtils
.
isAppForeground
())
{
if
(
AppUtils
.
isAppForeground
()
&&
C
.
SYSTEM
.
mStateEnable
)
{
if
(!
isShowing
)
{
if
(!
isShowing
)
{
this
.
recLen
=
mRecLen
;
this
.
recLen
=
mRecLen
;
this
.
shutDown
=
true
;
this
.
shutDown
=
true
;
...
@@ -283,7 +283,7 @@ public abstract class BaseDialog<P extends BasePresenter, B extends ViewDataBind
...
@@ -283,7 +283,7 @@ public abstract class BaseDialog<P extends BasePresenter, B extends ViewDataBind
* 关闭
* 关闭
*/
*/
public
void
dismiss
()
{
public
void
dismiss
()
{
if
(
AppUtils
.
isAppForeground
())
{
if
(
AppUtils
.
isAppForeground
()
&&
C
.
SYSTEM
.
mStateEnable
)
{
if
(
isShowing
)
{
if
(
isShowing
)
{
isShowing
=
false
;
isShowing
=
false
;
if
(
getBaseActivity
()
!=
null
&&
getBaseActivity
().
mDialogs
!=
null
)
{
if
(
getBaseActivity
()
!=
null
&&
getBaseActivity
().
mDialogs
!=
null
)
{
...
@@ -351,4 +351,5 @@ public abstract class BaseDialog<P extends BasePresenter, B extends ViewDataBind
...
@@ -351,4 +351,5 @@ public abstract class BaseDialog<P extends BasePresenter, B extends ViewDataBind
mBaseBinding
.
btnConfirm
.
setText
(
OK
);
mBaseBinding
.
btnConfirm
.
setText
(
OK
);
return
this
;
return
this
;
}
}
}
}
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
06a9cf74
...
@@ -769,6 +769,8 @@
...
@@ -769,6 +769,8 @@
<!--升级页面-->
<!--升级页面-->
<string
name=
"update_hint_done"
>
已经是最新版本
</string>
<string
name=
"update_hint_done"
>
已经是最新版本
</string>
<string
name=
"app_permission_to_fail"
>
权限申请失败
</string>
<string
name=
"log_file_err"
>
日志文件夹初始化失败
</string>
</resources>
</resources>
neptune/src/main/java/com/xingdata/pay/neptune/NeptuneCenter.java
View file @
06a9cf74
...
@@ -41,6 +41,29 @@ public class NeptuneCenter {
...
@@ -41,6 +41,29 @@ public class NeptuneCenter {
public
Observable
<
Response
>
pay
(
int
payChannel
,
Long
orderAmt
)
{
public
Observable
<
Response
>
pay
(
int
payChannel
,
Long
orderAmt
)
{
return
Factory
.
pay
(
payChannel
,
orderAmt
);
return
Factory
.
pay
(
payChannel
,
orderAmt
);
}
}
/**
* 退款
*
* @param payChannel 支付渠道
* @param orderAmt 金额
* @return 支付结果的Observable
*/
public
Observable
<
Response
>
refund
(
int
payChannel
,
Long
orderAmt
)
{
return
Factory
.
refund
(
payChannel
,
orderAmt
);
}
/**
* 交易状态
*
* @param orderAmt 原交易金额,为null则不参与查询
* @param origOrderNo 原订单号
* @param transUniqueId 原交易流水号, 为null则不参与查询
* @return
*/
public
Observable
<
Response
>
query
(
Long
orderAmt
,
String
origOrderNo
,
String
transUniqueId
)
{
return
Factory
.
query
(
orderAmt
,
origOrderNo
,
transUniqueId
);
}
}
}
...
...
neptune/src/main/java/com/xingdata/pay/neptune/ipc/C.java
View file @
06a9cf74
...
@@ -2,8 +2,8 @@ package com.xingdata.pay.neptune.ipc;
...
@@ -2,8 +2,8 @@ package com.xingdata.pay.neptune.ipc;
public
class
C
{
public
class
C
{
static
String
APP_ID
=
""
;
static
String
APP_ID
=
"
com.xingdata.zzdpos
"
;
static
String
APP_NAME
=
""
;
static
String
APP_NAME
=
"
TangKuPos
"
;
/**
/**
* 重试次数
* 重试次数
...
@@ -101,5 +101,9 @@ public class C {
...
@@ -101,5 +101,9 @@ public class C {
* 预授权完成请求撤销
* 预授权完成请求撤销
*/
*/
final
static
String
AUTH_CM_VOID
=
"AUTH_CM_VOID"
;
final
static
String
AUTH_CM_VOID
=
"AUTH_CM_VOID"
;
/**
* 交易状态查询
*/
public
static
final
String
TRANS_STAUS_QUERY
=
"ONLINE_QUERY"
;
}
}
}
}
neptune/src/main/java/com/xingdata/pay/neptune/ipc/Factory.java
View file @
06a9cf74
package
com
.
xingdata
.
pay
.
neptune
.
ipc
;
package
com
.
xingdata
.
pay
.
neptune
.
ipc
;
import
android.app.Service
;
import
android.content.ComponentName
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.ServiceConnection
;
import
android.content.ServiceConnection
;
import
android.content.pm.PackageManager
;
import
android.content.pm.ResolveInfo
;
import
android.os.IBinder
;
import
android.os.IBinder
;
import
android.os.RemoteException
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.blankj.utilcode.util.LogUtils
;
import
com.blankj.utilcode.util.LogUtils
;
import
com.blankj.utilcode.util.ToastUtils
;
import
com.pax.pay.service.aidl.PayService
;
import
com.pax.pay.service.aidl.PayService
;
import
com.xingdata.pay.neptune.NeptuneCenter
;
import
com.xingdata.pay.neptune.NeptuneCenter
;
import
com.xingdata.pay.neptune.Response
;
import
com.xingdata.pay.neptune.Response
;
import
java.util.List
;
import
io.reactivex.Observable
;
import
io.reactivex.Observable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.schedulers.Schedulers
;
import
io.reactivex.schedulers.Schedulers
;
public
class
Factory
{
public
class
Factory
{
private
static
PayService
mPayService
;
private
static
PayService
mPayService
;
private
static
ServiceConnection
serviceConnection
;
private
static
class
FactoryHolder
{
private
static
class
FactoryHolder
{
private
static
final
Factory
INSTANCE
=
new
Factory
();
private
static
final
Factory
INSTANCE
=
new
Factory
();
...
@@ -37,23 +32,101 @@ public class Factory {
...
@@ -37,23 +32,101 @@ public class Factory {
}
}
public
void
init
(
Context
context
)
{
public
void
init
(
Context
context
)
{
LogUtils
.
e
(
"开始初始化"
);
if
(
mPayService
==
null
)
{
ServiceConnection
conn
=
new
ServiceConnection
()
{
Intent
intent
=
new
Intent
(
"com.pax.cashier.SERVICE"
);
@Override
serviceConnection
=
new
ServiceConnection
()
{
public
void
onServiceConnected
(
ComponentName
componentName
,
IBinder
iBinder
)
{
@Override
LogUtils
.
e
(
"Service Connected!"
);
public
void
onServiceConnected
(
ComponentName
name
,
IBinder
service
)
{
mPayService
=
PayService
.
Stub
.
asInterface
(
iBinder
);
mPayService
=
PayService
.
Stub
.
asInterface
(
service
);
ToastUtils
.
showLong
(
"bind service success"
);
}
@Override
public
void
onServiceDisconnected
(
ComponentName
name
)
{
}
};
context
.
bindService
(
intent
,
serviceConnection
,
context
.
BIND_AUTO_CREATE
);
}
}
/**
* 交易状态查询
*
* @param orderAmt 交易金额
* @param origOrderNo
* @param transUniqueId
* @return
*/
public
static
Observable
<
Response
>
query
(
Long
orderAmt
,
String
origOrderNo
,
String
transUniqueId
)
{
IRequest
iRequest
=
IRequest
.
create
();
iRequest
.
setOrderNo
(
String
.
valueOf
(
NeptuneCenter
.
getInstance
().
mShopppp
.
getPosppp
().
getHposTrace
()));
if
(
orderAmt
>
0
)
{
iRequest
.
setTransAmount
(
orderAmt
+
""
);
}
if
(!
transUniqueId
.
equals
(
""
))
{
iRequest
.
setOrigTransUniqueID
(
transUniqueId
);
}
iRequest
.
setOrigOrderNo
(
origOrderNo
);
iRequest
.
setTransType
(
C
.
TRANS_TYPE
.
TRANS_STAUS_QUERY
);
return
run
(
Observable
.
just
(
iRequest
).
flatMap
(
iRequest1
->
{
while
(
mPayService
==
null
)
{
LogUtils
.
e
(
"PayService获取失败,"
+
C
.
RETRY_DELAY_TIME
+
"ms后尝试重连"
);
if
(
mRetry
<
C
.
RETRY_COUNT
)
{
Thread
.
sleep
(
C
.
RETRY_DELAY_TIME
);
}
else
{
return
Observable
.
just
(
new
IResponse
(
C
.
CODE
.
FAIL_CUSTOM
,
"初始化失败"
));
}
}
}
IResponse
iResponse
;
String
str
=
mPayService
.
doTrans
(
JSON
.
toJSONString
(
iRequest1
));
try
{
iResponse
=
JSON
.
parseObject
(
str
,
IResponse
.
class
);
}
catch
(
Exception
e
)
{
iResponse
=
new
IResponse
();
}
return
Observable
.
just
(
iResponse
);
}).
map
(
new
ResultFilter
()));
}
@Override
/**
public
void
onServiceDisconnected
(
ComponentName
componentName
)
{
* 退款
LogUtils
.
e
(
"Service Disconnected!"
);
*
* @param payChannel 支付渠道
* @param orderAmt 支付金额
* @return 交易结果
*/
public
static
Observable
<
Response
>
refund
(
int
payChannel
,
Long
orderAmt
)
{
IRequest
iRequest
=
IRequest
.
create
();
iRequest
.
setOrderNo
(
String
.
valueOf
(
NeptuneCenter
.
getInstance
().
mShopppp
.
getPosppp
().
getHposTrace
()));
iRequest
.
setTransType
(
C
.
TRANS_TYPE
.
REFUND
);
iRequest
.
setTransAmount
(
orderAmt
+
""
);
if
(
payChannel
==
com
.
xingdata
.
pay
.
neptune
.
C
.
PAY_CHANNEL
.
BANK
)
{
//银行卡退款
iRequest
.
setPayMode
(
com
.
xingdata
.
pay
.
neptune
.
ipc
.
C
.
PAY_MODE
.
UNIONPAY
);
}
else
{
//微信支付宝退款
iRequest
.
setPayMode
(
com
.
xingdata
.
pay
.
neptune
.
ipc
.
C
.
PAY_MODE
.
WECHAT
);
}
return
run
(
Observable
.
just
(
iRequest
).
flatMap
(
iRequest1
->
{
while
(
mPayService
==
null
)
{
LogUtils
.
e
(
"PayService获取失败,"
+
C
.
RETRY_DELAY_TIME
+
"ms后尝试重连"
);
if
(
mRetry
<
C
.
RETRY_COUNT
)
{
Thread
.
sleep
(
C
.
RETRY_DELAY_TIME
);
}
else
{
return
Observable
.
just
(
new
IResponse
(
C
.
CODE
.
FAIL_CUSTOM
,
"初始化失败"
));
}
}
IResponse
iResponse
;
String
str
=
mPayService
.
doTrans
(
JSON
.
toJSONString
(
iRequest1
));
try
{
iResponse
=
JSON
.
parseObject
(
str
,
IResponse
.
class
);
}
catch
(
Exception
e
)
{
iResponse
=
new
IResponse
();
}
}
};
return
Observable
.
just
(
iResponse
);
final
Intent
i
=
new
Intent
();
}).
map
(
new
ResultFilter
()));
i
.
setAction
(
"com.pax.cashier.PayService"
);
Intent
intent
=
new
Intent
(
createExplicitFromImplicitIntent
(
conqueryAndSputext
,
i
));
context
.
bindService
(
intent
,
conn
,
Service
.
BIND_AUTO_CREATE
);
}
}
/**
/**
...
@@ -63,18 +136,18 @@ public class Factory {
...
@@ -63,18 +136,18 @@ public class Factory {
*/
*/
public
static
Observable
<
Response
>
pay
(
int
payChannel
,
Long
orderAmt
)
{
public
static
Observable
<
Response
>
pay
(
int
payChannel
,
Long
orderAmt
)
{
IRequest
iRequest
=
IRequest
.
create
();
IRequest
iRequest
=
IRequest
.
create
();
iRequest
.
setTransType
(
C
.
TRANS_TYPE
.
SALE
);
iRequest
.
setOrderNo
(
String
.
valueOf
(
NeptuneCenter
.
getInstance
().
mShopppp
.
getPosppp
().
getHposTrace
()));
iRequest
.
setOrderNo
(
String
.
valueOf
(
NeptuneCenter
.
getInstance
().
mShopppp
.
getPosppp
().
getHposTrace
()));
iRequest
.
setTransType
(
com
.
xingdata
.
pay
.
neptune
.
ipc
.
C
.
TRANS_TYPE
.
SALE
);
switch
(
payChannel
)
{
switch
(
payChannel
)
{
case
com
.
xingdata
.
pay
.
neptune
.
C
.
PAY_CHANNEL
.
ALI
:
case
com
.
xingdata
.
pay
.
neptune
.
C
.
PAY_CHANNEL
.
ALI
:
iRequest
.
setPayMode
(
C
.
PAY_MODE
.
ALIPAY
);
//
iRequest.setPayMode(C.PAY_MODE.ALIPAY);
break
;
break
;
case
com
.
xingdata
.
pay
.
neptune
.
C
.
PAY_CHANNEL
.
WECHAT
:
case
com
.
xingdata
.
pay
.
neptune
.
C
.
PAY_CHANNEL
.
WECHAT
:
iRequest
.
setPayMode
(
C
.
PAY_MODE
.
WECHAT
);
//
iRequest.setPayMode(C.PAY_MODE.WECHAT);
break
;
break
;
}
}
iRequest
.
setTransAmount
(
String
.
valueOf
(
orderAmt
));
iRequest
.
setTransAmount
(
String
.
valueOf
(
orderAmt
));
iRequest
.
setOrderInfo
(
"测试信息,扫码消费"
+
String
.
valueOf
(
orderAmt
)
+
"分"
);
return
run
(
Observable
.
just
(
iRequest
).
flatMap
(
iRequest1
->
{
return
run
(
Observable
.
just
(
iRequest
).
flatMap
(
iRequest1
->
{
while
(
mPayService
==
null
)
{
while
(
mPayService
==
null
)
{
LogUtils
.
e
(
"PayService获取失败,"
+
C
.
RETRY_DELAY_TIME
+
"ms后尝试重连"
);
LogUtils
.
e
(
"PayService获取失败,"
+
C
.
RETRY_DELAY_TIME
+
"ms后尝试重连"
);
...
@@ -85,9 +158,10 @@ public class Factory {
...
@@ -85,9 +158,10 @@ public class Factory {
}
}
}
}
IResponse
iResponse
;
IResponse
iResponse
;
String
str
=
mPayService
.
doTrans
(
JSON
.
toJSONString
(
iRequest1
));
try
{
try
{
iResponse
=
JSON
.
parseObject
(
mPayService
.
doTrans
(
JSON
.
toJSONString
(
iRequest1
))
,
IResponse
.
class
);
iResponse
=
JSON
.
parseObject
(
str
,
IResponse
.
class
);
}
catch
(
Remote
Exception
e
)
{
}
catch
(
Exception
e
)
{
iResponse
=
new
IResponse
();
iResponse
=
new
IResponse
();
}
}
return
Observable
.
just
(
iResponse
);
return
Observable
.
just
(
iResponse
);
...
@@ -100,29 +174,5 @@ public class Factory {
...
@@ -100,29 +174,5 @@ public class Factory {
.
observeOn
(
AndroidSchedulers
.
mainThread
());
.
observeOn
(
AndroidSchedulers
.
mainThread
());
}
}
public
static
Intent
createExplicitFromImplicitIntent
(
Context
context
,
Intent
implicitIntent
)
{
// Retrieve all services that can match the given intent
PackageManager
pm
=
context
.
getPackageManager
();
List
<
ResolveInfo
>
resolveInfo
=
pm
.
queryIntentServices
(
implicitIntent
,
0
);
// Make sure only one match was found
if
(
resolveInfo
==
null
||
resolveInfo
.
size
()
!=
1
)
{
return
null
;
}
// Get component info and create ComponentName
ResolveInfo
serviceInfo
=
resolveInfo
.
get
(
0
);
String
packageName
=
serviceInfo
.
serviceInfo
.
packageName
;
String
className
=
serviceInfo
.
serviceInfo
.
name
;
ComponentName
component
=
new
ComponentName
(
packageName
,
className
);
// Create a new intent. Use the old one for extras and such reuse
Intent
explicitIntent
=
new
Intent
(
implicitIntent
);
// Set the component to be explicit
explicitIntent
.
setComponent
(
component
);
return
explicitIntent
;
}
}
}
neptune/src/main/java/com/xingdata/pay/neptune/ipc/IRequest.java
View file @
06a9cf74
...
@@ -21,7 +21,7 @@ class IRequest {
...
@@ -21,7 +21,7 @@ class IRequest {
*/
*/
private
String
appName
;
private
String
appName
;
/**
/**
*
交易类型
*
收银台应用名称
*/
*/
private
String
transType
;
private
String
transType
;
/**
/**
...
@@ -40,6 +40,14 @@ class IRequest {
...
@@ -40,6 +40,14 @@ class IRequest {
* 原交易唯一标识
* 原交易唯一标识
*/
*/
private
String
transUniqueIDString
;
private
String
transUniqueIDString
;
/**
* 原收银台交易唯一标识
*/
private
String
origTransUniqueID
;
private
String
orderInfo
;
private
String
origOrderNo
;
private
String
origOrderInfo
;
public
String
getAppId
()
{
public
String
getAppId
()
{
return
appId
;
return
appId
;
...
@@ -96,4 +104,36 @@ class IRequest {
...
@@ -96,4 +104,36 @@ class IRequest {
public
void
setTransUniqueIDString
(
String
transUniqueIDString
)
{
public
void
setTransUniqueIDString
(
String
transUniqueIDString
)
{
this
.
transUniqueIDString
=
transUniqueIDString
;
this
.
transUniqueIDString
=
transUniqueIDString
;
}
}
public
String
getOrderInfo
()
{
return
orderInfo
;
}
public
void
setOrderInfo
(
String
orderInfo
)
{
this
.
orderInfo
=
orderInfo
;
}
public
String
getOrigOrderNo
()
{
return
origOrderNo
;
}
public
void
setOrigOrderNo
(
String
origOrderNo
)
{
this
.
origOrderNo
=
origOrderNo
;
}
public
String
getOrigOrderInfo
()
{
return
origOrderInfo
;
}
public
void
setOrigOrderInfo
(
String
origOrderInfo
)
{
this
.
origOrderInfo
=
origOrderInfo
;
}
public
String
getOrigTransUniqueID
()
{
return
origTransUniqueID
;
}
public
void
setOrigTransUniqueID
(
String
origTransUniqueID
)
{
this
.
origTransUniqueID
=
origTransUniqueID
;
}
}
}
neptune/src/main/java/com/xingdata/pay/neptune/ipc/ResultFilter.java
View file @
06a9cf74
...
@@ -8,6 +8,13 @@ import io.reactivex.functions.Function;
...
@@ -8,6 +8,13 @@ import io.reactivex.functions.Function;
class
ResultFilter
implements
Function
<
IResponse
,
Response
>
{
class
ResultFilter
implements
Function
<
IResponse
,
Response
>
{
@Override
@Override
public
Response
apply
(
IResponse
iResponse
)
throws
Exception
{
public
Response
apply
(
IResponse
iResponse
)
throws
Exception
{
return
null
;
int
code
;
if
(
iResponse
.
getRspCode
().
equals
(
"0"
))
{
code
=
1
;
}
else
{
code
=
Integer
.
parseInt
(
iResponse
.
getRspCode
());
}
Response
response
=
new
Response
(
code
,
iResponse
.
getRspMsg
());
return
response
;
}
}
}
}
\ No newline at end of file
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