Compare commits
No commits in common. "644df8211db020c3e28aee07a7dc5c90c64b1a90" and "efb0c76f6915135b8d1bf5c0a25d4640d0c0bfdc" have entirely different histories.
644df8211d
...
efb0c76f69
33
.idea/.gitignore
vendored
Normal file
33
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Built files
|
||||||
|
*.apk
|
||||||
|
*.aab
|
||||||
|
*.dex
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
*/build/
|
||||||
|
|
||||||
|
**/build/
|
||||||
|
**/build/**
|
||||||
|
**/.transforms/
|
||||||
|
**/intermediates/
|
||||||
|
**/tmp/
|
||||||
|
paysdk-lib/build/
|
||||||
|
|
||||||
|
# Android Studio
|
||||||
|
*.iml
|
||||||
|
.idea/
|
||||||
|
local.properties
|
||||||
|
|
||||||
|
# Keystore
|
||||||
|
*.jks
|
||||||
|
*.keystore
|
||||||
|
|
||||||
|
# OS files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
*.log
|
||||||
827
.idea/ChatHistory_schema_v3.xml
Normal file
827
.idea/ChatHistory_schema_v3.xml
Normal file
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<bytecodeTargetLevel target="21" />
|
<bytecodeTargetLevel target="17" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@ -4,6 +4,14 @@
|
|||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="app">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<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>
|
</SelectionState>
|
||||||
</selectionStates>
|
</selectionStates>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
<option name="gradleJvm" value="temurin-17" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
|
|||||||
10
.idea/migrations.xml
Normal file
10
.idea/migrations.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectMigrations">
|
||||||
|
<option name="MigrateToGradleLocalJavaHome">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@ -1,4 +1,9 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK" />
|
<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>
|
||||||
</project>
|
</project>
|
||||||
@ -40,9 +40,6 @@ android {
|
|||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
debug {
|
|
||||||
debuggable true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_11
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
|||||||
@ -849,37 +849,37 @@ public class MainFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClickQR(){
|
public void onClickQRPay(){
|
||||||
// navigate to new QR Pay fragment
|
// navigate to new QR Pay fragment
|
||||||
routeId = R.id.action_nav_main_to_qrFragment;
|
routeId = R.id.action_nav_main_to_qrFragment;
|
||||||
safeNavigateToRouteId();
|
safeNavigateToRouteId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClickQRPay() {
|
// public void onClickQRPay() {
|
||||||
|
//
|
||||||
String mmqrIp = SystemParamsOperation.getInstance().getSecHostIpAddress();
|
// String mmqrIp = SystemParamsOperation.getInstance().getSecHostIpAddress();
|
||||||
|
//
|
||||||
if (mainViewModel.payDetailSingle.getValue() != null) {
|
// if (mainViewModel.payDetailSingle.getValue() != null) {
|
||||||
mainViewModel.startReversal(mainViewModel.payDetailSingle.getValue());
|
// mainViewModel.startReversal(mainViewModel.payDetailSingle.getValue());
|
||||||
}
|
// }
|
||||||
// else if (TMSUtil.getInstance().checkSecHostParams().isStatus() == ValidityStatus.FAILURE) {
|
//// else if (TMSUtil.getInstance().checkSecHostParams().isStatus() == ValidityStatus.FAILURE) {
|
||||||
// showDeclineDialog(getResourceString(R.string.txt_please_download_config)+"\n"+TMSUtil.getInstance().checkSecHostParams().getMessage());
|
//// 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();
|
||||||
|
//
|
||||||
// }
|
// }
|
||||||
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();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClickSettlement() {
|
public void onClickSettlement() {
|
||||||
|
|
||||||
|
|||||||
@ -142,9 +142,6 @@ public class InputPasswordFragment extends DataBindingFragment implements DataBi
|
|||||||
|
|
||||||
private void checkRoute() {
|
private void checkRoute() {
|
||||||
switch (Objects.requireNonNull(sharedViewModel.transactionsType.getValue())) {
|
switch (Objects.requireNonNull(sharedViewModel.transactionsType.getValue())) {
|
||||||
case MMQR_REFUND:
|
|
||||||
inputPasswordViewModel.passwordType.setValue(InputPasswordType.SYSTEM);
|
|
||||||
break;
|
|
||||||
case PRE_AUTH_COMPLETE_VOID:
|
case PRE_AUTH_COMPLETE_VOID:
|
||||||
inputPasswordViewModel.passwordType.setValue(InputPasswordType.SYSTEM);
|
inputPasswordViewModel.passwordType.setValue(InputPasswordType.SYSTEM);
|
||||||
sharedViewModel.transactionName.postValue(getResourceString(R.string.title_pre_auth_complete));
|
sharedViewModel.transactionName.postValue(getResourceString(R.string.title_pre_auth_complete));
|
||||||
@ -245,11 +242,6 @@ public class InputPasswordFragment extends DataBindingFragment implements DataBi
|
|||||||
if(inputPasswordViewModel.onClickEnter()) {
|
if(inputPasswordViewModel.onClickEnter()) {
|
||||||
clearLiveData();
|
clearLiveData();
|
||||||
|
|
||||||
if(sharedViewModel.transactionsType.getValue() == TransactionsType.MMQR_REFUND){
|
|
||||||
safePopBackStack();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(sharedViewModel.transactionsType.getValue() == TransactionsType.SETTING) {
|
if(sharedViewModel.transactionsType.getValue() == TransactionsType.SETTING) {
|
||||||
mListener.onSuccess();
|
mListener.onSuccess();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
package com.utsmm.kbz.ui.qr_pay;
|
package com.utsmm.kbz.ui.qr_pay;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
@ -18,8 +20,8 @@ public class QRHistoryAdapter extends RecyclerView.Adapter<QRHistoryAdapter.View
|
|||||||
|
|
||||||
private List<PayDetail> items = new ArrayList<>();
|
private List<PayDetail> items = new ArrayList<>();
|
||||||
|
|
||||||
public void setItems(List<PayDetail> data){
|
public void setItems(List<PayDetail> list){
|
||||||
items = data;
|
items = list;
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
package com.utsmm.kbz.ui.qr_pay;
|
package com.utsmm.kbz.ui.qr_pay;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|||||||
@ -16,20 +16,14 @@ import dagger.hilt.android.lifecycle.HiltViewModel;
|
|||||||
public class QRHistoryViewModel extends ViewModel {
|
public class QRHistoryViewModel extends ViewModel {
|
||||||
private final Repository repository;
|
private final Repository repository;
|
||||||
private final LiveData<List<PayDetail>> history;
|
private final LiveData<List<PayDetail>> history;
|
||||||
private final LiveData<List<PayDetail>> refundList;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public QRHistoryViewModel(Repository repository){
|
public QRHistoryViewModel(Repository repository){
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
this.history = repository.getAllQRHistory();
|
this.history = repository.getAllQRHistory();
|
||||||
this.refundList = repository.getRefundableQRHistory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveData<List<PayDetail>> getAllQrHistory(){
|
public LiveData<List<PayDetail>> getAllQrHistory(){
|
||||||
return history;
|
return history;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveData<List<PayDetail>> getRefundableQrHistory(){
|
|
||||||
return refundList;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,8 +10,6 @@ import com.utsmm.kbz.R;
|
|||||||
import com.utsmm.kbz.config.Constants;
|
import com.utsmm.kbz.config.Constants;
|
||||||
import com.utsmm.kbz.ui.adapters.QRPayAdapter;
|
import com.utsmm.kbz.ui.adapters.QRPayAdapter;
|
||||||
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
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.Connectivity;
|
||||||
import com.utsmm.kbz.util.tms.TMSUtil;
|
import com.utsmm.kbz.util.tms.TMSUtil;
|
||||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
@ -20,7 +18,6 @@ import com.utsmyanmar.paylibs.model.PayDetail;
|
|||||||
import com.utsmyanmar.paylibs.utils.POSUtil;
|
import com.utsmyanmar.paylibs.utils.POSUtil;
|
||||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
import com.utsmyanmar.paylibs.utils.enums.CurrencyType;
|
import com.utsmyanmar.paylibs.utils.enums.CurrencyType;
|
||||||
import com.utsmyanmar.paylibs.utils.enums.HostType;
|
|
||||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -32,10 +29,13 @@ public class QRPayFragment extends DataBindingFragment {
|
|||||||
private SharedViewModel sharedViewModel;
|
private SharedViewModel sharedViewModel;
|
||||||
private static final int hostId = Constants.NAV_HOST_ID;
|
private static final int hostId = Constants.NAV_HOST_ID;
|
||||||
private int routeId;
|
private int routeId;
|
||||||
private static final int currentId = R.id.qrFragment;
|
private static final int currentId = R.id.dashboardTransFragment;
|
||||||
|
|
||||||
|
|
||||||
|
public static QRPayFragment newInstance() {
|
||||||
|
return new QRPayFragment();
|
||||||
|
}
|
||||||
|
|
||||||
|
private QRPayViewModel vm;
|
||||||
private Observer<PayDetail> observeLastTrans;
|
private Observer<PayDetail> observeLastTrans;
|
||||||
private PayDetail lastPay;
|
private PayDetail lastPay;
|
||||||
|
|
||||||
@ -47,6 +47,7 @@ public class QRPayFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initViewModel() {
|
protected void initViewModel() {
|
||||||
|
vm = new ViewModelProvider(this).get(QRPayViewModel.class);
|
||||||
mainViewModel = new ViewModelProvider(requireActivity()).get(MainViewModel.class);
|
mainViewModel = new ViewModelProvider(requireActivity()).get(MainViewModel.class);
|
||||||
sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||||
}
|
}
|
||||||
@ -67,7 +68,7 @@ public class QRPayFragment extends DataBindingFragment {
|
|||||||
onClickQRPay();
|
onClickQRPay();
|
||||||
break;
|
break;
|
||||||
case "Refund":
|
case "Refund":
|
||||||
onClickRefund();
|
|
||||||
break;
|
break;
|
||||||
case "History":
|
case "History":
|
||||||
onClickHistory();
|
onClickHistory();
|
||||||
@ -75,17 +76,11 @@ public class QRPayFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
DataBindingConfig config = new DataBindingConfig(R.layout.fragment_qr_pay, BR.mainViewModel, mainViewModel);
|
DataBindingConfig config = new DataBindingConfig(R.layout.fragment_qr_pay, BR.vm, vm);
|
||||||
config.addBindingParam(BR.adapter, adapter);
|
config.addBindingParam(BR.adapter, adapter);
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ClickEvent {
|
|
||||||
public void onGenerateQRClick() { onClickQRPay(); }
|
|
||||||
public void onRefundClick() { onClickRefund(); }
|
|
||||||
public void onHistoryClick() { onClickHistory(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int currentId() {
|
protected int currentId() {
|
||||||
return currentId;
|
return currentId;
|
||||||
@ -126,21 +121,6 @@ public class QRPayFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onClickHistory(){
|
|
||||||
sharedViewModel.hostType.setValue(HostType.QR);
|
|
||||||
routeId = R.id.action_qrFragment_to_qrHistory;
|
|
||||||
safeNavigateToRouteId();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onClickRefund(){
|
|
||||||
routeId = R.id.action_qrFragment_to_qr_refund_list;
|
|
||||||
safeNavigateToRouteId();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void navigateToAmount() {
|
|
||||||
routeId = R.id.action_qrFragment_to_inputAmountFragment;
|
|
||||||
safeNavigateToRouteId();
|
|
||||||
}
|
|
||||||
private void processBatch() {
|
private void processBatch() {
|
||||||
calculateLastTransaction();
|
calculateLastTransaction();
|
||||||
mainViewModel.observeSettlementPOS();
|
mainViewModel.observeSettlementPOS();
|
||||||
@ -398,5 +378,14 @@ public class QRPayFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void navigateToAmount() {
|
||||||
|
// routeId = R.id.action_nav_main_to_inputAmountFragment;
|
||||||
|
// safeNavigateToRouteId();
|
||||||
|
NavHostFragment.findNavController(this)
|
||||||
|
.navigate(R.id.action_qrFragment_to_inputAmountFragment);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onClickHistory(){
|
||||||
|
NavHostFragment.findNavController(this).navigate(R.id.action_qrFragment_to_qrHistory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,42 +1,17 @@
|
|||||||
package com.utsmm.kbz.ui.qr_pay;
|
package com.utsmm.kbz.ui.qr_pay;
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData;
|
|
||||||
import androidx.lifecycle.MutableLiveData;
|
|
||||||
import androidx.lifecycle.ViewModel;
|
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 {
|
public class QRPayViewModel extends ViewModel {
|
||||||
|
public void generateQR(){
|
||||||
|
|
||||||
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(){
|
public void refundQR(){
|
||||||
return refundableHistory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPayDetail(PayDetail payDetail){
|
public void historyQR(){
|
||||||
_payDetail.setValue(payDetail);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Runnable onCancel;
|
}
|
||||||
public Runnable onConfirm;
|
|
||||||
}
|
}
|
||||||
@ -1,357 +0,0 @@
|
|||||||
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.network.model.KPayRefund;
|
|
||||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
|
||||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
|
||||||
import com.utsmyanmar.paylibs.model.TradeData;
|
|
||||||
import com.utsmyanmar.paylibs.system.SystemDateTime;
|
|
||||||
import com.utsmyanmar.paylibs.utils.POSUtil;
|
|
||||||
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.disposables.Disposable;
|
|
||||||
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;
|
|
||||||
|
|
||||||
CompositeDisposable refundDisposable = new CompositeDisposable();
|
|
||||||
CompositeDisposable retrieveUpdateDisposable = new CompositeDisposable();
|
|
||||||
|
|
||||||
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 onDestroyView() {
|
|
||||||
super.onDestroyView();
|
|
||||||
refundDisposable.dispose();
|
|
||||||
retrieveUpdateDisposable.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
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";
|
|
||||||
|
|
||||||
showLoadingDialog("Processing refund...");
|
|
||||||
|
|
||||||
// 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 -> {
|
|
||||||
dismissLoadingDialog();
|
|
||||||
handleRefundResponse(response, referenceNo);
|
|
||||||
},
|
|
||||||
throwable -> {
|
|
||||||
dismissLoadingDialog();
|
|
||||||
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 navigateToMain() {
|
|
||||||
routeId = R.id.action_QRRefundDetail_to_nav_main;
|
|
||||||
safeNavigateToRouteId();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void navigateToNext() {
|
|
||||||
routeId = R.id.action_QRRefundDetail_to_transactionResultFragment;
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
processKPayRefund(referenceNo, refundAmountStr, originalAmountStr, refundReason);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Original amount refund - no amount validation needed
|
|
||||||
processKPayRefund(referenceNo, "0", String.valueOf( etOriginalAmount.getText().toString().trim()), refundReason);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void navigateToPassword(){
|
|
||||||
sharedViewModel.transactionsType.setValue(TransactionsType.MMQR_REFUND);
|
|
||||||
routeId = R.id.action_qrRefundPasswordFragment_to_inputPasswordFragment;
|
|
||||||
safeRouteTo(currentId,routeId,hostId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,104 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,84 +0,0 @@
|
|||||||
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);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -240,7 +240,7 @@
|
|||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:onClick="@{() -> click.onClickQR()}"
|
android:onClick="@{() -> click.onClickQRPay()}"
|
||||||
app:disableBtn="@{mainViewModel.kPayStatus}"
|
app:disableBtn="@{mainViewModel.kPayStatus}"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/cardMenuCard"
|
app:layout_constraintTop_toBottomOf="@+id/cardMenuCard"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|||||||
@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
|
<variable
|
||||||
|
name="vm"
|
||||||
|
type="com.utsmm.kbz.ui.qr_pay.QRPayViewModel" />
|
||||||
|
|
||||||
<variable
|
<variable
|
||||||
name="adapter"
|
name="adapter"
|
||||||
type="androidx.recyclerview.widget.RecyclerView.Adapter" />
|
type="androidx.recyclerview.widget.RecyclerView.Adapter" />
|
||||||
|
|||||||
@ -1,44 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@ -1,349 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@ -21,7 +21,7 @@
|
|||||||
android:layout_marginVertical="6dp"
|
android:layout_marginVertical="6dp"
|
||||||
app:cardCornerRadius="12dp"
|
app:cardCornerRadius="12dp"
|
||||||
app:cardElevation="0dp"
|
app:cardElevation="0dp"
|
||||||
app:cardBackgroundColor="@color/colorPrimary"
|
app:cardBackgroundColor="@color/white"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
@ -41,7 +41,7 @@
|
|||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:src="@drawable/ic_custom_pos"
|
android:src="@drawable/ic_custom_pos"
|
||||||
app:tint="@color/white"
|
app:tint="@color/colorPrimary"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:layout_gravity="top" />
|
android:layout_gravity="top" />
|
||||||
@ -66,10 +66,11 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@{POSUtil.getInstance().getTransName(payDetail)}"
|
android:text="@{POSUtil.getInstance().getTransName(payDetail)}"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:fontFamily="sans-serif-medium"
|
android:fontFamily="sans-serif-medium"
|
||||||
|
app:isColorChanges="@{payDetail}"
|
||||||
tools:text="SALE" />
|
tools:text="SALE" />
|
||||||
|
|
||||||
<!-- Transaction Amount -->
|
<!-- Transaction Amount -->
|
||||||
@ -77,10 +78,11 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="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:text="@{POSUtil.getInstance().checkMinusSign(payDetail.transactionType)+POSUtil.getInstance().getDecimalAmountSeparatorFormat(payDetail.amount) + ` `+POSUtil.getInstance().currencyCodeToText(payDetail.currencyCode)}"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:fontFamily="sans-serif-medium"
|
android:fontFamily="sans-serif-medium"
|
||||||
|
app:isColorChanges="@{payDetail}"
|
||||||
tools:text="1,000.00 MMK" />
|
tools:text="1,000.00 MMK" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -90,10 +92,11 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{POSUtil.getInstance().convertDateFormatByDateString(payDetail.transDate)}"
|
android:text="@{POSUtil.getInstance().convertDateFormatByDateString(payDetail.transDate)}"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:fontFamily="sans-serif"
|
android:fontFamily="sans-serif"
|
||||||
|
app:isColorChanges="@{payDetail}"
|
||||||
android:layout_marginBottom="6dp"
|
android:layout_marginBottom="6dp"
|
||||||
tools:text="2022-11-26" />
|
tools:text="2022-11-26" />
|
||||||
|
|
||||||
@ -102,7 +105,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{POSUtil.getInstance().getCardNumMasking(payDetail.cardNo)}"
|
android:text="@{POSUtil.getInstance().getCardNumMasking(payDetail.cardNo)}"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:fontFamily="monospace"
|
android:fontFamily="monospace"
|
||||||
@ -121,10 +124,11 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
app:isTrace="@{payDetail}"
|
app:isTrace="@{payDetail}"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="13sp"
|
android:textSize="13sp"
|
||||||
android:alpha="0.7"
|
android:alpha="0.7"
|
||||||
android:fontFamily="monospace"
|
android:fontFamily="monospace"
|
||||||
|
app:isColorChanges="@{payDetail}"
|
||||||
tools:text="TRC:000050" />
|
tools:text="TRC:000050" />
|
||||||
|
|
||||||
<!-- RRN -->
|
<!-- RRN -->
|
||||||
@ -133,11 +137,12 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@{`RRN:`+payDetail.referNo}"
|
android:text="@{`RRN:`+payDetail.referNo}"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="13sp"
|
android:textSize="13sp"
|
||||||
android:alpha="0.7"
|
android:alpha="0.7"
|
||||||
android:fontFamily="monospace"
|
android:fontFamily="monospace"
|
||||||
android:textAlignment="textEnd"
|
android:textAlignment="textEnd"
|
||||||
|
app:isColorChanges="@{payDetail}"
|
||||||
tools:text="RRN:233001786242" />
|
tools:text="RRN:233001786242" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -149,7 +154,7 @@
|
|||||||
android:layout_width="16dp"
|
android:layout_width="16dp"
|
||||||
android:layout_height="16dp"
|
android:layout_height="16dp"
|
||||||
android:src="@drawable/ic_right_arrow"
|
android:src="@drawable/ic_right_arrow"
|
||||||
app:tint="@color/white"
|
app:tint="@color/colorPrimary"
|
||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginStart="8dp" />
|
android:layout_marginStart="8dp" />
|
||||||
|
|||||||
@ -1,160 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@ -1084,61 +1084,13 @@
|
|||||||
app:destination="@id/inputAmountFragment" />
|
app:destination="@id/inputAmountFragment" />
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_qrFragment_to_qrHistory"
|
android:id="@+id/action_qrFragment_to_qrHistory"
|
||||||
app:destination="@id/reprintAnyTransactionFragment"
|
app:destination="@id/qrHistory"
|
||||||
/>
|
|
||||||
<action
|
|
||||||
android:id="@+id/action_qrFragment_to_qr_refund_list"
|
|
||||||
app:destination="@id/qrRefundList"
|
|
||||||
/>
|
/>
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
<!-- <fragment-->
|
|
||||||
<!-- android:id="@+id/qrHistory"-->
|
|
||||||
<!-- tools:layout="@layout/fragment_qr_history"-->
|
|
||||||
<!-- android:name="com.utsmm.kbz.ui.qr_pay.QRHistoryFragment"-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- </fragment>-->
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/qrRefundList"
|
android:id="@+id/qrHistory"
|
||||||
tools:layout="@layout/fragment_qr_refund"
|
tools:layout="@layout/fragment_qr_history"
|
||||||
android:name="com.utsmm.kbz.ui.qr_pay.QRRefundFragment"
|
android:name="com.utsmm.kbz.ui.qr_pay.QRHistoryFragment"
|
||||||
>
|
>
|
||||||
<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/QRRefundPasswordFragment"
|
|
||||||
app:popUpToInclusive="true"
|
|
||||||
android:id="@+id/action_qrRefundPasswordFragment_to_inputPasswordFragment"
|
|
||||||
app:destination="@id/inputPasswordFragment" />
|
|
||||||
</fragment>
|
</fragment>
|
||||||
</navigation>
|
</navigation>
|
||||||
@ -64,5 +64,4 @@
|
|||||||
<dimen name="button_height">48dp</dimen>
|
<dimen name="button_height">48dp</dimen>
|
||||||
<dimen name="button_corner_radius">12dp</dimen>
|
<dimen name="button_corner_radius">12dp</dimen>
|
||||||
<dimen name="fab_size">56dp</dimen>
|
<dimen name="fab_size">56dp</dimen>
|
||||||
<dimen name="text_margin">16dp</dimen>
|
|
||||||
</resources>
|
</resources>
|
||||||
@ -149,10 +149,7 @@ public interface PayDetailDao {
|
|||||||
@Query("SELECT * FROM paydetail ORDER BY PID DESC")
|
@Query("SELECT * FROM paydetail ORDER BY PID DESC")
|
||||||
LiveData<List<PayDetail>> getAllTrans();
|
LiveData<List<PayDetail>> getAllTrans();
|
||||||
|
|
||||||
|
|
||||||
@Query("SELECT * FROM paydetail WHERE transactionType = 20 ORDER BY PID DESC")
|
@Query("SELECT * FROM paydetail WHERE transactionType = 20 ORDER BY PID DESC")
|
||||||
LiveData<List<PayDetail>> getAllQRHistory();
|
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();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -228,6 +228,4 @@ public class Repository {
|
|||||||
public LiveData<List<PayDetail>> getAllTrans() { return payDetailDao.getAllTrans(); }
|
public LiveData<List<PayDetail>> getAllTrans() { return payDetailDao.getAllTrans(); }
|
||||||
|
|
||||||
public LiveData<List<PayDetail>> getAllQRHistory(){ return payDetailDao.getAllQRHistory();}
|
public LiveData<List<PayDetail>> getAllQRHistory(){ return payDetailDao.getAllQRHistory();}
|
||||||
|
|
||||||
public LiveData<List<PayDetail>> getRefundableQRHistory(){ return payDetailDao.getRefundableQRHistory(); }
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user