Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
supplier
Overview
Overview
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
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王宇航
supplier
Commits
d3cc4b0f
Commit
d3cc4b0f
authored
Dec 31, 2020
by
宁斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
賬單管理功能button調整,N5支付取消,退款,補小費
parent
b4efd6e3
Hide whitespace changes
Inline
Side-by-side
Showing
58 changed files
with
2229 additions
and
883 deletions
+2229
-883
component-pay/src/main/java/com/gingersoft/gsa/cloud/pay/mvp/ui/activity/PayResultActivity.java
+108
-110
component-pay/src/main/res/layout/activity_pay_result.xml
+119
-95
component-table/src/main/java/com/gingersoft/gsa/cloud/table/ComponentTable.java
+17
-10
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/model/bean/response/OrderManagerResponse.java
+72
-17
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/model/utils/OrderAssemblyUtil.java
+1
-1
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/TablePresenter.java
+18
-0
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/orderManager/AllOrderPresenter.java
+181
-2
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/OrderPayActivity.java
+2
-1
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/orderManager/OrderCenterActivity.java
+1
-1
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/orderManager/OrderDetailActivity.java
+207
-6
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/adapter/OrderCenterAdapter.java
+51
-7
component-table/src/main/res/layout/activity_order_center.xml
+7
-0
component-table/src/main/res/layout/activity_order_detail.xml
+5
-0
component-table/src/main/res/layout/item_order_center.xml
+1
-1
component-table/src/main/res/layout/table_activity_table.xml
+5
-0
library-common/src/main/java/com/gingersoft/gsa/cloud/common/config/globalconfig/lifecyclesOptioins/MyActivityLifecycle.java
+8
-4
library-common/src/main/java/com/gingersoft/gsa/cloud/common/core/table/TableBean.java
+77
-1
library-common/src/main/java/com/gingersoft/gsa/cloud/component/ComponentAction.java
+4
-0
library-order/build.gradle
+11
-0
library-order/src/main/AndroidManifest.xml
+1
-1
library-order/src/main/java/com/gingersoft/gsa/cloud/order/bean/event/MealPayResultParam.java
+42
-1
library-order/src/main/java/com/gingersoft/gsa/cloud/order/bean/request/MealOrderPayRequest.java
+92
-2
library-order/src/main/java/com/gingersoft/gsa/cloud/order/bean/response/OrderResponse.java
+15
-2
library-order/src/main/java/com/gingersoft/gsa/cloud/order/billItem/BillItem.java
+42
-1
library-order/src/main/java/com/gingersoft/gsa/cloud/order/cart/ShoppingCart.java
+7
-3
library-order/src/main/java/com/gingersoft/gsa/cloud/order/order/DoshokuOrder.java
+9
-40
library-order/src/main/java/com/gingersoft/gsa/cloud/order/order/TakeawayOrder.java
+5
-1
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/bean/PayMethod.java
+128
-345
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/bean/PosActionStatusExceptionParam.java
+62
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/contract/PayErrorCode.java
+3
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/IPosAction.java
+8
-33
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/IPosCallback.java
+0
-32
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/OnPosActionListener.java
+18
-4
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/PosAction.java
+1
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/PosPay.java
+42
-1
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/bbpos/BBPosCallback.java
+0
-54
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/bean/PosMatter.java
+59
-1
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/fragment/PosActionStatusExceptionFragment.java
+213
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/bg/GetTipTxnIdResponse.java
+17
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/AdjustTipRespose.java
+41
-2
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/HywebPosResponse.java
+30
-2
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/RefundRespose.java
+40
-1
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/RetrievalRespose.java
+76
-2
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/SaleRespose.java
+53
-2
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/SettlementRespose.java
+29
-1
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/VoidRespose.java
+40
-1
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/command/CommandImpl.java
+4
-7
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/constant/PayStatusCode.java
+25
-2
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/RefundActionImpl.java
+19
-12
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/RetrievalActionImpl.java
+20
-8
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/SaleActionImpl.java
+30
-31
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/TipsActionImpl.java
+33
-21
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/VoidActionImpl.java
+21
-9
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/view/customstatus/CustomStatusView.java
+1
-1
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/widget/StatusLoadingDialog.java
+2
-4
library-order/src/main/res/layout/pay_fragment_pos_status_exception.xml
+106
-0
library-order/src/main/res/mipmap-xhdpi/pay_status_exception.png
+0
-0
library-order/src/main/res/mipmap-xhdpi/pay_status_success.png
+0
-0
No files found.
component-pay/src/main/java/com/gingersoft/gsa/cloud/pay/mvp/ui/activity/PayResultActivity.java
View file @
d3cc4b0f
...
...
@@ -5,47 +5,41 @@ import android.os.Bundle;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.widget.LinearLayout
;
import
android.widget.
ScrollView
;
import
android.widget.
RelativeLayout
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.core.content.ContextCompat
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.billy.cc.core.component.CC
;
import
com.gingersoft.gsa.cloud.common.
loadsir.ErrorCallback
;
import
com.billy.cc.core.component.CC
Util
;
import
com.gingersoft.gsa.cloud.common.
constans.AppConstans
;
import
com.gingersoft.gsa.cloud.common.utils.MoneyUtil
;
import
com.gingersoft.gsa.cloud.component.ComponentAction
;
import
com.gingersoft.gsa.cloud.component.ComponentName
;
import
com.gingersoft.gsa.cloud.order.bean.event.MealPayResultEvent
;
import
com.gingersoft.gsa.cloud.order.bean.event.MealPayResultParam
;
import
com.gingersoft.gsa.cloud.order.order.DoshokuOrder
;
import
com.gingersoft.gsa.cloud.pay.R
;
import
com.gingersoft.gsa.cloud.pay.R2
;
import
com.gingersoft.gsa.cloud.pay.bean.PayMethod
;
import
com.gingersoft.gsa.cloud.pay.bean.PosActionStatusExceptionParam
;
import
com.gingersoft.gsa.cloud.pay.di.component.DaggerPayResultComponent
;
import
com.gingersoft.gsa.cloud.pay.mvp.contract.PayResultContract
;
import
com.gingersoft.gsa.cloud.pay.mvp.presenter.PayResultPresenter
;
import
com.gingersoft.gsa.cloud.pay.mvp.ui.adapter.ResultBillItemAdapter
;
import
com.gingersoft.gsa.cloud.pay.pos.OnPosActionListener
;
import
com.gingersoft.gsa.cloud.pay.pos.PosAction
;
import
com.gingersoft.gsa.cloud.pay.pos.PosPay
;
import
com.gingersoft.gsa.cloud.pay.pos.fragment.PosActionStatusExceptionFragment
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.bg.GetTxnIdRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.AdjustTipRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.RetrievalRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.HywebPosResponse
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.SaleRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.constant.PayStatusCode
;
import
com.gingersoft.gsa.cloud.ui.widget.dialog.KeyboardDialog
;
import
com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog
;
import
com.jess.arms.base.BaseActivity
;
import
com.jess.arms.base.Base
Fragment
Activity
;
import
com.jess.arms.di.component.AppComponent
;
import
com.jess.arms.utils.ArmsUtils
;
import
com.kingja.loadsir.callback.Callback
;
import
com.kingja.loadsir.core.LoadService
;
import
com.kingja.loadsir.core.LoadSir
;
import
com.qmuiteam.qmui.widget.QMUITopBar
;
import
com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
;
import
org.simple.eventbus.Subscriber
;
import
java.util.List
;
...
...
@@ -67,34 +61,39 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public
class
PayResultActivity
extends
BaseActivity
<
PayResultPresenter
>
implements
PayResultContract
.
View
{
public
class
PayResultActivity
extends
BaseFragmentActivity
<
PayResultPresenter
>
implements
PayResultContract
.
View
{
@BindView
(
R2
.
id
.
topbar
)
QMUITopBar
topbar
;
@BindView
(
R2
.
id
.
scrollView
)
ScrollView
scrollView
;
@BindView
(
R2
.
id
.
tv_table_name
)
TextView
tvTableName
;
@BindView
(
R2
.
id
.
tv_order_num
)
TextView
tvOrderNum
;
@BindView
(
R2
.
id
.
rv_bill_and_paymethod
)
RecyclerView
rvBillAndPaymethod
;
@BindView
(
R2
.
id
.
btn_tips
)
QMUIRoundButton
btnTips
;
@BindView
(
R2
.
id
.
btn_printer
)
QMUIRoundButton
btnPrinter
;
@BindView
(
R2
.
id
.
btn_complate
)
QMUIRoundButton
btnComplate
;
@BindView
(
R2
.
id
.
ll_container
)
LinearLayout
llContainer
;
@BindView
(
R2
.
id
.
tv_pay_status
)
TextView
tvPayStatus
;
@BindView
(
R2
.
id
.
tv_amount
)
TextView
tvAmount
;
@BindView
(
R2
.
id
.
tv_paymethod
)
TextView
tv_paymethod
;
TextView
tvPaymethod
;
@BindView
(
R2
.
id
.
ll_content
)
LinearLayout
llContent
;
@BindView
(
R2
.
id
.
tv_tips
)
TextView
tvTips
;
@BindView
(
R2
.
id
.
tv_printer
)
TextView
tvPrinter
;
@BindView
(
R2
.
id
.
tv_complate
)
TextView
tvComplate
;
@BindView
(
R2
.
id
.
ll_bottom
)
LinearLayout
llBottom
;
@BindView
(
R2
.
id
.
rl_container
)
RelativeLayout
rlContainer
;
private
LoadService
loadService
;
private
MealPayResultParam
mMealPayResultParam
;
private
SaleRespose
mSaleRespose
;
private
MealPayResultEvent
mPayResultEvent
;
private
String
mPayMehodNames
;
@Override
public
void
setupActivityComponent
(
@NonNull
AppComponent
appComponent
)
{
...
...
@@ -113,93 +112,61 @@ public class PayResultActivity extends BaseActivity<PayResultPresenter> implemen
@Override
public
void
initData
(
@Nullable
Bundle
savedInstanceState
)
{
// loadService = LoadSir.getDefault().register(rlContainer, new Callback.OnReloadListener() {
// @Override
// public void onReload(View v) {
//// onRetrievalRequest(mPayResultEvent.getTxnId());
// }
// });
// loadService.showSuccess();
}
loadService
=
LoadSir
.
getDefault
().
register
(
scrollView
,
new
Callback
.
OnReloadListener
()
{
@Override
public
void
onReload
(
View
v
)
{
onRetrievalRequest
(
mPayResultEvent
.
getTxnId
());
}
}
);
loadService
.
showSuccess
();
@Override
public
void
initIntent
()
{
MealPayResultParam
payResultParam
=
CCUtil
.
getNavigateParam
(
this
,
"payResultParam"
,
null
);
if
(
payResultParam
!=
null
)
{
this
.
mMealPayResultParam
=
payResultParam
;
initMealPayResultParam
(
);
}
}
@Subscriber
(
tag
=
"onIntentPayStatusSuccess"
)
private
void
onIntentPayStatusSuccess
(
MealPayResultEvent
payResultEvent
)
{
this
.
mPayResultEvent
=
payResultEvent
;
if
(
payResultEvent
.
getSaleRespose
().
getSTATUS
().
equals
(
PayStatusCode
.
PAY_STATUS_00
))
{
private
void
initMealPayResultParam
()
{
mSaleRespose
=
mMealPayResultParam
.
getSaleRespose
();
if
(
PayStatusCode
.
withSuccess
(
mSaleRespose
.
getSTATUS
()))
{
ResultBillItemAdapter
adapter
=
new
ResultBillItemAdapter
(
payResultEvent
.
getBillItemList
());
rvBillAndPaymethod
.
setAdapter
(
adapter
);
mPayMehodNames
=
getPayMehodStr
(
mMealPayResultParam
.
getPayMethodList
());
tv_paymethod
.
setText
(
getPayMehodStr
(
payResultEvent
.
getPayMethodList
()));
tvTableName
.
setText
(
"檯號: "
+
payResultEvent
.
getTableBean
().
getTableName
());
tvOrderNum
.
setText
(
"單號: "
+
payResultEvent
.
getMealOrderPayRequest
().
getOrderId
());
loadService
.
showSuccess
();
tvAmount
.
setText
(
getPayAmount
(
mSaleRespose
.
getTXN_AMT
()));
tvPaymethod
.
setText
(
mPayMehodNames
);
tvTableName
.
setText
(
"檯號: "
+
mMealPayResultParam
.
getTableBean
().
getTableName
());
tvOrderNum
.
setText
(
"單號: "
+
mMealPayResultParam
.
getMealOrderPayRequest
().
getOrderId
());
// loadService.showSuccess();
}
else
{
loadService
.
showCallback
(
ErrorCallback
.
class
);
//
loadService.showCallback(ErrorCallback.class);
}
}
@Subscriber
(
tag
=
"onIntentPayStatusError"
)
private
void
onIntentPayStatusError
(
MealPayResultEvent
payResultEvent
)
{
this
.
mPayResultEvent
=
payResultEvent
;
loadService
.
showCallback
(
ErrorCallback
.
class
);
private
String
getPayAmount
(
double
payAmount
)
{
return
AppConstans
.
CARSH_STR
+
payAmount
;
}
private
String
getPayMehodStr
(
List
<
PayMethod
>
payMethodList
)
{
StringBuilder
s
tringBuilder
=
new
StringBuilder
();
StringBuilder
s
b
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
payMethodList
.
size
();
i
++)
{
PayMethod
payMethod
=
payMethodList
.
get
(
i
);
if
(
i
<
payMethodList
.
size
())
{
s
tringBuilder
.
append
(
payMethod
.
getPayName
()
+
","
);
if
(
i
<
payMethodList
.
size
()
&&
payMethodList
.
size
()
!=
0
)
{
s
b
.
append
(
payMethod
.
getPayName
()
+
","
);
}
else
{
s
tringBuilder
.
append
(
payMethod
.
getPayName
());
s
b
.
append
(
payMethod
.
getPayName
());
}
}
return
stringBuilder
.
toString
();
}
/**
* 重新調起Hyweb重新獲取支付狀態
*/
private
void
onRetrievalRequest
(
String
txnId
)
{
RetrievalRequest
retrievalRequest
=
new
RetrievalRequest
();
retrievalRequest
.
setTXN_ID
(
txnId
);
DoshokuOrder
.
getInstance
().
retrieval
(
mContext
,
PayResultActivity
.
this
,
retrievalRequest
,
new
OnPosActionListener
()
{
@Override
public
void
onSuccess
(
HywebPosResponse
response
)
{
loadService
.
showSuccess
();
}
@Override
public
void
onError
(
Throwable
e
)
{
}
@Override
public
void
onResponseNull
()
{
}
});
}
@Override
public
void
initIntent
()
{
return
sb
.
toString
();
}
@Override
public
void
initTopBar
()
{
topbar
.
setTitle
(
"支付結果"
);
topbar
.
setBackgroundColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
theme_color
));
// topbar.addLeftBackImageButton().setOnClickListener(new View.OnClickListener() {
//
// @Override
// public void onClick(View v) {
// killMyself();
// }
// });
}
@Override
...
...
@@ -247,18 +214,24 @@ public class PayResultActivity extends BaseActivity<PayResultPresenter> implemen
finish
();
}
@OnClick
({
R2
.
id
.
btn_tips
,
R2
.
id
.
btn_printer
,
R2
.
id
.
btn_complate
})
@Override
public
void
onBackPressedSupport
()
{
killMyself
();
}
@OnClick
({
R2
.
id
.
tv_tips
,
R2
.
id
.
tv_printer
,
R2
.
id
.
tv_complate
})
public
void
onViewClicked
(
View
view
)
{
if
(
view
.
getId
()
==
R
.
id
.
btn
_tips
)
{
if
(
view
.
getId
()
==
R
.
id
.
tv
_tips
)
{
showKeyboardDialog
();
}
else
if
(
view
.
getId
()
==
R
.
id
.
btn
_printer
)
{
}
else
if
(
view
.
getId
()
==
R
.
id
.
tv
_printer
)
{
}
else
if
(
view
.
getId
()
==
R
.
id
.
btn
_complate
)
{
}
else
if
(
view
.
getId
()
==
R
.
id
.
tv
_complate
)
{
//返回餐檯頁面
CC
.
obtainBuilder
(
ComponentName
.
COMPONENT_TABLE
)
.
setActionName
(
ComponentAction
.
Table
.
KILL_MEAL_ORDER_PAY
)
.
build
()
.
call
();
// CC.obtainBuilder(ComponentName.COMPONENT_TABLE)
// .setActionName(ComponentAction.Table.KILL_MEAL_ORDER_PAY)
// .build()
// .call();
killMyself
();
}
}
...
...
@@ -270,24 +243,48 @@ public class PayResultActivity extends BaseActivity<PayResultPresenter> implemen
public
void
onSure
(
String
number
)
{
if
(!
TextUtils
.
isEmpty
(
number
))
{
// GetTxnIdRequest txnIdRequest = new GetTxnIdRequest();
// txnIdRequest.setOrderId(DoshokuOrder.getInstance().getOrderId());
// txnIdRequest.setOrderId(DoshokuOrder.getInstance().getOrderId());
// txnIdRequest.setOrderId(DoshokuOrder.getInstance().getOrderId());
// txnIdRequest.setOrderId(DoshokuOrder.getInstance().getOrderId());
GetTxnIdRequest
txnIdRequest
=
new
GetTxnIdRequest
();
txnIdRequest
.
setOrderId
(
DoshokuOrder
.
getInstance
().
getOrderId
());
if
(!
TextUtils
.
isEmpty
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getTableNumber
()))
{
txnIdRequest
.
setTableExtId
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getId
());
}
else
{
txnIdRequest
.
setTableId
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getId
());
}
txnIdRequest
.
setAmount
(
mSaleRespose
.
getTXN_AMT
());
PosPay
.
tip
(
mContext
,
PayResultActivity
.
this
,
txnIdRequest
,
getTipsRequest
(
mMealPayResultParam
.
getSaleRespose
(),
Double
.
parseDouble
(
number
)),
new
OnPosActionListener
()
{
DoshokuOrder
.
getInstance
().
tip
(
mContext
,
PayResultActivity
.
this
,
txnIdRequest
,
getTipsRequest
(
mPayResultEvent
.
getSaleRespose
(),
Double
.
parseDouble
(
number
)),
new
OnPosActionListener
()
{
@Override
public
void
onSuccess
(
HywebPosResponse
response
)
{
//刷新賬單頁面
public
void
onPosSuccess
(
HywebPosResponse
response
)
{
}
@Override
public
void
onError
(
Throwable
e
)
{
public
void
onPosException
(
HywebPosResponse
response
)
{
if
(
findFragment
(
PosActionStatusExceptionFragment
.
class
)
==
null
)
{
PosActionStatusExceptionParam
statusExceptionParam
=
new
PosActionStatusExceptionParam
();
statusExceptionParam
.
setTxnId
(
mMealPayResultParam
.
getTxnId
());
statusExceptionParam
.
setAmount
(
mSaleRespose
.
getTXN_AMT
());
statusExceptionParam
.
setOrderNum
(
mMealPayResultParam
.
getMealOrderPayRequest
().
getOrderId
());
statusExceptionParam
.
setPayMethodName
(
mPayMehodNames
);
statusExceptionParam
.
setPosAction
(
PosAction
.
TIP
);
loadRootFragment
(
R
.
id
.
rl_container
,
PosActionStatusExceptionFragment
.
newInstance
(
statusExceptionParam
));
}
}
@Override
public
void
onSuccess
(
HywebPosResponse
response
)
{
}
@Override
public
void
on
ResponseNull
(
)
{
onRetrievalRequest
(
mPayResultEvent
.
getTxnId
());
public
void
on
Error
(
Throwable
e
)
{
}
});
}
...
...
@@ -302,4 +299,5 @@ public class PayResultActivity extends BaseActivity<PayResultPresenter> implemen
tipRequest
.
setTOTAL_TXN_AMT
(
MoneyUtil
.
sum
(
saleRespose
.
getTXN_AMT
(),
tips
));
return
tipRequest
;
}
}
component-pay/src/main/res/layout/activity_pay_result.xml
View file @
d3cc4b0f
<?xml version="1.0" encoding="utf-8"?>
<
Linear
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
Relative
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/
l
l_container"
android:id=
"@+id/
r
l_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/theme_white_color"
...
...
@@ -14,110 +14,134 @@
android:background=
"@color/theme_color"
app:qmui_topbar_title_color=
"@color/theme_white_color"
/>
<
ScrollView
android:id=
"@+id/
scrollView
"
<
LinearLayout
android:id=
"@+id/
ll_content
"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:fillViewport=
"true"
>
android:layout_below=
"@+id/topbar"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"
match_parent
"
android:orientation=
"
vertic
al"
>
android:layout_height=
"
@dimen/dp_50
"
android:orientation=
"
horizont
al"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_30"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/tv_table_name"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"@color/theme_white_color"
android:gravity=
"center"
android:text=
"檯號:"
android:textColor=
"@color/black"
android:textSize=
"@dimen/font_normal3"
/>
<TextView
android:id=
"@+id/tv_table_name"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"@color/theme_white_color"
android:gravity=
"center"
android:text=
""
android:textColor=
"@color/black"
android:textSize=
"@dimen/font_normal"
/>
<View
android:layout_width=
"3dp"
android:layout_height=
"match_parent"
/>
<View
android:layout_width=
"3dp"
android:layout_height=
"match_parent"
/>
<TextView
android:id=
"@+id/tv_order_num"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:gravity=
"center"
android:text=
"單號:"
android:textColor=
"@color/theme_black"
android:textSize=
"@dimen/font_normal3"
/>
</LinearLayout>
<TextView
android:id=
"@+id/tv_order_num
"
android:layout_width=
"0dp
"
android:layout_height=
"match_par
ent"
android:layout_weight=
"1
"
android:background=
"@color/green_400
"
android:gravity=
"center
"
android:textColor=
"@color/black
"
android:textSize=
"@dimen/font_normal"
/>
</LinearLayout
>
<TextView
android:id=
"@+id/tv_pay_status
"
android:layout_width=
"wrap_content
"
android:layout_height=
"wrap_cont
ent"
android:gravity=
"center
"
android:drawablePadding=
"@dimen/dp_6
"
android:layout_marginTop=
"@dimen/dp_50
"
android:drawableTop=
"@mipmap/pay_status_success
"
android:text=
"支付成功"
android:textSize=
"@dimen/font_normal2"
/
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_bill_and_paymethod"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:divider=
"@color/theme_white_color"
android:fadeScrollbars=
"false"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
app:spanCount=
"1"
/>
<TextView
android:id=
"@+id/tv_amount"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:text=
"$500"
android:textSize=
"@dimen/sp_32"
android:textColor=
"@color/theme_black"
/>
<TextView
android:id=
"@+id/tv_paymethod"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:padding=
"@dimen/dp_10"
android:gravity=
"center"
android:textColor=
"@color/black"
android:textSize=
"@dimen/sp_16"
/>
<TextView
android:id=
"@+id/tv_paymethod"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:layout_marginTop=
"@dimen/dp_20"
android:textColor=
"@color/black"
android:textSize=
"@dimen/sp_16"
/>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id=
"@+id/tv_complate"
android:layout_width=
"@dimen/dp_120"
android:layout_height=
"@dimen/dp_50"
android:layout_marginTop=
"@dimen/dp_30"
android:text=
"完成"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/font_normal2"
android:background=
"@drawable/shape_app_btn"
app:cornerRadius=
"@dimen/dp_6"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_40"
android:layout_marginBottom=
"@dimen/dp_2"
android:orientation=
"horizontal"
>
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/rv_bill_and_paymethod"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:divider="@color/theme_white_color"-->
<!-- android:fadeScrollbars="false"-->
<!-- app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"-->
<!-- app:spanCount="1" />-->
</LinearLayout>
<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id=
"@+id/btn_tips"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:text=
"貼士"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/font_normal3"
app:qmui_backgroundColor=
"@color/green_400"
app:qmui_borderColor=
"@color/green_400"
app:qmui_radius=
"@dimen/dp_20"
/>
<LinearLayout
android:id=
"@+id/ll_bottom"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_40"
android:orientation=
"horizontal"
android:layout_alignParentBottom=
"true"
>
<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id=
"@+id/btn_printer"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:text=
"打印"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/font_normal3"
app:qmui_backgroundColor=
"@color/orange_400"
app:qmui_borderColor=
"@color/orange_400"
app:qmui_radius=
"@dimen/dp_20"
/>
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id=
"@+id/tv_tips"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:background=
"@color/green_400"
android:gravity=
"center"
android:text=
"貼士"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/font_normal2"
/>
<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id=
"@+id/btn_complate"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:text=
"完成"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/font_normal3"
app:qmui_backgroundColor=
"@color/theme_color"
app:qmui_borderColor=
"@color/theme_color"
app:qmui_radius=
"@dimen/dp_20"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
\ No newline at end of file
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id=
"@+id/tv_printer"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:background=
"@color/orange_400"
android:gravity=
"center"
android:text=
"打印"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/font_normal2"
/>
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaTextView-->
<!-- android:id="@+id/tv_complate"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_weight="1"-->
<!-- android:background="@color/theme_color"-->
<!-- android:gravity="center"-->
<!-- android:text="完成"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:textSize="@dimen/font_normal3" />-->
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
component-table/src/main/java/com/gingersoft/gsa/cloud/table/ComponentTable.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
table
;
import
android.content.Context
;
import
com.billy.cc.core.component.CC
;
import
com.billy.cc.core.component.CCResult
;
import
com.billy.cc.core.component.CCUtil
;
import
com.billy.cc.core.component.IComponent
;
import
com.gingersoft.gsa.cloud.common.function.FModule
;
import
com.gingersoft.gsa.cloud.component.ComponentAction
;
import
com.gingersoft.gsa.cloud.order.order.DoshokuOrder
;
import
com.gingersoft.gsa.cloud.order.order.TakeawayOrder
;
import
com.gingersoft.gsa.cloud.table.mvp.ui.activity.MealStandActivity
;
import
com.gingersoft.gsa.cloud.table.mvp.ui.activity.OrderContentActivity
;
import
com.gingersoft.gsa.cloud.table.mvp.ui.activity.OrderPayActivity
;
...
...
@@ -13,15 +17,11 @@ import com.gingersoft.gsa.cloud.table.mvp.ui.activity.SoldoutCtrlActivity;
import
com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity
;
import
com.gingersoft.gsa.cloud.table.mvp.ui.activity.orderManager.OrderCenterActivity
;
import
com.jess.arms.integration.AppManager
;
import
javax.inject.Inject
;
import
com.jess.arms.utils.ArmsUtils
;
public
class
ComponentTable
implements
IComponent
{
@Inject
AppManager
mAppManager
;
public
static
final
class
table
{
/**
* 餐檯頁
...
...
@@ -57,7 +57,7 @@ public class ComponentTable implements IComponent {
public
String
getName
()
{
//组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync()
return
com
.
gingersoft
.
gsa
.
cloud
.
component
.
ComponentName
.
COMPONENT_TABLE
;
return
com
.
gingersoft
.
gsa
.
cloud
.
component
.
ComponentName
.
COMPONENT_TABLE
;
}
/**
...
...
@@ -71,6 +71,7 @@ public class ComponentTable implements IComponent {
*/
@Override
public
boolean
onCall
(
CC
cc
)
{
Context
context
=
cc
.
getContext
();
String
actionName
=
cc
.
getActionName
();
switch
(
actionName
)
{
case
"showTableActivity"
:
...
...
@@ -98,11 +99,17 @@ public class ComponentTable implements IComponent {
case
"getInfo"
:
getInfo
(
cc
);
break
;
case
ComponentAction
.
Table
.
INT_ORDER
:
//初始化堂食賬單類
DoshokuOrder
.
getInstance
().
initialization
();
//初始化外賣賬單類
TakeawayOrder
.
getInstance
().
initialization
();
break
;
case
ComponentAction
.
Table
.
KILL_MEAL_ORDER_PAY
:
mAppManager
.
findActivity
(
OrderPayActivity
.
class
);
mAppManager
.
findActivity
(
OrderContentActivity
.
class
);
mAppManager
.
findActivity
(
MealStandActivity
.
class
);
AppManager
appManager
=
ArmsUtils
.
obtainAppComponentFromContext
(
context
).
appManager
();
appManager
.
killActivity
(
OrderPayActivity
.
class
);
appManager
.
killActivity
(
OrderContentActivity
.
class
);
appManager
.
killActivity
(
MealStandActivity
.
class
);
break
;
default
:
//这个逻辑分支上没有调用CC.sendCCResult(...),是一种错误的示例
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/model/bean/response/OrderManagerResponse.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
table
.
mvp
.
model
.
bean
.
response
;
import
android.text.TextUtils
;
import
com.gingersoft.gsa.cloud.common.core.member.MemberInfo
;
import
com.gingersoft.gsa.cloud.common.core.table.TableBean
;
import
com.gingersoft.gsa.cloud.order.bean.response.OrderDiscountResponse
;
...
...
@@ -53,41 +55,87 @@ public class OrderManagerResponse implements Serializable {
* 7:自取
*/
private
int
orderType
;
/**總金額*/
/**
* 總金額
*/
private
double
totalAmount
;
private
int
totalPoints
;
/**支付金額*/
/**
* 支付金額
*/
private
double
amount
;
/**賬單小數*/
/**
* 賬單小數
*/
private
Double
rounding
;
/**服務費*/
/**
* 服務費
*/
private
Double
serviceAmount
;
/**訂單碼*/
/**
* 訂單碼
*/
private
String
billNo
;
/**取餐碼*/
/**
* 取餐碼
*/
private
String
takeFoodCode
;
/**生成訂單時間*/
/**
* 生成訂單時間
*/
private
String
createTime
;
/**結賬時間*/
/**
* 結賬時間
*/
private
String
endTime
;
/**訂單食品詳情*/
/**
* 訂單食品詳情
*/
private
List
<
OrderResponse
.
OrderDetailsBean
>
orderDetails
;
/**折扣詳情*/
/**
* 折扣詳情
*/
private
List
<
OrderDiscountResponse
>
discountDetails
;
/**支付詳情*/
/**
* 支付詳情
*/
private
List
<
OrderPayBean
>
orderPays
;
/**餐檯信息*/
/**
* 餐檯信息
*/
private
TableBean
.
DataBean
restaurantTable
;
/**會員信息*/
/**
* 會員信息
*/
private
MemberInfo
memberInfo
;
/**會員積分碼*/
/**
* 會員積分碼
*/
private
String
verifyCode
;
/**會員積分相关实体*/
/**
* 會員積分相关实体
*/
private
OrderPayResponse
integralInfo
;
/**
* N5相關,以下哪個參數不為Null說明為當前支付狀態
*/
/**
* N5 支付TXN_ID
*/
private
String
payTxnId
;
/**
* N5取消支付TXN_ID
*/
private
String
cancelTxnId
;
/**
* N5退款Refund_Id
*/
private
String
refundTxnId
;
/**
* 訂單狀態:0:未支付;1:待確認(已支付, 待餐廳確認);2:制作中(餐厅确认);3:派送中;4:确认收货(完成);5:是否评论;6:取消;
*/
public
static
final
byte
STATUS_UNPAID
=
0
;
...
...
@@ -98,7 +146,6 @@ public class OrderManagerResponse implements Serializable {
public
static
final
byte
STATUS_COMMENT
=
5
;
public
static
final
byte
STATUS_CANCEL
=
6
;
/**
* 订单类型1:堂食2:外賣3:掃碼點餐5:預點餐7:自取
*/
...
...
@@ -106,8 +153,16 @@ public class OrderManagerResponse implements Serializable {
public
static
final
byte
ORDER_TYPE_TAKEAWAY
=
2
;
public
static
final
byte
ORDER_TYPE_SELFCOLLECTION
=
7
;
public
boolean
withHywebPay
()
{
if
(!
TextUtils
.
isEmpty
(
payTxnId
)
||
!
TextUtils
.
isEmpty
(
cancelTxnId
)
||
!
TextUtils
.
isEmpty
(
refundTxnId
))
{
return
true
;
}
return
false
;
}
@Data
public
static
final
class
OrderPayBean
implements
Serializable
{
public
static
final
class
OrderPayBean
implements
Serializable
{
private
long
id
;
private
long
lineOrderId
;
private
int
payType
;
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/model/utils/OrderAssemblyUtil.java
View file @
d3cc4b0f
...
...
@@ -28,7 +28,7 @@ public class OrderAssemblyUtil {
newOrderDetails
.
addAll
(
getOrdersItem2ByParentId
(
orderDetails
,
order
.
getId
(),
order
.
getProductId
(),
i
));
}
}
return
newOrderDetails
;
return
newOrderDetails
;
//10 + 7
}
private
static
List
<
OrderDetail
>
getOrdersItem2ByParentId
(
List
<
OrderDetail
>
orderDetails
,
long
id
,
long
productId
,
int
startIndex
)
{
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/TablePresenter.java
View file @
d3cc4b0f
...
...
@@ -26,6 +26,9 @@ import com.gingersoft.gsa.cloud.order.bean.response.OrderResponse;
import
com.gingersoft.gsa.cloud.order.commodity.OrderDetail
;
import
com.gingersoft.gsa.cloud.order.order.BaseOrder
;
import
com.gingersoft.gsa.cloud.order.order.DoshokuOrder
;
import
com.gingersoft.gsa.cloud.pay.bean.PosActionStatusExceptionParam
;
import
com.gingersoft.gsa.cloud.pay.pos.PosAction
;
import
com.gingersoft.gsa.cloud.pay.pos.fragment.PosActionStatusExceptionFragment
;
import
com.gingersoft.gsa.cloud.table.FunctionTable
;
import
com.gingersoft.gsa.cloud.table.R
;
import
com.gingersoft.gsa.cloud.table.mvp.contract.TableContract
;
...
...
@@ -375,6 +378,21 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
OrderResponse
orderBean
=
respose
.
getData
();
if
(
orderBean
!=
null
&&
respose
.
getData
().
getOrderDetails
()
!=
null
)
{
if
(!
TextUtils
.
isEmpty
(
orderBean
.
getTxnId
()))
{
//有支付異常事項需要處理
if
(
IActivity
.
findFragment
(
PosActionStatusExceptionFragment
.
class
)
==
null
)
{
PosActionStatusExceptionParam
statusExceptionParam
=
new
PosActionStatusExceptionParam
();
statusExceptionParam
.
setTxnId
(
orderBean
.
getTxnId
());
statusExceptionParam
.
setAmount
(
orderBean
.
getTotalAmount
());
statusExceptionParam
.
setOrderNum
(
orderBean
.
getId
());
statusExceptionParam
.
setPayMethodName
(
orderBean
.
getPayName
());
statusExceptionParam
.
setPosAction
(
PosAction
.
RETRIEVAL
);
IActivity
.
loadRootFragment
(
R
.
id
.
fl_container
,
PosActionStatusExceptionFragment
.
newInstance
(
statusExceptionParam
));
}
return
;
}
if
(
respose
.
getData
().
getCreateTime
()
!=
null
&&
openTableBean
!=
null
)
{
//將開台時間設置為訂單創建時間
openTableBean
.
setCreateTime
(
respose
.
getData
().
getCreateTime
());
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/orderManager/AllOrderPresenter.java
View file @
d3cc4b0f
...
...
@@ -9,6 +9,7 @@ import android.util.Log;
import
com.billy.cc.core.component.CC
;
import
com.gingersoft.gsa.cloud.common.constans.PrintConstans
;
import
com.gingersoft.gsa.cloud.common.core.table.TableBean
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.utils.MoneyUtil
;
import
com.gingersoft.gsa.cloud.common.utils.time.TimeUtils
;
import
com.gingersoft.gsa.cloud.component.ComponentName
;
...
...
@@ -20,6 +21,16 @@ import com.gingersoft.gsa.cloud.order.cart.ShoppingCart;
import
com.gingersoft.gsa.cloud.order.commodity.OrderDetail
;
import
com.gingersoft.gsa.cloud.order.order.DoshokuOrder
;
import
com.gingersoft.gsa.cloud.pay.bean.PayMethod
;
import
com.gingersoft.gsa.cloud.pay.bean.PosActionStatusExceptionParam
;
import
com.gingersoft.gsa.cloud.pay.pos.OnPosActionListener
;
import
com.gingersoft.gsa.cloud.pay.pos.PosAction
;
import
com.gingersoft.gsa.cloud.pay.pos.PosPay
;
import
com.gingersoft.gsa.cloud.pay.pos.fragment.PosActionStatusExceptionFragment
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.bg.GetTxnIdRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.AdjustTipRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.RefundRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.VoidRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.HywebPosResponse
;
import
com.gingersoft.gsa.cloud.print.bean.PrintContent
;
import
com.gingersoft.gsa.cloud.print.bean.adapter.PrintContentAdapter
;
import
com.gingersoft.gsa.cloud.table.R
;
...
...
@@ -32,6 +43,7 @@ import com.gingersoft.gsa.cloud.table.mvp.ui.activity.orderManager.OrderDetailAc
import
com.gingersoft.gsa.cloud.table.mvp.ui.adapter.OrderCenterAdapter
;
import
com.gingersoft.gsa.cloud.table.mvp.ui.fragment.AllOrderFragment
;
import
com.gingersoft.gsa.cloud.ui.bean.view.SectionTextItem3
;
import
com.gingersoft.gsa.cloud.ui.widget.dialog.KeyboardDialog
;
import
com.jess.arms.di.scope.FragmentScope
;
import
com.jess.arms.http.imageloader.ImageLoader
;
import
com.jess.arms.integration.AppManager
;
...
...
@@ -83,7 +95,7 @@ public class AllOrderPresenter extends BasePresenter<AllOrderContract.Model, All
super
(
model
,
rootView
);
AllOrderFragment
allOrderFragment
=
(
AllOrderFragment
)
rootView
;
this
.
IActivity
=
(
OrderCenterActivity
)
allOrderFragment
.
getCurrentActivity
();
doshokuOrder
=
DoshokuOrder
.
getInstance
();
shoppingCart
=
doshokuOrder
.
getShoppingCart
();
}
...
...
@@ -162,11 +174,177 @@ public class AllOrderPresenter extends BasePresenter<AllOrderContract.Model, All
@Override
public
void
onCancelClick
(
OrderManagerResponse
datasBean
,
int
position
)
{
showCancelDialog
(
datasBean
.
getId
());
if
(
datasBean
.
withHywebPay
())
{
GetTxnIdRequest
txnIdRequest
=
new
GetTxnIdRequest
();
txnIdRequest
.
setOrderId
(
DoshokuOrder
.
getInstance
().
getOrderId
());
if
(!
TextUtils
.
isEmpty
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getTableNumber
()))
{
txnIdRequest
.
setTableExtId
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getId
());
}
else
{
txnIdRequest
.
setTableId
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getId
());
}
txnIdRequest
.
setAmount
(
datasBean
.
getAmount
());
VoidRequest
voidRequest
=
new
VoidRequest
();
PosPay
.
voidO
(
IActivity
,
IActivity
,
voidRequest
,
txnIdRequest
,
new
OnPosActionListener
()
{
@Override
public
void
onPosSuccess
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onPosSuccess: "
+
response
.
toString
());
}
@Override
public
void
onPosException
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onPosException: "
+
response
.
toString
());
if
(
IActivity
.
findFragment
(
PosActionStatusExceptionFragment
.
class
)
==
null
)
{
PosActionStatusExceptionParam
statusExceptionParam
=
new
PosActionStatusExceptionParam
();
statusExceptionParam
.
setTxnId
(
datasBean
.
getPayTxnId
());
statusExceptionParam
.
setAmount
(
datasBean
.
getAmount
());
statusExceptionParam
.
setOrderNum
(
datasBean
.
getId
());
statusExceptionParam
.
setPayMethodName
(
"VISA測試"
);
statusExceptionParam
.
setPosAction
(
PosAction
.
VOID
);
IActivity
.
loadRootFragment
(
R
.
id
.
rl_container
,
PosActionStatusExceptionFragment
.
newInstance
(
statusExceptionParam
));
}
}
@Override
public
void
onSuccess
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onSuccess: "
+
response
.
toString
());
IActivity
.
refeshOrderList
();
}
@Override
public
void
onError
(
Throwable
e
)
{
LoganManager
.
w_code
(
TAG
,
"onError: "
+
e
.
getMessage
());
}
});
}
else
{
showCancelDialog
(
datasBean
.
getId
());
}
}
@Override
public
void
onRefundClick
(
OrderManagerResponse
datasBean
,
int
position
)
{
if
(
datasBean
.
withHywebPay
())
{
GetTxnIdRequest
txnIdRequest
=
new
GetTxnIdRequest
();
txnIdRequest
.
setOrderId
(
DoshokuOrder
.
getInstance
().
getOrderId
());
if
(!
TextUtils
.
isEmpty
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getTableNumber
()))
{
txnIdRequest
.
setTableExtId
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getId
());
}
else
{
txnIdRequest
.
setTableId
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getId
());
}
txnIdRequest
.
setAmount
(
datasBean
.
getAmount
());
RefundRequest
refundRequest
=
new
RefundRequest
();
PosPay
.
refund
(
IActivity
,
IActivity
,
refundRequest
,
txnIdRequest
,
new
OnPosActionListener
()
{
@Override
public
void
onPosSuccess
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onPosSuccess: "
+
response
.
toString
());
}
@Override
public
void
onPosException
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onPosException: "
+
response
.
toString
());
if
(
IActivity
.
findFragment
(
PosActionStatusExceptionFragment
.
class
)
==
null
)
{
PosActionStatusExceptionParam
statusExceptionParam
=
new
PosActionStatusExceptionParam
();
statusExceptionParam
.
setTxnId
(
datasBean
.
getPayTxnId
());
statusExceptionParam
.
setAmount
(
datasBean
.
getAmount
());
statusExceptionParam
.
setOrderNum
(
datasBean
.
getId
());
statusExceptionParam
.
setPayMethodName
(
"VISA測試"
);
statusExceptionParam
.
setPosAction
(
PosAction
.
REFUND
);
IActivity
.
loadRootFragment
(
R
.
id
.
rl_container
,
PosActionStatusExceptionFragment
.
newInstance
(
statusExceptionParam
));
}
}
@Override
public
void
onSuccess
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onSuccess: "
+
response
.
toString
());
IActivity
.
refeshOrderList
();
}
@Override
public
void
onError
(
Throwable
e
)
{
LoganManager
.
w_code
(
TAG
,
"onError: "
+
e
.
getMessage
());
}
});
}
}
@Override
public
void
onTipsClick
(
OrderManagerResponse
datasBean
,
int
position
)
{
showKeyboardDialog
(
datasBean
);
}
});
}
private
void
showKeyboardDialog
(
OrderManagerResponse
datasBean
)
{
new
KeyboardDialog
(
IActivity
)
.
build
()
.
setOnCallBackListener
(
new
KeyboardDialog
.
OnCallBackListener
()
{
@Override
public
void
onSure
(
String
number
)
{
if
(!
TextUtils
.
isEmpty
(
number
))
{
GetTxnIdRequest
txnIdRequest
=
new
GetTxnIdRequest
();
txnIdRequest
.
setOrderId
(
DoshokuOrder
.
getInstance
().
getOrderId
());
if
(!
TextUtils
.
isEmpty
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getTableNumber
()))
{
txnIdRequest
.
setTableExtId
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getId
());
}
else
{
txnIdRequest
.
setTableId
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getId
());
}
txnIdRequest
.
setAmount
(
datasBean
.
getAmount
());
PosPay
.
tip
(
IActivity
,
IActivity
,
txnIdRequest
,
getTipsRequest
(
datasBean
.
getPayTxnId
(),
datasBean
.
getAmount
(),
Double
.
parseDouble
(
number
)),
new
OnPosActionListener
()
{
@Override
public
void
onPosSuccess
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onPosSuccess: "
+
response
.
toString
());
}
@Override
public
void
onPosException
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onPosException: "
+
response
.
toString
());
if
(
IActivity
.
findFragment
(
PosActionStatusExceptionFragment
.
class
)
==
null
)
{
PosActionStatusExceptionParam
statusExceptionParam
=
new
PosActionStatusExceptionParam
();
statusExceptionParam
.
setTxnId
(
datasBean
.
getPayTxnId
());
statusExceptionParam
.
setAmount
(
datasBean
.
getAmount
());
statusExceptionParam
.
setOrderNum
(
datasBean
.
getId
());
statusExceptionParam
.
setPayMethodName
(
"VISA測試"
);
statusExceptionParam
.
setPosAction
(
PosAction
.
TIP
);
IActivity
.
loadRootFragment
(
R
.
id
.
rl_container
,
PosActionStatusExceptionFragment
.
newInstance
(
statusExceptionParam
));
}
}
@Override
public
void
onSuccess
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onSuccess: "
+
response
.
toString
());
IActivity
.
refeshOrderList
();
}
@Override
public
void
onError
(
Throwable
e
)
{
LoganManager
.
w_code
(
TAG
,
"onError: "
+
e
.
getMessage
());
}
});
}
}
})
.
show
();
}
private
AdjustTipRequest
getTipsRequest
(
String
txnId
,
double
amount
,
double
tips
)
{
AdjustTipRequest
tipRequest
=
new
AdjustTipRequest
();
tipRequest
.
setTXN_ID
(
txnId
);
tipRequest
.
setTOTAL_TXN_AMT
(
MoneyUtil
.
sum
(
amount
,
tips
));
return
tipRequest
;
}
private
void
showCancelDialog
(
long
orderId
)
{
QMUIDialog
.
MessageDialogBuilder
dialogBuilder
=
new
QMUIDialog
.
MessageDialogBuilder
(
IActivity
);
dialogBuilder
.
setTitle
(
"溫馨提示"
);
...
...
@@ -263,6 +441,7 @@ public class AllOrderPresenter extends BasePresenter<AllOrderContract.Model, All
/**
* 獲取賬單折扣列
*
* @param orderDetailItem
* @return
*/
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/OrderPayActivity.java
View file @
d3cc4b0f
...
...
@@ -29,6 +29,7 @@ import com.gingersoft.gsa.cloud.order.billItem.BillItem;
import
com.gingersoft.gsa.cloud.order.order.DoshokuOrder
;
import
com.gingersoft.gsa.cloud.pay.bean.PayMethod
;
import
com.gingersoft.gsa.cloud.pay.contract.PayTypeContract
;
import
com.gingersoft.gsa.cloud.pay.pos.PosPay
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.bg.GetTxnIdRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.SaleRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.constant.PayMethodConstant
;
...
...
@@ -506,7 +507,7 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
MealOrderPayRequest
orderPayRequest
=
mPresenter
.
getOrderPayRequest
(
gsaPayView
);
List
<
BillItem
>
billItemList
=
DoshokuOrder
.
getInstance
().
getShoppingCart
().
getBillItemList
();
DoshokuOrder
.
getInstance
()
.
pay
(
mContext
,
OrderPayActivity
.
this
,
saleRequest
,
txnIdRequest
,
DoshokuOrder
.
getInstance
().
getOpenTableInfo
(),
orderPayRequest
,
billItemList
,
mBillMoneyList
);
PosPay
.
pay
(
mContext
,
OrderPayActivity
.
this
,
saleRequest
,
txnIdRequest
,
DoshokuOrder
.
getInstance
().
getOpenTableInfo
(),
orderPayRequest
,
billItemList
,
mBillMoneyList
);
}
else
{
}
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/orderManager/OrderCenterActivity.java
View file @
d3cc4b0f
...
...
@@ -96,7 +96,7 @@ public class OrderCenterActivity extends BaseFragmentActivity<OrderCenterPresent
refeshOrderList
();
}
p
rivate
void
refeshOrderList
(){
p
ublic
void
refeshOrderList
(){
setPageIndex
(
0
);
mPresenter
.
loadOrderList
(
OrderManagerResponse
.
ORDER_TYPE_DOSHOKU
+
""
,
0
,
10
,
null
,
false
);
}
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/orderManager/OrderDetailActivity.java
View file @
d3cc4b0f
...
...
@@ -5,6 +5,7 @@ import android.os.Bundle;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.FrameLayout
;
import
android.widget.LinearLayout
;
import
android.widget.ScrollView
;
import
android.widget.TextView
;
...
...
@@ -18,6 +19,7 @@ import androidx.recyclerview.widget.RecyclerView;
import
com.billy.cc.core.component.CC
;
import
com.gingersoft.gsa.cloud.common.constans.PrintConstans
;
import
com.gingersoft.gsa.cloud.common.core.table.TableBean
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.utils.LanguageUtils
;
import
com.gingersoft.gsa.cloud.common.utils.MoneyUtil
;
import
com.gingersoft.gsa.cloud.common.utils.time.TimeUtils
;
...
...
@@ -30,6 +32,16 @@ import com.gingersoft.gsa.cloud.order.cart.ShoppingCart;
import
com.gingersoft.gsa.cloud.order.commodity.OrderDetail
;
import
com.gingersoft.gsa.cloud.order.order.DoshokuOrder
;
import
com.gingersoft.gsa.cloud.pay.bean.PayMethod
;
import
com.gingersoft.gsa.cloud.pay.bean.PosActionStatusExceptionParam
;
import
com.gingersoft.gsa.cloud.pay.pos.OnPosActionListener
;
import
com.gingersoft.gsa.cloud.pay.pos.PosAction
;
import
com.gingersoft.gsa.cloud.pay.pos.PosPay
;
import
com.gingersoft.gsa.cloud.pay.pos.fragment.PosActionStatusExceptionFragment
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.bg.GetTxnIdRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.AdjustTipRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.RefundRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.VoidRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.HywebPosResponse
;
import
com.gingersoft.gsa.cloud.print.bean.PrintContent
;
import
com.gingersoft.gsa.cloud.print.bean.adapter.PrintContentAdapter
;
import
com.gingersoft.gsa.cloud.table.R
;
...
...
@@ -43,8 +55,9 @@ import com.gingersoft.gsa.cloud.table.mvp.ui.activity.MealStandActivity;
import
com.gingersoft.gsa.cloud.table.mvp.ui.adapter.OrderCenterDetailFoodAdapter
;
import
com.gingersoft.gsa.cloud.table.mvp.ui.adapter.OrderCenterMoneyAdapter
;
import
com.gingersoft.gsa.cloud.ui.bean.view.SectionTextItem3
;
import
com.gingersoft.gsa.cloud.ui.widget.dialog.KeyboardDialog
;
import
com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog
;
import
com.jess.arms.base.BaseActivity
;
import
com.jess.arms.base.Base
Fragment
Activity
;
import
com.jess.arms.di.component.AppComponent
;
import
com.jess.arms.utils.ArmsUtils
;
import
com.qmuiteam.qmui.alpha.QMUIAlphaButton
;
...
...
@@ -74,11 +87,14 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public
class
OrderDetailActivity
extends
BaseActivity
<
OrderDetailPresenter
>
implements
OrderDetailContract
.
View
{
public
class
OrderDetailActivity
extends
Base
Fragment
Activity
<
OrderDetailPresenter
>
implements
OrderDetailContract
.
View
{
@BindView
(
R2
.
id
.
topbar
)
QMUITopBar
mTopBar
;
@BindView
(
R2
.
id
.
rl_container
)
FrameLayout
rl_container
;
@BindView
(
R2
.
id
.
scrollview
)
ScrollView
scrollview
;
@BindView
(
R2
.
id
.
tv_table_name
)
...
...
@@ -175,7 +191,32 @@ public class OrderDetailActivity extends BaseActivity<OrderDetailPresenter> impl
initOrderDetail
(
mOrderDetailItem
);
}
private
void
setOrderStatusByTxnId
(
String
payTxnId
,
String
cancelTxnId
,
String
refundTxnId
)
{
if
(!
TextUtils
.
isEmpty
(
cancelTxnId
))
{
tv_order_status
.
setText
(
"已取消"
);
tv_order_status
.
setVisibility
(
View
.
VISIBLE
);
return
;
}
if
(!
TextUtils
.
isEmpty
(
refundTxnId
))
{
tv_order_status
.
setVisibility
(
View
.
VISIBLE
);
tv_order_status
.
setText
(
"已退款"
);
return
;
}
if
(!
TextUtils
.
isEmpty
(
payTxnId
))
{
btn_print_order
.
setVisibility
(
View
.
VISIBLE
);
btn_refund
.
setVisibility
(
View
.
VISIBLE
);
btn_tips
.
setVisibility
(
View
.
VISIBLE
);
btn_cancel_order
.
setVisibility
(
View
.
VISIBLE
);
btn_modify_order
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
tv_order_status
.
setVisibility
(
View
.
GONE
);
}
}
private
void
initOrderDetail
(
OrderManagerResponse
orderDetailItem
)
{
if
(
orderDetailItem
.
withHywebPay
())
{
setOrderStatusByTxnId
(
orderDetailItem
.
getPayTxnId
(),
orderDetailItem
.
getCancelTxnId
(),
orderDetailItem
.
getRefundTxnId
());
}
if
(
orderDetailItem
!=
null
)
{
String
payBill
=
LanguageUtils
.
get_language_system
(
this
,
"opentable.paybill"
,
"結賬"
)
+
":"
;
String
pax
=
LanguageUtils
.
get_language_system
(
this
,
"Meal.Mannumber"
,
"人數"
)
+
":"
;
...
...
@@ -438,18 +479,174 @@ public class OrderDetailActivity extends BaseActivity<OrderDetailPresenter> impl
}
}
@OnClick
({
R2
.
id
.
btn_print_order
,
R2
.
id
.
btn_cancel_order
,
R2
.
id
.
btn_modify_order
})
@OnClick
({
R2
.
id
.
btn_print_order
,
R2
.
id
.
btn_cancel_order
,
R2
.
id
.
btn_modify_order
,
R2
.
id
.
btn_tips
,
R2
.
id
.
btn_refund
})
public
void
onClick
(
View
v
)
{
int
id
=
v
.
getId
();
if
(
id
==
R
.
id
.
btn_print_order
)
{
startPrintOrder
(
mOrderDetailItem
,
mOrderDetailList
);
}
else
if
(
id
==
R
.
id
.
btn_cancel_order
)
{
showCancelDialog
();
}
else
if
(
id
==
R
.
id
.
btn_modify_order
)
{
startModifyOrder
(
mOrderDetailItem
);
}
else
if
(
id
==
R
.
id
.
btn_cancel_order
)
{
if
(
mOrderDetailItem
.
withHywebPay
())
{
GetTxnIdRequest
txnIdRequest
=
new
GetTxnIdRequest
();
txnIdRequest
.
setOrderId
(
DoshokuOrder
.
getInstance
().
getOrderId
());
if
(!
TextUtils
.
isEmpty
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getTableNumber
()))
{
txnIdRequest
.
setTableExtId
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getId
());
}
else
{
txnIdRequest
.
setTableId
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getId
());
}
txnIdRequest
.
setAmount
(
mOrderDetailItem
.
getTotalAmount
());
VoidRequest
voidRequest
=
new
VoidRequest
();
PosPay
.
voidO
(
mContext
,
this
,
voidRequest
,
txnIdRequest
,
new
OnPosActionListener
()
{
@Override
public
void
onPosSuccess
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onPosSuccess: "
+
response
.
toString
());
}
@Override
public
void
onPosException
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onPosException: "
+
response
.
toString
());
if
(
findFragment
(
PosActionStatusExceptionFragment
.
class
)
==
null
)
{
PosActionStatusExceptionParam
statusExceptionParam
=
new
PosActionStatusExceptionParam
();
statusExceptionParam
.
setTxnId
(
mOrderDetailItem
.
getPayTxnId
());
statusExceptionParam
.
setAmount
(
mOrderDetailItem
.
getAmount
());
statusExceptionParam
.
setOrderNum
(
mOrderDetailItem
.
getId
());
statusExceptionParam
.
setPayMethodName
(
"VISA測試"
);
statusExceptionParam
.
setPosAction
(
PosAction
.
VOID
);
loadRootFragment
(
R
.
id
.
rl_container
,
PosActionStatusExceptionFragment
.
newInstance
(
statusExceptionParam
));
}
}
@Override
public
void
onSuccess
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onSuccess: "
+
response
.
toString
());
refreafshOrderDetail
();
}
@Override
public
void
onError
(
Throwable
e
)
{
LoganManager
.
w_code
(
TAG
,
"onError: "
+
e
.
getMessage
());
}
});
}
else
{
showCancelDialog
();
}
}
else
if
(
id
==
R
.
id
.
btn_refund
)
{
if
(
mOrderDetailItem
.
withHywebPay
())
{
GetTxnIdRequest
txnIdRequest
=
new
GetTxnIdRequest
();
txnIdRequest
.
setOrderId
(
DoshokuOrder
.
getInstance
().
getOrderId
());
if
(!
TextUtils
.
isEmpty
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getTableNumber
()))
{
txnIdRequest
.
setTableExtId
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getId
());
}
else
{
txnIdRequest
.
setTableId
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getId
());
}
txnIdRequest
.
setAmount
(
mOrderDetailItem
.
getTotalAmount
());
RefundRequest
refundRequest
=
new
RefundRequest
();
PosPay
.
refund
(
mContext
,
this
,
refundRequest
,
txnIdRequest
,
new
OnPosActionListener
()
{
@Override
public
void
onPosSuccess
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onPosSuccess: "
+
response
.
toString
());
}
@Override
public
void
onPosException
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onPosException: "
+
response
.
toString
());
if
(
findFragment
(
PosActionStatusExceptionFragment
.
class
)
==
null
)
{
PosActionStatusExceptionParam
statusExceptionParam
=
new
PosActionStatusExceptionParam
();
statusExceptionParam
.
setTxnId
(
mOrderDetailItem
.
getPayTxnId
());
statusExceptionParam
.
setAmount
(
mOrderDetailItem
.
getAmount
());
statusExceptionParam
.
setOrderNum
(
mOrderDetailItem
.
getId
());
statusExceptionParam
.
setPayMethodName
(
"VISA測試"
);
statusExceptionParam
.
setPosAction
(
PosAction
.
REFUND
);
loadRootFragment
(
R
.
id
.
rl_container
,
PosActionStatusExceptionFragment
.
newInstance
(
statusExceptionParam
));
}
}
@Override
public
void
onSuccess
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onSuccess: "
+
response
.
toString
());
refreafshOrderDetail
();
}
@Override
public
void
onError
(
Throwable
e
)
{
LoganManager
.
w_code
(
TAG
,
"onError: "
+
e
.
getMessage
());
}
});
}
}
else
if
(
id
==
R
.
id
.
btn_tips
)
{
showKeyboardDialog
();
}
}
private
void
showKeyboardDialog
()
{
new
KeyboardDialog
(
this
)
.
build
()
.
setOnCallBackListener
(
new
KeyboardDialog
.
OnCallBackListener
()
{
@Override
public
void
onSure
(
String
number
)
{
if
(!
TextUtils
.
isEmpty
(
number
))
{
GetTxnIdRequest
txnIdRequest
=
new
GetTxnIdRequest
();
txnIdRequest
.
setOrderId
(
DoshokuOrder
.
getInstance
().
getOrderId
());
if
(!
TextUtils
.
isEmpty
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getTableNumber
()))
{
txnIdRequest
.
setTableExtId
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getId
());
}
else
{
txnIdRequest
.
setTableId
(
DoshokuOrder
.
getInstance
().
getOpenTableInfo
().
getId
());
}
txnIdRequest
.
setAmount
(
mOrderDetailItem
.
getAmount
());
PosPay
.
tip
(
mContext
,
OrderDetailActivity
.
this
,
txnIdRequest
,
getTipsRequest
(
mOrderDetailItem
.
getPayTxnId
(),
mOrderDetailItem
.
getAmount
(),
Double
.
parseDouble
(
number
)),
new
OnPosActionListener
()
{
@Override
public
void
onPosSuccess
(
HywebPosResponse
response
)
{
}
@Override
public
void
onPosException
(
HywebPosResponse
response
)
{
LoganManager
.
w_code
(
TAG
,
"onPosException: "
+
response
.
toString
());
if
(
findFragment
(
PosActionStatusExceptionFragment
.
class
)
==
null
)
{
PosActionStatusExceptionParam
statusExceptionParam
=
new
PosActionStatusExceptionParam
();
statusExceptionParam
.
setTxnId
(
mOrderDetailItem
.
getPayTxnId
());
statusExceptionParam
.
setAmount
(
mOrderDetailItem
.
getAmount
());
statusExceptionParam
.
setOrderNum
(
mOrderDetailItem
.
getId
());
statusExceptionParam
.
setPayMethodName
(
"VISA測試"
);
statusExceptionParam
.
setPosAction
(
PosAction
.
TIP
);
loadRootFragment
(
R
.
id
.
rl_container
,
PosActionStatusExceptionFragment
.
newInstance
(
statusExceptionParam
));
}
}
@Override
public
void
onSuccess
(
HywebPosResponse
response
)
{
refreafshOrderDetail
();
}
@Override
public
void
onError
(
Throwable
e
)
{
}
});
}
}
})
.
show
();
}
private
AdjustTipRequest
getTipsRequest
(
String
txnId
,
double
amount
,
double
tips
)
{
AdjustTipRequest
tipRequest
=
new
AdjustTipRequest
();
tipRequest
.
setTXN_ID
(
txnId
);
tipRequest
.
setTOTAL_TXN_AMT
(
MoneyUtil
.
sum
(
amount
,
tips
));
return
tipRequest
;
}
private
void
startModifyOrder
(
OrderManagerResponse
datasBean
)
{
if
(
datasBean
.
getRestaurantTable
()
==
null
)
{
showMessage
(
"餐檯不存在,無法修改訂單"
);
...
...
@@ -650,8 +847,12 @@ public class OrderDetailActivity extends BaseActivity<OrderDetailPresenter> impl
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
if
(
requestCode
==
OrderCenterActivity
.
MODIFY_ORDER_RETURN_CODE
)
{
//修改訂單返回,刷新訂單數據
mPresenter
.
getOrderDetailItem
(
mOrderDetailItem
.
getId
()
);
refreafshOrderDetail
(
);
}
}
private
void
refreafshOrderDetail
()
{
mPresenter
.
getOrderDetailItem
(
mOrderDetailItem
.
getId
());
}
}
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/adapter/OrderCenterAdapter.java
View file @
d3cc4b0f
...
...
@@ -134,21 +134,23 @@ public class OrderCenterAdapter extends DefaultAdapter<OrderManagerResponse> {
}
private
void
setOrderStatus
(
OrderManagerResponse
item
,
int
position
)
{
btn_cancel_order
.
setVisibility
(
View
.
GONE
);
//
btn_cancel_order.setVisibility(View.GONE);
if
(
item
.
getStatus
()
==
6
)
{
btn_print_order
.
setVisibility
(
View
.
GONE
);
btn_modify_order
.
setVisibility
(
View
.
GONE
);
//
btn_cancel_order.setVisibility(View.GONE);
btn_cancel_order
.
setVisibility
(
View
.
GONE
);
btn_order_status
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
btn_print_order
.
setVisibility
(
View
.
VISIBLE
);
btn_modify_order
.
setVisibility
(
View
.
VISIBLE
);
btn_cancel_order
.
setVisibility
(
View
.
VISIBLE
);
if
(
item
.
withHywebPay
())
{
setOrderStatusByTxnId
(
item
.
getPayTxnId
(),
item
.
getCancelTxnId
(),
item
.
getRefundTxnId
());
}
btn_print_order
.
setText
(
LanguageUtils
.
get_language_system
(
mContext
,
"print.order"
,
"打印賬單"
));
btn_tips
.
setText
(
LanguageUtils
.
get_language_system
(
mContext
,
"public.tips"
,
"貼士"
));
btn_modify_order
.
setText
(
LanguageUtils
.
get_language_system
(
mContext
,
"modify.order"
,
"修改訂單"
));
// btn_cancel_order.setText(LanguageUtils.get_language_system(mContext, "cancel.order", "取消訂單"));
btn_print_order
.
setVisibility
(
View
.
VISIBLE
);
btn_modify_order
.
setVisibility
(
View
.
VISIBLE
);
// btn_cancel_order.setVisibility(View.VISIBLE);
btn_order_status
.
setVisibility
(
View
.
GONE
);
btn_cancel_order
.
setText
(
LanguageUtils
.
get_language_system
(
mContext
,
"cancel.order"
,
"取消訂單"
));
btn_print_order
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
...
...
@@ -173,6 +175,44 @@ public class OrderCenterAdapter extends DefaultAdapter<OrderManagerResponse> {
}
}
});
btn_refund
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
mOnItemClickListener
!=
null
)
{
mOnItemClickListener
.
onRefundClick
(
item
,
position
);
}
}
});
btn_tips
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
mOnItemClickListener
!=
null
)
{
mOnItemClickListener
.
onTipsClick
(
item
,
position
);
}
}
});
}
}
private
void
setOrderStatusByTxnId
(
String
payTxnId
,
String
cancelTxnId
,
String
refundTxnId
)
{
if
(!
TextUtils
.
isEmpty
(
cancelTxnId
))
{
btn_order_status
.
setText
(
"已取消"
);
btn_order_status
.
setVisibility
(
View
.
VISIBLE
);
return
;
}
if
(!
TextUtils
.
isEmpty
(
refundTxnId
))
{
btn_order_status
.
setVisibility
(
View
.
VISIBLE
);
btn_order_status
.
setText
(
"已退款"
);
return
;
}
if
(!
TextUtils
.
isEmpty
(
payTxnId
))
{
btn_print_order
.
setVisibility
(
View
.
VISIBLE
);
btn_refund
.
setVisibility
(
View
.
VISIBLE
);
btn_tips
.
setVisibility
(
View
.
VISIBLE
);
btn_cancel_order
.
setVisibility
(
View
.
VISIBLE
);
btn_modify_order
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
btn_order_status
.
setVisibility
(
View
.
GONE
);
}
}
...
...
@@ -200,5 +240,9 @@ public class OrderCenterAdapter extends DefaultAdapter<OrderManagerResponse> {
void
onModifyClick
(
OrderManagerResponse
datasBean
,
int
position
);
void
onCancelClick
(
OrderManagerResponse
datasBean
,
int
position
);
void
onRefundClick
(
OrderManagerResponse
datasBean
,
int
position
);
void
onTipsClick
(
OrderManagerResponse
datasBean
,
int
position
);
}
}
component-table/src/main/res/layout/activity_order_center.xml
View file @
d3cc4b0f
...
...
@@ -33,4 +33,10 @@
android:fitsSystemWindows=
"true"
/>
</LinearLayout>
<FrameLayout
android:id=
"@+id/rl_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>
\ No newline at end of file
component-table/src/main/res/layout/activity_order_detail.xml
View file @
d3cc4b0f
...
...
@@ -273,4 +273,8 @@
android:layout_height=
"?attr/qmui_topbar_height"
android:fitsSystemWindows=
"true"
/>
<FrameLayout
android:id=
"@+id/rl_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>
\ No newline at end of file
component-table/src/main/res/layout/item_order_center.xml
View file @
d3cc4b0f
...
...
@@ -145,7 +145,7 @@
android:text=
"取消訂單"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/sp_13"
android:visibility=
"
gon
e"
/>
android:visibility=
"
visibl
e"
/>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id=
"@+id/btn_refund"
...
...
component-table/src/main/res/layout/table_activity_table.xml
View file @
d3cc4b0f
...
...
@@ -98,4 +98,9 @@
android:visibility=
"invisible"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:id=
"@+id/fl_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</RelativeLayout>
library-common/src/main/java/com/gingersoft/gsa/cloud/common/config/globalconfig/lifecyclesOptioins/MyActivityLifecycle.java
View file @
d3cc4b0f
...
...
@@ -5,9 +5,12 @@ import android.app.Activity;
import
android.app.Application
;
import
android.os.Bundle
;
import
com.billy.cc.core.component.CC
;
import
com.gingersoft.gsa.cloud.app.GsaCloudApplication
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.utils.CommonConfiguration
;
import
com.gingersoft.gsa.cloud.component.ComponentAction
;
import
com.gingersoft.gsa.cloud.component.ComponentName
;
import
com.gingersoft.gsa.cloud.database.utils.FoodComboDaoUtils
;
import
com.gingersoft.gsa.cloud.database.utils.ModifierDaoUtils
;
...
...
@@ -59,10 +62,11 @@ public class MyActivityLifecycle implements Application.ActivityLifecycleCallbac
}).
subscribeOn
(
Schedulers
.
io
()).
subscribe
();
}
else
if
(
name
.
equals
(
"TableActivity"
)
||
name
.
equals
(
"OrderCenterActivity"
)
||
name
.
equals
(
"OrderDetailActivity"
))
{
// //初始化堂食賬單類
// DoshokuOrder.getInstance().initialization();
// //初始化外賣賬單類
// TakeawayOrder.getInstance().initialization();
//初始化堂食,外賣賬單類
CC
.
obtainBuilder
(
ComponentName
.
COMPONENT_TABLE
)
.
setActionName
(
ComponentAction
.
Table
.
INT_ORDER
)
.
build
()
.
call
();
}
GsaCloudApplication
.
getAppContext
().
setCurrentActivity
(
activity
);
}
...
...
library-common/src/main/java/com/gingersoft/gsa/cloud/common/core/table/TableBean.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
common
.
core
.
table
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
java.io.Serializable
;
import
java.util.List
;
...
...
@@ -60,7 +63,7 @@ public class TableBean {
}
@Data
public
static
class
DataBean
implements
Serializable
{
public
static
class
DataBean
implements
Serializable
,
Parcelable
{
/**
* id : 25839
* tableName : ceshitai1*
...
...
@@ -192,6 +195,79 @@ public class TableBean {
this
.
summaryId
=
dataBean
.
summaryId
;
this
.
scanId
=
dataBean
.
scanId
;
}
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeInt
(
this
.
id
);
dest
.
writeString
(
this
.
tableName
);
dest
.
writeInt
(
this
.
restaurantId
);
dest
.
writeValue
(
this
.
orderId
);
dest
.
writeString
(
this
.
qrCode
);
dest
.
writeString
(
this
.
qrCodeImg
);
dest
.
writeInt
(
this
.
seatCount
);
dest
.
writeInt
(
this
.
maxSeatCount
);
dest
.
writeInt
(
this
.
minSeatCount
);
dest
.
writeString
(
this
.
createTime
);
dest
.
writeString
(
this
.
createBy
);
dest
.
writeInt
(
this
.
posTableId
);
dest
.
writeInt
(
this
.
serviceCharge
);
dest
.
writeLong
(
this
.
memberId
);
dest
.
writeInt
(
this
.
status
);
dest
.
writeInt
(
this
.
person
);
dest
.
writeInt
(
this
.
useStatus
);
dest
.
writeInt
(
this
.
sort
);
dest
.
writeInt
(
this
.
type
);
dest
.
writeInt
(
this
.
splitStatus
);
dest
.
writeString
(
this
.
tableNumber
);
dest
.
writeString
(
this
.
skyQrCode
);
dest
.
writeLong
(
this
.
summaryId
);
dest
.
writeValue
(
this
.
scanId
);
}
protected
DataBean
(
Parcel
in
)
{
this
.
id
=
in
.
readInt
();
this
.
tableName
=
in
.
readString
();
this
.
restaurantId
=
in
.
readInt
();
this
.
orderId
=
(
Long
)
in
.
readValue
(
Long
.
class
.
getClassLoader
());
this
.
qrCode
=
in
.
readString
();
this
.
qrCodeImg
=
in
.
readString
();
this
.
seatCount
=
in
.
readInt
();
this
.
maxSeatCount
=
in
.
readInt
();
this
.
minSeatCount
=
in
.
readInt
();
this
.
createTime
=
in
.
readString
();
this
.
createBy
=
in
.
readString
();
this
.
posTableId
=
in
.
readInt
();
this
.
serviceCharge
=
in
.
readInt
();
this
.
memberId
=
in
.
readLong
();
this
.
status
=
in
.
readInt
();
this
.
person
=
in
.
readInt
();
this
.
useStatus
=
in
.
readInt
();
this
.
sort
=
in
.
readInt
();
this
.
type
=
in
.
readInt
();
this
.
splitStatus
=
in
.
readInt
();
this
.
tableNumber
=
in
.
readString
();
this
.
skyQrCode
=
in
.
readString
();
this
.
summaryId
=
in
.
readLong
();
this
.
scanId
=
(
Long
)
in
.
readValue
(
Long
.
class
.
getClassLoader
());
}
public
static
final
Creator
<
DataBean
>
CREATOR
=
new
Creator
<
DataBean
>()
{
@Override
public
DataBean
createFromParcel
(
Parcel
source
)
{
return
new
DataBean
(
source
);
}
@Override
public
DataBean
[]
newArray
(
int
size
)
{
return
new
DataBean
[
size
];
}
};
}
public
static
TableBean
.
DataBean
splitTableTransformTable
(
TableBean
.
DataBean
mainTable
,
TableExtBean
.
DataBean
dataBean
)
{
...
...
library-common/src/main/java/com/gingersoft/gsa/cloud/component/ComponentAction.java
View file @
d3cc4b0f
...
...
@@ -24,6 +24,10 @@ public class ComponentAction {
public
interface
Table
{
String
KILL_MEAL_ORDER_PAY
=
"kill_meal_order_pay"
;
/**
* 初始化餐檯,外賣訂單
*/
String
INT_ORDER
=
"int_order"
;
}
public
interface
Print
{
...
...
library-order/build.gradle
View file @
d3cc4b0f
ext
.
alwaysLib
=
true
//虽然apply了cc-settings-2.gradle,但一直作为library编译,否则别的组件依赖此module时会报错
apply
from:
rootProject
.
file
(
"cc-settings.gradle"
)
apply
plugin:
'com.jakewharton.butterknife'
android
{
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
...
...
@@ -15,7 +16,17 @@ android {
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
versionCode
rootProject
.
ext
.
android
[
"versionCode"
]
versionName
rootProject
.
ext
.
android
[
"versionName"
]
multiDexEnabled
true
//配置注解处理器
javaCompileOptions
{
annotationProcessorOptions
{
includeCompileClasspath
true
}
}
}
resourcePrefix
"order"
buildTypes
{
// Test {
// buildConfigField "boolean", "LOG_DEBUG", "false"
...
...
library-order/src/main/AndroidManifest.xml
View file @
d3cc4b0f
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.gingersoft.
runtime.pay_module
"
/>
package=
"com.gingersoft.
gsa.cloud.order
"
/>
library-order/src/main/java/com/gingersoft/gsa/cloud/order/bean/event/MealPayResult
Event
.java
→
library-order/src/main/java/com/gingersoft/gsa/cloud/order/bean/event/MealPayResult
Param
.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
order
.
bean
.
event
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
com.gingersoft.gsa.cloud.common.core.table.TableBean
;
import
com.gingersoft.gsa.cloud.order.bean.request.MealOrderPayRequest
;
import
com.gingersoft.gsa.cloud.order.billItem.BillItem
;
...
...
@@ -15,7 +18,7 @@ import lombok.Data;
* @描述:
*/
@Data
public
class
MealPayResult
Event
{
public
class
MealPayResult
Param
implements
Parcelable
{
private
TableBean
.
DataBean
tableBean
;
private
MealOrderPayRequest
mealOrderPayRequest
;
...
...
@@ -25,4 +28,42 @@ public class MealPayResultEvent {
private
SaleRespose
saleRespose
;
private
String
txnId
;
public
MealPayResultParam
()
{
}
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeParcelable
(
this
.
tableBean
,
flags
);
dest
.
writeParcelable
(
this
.
mealOrderPayRequest
,
flags
);
dest
.
writeTypedList
(
this
.
billItemList
);
dest
.
writeTypedList
(
this
.
payMethodList
);
dest
.
writeParcelable
(
this
.
saleRespose
,
flags
);
dest
.
writeString
(
this
.
txnId
);
}
protected
MealPayResultParam
(
Parcel
in
)
{
this
.
tableBean
=
in
.
readParcelable
(
TableBean
.
DataBean
.
class
.
getClassLoader
());
this
.
mealOrderPayRequest
=
in
.
readParcelable
(
MealOrderPayRequest
.
class
.
getClassLoader
());
this
.
billItemList
=
in
.
createTypedArrayList
(
BillItem
.
CREATOR
);
this
.
payMethodList
=
in
.
createTypedArrayList
(
PayMethod
.
CREATOR
);
this
.
saleRespose
=
in
.
readParcelable
(
SaleRespose
.
class
.
getClassLoader
());
this
.
txnId
=
in
.
readString
();
}
public
static
final
Creator
<
MealPayResultParam
>
CREATOR
=
new
Creator
<
MealPayResultParam
>()
{
@Override
public
MealPayResultParam
createFromParcel
(
Parcel
source
)
{
return
new
MealPayResultParam
(
source
);
}
@Override
public
MealPayResultParam
[]
newArray
(
int
size
)
{
return
new
MealPayResultParam
[
size
];
}
};
}
library-order/src/main/java/com/gingersoft/gsa/cloud/order/bean/request/MealOrderPayRequest.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
order
.
bean
.
request
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
com.gingersoft.gsa.cloud.pay.pos.bean.PosMatter
;
import
java.util.ArrayList
;
...
...
@@ -15,7 +18,7 @@ import lombok.Data;
* 描述:堂食支付請求數據
*/
@Data
public
class
MealOrderPayRequest
{
public
class
MealOrderPayRequest
implements
Parcelable
{
private
long
orderId
;
private
int
linePayType
;
...
...
@@ -39,13 +42,100 @@ public class MealOrderPayRequest {
*/
private
PosMatter
posMatter
;
public
MealOrderPayRequest
()
{
}
@Data
public
static
class
OrderPay
{
public
static
class
OrderPay
implements
Parcelable
{
private
int
payType
;
private
double
amount
;
private
double
tipsPrice
;
/**積分支付 所消費的積分*/
private
Double
consumptionPoints
;
public
OrderPay
()
{
}
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeInt
(
this
.
payType
);
dest
.
writeDouble
(
this
.
amount
);
dest
.
writeDouble
(
this
.
tipsPrice
);
dest
.
writeValue
(
this
.
consumptionPoints
);
}
protected
OrderPay
(
Parcel
in
)
{
this
.
payType
=
in
.
readInt
();
this
.
amount
=
in
.
readDouble
();
this
.
tipsPrice
=
in
.
readDouble
();
this
.
consumptionPoints
=
(
Double
)
in
.
readValue
(
Double
.
class
.
getClassLoader
());
}
public
static
final
Creator
<
OrderPay
>
CREATOR
=
new
Creator
<
OrderPay
>()
{
@Override
public
OrderPay
createFromParcel
(
Parcel
source
)
{
return
new
OrderPay
(
source
);
}
@Override
public
OrderPay
[]
newArray
(
int
size
)
{
return
new
OrderPay
[
size
];
}
};
}
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeLong
(
this
.
orderId
);
dest
.
writeInt
(
this
.
linePayType
);
dest
.
writeInt
(
this
.
orderPayType
);
dest
.
writeInt
(
this
.
tableId
);
dest
.
writeString
(
this
.
tableNumber
);
dest
.
writeValue
(
this
.
memberId
);
dest
.
writeValue
(
this
.
couponId
);
dest
.
writeValue
(
this
.
pointsAdd
);
dest
.
writeValue
(
this
.
pointsUse
);
dest
.
writeInt
(
this
.
whetherFreeService
);
dest
.
writeTypedList
(
this
.
orderPays
);
dest
.
writeParcelable
(
this
.
posMatter
,
flags
);
}
protected
MealOrderPayRequest
(
Parcel
in
)
{
this
.
orderId
=
in
.
readLong
();
this
.
linePayType
=
in
.
readInt
();
this
.
orderPayType
=
in
.
readInt
();
this
.
tableId
=
in
.
readInt
();
this
.
tableNumber
=
in
.
readString
();
this
.
memberId
=
(
Long
)
in
.
readValue
(
Long
.
class
.
getClassLoader
());
this
.
couponId
=
(
Long
)
in
.
readValue
(
Long
.
class
.
getClassLoader
());
this
.
pointsAdd
=
(
Double
)
in
.
readValue
(
Double
.
class
.
getClassLoader
());
this
.
pointsUse
=
(
Double
)
in
.
readValue
(
Double
.
class
.
getClassLoader
());
this
.
whetherFreeService
=
in
.
readInt
();
this
.
orderPays
=
in
.
createTypedArrayList
(
OrderPay
.
CREATOR
);
this
.
posMatter
=
in
.
readParcelable
(
PosMatter
.
class
.
getClassLoader
());
}
public
static
final
Creator
<
MealOrderPayRequest
>
CREATOR
=
new
Creator
<
MealOrderPayRequest
>()
{
@Override
public
MealOrderPayRequest
createFromParcel
(
Parcel
source
)
{
return
new
MealOrderPayRequest
(
source
);
}
@Override
public
MealOrderPayRequest
[]
newArray
(
int
size
)
{
return
new
MealOrderPayRequest
[
size
];
}
};
}
library-order/src/main/java/com/gingersoft/gsa/cloud/order/bean/response/OrderResponse.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
order
.
bean
.
response
;
import
androidx.annotation.Nullable
;
import
com.gingersoft.gsa.cloud.common.core.member.MemberInfo
;
import
java.io.Serializable
;
...
...
@@ -36,6 +38,15 @@ public class OrderResponse {
private
List
<
OrderDiscountResponse
>
discountDetails
;
private
List
<
OrderDetailsBean
>
orderDetails
;
/**
* N5支付ID
* 有支付異常事項需要處理時才返回
*/
@Nullable
private
String
txnId
;
@Nullable
private
String
payName
;
public
OrderResponse
()
{
}
...
...
@@ -94,7 +105,9 @@ public class OrderResponse {
* 是否参与服務費#0:不參與;1:參與;
**/
private
byte
scAble
=
1
;
/**折扣實體*/
/**
* 折扣實體
*/
private
List
<
RestaurantDiscountVO
>
discountList
;
/**
...
...
@@ -137,7 +150,7 @@ public class OrderResponse {
private
long
memberId
;
@Data
public
static
class
RestaurantDiscountVO
implements
Serializable
{
public
static
class
RestaurantDiscountVO
implements
Serializable
{
private
Long
id
;
private
long
discountId
;
private
int
type
;
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/order/billItem/BillItem.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
order
.
billItem
;
import
android.graphics.Color
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
lombok.Data
;
...
...
@@ -11,7 +13,7 @@ import lombok.Data;
* @description: 賬單項抽象類{@link BillItem}
*/
@Data
public
abstract
class
BillItem
{
public
class
BillItem
implements
Parcelable
{
protected
String
name
;
protected
double
money
=
0.0
;
...
...
@@ -66,4 +68,43 @@ public abstract class BillItem {
this
.
status
=
status
;
this
.
type
=
type
;
}
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeString
(
this
.
name
);
dest
.
writeDouble
(
this
.
money
);
dest
.
writeInt
(
this
.
textSize
);
dest
.
writeInt
(
this
.
textColor
);
dest
.
writeInt
(
this
.
bgColor
);
dest
.
writeInt
(
this
.
status
);
dest
.
writeByte
(
this
.
type
);
}
protected
BillItem
(
Parcel
in
)
{
this
.
name
=
in
.
readString
();
this
.
money
=
in
.
readDouble
();
this
.
textSize
=
in
.
readInt
();
this
.
textColor
=
in
.
readInt
();
this
.
bgColor
=
in
.
readInt
();
this
.
status
=
in
.
readInt
();
this
.
type
=
in
.
readByte
();
}
public
static
final
Creator
<
BillItem
>
CREATOR
=
new
Creator
<
BillItem
>()
{
@Override
public
BillItem
createFromParcel
(
Parcel
source
)
{
return
new
BillItem
(
source
);
}
@Override
public
BillItem
[]
newArray
(
int
size
)
{
return
new
BillItem
[
size
];
}
};
}
library-order/src/main/java/com/gingersoft/gsa/cloud/order/cart/ShoppingCart.java
View file @
d3cc4b0f
...
...
@@ -33,7 +33,11 @@ public class ShoppingCart {
public
static
ShoppingCart
getInstance
()
{
if
(
shoppingCart
==
null
)
{
shoppingCart
=
new
ShoppingCart
();
synchronized
(
ShoppingCart
.
class
)
{
if
(
shoppingCart
==
null
)
{
shoppingCart
=
new
ShoppingCart
();
}
}
}
return
shoppingCart
;
}
...
...
@@ -83,7 +87,7 @@ public class ShoppingCart {
private
ShoppingCartNumberChange
cartNumberChange
=
new
ShoppingCartNumberChange
(
orderCommodityList
);
public
void
changeNumber
(
int
number
,
OrderDetail
orderFood
,
OrderDetail
orderMainFood
,
int
select_Full_start_position
,
int
select_Full_end_position
,
ShoppingCartNumberChange
.
OnNumberChangeListener
listener
)
{
public
void
changeNumber
(
int
number
,
OrderDetail
orderFood
,
OrderDetail
orderMainFood
,
int
select_Full_start_position
,
int
select_Full_end_position
,
ShoppingCartNumberChange
.
OnNumberChangeListener
listener
)
{
cartNumberChange
.
changeNumber
(
number
,
orderFood
,
orderMainFood
,
select_Full_start_position
,
select_Full_end_position
,
listener
);
}
...
...
@@ -212,7 +216,7 @@ public class ShoppingCart {
* @return
*/
public
MultyDiscount
addNomalDiscountToLinked
(
MultyDiscount
multyDiscounts
,
Discount
discount
,
int
status
)
{
MultyDiscount
nomalDiscount
=
new
NomalDiscount
(
discount
.
getRemark
(),
status
,
multyDiscounts
,
discount
);
MultyDiscount
nomalDiscount
=
new
NomalDiscount
(
discount
.
getRemark
(),
status
,
multyDiscounts
,
discount
);
return
nomalDiscount
;
}
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/order/order/DoshokuOrder.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
order
.
order
;
import
android.
content.Context
;
import
android.
text.TextUtils
;
import
com.gingersoft.gsa.cloud.common.core.member.MemberInfo
;
import
com.gingersoft.gsa.cloud.common.core.table.TableBean
;
import
com.gingersoft.gsa.cloud.order.bean.request.DeleteOrderRequest
;
import
com.gingersoft.gsa.cloud.order.bean.request.MealOrderPayRequest
;
import
com.gingersoft.gsa.cloud.order.bean.response.OrderResponse
;
import
com.gingersoft.gsa.cloud.order.billItem.BillItem
;
import
com.gingersoft.gsa.cloud.order.commodity.OrderDetail
;
import
com.gingersoft.gsa.cloud.pay.bean.PayMethod
;
import
com.gingersoft.gsa.cloud.pay.pos.OnPosActionListener
;
import
com.gingersoft.gsa.cloud.pay.pos.PosAction
;
import
com.gingersoft.gsa.cloud.pay.pos.PosPay
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.bg.GetTxnIdRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.AdjustTipRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.RefundRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.RetrievalRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.SaleRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.VoidRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.imp.RefundActionImpl
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.imp.RetrievalActionImpl
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.imp.SaleActionImpl
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.imp.TipsActionImpl
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.imp.VoidActionImpl
;
import
com.jess.arms.mvp.IView
;
import
java.util.ArrayList
;
import
java.util.Date
;
...
...
@@ -47,7 +30,11 @@ public class DoshokuOrder extends BaseOrder {
public
static
DoshokuOrder
getInstance
()
{
if
(
doshokuOrder
==
null
)
{
doshokuOrder
=
new
DoshokuOrder
();
synchronized
(
DoshokuOrder
.
class
)
{
if
(
doshokuOrder
==
null
)
{
doshokuOrder
=
new
DoshokuOrder
();
}
}
}
return
doshokuOrder
;
}
...
...
@@ -146,6 +133,9 @@ public class DoshokuOrder extends BaseOrder {
}
public
boolean
needUpdateMemberInfo
()
{
if
(
TextUtils
.
isEmpty
(
memberUpdateStatus
))
{
return
false
;
}
String
[]
status
=
memberUpdateStatus
.
split
(
"-"
);
if
(
status
.
length
==
2
)
{
if
(
Boolean
.
parseBoolean
(
status
[
0
])
!=
Boolean
.
parseBoolean
(
status
[
1
]))
{
...
...
@@ -158,27 +148,6 @@ public class DoshokuOrder extends BaseOrder {
}
}
public
void
pay
(
Context
context
,
IView
iView
,
SaleRequest
saleRequest
,
GetTxnIdRequest
getTxnIdRequest
,
TableBean
.
DataBean
tableBean
,
MealOrderPayRequest
orderPayRequest
,
List
<
BillItem
>
billItemList
,
List
<
PayMethod
>
payMethodList
)
{
PosPay
.
sendRequest
(
new
SaleActionImpl
(
context
,
iView
,
PosAction
.
SALE
,
saleRequest
,
getTxnIdRequest
,
tableBean
,
orderPayRequest
,
billItemList
,
payMethodList
,
true
));
}
public
void
refund
(
Context
context
,
IView
iView
,
RefundRequest
request
,
GetTxnIdRequest
getTxnIdRequest
,
OnPosActionListener
onPosActionListener
)
{
PosPay
.
sendRequest
(
new
RefundActionImpl
(
context
,
iView
,
PosAction
.
REFUND
,
request
,
getTxnIdRequest
,
onPosActionListener
,
true
));
}
public
void
voidO
(
Context
context
,
IView
iView
,
VoidRequest
request
,
GetTxnIdRequest
getTxnIdRequest
,
OnPosActionListener
onPosActionListener
)
{
PosPay
.
sendRequest
(
new
VoidActionImpl
(
context
,
iView
,
PosAction
.
VOID
,
request
,
getTxnIdRequest
,
onPosActionListener
,
true
));
}
public
void
tip
(
Context
context
,
IView
iView
,
GetTxnIdRequest
txnIdRequest
,
AdjustTipRequest
tipRequest
,
OnPosActionListener
onPosActionListener
)
{
PosPay
.
sendRequest
(
new
TipsActionImpl
(
context
,
iView
,
PosAction
.
TIP
,
txnIdRequest
,
tipRequest
,
onPosActionListener
,
true
));
}
public
void
retrieval
(
Context
context
,
IView
iView
,
RetrievalRequest
request
,
OnPosActionListener
onPosActionListener
)
{
PosPay
.
sendRequest
(
new
RetrievalActionImpl
(
context
,
iView
,
PosAction
.
RETRIEVAL
,
request
,
onPosActionListener
,
true
));
}
@Override
public
void
initialization
()
{
if
(
deleteMealOrders
!=
null
)
{
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/order/order/TakeawayOrder.java
View file @
d3cc4b0f
...
...
@@ -16,7 +16,11 @@ public class TakeawayOrder extends BaseOrder {
public
static
TakeawayOrder
getInstance
()
{
if
(
takeawayOrder
==
null
)
{
takeawayOrder
=
new
TakeawayOrder
();
synchronized
(
TakeawayOrder
.
class
)
{
if
(
takeawayOrder
==
null
)
{
takeawayOrder
=
new
TakeawayOrder
();
}
}
}
return
takeawayOrder
;
}
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/bean/PayMethod.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
bean
;
import
android.graphics.Color
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
android.text.TextUtils
;
import
com.google.gson.annotations.SerializedName
;
import
lombok.Data
;
/**
...
...
@@ -13,7 +17,7 @@ import lombok.Data;
* 描述:
*/
@Data
public
class
PayMethod
{
public
class
PayMethod
implements
Parcelable
{
/**
* id : 12
...
...
@@ -88,7 +92,6 @@ public class PayMethod {
private
double
amountValue
;
/**
* 支付方式(1:寶達通 8:支付寶 1001:現金 1023:支付寶HK
*
*/
private
int
payType
;
...
...
@@ -193,373 +196,153 @@ public class PayMethod {
this
.
amountValue
=
method
.
amountValue
;
this
.
payType
=
method
.
payType
;
this
.
minPayAmount
=
method
.
minPayAmount
;
this
.
whetherFreeService
=
method
.
whetherFreeService
;
this
.
whetherFreeService
=
method
.
whetherFreeService
;
this
.
whetherTaxExemption
=
method
.
whetherTaxExemption
;
this
.
whetherSignatureLine
=
method
.
whetherSignatureLine
;
this
.
whetherSignatureLine
=
method
.
whetherSignatureLine
;
this
.
paySeq
=
method
.
paySeq
;
this
.
whetherOpenBox
=
method
.
whetherOpenBox
;
this
.
getIntegral
=
method
.
getIntegral
;
this
.
integralMultiple
=
method
.
integralMultiple
;
this
.
deductionIntegral
=
method
.
deductionIntegral
;
this
.
dockingType
=
method
.
dockingType
;
this
.
integralMultiple
=
method
.
integralMultiple
;
this
.
deductionIntegral
=
method
.
deductionIntegral
;
this
.
dockingType
=
method
.
dockingType
;
this
.
billType
=
method
.
billType
;
this
.
tablePrintingAmount
=
method
.
tablePrintingAmount
;
this
.
takeOutPrintingAmount
=
method
.
takeOutPrintingAmount
;
this
.
takeOutPrintingAmount
=
method
.
takeOutPrintingAmount
;
this
.
updateTime
=
method
.
updateTime
;
this
.
createTimeX
=
method
.
createTimeX
;
this
.
updateUid
=
method
.
updateUid
;
this
.
createUid
=
method
.
createUid
;
this
.
payMoney
=
method
.
payMoney
;
this
.
TipsPrice
=
method
.
TipsPrice
;
this
.
payMoney
=
method
.
payMoney
;
this
.
TipsPrice
=
method
.
TipsPrice
;
this
.
payModeTextColor
=
method
.
payModeTextColor
;
this
.
payMoneyTextColor
=
method
.
payMoneyTextColor
;
this
.
payModeTextSelectColor
=
method
.
payModeTextSelectColor
;
this
.
payMoneyTextSelectColor
=
method
.
payMoneyTextSelectColor
;
this
.
payModeSize
=
method
.
payModeSize
;
this
.
payMoneySize
=
method
.
payMoneySize
;
this
.
payMoneyTextColor
=
method
.
payMoneyTextColor
;
this
.
payModeTextSelectColor
=
method
.
payModeTextSelectColor
;
this
.
payMoneyTextSelectColor
=
method
.
payMoneyTextSelectColor
;
this
.
payModeSize
=
method
.
payModeSize
;
this
.
payMoneySize
=
method
.
payMoneySize
;
}
public
String
getPayName
()
{
if
(!
TextUtils
.
isEmpty
(
nameFirst
))
if
(!
TextUtils
.
isEmpty
(
nameFirst
))
{
return
nameFirst
;
if
(!
TextUtils
.
isEmpty
(
nameSecond
))
}
if
(!
TextUtils
.
isEmpty
(
nameSecond
))
{
return
nameSecond
;
if
(!
TextUtils
.
isEmpty
(
nameThird
))
}
if
(!
TextUtils
.
isEmpty
(
nameThird
))
{
return
nameThird
;
}
return
""
;
}
public
void
setPayName
(
String
name
){
public
void
setPayName
(
String
name
)
{
this
.
nameFirst
=
name
;
this
.
nameSecond
=
name
;
this
.
nameThird
=
name
;
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
int
getBrandId
()
{
return
brandId
;
}
public
void
setBrandId
(
int
brandId
)
{
this
.
brandId
=
brandId
;
}
public
int
getRestaurantId
()
{
return
restaurantId
;
}
public
void
setRestaurantId
(
int
restaurantId
)
{
this
.
restaurantId
=
restaurantId
;
}
public
String
getNameFirst
()
{
return
nameFirst
;
}
public
void
setNameFirst
(
String
nameFirst
)
{
this
.
nameFirst
=
nameFirst
;
}
public
String
getNameSecond
()
{
return
nameSecond
;
}
public
void
setNameSecond
(
String
nameSecond
)
{
this
.
nameSecond
=
nameSecond
;
}
public
String
getNameThird
()
{
return
nameThird
;
}
public
void
setNameThird
(
String
nameThird
)
{
this
.
nameThird
=
nameThird
;
}
public
int
getWhetherSales
()
{
return
whetherSales
;
}
public
void
setWhetherSales
(
int
whetherSales
)
{
this
.
whetherSales
=
whetherSales
;
}
public
int
getWhetherManagerAuthority
()
{
return
whetherManagerAuthority
;
}
public
void
setWhetherManagerAuthority
(
int
whetherManagerAuthority
)
{
this
.
whetherManagerAuthority
=
whetherManagerAuthority
;
}
public
String
getColor
()
{
return
color
;
}
public
void
setColor
(
String
color
)
{
this
.
color
=
color
;
}
public
String
getFont_color
()
{
return
font_color
;
}
public
void
setFont_color
(
String
font_color
)
{
this
.
font_color
=
font_color
;
}
public
int
getWhetherReportCount
()
{
return
whetherReportCount
;
}
public
void
setWhetherReportCount
(
int
whetherReportCount
)
{
this
.
whetherReportCount
=
whetherReportCount
;
}
public
int
getInteractiveType
()
{
return
interactiveType
;
}
public
void
setInteractiveType
(
int
interactiveType
)
{
this
.
interactiveType
=
interactiveType
;
}
public
int
getWhetherFixedAmount
()
{
return
whetherFixedAmount
;
}
public
void
setWhetherFixedAmount
(
int
whetherFixedAmount
)
{
this
.
whetherFixedAmount
=
whetherFixedAmount
;
}
public
double
getAmountValue
()
{
return
amountValue
;
}
public
void
setAmountValue
(
double
amountValue
)
{
this
.
amountValue
=
amountValue
;
}
public
int
getPayType
()
{
return
payType
;
}
public
void
setPayType
(
int
payType
)
{
this
.
payType
=
payType
;
}
public
double
getMinPayAmount
()
{
return
minPayAmount
;
}
public
void
setMinPayAmount
(
double
minPayAmount
)
{
this
.
minPayAmount
=
minPayAmount
;
}
public
int
getWhetherFreeService
()
{
return
whetherFreeService
;
}
public
void
setWhetherFreeService
(
int
whetherFreeService
)
{
this
.
whetherFreeService
=
whetherFreeService
;
}
public
int
getWhetherTaxExemption
()
{
return
whetherTaxExemption
;
}
public
void
setWhetherTaxExemption
(
int
whetherTaxExemption
)
{
this
.
whetherTaxExemption
=
whetherTaxExemption
;
}
public
int
getWhetherSignatureLine
()
{
return
whetherSignatureLine
;
}
public
void
setWhetherSignatureLine
(
int
whetherSignatureLine
)
{
this
.
whetherSignatureLine
=
whetherSignatureLine
;
}
public
int
getPaySeq
()
{
return
paySeq
;
}
public
void
setPaySeq
(
int
paySeq
)
{
this
.
paySeq
=
paySeq
;
}
public
int
getWhetherOpenBox
()
{
return
whetherOpenBox
;
}
public
void
setWhetherOpenBox
(
int
whetherOpenBox
)
{
this
.
whetherOpenBox
=
whetherOpenBox
;
}
public
int
getGetIntegral
()
{
return
getIntegral
;
}
public
void
setGetIntegral
(
int
getIntegral
)
{
this
.
getIntegral
=
getIntegral
;
}
public
int
getIntegralMultiple
()
{
return
integralMultiple
;
}
public
void
setIntegralMultiple
(
int
integralMultiple
)
{
this
.
integralMultiple
=
integralMultiple
;
}
public
float
getDeductionIntegral
()
{
return
deductionIntegral
;
}
public
void
setDeductionIntegral
(
float
deductionIntegral
)
{
this
.
deductionIntegral
=
deductionIntegral
;
}
public
int
getDockingType
()
{
return
dockingType
;
}
public
void
setDockingType
(
int
dockingType
)
{
this
.
dockingType
=
dockingType
;
}
public
String
getBillType
()
{
return
billType
;
}
public
void
setBillType
(
String
billType
)
{
this
.
billType
=
billType
;
}
public
int
getTablePrintingAmount
()
{
return
tablePrintingAmount
;
}
public
void
setTablePrintingAmount
(
int
tablePrintingAmount
)
{
this
.
tablePrintingAmount
=
tablePrintingAmount
;
}
public
int
getTakeOutPrintingAmount
()
{
return
takeOutPrintingAmount
;
}
public
void
setTakeOutPrintingAmount
(
int
takeOutPrintingAmount
)
{
this
.
takeOutPrintingAmount
=
takeOutPrintingAmount
;
}
public
long
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
long
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
long
getCreateTimeX
()
{
return
createTimeX
;
}
public
void
setCreateTimeX
(
long
createTimeX
)
{
this
.
createTimeX
=
createTimeX
;
}
public
int
getUpdateUid
()
{
return
updateUid
;
}
public
void
setUpdateUid
(
int
updateUid
)
{
this
.
updateUid
=
updateUid
;
}
public
int
getCreateUid
()
{
return
createUid
;
}
public
void
setCreateUid
(
int
createUid
)
{
this
.
createUid
=
createUid
;
}
public
double
getPayMoney
()
{
return
payMoney
;
}
public
void
setPayMoney
(
double
payMoney
)
{
this
.
payMoney
=
payMoney
;
}
public
double
getTipsPrice
()
{
return
TipsPrice
;
}
public
void
setTipsPrice
(
double
tipsPrice
)
{
TipsPrice
=
tipsPrice
;
}
public
int
getPayModeTextColor
()
{
return
payModeTextColor
;
}
public
void
setPayModeTextColor
(
int
payModeTextColor
)
{
this
.
payModeTextColor
=
payModeTextColor
;
}
public
int
getPayMoneyTextColor
()
{
return
payMoneyTextColor
;
}
public
void
setPayMoneyTextColor
(
int
payMoneyTextColor
)
{
this
.
payMoneyTextColor
=
payMoneyTextColor
;
}
public
int
getPayModeTextSelectColor
()
{
return
payModeTextSelectColor
;
}
public
void
setPayModeTextSelectColor
(
int
payModeTextSelectColor
)
{
this
.
payModeTextSelectColor
=
payModeTextSelectColor
;
}
public
int
getPayMoneyTextSelectColor
()
{
return
payMoneyTextSelectColor
;
}
public
void
setPayMoneyTextSelectColor
(
int
payMoneyTextSelectColor
)
{
this
.
payMoneyTextSelectColor
=
payMoneyTextSelectColor
;
}
public
int
getPayModeSize
()
{
return
payModeSize
;
}
public
void
setPayModeSize
(
int
payModeSize
)
{
this
.
payModeSize
=
payModeSize
;
}
public
int
getPayMoneySize
()
{
return
payMoneySize
;
}
public
void
setPayMoneySize
(
int
payMoneySize
)
{
this
.
payMoneySize
=
payMoneySize
;
}
public
static
int
getPayTypeCash
()
{
return
PAY_TYPE_CASH
;
}
public
static
int
getPayTypeIntegral
()
{
return
PAY_TYPE_INTEGRAL
;
}
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeInt
(
this
.
id
);
dest
.
writeInt
(
this
.
brandId
);
dest
.
writeInt
(
this
.
restaurantId
);
dest
.
writeString
(
this
.
nameFirst
);
dest
.
writeString
(
this
.
nameSecond
);
dest
.
writeString
(
this
.
nameThird
);
dest
.
writeInt
(
this
.
whetherSales
);
dest
.
writeInt
(
this
.
whetherManagerAuthority
);
dest
.
writeString
(
this
.
color
);
dest
.
writeString
(
this
.
font_color
);
dest
.
writeInt
(
this
.
whetherReportCount
);
dest
.
writeInt
(
this
.
interactiveType
);
dest
.
writeInt
(
this
.
whetherFixedAmount
);
dest
.
writeDouble
(
this
.
amountValue
);
dest
.
writeInt
(
this
.
payType
);
dest
.
writeDouble
(
this
.
minPayAmount
);
dest
.
writeInt
(
this
.
whetherFreeService
);
dest
.
writeInt
(
this
.
whetherTaxExemption
);
dest
.
writeInt
(
this
.
whetherSignatureLine
);
dest
.
writeInt
(
this
.
paySeq
);
dest
.
writeInt
(
this
.
whetherOpenBox
);
dest
.
writeInt
(
this
.
getIntegral
);
dest
.
writeInt
(
this
.
integralMultiple
);
dest
.
writeFloat
(
this
.
deductionIntegral
);
dest
.
writeInt
(
this
.
dockingType
);
dest
.
writeString
(
this
.
billType
);
dest
.
writeInt
(
this
.
tablePrintingAmount
);
dest
.
writeInt
(
this
.
takeOutPrintingAmount
);
dest
.
writeLong
(
this
.
updateTime
);
dest
.
writeLong
(
this
.
createTimeX
);
dest
.
writeInt
(
this
.
updateUid
);
dest
.
writeInt
(
this
.
createUid
);
dest
.
writeDouble
(
this
.
payMoney
);
dest
.
writeDouble
(
this
.
TipsPrice
);
dest
.
writeInt
(
this
.
payModeTextColor
);
dest
.
writeInt
(
this
.
payMoneyTextColor
);
dest
.
writeInt
(
this
.
payModeTextSelectColor
);
dest
.
writeInt
(
this
.
payMoneyTextSelectColor
);
dest
.
writeInt
(
this
.
payModeSize
);
dest
.
writeInt
(
this
.
payMoneySize
);
}
protected
PayMethod
(
Parcel
in
)
{
this
.
id
=
in
.
readInt
();
this
.
brandId
=
in
.
readInt
();
this
.
restaurantId
=
in
.
readInt
();
this
.
nameFirst
=
in
.
readString
();
this
.
nameSecond
=
in
.
readString
();
this
.
nameThird
=
in
.
readString
();
this
.
whetherSales
=
in
.
readInt
();
this
.
whetherManagerAuthority
=
in
.
readInt
();
this
.
color
=
in
.
readString
();
this
.
font_color
=
in
.
readString
();
this
.
whetherReportCount
=
in
.
readInt
();
this
.
interactiveType
=
in
.
readInt
();
this
.
whetherFixedAmount
=
in
.
readInt
();
this
.
amountValue
=
in
.
readDouble
();
this
.
payType
=
in
.
readInt
();
this
.
minPayAmount
=
in
.
readDouble
();
this
.
whetherFreeService
=
in
.
readInt
();
this
.
whetherTaxExemption
=
in
.
readInt
();
this
.
whetherSignatureLine
=
in
.
readInt
();
this
.
paySeq
=
in
.
readInt
();
this
.
whetherOpenBox
=
in
.
readInt
();
this
.
getIntegral
=
in
.
readInt
();
this
.
integralMultiple
=
in
.
readInt
();
this
.
deductionIntegral
=
in
.
readFloat
();
this
.
dockingType
=
in
.
readInt
();
this
.
billType
=
in
.
readString
();
this
.
tablePrintingAmount
=
in
.
readInt
();
this
.
takeOutPrintingAmount
=
in
.
readInt
();
this
.
updateTime
=
in
.
readLong
();
this
.
createTimeX
=
in
.
readLong
();
this
.
updateUid
=
in
.
readInt
();
this
.
createUid
=
in
.
readInt
();
this
.
payMoney
=
in
.
readDouble
();
this
.
TipsPrice
=
in
.
readDouble
();
this
.
payModeTextColor
=
in
.
readInt
();
this
.
payMoneyTextColor
=
in
.
readInt
();
this
.
payModeTextSelectColor
=
in
.
readInt
();
this
.
payMoneyTextSelectColor
=
in
.
readInt
();
this
.
payModeSize
=
in
.
readInt
();
this
.
payMoneySize
=
in
.
readInt
();
}
public
static
final
Creator
<
PayMethod
>
CREATOR
=
new
Creator
<
PayMethod
>()
{
@Override
public
PayMethod
createFromParcel
(
Parcel
source
)
{
return
new
PayMethod
(
source
);
}
@Override
public
PayMethod
[]
newArray
(
int
size
)
{
return
new
PayMethod
[
size
];
}
};
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/bean/PosActionStatusExceptionParam.java
0 → 100644
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
bean
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
com.gingersoft.gsa.cloud.pay.pos.PosAction
;
import
lombok.Data
;
/**
* @作者: bin
* @創建時間: 2020-12-30 16:11
* @更新時間: 2020-12-30 16:11
* @描述:
*/
@Data
public
class
PosActionStatusExceptionParam
implements
Parcelable
{
private
String
txnId
;
private
PosAction
posAction
;
private
long
orderNum
;
private
double
amount
;
private
String
payMethodName
;
public
PosActionStatusExceptionParam
()
{
}
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeString
(
this
.
txnId
);
dest
.
writeInt
(
this
.
posAction
==
null
?
-
1
:
this
.
posAction
.
ordinal
());
dest
.
writeLong
(
this
.
orderNum
);
dest
.
writeDouble
(
this
.
amount
);
dest
.
writeString
(
this
.
payMethodName
);
}
protected
PosActionStatusExceptionParam
(
Parcel
in
)
{
this
.
txnId
=
in
.
readString
();
int
tmpPosAction
=
in
.
readInt
();
this
.
posAction
=
tmpPosAction
==
-
1
?
null
:
PosAction
.
values
()[
tmpPosAction
];
this
.
orderNum
=
in
.
readLong
();
this
.
amount
=
in
.
readDouble
();
this
.
payMethodName
=
in
.
readString
();
}
public
static
final
Creator
<
PosActionStatusExceptionParam
>
CREATOR
=
new
Creator
<
PosActionStatusExceptionParam
>()
{
@Override
public
PosActionStatusExceptionParam
createFromParcel
(
Parcel
source
)
{
return
new
PosActionStatusExceptionParam
(
source
);
}
@Override
public
PosActionStatusExceptionParam
[]
newArray
(
int
size
)
{
return
new
PosActionStatusExceptionParam
[
size
];
}
};
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/contract/PayErrorCode.java
View file @
d3cc4b0f
...
...
@@ -12,6 +12,9 @@ public interface PayErrorCode {
* pos回調為Null
*/
String
pos_response_null
=
"[100]"
;
/**
* pos回調status != 00
*/
String
pos_response_101
=
"[101]"
;
/**
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/IPosAction.java
View file @
d3cc4b0f
...
...
@@ -31,7 +31,7 @@ public abstract class IPosAction {
private
final
String
mLoadingActionText
=
"中..."
;
private
final
String
mLoadingActionComplteText
=
"成功"
;
private
final
long
mCancelDelayMillis
=
1
0
00
;
private
final
long
mCancelDelayMillis
=
1
5
00
;
public
IPosAction
(
Context
context
,
IView
iView
,
PosAction
action
,
boolean
showLoading
)
{
this
.
mContext
=
context
;
...
...
@@ -80,7 +80,7 @@ public abstract class IPosAction {
}
if
(
e
.
getMessage
().
contains
(
PayErrorCode
.
pos_response_null
))
{
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
on
ResponseNull
(
);
mOnPosActionListener
.
on
PosException
(
null
);
}
}
}
...
...
@@ -92,44 +92,19 @@ public abstract class IPosAction {
}
/**
* 根據Pos事件類型獲取業務類型
*
* @param eventName
* @return
*/
protected
String
getActionNameByEventName
(
String
eventName
)
{
switch
(
eventName
)
{
case
com
.
etps
.
aca
.
lib
.
constant
.
Constant
.
EVENT
.
NAME
.
SALE_RESP
:
return
PosAction
.
SALE
.
getActionName
();
case
com
.
etps
.
aca
.
lib
.
constant
.
Constant
.
EVENT
.
NAME
.
VOID_RESP
:
return
PosAction
.
VOID
.
getActionName
();
case
com
.
etps
.
aca
.
lib
.
constant
.
Constant
.
EVENT
.
NAME
.
REFUND_RESP
:
return
PosAction
.
RETRIEVAL
.
getActionName
();
case
com
.
etps
.
aca
.
lib
.
constant
.
Constant
.
EVENT
.
NAME
.
ADJUST_RESP
:
return
PosAction
.
TIP
.
getActionName
();
case
"RETRIEVAL_RESP"
:
return
PosAction
.
RETRIEVAL
.
getActionName
();
case
"SETTLE_RESP"
:
return
PosAction
.
SETTLEMENT
.
getActionName
();
}
return
"未知動作"
;
}
/**
* 根據業務回調狀態,返回事項上傳狀態
*
* @param status
* @return
*/
protected
byte
getPosMatterStatus
(
String
status
)
{
switch
(
status
)
{
case
PayStatusCode
.
PAY_STATUS_00
:
return
PosMatter
.
status_0
;
default
:
return
PosMatter
.
status_2
;
if
(
PayStatusCode
.
withSuccess
(
status
))
{
return
PosMatter
.
status_1
;
}
else
if
(
PayStatusCode
.
withException
(
status
))
{
return
PosMatter
.
status_0
;
}
else
{
return
PosMatter
.
status_2
;
}
}
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/IPosCallback.java
deleted
100644 → 0
View file @
b4efd6e3
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
pos
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.AdjustTipRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.RefundRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.RetrievalRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.SaleRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.SettlementRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.VoidRespose
;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2019-11-01
* 修订历史:2019-11-01
* 描述:
*/
public
interface
IPosCallback
{
void
onSaleCall
(
SaleRespose
response
);
void
onVoidCall
(
VoidRespose
response
);
void
onRefundCall
(
RefundRespose
response
);
void
onRetrievalCall
(
RetrievalRespose
response
);
void
onAdjustCall
(
AdjustTipRespose
response
);
void
onSettleCall
(
SettlementRespose
response
);
void
onPrinterCall
(
String
response
);
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/OnPosActionListener.java
View file @
d3cc4b0f
...
...
@@ -10,12 +10,26 @@ import com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.HywebPosRespo
*/
public
interface
OnPosActionListener
{
void
onSuccess
(
HywebPosResponse
response
);
/**
* N5回調成功
* @param response
*/
void
onPosSuccess
(
HywebPosResponse
response
);
void
onError
(
Throwable
e
);
/**
* N6回調狀態異常,需要去重試查詢
*/
void
onPosException
(
HywebPosResponse
response
);
/**
* N6回調失敗,需要去重試查詢
* 更新狀態成功
* @param response
*/
void
onResponseNull
();
void
onSuccess
(
HywebPosResponse
response
);
/**
* 更新狀態失敗
* @param e
*/
void
onError
(
Throwable
e
);
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/PosAction.java
View file @
d3cc4b0f
...
...
@@ -27,4 +27,5 @@ public enum PosAction {
return
actionName
+
"回調異常"
;
}
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/PosPay.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
pos
;
import
android.content.Context
;
import
com.etps.aca.lib.activity.CommandActivity
;
import
com.gingersoft.gsa.cloud.common.core.table.TableBean
;
import
com.gingersoft.gsa.cloud.order.bean.request.MealOrderPayRequest
;
import
com.gingersoft.gsa.cloud.order.billItem.BillItem
;
import
com.gingersoft.gsa.cloud.pay.bean.PayMethod
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.bg.GetTxnIdRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.AdjustTipRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.RefundRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.RetrievalRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.SaleRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.VoidRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.command.CommandImpl
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.imp.RefundActionImpl
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.imp.RetrievalActionImpl
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.imp.SaleActionImpl
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.imp.TipsActionImpl
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.imp.VoidActionImpl
;
import
com.jess.arms.mvp.IView
;
import
java.util.List
;
/**
* @作者: bin
...
...
@@ -9,7 +29,7 @@ import com.gingersoft.gsa.cloud.pay.pos.hywebpos.command.CommandImpl;
* @更新時間: 2020-12-26 10:32
* @描述:
*/
public
class
PosPay
{
public
final
class
PosPay
{
public
static
void
sendRequest
(
IPosAction
action
)
{
...
...
@@ -23,4 +43,25 @@ public class PosPay {
// }
}
public
static
void
pay
(
Context
context
,
IView
iView
,
SaleRequest
saleRequest
,
GetTxnIdRequest
getTxnIdRequest
,
TableBean
.
DataBean
tableBean
,
MealOrderPayRequest
orderPayRequest
,
List
<
BillItem
>
billItemList
,
List
<
PayMethod
>
payMethodList
)
{
PosPay
.
sendRequest
(
new
SaleActionImpl
(
context
,
iView
,
PosAction
.
SALE
,
saleRequest
,
getTxnIdRequest
,
tableBean
,
orderPayRequest
,
billItemList
,
payMethodList
,
true
));
}
public
static
void
tip
(
Context
context
,
IView
iView
,
GetTxnIdRequest
txnIdRequest
,
AdjustTipRequest
tipRequest
,
OnPosActionListener
onPosActionListener
)
{
PosPay
.
sendRequest
(
new
TipsActionImpl
(
context
,
iView
,
PosAction
.
TIP
,
txnIdRequest
,
tipRequest
,
onPosActionListener
,
true
));
}
public
static
void
refund
(
Context
context
,
IView
iView
,
RefundRequest
request
,
GetTxnIdRequest
getTxnIdRequest
,
OnPosActionListener
onPosActionListener
)
{
PosPay
.
sendRequest
(
new
RefundActionImpl
(
context
,
iView
,
PosAction
.
REFUND
,
request
,
getTxnIdRequest
,
onPosActionListener
,
true
));
}
public
static
void
voidO
(
Context
context
,
IView
iView
,
VoidRequest
request
,
GetTxnIdRequest
getTxnIdRequest
,
OnPosActionListener
onPosActionListener
)
{
PosPay
.
sendRequest
(
new
VoidActionImpl
(
context
,
iView
,
PosAction
.
VOID
,
request
,
getTxnIdRequest
,
onPosActionListener
,
true
));
}
public
static
void
retrieval
(
Context
context
,
IView
iView
,
RetrievalRequest
request
,
OnPosActionListener
onPosActionListener
)
{
PosPay
.
sendRequest
(
new
RetrievalActionImpl
(
context
,
iView
,
PosAction
.
RETRIEVAL
,
111
,
request
,
onPosActionListener
,
false
));
}
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/bbpos/BBPosCallback.java
deleted
100644 → 0
View file @
b4efd6e3
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
pos
.
bbpos
;
import
com.gingersoft.gsa.cloud.pay.pos.IPosCallback
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.AdjustTipRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.RefundRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.RetrievalRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.SaleRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.SettlementRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.VoidRespose
;
/**
* @作者: bin
* @創建時間: 2020-12-26 10:38
* @更新時間: 2020-12-26 10:38
* @描述:
*/
public
class
BBPosCallback
implements
IPosCallback
{
@Override
public
void
onSaleCall
(
SaleRespose
response
)
{
}
@Override
public
void
onVoidCall
(
VoidRespose
response
)
{
}
@Override
public
void
onRefundCall
(
RefundRespose
response
)
{
}
@Override
public
void
onRetrievalCall
(
RetrievalRespose
response
)
{
}
@Override
public
void
onAdjustCall
(
AdjustTipRespose
response
)
{
}
@Override
public
void
onSettleCall
(
SettlementRespose
response
)
{
}
@Override
public
void
onPrinterCall
(
String
response
)
{
}
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/bean/PosMatter.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
pos
.
bean
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
lombok.Data
;
/**
...
...
@@ -9,7 +12,7 @@ import lombok.Data;
* @描述: 事項實體
*/
@Data
public
class
PosMatter
{
public
class
PosMatter
implements
Parcelable
{
private
Long
id
;
/**
...
...
@@ -74,4 +77,59 @@ public class PosMatter {
public
static
final
double
POINTS
=
0.00
;
public
PosMatter
()
{
}
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeValue
(
this
.
id
);
dest
.
writeString
(
this
.
payId
);
dest
.
writeString
(
this
.
refundId
);
dest
.
writeString
(
this
.
deviceId
);
dest
.
writeValue
(
this
.
orderId
);
dest
.
writeValue
(
this
.
businessType
);
dest
.
writeValue
(
this
.
status
);
dest
.
writeValue
(
this
.
tableId
);
dest
.
writeValue
(
this
.
tableExtId
);
dest
.
writeValue
(
this
.
payMethodId
);
dest
.
writeValue
(
this
.
amount
);
dest
.
writeString
(
this
.
content
);
dest
.
writeValue
(
this
.
linePayType
);
dest
.
writeValue
(
this
.
tipsPrice
);
}
protected
PosMatter
(
Parcel
in
)
{
this
.
id
=
(
Long
)
in
.
readValue
(
Long
.
class
.
getClassLoader
());
this
.
payId
=
in
.
readString
();
this
.
refundId
=
in
.
readString
();
this
.
deviceId
=
in
.
readString
();
this
.
orderId
=
(
Long
)
in
.
readValue
(
Long
.
class
.
getClassLoader
());
this
.
businessType
=
(
Byte
)
in
.
readValue
(
Byte
.
class
.
getClassLoader
());
this
.
status
=
(
Byte
)
in
.
readValue
(
Byte
.
class
.
getClassLoader
());
this
.
tableId
=
(
Long
)
in
.
readValue
(
Long
.
class
.
getClassLoader
());
this
.
tableExtId
=
(
Long
)
in
.
readValue
(
Long
.
class
.
getClassLoader
());
this
.
payMethodId
=
(
Long
)
in
.
readValue
(
Long
.
class
.
getClassLoader
());
this
.
amount
=
(
Double
)
in
.
readValue
(
Double
.
class
.
getClassLoader
());
this
.
content
=
in
.
readString
();
this
.
linePayType
=
(
Byte
)
in
.
readValue
(
Byte
.
class
.
getClassLoader
());
this
.
tipsPrice
=
(
Double
)
in
.
readValue
(
Double
.
class
.
getClassLoader
());
}
public
static
final
Creator
<
PosMatter
>
CREATOR
=
new
Creator
<
PosMatter
>()
{
@Override
public
PosMatter
createFromParcel
(
Parcel
source
)
{
return
new
PosMatter
(
source
);
}
@Override
public
PosMatter
[]
newArray
(
int
size
)
{
return
new
PosMatter
[
size
];
}
};
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/fragment/PosActionStatusExceptionFragment.java
0 → 100644
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
pos
.
fragment
;
import
android.content.Intent
;
import
android.graphics.drawable.Drawable
;
import
android.os.Bundle
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.LinearLayout
;
import
android.widget.ProgressBar
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
com.gingersoft.gsa.cloud.common.constans.AppConstans
;
import
com.gingersoft.gsa.cloud.order.R
;
import
com.gingersoft.gsa.cloud.order.R2
;
import
com.gingersoft.gsa.cloud.pay.bean.PosActionStatusExceptionParam
;
import
com.gingersoft.gsa.cloud.pay.pos.OnPosActionListener
;
import
com.gingersoft.gsa.cloud.pay.pos.PosPay
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.RetrievalRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.HywebPosResponse
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.constant.PayStatusCode
;
import
com.jess.arms.base.BaseFragment
;
import
com.jess.arms.di.component.AppComponent
;
import
com.jess.arms.mvp.IView
;
import
com.qmuiteam.qmui.alpha.QMUIAlphaButton
;
import
butterknife.BindView
;
import
butterknife.OnClick
;
/**
* @作者: bin
* @創建時間: 2020-12-30 10:37
* @更新時間: 2020-12-30 10:37
* @描述:支付狀態異常頁面,POS未回調成功的情況下顯示此頁面,重試POS查詢狀態
*/
public
class
PosActionStatusExceptionFragment
extends
BaseFragment
implements
IView
{
@BindView
(
R2
.
id
.
tv_order_num
)
TextView
tvOrderNum
;
@BindView
(
R2
.
id
.
tv_pay_status
)
TextView
tvPayStatus
;
@BindView
(
R2
.
id
.
pro_pay_status
)
ProgressBar
proPayStatus
;
@BindView
(
R2
.
id
.
tv_loading_text
)
TextView
tvLoadingText
;
@BindView
(
R2
.
id
.
tv_amount
)
TextView
tvAmount
;
@BindView
(
R2
.
id
.
tv_paymethod
)
TextView
tvPaymethod
;
@BindView
(
R2
.
id
.
btn_refresh_status
)
QMUIAlphaButton
btnRefreshStatus
;
@BindView
(
R2
.
id
.
btn_back
)
QMUIAlphaButton
btnBack
;
@BindView
(
R2
.
id
.
ll_content
)
LinearLayout
llContent
;
@BindView
(
R2
.
id
.
rl_container
)
RelativeLayout
rlContainer
;
private
PosActionStatusExceptionParam
mPosStatusExceptionParam
;
public
static
PosActionStatusExceptionFragment
newInstance
(
PosActionStatusExceptionParam
posStatusExceptionParam
)
{
Bundle
args
=
new
Bundle
();
PosActionStatusExceptionFragment
fragment
=
new
PosActionStatusExceptionFragment
();
args
.
putParcelable
(
"posStatusExceptionParam"
,
posStatusExceptionParam
);
fragment
.
setArguments
(
args
);
return
fragment
;
}
@Override
public
void
setupFragmentComponent
(
@NonNull
AppComponent
appComponent
)
{
}
@Override
public
View
initView
(
@NonNull
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
return
inflater
.
inflate
(
R
.
layout
.
pay_fragment_pos_status_exception
,
container
,
false
);
}
@Override
public
void
initData
(
@Nullable
Bundle
savedInstanceState
)
{
Bundle
bundle
=
getArguments
();
mPosStatusExceptionParam
=
bundle
.
getParcelable
(
"posStatusExceptionParam"
);
showStatusLoading
();
initPage
();
retrievalStatus
();
}
private
void
initPage
()
{
tvOrderNum
.
setText
(
"單號:"
+
mPosStatusExceptionParam
.
getOrderNum
());
tvAmount
.
setText
(
AppConstans
.
CARSH_STR
+
mPosStatusExceptionParam
.
getAmount
());
tvPaymethod
.
setText
(
mPosStatusExceptionParam
.
getPayMethodName
());
}
private
void
showStatusLoading
()
{
tvPayStatus
.
setVisibility
(
View
.
INVISIBLE
);
proPayStatus
.
setVisibility
(
View
.
VISIBLE
);
tvLoadingText
.
setVisibility
(
View
.
VISIBLE
);
}
private
void
hideStatusLoading
()
{
tvPayStatus
.
setVisibility
(
View
.
VISIBLE
);
proPayStatus
.
setVisibility
(
View
.
INVISIBLE
);
tvLoadingText
.
setVisibility
(
View
.
INVISIBLE
);
}
private
void
retrievalStatus
()
{
RetrievalRequest
retrievalRequest
=
new
RetrievalRequest
();
retrievalRequest
.
setTXN_ID
(
mPosStatusExceptionParam
.
getTxnId
());
PosPay
.
retrieval
(
mContext
,
this
,
retrievalRequest
,
new
OnPosActionListener
()
{
@Override
public
void
onPosSuccess
(
HywebPosResponse
response
)
{
Drawable
drawable
;
if
(
PayStatusCode
.
withSuccess
(
response
.
getSTATUS
()))
{
drawable
=
getResources
().
getDrawable
(
R
.
mipmap
.
pay_status_success
);
drawable
.
setBounds
(
0
,
0
,
drawable
.
getMinimumWidth
(),
drawable
.
getMinimumHeight
());
tvPayStatus
.
setCompoundDrawables
(
null
,
drawable
,
null
,
null
);
tvPayStatus
.
setText
(
PayStatusCode
.
getHywebRequestTextByCode
(
response
.
getSTATUS
()));
}
else
{
drawable
=
getResources
().
getDrawable
(
R
.
mipmap
.
pay_status_exception
);
drawable
.
setBounds
(
0
,
0
,
drawable
.
getMinimumWidth
(),
drawable
.
getMinimumHeight
());
}
tvPayStatus
.
setCompoundDrawables
(
null
,
drawable
,
null
,
null
);
tvPayStatus
.
setText
(
PayStatusCode
.
getHywebRequestTextByCode
(
response
.
getSTATUS
()));
hideStatusLoading
();
}
@Override
public
void
onPosException
(
HywebPosResponse
response
)
{
hideStatusLoading
();
}
@Override
public
void
onSuccess
(
HywebPosResponse
response
)
{
}
@Override
public
void
onError
(
Throwable
e
)
{
hideStatusLoading
();
}
});
}
// private MealOrderPayRequest getMealOrderPayRequest(){
// SaleRequest saleRequest = new SaleRequest();
// saleRequest.setPAYMENT_APP_ID(PayMethodConstant.PAY_TYPE_CC);
// saleRequest.setTXN_AMT(DoshokuOrder.getInstance().getShoppingCart().getTotalAmount());
// saleRequest.setTIPS(0);
//
// GetTxnIdRequest txnIdRequest = new GetTxnIdRequest();
// txnIdRequest.setOrderId(DoshokuOrder.getInstance().getOrderId());
// if (!TextUtils.isEmpty(DoshokuOrder.getInstance().getOpenTableInfo().getTableNumber())) {
// txnIdRequest.setTableExtId(DoshokuOrder.getInstance().getOpenTableInfo().getId());
// } else {
// txnIdRequest.setTableId(DoshokuOrder.getInstance().getOpenTableInfo().getId());
// }
// txnIdRequest.setPayMethodId(hywebPayMethod.getId());
// txnIdRequest.setAmount(hywebPayMethod.getPayMoney());
//
// MealOrderPayRequest orderPayRequest = mPresenter.getOrderPayRequest(gsaPayView);
// List<BillItem> billItemList = DoshokuOrder.getInstance().getShoppingCart().getBillItemList();
// }
@Override
public
void
setData
(
@Nullable
Object
data
)
{
}
@OnClick
({
R2
.
id
.
btn_refresh_status
,
R2
.
id
.
btn_back
})
public
void
onViewClicked
(
View
view
)
{
int
id
=
view
.
getId
();
if
(
id
==
R
.
id
.
btn_back
)
{
killMyself
();
}
else
if
(
id
==
R
.
id
.
btn_refresh_status
)
{
retrievalStatus
();
}
}
@Override
public
void
showLoading
(
String
message
)
{
}
@Override
public
void
hideLoading
()
{
}
@Override
public
void
showMessage
(
@NonNull
String
message
)
{
}
@Override
public
void
launchActivity
(
@NonNull
Intent
intent
)
{
}
@Override
public
void
killMyself
()
{
_mActivity
.
onBackPressed
();
}
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/bg/GetTipTxnIdResponse.java
0 → 100644
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
pos
.
hywebpos
.
bean
.
response
.
bg
;
import
lombok.Getter
;
import
lombok.Setter
;
/**
* @作者: bin
* @創建時間: 2020-12-26 16:46
* @更新時間: 2020-12-26 16:46
* @描述:
*/
@Getter
@Setter
public
class
GetTipTxnIdResponse
{
private
String
tipTxnId
;
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/AdjustTipRespose.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
pos
.
hywebpos
.
bean
.
response
.
pos
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
lombok.Data
;
/**
...
...
@@ -10,7 +13,7 @@ import lombok.Data;
* 描述:
*/
@Data
public
class
AdjustTipRespose
extends
HywebPosResponse
{
public
class
AdjustTipRespose
extends
HywebPosResponse
implements
Parcelable
{
/**
* EVENT_NAME : ADJUST_RESP
...
...
@@ -27,9 +30,45 @@ public class AdjustTipRespose extends HywebPosResponse {
private
String
PAYMENT_TYPE
;
private
String
RESP_CODE
;
private
double
TIPS
;
//
private double TIPS;
private
String
HOST_REF
;
private
String
TXN_TIME
;
private
String
TXN_DATE
;
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
super
.
writeToParcel
(
dest
,
flags
);
dest
.
writeString
(
this
.
PAYMENT_TYPE
);
dest
.
writeString
(
this
.
RESP_CODE
);
dest
.
writeString
(
this
.
HOST_REF
);
dest
.
writeString
(
this
.
TXN_TIME
);
dest
.
writeString
(
this
.
TXN_DATE
);
}
protected
AdjustTipRespose
(
Parcel
in
)
{
super
(
in
);
this
.
PAYMENT_TYPE
=
in
.
readString
();
this
.
RESP_CODE
=
in
.
readString
();
this
.
HOST_REF
=
in
.
readString
();
this
.
TXN_TIME
=
in
.
readString
();
this
.
TXN_DATE
=
in
.
readString
();
}
public
static
final
Creator
<
AdjustTipRespose
>
CREATOR
=
new
Creator
<
AdjustTipRespose
>()
{
@Override
public
AdjustTipRespose
createFromParcel
(
Parcel
source
)
{
return
new
AdjustTipRespose
(
source
);
}
@Override
public
AdjustTipRespose
[]
newArray
(
int
size
)
{
return
new
AdjustTipRespose
[
size
];
}
};
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/HywebPosResponse.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
pos
.
hywebpos
.
bean
.
response
.
pos
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
lombok.Data
;
/**
...
...
@@ -9,11 +12,36 @@ import lombok.Data;
* @描述:
*/
@Data
public
abstract
class
HywebPosRespons
e
{
public
class
HywebPosResponse
implements
Parcelabl
e
{
protected
String
EVENT_NAME
;
protected
String
STATUS
;
protected
String
TXN_ID
;
protected
double
TXN_AMT
;
protected
double
TXN_AMT
=
0.0
;
protected
double
TIPS
=
0.0
;
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeString
(
this
.
EVENT_NAME
);
dest
.
writeString
(
this
.
STATUS
);
dest
.
writeString
(
this
.
TXN_ID
);
dest
.
writeDouble
(
this
.
TXN_AMT
);
dest
.
writeDouble
(
this
.
TIPS
);
}
protected
HywebPosResponse
(
Parcel
in
)
{
this
.
EVENT_NAME
=
in
.
readString
();
this
.
STATUS
=
in
.
readString
();
this
.
TXN_ID
=
in
.
readString
();
this
.
TXN_AMT
=
in
.
readDouble
();
this
.
TIPS
=
in
.
readDouble
();
}
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/RefundRespose.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
pos
.
hywebpos
.
bean
.
response
.
pos
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
lombok.Data
;
/**
...
...
@@ -10,7 +13,7 @@ import lombok.Data;
* 描述:
*/
@Data
public
class
RefundRespose
extends
HywebPosResponse
{
public
class
RefundRespose
extends
HywebPosResponse
implements
Parcelable
{
//N5取消回调数据
private
String
RESP_CODE
;
...
...
@@ -19,4 +22,40 @@ public class RefundRespose extends HywebPosResponse {
private
String
TXN_DATE
;
private
String
HOST_REF
;
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
super
.
writeToParcel
(
dest
,
flags
);
dest
.
writeString
(
this
.
RESP_CODE
);
dest
.
writeString
(
this
.
TRACE_NO
);
dest
.
writeString
(
this
.
TXN_TIME
);
dest
.
writeString
(
this
.
TXN_DATE
);
dest
.
writeString
(
this
.
HOST_REF
);
}
protected
RefundRespose
(
Parcel
in
)
{
super
(
in
);
this
.
RESP_CODE
=
in
.
readString
();
this
.
TRACE_NO
=
in
.
readString
();
this
.
TXN_TIME
=
in
.
readString
();
this
.
TXN_DATE
=
in
.
readString
();
this
.
HOST_REF
=
in
.
readString
();
}
public
static
final
Creator
<
RefundRespose
>
CREATOR
=
new
Creator
<
RefundRespose
>()
{
@Override
public
RefundRespose
createFromParcel
(
Parcel
source
)
{
return
new
RefundRespose
(
source
);
}
@Override
public
RefundRespose
[]
newArray
(
int
size
)
{
return
new
RefundRespose
[
size
];
}
};
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/RetrievalRespose.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
pos
.
hywebpos
.
bean
.
response
.
pos
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
lombok.Data
;
/**
...
...
@@ -10,7 +13,7 @@ import lombok.Data;
* 描述:
*/
@Data
public
class
RetrievalRespose
extends
HywebPosResponse
{
public
class
RetrievalRespose
extends
HywebPosResponse
implements
Parcelable
{
private
String
TXN_TYPE
;
// private String TXN_ID;
...
...
@@ -18,7 +21,7 @@ public class RetrievalRespose extends HywebPosResponse {
//仅当STATUS = 00时才返回以下字段
private
String
TXN_STATUS
;
// private String TXN_AMT ;
private
double
TIPS
;
//
private double TIPS ;
private
String
PAYMENT_TYPE
;
private
String
RESP_CODE
;
private
String
LOYALTY_TYPE
;
...
...
@@ -42,4 +45,75 @@ public class RetrievalRespose extends HywebPosResponse {
private
String
EXPIRY_DATE
;
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
super
.
writeToParcel
(
dest
,
flags
);
dest
.
writeString
(
this
.
TXN_TYPE
);
dest
.
writeString
(
this
.
TXN_STATUS
);
dest
.
writeString
(
this
.
PAYMENT_TYPE
);
dest
.
writeString
(
this
.
RESP_CODE
);
dest
.
writeString
(
this
.
LOYALTY_TYPE
);
dest
.
writeString
(
this
.
CAMPAIGN_ID
);
dest
.
writeString
(
this
.
TRACE_NO
);
dest
.
writeString
(
this
.
TXN_DATE
);
dest
.
writeString
(
this
.
TXN_TIME
);
dest
.
writeString
(
this
.
HOST_REF
);
dest
.
writeString
(
this
.
COUPON_ID
);
dest
.
writeString
(
this
.
AUTH_CODE
);
dest
.
writeInt
(
this
.
TENDER
);
dest
.
writeDouble
(
this
.
AUTH_AMT
);
dest
.
writeDouble
(
this
.
DISCOUNT
);
dest
.
writeString
(
this
.
LOCAL_CUR
);
dest
.
writeString
(
this
.
FOREIGN_CUR
);
dest
.
writeDouble
(
this
.
FXRATE
);
dest
.
writeDouble
(
this
.
FOREIGN_AMT
);
dest
.
writeString
(
this
.
MID
);
dest
.
writeString
(
this
.
TID
);
dest
.
writeString
(
this
.
PAN
);
dest
.
writeString
(
this
.
EXPIRY_DATE
);
}
protected
RetrievalRespose
(
Parcel
in
)
{
super
(
in
);
this
.
TXN_TYPE
=
in
.
readString
();
this
.
TXN_STATUS
=
in
.
readString
();
this
.
PAYMENT_TYPE
=
in
.
readString
();
this
.
RESP_CODE
=
in
.
readString
();
this
.
LOYALTY_TYPE
=
in
.
readString
();
this
.
CAMPAIGN_ID
=
in
.
readString
();
this
.
TRACE_NO
=
in
.
readString
();
this
.
TXN_DATE
=
in
.
readString
();
this
.
TXN_TIME
=
in
.
readString
();
this
.
HOST_REF
=
in
.
readString
();
this
.
COUPON_ID
=
in
.
readString
();
this
.
AUTH_CODE
=
in
.
readString
();
this
.
TENDER
=
in
.
readInt
();
this
.
AUTH_AMT
=
in
.
readDouble
();
this
.
DISCOUNT
=
in
.
readDouble
();
this
.
LOCAL_CUR
=
in
.
readString
();
this
.
FOREIGN_CUR
=
in
.
readString
();
this
.
FXRATE
=
in
.
readDouble
();
this
.
FOREIGN_AMT
=
in
.
readDouble
();
this
.
MID
=
in
.
readString
();
this
.
TID
=
in
.
readString
();
this
.
PAN
=
in
.
readString
();
this
.
EXPIRY_DATE
=
in
.
readString
();
}
public
static
final
Creator
<
RetrievalRespose
>
CREATOR
=
new
Creator
<
RetrievalRespose
>()
{
@Override
public
RetrievalRespose
createFromParcel
(
Parcel
source
)
{
return
new
RetrievalRespose
(
source
);
}
@Override
public
RetrievalRespose
[]
newArray
(
int
size
)
{
return
new
RetrievalRespose
[
size
];
}
};
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/SaleRespose.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
pos
.
hywebpos
.
bean
.
response
.
pos
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
lombok.Data
;
/**
...
...
@@ -10,7 +13,7 @@ import lombok.Data;
* 描述:
*/
@Data
public
class
SaleRespose
extends
HywebPosResponse
{
public
class
SaleRespose
extends
HywebPosResponse
implements
Parcelable
{
//N5支付回调数据
/**
...
...
@@ -36,7 +39,7 @@ public class SaleRespose extends HywebPosResponse {
private
String
PAYMENT_TYPE
;
private
String
PAN
;
private
String
TRACE_NO
;
private
double
TIPS
;
//
private double TIPS;
private
String
RESP_CODE
;
private
String
HOST_REF
;
private
String
TXN_TIME
;
...
...
@@ -47,4 +50,52 @@ public class SaleRespose extends HywebPosResponse {
private
String
TID
;
// private double TXN_AMT;
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
super
.
writeToParcel
(
dest
,
flags
);
dest
.
writeString
(
this
.
MID
);
dest
.
writeString
(
this
.
PAYMENT_TYPE
);
dest
.
writeString
(
this
.
PAN
);
dest
.
writeString
(
this
.
TRACE_NO
);
dest
.
writeString
(
this
.
RESP_CODE
);
dest
.
writeString
(
this
.
HOST_REF
);
dest
.
writeString
(
this
.
TXN_TIME
);
dest
.
writeString
(
this
.
TXN_DATE
);
dest
.
writeString
(
this
.
EXPIRY_DATE
);
dest
.
writeString
(
this
.
AUTH_CODE
);
dest
.
writeString
(
this
.
TID
);
}
protected
SaleRespose
(
Parcel
in
)
{
super
(
in
);
this
.
MID
=
in
.
readString
();
this
.
PAYMENT_TYPE
=
in
.
readString
();
this
.
PAN
=
in
.
readString
();
this
.
TRACE_NO
=
in
.
readString
();
this
.
RESP_CODE
=
in
.
readString
();
this
.
HOST_REF
=
in
.
readString
();
this
.
TXN_TIME
=
in
.
readString
();
this
.
TXN_DATE
=
in
.
readString
();
this
.
EXPIRY_DATE
=
in
.
readString
();
this
.
AUTH_CODE
=
in
.
readString
();
this
.
TID
=
in
.
readString
();
}
public
static
final
Creator
<
SaleRespose
>
CREATOR
=
new
Creator
<
SaleRespose
>()
{
@Override
public
SaleRespose
createFromParcel
(
Parcel
source
)
{
return
new
SaleRespose
(
source
);
}
@Override
public
SaleRespose
[]
newArray
(
int
size
)
{
return
new
SaleRespose
[
size
];
}
};
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/SettlementRespose.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
pos
.
hywebpos
.
bean
.
response
.
pos
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
lombok.Data
;
/**
...
...
@@ -10,7 +13,7 @@ import lombok.Data;
* 描述:
*/
@Data
public
class
SettlementRespose
extends
HywebPosResponse
{
public
class
SettlementRespose
extends
HywebPosResponse
implements
Parcelable
{
/**
* EVENT_NAME : SETTLE_RESP
...
...
@@ -18,4 +21,29 @@ public class SettlementRespose extends HywebPosResponse {
*/
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
super
.
writeToParcel
(
dest
,
flags
);
}
protected
SettlementRespose
(
Parcel
in
)
{
super
(
in
);
}
public
static
final
Creator
<
SettlementRespose
>
CREATOR
=
new
Creator
<
SettlementRespose
>()
{
@Override
public
SettlementRespose
createFromParcel
(
Parcel
source
)
{
return
new
SettlementRespose
(
source
);
}
@Override
public
SettlementRespose
[]
newArray
(
int
size
)
{
return
new
SettlementRespose
[
size
];
}
};
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/VoidRespose.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
pos
.
hywebpos
.
bean
.
response
.
pos
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
lombok.Data
;
/**
...
...
@@ -10,7 +13,7 @@ import lombok.Data;
* 描述:
*/
@Data
public
class
VoidRespose
extends
HywebPosResponse
{
public
class
VoidRespose
extends
HywebPosResponse
implements
Parcelable
{
//N5取消回调数据
// private String TXN_ID;
...
...
@@ -21,4 +24,40 @@ public class VoidRespose extends HywebPosResponse {
private
String
TXN_DATE
;
private
String
HOST_REF
;
@Override
public
int
describeContents
()
{
return
0
;
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
super
.
writeToParcel
(
dest
,
flags
);
dest
.
writeString
(
this
.
RESP_CODE
);
dest
.
writeString
(
this
.
TRACE_NO
);
dest
.
writeString
(
this
.
TXN_TIME
);
dest
.
writeString
(
this
.
TXN_DATE
);
dest
.
writeString
(
this
.
HOST_REF
);
}
protected
VoidRespose
(
Parcel
in
)
{
super
(
in
);
this
.
RESP_CODE
=
in
.
readString
();
this
.
TRACE_NO
=
in
.
readString
();
this
.
TXN_TIME
=
in
.
readString
();
this
.
TXN_DATE
=
in
.
readString
();
this
.
HOST_REF
=
in
.
readString
();
}
public
static
final
Creator
<
VoidRespose
>
CREATOR
=
new
Creator
<
VoidRespose
>()
{
@Override
public
VoidRespose
createFromParcel
(
Parcel
source
)
{
return
new
VoidRespose
(
source
);
}
@Override
public
VoidRespose
[]
newArray
(
int
size
)
{
return
new
VoidRespose
[
size
];
}
};
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/command/CommandImpl.java
View file @
d3cc4b0f
...
...
@@ -92,7 +92,6 @@ public class CommandImpl implements ICommand {
String
eventName
=
msgObj
.
getString
(
Constant
.
EVENT
.
ATTR
.
EVENT_NAME
);
AppManager
appManager
=
ArmsUtils
.
obtainAppComponentFromContext
(
context
).
appManager
();
//kill掉n5頁回到原來的頁面
appManager
.
killActivity
(
CommandActivity
.
class
);
...
...
@@ -104,13 +103,11 @@ public class CommandImpl implements ICommand {
LoganManager
.
w_code
(
TAG
,
"currentActivity : "
+
currentActivity
.
getClass
().
getName
());
HywebPosResponse
posResponse
=
parsePosResponse
(
response
,
eventName
);
if
(
posResponse
==
null
)
{
onActionError
(
new
Exception
(
"回調異常"
+
PayErrorCode
.
pos_response_101
));
}
else
{
/**
* 回調成功
*/
if
(
posResponse
!=
null
)
{
onActionComplte
(
context
,
posResponse
,
currentActivity
);
}
else
{
// onActionError(new Exception("回調異常" + PayErrorCode.pos_response_101));
onActionError
(
new
Exception
(
PayErrorCode
.
pos_response_101
));
}
}
catch
(
JSONException
e
)
{
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/constant/PayStatusCode.java
View file @
d3cc4b0f
package
com
.
gingersoft
.
gsa
.
cloud
.
pay
.
pos
.
hywebpos
.
constant
;
import
android.text.TextUtils
;
/**
* @作者: bin
* @創建時間: 2020-12-24 9:41
...
...
@@ -21,7 +23,7 @@ public class PayStatusCode {
*/
public
static
final
String
PAY_STATUS_00
=
"00"
;
//成功 √
public
static
final
String
PAY_STATUS_02
=
"02"
;
//微信、支付宝正在处理这笔退款请求(可认为已成功) √
public
static
final
String
PAY_STATUS_03
=
"03"
;
//确认/处理 (支付、清機 同步接口防止N5機器關機未收到結果) √
public
static
final
String
PAY_STATUS_09
=
"09"
;
//用户取消 √
public
static
final
String
PAY_STATUS_10
=
"10"
;
//主持人拒绝 √
public
static
final
String
PAY_STATUS_11
=
"11"
;
//用户撤销(应用于仅限微信/支付宝) √
...
...
@@ -31,10 +33,31 @@ public class PayStatusCode {
public
static
final
String
PAY_STATUS_91
=
"91"
;
//功能或 付款方式没有 支持的 √
public
static
final
String
PAY_STATUS_97
=
"97"
;
//N5 POS忙碌 √
public
static
final
String
PAY_STATUS_98
=
"98"
;
//超时 √
/**
* 以下狀態認為是異常情況
*/
public
static
final
String
PAY_STATUS_03
=
"03"
;
//确认/处理 (支付、清機 同步接口防止N5機器關機未收到結果) √
public
static
final
String
PAY_STATUS_99
=
"99"
;
//未知错误 √
public
static
final
String
PAY_STATUS_200
=
"200"
;
//自定義錯誤提示 √
public
static
boolean
withSuccess
(
String
status
)
{
if
(
TextUtils
.
isEmpty
(
status
))
{
return
false
;
}
//這二种狀態都可認為已成功
if
(
status
.
equals
(
PAY_STATUS_00
)
||
status
.
equals
(
PAY_STATUS_02
))
{
return
true
;
}
return
false
;
}
public
static
boolean
withException
(
String
status
)
{
if
(
status
.
equals
(
PAY_STATUS_99
)
||
status
.
equals
(
PAY_STATUS_03
))
{
return
true
;
}
return
false
;
}
public
static
String
getHywebRequestTextByCode
(
String
status
)
{
switch
(
status
)
{
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/RefundActionImpl.java
View file @
d3cc4b0f
...
...
@@ -44,8 +44,8 @@ public class RefundActionImpl extends IPosAction {
private
RefundRequest
mRefundRequest
;
public
RefundActionImpl
(
Context
context
,
IView
iView
,
PosAction
action
,
RefundRequest
refundRequest
,
GetTxnIdRequest
getTxnIdRequest
,
OnPosActionListener
onPosActionListener
,
boolean
showLoading
)
{
super
(
context
,
iView
,
action
,
showLoading
);
public
RefundActionImpl
(
Context
context
,
IView
iView
,
PosAction
action
,
RefundRequest
refundRequest
,
GetTxnIdRequest
getTxnIdRequest
,
OnPosActionListener
onPosActionListener
,
boolean
showLoading
)
{
super
(
context
,
iView
,
action
,
showLoading
);
this
.
mRefundRequest
=
refundRequest
;
this
.
mGetTxnIdRequest
=
getTxnIdRequest
;
this
.
mOnPosActionListener
=
onPosActionListener
;
...
...
@@ -104,24 +104,28 @@ public class RefundActionImpl extends IPosAction {
@Override
public
void
onError
(
Throwable
t
)
{
onActionError
(
new
Exception
(
t
.
getMessage
()));
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onError
(
new
Exception
(
t
.
getMessage
()));
}
}
});
}
/**
* 退款回調成功
* 1、
顯示退款結果
* 2、
更新上傳退款狀態
* 1、
更新上傳退款狀態
* 2、
顯示退款結果
*
* @param context
* @param response
* @param originalActivity
*/
@Override
public
void
onActionComplte
(
Context
context
,
HywebPosResponse
response
,
Activity
originalActivity
)
{
public
void
onActionComplte
(
Context
context
,
HywebPosResponse
response
,
Activity
originalActivity
)
{
showRefundResult
(
context
,
response
,
originalActivity
);
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onPosSuccess
(
response
);
}
//1、更新上傳退款狀態
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"orderPay/add"
,
getPosMatterRequest
((
RefundRespose
)
response
))
...
...
@@ -142,11 +146,16 @@ public class RefundActionImpl extends IPosAction {
@Override
public
void
onNext
(
String
result
)
{
showRefundResult
(
context
,
response
,
originalActivity
);
if
(!
TextUtils
.
isEmpty
(
result
))
{
BaseResult
baseResult
=
GsonUtils
.
GsonToBean
(
result
,
BaseResult
.
class
);
if
(
baseResult
!=
null
)
{
if
(
baseResult
.
isSuccess
()
&&
baseResult
.
getData
()
!=
null
)
{
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onSuccess
(
response
);
}
}
else
{
onActionError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayErrorCode
.
sale_412
));
}
...
...
@@ -160,6 +169,7 @@ public class RefundActionImpl extends IPosAction {
@Override
public
void
onError
(
Throwable
e
)
{
showRefundResult
(
context
,
response
,
originalActivity
);
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onError
(
e
);
}
...
...
@@ -167,9 +177,6 @@ public class RefundActionImpl extends IPosAction {
@Override
public
void
onComplete
()
{
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onSuccess
(
response
);
}
}
});
}
...
...
@@ -182,7 +189,7 @@ public class RefundActionImpl extends IPosAction {
* @param originalActivity
*/
private
void
showRefundResult
(
Context
context
,
HywebPosResponse
response
,
Activity
originalActivity
)
{
if
(
response
.
getSTATUS
().
equals
(
PayStatusCode
.
PAY_STATUS_00
))
{
if
(
PayStatusCode
.
withSuccess
(
response
.
getSTATUS
()
))
{
//退款成功
AppManager
appManager
=
ArmsUtils
.
obtainAppComponentFromContext
(
context
).
appManager
();
Activity
activity
=
appManager
.
getCurrentActivity
();
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/RetrievalActionImpl.java
View file @
d3cc4b0f
...
...
@@ -13,6 +13,7 @@ import com.gingersoft.gsa.cloud.pay.contract.PayErrorCode;
import
com.gingersoft.gsa.cloud.pay.pos.IPosAction
;
import
com.gingersoft.gsa.cloud.pay.pos.OnPosActionListener
;
import
com.gingersoft.gsa.cloud.pay.pos.PosAction
;
import
com.gingersoft.gsa.cloud.pay.pos.bean.PosMatter
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.RetrievalRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.HywebPosResponse
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.RefundRespose
;
...
...
@@ -36,9 +37,11 @@ import okhttp3.RequestBody;
public
class
RetrievalActionImpl
extends
IPosAction
{
private
RetrievalRequest
mRetrievalRequest
;
private
long
mOrderId
;
public
RetrievalActionImpl
(
Context
context
,
IView
iView
,
PosAction
action
,
RetrievalRequest
request
,
OnPosActionListener
onPosActionListener
,
boolean
showLoading
)
{
public
RetrievalActionImpl
(
Context
context
,
IView
iView
,
PosAction
action
,
long
orderId
,
RetrievalRequest
request
,
OnPosActionListener
onPosActionListener
,
boolean
showLoading
)
{
super
(
context
,
iView
,
action
,
showLoading
);
this
.
mOrderId
=
mOrderId
;
this
.
mRetrievalRequest
=
request
;
this
.
mOnPosActionListener
=
onPosActionListener
;
}
...
...
@@ -60,11 +63,15 @@ public class RetrievalActionImpl extends IPosAction {
@Override
public
void
onActionComplte
(
Context
context
,
HywebPosResponse
response
,
Activity
originalActivity
)
{
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onPosSuccess
(
response
);
}
String
url
=
null
;
RequestBody
requestBody
;
switch
(
response
.
getEVENT_NAME
())
{
case
Constant
.
EVENT
.
NAME
.
SALE_RESP
:
// url =
url
=
"posPay/updatePosMatter"
;
requestBody
=
getPosMatterSaleRequest
((
SaleRespose
)
response
);
break
;
case
Constant
.
EVENT
.
NAME
.
REFUND_RESP
:
...
...
@@ -92,7 +99,9 @@ public class RetrievalActionImpl extends IPosAction {
BaseResult
baseResult
=
GsonUtils
.
GsonToBean
(
result
,
BaseResult
.
class
);
if
(
baseResult
!=
null
)
{
if
(
baseResult
.
isSuccess
()
&&
baseResult
.
getData
()
!=
null
)
{
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onSuccess
(
response
);
}
}
else
{
onActionError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayErrorCode
.
sale_412
));
}
...
...
@@ -113,9 +122,6 @@ public class RetrievalActionImpl extends IPosAction {
@Override
public
void
onComplete
()
{
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onSuccess
(
response
);
}
}
});
...
...
@@ -123,9 +129,15 @@ public class RetrievalActionImpl extends IPosAction {
private
RequestBody
getPosMatterSaleRequest
(
SaleRespose
response
)
{
PosMatter
posMatter
=
new
PosMatter
();
posMatter
.
setOrderId
(
mOrderId
);
posMatter
.
setPayId
(
response
.
getTXN_ID
());
posMatter
.
setContent
(
GsonUtils
.
GsonString
(
response
));
posMatter
.
setStatus
(
getPosMatterStatus
(
response
.
getSTATUS
()));
// mMealOrderPayRequest.setPosMatter(posMatter);
RequestBody
requestBody
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json"
),
GsonUtils
.
GsonString
(
response
));
String
json
=
GsonUtils
.
GsonString
(
response
);
RequestBody
requestBody
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json"
),
GsonUtils
.
GsonString
(
posMatter
));
String
json
=
GsonUtils
.
GsonString
(
posMatter
);
return
requestBody
;
}
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/SaleActionImpl.java
View file @
d3cc4b0f
...
...
@@ -12,7 +12,7 @@ import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import
com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils
;
import
com.gingersoft.gsa.cloud.component.ComponentAction
;
import
com.gingersoft.gsa.cloud.component.ComponentName
;
import
com.gingersoft.gsa.cloud.order.bean.event.MealPayResult
Event
;
import
com.gingersoft.gsa.cloud.order.bean.event.MealPayResult
Param
;
import
com.gingersoft.gsa.cloud.order.bean.request.MealOrderPayRequest
;
import
com.gingersoft.gsa.cloud.order.billItem.BillItem
;
import
com.gingersoft.gsa.cloud.pay.bean.PayMethod
;
...
...
@@ -25,15 +25,10 @@ import com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.SaleRequest;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.bg.GetTxnIdResponse
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.HywebPosResponse
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.SaleRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.constant.PayStatusCode
;
import
com.gingersoft.gsa.cloud.pay.widget.StatusLoadingDialog
;
import
com.jess.arms.integration.AppManager
;
import
com.jess.arms.mvp.IView
;
import
com.jess.arms.utils.ArmsUtils
;
import
com.jess.arms.utils.RxLifecycleUtils
;
import
org.simple.eventbus.EventBus
;
import
java.util.List
;
import
io.reactivex.Observer
;
...
...
@@ -118,7 +113,7 @@ public class SaleActionImpl extends IPosAction {
mTxnIdResponse
=
GsonUtils
.
GsonToBean
(
baseResult
.
getData
(),
GetTxnIdResponse
.
class
);
if
(
mSaleRequest
!=
null
)
{
mSaleRequest
.
setTXN_ID
(
mTxnIdResponse
.
getTxnId
());
//調起N5支付
//調起N5支付
936E4F01A0A5473C971503433F78027E
onRequestPOS
(
GsonUtils
.
GsonString
(
mSaleRequest
));
canCelLoadingDialog
();
}
else
{
...
...
@@ -148,8 +143,8 @@ public class SaleActionImpl extends IPosAction {
/**
* 支付回調成功
* 1、
顯示支付結果
* 2、
更新上傳支付狀態
* 1、
更新上傳支付狀態
* 2、
顯示支付結果
* 3、跳轉支付詳情頁
*
* @param context
...
...
@@ -158,6 +153,9 @@ public class SaleActionImpl extends IPosAction {
*/
@Override
public
void
onActionComplte
(
Context
context
,
HywebPosResponse
response
,
Activity
originalActivity
)
{
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onSuccess
(
response
);
}
//1、更新上傳支付狀態
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"orderPay/add"
,
getPosMatterRequest
((
SaleRespose
)
response
))
.
subscribeOn
(
Schedulers
.
io
())
...
...
@@ -184,7 +182,10 @@ public class SaleActionImpl extends IPosAction {
BaseResult
baseResult
=
GsonUtils
.
GsonToBean
(
result
,
BaseResult
.
class
);
if
(
baseResult
!=
null
)
{
if
(
baseResult
.
isSuccess
()
&&
baseResult
.
getData
()
!=
null
)
{
startPayResultActivity
(
response
);
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onSuccess
(
response
);
}
startPayResultActivity
(
context
,
response
);
}
else
{
onActionError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayErrorCode
.
sale_412
));
}
...
...
@@ -199,7 +200,7 @@ public class SaleActionImpl extends IPosAction {
@Override
public
void
onError
(
Throwable
e
)
{
showPayResult
(
context
,
response
,
originalActivity
);
startPayResultActivity
(
response
);
startPayResultActivity
(
context
,
response
);
}
@Override
...
...
@@ -216,17 +217,7 @@ public class SaleActionImpl extends IPosAction {
* @param originalActivity
*/
private
void
showPayResult
(
Context
context
,
HywebPosResponse
response
,
Activity
originalActivity
)
{
if
(
response
.
getSTATUS
().
equals
(
PayStatusCode
.
PAY_STATUS_00
))
{
//支付成功
AppManager
appManager
=
ArmsUtils
.
obtainAppComponentFromContext
(
context
).
appManager
();
Activity
activity
=
appManager
.
getCurrentActivity
();
if
(
activity
.
getClass
().
equals
(
originalActivity
.
getClass
()))
{
super
.
onActionComplte
(
context
,
response
,
originalActivity
);
}
}
else
{
//支付失敗
onActionError
(
new
Exception
(
mPosAction
.
getActionName
()
+
PayStatusCode
.
getHywebRequestTextByCode
(
response
.
getSTATUS
())
+
PayErrorCode
.
tips_710
));
}
super
.
onActionComplte
(
context
,
response
,
originalActivity
);
}
/**
...
...
@@ -234,19 +225,27 @@ public class SaleActionImpl extends IPosAction {
*
* @param response
*/
private
void
startPayResultActivity
(
HywebPosResponse
response
)
{
private
void
startPayResultActivity
(
Context
context
,
HywebPosResponse
response
)
{
MealPayResultParam
payResultParam
=
new
MealPayResultParam
();
payResultParam
.
setTxnId
(
mTxnIdResponse
.
getTxnId
());
payResultParam
.
setTableBean
(
mTableBean
);
payResultParam
.
setMealOrderPayRequest
(
mMealOrderPayRequest
);
payResultParam
.
setBillItemList
(
mBillItemList
);
payResultParam
.
setPayMethodList
(
mPayMethodList
);
payResultParam
.
setSaleRespose
((
SaleRespose
)
response
);
//kill orderPayActivity,orderContentActivity,mealActivity
CC
.
obtainBuilder
(
ComponentName
.
COMPONENT_TABLE
)
.
setActionName
(
ComponentAction
.
Table
.
KILL_MEAL_ORDER_PAY
)
.
build
()
.
call
();
CC
.
obtainBuilder
(
ComponentName
.
COMPONENT_PAY
)
.
setActionName
(
ComponentAction
.
Pay
.
OPEN_PAY_RESULT
)
.
addParam
(
"payResultParam"
,
payResultParam
)
.
build
()
.
call
();
MealPayResultEvent
payResultEvent
=
new
MealPayResultEvent
();
payResultEvent
.
setTxnId
(
mTxnIdResponse
.
getTxnId
());
payResultEvent
.
setTableBean
(
mTableBean
);
payResultEvent
.
setMealOrderPayRequest
(
mMealOrderPayRequest
);
payResultEvent
.
setBillItemList
(
mBillItemList
);
payResultEvent
.
setPayMethodList
(
mPayMethodList
);
payResultEvent
.
setSaleRespose
((
SaleRespose
)
response
);
EventBus
.
getDefault
().
post
(
payResultEvent
,
"onIntentPayStatusSuccess"
);
}
private
RequestBody
getPosMatterRequest
(
SaleRespose
response
)
{
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/TipsActionImpl.java
View file @
d3cc4b0f
...
...
@@ -15,7 +15,7 @@ import com.gingersoft.gsa.cloud.pay.pos.PosAction;
import
com.gingersoft.gsa.cloud.pay.pos.bean.PosMatter
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.bg.GetTxnIdRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.AdjustTipRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.bg.GetTxnIdResponse
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.bg.GetT
ipT
xnIdResponse
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.AdjustTipRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.HywebPosResponse
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.constant.PayStatusCode
;
...
...
@@ -43,7 +43,7 @@ public class TipsActionImpl extends IPosAction {
private
AdjustTipRequest
mAdjustTipRequest
;
private
GetTxnIdRequest
mTxnIdRequest
;
private
GetTxnIdResponse
mTxnIdResponse
;
private
GetT
ipT
xnIdResponse
mTxnIdResponse
;
private
OnPosActionListener
mOnPosActionListener
;
...
...
@@ -56,7 +56,11 @@ public class TipsActionImpl extends IPosAction {
@Override
protected
void
onRequestBefore
()
{
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"posPay/getTipTxnId"
,
null
)
RequestBody
requestBody
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json"
),
GsonUtils
.
GsonString
(
mTxnIdRequest
));
String
json
=
GsonUtils
.
GsonString
(
mTxnIdRequest
);
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"posPay/getTipTxnId"
,
requestBody
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
Schedulers
.
io
())
.
doOnSubscribe
(
disposable
->
{
...
...
@@ -77,9 +81,9 @@ public class TipsActionImpl extends IPosAction {
BaseResult
baseResult
=
GsonUtils
.
GsonToBean
(
result
,
BaseResult
.
class
);
if
(
baseResult
!=
null
)
{
if
(
baseResult
.
isSuccess
()
&&
baseResult
.
getData
()
!=
null
)
{
mTxnIdResponse
=
GsonUtils
.
GsonToBean
(
baseResult
.
getData
(),
GetTxnIdResponse
.
class
);
mTxnIdResponse
=
GsonUtils
.
GsonToBean
(
baseResult
.
getData
(),
GetT
ipT
xnIdResponse
.
class
);
if
(
mAdjustTipRequest
!=
null
)
{
mAdjustTipRequest
.
setTXN_ID
(
mTxnIdResponse
.
getTxnId
());
mAdjustTipRequest
.
setTXN_ID
(
mTxnIdResponse
.
getT
ipT
xnId
());
//調起N5補小費
onRequestPOS
(
GsonUtils
.
GsonString
(
mAdjustTipRequest
));
canCelLoadingDialog
();
...
...
@@ -87,7 +91,11 @@ public class TipsActionImpl extends IPosAction {
onActionError
(
new
Exception
(
error
+
PayErrorCode
.
tips_701
));
}
}
else
{
onActionError
(
new
Exception
(
error
+
PayErrorCode
.
tips_702
));
if
(!
TextUtils
.
isEmpty
(
baseResult
.
getErrMsg
()))
{
onActionError
(
new
Exception
(
baseResult
.
getErrMsg
()));
}
else
{
onActionError
(
new
Exception
(
error
+
PayErrorCode
.
tips_702
));
}
}
}
else
{
onActionError
(
new
Exception
(
error
+
PayErrorCode
.
tips_703
));
...
...
@@ -110,8 +118,8 @@ public class TipsActionImpl extends IPosAction {
/**
* 補小費回調成功
* 1、
顯示小費結果
* 2、
更新上傳小費狀態
* 1、
更新上傳小費狀態
* 2、
顯示小費結果
* 3、刷新當前頁面
*
* @param context
...
...
@@ -121,10 +129,11 @@ public class TipsActionImpl extends IPosAction {
@Override
public
void
onActionComplte
(
Context
context
,
HywebPosResponse
response
,
Activity
originalActivity
)
{
//1、顯示小費結果
showTipsResult
(
context
,
response
,
originalActivity
);
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onPosSuccess
(
response
);
}
//
2
、更新上傳小費狀態
//
1
、更新上傳小費狀態
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"orderPay/updatePosTip"
,
getPosMatterRequest
((
AdjustTipRespose
)
response
))
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
Schedulers
.
io
())
...
...
@@ -137,31 +146,37 @@ public class TipsActionImpl extends IPosAction {
})
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mView
))
.
subscribe
(
new
Observer
<
String
>()
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
}
@Override
public
void
onNext
(
String
result
)
{
showTipsResult
(
context
,
response
,
originalActivity
);
if
(!
TextUtils
.
isEmpty
(
result
))
{
BaseResult
baseResult
=
GsonUtils
.
GsonToBean
(
result
,
BaseResult
.
class
);
if
(
baseResult
!=
null
)
{
if
(
baseResult
.
isSuccess
()
&&
baseResult
.
getData
()
!=
null
)
{
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onSuccess
(
response
);
}
}
else
{
//
onActionError(new Exception(mPosAction.getCallbackExceptionText() + PayErrorCode.tips_711));
onActionError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayErrorCode
.
tips_711
));
}
}
else
{
//
onActionError(new Exception(mPosAction.getCallbackExceptionText() + PayErrorCode.tips_712));
onActionError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayErrorCode
.
tips_712
));
}
}
else
{
//
onActionError(new Exception(mPosAction.getCallbackExceptionText() + PayErrorCode.tips_713));
onActionError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayErrorCode
.
tips_713
));
}
}
@Override
public
void
onError
(
Throwable
e
)
{
showTipsResult
(
context
,
response
,
originalActivity
);
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onError
(
e
);
}
...
...
@@ -169,22 +184,19 @@ public class TipsActionImpl extends IPosAction {
@Override
public
void
onComplete
()
{
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onSuccess
(
response
);
}
}
});
}
/**
*
1
、顯示小費結果
*
2
、顯示小費結果
*
* @param context
* @param response
* @param originalActivity
*/
private
void
showTipsResult
(
Context
context
,
HywebPosResponse
response
,
Activity
originalActivity
)
{
if
(
response
.
getSTATUS
().
equals
(
PayStatusCode
.
PAY_STATUS_00
))
{
if
(
PayStatusCode
.
withSuccess
(
response
.
getSTATUS
()
))
{
//補小費成功
AppManager
appManager
=
ArmsUtils
.
obtainAppComponentFromContext
(
context
).
appManager
();
Activity
activity
=
appManager
.
getCurrentActivity
();
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/VoidActionImpl.java
View file @
d3cc4b0f
...
...
@@ -55,7 +55,11 @@ public class VoidActionImpl extends IPosAction {
@Override
protected
void
onRequestBefore
()
{
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"posPay/getRefundTxnId"
,
null
)
RequestBody
requestBody
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json"
),
GsonUtils
.
GsonString
(
mTxnIdRequest
));
String
json
=
GsonUtils
.
GsonString
(
mTxnIdRequest
);
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"posPay/getCancelTxnId"
,
requestBody
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
Schedulers
.
io
())
.
doOnSubscribe
(
disposable
->
{
...
...
@@ -109,8 +113,9 @@ public class VoidActionImpl extends IPosAction {
/**
* 取消回調成功
* 1、顯示取消結果
* 2、更新上傳取消狀態
*
* 1、更新上傳取消狀態
* 2、顯示取消結果
* 3、刷新當前頁面
*
* @param context
...
...
@@ -120,10 +125,11 @@ public class VoidActionImpl extends IPosAction {
@Override
public
void
onActionComplte
(
Context
context
,
HywebPosResponse
response
,
Activity
originalActivity
)
{
//1、顯示取消結果
showVoidResult
(
context
,
response
,
originalActivity
);
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onPosSuccess
(
response
);
}
//
2
、更新上傳取消狀態
//
1
、更新上傳取消狀態
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"orderPay/updatePosCancel"
,
getPosMatterRequest
((
VoidRespose
)
response
))
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
Schedulers
.
io
())
...
...
@@ -142,11 +148,16 @@ public class VoidActionImpl extends IPosAction {
@Override
public
void
onNext
(
String
result
)
{
showVoidResult
(
context
,
response
,
originalActivity
);
if
(!
TextUtils
.
isEmpty
(
result
))
{
BaseResult
baseResult
=
GsonUtils
.
GsonToBean
(
result
,
BaseResult
.
class
);
if
(
baseResult
!=
null
)
{
if
(
baseResult
.
isSuccess
()
&&
baseResult
.
getData
()
!=
null
)
{
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onSuccess
(
response
);
}
}
else
{
// onActionError(new Exception(mPosAction.getCallbackExceptionText() + PayErrorCode.tips_711));
}
...
...
@@ -160,6 +171,7 @@ public class VoidActionImpl extends IPosAction {
@Override
public
void
onError
(
Throwable
e
)
{
showVoidResult
(
context
,
response
,
originalActivity
);
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onError
(
e
);
}
...
...
@@ -175,14 +187,14 @@ public class VoidActionImpl extends IPosAction {
}
/**
*
1
、顯示小費結果
*
2
、顯示小費結果
*
* @param context
* @param response
* @param originalActivity
*/
private
void
showVoidResult
(
Context
context
,
HywebPosResponse
response
,
Activity
originalActivity
)
{
if
(
response
.
getSTATUS
().
equals
(
PayStatusCode
.
PAY_STATUS_00
))
{
if
(
PayStatusCode
.
withSuccess
(
response
.
getSTATUS
()
))
{
//補小費成功
AppManager
appManager
=
ArmsUtils
.
obtainAppComponentFromContext
(
context
).
appManager
();
Activity
activity
=
appManager
.
getCurrentActivity
();
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/view/customstatus/CustomStatusView.java
View file @
d3cc4b0f
...
...
@@ -12,7 +12,7 @@ import android.graphics.RectF;
import
android.util.AttributeSet
;
import
android.view.View
;
import
androidx.core.content.ContextCompat
;
import
com.gingersoft.
runtime.pay_module
.R
;
import
com.gingersoft.
gsa.cloud.order
.R
;
/**
*
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/widget/StatusLoadingDialog.java
View file @
d3cc4b0f
...
...
@@ -7,9 +7,8 @@ import android.view.View;
import
android.widget.FrameLayout
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.gingersoft.gsa.cloud.order.R
;
import
com.gingersoft.gsa.cloud.pay.view.customstatus.CustomStatusView
;
import
com.gingersoft.runtime.pay_module.R
;
import
com.jess.arms.utils.ArmsUtils
;
...
...
@@ -22,7 +21,7 @@ public class StatusLoadingDialog {
private
CustomStatusView
as_status
;
private
TextView
tv_status
;
private
long
mCancelDelayMillis
=
10
00
;
private
long
mCancelDelayMillis
=
15
00
;
private
String
mLoadingText
;
public
StatusLoadingDialog
(
Context
context
,
String
loadingText
,
long
cancelDelayMillis
)
{
...
...
@@ -53,7 +52,6 @@ public class StatusLoadingDialog {
}
public
void
loadSuccess
()
{
setStatusText
(
mLoadingText
+
"成功"
);
as_status
.
loadSuccess
();
as_status
.
postDelayed
(
new
Runnable
()
{
@Override
...
...
library-order/src/main/res/layout/pay_fragment_pos_status_exception.xml
0 → 100644
View file @
d3cc4b0f
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/rl_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/theme_white_color"
android:orientation=
"vertical"
>
<LinearLayout
android:id=
"@+id/ll_content"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/tv_order_num"
android:layout_width=
"wrap_content"
android:layout_height=
"@dimen/dp_60"
android:gravity=
"center"
android:text=
"單號:123571416"
android:textColor=
"@color/theme_black"
android:textSize=
"@dimen/font_normal3"
/>
<FrameLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_50"
>
<TextView
android:id=
"@+id/tv_pay_status"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:drawablePadding=
"@dimen/dp_6"
android:drawableTop=
"@mipmap/pay_status_exception"
android:text=
"支付失敗"
android:textSize=
"@dimen/font_normal2"
android:textColor=
"@color/theme_black"
/>
<ProgressBar
android:id=
"@+id/pro_pay_status"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:theme=
"@style/AppTheme"
android:visibility=
"invisible"
/>
<TextView
android:id=
"@+id/tv_loading_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/theme_black"
android:textSize=
"@dimen/font_normal"
android:text=
"@string/loading"
android:visibility=
"invisible"
android:layout_gravity=
"center_horizontal|bottom"
/>
</FrameLayout>
<TextView
android:id=
"@+id/tv_amount"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:text=
"$500"
android:textColor=
"@color/theme_black"
android:textSize=
"@dimen/sp_32"
/>
<TextView
android:id=
"@+id/tv_paymethod"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_50"
android:gravity=
"center"
android:textColor=
"@color/black"
android:textSize=
"@dimen/font_normal3"
android:text=
"微信,支付寶"
/>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id=
"@+id/btn_refresh_status"
android:layout_width=
"@dimen/dp_100"
android:layout_height=
"@dimen/dp_40"
android:gravity=
"center"
android:layout_marginTop=
"@dimen/dp_50"
android:background=
"@color/theme_color"
android:text=
"刷新"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/font_normal2"
app:cornerRadius=
"@dimen/dp_6"
/>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id=
"@+id/btn_back"
android:layout_width=
"@dimen/dp_100"
android:layout_height=
"@dimen/dp_40"
android:gravity=
"center"
android:layout_marginTop=
"@dimen/dp_20"
android:background=
"@color/theme_grey_color"
android:text=
"返回"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/font_normal2"
app:cornerRadius=
"@dimen/dp_6"
/>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
library-order/src/main/res/mipmap-xhdpi/pay_status_exception.png
0 → 100644
View file @
d3cc4b0f
8.82 KB
library-order/src/main/res/mipmap-xhdpi/pay_status_success.png
0 → 100644
View file @
d3cc4b0f
8.71 KB
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