Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c266677e7 | ||
|
|
063dfae87f | ||
|
|
9502ee7a04 | ||
|
|
5509bf4349 | ||
| 476e1d9eaa | |||
| 28d4672878 | |||
|
|
644df8211d | ||
|
|
2358782f3d | ||
|
|
f142df0144 | ||
|
|
efb0c76f69 | ||
|
|
d861c278a2 |
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="17" />
|
||||
<bytecodeTargetLevel target="21" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/copilot.data.migration.agent.xml
Normal file
6
.idea/copilot.data.migration.agent.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AgentMigrationStateService">
|
||||
<option name="migrationStatus" value="COMPLETED" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/copilot.data.migration.ask.xml
Normal file
6
.idea/copilot.data.migration.ask.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AskMigrationStateService">
|
||||
<option name="migrationStatus" value="COMPLETED" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/copilot.data.migration.ask2agent.xml
Normal file
6
.idea/copilot.data.migration.ask2agent.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Ask2AgentMigrationStateService">
|
||||
<option name="migrationStatus" value="COMPLETED" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/copilot.data.migration.edit.xml
Normal file
6
.idea/copilot.data.migration.edit.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EditMigrationStateService">
|
||||
<option name="migrationStatus" value="COMPLETED" />
|
||||
</component>
|
||||
</project>
|
||||
@ -4,14 +4,6 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2025-10-28T19:40:02.148831Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=0123456789ABCDEF" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
<DialogSelection />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="temurin-17" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
||||
@ -1,9 +1,4 @@
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="temurin-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
@ -14,8 +14,8 @@ android {
|
||||
applicationId "com.utsmm.kbz"
|
||||
minSdk 24
|
||||
targetSdk 33
|
||||
versionCode 5
|
||||
versionName "1.05"
|
||||
versionCode 7
|
||||
versionName "1.07"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@ -90,7 +90,6 @@ dependencies {
|
||||
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
|
||||
|
||||
|
||||
|
||||
def nav_version = "2.3.2"
|
||||
def lottieVersion = "3.5.0"
|
||||
def fragment_version = "1.2.0"
|
||||
|
||||
@ -46,8 +46,7 @@
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
>
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<!-- android:manageSpaceActivity="com.utsmyanmar.upos.config.UTSManageSpaceActivity"-->
|
||||
<!-- <activity-->
|
||||
<!-- android:screenOrientation="portrait"-->
|
||||
|
||||
@ -292,7 +292,7 @@ public class MainFragment extends DataBindingFragment {
|
||||
|
||||
private void updateButtonStatus() {
|
||||
mainViewModel.settlementStatus.setValue(SystemParamsOperation.getInstance().getSettlementStatus());
|
||||
mainViewModel.kPayStatus.setValue(SystemParamsOperation.getInstance().getWavePayStatus());
|
||||
mainViewModel.kPayStatus.setValue(SystemParamsOperation.getInstance().getQRPayStatus());
|
||||
}
|
||||
|
||||
private void setUpCarouselImages() {
|
||||
@ -849,6 +849,12 @@ public class MainFragment extends DataBindingFragment {
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickQR(){
|
||||
// navigate to new QR Pay fragment
|
||||
routeId = R.id.action_nav_main_to_qrFragment;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
|
||||
public void onClickQRPay() {
|
||||
|
||||
String mmqrIp = SystemParamsOperation.getInstance().getSecHostIpAddress();
|
||||
|
||||
@ -94,7 +94,7 @@ public class MainViewModel extends ViewModel {
|
||||
|
||||
settlementStatus.setValue(SystemParamsOperation.getInstance().getSettlementStatus());
|
||||
|
||||
kPayStatus.setValue(SystemParamsOperation.getInstance().getWavePayStatus());
|
||||
kPayStatus.setValue(SystemParamsOperation.getInstance().getQRPayStatus());
|
||||
|
||||
disabledMsg.setValue(SystemParamsOperation.getInstance().getDisabledMsg());
|
||||
}
|
||||
|
||||
@ -5,5 +5,6 @@ public enum CardTransactionType {
|
||||
MPU,
|
||||
EMV,
|
||||
MAG,
|
||||
FALLBACK
|
||||
FALLBACK,
|
||||
MOCK
|
||||
}
|
||||
|
||||
@ -0,0 +1,68 @@
|
||||
package com.utsmm.kbz.ui.adapters;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.utsmm.kbz.R;
|
||||
import com.utsmm.kbz.databinding.ItemQrPayButtonBinding;
|
||||
import com.utsmm.kbz.ui.qr_pay.QRPayItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class QRPayAdapter extends RecyclerView.Adapter<QRPayAdapter.ViewHolder> {
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void onItemClick(int position);
|
||||
}
|
||||
|
||||
private final List<QRPayItem> items;
|
||||
private final OnItemClickListener listener;
|
||||
|
||||
public QRPayAdapter(List<QRPayItem> item, OnItemClickListener listener) {
|
||||
this.items = item;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
ItemQrPayButtonBinding binding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(parent.getContext()),
|
||||
R.layout.item_qr_pay_button,
|
||||
parent,
|
||||
false
|
||||
);
|
||||
return new ViewHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
QRPayItem item = items.get(position);
|
||||
holder.binding.setText(item.title);
|
||||
holder.binding.setIcon(item.icon);
|
||||
holder.binding.btnItem.setOnClickListener(v -> {
|
||||
if(listener != null){
|
||||
listener.onItemClick(position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return items == null ? 0 : items.size();
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
final ItemQrPayButtonBinding binding;
|
||||
public ViewHolder(@NonNull ItemQrPayButtonBinding binding) {
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,11 +106,15 @@ public class CardWaitingFragment extends DataBindingFragment implements DataBind
|
||||
|
||||
public void onClickManualEntry() {
|
||||
|
||||
// showSingleInfoDialogAutoHide("Coming Soon!");
|
||||
|
||||
routeId = R.id.action_cardWaitingFragment_to_manualEntryFragment;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
|
||||
public void onClickTap() {
|
||||
cardReadViewModel.setCardTransactionType(CardTransactionType.MOCK);
|
||||
routeId = R.id.action_cardWaitingFragment_to_processingCardFragment;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -142,6 +142,10 @@ public class InputPasswordFragment extends DataBindingFragment implements DataBi
|
||||
|
||||
private void checkRoute() {
|
||||
switch (Objects.requireNonNull(sharedViewModel.transactionsType.getValue())) {
|
||||
case MMQR_REFUND:
|
||||
inputPasswordViewModel.passwordType.setValue(InputPasswordType.SYSTEM);
|
||||
routeId = R.id.action_inputPasswordFragment_to_QRRefundProcessFragment;
|
||||
break;
|
||||
case PRE_AUTH_COMPLETE_VOID:
|
||||
inputPasswordViewModel.passwordType.setValue(InputPasswordType.SYSTEM);
|
||||
sharedViewModel.transactionName.postValue(getResourceString(R.string.title_pre_auth_complete));
|
||||
|
||||
@ -7,6 +7,7 @@ import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.utsmm.kbz.util.MockData;
|
||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||
import com.utsmyanmar.checkxread.model.CardDataX;
|
||||
@ -41,6 +42,8 @@ public class ProcessingCardFragment extends DataBindingFragment {
|
||||
private TransProcessViewModel transProcessViewModel;
|
||||
private PinPadViewModel pinPadViewModel;
|
||||
private EmvTransactionProcessViewModel emvTransactionViewModel;
|
||||
|
||||
|
||||
private int routeId;
|
||||
|
||||
@Override
|
||||
@ -102,9 +105,24 @@ public class ProcessingCardFragment extends DataBindingFragment {
|
||||
break;
|
||||
case MAG: readMAGStripe(false,true);
|
||||
break;
|
||||
case MOCK: mockMPUCard();
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void mockMPUCard() {
|
||||
LogUtil.d(TAG,"initialize mock card data...");
|
||||
routeId = R.id.action_processingCardFragment_to_pinPadFragment;
|
||||
transProcessViewModel.transType.postValue(sharedViewModel.transactionsType.getValue());
|
||||
pinPadViewModel.transType.postValue(sharedViewModel.transactionsType.getValue());
|
||||
|
||||
CardDataX cardDataX = MockData.getInstance().generateMPUCard();
|
||||
|
||||
TradeData tradeData = TransactionUtil.getInstance().initMPUTransaction(cardDataX, CardTypeX.IC);
|
||||
transProcessViewModel.setTradeData(tradeData);
|
||||
pinPadViewModel.setTradeData(tradeData);
|
||||
sharedViewModel.setCardDataExist(true);
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
|
||||
private void readMPUCard() {
|
||||
cardReadViewModel.startReadXProcess(MPUXReadCard.getInstance(), new ReadCardResultX() {
|
||||
|
||||
@ -42,12 +42,13 @@ import java.io.IOException;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.hilt.android.AndroidEntryPoint;
|
||||
import retrofit2.HttpException;
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
|
||||
|
||||
// Temporarily disabled Hilt
|
||||
// @AndroidEntryPoint
|
||||
@AndroidEntryPoint
|
||||
public class TransactionResultFragment extends DataBindingFragment implements DataBindingFragment.BackPressCallback {
|
||||
|
||||
private static final String TAG = TransactionResultFragment.class.getSimpleName();
|
||||
|
||||
@ -25,6 +25,8 @@ import java.util.HashSet;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import io.reactivex.rxjava3.core.Single;
|
||||
|
||||
|
||||
public class CardReadViewModel extends ViewModel {
|
||||
|
||||
@ -46,7 +48,6 @@ public class CardReadViewModel extends ViewModel {
|
||||
public SingleLiveEvent<Integer> cardTypeData = new SingleLiveEvent<>();
|
||||
public SingleLiveEvent<PayDetail> payDetail = new SingleLiveEvent<>();
|
||||
|
||||
public SingleLiveEvent<CardReadStatus> readStatus = new SingleLiveEvent<>();
|
||||
|
||||
public SingleLiveEvent<String> checkCardAlertMsg = new SingleLiveEvent<>();
|
||||
|
||||
@ -95,96 +96,6 @@ public class CardReadViewModel extends ViewModel {
|
||||
checkCardAlertMsg.setValue(null);
|
||||
}
|
||||
|
||||
// public void initCardReadProcess(int allType, int timeOutInSec, ReadCardResult readCardResult) {
|
||||
// ReadCardProcess.getInstance().startReadCard(allType,"",timeOutInSec,false).onStartReadCardProcess(new CheckCardListener() {
|
||||
// @Override
|
||||
// public void onCheckCardSuccess(int cardType, MPUCardData mpuCardData, CardScheme cardScheme) {
|
||||
//
|
||||
// cardData.postValue(mpuCardData);
|
||||
// cardSchemeData.postValue(cardScheme);
|
||||
// cardTypeData.postValue(cardType);
|
||||
// PayDetail payDetailData = new PayDetail();
|
||||
// payDetailData.setCardNo(mpuCardData.getPan());
|
||||
// payDetailData.setEXPDate(mpuCardData.getExp());
|
||||
// payDetailData.setAccountType(cardScheme.name());
|
||||
// payDetailData.setCardType(cardType);
|
||||
// payDetailData.setCardHolderName(mpuCardData.getCardHolderName());
|
||||
// CardInfo cardInfo = new CardInfo();
|
||||
// MAGCardInfo magCardInfo = new MAGCardInfo();
|
||||
// LogUtil.d(TAG,"track 2 : "+mpuCardData.getTrack2());
|
||||
// magCardInfo.setTrack2Cipher(mpuCardData.getTrack2());
|
||||
// cardInfo.setMAGCardInfo(magCardInfo);
|
||||
// payDetailData.setCardInfo(cardInfo);
|
||||
//
|
||||
// payDetail.postValue(payDetailData);
|
||||
//
|
||||
// mainThreadHandler.post(readCardResult::onSuccess);
|
||||
//// readCardResult.onSuccess();
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCheckCardFail(int code, String message) {
|
||||
//
|
||||
// if(code == -2801) {
|
||||
// mainThreadHandler.post(readCardResult::onCommunicationError);
|
||||
//// readCardResult.onCommunicationError();
|
||||
// } else {
|
||||
// mainThreadHandler.post(() -> readCardResult.onError(code,message));
|
||||
//// readCardResult.onError(code,message);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// public SingleLiveEvent<CardReadStatus> startReadProcess(int allType,int timeOutInSec){
|
||||
//
|
||||
// ReadCardProcess.getInstance().startReadCard(allType,"",timeOutInSec,false).onStartReadCardProcess(new CheckCardListener() {
|
||||
// @Override
|
||||
// public void onCheckCardSuccess(int cardType, MPUCardData mpuCardData, CardScheme cardScheme) {
|
||||
// flag.postValue(true);
|
||||
// cardData.postValue(mpuCardData);
|
||||
// cardSchemeData.postValue(cardScheme);
|
||||
// cardTypeData.postValue(cardType);
|
||||
// PayDetail payDetailData = new PayDetail();
|
||||
// payDetailData.setCardNo(mpuCardData.getPan());
|
||||
// payDetailData.setEXPDate(mpuCardData.getExp());
|
||||
// payDetailData.setAccountType(cardScheme.name());
|
||||
// payDetailData.setCardType(cardType);
|
||||
// payDetailData.setCardHolderName(mpuCardData.getCardHolderName());
|
||||
// CardInfo cardInfo = new CardInfo();
|
||||
// MAGCardInfo magCardInfo = new MAGCardInfo();
|
||||
// LogUtil.d(TAG,"track 2 : "+mpuCardData.getTrack2());
|
||||
// magCardInfo.setTrack2Cipher(mpuCardData.getTrack2());
|
||||
// cardInfo.setMAGCardInfo(magCardInfo);
|
||||
// payDetailData.setCardInfo(cardInfo);
|
||||
//
|
||||
// payDetail.postValue(payDetailData);
|
||||
//
|
||||
// readStatus.postValue(CardReadStatus.SUCCESS);
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCheckCardFail(int code, String message) {
|
||||
//
|
||||
// readStatus.postValue(CardReadStatus.FAIL);
|
||||
// // this action just need to do once because there's too many reason to get fail
|
||||
// if(!oneTimeFlag){
|
||||
// errorCode.postValue(code+":"+message);
|
||||
// flag.postValue(false);
|
||||
// cardSchemeData.postValue(CardScheme.UNK);
|
||||
// oneTimeFlag = true;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// return readStatus;
|
||||
// }
|
||||
|
||||
public void resetOneTimeFlag(){
|
||||
oneTimeFlag = false;
|
||||
}
|
||||
@ -193,19 +104,4 @@ public class CardReadViewModel extends ViewModel {
|
||||
NexGoSDK.getInstance().cancelCheckCard();
|
||||
}
|
||||
|
||||
// public void checkCard(){
|
||||
// int allType = AidlConstants.CardType.NFC.getValue() | AidlConstants.CardType.IC.getValue() | AidlConstants.CardType.MAGNETIC.getValue();
|
||||
// ReadCardProcess.getInstance().startReadCard(allType,"",60,false).onStartReadCardProcess(new CheckCardListener() {
|
||||
// @Override
|
||||
// public void onCheckCardSuccess(int cardType, MPUCardData mpuCardData, CardScheme cardScheme) {
|
||||
// System.out.println("Success");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCheckCardFail(int code, String message) {
|
||||
//
|
||||
// System.out.println("Failed");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
@ -492,9 +492,9 @@ public class EmvTransactionProcessViewModel extends EmvBaseViewModel implements
|
||||
private void handleTransactionProcess() {
|
||||
|
||||
String cardNo = mPayDetail.getCardNo();
|
||||
if (cardNo == null || TextUtils.equals(cardNo, "")) {
|
||||
// if (cardNo == null || TextUtils.equals(cardNo, "")) {
|
||||
getCardInfo();
|
||||
}
|
||||
// }
|
||||
getPayWaveData();
|
||||
getF055Data();
|
||||
if(transType.getValue() == TransactionsType.PRE_AUTH_COMPLETE || transType.getValue() == TransactionsType.PRE_AUTH_VOID || transType.getValue() == TransactionsType.REFUND ) {
|
||||
|
||||
@ -36,6 +36,7 @@ import com.utsmyanmar.paylibs.model.TradeData;
|
||||
import com.utsmyanmar.paylibs.system.SingleLiveEvent;
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsSettings;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.HashMap;
|
||||
@ -52,7 +53,11 @@ public class KPayViewModel extends ViewModel {
|
||||
|
||||
private final Repository repository;
|
||||
|
||||
private final String appKey = "UTSMMuat@2025";
|
||||
private final String appKey = SystemParamsOperation.getInstance().getAppKey();
|
||||
// private final String appKey = "UTSMMuat@2025";
|
||||
|
||||
private final String appId = SystemParamsOperation.getInstance().getAppId();
|
||||
// private final String appId = "kp9b0794b349ae85b00c51e0677484c7";
|
||||
|
||||
private final ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
private final Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
@ -114,7 +119,7 @@ public class KPayViewModel extends ViewModel {
|
||||
bizContent.put("refund_request_no", refundOrderId);
|
||||
bizContent.put("merch_order_id", origOrderId);
|
||||
bizContent.put("merch_code", mid);
|
||||
bizContent.put("appid", "kp9b0794b349ae85b00c51e0677484c7");
|
||||
bizContent.put("appid", appId);
|
||||
if(!refundAmount.equals("0")) {
|
||||
bizContent.put("refund_amount", refundAmount);
|
||||
}
|
||||
@ -138,7 +143,7 @@ public class KPayViewModel extends ViewModel {
|
||||
|
||||
KPayRefund.RefundRequest.RequestBody.BizContent biz =
|
||||
new KPayRefund.RefundRequest.RequestBody.BizContent(
|
||||
"kp9b0794b349ae85b00c51e0677484c7",
|
||||
appId,
|
||||
mid,
|
||||
origOrderId,
|
||||
refundAmount, // This can be null for original refunds
|
||||
@ -160,7 +165,7 @@ public class KPayViewModel extends ViewModel {
|
||||
} else {
|
||||
KPayRefund.RefundRequest.RequestBody.BizContent biz =
|
||||
new KPayRefund.RefundRequest.RequestBody.BizContent(
|
||||
"kp9b0794b349ae85b00c51e0677484c7",
|
||||
appId,
|
||||
mid,
|
||||
origOrderId,
|
||||
refundOrderId,
|
||||
@ -195,7 +200,7 @@ public class KPayViewModel extends ViewModel {
|
||||
Map<String, Object> bizContent = new HashMap<>();
|
||||
bizContent.put("merch_order_id", merchOrderId);
|
||||
bizContent.put("merch_code", mid);
|
||||
bizContent.put("appid", "kp9b0794b349ae85b00c51e0677484c7");
|
||||
bizContent.put("appid", appId);
|
||||
bizContent.put("trade_type", "PAY_BY_QRCODE");
|
||||
bizContent.put("total_amount", amount);
|
||||
bizContent.put("title", "testing");
|
||||
@ -216,7 +221,7 @@ public class KPayViewModel extends ViewModel {
|
||||
String sign = Sign.INSTANCE.generateSign(requestMap, appKey);
|
||||
|
||||
KPayQRRequest.QrRequest.RequestBody.BizContent biz = new KPayQRRequest.QrRequest.RequestBody.BizContent(
|
||||
"kp9b0794b349ae85b00c51e0677484c7",
|
||||
appId,
|
||||
mid,
|
||||
merchOrderId,
|
||||
"PAY_BY_QRCODE",
|
||||
@ -252,7 +257,7 @@ public class KPayViewModel extends ViewModel {
|
||||
Map<String, Object> bizContentMap = new HashMap<>();
|
||||
bizContentMap.put("merch_order_id", merchOrderId);
|
||||
bizContentMap.put("merch_code", mid);
|
||||
bizContentMap.put("appid", "kp9b0794b349ae85b00c51e0677484c7");
|
||||
bizContentMap.put("appid", appId);
|
||||
|
||||
Map<String, Object> requestMap = new HashMap<>();
|
||||
requestMap.put("timestamp", currentTime);
|
||||
@ -264,7 +269,7 @@ public class KPayViewModel extends ViewModel {
|
||||
String sign = Sign.INSTANCE.generateSign(requestMap, appKey);
|
||||
|
||||
KPayQRQueryRequest.QRQueryRequest.Request.BizContent bizContent = new KPayQRQueryRequest.QRQueryRequest.Request.BizContent(
|
||||
"kp9b0794b349ae85b00c51e0677484c7",
|
||||
appId,
|
||||
mid,
|
||||
merchOrderId
|
||||
);
|
||||
|
||||
@ -119,7 +119,12 @@ public class PinPadViewModel extends ViewModel {
|
||||
case ON_CONFIRM_CLICK:
|
||||
LogUtil.d(TAG, "ON CLICK CONFIRM");
|
||||
// increasedKSN();
|
||||
if(transType.getValue() == TransactionsType.PRE_AUTH_COMPLETE || transType.getValue() == TransactionsType.PRE_AUTH_VOID || transType.getValue() == TransactionsType.REFUND ) {
|
||||
pinStatus.postValue(PinPadStatus.ON_NEXT_SCREEN);
|
||||
} else {
|
||||
pinStatus.postValue(PinPadStatus.ON_CONFIRM);
|
||||
}
|
||||
|
||||
break;
|
||||
case ON_CANCEL_CLICK:
|
||||
LogUtil.d(TAG, "ON CLICK CANCEL");
|
||||
|
||||
@ -8,6 +8,9 @@ import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel;
|
||||
|
||||
@HiltViewModel
|
||||
public class PreAuthVoidViewModel extends ViewModel {
|
||||
|
||||
private Repository repository;
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
package com.utsmm.kbz.ui.qr_pay;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.utsmm.kbz.R;
|
||||
import com.utsmm.kbz.databinding.ItemQrHistoryBinding;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class QRHistoryAdapter extends RecyclerView.Adapter<QRHistoryAdapter.ViewHolder> {
|
||||
|
||||
private List<PayDetail> items = new ArrayList<>();
|
||||
|
||||
public void setItems(List<PayDetail> data){
|
||||
items = data;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
ItemQrHistoryBinding binding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(parent.getContext()),
|
||||
R.layout.item_qr_history,
|
||||
parent,
|
||||
false
|
||||
);
|
||||
return new ViewHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
holder.bind(items.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return items.size();
|
||||
}
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private final ItemQrHistoryBinding binding;
|
||||
|
||||
public ViewHolder(@NonNull ItemQrHistoryBinding binding){
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
}
|
||||
|
||||
public void bind(PayDetail item){
|
||||
binding.setPayDetail(item);
|
||||
binding.executePendingBindings();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package com.utsmm.kbz.ui.qr_pay;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.utsmm.kbz.BR;
|
||||
import com.utsmm.kbz.R;
|
||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||
|
||||
import dagger.hilt.android.AndroidEntryPoint;
|
||||
|
||||
@AndroidEntryPoint
|
||||
public class QRHistoryFragment extends DataBindingFragment {
|
||||
|
||||
private QRHistoryAdapter adapter;
|
||||
private QRHistoryViewModel viewModel;
|
||||
|
||||
|
||||
@Override
|
||||
protected void initViewModel() {
|
||||
viewModel = new ViewModelProvider(this).get(QRHistoryViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DataBindingConfig getDataBindingConfig() {
|
||||
DataBindingConfig bindingConfig = new DataBindingConfig(R.layout.fragment_qr_history, BR.viewModel, viewModel);
|
||||
bindingConfig.addBindingParam(BR.adapter, adapter);
|
||||
return bindingConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int currentId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int hostId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int routeId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
setToolBarTitleWithBackIcon("History");
|
||||
observeData();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstance){
|
||||
super.onViewCreated(view, savedInstance);
|
||||
|
||||
RecyclerView rvHistory = view.findViewById(R.id.qrRvHistory);
|
||||
rvHistory.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
adapter = new QRHistoryAdapter();
|
||||
rvHistory.setAdapter(adapter);
|
||||
observeData();
|
||||
}
|
||||
|
||||
private void observeData(){
|
||||
viewModel.getAllQrHistory().observe(getViewLifecycleOwner(), list -> {
|
||||
adapter.setItems(list);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.utsmm.kbz.ui.qr_pay;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.utsmyanmar.baselib.repo.Repository;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel;
|
||||
|
||||
@HiltViewModel
|
||||
public class QRHistoryViewModel extends ViewModel {
|
||||
private final Repository repository;
|
||||
private final LiveData<List<PayDetail>> history;
|
||||
private final LiveData<List<PayDetail>> refundList;
|
||||
|
||||
@Inject
|
||||
public QRHistoryViewModel(Repository repository){
|
||||
this.repository = repository;
|
||||
this.history = repository.getAllQRHistory();
|
||||
this.refundList = repository.getRefundableQRHistory();
|
||||
}
|
||||
|
||||
public LiveData<List<PayDetail>> getAllQrHistory(){
|
||||
return history;
|
||||
}
|
||||
|
||||
public LiveData<List<PayDetail>> getRefundableQrHistory(){
|
||||
return refundList;
|
||||
}
|
||||
}
|
||||
406
app/src/main/java/com/utsmm/kbz/ui/qr_pay/QRPayFragment.java
Normal file
406
app/src/main/java/com/utsmm/kbz/ui/qr_pay/QRPayFragment.java
Normal file
@ -0,0 +1,406 @@
|
||||
package com.utsmm.kbz.ui.qr_pay;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.fragment.NavHostFragment;
|
||||
|
||||
import com.utsmm.kbz.BR;
|
||||
import com.utsmm.kbz.MainViewModel;
|
||||
import com.utsmm.kbz.R;
|
||||
import com.utsmm.kbz.config.Constants;
|
||||
import com.utsmm.kbz.ui.adapters.QRPayAdapter;
|
||||
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||
import com.utsmm.kbz.ui.management.ManagementViewModel;
|
||||
import com.utsmm.kbz.ui.settlement.SettlementViewModel;
|
||||
import com.utsmm.kbz.util.Connectivity;
|
||||
import com.utsmm.kbz.util.tms.TMSUtil;
|
||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.utils.POSUtil;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
import com.utsmyanmar.paylibs.utils.enums.CurrencyType;
|
||||
import com.utsmyanmar.paylibs.utils.enums.HostType;
|
||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class QRPayFragment extends DataBindingFragment {
|
||||
|
||||
private MainViewModel mainViewModel;
|
||||
private SharedViewModel sharedViewModel;
|
||||
private static final int hostId = Constants.NAV_HOST_ID;
|
||||
private int routeId;
|
||||
private static final int currentId = R.id.qrFragment;
|
||||
|
||||
|
||||
|
||||
private Observer<PayDetail> observeLastTrans;
|
||||
private PayDetail lastPay;
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
setToolBarTitleWithBackIcon("QR Pay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViewModel() {
|
||||
mainViewModel = new ViewModelProvider(requireActivity()).get(MainViewModel.class);
|
||||
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||
sharedViewModel = getFragmentScopeViewModel(SharedViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DataBindingConfig getDataBindingConfig() {
|
||||
|
||||
List<QRPayItem> features = List.of(
|
||||
new QRPayItem("Generate QR", R.drawable.ic_qr_pay),
|
||||
new QRPayItem("Refund", R.drawable.ic_refund),
|
||||
new QRPayItem("History", R.drawable.ic_history)
|
||||
);
|
||||
|
||||
QRPayAdapter adapter = new QRPayAdapter(features, position -> {
|
||||
QRPayItem selectedBtn = features.get(position);
|
||||
switch (selectedBtn.title){
|
||||
case "Generate QR":
|
||||
onClickQRPay();
|
||||
break;
|
||||
case "Refund":
|
||||
onClickRefund();
|
||||
break;
|
||||
case "History":
|
||||
onClickHistory();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
DataBindingConfig config = new DataBindingConfig(R.layout.fragment_qr_pay, BR.mainViewModel, mainViewModel);
|
||||
config.addBindingParam(BR.sharedViewModel,sharedViewModel);
|
||||
config.addBindingParam(BR.adapter, adapter);
|
||||
return config;
|
||||
}
|
||||
|
||||
public class ClickEvent {
|
||||
public void onGenerateQRClick() { onClickQRPay(); }
|
||||
public void onRefundClick() { onClickRefund(); }
|
||||
public void onHistoryClick() { onClickHistory(); }
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int currentId() {
|
||||
return currentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int hostId() {
|
||||
return hostId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int routeId() {
|
||||
return routeId;
|
||||
}
|
||||
|
||||
public void onClickQRPay() {
|
||||
|
||||
String mmqrIp = SystemParamsOperation.getInstance().getSecHostIpAddress();
|
||||
|
||||
if (mainViewModel.payDetailSingle.getValue() != null) {
|
||||
mainViewModel.startReversal(mainViewModel.payDetailSingle.getValue());
|
||||
}
|
||||
// else if (TMSUtil.getInstance().checkSecHostParams().isStatus() == ValidityStatus.FAILURE) {
|
||||
// showDeclineDialog(getResourceString(R.string.txt_please_download_config)+"\n"+TMSUtil.getInstance().checkSecHostParams().getMessage());
|
||||
// }
|
||||
else if (!Connectivity.isConnectedWifi(getContext()) && !Connectivity.isConnectedMobile(getContext())) {
|
||||
showSingleInfoDialog(getResourceString(R.string.txt_please_enable_internet));
|
||||
}
|
||||
// else if (!isValidDomain(mmqrIp)) {
|
||||
// showDeclineDialog(getResourceString(R.string.txt_please_check_mmqr_ip));
|
||||
// }
|
||||
else {
|
||||
CurrencyType currencyType = TMSUtil.getInstance().currencyTextToCurrencyType(SystemParamsOperation.getInstance().getSecHostCurrency());
|
||||
sharedViewModel.set_currencyText(currencyType.name);
|
||||
processBatch();
|
||||
sharedViewModel.transactionsType.setValue(TransactionsType.MMQR);
|
||||
navigateToAmount();
|
||||
}
|
||||
}
|
||||
|
||||
private void onClickHistory(){
|
||||
sharedViewModel.hostType.setValue(HostType.QR);
|
||||
routeId = R.id.action_qrFragment_to_qrHistory;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
|
||||
private void onClickRefund(){
|
||||
// sharedViewModel.setTransactionsType(TransactionsType.MMQR_REFUND);
|
||||
routeId = R.id.action_qrFragment_to_qr_refund_list;
|
||||
// routeId = R.id.action_qrFragment_to_inputPasswordFragment;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
|
||||
private void navigateToAmount() {
|
||||
routeId = R.id.action_qrFragment_to_inputAmountFragment;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
private void processBatch() {
|
||||
calculateLastTransaction();
|
||||
mainViewModel.observeSettlementPOS();
|
||||
observeLastTrans = payDetail -> {
|
||||
|
||||
if(payDetail == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// SystemParamsOperation.getInstance().saveSerialNumber(payDetail.getVoucherNo());
|
||||
// SystemParamsOperation.getInstance().saveInvoiceNumber(payDetail.getInvoiceNo());
|
||||
|
||||
if(lastPay != null) {
|
||||
Date lastPayDate = POSUtil.getInstance().getDateByString(lastPay.getTransDate());
|
||||
Date observePayDate = POSUtil.getInstance().getDateByString(payDetail.getTransDate());
|
||||
|
||||
if(lastPayDate.compareTo(observePayDate) < 0) {
|
||||
payDetail = lastPay;
|
||||
}
|
||||
}
|
||||
|
||||
// LogUtil.d(TAG,"TransDetail :"+payDetail.getTransType() + "- Trans Time :"+payDetail.getTransDate());
|
||||
|
||||
if(payDetail.getTransactionType() == TransactionsType.SETTLEMENT.value){
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* saving for api post request, to send in next time.
|
||||
* */
|
||||
SystemParamsOperation.getInstance().setLastTransTime(String.valueOf(payDetail.getTransNum()));
|
||||
SystemParamsOperation.getInstance().setLastTransName(payDetail.getTransType());
|
||||
|
||||
|
||||
String lastTransDate = payDetail.getTransDate();
|
||||
String lastTransTime = payDetail.getTransTime();
|
||||
|
||||
Date today = POSUtil.getInstance().getCurrentDate();
|
||||
Date transDate;
|
||||
Date current = new Date(System.currentTimeMillis());
|
||||
String configTimer = SystemParamsOperation.getInstance().getClearBatchTime();
|
||||
// LogUtil.d(TAG,"Config Time :" + configTimer);
|
||||
String configTime = "23:00";
|
||||
int configDay = 10;
|
||||
|
||||
String configRawDay = SystemParamsOperation.getInstance().getClearBatchDay();
|
||||
|
||||
if(configRawDay != null && !configRawDay.trim().isEmpty()) {
|
||||
try {
|
||||
configDay = Integer.parseInt(configRawDay);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(configTimer != null && !configTimer.trim().isEmpty() && checkValidTime(configTimer.trim())) {
|
||||
configTime = configTimer.trim();
|
||||
}
|
||||
Date configDateTime = POSUtil.getInstance().getDateTime(configTime);
|
||||
Date yesterdayConfigDateTime = POSUtil.getInstance().getYesterdayConfigDateTime(configTime);
|
||||
|
||||
transDate = POSUtil.getInstance().getDateByString(lastTransDate);
|
||||
|
||||
Date yesterdayDate = POSUtil.getInstance().getYesterdayDate();
|
||||
|
||||
if(today.compareTo(transDate) == 0) {
|
||||
|
||||
// LogUtil.d(TAG,"Last Trans is Today!");
|
||||
// LogUtil.d(TAG,"date current :!"+current);
|
||||
// LogUtil.d(TAG,"date config :!"+configDateTime);
|
||||
|
||||
// Today
|
||||
if(current.compareTo(configDateTime) > 0) {
|
||||
// clear batch and force update param
|
||||
|
||||
// LogUtil.d(TAG,"Last Trans is Today! Config time is passed!");
|
||||
// if (!SystemParamsOperation.getInstance().isClearBatch()) {
|
||||
if (checkSyncTrans() || !SystemParamsOperation.getInstance().isClearBatch() ) {
|
||||
// LogUtil.d(TAG,"Clearing....");
|
||||
if(!SystemParamsOperation.getInstance().getSettlementStatus()) {
|
||||
clearBatchAndDownload(configDay,payDetail);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
// LogUtil.d(TAG,"Last Trans is Today! Config time is not passed yet.....");
|
||||
SystemParamsOperation.getInstance().setClearBatch(false);
|
||||
}
|
||||
|
||||
} else {
|
||||
// LogUtil.d(TAG,"Last Trans is Before Today!");
|
||||
Date yest;
|
||||
if(configTime.equals("00:00")) {
|
||||
yest = configDateTime;
|
||||
} else {
|
||||
yest = yesterdayConfigDateTime;
|
||||
}
|
||||
|
||||
|
||||
Date lastTransDateTime = POSUtil.getInstance().getDateByTransDateTime(lastTransDate,lastTransTime);
|
||||
// LogUtil.d(TAG,"Compare Result : "+lastTransDateTime.compareTo(yest));
|
||||
|
||||
if(yest.compareTo(lastTransDateTime) < 0) {
|
||||
// LogUtil.d(TAG,"Trans is yesterday, but after config time, no action!");
|
||||
} else {
|
||||
// LogUtil.d(TAG,"Trans is yesterday, before config time,");
|
||||
// if(!checkSyncTrans()) {
|
||||
// LogUtil.d(TAG,"Clearing....");
|
||||
if(!SystemParamsOperation.getInstance().getSettlementStatus()) {
|
||||
clearBatchAndDownload(configDay,payDetail);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
if(mainViewModel.lastTrans.hasActiveObservers()) {
|
||||
mainViewModel.lastTrans.removeObserver(observeLastTrans);
|
||||
}
|
||||
mainViewModel.lastTrans.observe(getViewLifecycleOwner(),observeLastTrans);
|
||||
}
|
||||
|
||||
private void calculateLastTransaction() {
|
||||
mainViewModel.allTrans.observe(getViewLifecycleOwner(), new Observer<List<PayDetail>>() {
|
||||
@Override
|
||||
public void onChanged(List<PayDetail> payDetails) {
|
||||
if(payDetails == null || payDetails.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
PayDetail tempPay = payDetails.get(0);
|
||||
for (int i = 0; i < payDetails.size() ; i++) {
|
||||
|
||||
Date tempDate = POSUtil.getInstance().getDateByString(tempPay.getTransDate());
|
||||
Date indexDate = POSUtil.getInstance().getDateByString(payDetails.get(i).getTransDate());
|
||||
|
||||
if(tempDate.compareTo(indexDate) > 0) {
|
||||
// if before
|
||||
tempPay = payDetails.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
lastPay = tempPay;
|
||||
|
||||
// LogUtil.d(TAG,"Transaction Name : "+tempPay.getTransType());
|
||||
// LogUtil.d(TAG,"Transaction Type : "+tempPay.getTransactionType());
|
||||
// LogUtil.d(TAG,"Transaction Amount : "+tempPay.getAmount());
|
||||
// LogUtil.d(TAG,"Transaction Date/Time : "+tempPay.getTransDate()+"/"+tempPay.getTransTime());
|
||||
// LogUtil.d(TAG,"RRN/Trace : "+tempPay.getReferNo()+"/"+tempPay.getVoucherNo());
|
||||
// LogUtil.d(TAG,"Transaction is canceled : "+tempPay.isCanceled());
|
||||
// LogUtil.d(TAG,"Transaction settlement config : "+tempPay.isSettlementEnabled());
|
||||
// LogUtil.d(TAG,"----------------------------------------------------------");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean checkSyncTrans() {
|
||||
String transDateString = SystemParamsOperation.getInstance().getSyncTransDate();
|
||||
Date today = POSUtil.getInstance().getCurrentDate();
|
||||
if(transDateString == null || transDateString.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
Date transDate = POSUtil.getInstance().getDateByString(transDateString);
|
||||
return today.compareTo(transDate) == 0;
|
||||
|
||||
}
|
||||
|
||||
private void clearBatchAndDownload(int configDay,PayDetail payDetail) {
|
||||
|
||||
|
||||
Date yesterday = POSUtil.getInstance().getYesterdayDate();
|
||||
Date lastInputDay = POSUtil.getInstance().getLastInputDay(configDay);
|
||||
mainViewModel.settlementPOS.observe(getViewLifecycleOwner(), list -> {
|
||||
|
||||
Date transDate;
|
||||
|
||||
if(list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (PayDetail pay:list) {
|
||||
/*
|
||||
* To Hold One day transaction!
|
||||
* */
|
||||
|
||||
transDate = POSUtil.getInstance().getDateByString(pay.getTransDate());
|
||||
|
||||
if (pay.getTransactionType() == TransactionsType.SALE.value) {
|
||||
if(lastInputDay.compareTo(transDate) > 0) {
|
||||
mainViewModel.deletePayDetail(pay);
|
||||
}
|
||||
} else {
|
||||
if(yesterday.compareTo(transDate) > 0 ) {
|
||||
mainViewModel.deletePayDetail(pay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
mainViewModel.deleteTrans.observe(getViewLifecycleOwner(), lists -> {
|
||||
Date transDate;
|
||||
if(lists == null || lists.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (PayDetail pay:lists) {
|
||||
/*
|
||||
* To Hold One day transaction!
|
||||
* */
|
||||
|
||||
transDate = POSUtil.getInstance().getDateByString(pay.getTransDate());
|
||||
// LogUtil.d(TAG,"Trans Type : "+pay.getTransType()+"<=====> Trans Date :"+pay.getTransDate());
|
||||
// LogUtil.d(TAG,"Yesterday Date: "+yesterday.toString());
|
||||
// LogUtil.d(TAG,"Compare result :"+yesterday.compareTo(transDate));
|
||||
|
||||
if(yesterday.compareTo(transDate) > 0) {
|
||||
mainViewModel.deletePayDetail(pay);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
mainViewModel.preAuthTrans.observe(getViewLifecycleOwner(), lists -> {
|
||||
Date transDate;
|
||||
if(lists == null || lists.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (PayDetail pay:lists) {
|
||||
|
||||
transDate = POSUtil.getInstance().getDateByString(pay.getTransDate());
|
||||
|
||||
if (lastInputDay.compareTo(transDate) > 0) {
|
||||
mainViewModel.deletePayDetail(pay);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
*
|
||||
* Need to think about his problem .... Nov 7, 2024
|
||||
* */
|
||||
if(!SystemParamsOperation.getInstance().isClearBatch()) {
|
||||
// downloadParams(payDetail.getTransType(),String.valueOf(payDetail.getTransNum()),TMSUpdate.UPDATE,false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
11
app/src/main/java/com/utsmm/kbz/ui/qr_pay/QRPayItem.java
Normal file
11
app/src/main/java/com/utsmm/kbz/ui/qr_pay/QRPayItem.java
Normal file
@ -0,0 +1,11 @@
|
||||
package com.utsmm.kbz.ui.qr_pay;
|
||||
|
||||
public class QRPayItem {
|
||||
public String title;
|
||||
public int icon;
|
||||
|
||||
public QRPayItem(String title, int icon) {
|
||||
this.title = title;
|
||||
this.icon = icon;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.utsmm.kbz.ui.qr_pay;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.utsmyanmar.baselib.repo.Repository;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel;
|
||||
|
||||
@HiltViewModel
|
||||
public class QRPayViewModel extends ViewModel {
|
||||
|
||||
private final Repository repository;
|
||||
private final LiveData<List<PayDetail>> refundableHistory;
|
||||
|
||||
private final MutableLiveData<PayDetail> _payDetail = new MutableLiveData<>();
|
||||
public LiveData<PayDetail> payDetail = _payDetail;
|
||||
|
||||
|
||||
@Inject
|
||||
public QRPayViewModel(Repository repository){
|
||||
this.repository = repository;
|
||||
this.refundableHistory = repository.getRefundableQRHistory();
|
||||
}
|
||||
|
||||
public LiveData<List<PayDetail>> getRefundableQrHistory(){
|
||||
return refundableHistory;
|
||||
}
|
||||
|
||||
public void setPayDetail(PayDetail payDetail){
|
||||
_payDetail.setValue(payDetail);
|
||||
}
|
||||
|
||||
public Runnable onCancel;
|
||||
public Runnable onConfirm;
|
||||
}
|
||||
49
app/src/main/java/com/utsmm/kbz/ui/qr_pay/QRRefund.java
Normal file
49
app/src/main/java/com/utsmm/kbz/ui/qr_pay/QRRefund.java
Normal file
@ -0,0 +1,49 @@
|
||||
package com.utsmm.kbz.ui.qr_pay;
|
||||
|
||||
public class QRRefund {
|
||||
|
||||
private String referenceNo;
|
||||
private String refundAmount;
|
||||
private String originalAmount;
|
||||
private String reason;
|
||||
|
||||
public QRRefund(String referenceNo, String refundAmount, String originalAmount, String reason) {
|
||||
this.referenceNo = referenceNo;
|
||||
this.refundAmount = refundAmount;
|
||||
this.originalAmount = originalAmount;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public String getReferenceNo() {
|
||||
return referenceNo;
|
||||
}
|
||||
|
||||
public void setReferenceNo(String referenceNo) {
|
||||
this.referenceNo = referenceNo;
|
||||
}
|
||||
|
||||
public String getRefundAmount() {
|
||||
return refundAmount;
|
||||
}
|
||||
|
||||
public void setRefundAmount(String refundAmount) {
|
||||
this.refundAmount = refundAmount;
|
||||
}
|
||||
|
||||
public String getOriginalAmount() {
|
||||
return originalAmount;
|
||||
}
|
||||
|
||||
public void setOriginalAmount(String originalAmount) {
|
||||
this.originalAmount = originalAmount;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,230 @@
|
||||
package com.utsmm.kbz.ui.qr_pay;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.InputFilter;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.utsmm.kbz.ui.kpay.KPayViewModel;
|
||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.model.TradeData;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||
import com.utsmm.kbz.BR;
|
||||
import com.utsmm.kbz.R;
|
||||
import com.utsmm.kbz.config.Constants;
|
||||
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||
import com.utsmm.kbz.util.DecimalDigitsInputFilter;
|
||||
import com.utsmm.kbz.util.TransactionUtil;
|
||||
import com.utsmm.kbz.util.ecr.CoreUtils;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
|
||||
public class QRRefundDetailFragment extends DataBindingFragment {
|
||||
|
||||
private SharedViewModel sharedViewModel;
|
||||
private KPayViewModel kPayViewModel;
|
||||
private int routeId;
|
||||
|
||||
|
||||
private TradeData tradeData;
|
||||
private PayDetail payDetail;
|
||||
|
||||
// UI Elements
|
||||
private RadioGroup radioGroupRefundType;
|
||||
private RadioButton radioOriginal, radioPartial;
|
||||
private EditText etReferenceNo, etOriginalAmount, etRefundAmount, etRefundReason;
|
||||
private LinearLayout originalAmountLayout, refundAmountLayout;
|
||||
|
||||
private boolean isPartialRefund = false;
|
||||
|
||||
|
||||
|
||||
private static final String TAG = com.utsmm.kbz.ui.kpay.QRRefundFragment.class.getSimpleName();
|
||||
|
||||
private static final int hostId = Constants.NAV_HOST_ID;
|
||||
private static final int currentId = R.id.qrRefundDetail;
|
||||
|
||||
@Override
|
||||
protected void initViewModel() {
|
||||
sharedViewModel = getFragmentScopeViewModel(SharedViewModel.class);
|
||||
kPayViewModel = getFragmentScopeViewModel(KPayViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DataBindingConfig getDataBindingConfig() {
|
||||
return new DataBindingConfig(R.layout.fragment_qr_refund_detail, BR.sharedViewModel, sharedViewModel)
|
||||
.addBindingParam(BR.kPayViewModel, kPayViewModel)
|
||||
.addBindingParam(BR.click, new ClickEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int currentId() {
|
||||
return currentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int hostId() {
|
||||
return Constants.NAV_HOST_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int routeId() {
|
||||
return routeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState){
|
||||
super.onCreate(savedInstanceState);
|
||||
if(getArguments() != null){
|
||||
payDetail = (PayDetail) getArguments().getSerializable("payDetail");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
setToolBarTitleWithBackIcon("KPay Refund");
|
||||
kPayViewModel.invalidAmountMsg.setValue("");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
initViews();
|
||||
initData();
|
||||
setupRadioGroupListener();
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
radioGroupRefundType = mBinding.getRoot().findViewById(R.id.radio_group_refund_type);
|
||||
radioOriginal = mBinding.getRoot().findViewById(R.id.radio_original);
|
||||
radioPartial = mBinding.getRoot().findViewById(R.id.radio_partial);
|
||||
etReferenceNo = mBinding.getRoot().findViewById(R.id.et_reference_no);
|
||||
etOriginalAmount = mBinding.getRoot().findViewById(R.id.et_original_amount);
|
||||
etRefundAmount = mBinding.getRoot().findViewById(R.id.et_refund_amount);
|
||||
etRefundReason = mBinding.getRoot().findViewById(R.id.et_refund_reason);
|
||||
originalAmountLayout = mBinding.getRoot().findViewById(R.id.original_amount_layout);
|
||||
refundAmountLayout = mBinding.getRoot().findViewById(R.id.refund_amount_layout);
|
||||
|
||||
// Set input filters for amount fields
|
||||
etOriginalAmount.setFilters(new InputFilter[]{new DecimalDigitsInputFilter(11, 2)});
|
||||
etRefundAmount.setFilters(new InputFilter[]{new DecimalDigitsInputFilter(11, 2)});
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
payDetail = TransactionUtil.getInstance().initWalletTransaction(TransactionsType.MMQR_REFUND);
|
||||
payDetail.setInvoiceNo(SystemParamsOperation.getInstance().getIncrementInvoiceNum());
|
||||
|
||||
if(getArguments() != null){
|
||||
PayDetail passData = (PayDetail) getArguments().getSerializable("payDetail");
|
||||
if(passData != null && passData.getReferNo() != null){
|
||||
etReferenceNo.setText(passData.getReferNo());
|
||||
etReferenceNo.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setupRadioGroupListener() {
|
||||
radioGroupRefundType.setOnCheckedChangeListener((group, checkedId) -> {
|
||||
if (checkedId == R.id.radio_partial) {
|
||||
// Show both amount fields for partial refund
|
||||
isPartialRefund = true;
|
||||
originalAmountLayout.setVisibility(View.VISIBLE);
|
||||
refundAmountLayout.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
// Hide amount fields for original refund
|
||||
isPartialRefund = false;
|
||||
originalAmountLayout.setVisibility(View.GONE);
|
||||
refundAmountLayout.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public class ClickEvent {
|
||||
|
||||
public void onCancel() {
|
||||
safePopBackStack();
|
||||
}
|
||||
|
||||
public void onConfirm() {
|
||||
kPayViewModel.invalidAmountMsg.setValue("");
|
||||
|
||||
String referenceNo = etReferenceNo.getText().toString().trim();
|
||||
String refundReason = etRefundReason.getText().toString().trim();
|
||||
|
||||
// Validate reference number
|
||||
if (referenceNo.isEmpty()) {
|
||||
kPayViewModel.invalidAmountMsg.setValue("Enter reference number");
|
||||
return;
|
||||
}
|
||||
|
||||
if (isPartialRefund) {
|
||||
// Partial refund validation
|
||||
String originalAmountStr = etOriginalAmount.getText().toString().trim();
|
||||
String refundAmountStr = etRefundAmount.getText().toString().trim();
|
||||
|
||||
if (originalAmountStr.isEmpty()) {
|
||||
kPayViewModel.invalidAmountMsg.setValue("Enter original amount");
|
||||
return;
|
||||
}
|
||||
|
||||
if (refundAmountStr.isEmpty()) {
|
||||
kPayViewModel.invalidAmountMsg.setValue("Enter refund amount");
|
||||
return;
|
||||
}
|
||||
|
||||
double originalAmount = Double.parseDouble(originalAmountStr);
|
||||
double refundAmount = Double.parseDouble(refundAmountStr);
|
||||
|
||||
if (originalAmount <= 0) {
|
||||
kPayViewModel.invalidAmountMsg.setValue("Enter valid original amount");
|
||||
return;
|
||||
}
|
||||
|
||||
if (refundAmount <= 0) {
|
||||
kPayViewModel.invalidAmountMsg.setValue("Enter valid refund amount");
|
||||
return;
|
||||
}
|
||||
|
||||
if (refundAmount > originalAmount) {
|
||||
kPayViewModel.invalidAmountMsg.setValue("Refund amount cannot exceed original amount");
|
||||
return;
|
||||
}
|
||||
|
||||
QRRefund qrRefund = new QRRefund(referenceNo, refundAmountStr, originalAmountStr, refundReason);
|
||||
|
||||
// kPayViewModel.setQrRefund(qrRefund);
|
||||
|
||||
} else {
|
||||
QRRefund qrRefund = new QRRefund(referenceNo, "0", etOriginalAmount.getText().toString().trim(), refundReason);
|
||||
|
||||
// kPayViewModel.setQrRefund(qrRefund);
|
||||
}
|
||||
|
||||
kPayViewModel.setPayDetail(payDetail);
|
||||
|
||||
navigateToPassword();
|
||||
}
|
||||
}
|
||||
|
||||
public void navigateToPassword(){
|
||||
routeId = R.id.action_QRRefundDetail_to_inputPasswordFragment;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
}
|
||||
104
app/src/main/java/com/utsmm/kbz/ui/qr_pay/QRRefundFragment.java
Normal file
104
app/src/main/java/com/utsmm/kbz/ui/qr_pay/QRRefundFragment.java
Normal file
@ -0,0 +1,104 @@
|
||||
package com.utsmm.kbz.ui.qr_pay;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.fragment.NavHostFragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.utsmm.kbz.BR;
|
||||
import com.utsmm.kbz.R;
|
||||
import com.utsmm.kbz.config.Constants;
|
||||
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||
import com.utsmm.kbz.ui.kpay.KPayViewModel;
|
||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class QRRefundFragment extends DataBindingFragment {
|
||||
|
||||
private static final int hostId = Constants.NAV_HOST_ID;
|
||||
private int routeId;
|
||||
private static final int currentId = R.id.qrRefundList;
|
||||
private QRPayViewModel qrPayViewModel;
|
||||
private SharedViewModel sharedViewModel;
|
||||
private QRRefundViewAdapter adapter;
|
||||
|
||||
@Override
|
||||
protected int currentId() {
|
||||
return currentId;
|
||||
}
|
||||
@Override
|
||||
protected int hostId() {return hostId;}
|
||||
@Override
|
||||
protected int routeId() {return routeId;}
|
||||
|
||||
@Override
|
||||
protected void initViewModel() {
|
||||
sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||
qrPayViewModel = new ViewModelProvider(requireActivity()).get(QRPayViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DataBindingConfig getDataBindingConfig() {
|
||||
adapter = new QRRefundViewAdapter(this::onRefundItemClicked);
|
||||
return new DataBindingConfig(R.layout.fragment_qr_refund, BR.sharedViewModel, sharedViewModel)
|
||||
.addBindingParam(BR.adapter, adapter)
|
||||
.addBindingParam(BR.click, new ClickEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
setToolBarTitleWithBackIcon("QR Refund");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstance){
|
||||
super.onCreate(savedInstance);
|
||||
adapter = new QRRefundViewAdapter(this::onRefundItemClicked);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState){
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
RecyclerView recyclerView = view.findViewById(R.id.qrRefundHistory);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
recyclerView.setAdapter(adapter);
|
||||
observeData();
|
||||
}
|
||||
|
||||
private void observeData(){
|
||||
qrPayViewModel.getRefundableQrHistory().observe(getViewLifecycleOwner(), this::updateList);
|
||||
}
|
||||
|
||||
private void updateList(List<PayDetail> list){
|
||||
if (adapter == null) {
|
||||
return;
|
||||
}
|
||||
adapter.setData(list);
|
||||
}
|
||||
|
||||
public class ClickEvent {
|
||||
public void onCancel(){
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
}
|
||||
|
||||
private void onRefundItemClicked(PayDetail payDetail) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("payDetail", payDetail);
|
||||
routeId = R.id.action_qrRefundList_to_qrRefundDetail;
|
||||
NavHostFragment.findNavController(this).navigate(R.id.action_qrRefundList_to_qrRefundDetail, bundle);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,215 @@
|
||||
package com.utsmm.kbz.ui.qr_pay;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.utsmm.kbz.BR;
|
||||
import com.utsmm.kbz.R;
|
||||
import com.utsmm.kbz.config.Constants;
|
||||
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||
import com.utsmm.kbz.ui.kpay.KPayViewModel;
|
||||
import com.utsmm.kbz.ui.kpay.QRRefundFragment;
|
||||
import com.utsmm.kbz.util.TransactionUtil;
|
||||
import com.utsmm.kbz.util.ecr.CoreUtils;
|
||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||
import com.utsmyanmar.baselib.network.model.KPayRefund;
|
||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.system.SystemDateTime;
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
import com.utsmyanmar.paylibs.utils.POSUtil;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
public class QRRefundProcessFragment extends DataBindingFragment {
|
||||
|
||||
private static final String TAG = QRRefundProcessFragment.class.getSimpleName();
|
||||
private SharedViewModel sharedViewModel;
|
||||
private KPayViewModel kPayViewModel;
|
||||
|
||||
private PayDetail payDetail;
|
||||
|
||||
private QRRefund qrRefund;
|
||||
private static final int hostId = Constants.NAV_HOST_ID;
|
||||
private int routeId;
|
||||
private static final int currentId = R.id.QRRefundProcessFragment;
|
||||
|
||||
CompositeDisposable retrieveUpdateDisposable = new CompositeDisposable();
|
||||
CompositeDisposable refundDisposable = new CompositeDisposable();
|
||||
|
||||
@Override
|
||||
protected void initViewModel() {
|
||||
sharedViewModel = getFragmentScopeViewModel(SharedViewModel.class);
|
||||
kPayViewModel = getFragmentScopeViewModel(KPayViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DataBindingConfig getDataBindingConfig() {
|
||||
return new DataBindingConfig(R.layout.fragment_qr_refund_process, BR.sharedViewModel, sharedViewModel)
|
||||
.addBindingParam(BR.kPayViewModel, kPayViewModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
retrieveUpdateDisposable.dispose();
|
||||
refundDisposable.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int currentId() {
|
||||
return currentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int hostId() {
|
||||
return hostId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int routeId() {
|
||||
return routeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
initData();
|
||||
|
||||
processKPayRefund(qrRefund.getReferenceNo(), qrRefund.getRefundAmount(), qrRefund.getOriginalAmount(), qrRefund.getReason());
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
payDetail = kPayViewModel.getPayDetail();
|
||||
// qrRefund = kPayViewModel.getQrRefund();
|
||||
}
|
||||
|
||||
private void processKPayRefund(String referenceNo, String refundAmount, String originalAmount, String reason) {
|
||||
String merchantId = TransactionUtil.getInstance().getQRMerchantId();
|
||||
|
||||
// Generate unique refund request ID
|
||||
String refundRequestId = referenceNo + "R";
|
||||
|
||||
|
||||
// Create KPay refund request
|
||||
KPayRefund.RefundRequest refundRequest = kPayViewModel.createRefundRequest(
|
||||
refundRequestId,
|
||||
referenceNo,
|
||||
merchantId,
|
||||
refundAmount,
|
||||
reason != null ? reason : "Refund request"
|
||||
);
|
||||
|
||||
Disposable refundDi = kPayViewModel.kPayRefund(refundRequest)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
response -> {
|
||||
handleRefundResponse(response, referenceNo);
|
||||
},
|
||||
throwable -> {
|
||||
LogUtil.e(TAG, "Refund error: " + throwable.getMessage());
|
||||
showDeclineDialog("Refund failed!\nCommunication Error!");
|
||||
ecrActionCancel("Refund failed");
|
||||
navigateToMain();
|
||||
},
|
||||
() -> LogUtil.d(TAG, "Refund request completed")
|
||||
);
|
||||
|
||||
refundDisposable.add(refundDi);
|
||||
}
|
||||
|
||||
private void handleRefundResponse(KPayRefund.RefundResponse response, String referenceNo) {
|
||||
if (response != null && response.getResponse() != null && "REFUND_SUCCESS".equalsIgnoreCase(response.getResponse().getRefundStatus())) {
|
||||
LogUtil.d(TAG, "Refund successful!");
|
||||
|
||||
String refundAmount = response.getResponse().getRefundAmount();
|
||||
|
||||
String dateTime = SystemDateTime.getTodayDateFormat() + " " + SystemDateTime.getTodayTimeFormat();
|
||||
payDetail.setAmount(refundAmount == null ? 0 : POSUtil.getInstance().convertAmount(refundAmount));
|
||||
payDetail.setOriginalTransDate(dateTime);
|
||||
payDetail.setQrTransStatus(1);
|
||||
payDetail.setQrReferNo(referenceNo);
|
||||
payDetail.setReferNo(referenceNo);
|
||||
payDetail.setIsCanceled(true);
|
||||
|
||||
retrievedUpdatePayDetail(referenceNo);
|
||||
|
||||
} else {
|
||||
LogUtil.d(TAG, "Refund failed!");
|
||||
payDetail.setQrTransStatus(-1);
|
||||
payDetail.setQrReferNo(referenceNo);
|
||||
payDetail.setReferNo(referenceNo);
|
||||
|
||||
String errorMsg = "Refund failed";
|
||||
if (response != null && response.getResponse() != null && response.getResponse().getMsg() != null) {
|
||||
errorMsg = response.getResponse().getMsg();
|
||||
}
|
||||
payDetail.setTradeResultDes(errorMsg);
|
||||
|
||||
sharedViewModel.payDetail.setValue(payDetail);
|
||||
navigateToNext();
|
||||
}
|
||||
}
|
||||
|
||||
private void retrievedUpdatePayDetail(String refNum) {
|
||||
LogUtil.d(TAG, "Trying to update Database!");
|
||||
retrieveUpdateDisposable.add(kPayViewModel.searchPayByRefNum(refNum)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(oldPay -> {
|
||||
LogUtil.d(TAG, "Inside the subscribe!");
|
||||
if (oldPay != null) {
|
||||
oldPay.setIsCanceled(true);
|
||||
payDetail.setQrTransId(oldPay.getQrTransId());
|
||||
payDetail.setCustomerMobile(oldPay.getCustomerMobile());
|
||||
sharedViewModel.updatePayDetail(oldPay);
|
||||
}
|
||||
updateData();
|
||||
navigateToNext();
|
||||
},
|
||||
onError -> {
|
||||
LogUtil.d(TAG, "On error Unable to retrieve PayDetail");
|
||||
updateData();
|
||||
navigateToNext();
|
||||
},
|
||||
() -> {
|
||||
LogUtil.d(TAG, "No data found! navigating to Result Page!");
|
||||
updateData();
|
||||
navigateToNext();
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
private void updateData() {
|
||||
kPayViewModel.insertPayDetail(payDetail);
|
||||
sharedViewModel.payDetail.postValue(payDetail);
|
||||
}
|
||||
|
||||
private void navigateToNext() {
|
||||
routeId = R.id.action_QRRefundProcessFragment_to_transactionResultFragment;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
|
||||
private void navigateToMain() {
|
||||
routeId = R.id.action_QRRefundProcessFragment_to_nav_main;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
|
||||
private void ecrActionCancel(String msg) {
|
||||
if (sharedViewModel.isEcr.getValue() != null) {
|
||||
if (sharedViewModel.isEcr.getValue()) {
|
||||
sharedViewModel.isEcr.postValue(false);
|
||||
CoreUtils.getInstance(sharedViewModel).responseRejectMsg(msg);
|
||||
sharedViewModel.isEcrFinished.postValue(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package com.utsmm.kbz.ui.qr_pay;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.utsmm.kbz.BR;
|
||||
import com.utsmm.kbz.R;
|
||||
import com.utsmm.kbz.databinding.ItemQrRefundBinding;
|
||||
import com.utsmm.kbz.ui.adapters.QRPayAdapter;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class QRRefundViewAdapter extends RecyclerView.Adapter<QRRefundViewAdapter.ViewHolder> {
|
||||
|
||||
private List<PayDetail> payDetailList = new ArrayList<>();
|
||||
private final OnRefundItemClick listener;
|
||||
|
||||
public interface OnRefundItemClick {
|
||||
void onClick(PayDetail payDetail);
|
||||
}
|
||||
|
||||
public QRRefundViewAdapter(OnRefundItemClick listener){
|
||||
this.listener = listener;
|
||||
}
|
||||
// public QRRefundViewAdapter(List<PayDetail> payDetailList, OnRefundItemClick listener){
|
||||
// this.payDetailList = payDetailList;
|
||||
// this.listener = listener;
|
||||
// }
|
||||
|
||||
|
||||
public void setData(List<PayDetail> data){
|
||||
this.payDetailList = data != null ? data : new ArrayList<>();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
ItemQrRefundBinding binding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(parent.getContext()),
|
||||
R.layout.item_qr_refund,
|
||||
parent,
|
||||
false
|
||||
);
|
||||
|
||||
return new ViewHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
PayDetail payDetail = payDetailList.get(position);
|
||||
holder.bind(payDetail, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return payDetailList == null ? 0 : payDetailList.size();
|
||||
}
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private final ItemQrRefundBinding binding;
|
||||
|
||||
public ViewHolder(ItemQrRefundBinding binding){
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
}
|
||||
|
||||
public void bind(PayDetail payDetail, OnRefundItemClick listener){
|
||||
binding.setVariable(BR.payDetail, payDetail);
|
||||
binding.executePendingBindings();
|
||||
binding.getRoot().setOnClickListener( v -> {
|
||||
if(listener != null) listener.onClick(payDetail);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.utsmm.kbz.util;
|
||||
|
||||
import com.sunmi.pay.hardware.aidlv2.AidlConstantsV2;
|
||||
import com.utsmyanmar.checkxread.model.CardDataX;
|
||||
import com.utsmyanmar.paylibs.model.CardInfo;
|
||||
import com.utsmyanmar.paylibs.model.ICCardInfo;
|
||||
import com.utsmyanmar.paylibs.model.MAGCardInfo;
|
||||
@ -44,13 +45,29 @@ public class MockData {
|
||||
// .iccData("5F21BLAHBLAH")
|
||||
// .build();
|
||||
|
||||
// mockCardData = new MockCardData.Builder()
|
||||
// .cardNo("9503051034047056")
|
||||
// .expDate("0230")
|
||||
// .cardScheme("MPU")
|
||||
// .cardHolderName("KBZ Debit")
|
||||
// .iccData("9503051034047056=30021015930000000000")
|
||||
// .build();
|
||||
mockCardData = new MockCardData.Builder()
|
||||
.cardNo("9503190006079422")
|
||||
.expDate("0725")
|
||||
.cardNo("9505050161133125")
|
||||
.expDate("0127")
|
||||
.cardScheme("MPU")
|
||||
.cardHolderName("YOMA VALUED CUSTOMER")
|
||||
.cardHolderName("KBZ Credit")
|
||||
.iccData("9505050161133125=27011017250000000000")
|
||||
.build();
|
||||
|
||||
// mockCardData = new MockCardData.Builder()
|
||||
// .cardNo("9503742975107251")
|
||||
// .expDate("0629")
|
||||
// .cardScheme("MPU")
|
||||
// .cardHolderName("Bank Q")
|
||||
// .iccData("9503742975107251=22081010000000000000")
|
||||
// .build();
|
||||
|
||||
// mockCardData = new MockCardData.Builder()
|
||||
// .phoneNo("9794452506")
|
||||
// .expDate("0425")
|
||||
@ -74,6 +91,15 @@ public class MockData {
|
||||
return String.valueOf(randomNumber);
|
||||
}
|
||||
|
||||
public CardDataX generateMPUCard() {
|
||||
CardDataX cardDataX = new CardDataX();
|
||||
cardDataX.setPan(mockCardData.getCardNo());
|
||||
cardDataX.setExp(mockCardData.getExpDate());
|
||||
cardDataX.setCardHolderName(mockCardData.getCardHolderName());
|
||||
cardDataX.setTrack2(mockCardData.getIccData());
|
||||
return cardDataX;
|
||||
}
|
||||
|
||||
public TradeData generateMockDataWithTime(TransactionsType transType,int cardInputType,String transDate,String transTime) {
|
||||
String strDate = SystemDateTime.getMMDD();
|
||||
String strTime = SystemDateTime.getHHmmss();
|
||||
|
||||
@ -10,6 +10,7 @@ import com.utsmyanmar.baselib.network.model.sirius.SiriusMerchant;
|
||||
import com.utsmyanmar.baselib.network.model.sirius.SiriusProperty;
|
||||
import com.utsmyanmar.baselib.network.model.sirius.SiriusResponse;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsSettings;
|
||||
import com.utsmyanmar.paylibs.utils.enums.CurrencyType;
|
||||
|
||||
import com.utsmm.kbz.BuildConfig;
|
||||
@ -412,15 +413,15 @@ public class TMSSetupsImpl implements TMSSetups{
|
||||
} else if (TextUtils.equals(name,"ssl_enable")) {
|
||||
|
||||
SystemParamsOperation.getInstance().setSslSwitchStatus(parseBoolean(data));
|
||||
} else if (TextUtils.equals(name,"wave_pay_inquiry_status_enable")) {
|
||||
} else if (TextUtils.equals(name,"qrpay_inquiry_status_enable")) {
|
||||
|
||||
SystemParamsOperation.getInstance().setWavePayInquiryStatus(parseBoolean(data));
|
||||
SystemParamsOperation.getInstance().setQRPayInquiryStatus(parseBoolean(data));
|
||||
} else if (TextUtils.equals(name,"tips_adjustment_enable")) {
|
||||
|
||||
SystemParamsOperation.getInstance().setTipsAdjustmentStatus(parseBoolean(data));
|
||||
} else if (TextUtils.equals(name,"wave_enable")) {
|
||||
} else if (TextUtils.equals(name,"qrpay_enable")) {
|
||||
|
||||
SystemParamsOperation.getInstance().setWavePayStatus(parseBoolean(data));
|
||||
SystemParamsOperation.getInstance().setQRPayStatus(parseBoolean(data));
|
||||
} else if (TextUtils.equals(name,"print_iso_enable")) {
|
||||
|
||||
SystemParamsOperation.getInstance().setPrintISOStatus(parseBoolean(data));
|
||||
@ -582,11 +583,14 @@ public class TMSSetupsImpl implements TMSSetups{
|
||||
}
|
||||
} else if (TextUtils.equals(name,"speedup_contactless_enable")) {
|
||||
SystemParamsOperation.getInstance().setSpeedUpContactless(parseBoolean(data));
|
||||
}
|
||||
else if (TextUtils.equals(name,"manual_entry_pin_enable")) {
|
||||
} else if (TextUtils.equals(name,"manual_entry_pin_enable")) {
|
||||
SystemParamsOperation.getInstance().setManualEntryPinEnable(parseBoolean(data));
|
||||
} else if (TextUtils.equals(name,"decimal_enable")) {
|
||||
SystemParamsOperation.getInstance().setDecimalEnable(parseBoolean(data));
|
||||
} else if (TextUtils.equals(name,"app_key")) {
|
||||
SystemParamsOperation.getInstance().setAppKey(data);
|
||||
} else if (TextUtils.equals(name,"app_id")) {
|
||||
SystemParamsOperation.getInstance().setAppId(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ public class TMSUtil {
|
||||
voidStatus = SystemParamsOperation.getInstance().getVoidStatus();
|
||||
cashAdvanceStatus = SystemParamsOperation.getInstance().getCashAdvanceStatus();
|
||||
refundStatus = SystemParamsOperation.getInstance().getRefundStatus();
|
||||
wavePayInquiryStatus = SystemParamsOperation.getInstance().getWavePayInquiryStatus();
|
||||
wavePayInquiryStatus = SystemParamsOperation.getInstance().getQRPayInquiryStatus();
|
||||
tipAdjustmentStatus = SystemParamsOperation.getInstance().getTipsAdjustmentStatus();
|
||||
settlementStatus = SystemParamsOperation.getInstance().getSettlementStatus();
|
||||
|
||||
|
||||
@ -149,6 +149,7 @@
|
||||
android:layout_weight="1"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="2dp"
|
||||
android:onClick="@{()->click.onClickTap()}"
|
||||
android:backgroundTint="#fff"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:focusable="true"
|
||||
|
||||
@ -240,7 +240,7 @@
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:onClick="@{() -> click.onClickQRPay()}"
|
||||
android:onClick="@{() -> click.onClickQR()}"
|
||||
app:disableBtn="@{mainViewModel.kPayStatus}"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cardMenuCard"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
28
app/src/main/res/layout/fragment_qr_history.xml
Normal file
28
app/src/main/res/layout/fragment_qr_history.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<data>
|
||||
<variable
|
||||
name="vm"
|
||||
type="com.utsmm.kbz.ui.qr_pay.QRHistoryViewModel" />
|
||||
</data>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/qrRvHistory"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
<!-- No Data Message -->
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tvNoData"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:text="No history available"-->
|
||||
<!-- android:textSize="18sp"-->
|
||||
<!-- android:padding="16dp"-->
|
||||
<!-- android:visibility="@{vm.refundList.size() == 0 ? View.VISIBLE : View.GONE}" />-->
|
||||
</FrameLayout>
|
||||
</layout>
|
||||
41
app/src/main/res/layout/fragment_qr_pay.xml
Normal file
41
app/src/main/res/layout/fragment_qr_pay.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:bind="http://schemas.android.com/tools">
|
||||
|
||||
|
||||
<data>
|
||||
<variable
|
||||
name="adapter"
|
||||
type="androidx.recyclerview.widget.RecyclerView.Adapter" />
|
||||
<variable
|
||||
name="sharedViewModel"
|
||||
type="com.utsmm.kbz.ui.core_viewmodel.SharedViewModel" />
|
||||
</data>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorBackground">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerViewFeatures"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:clipToPadding="false"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:padding="16dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:spanCount="2"
|
||||
bind:setAdapter="@{adapter}"
|
||||
tools:itemCount="3"
|
||||
tools:listitem="@layout/item_qr_pay_button" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
44
app/src/main/res/layout/fragment_qr_refund.xml
Normal file
44
app/src/main/res/layout/fragment_qr_refund.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:bind="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
<variable
|
||||
name="sharedViewModel"
|
||||
type="com.utsmm.kbz.ui.core_viewmodel.SharedViewModel" />
|
||||
<variable
|
||||
name="adapter"
|
||||
type="androidx.recyclerview.widget.RecyclerView.Adapter" />
|
||||
|
||||
<!-- Optional: Click handler class (if you want Cancel button or click events) -->
|
||||
<!-- <variable-->
|
||||
<!-- name="click"-->
|
||||
<!-- type="com.utsmm.kbz.ui.qr_pay.QRRefundListFragment.ClickEvent" />-->
|
||||
</data>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!-- RecyclerView showing refund history -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/qrRefundHistory"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
bind:setAdapter="@{adapter}"
|
||||
tools:listitem="@layout/item_qr_refund" />
|
||||
<!-- Optional empty view (you can control visibility with ViewModel vars) -->
|
||||
<TextView
|
||||
android:id="@+id/txtNoData"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="Not Records To Display"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#888"
|
||||
android:visibility="gone" />
|
||||
|
||||
</FrameLayout>
|
||||
</layout>
|
||||
349
app/src/main/res/layout/fragment_qr_refund_detail.xml
Normal file
349
app/src/main/res/layout/fragment_qr_refund_detail.xml
Normal file
@ -0,0 +1,349 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
<variable
|
||||
name="sharedViewModel"
|
||||
type="com.utsmm.kbz.ui.core_viewmodel.SharedViewModel" />
|
||||
|
||||
<variable
|
||||
name="kPayViewModel"
|
||||
type="com.utsmm.kbz.ui.kpay.KPayViewModel" />
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="com.utsmm.kbz.ui.qr_pay.QRRefundDetailFragment.ClickEvent" />
|
||||
</data>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp">
|
||||
|
||||
<!-- Refund Type Selection -->
|
||||
<LinearLayout
|
||||
android:id="@+id/refund_type_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:text="Refund Type"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radio_group_refund_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radio_original"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:checked="true"
|
||||
android:text="Original Amount"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radio_partial"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Partial Amount"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Reference Number Input -->
|
||||
<LinearLayout
|
||||
android:id="@+id/reference_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/refund_type_layout">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:text="Reference Number *"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_reference_no"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:hint="Enter reference number"
|
||||
android:inputType="text"
|
||||
android:maxLength="20"
|
||||
android:padding="16dp"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
tools:text="NEX000011" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Original Amount Input (for partial refunds) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/original_amount_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/reference_layout">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:text="Original Amount *"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_amount_title"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/mmk"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="4dp"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_original_amount"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:hint="0.00"
|
||||
android:inputType="numberDecimal"
|
||||
android:padding="16dp"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="1000.00" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Refund Amount Input (for partial refunds) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/refund_amount_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/original_amount_layout">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:text="Refund Amount *"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_amount_title"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/mmk"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="4dp"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_refund_amount"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:hint="0.00"
|
||||
android:inputType="numberDecimal"
|
||||
android:padding="16dp"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="400.00" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Refund Reason Input -->
|
||||
<LinearLayout
|
||||
android:id="@+id/refund_reason_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/refund_amount_layout">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:text="Refund Reason"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_refund_reason"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:hint="Enter refund reason (optional)"
|
||||
android:inputType="textMultiLine"
|
||||
android:lines="3"
|
||||
android:padding="16dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
tools:text="Customer requested refund" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Error Message -->
|
||||
<TextView
|
||||
android:id="@+id/error_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@{kPayViewModel.invalidAmountMsg}"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/refund_reason_layout"
|
||||
tools:text="Invalid amount entered" />
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<LinearLayout
|
||||
android:id="@+id/button_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/error_message">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="4dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_rounded_btn_cancel_cv"
|
||||
android:onClick="@{()->click.onCancel()}"
|
||||
android:text="@string/layout_cancel"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_confirm"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="4dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_rounded_btn_cv"
|
||||
android:onClick="@{()->click.onConfirm()}"
|
||||
android:text="Process Refund"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
</layout>
|
||||
44
app/src/main/res/layout/fragment_qr_refund_process.xml
Normal file
44
app/src/main/res/layout/fragment_qr_refund_process.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<variable
|
||||
name="sharedViewModel"
|
||||
type="com.utsmm.kbz.ui.core_viewmodel.SharedViewModel" />
|
||||
<variable
|
||||
name="kPayViewModel"
|
||||
type="com.utsmm.kbz.ui.kpay.KPayViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/rubik_regular"
|
||||
android:text="@string/txt_processing_refund"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="@+id/lav_thumbUp"
|
||||
app:layout_constraintStart_toStartOf="@+id/lav_thumbUp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/lav_thumbUp" />
|
||||
|
||||
|
||||
<com.airbnb.lottie.LottieAnimationView
|
||||
android:id="@+id/lav_thumbUp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_margin="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:lottie_autoPlay="true"
|
||||
app:lottie_fileName="lottie_processing_card.json"
|
||||
app:lottie_loop="true" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
160
app/src/main/res/layout/item_qr_history.xml
Normal file
160
app/src/main/res/layout/item_qr_history.xml
Normal file
@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
>
|
||||
|
||||
<data>
|
||||
<import type="com.utsmyanmar.paylibs.utils.POSUtil"/>
|
||||
<variable
|
||||
name="payDetail"
|
||||
type="com.utsmyanmar.paylibs.model.PayDetail" />
|
||||
<variable
|
||||
name="onItemClick"
|
||||
type="com.utsmm.kbz.ui.management.ItemClickListener" />
|
||||
</data>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="4dp"
|
||||
android:layout_marginVertical="6dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="@color/colorPrimary"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:onClick="@{() -> onItemClick.onClickCard(payDetail)}">
|
||||
|
||||
<!-- Card with border -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:background="@drawable/bg_edittext_primary_border"
|
||||
android:orientation="horizontal"
|
||||
android:padding="16dp">
|
||||
|
||||
<!-- Transaction Icon -->
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_custom_pos"
|
||||
app:tint="@color/white"
|
||||
android:alpha="0.8"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_gravity="top" />
|
||||
|
||||
<!-- Transaction Details -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Transaction Type and Amount Row -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
<!-- Transaction Type -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@{POSUtil.getInstance().getTransName(payDetail)}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
tools:text="SALE" />
|
||||
|
||||
<!-- Transaction Amount -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{POSUtil.getInstance().checkMinusSign(payDetail.transactionType)+POSUtil.getInstance().getDecimalAmountSeparatorFormat(payDetail.amount) + ` `+POSUtil.getInstance().currencyCodeToText(payDetail.currencyCode)}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
tools:text="1,000.00 MMK" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Transaction Date -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{POSUtil.getInstance().convertDateFormatByDateString(payDetail.transDate)}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
android:alpha="0.8"
|
||||
android:fontFamily="sans-serif"
|
||||
android:layout_marginBottom="6dp"
|
||||
tools:text="2022-11-26" />
|
||||
|
||||
<!-- Card Number -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{POSUtil.getInstance().getCardNumMasking(payDetail.cardNo)}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
android:alpha="0.8"
|
||||
android:fontFamily="monospace"
|
||||
android:layout_marginBottom="8dp"
|
||||
tools:text="468785******9564" />
|
||||
|
||||
<!-- Trace and RRN Row -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- Trace Number -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:isTrace="@{payDetail}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp"
|
||||
android:alpha="0.7"
|
||||
android:fontFamily="monospace"
|
||||
tools:text="TRC:000050" />
|
||||
|
||||
<!-- RRN -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@{`RRN:`+payDetail.referNo}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp"
|
||||
android:alpha="0.7"
|
||||
android:fontFamily="monospace"
|
||||
android:textAlignment="textEnd"
|
||||
tools:text="RRN:233001786242" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Arrow Icon -->
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:src="@drawable/ic_right_arrow"
|
||||
app:tint="@color/white"
|
||||
android:alpha="0.6"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</layout>
|
||||
63
app/src/main/res/layout/item_qr_pay_button.xml
Normal file
63
app/src/main/res/layout/item_qr_pay_button.xml
Normal file
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
<import type="com.utsmm.kbz.R"/>
|
||||
<import type="com.utsmm.kbz.util.enums.FeaturesType" />
|
||||
<variable
|
||||
name="text"
|
||||
type="String" />
|
||||
<variable
|
||||
name="icon"
|
||||
type="Integer" />
|
||||
</data>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/btnItem"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="180dp"
|
||||
android:layout_margin="8dp"
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="6dp"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/primary_card_bg"
|
||||
android:padding="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnIcon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:srcUrl="@{icon}"
|
||||
app:tint="@color/white"
|
||||
tools:tint="@color/white"
|
||||
tools:src="@drawable/ic_sale" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/rubik_medium"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:text="@{text}"
|
||||
android:gravity="center"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</layout>
|
||||
160
app/src/main/res/layout/item_qr_refund.xml
Normal file
160
app/src/main/res/layout/item_qr_refund.xml
Normal file
@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
>
|
||||
|
||||
<data>
|
||||
<import type="com.utsmyanmar.paylibs.utils.POSUtil"/>
|
||||
<variable
|
||||
name="payDetail"
|
||||
type="com.utsmyanmar.paylibs.model.PayDetail" />
|
||||
<variable
|
||||
name="onItemClick"
|
||||
type="com.utsmm.kbz.ui.qr_pay.QRRefundFragment.ClickEvent" />
|
||||
</data>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="4dp"
|
||||
android:layout_marginVertical="6dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="@color/colorPrimary"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:onClick="@{() -> onItemClick.onCancel()}">
|
||||
|
||||
<!-- Card with border -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:background="@drawable/bg_edittext_primary_border"
|
||||
android:orientation="horizontal"
|
||||
android:padding="16dp">
|
||||
|
||||
<!-- Transaction Icon -->
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_custom_pos"
|
||||
app:tint="@color/white"
|
||||
android:alpha="0.8"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_gravity="top" />
|
||||
|
||||
<!-- Transaction Details -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Transaction Type and Amount Row -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
<!-- Transaction Type -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@{POSUtil.getInstance().getTransName(payDetail)}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
tools:text="SALE" />
|
||||
|
||||
<!-- Transaction Amount -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{POSUtil.getInstance().checkMinusSign(payDetail.transactionType)+POSUtil.getInstance().getDecimalAmountSeparatorFormat(payDetail.amount) + ` `+POSUtil.getInstance().currencyCodeToText(payDetail.currencyCode)}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
tools:text="1,000.00 MMK" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Transaction Date -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{POSUtil.getInstance().convertDateFormatByDateString(payDetail.transDate)}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
android:alpha="0.8"
|
||||
android:fontFamily="sans-serif"
|
||||
android:layout_marginBottom="6dp"
|
||||
tools:text="2022-11-26" />
|
||||
|
||||
<!-- Card Number -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{POSUtil.getInstance().getCardNumMasking(payDetail.cardNo)}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
android:alpha="0.8"
|
||||
android:fontFamily="monospace"
|
||||
android:layout_marginBottom="8dp"
|
||||
tools:text="468785******9564" />
|
||||
|
||||
<!-- Trace and RRN Row -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- Trace Number -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:isTrace="@{payDetail}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp"
|
||||
android:alpha="0.7"
|
||||
android:fontFamily="monospace"
|
||||
tools:text="TRC:000050" />
|
||||
|
||||
<!-- RRN -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@{`RRN:`+payDetail.referNo}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp"
|
||||
android:alpha="0.7"
|
||||
android:fontFamily="monospace"
|
||||
android:textAlignment="textEnd"
|
||||
tools:text="RRN:233001786242" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Arrow Icon -->
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:src="@drawable/ic_right_arrow"
|
||||
app:tint="@color/white"
|
||||
android:alpha="0.6"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</layout>
|
||||
@ -141,6 +141,9 @@
|
||||
<action
|
||||
android:id="@+id/action_nav_main_to_QRConnectingFragment"
|
||||
app:destination="@id/QRConnectingFragment" />
|
||||
<action
|
||||
android:id="@+id/action_nav_main_to_qrFragment"
|
||||
app:destination="@id/qrFragment" />
|
||||
<action
|
||||
app:launchSingleTop="true"
|
||||
app:popUpTo="@+id/nav_main"
|
||||
@ -186,6 +189,12 @@
|
||||
app:popUpToInclusive="true"
|
||||
android:id="@+id/action_cardWaitingFragment_to_nav_main"
|
||||
app:destination="@id/nav_main" />
|
||||
<action
|
||||
android:id="@+id/action_cardWaitingFragment_to_pinPadFragment"
|
||||
app:launchSingleTop="true"
|
||||
app:popUpTo="@+id/cardWaitingFragment"
|
||||
app:popUpToInclusive="true"
|
||||
app:destination="@id/pinPadFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
tools:layout="@layout/fragment_emv_input_pin"
|
||||
@ -332,6 +341,18 @@
|
||||
app:popUpToInclusive="true"
|
||||
android:id="@+id/action_inputPasswordFragment_to_inputTraceFragment"
|
||||
app:destination="@id/inputTraceFragment" />
|
||||
<action
|
||||
app:launchSingleTop="true"
|
||||
app:popUpTo="@+id/inputPasswordFragment"
|
||||
app:popUpToInclusive="true"
|
||||
android:id="@+id/action_inputPasswordFragment_to_qrRefundList"
|
||||
app:destination="@id/qrRefundList" />
|
||||
<action
|
||||
app:launchSingleTop="true"
|
||||
app:popUpTo="@+id/inputPasswordFragment"
|
||||
app:popUpToInclusive="true"
|
||||
android:id="@+id/action_inputPasswordFragment_to_QRRefundProcessFragment"
|
||||
app:destination="@id/QRRefundProcessFragment" />
|
||||
|
||||
</fragment>
|
||||
|
||||
@ -1070,6 +1091,98 @@
|
||||
android:id="@+id/action_receiptFragment_to_nav_main"
|
||||
app:destination="@id/nav_main" />
|
||||
</fragment>
|
||||
<!-- qr menu-->
|
||||
<fragment
|
||||
android:id="@+id/qrFragment"
|
||||
tools:layout="@layout/fragment_qr_pay"
|
||||
android:name="com.utsmm.kbz.ui.qr_pay.QRPayFragment"
|
||||
android:label="QRPayFragment" >
|
||||
<action
|
||||
android:id="@+id/action_qrFragment_to_inputAmountFragment"
|
||||
app:destination="@id/inputAmountFragment" />
|
||||
<action
|
||||
android:id="@+id/action_qrFragment_to_qrHistory"
|
||||
app:destination="@id/reprintAnyTransactionFragment"
|
||||
/>
|
||||
<action
|
||||
android:id="@+id/action_qrFragment_to_qr_refund_list"
|
||||
app:destination="@id/qrRefundList"
|
||||
/>
|
||||
<action
|
||||
app:launchSingleTop="true"
|
||||
app:popUpTo="@+id/fragment_qr_pay"
|
||||
app:popUpToInclusive="true"
|
||||
android:id="@+id/action_qrFragment_to_inputPasswordFragment"
|
||||
app:destination="@id/inputPasswordFragment" />
|
||||
</fragment>
|
||||
|
||||
<!-- <fragment-->
|
||||
<!-- android:id="@+id/qrHistory"-->
|
||||
<!-- tools:layout="@layout/fragment_qr_history"-->
|
||||
<!-- android:name="com.utsmm.kbz.ui.qr_pay.QRHistoryFragment"-->
|
||||
<!-- >-->
|
||||
<!-- </fragment>-->
|
||||
<fragment
|
||||
android:id="@+id/qrRefundList"
|
||||
tools:layout="@layout/fragment_qr_refund"
|
||||
android:name="com.utsmm.kbz.ui.qr_pay.QRRefundFragment"
|
||||
>
|
||||
<action
|
||||
android:id="@+id/action_qrRefundList_to_qrRefundDetail"
|
||||
app:destination="@id/qrRefundDetail"
|
||||
/>
|
||||
<action
|
||||
app:launchSingleTop="true"
|
||||
app:popUpTo="@+id/QRRefundPasswordFragment"
|
||||
app:popUpToInclusive="true"
|
||||
android:id="@+id/action_qrRefundPasswordFragment_to_inputPasswordFragment"
|
||||
app:destination="@id/inputPasswordFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/qrRefundDetail"
|
||||
tools:layout="@layout/fragment_qr_refund_detail"
|
||||
android:name="com.utsmm.kbz.ui.qr_pay.QRRefundDetailFragment"
|
||||
>
|
||||
<action
|
||||
android:id="@+id/action_QRRefundDetail_to_transactionResultFragment"
|
||||
app:destination="@id/transactionResultFragment" />
|
||||
<action
|
||||
app:launchSingleTop="true"
|
||||
app:popUpToInclusive="true"
|
||||
app:popUpTo="@id/mobile_navigation"
|
||||
android:id="@+id/action_QRRefundDetail_to_nav_main"
|
||||
app:destination="@id/nav_main" />
|
||||
<!-- <action-->
|
||||
<!-- app:launchSingleTop="true"-->
|
||||
<!-- app:popUpTo="@+id/QRRefundFragment"-->
|
||||
<!-- app:popUpToInclusive="true"-->
|
||||
<!-- android:id="@+id/action_qrRefundDetail_to_inputAmountFragment"-->
|
||||
<!-- app:destination="@id/inputAmountFragment" />-->
|
||||
<action
|
||||
app:launchSingleTop="true"
|
||||
app:popUpTo="@+id/qrRefundDetail"
|
||||
app:popUpToInclusive="true"
|
||||
android:id="@+id/action_QRRefundDetail_to_inputPasswordFragment"
|
||||
app:destination="@id/inputPasswordFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
tools:layout="@layout/fragment_qr_refund_process"
|
||||
android:id="@+id/QRRefundProcessFragment"
|
||||
android:name="com.utsmm.kbz.ui.qr_pay.QRRefundProcessFragment"
|
||||
android:label="QRRefundProcessFragment" >
|
||||
<action
|
||||
app:launchSingleTop="true"
|
||||
app:popUpTo="@+id/QRRefundProcessFragment"
|
||||
app:popUpToInclusive="true"
|
||||
android:id="@+id/action_QRRefundProcessFragment_to_transactionResultFragment"
|
||||
app:destination="@id/transactionResultFragment" />
|
||||
<action
|
||||
app:launchSingleTop="true"
|
||||
app:popUpTo="@+id/QRRefundProcessFragment"
|
||||
app:popUpToInclusive="true"
|
||||
android:id="@+id/action_QRRefundProcessFragment_to_nav_main"
|
||||
app:destination="@id/nav_main" />
|
||||
</fragment>
|
||||
|
||||
|
||||
</navigation>
|
||||
@ -362,6 +362,7 @@
|
||||
<string name="alert_sound_title">Alert Sound</string>
|
||||
<string name="title_echo">Echo Test</string>
|
||||
<string name="txt_processing_card">Processing card, please wait...</string>
|
||||
<string name="txt_processing_refund">Processing refund, please wait...</string>
|
||||
<string name="title_processing_card">Processing Card</string>
|
||||
<string name="title_log_on">Log-On</string>
|
||||
<string name="title_log_off">Log-Off</string>
|
||||
|
||||
@ -149,4 +149,10 @@ public interface PayDetailDao {
|
||||
@Query("SELECT * FROM paydetail ORDER BY PID DESC")
|
||||
LiveData<List<PayDetail>> getAllTrans();
|
||||
|
||||
@Query("SELECT * FROM paydetail WHERE transactionType = 20 ORDER BY PID DESC")
|
||||
LiveData<List<PayDetail>> getAllQRHistory();
|
||||
|
||||
@Query("SELECT * FROM paydetail WHERE transactionType = 20 AND qrTransStatus = 1 AND isCanceled = 0 ORDER BY PID DESC")
|
||||
LiveData<List<PayDetail>> getRefundableQRHistory();
|
||||
|
||||
}
|
||||
|
||||
@ -226,4 +226,8 @@ public class Repository {
|
||||
}
|
||||
|
||||
public LiveData<List<PayDetail>> getAllTrans() { return payDetailDao.getAllTrans(); }
|
||||
|
||||
public LiveData<List<PayDetail>> getAllQRHistory(){ return payDetailDao.getAllQRHistory();}
|
||||
|
||||
public LiveData<List<PayDetail>> getRefundableQRHistory(){ return payDetailDao.getRefundableQRHistory(); }
|
||||
}
|
||||
|
||||
@ -564,6 +564,8 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
|
||||
mHandler.obtainMessage(PIN_TIME_OUT,-7009).sendToTarget();
|
||||
} else if (retCode == SdkResult.PinPad_No_Pin_Input) {
|
||||
mHandler.obtainMessage(PIN_CLICK_CONFIRM).sendToTarget();
|
||||
} else {
|
||||
mHandler.obtainMessage(PIN_ERROR).sendToTarget();
|
||||
}
|
||||
|
||||
LogUtil.d(TAG, "RetCode:" + retCode);
|
||||
@ -631,24 +633,6 @@ public abstract class EmvBaseViewModel extends BaseViewModel {
|
||||
++pinEnterCount;
|
||||
}
|
||||
|
||||
private void keyMap(String str, PinPadDataV2 data) {
|
||||
data.keyMap = new byte[64];
|
||||
for (int i = 0, j = 0; i < 15; i++, j++) {
|
||||
if (i == 9 || i == 12) { // || i == 12
|
||||
data.keyMap[i] = 0x1B;//cancel
|
||||
j--;
|
||||
} else if (i == 13) { //10
|
||||
data.keyMap[i] = 0x0C;//clear
|
||||
j--;
|
||||
} else if (i == 11 || i == 14) { // || i == 14
|
||||
data.keyMap[i] = 0x0D;//confirm
|
||||
j--;
|
||||
} else {
|
||||
data.keyMap[i] = (byte) str.charAt(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private OnEmvProcessListener2 emvProcessListener = new OnEmvProcessListener2() {
|
||||
@Override
|
||||
|
||||
@ -17,7 +17,8 @@ public abstract class BaseISOMsgX {
|
||||
|
||||
byte[] newSendBytes = EncodePackage.assembly(map, msgIdentifier, 0, "0000000000",hostName);
|
||||
|
||||
String BPCTPDU = "6005150000";
|
||||
// String BPCTPDU = "6005150000"; //UAT
|
||||
String BPCTPDU = "6005170000"; //PrePro
|
||||
|
||||
if(isoMode == ISOMode.BOTH_HEADER_TPDU) {
|
||||
byte[] outBytes = new byte[newSendBytes.length - 6 ];
|
||||
|
||||
@ -12,16 +12,17 @@ import com.utsmyanmar.paylibs.model.MAGCardInfo;
|
||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||
import com.utsmyanmar.paylibs.model.TradeData;
|
||||
import com.utsmyanmar.paylibs.utils.CardSchemeUtils;
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
import com.utsmyanmar.paylibs.utils.TLV;
|
||||
import com.utsmyanmar.paylibs.utils.enums.CardScheme;
|
||||
|
||||
import org.bouncycastle.pqc.math.linearalgebra.ByteUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||
|
||||
public class KernelDataProcessUtil {
|
||||
|
||||
@ -32,7 +33,7 @@ public class KernelDataProcessUtil {
|
||||
Map<String, TLV> tlvMap = TLVUtil.buildTLVMap(data);
|
||||
com.sunmi.pay.hardware.aidl.bean.CardInfo cardInfo = new com.sunmi.pay.hardware.aidl.bean.CardInfo();
|
||||
|
||||
LogUtil.d(TAG,"EMV Track data : "+ByteUtil.bytes2HexStr(data));
|
||||
LogUtil.d(TAG, "EMV Track data : " + ByteUtil.bytes2HexStr(data));
|
||||
|
||||
// Two magnetic
|
||||
TLV tlv = tlvMap.get("57");
|
||||
@ -40,10 +41,10 @@ public class KernelDataProcessUtil {
|
||||
String value = tlv.getValue().toUpperCase();
|
||||
cardInfo = Track2Util.parseTrack2(value);
|
||||
// cardInfo.track2=value;
|
||||
LogUtil.d(TAG,"57 track:"+value);
|
||||
LogUtil.d(TAG, "57 track:" + value);
|
||||
cardInfo.track2 = value.replaceAll("F", ""); // Edited "0" with "" 20,Nov,2024
|
||||
|
||||
LogUtil.d(TAG,"57 track:"+cardInfo.track2);
|
||||
LogUtil.d(TAG, "57 track:" + cardInfo.track2);
|
||||
}
|
||||
// IC card obtains the card number and expiration date through 5A and 5F24
|
||||
if (AidlConstants.CardType.IC.getValue() == cardType) {
|
||||
@ -67,7 +68,6 @@ public class KernelDataProcessUtil {
|
||||
}
|
||||
LogUtil.d(Constant.TAG, "The card is valid for:" + value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Card serial number
|
||||
@ -94,7 +94,7 @@ public class KernelDataProcessUtil {
|
||||
cardInfo = Track2Util.parseTrack2(value);
|
||||
cardInfo.track2 = value.replaceAll("F", "0"); // edited " " with "0"
|
||||
|
||||
LogUtil.d(TAG,"9F6B track:"+cardInfo.track2);
|
||||
LogUtil.d(TAG, "9F6B track:" + cardInfo.track2);
|
||||
}
|
||||
|
||||
cardInfo.cardType = cardType;
|
||||
@ -125,7 +125,11 @@ public class KernelDataProcessUtil {
|
||||
if (track2 != null && track2.length() > 0) {
|
||||
magCardInfo.setTrack2(track2);
|
||||
String track2Encrypt = TrackEncrypt.trackEncrypt(track2);
|
||||
track2Encrypt = track2Encrypt.replace("=","D");
|
||||
// /*
|
||||
// * comment this line cuz mastercard network validation is getting failure
|
||||
// * */
|
||||
track2Encrypt = track2Encrypt.replace("=", "D");
|
||||
|
||||
|
||||
magCardInfo.setTrack2Cipher(track2Encrypt);
|
||||
}
|
||||
@ -231,7 +235,7 @@ public class KernelDataProcessUtil {
|
||||
// if(value.equals("554E494F4E504159204445424954")){
|
||||
// payDetail.setCardHolderName("UNIONPAY");
|
||||
// }else{
|
||||
LogUtil.d(TAG,"App Label 50 : "+Utils.hexStr2AsciiStr(value));
|
||||
LogUtil.d(TAG, "App Label 50 : " + Utils.hexStr2AsciiStr(value));
|
||||
|
||||
icCardInfo.setAppLabel(Utils.hexStr2AsciiStr(value));
|
||||
payDetail.setAppLabel(Utils.hexStr2AsciiStr(value));
|
||||
@ -246,7 +250,7 @@ public class KernelDataProcessUtil {
|
||||
String value = tlv.getValue();
|
||||
icCardInfo.setAppName(value);
|
||||
payDetail.setAppName(value);
|
||||
LogUtil.d(TAG,"App Name : "+value);
|
||||
LogUtil.d(TAG, "App Name : " + value);
|
||||
}
|
||||
|
||||
// TVR Terminal verification result
|
||||
@ -530,14 +534,22 @@ public class KernelDataProcessUtil {
|
||||
// Cardholder verification method result CVM
|
||||
if (tlvMap.get("9F34") != null) {
|
||||
f55DataStr += "9F3403" + tlvMap.get("9F34").getValue();
|
||||
if(tlvMap.get("9F34").getValue() != null && !tlvMap.get("9F34").getValue().isEmpty()) {
|
||||
if (tlvMap.get("9F34").getValue() != null && !tlvMap.get("9F34").getValue().isEmpty()) {
|
||||
f55WaveDataStr += "9F3403" + tlvMap.get("9F34").getValue();
|
||||
}
|
||||
// f55WaveDataStr += "9F3403020200" ;
|
||||
}
|
||||
// f55DataStr += "9F34031F0302";
|
||||
// TSI Transaction status information
|
||||
if (tlvMap.get("9B") != null && !tlvMap.get("9B").getValue().isEmpty()) {
|
||||
|
||||
|
||||
f55DataStr += "9B02" + tlvMap.get("9B").getValue();
|
||||
f55WaveDataStr += "9B02" + tlvMap.get("9B").getValue();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// terminal type
|
||||
if (tlvMap.get("9F35") != null) {
|
||||
f55DataStr += "9F3501" + tlvMap.get("9F35").getValue();
|
||||
@ -563,8 +575,8 @@ public class KernelDataProcessUtil {
|
||||
// need to keeps or not?
|
||||
if (tlvMap.get("9F41") != null) {
|
||||
int length = tlvMap.get("9F41").getLength();
|
||||
f55DataStr += "9F41" + String.format("%02d", length-1) + tlvMap.get("9F41").getValue().substring(2,8);
|
||||
f55WaveDataStr += "9F41" + String.format("%02d", length-1) + tlvMap.get("9F41").getValue().substring(2,8);
|
||||
f55DataStr += "9F41" + String.format("%02d", length - 1) + tlvMap.get("9F41").getValue().substring(2, 8);
|
||||
f55WaveDataStr += "9F41" + String.format("%02d", length - 1) + tlvMap.get("9F41").getValue().substring(2, 8);
|
||||
} else {
|
||||
String batchNumStart = SystemParamsOperation.getInstance().getSystemParamsSettings().getBatchNumStart();
|
||||
try {
|
||||
@ -576,29 +588,15 @@ public class KernelDataProcessUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/* if (tlvMap.get("4F") != null) {
|
||||
tlv = tlvMap.get("4F");
|
||||
String value = tlv.getValue();
|
||||
int length = tlv.getLength();
|
||||
String len = getHexLen(length);
|
||||
f55DataStr += "4F" + len + value;
|
||||
}
|
||||
|
||||
if (tlvMap.get("9F08") != null) {
|
||||
tlv = tlvMap.get("9F08");
|
||||
String value = tlv.getValue();
|
||||
int length = tlv.getLength();
|
||||
String len = getHexLen(length);
|
||||
f55DataStr += "9F08" + len + value;
|
||||
}*/
|
||||
|
||||
/*
|
||||
* merchant category code
|
||||
* */
|
||||
// disabled at 18/ July 2025
|
||||
// if(tlvMap.get("9F53") !=null){
|
||||
// f55DataStr += "9F5301"+ tlvMap.get("9F53").getValue();
|
||||
// }
|
||||
if (tlvMap.get("9F53") != null) {
|
||||
f55DataStr += "9F5301" + tlvMap.get("9F53").getValue();
|
||||
} else {
|
||||
f55DataStr += "9F530150";
|
||||
}
|
||||
|
||||
// else{
|
||||
//// f55DataStr += "9F530152";
|
||||
@ -659,53 +657,62 @@ public class KernelDataProcessUtil {
|
||||
if (cardType == AidlConstants.CardType.IC.getValue()) {
|
||||
icCardInfo.setICC55(f55DataStr);
|
||||
payDetail.setICC55(f55DataStr);
|
||||
LogUtil.d(TAG,"DE55 IC: "+f55DataStr);
|
||||
LogUtil.d(TAG, "DE55 IC: " + f55DataStr);
|
||||
} else {
|
||||
String[] tagList = {
|
||||
"9F6E"
|
||||
};
|
||||
|
||||
String hexStr = "";
|
||||
byte[] dataOut = new byte[1024];
|
||||
|
||||
try {
|
||||
int len = PayLibsUtils.getInstance().emvOptV2.getTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_PAYWAVE, tagList, dataOut);
|
||||
if (len > 0) {
|
||||
byte[] dataOutBytes = Arrays.copyOf(dataOut, len);
|
||||
hexStr = ByteUtil.bytes2HexStr(dataOutBytes);
|
||||
LogUtil.d(TAG, "get 9F6E Data :" + hexStr);
|
||||
Map<String, TLV> map = TLVUtil.buildTLVMap(hexStr);
|
||||
LogUtil.d(TAG, "get 9F6E Data :" + map);
|
||||
|
||||
} else {
|
||||
LogUtil.e(TAG, "Get the data length of payWave is negative = " + len);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (tlvMap.get("9F6E") != null) {
|
||||
int length = tlvMap.get("9F6E").getLength();
|
||||
String len = getHexLen(length);
|
||||
f55WaveDataStr += "9F6E" + len + tlvMap.get("9F6E").getValue();
|
||||
}
|
||||
|
||||
if (hexStr.equals("9F6E00")) {
|
||||
try {
|
||||
int len = PayLibsUtils.getInstance().emvOptV2.getTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_PAYPASS, tagList, dataOut);
|
||||
if (len > 0) {
|
||||
byte[] dataOutBytes = Arrays.copyOf(dataOut, len);
|
||||
hexStr = ByteUtil.bytes2HexStr(dataOutBytes);
|
||||
LogUtil.d(TAG, "get 9F6E Data :" + hexStr);
|
||||
Map<String, TLV> map = TLVUtil.buildTLVMap(hexStr);
|
||||
LogUtil.d(TAG, "get 9F6E Data :" + map);
|
||||
|
||||
} else {
|
||||
LogUtil.e(TAG, "Get the data length of payPass is negative = " + len);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if(!hexStr.equals("9F6E00")) {
|
||||
f55WaveDataStr += hexStr;
|
||||
}
|
||||
LogUtil.d(TAG,"9F6E data :"+hexStr);
|
||||
// byte[] dataOut = new byte[1024];
|
||||
//
|
||||
// try {
|
||||
// int len = PayLibsUtils.getInstance().emvOptV2.getTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_PAYWAVE, tagList, dataOut);
|
||||
// if (len > 0) {
|
||||
// byte[] dataOutBytes = Arrays.copyOf(dataOut, len);
|
||||
// hexStr = ByteUtil.bytes2HexStr(dataOutBytes);
|
||||
// LogUtil.d(TAG, "get 9F6E Data :" + hexStr);
|
||||
// Map<String, TLV> map = TLVUtil.buildTLVMap(hexStr);
|
||||
// LogUtil.d(TAG, "get 9F6E Data :" + map);
|
||||
//
|
||||
// } else {
|
||||
// LogUtil.e(TAG, "Get the data length of payWave is negative = " + len);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// if (hexStr.equals("9F6E00")) {
|
||||
// try {
|
||||
// int len = PayLibsUtils.getInstance().emvOptV2.getTlvList(AidlConstantsV2.EMV.TLVOpCode.OP_PAYPASS, tagList, dataOut);
|
||||
// if (len > 0) {
|
||||
// byte[] dataOutBytes = Arrays.copyOf(dataOut, len);
|
||||
// hexStr = ByteUtil.bytes2HexStr(dataOutBytes);
|
||||
// LogUtil.d(TAG, "get 9F6E Data :" + hexStr);
|
||||
// Map<String, TLV> map = TLVUtil.buildTLVMap(hexStr);
|
||||
// LogUtil.d(TAG, "get 9F6E Data :" + map);
|
||||
//
|
||||
// } else {
|
||||
// LogUtil.e(TAG, "Get the data length of payPass is negative = " + len);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// if (!hexStr.equals("9F6E00")) {
|
||||
// f55WaveDataStr += hexStr;
|
||||
// }
|
||||
icCardInfo.setICC55(f55WaveDataStr);
|
||||
payDetail.setICC55(f55WaveDataStr);
|
||||
LogUtil.d(TAG,"DE55 kpay: "+f55WaveDataStr);
|
||||
LogUtil.d(TAG, "DE55 wave: " + f55WaveDataStr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -395,9 +395,9 @@ public class SystemParamsOperation {
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
public void setWavePayInquiryStatus(boolean status) {
|
||||
public void setQRPayInquiryStatus(boolean status) {
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
params.setWavePayInquiryStatus(status);
|
||||
params.setQRPayInquiryStatus(status);
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
@ -423,9 +423,9 @@ public class SystemParamsOperation {
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
public boolean getWavePayInquiryStatus() {
|
||||
public boolean getQRPayInquiryStatus() {
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
return params.getWavePayInquiryStatus();
|
||||
return params.getQRPayInquiryStatus();
|
||||
}
|
||||
|
||||
public void setNfcEnabled(boolean status) {
|
||||
@ -478,9 +478,9 @@ public class SystemParamsOperation {
|
||||
return params.isFallbackEnabled();
|
||||
}
|
||||
|
||||
public void setWavePayStatus(boolean status) {
|
||||
public void setQRPayStatus(boolean status) {
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
params.setWavePayStatus(status);
|
||||
params.setQRPayStatus(status);
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
@ -494,9 +494,9 @@ public class SystemParamsOperation {
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
return params.isDecimal_enable();
|
||||
}
|
||||
public boolean getWavePayStatus() {
|
||||
public boolean getQRPayStatus() {
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
return params.getWavePayStatus();
|
||||
return params.getQRPayStatus();
|
||||
}
|
||||
|
||||
public boolean getTipsAdjustmentStatus() {
|
||||
@ -701,6 +701,28 @@ public class SystemParamsOperation {
|
||||
return params.isEmvEnabled();
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
return params.getAppId();
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
params.setAppId(appId);
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
public String getAppKey() {
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
return params.getAppKey();
|
||||
}
|
||||
|
||||
public void setAppKey(String appKey) {
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
params.setAppKey(appKey);
|
||||
saveSystemParamsSettings(params);
|
||||
}
|
||||
|
||||
public String getComp1(){
|
||||
SystemParamsSettings params = getSystemParamsSettings();
|
||||
return params.getComp1();
|
||||
|
||||
@ -129,6 +129,10 @@ public class SystemParamsSettings implements Serializable {
|
||||
|
||||
private String lastSuccessTranx = "000001";
|
||||
|
||||
private String appId = "";
|
||||
|
||||
private String appKey = "";
|
||||
|
||||
private int fallbackCounter = 2;
|
||||
|
||||
private long jCbCVMLimit = 75000;
|
||||
@ -177,7 +181,7 @@ public class SystemParamsSettings implements Serializable {
|
||||
|
||||
private boolean cvv_bypass_status = false;
|
||||
|
||||
private boolean wave_pay_inquiry_status = true;
|
||||
private boolean qrpay_inquiry_status = true;
|
||||
|
||||
private boolean tips_adjustment_status = true;
|
||||
|
||||
@ -187,7 +191,7 @@ public class SystemParamsSettings implements Serializable {
|
||||
|
||||
private boolean refund_status = true;
|
||||
|
||||
private boolean wave_status = true;
|
||||
private boolean qrpay_status = true;
|
||||
|
||||
private boolean full_void_preauth_status = true;
|
||||
|
||||
@ -285,6 +289,22 @@ public class SystemParamsSettings implements Serializable {
|
||||
this.disabledMessage = disabledMessage;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public void setAppKey(String appKey) {
|
||||
this.appKey = appKey;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public String getAppKey() {
|
||||
return appKey;
|
||||
}
|
||||
|
||||
protected void setjCbCVMLimit(long amount) {
|
||||
this.jCbCVMLimit = amount;
|
||||
}
|
||||
@ -369,8 +389,8 @@ public class SystemParamsSettings implements Serializable {
|
||||
return ecrKey;
|
||||
}
|
||||
|
||||
protected void setWavePayInquiryStatus(boolean status) {
|
||||
this.wave_pay_inquiry_status = status;
|
||||
protected void setQRPayInquiryStatus(boolean status) {
|
||||
this.qrpay_inquiry_status = status;
|
||||
}
|
||||
|
||||
protected String getTerminalCapability() { return terminalCapability;}
|
||||
@ -403,11 +423,11 @@ public class SystemParamsSettings implements Serializable {
|
||||
protected void setRandomPinPad(boolean randomPinPad) { this.isRandomPinPad = randomPinPad;}
|
||||
|
||||
protected boolean isRandomPinPad() { return isRandomPinPad; }
|
||||
protected void setWavePayStatus(boolean status) {
|
||||
this.wave_status = status;
|
||||
protected void setQRPayStatus(boolean status) {
|
||||
this.qrpay_status = status;
|
||||
}
|
||||
|
||||
protected boolean getWavePayStatus() { return wave_status; }
|
||||
protected boolean getQRPayStatus() { return qrpay_status; }
|
||||
|
||||
protected boolean isAutoPrintCustomerCopy() {
|
||||
return isAutoPrintCustomerCopy;
|
||||
@ -415,8 +435,8 @@ public class SystemParamsSettings implements Serializable {
|
||||
|
||||
protected void setAutoPrintCustomerCopy(boolean flag) { this.isAutoPrintCustomerCopy = flag; }
|
||||
|
||||
protected boolean getWavePayInquiryStatus() {
|
||||
return wave_pay_inquiry_status;
|
||||
protected boolean getQRPayInquiryStatus() {
|
||||
return qrpay_inquiry_status;
|
||||
}
|
||||
|
||||
protected void setTipsAdjustmentStatus(boolean status) {
|
||||
|
||||
@ -24,7 +24,8 @@ public class BitmapConfig {
|
||||
|
||||
public static final String FUND_TRANSFER = "7024048020801080";
|
||||
|
||||
public static final String CASH_ADVANCE = "7024048020801000";
|
||||
// public static final String CASH_ADVANCE = "7024048020801000";
|
||||
public static final String CASH_ADVANCE = "7020048020801000"; // removed DE 14
|
||||
// 7020048000808000
|
||||
|
||||
public static final String SIGN_ON = "2020000000800000";
|
||||
@ -58,7 +59,8 @@ public class BitmapConfig {
|
||||
// public static final String BPC_SALE = "3230058020C09000"; // original
|
||||
// public static final String BPC_SALE = "3230058020C09A00"; // for emv
|
||||
// public static final String BPC_SALE = "7234058020C19A00"; // DUKPT
|
||||
public static final String BPC_SALE = "7234058020C19200"; // TMK
|
||||
// public static final String BPC_SALE = "7234058020C19200"; // TMK
|
||||
public static final String BPC_SALE = "7230058020C19200"; // TMK no DE 14
|
||||
// public static final String BPC_SALE = "7230058020C19A00"; // also for manual
|
||||
// public static final String BPC_SALE = "7230058020C09A00"; // also for manual , also added DE48
|
||||
|
||||
@ -88,19 +90,22 @@ public class BitmapConfig {
|
||||
// commented on Nov 13,2024
|
||||
// public static final String BPC_PRE_AUTH_SALE = "3230058020C09800";
|
||||
// public static final String BPC_PRE_AUTH_SALE = "3230058020C09A00";
|
||||
public static final String BPC_PRE_AUTH_SALE = "7230058020C09A00"; // for manual
|
||||
// public static final String BPC_PRE_AUTH_SALE = "7230058020C09A00"; // for manual
|
||||
public static final String BPC_PRE_AUTH_SALE = "7230058020C09200"; // for tmk
|
||||
|
||||
// public static final String BPC_PRE_AUTH_SALE_COMPLETE = "7230058028C09000";
|
||||
// public static final String BPC_PRE_AUTH_SALE_COMPLETE = "3230058020C09000";
|
||||
|
||||
// commented on Nov 13, 2024
|
||||
// public static final String BPC_PRE_AUTH_SALE_COMPLETE = "3230058028C09800";
|
||||
public static final String BPC_PRE_AUTH_SALE_COMPLETE = "3230058028C09A00";
|
||||
// public static final String BPC_PRE_AUTH_SALE_COMPLETE = "3230058028C09A00";
|
||||
public static final String BPC_PRE_AUTH_SALE_COMPLETE = "3230058028C09200"; // for tmk
|
||||
|
||||
// public static final String BPC_PRE_AUTH_SALE_VOID_REVERSAL = "7230058028C09000";
|
||||
|
||||
// commented on Nov 13,2024
|
||||
public static final String BPC_PRE_AUTH_SALE_VOID_REVERSAL = "7230058028C19800"; // added DE 2
|
||||
// public static final String BPC_PRE_AUTH_SALE_VOID_REVERSAL = "7230058028C19800"; // added DE 2
|
||||
public static final String BPC_PRE_AUTH_SALE_VOID_REVERSAL = "7234058008C09000"; // for tmk MPU
|
||||
// public static final String BPC_PRE_AUTH_SALE_VOID_REVERSAL = "3230058028C19800";
|
||||
// public static final String BPC_PRE_AUTH_SALE_VOID_REVERSAL = "3230058028C19A00"; //DE55
|
||||
//
|
||||
@ -122,7 +127,8 @@ public class BitmapConfig {
|
||||
public static final String BPC_TIP_ADJUSTMENTS = "723005802CC08000";
|
||||
|
||||
// public static final String BPC_BATCH_UPLOAD = "7234058028C09000";
|
||||
public static final String BPC_BATCH_UPLOAD = "3234058028C08000";
|
||||
// public static final String BPC_BATCH_UPLOAD = "3234058028C08000";
|
||||
public static final String BPC_BATCH_UPLOAD = "3230058028C08000"; //removed de 14
|
||||
|
||||
|
||||
public static final String BPC_NETWORK_CUT_OVER = "2220010000C00000";
|
||||
|
||||
@ -3,7 +3,7 @@ package com.utsmyanmar.paylibs.utils.iso_utils;
|
||||
public enum TransactionsType {
|
||||
SALE("SALE",1,"000000"),
|
||||
|
||||
VOID("VOID SALE",2,"200000"), //020000
|
||||
VOID("VOID SALE",2,"020000"), //200000
|
||||
|
||||
SETTLEMENT("SETTLEMENT",3,"920000"),
|
||||
|
||||
@ -11,7 +11,7 @@ public enum TransactionsType {
|
||||
|
||||
PRE_AUTH_SALE("PRE-AUTH",5,"930000"),
|
||||
|
||||
PRE_AUTH_VOID("PREAUTH CANCELLATION",6,"200000"),
|
||||
PRE_AUTH_VOID("PREAUTH CANCELLATION",6,"020000"), //200000
|
||||
|
||||
PRE_AUTH_COMPLETE("PREAUTH COMPLETION",7,"940000"),
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user