Compare commits
77 Commits
main
...
merge_late
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d894116dd | |||
| 0804f7b762 | |||
|
|
a1c0f55472 | ||
|
|
71e0e24b3c | ||
| 014bdc18e3 | |||
|
|
97014377a8 | ||
|
|
424678e0ca | ||
| b92f9bfe4e | |||
|
|
d42ee5d2f7 | ||
|
|
3fe711cc2f | ||
| f91ae09be7 | |||
|
|
eebe9ac2c6 | ||
|
|
d3a8bf6ab5 | ||
|
|
311f7a7e1e | ||
|
|
2204e99463 | ||
| 8200cefb96 | |||
|
|
c18704f031 | ||
|
|
eed7dd4680 | ||
| 1a7e86077c | |||
|
|
20417eb811 | ||
|
|
0d796ab20f | ||
| 8b211ca530 | |||
| 6bf49b3f19 | |||
|
|
4d5124fc64 | ||
|
|
6b1c6ef4b5 | ||
|
|
a6db8970af | ||
| 2f4db87441 | |||
|
|
315d37ca31 | ||
|
|
ff68ee6a1f | ||
| aa37e14ea4 | |||
|
|
a0ffff71c4 | ||
|
|
2441ba5141 | ||
|
|
90c9a48197 | ||
| 1ac8c14b09 | |||
|
|
af45ed4b43 | ||
|
|
799f03dbcd | ||
| 44f4e1ea94 | |||
|
|
c619166ea8 | ||
| 49b929ab27 | |||
|
|
ab4801d687 | ||
|
|
d8befb7f2a | ||
|
|
3d2b316e99 | ||
|
|
8bf4d6da22 | ||
|
|
adfa73070f | ||
|
|
a449a366e0 | ||
|
|
5d450e0a48 | ||
| ced683e302 | |||
|
|
1811fefec1 | ||
|
|
b484f69cb3 | ||
|
|
8cd56777cc | ||
|
|
53f6414f70 | ||
|
|
bb60828767 | ||
|
|
749abb1455 | ||
| a8624195b0 | |||
|
|
65eb17e3b9 | ||
| 2f9f06ce87 | |||
| 41b6fb7782 | |||
|
|
7e2a589636 | ||
|
|
7c266677e7 | ||
|
|
063dfae87f | ||
|
|
9502ee7a04 | ||
|
|
5509bf4349 | ||
| 476e1d9eaa | |||
| 28d4672878 | |||
|
|
644df8211d | ||
|
|
2358782f3d | ||
|
|
f142df0144 | ||
| 8da4b2399e | |||
|
|
efb0c76f69 | ||
|
|
d861c278a2 | ||
| 5efcc7ef24 | |||
| c7ac1e90bf | |||
| 1b4a56c29f | |||
| a885d05b62 | |||
| 1cedbc987c | |||
| 0a2cc295a1 | |||
| b5a82a5fd1 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -13,3 +13,5 @@
|
|||||||
.externalNativeBuild
|
.externalNativeBuild
|
||||||
.cxx
|
.cxx
|
||||||
local.properties
|
local.properties
|
||||||
|
/.idea
|
||||||
|
/app/release
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
KBZ-Master
|
KBZ-Master-latest
|
||||||
File diff suppressed because one or more lines are too long
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>
|
<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>
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
<option value="$PROJECT_DIR$/ecr" />
|
<option value="$PROJECT_DIR$/ecr" />
|
||||||
<option value="$PROJECT_DIR$/ecr-service-lib" />
|
<option value="$PROJECT_DIR$/ecr-service-lib" />
|
||||||
<option value="$PROJECT_DIR$/mpulib" />
|
<option value="$PROJECT_DIR$/mpulib" />
|
||||||
|
<option value="$PROJECT_DIR$/nexdlkey-lib" />
|
||||||
<option value="$PROJECT_DIR$/nexsdk-lib" />
|
<option value="$PROJECT_DIR$/nexsdk-lib" />
|
||||||
<option value="$PROJECT_DIR$/paylibs" />
|
<option value="$PROJECT_DIR$/paylibs" />
|
||||||
<option value="$PROJECT_DIR$/paysdk-lib" />
|
<option value="$PROJECT_DIR$/paysdk-lib" />
|
||||||
|
|||||||
@ -14,19 +14,58 @@ android {
|
|||||||
applicationId "com.utsmm.kbz"
|
applicationId "com.utsmm.kbz"
|
||||||
minSdk 24
|
minSdk 24
|
||||||
targetSdk 33
|
targetSdk 33
|
||||||
versionCode 5
|
versionCode 1
|
||||||
versionName "1.05"
|
versionName "1.0"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
// // Add CMake configuration
|
|
||||||
// externalNativeBuild {
|
|
||||||
// cmake {
|
|
||||||
// cppFlags "-std=c++14"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// 🔥 MULTI-VARIANT FLAVORS
|
||||||
|
// -----------------------------
|
||||||
|
flavorDimensions "env"
|
||||||
|
|
||||||
|
productFlavors {
|
||||||
|
sit {
|
||||||
|
dimension "env"
|
||||||
|
applicationId "com.utsmm.kbz.sit"
|
||||||
|
versionNameSuffix "-sit"
|
||||||
|
resValue "string", "app_name", "KBZ-SIT"
|
||||||
|
}
|
||||||
|
|
||||||
|
uat {
|
||||||
|
dimension "env"
|
||||||
|
applicationId "com.utsmm.kbz.uat"
|
||||||
|
versionNameSuffix "-uat"
|
||||||
|
resValue "string", "app_name", "KBZ-UAT"
|
||||||
|
}
|
||||||
|
|
||||||
|
prod {
|
||||||
|
dimension "env"
|
||||||
|
applicationId "com.utsmm.kbz"
|
||||||
|
versionNameSuffix ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// defaultConfig {
|
||||||
|
// applicationId "com.utsmm.kbz.sit"
|
||||||
|
// minSdk 24
|
||||||
|
// targetSdk 33
|
||||||
|
// versionCode 1
|
||||||
|
// versionName "1.0"
|
||||||
|
//
|
||||||
|
//// applicationId "com.utsmm.kbz"
|
||||||
|
//// versionName "1.10"
|
||||||
|
//
|
||||||
|
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
//
|
||||||
|
//// // Add CMake configuration
|
||||||
|
//// externalNativeBuild {
|
||||||
|
//// cmake {
|
||||||
|
//// cppFlags "-std=c++14"
|
||||||
|
//// }
|
||||||
|
//// }
|
||||||
|
// }
|
||||||
|
|
||||||
// Configure CMake
|
// Configure CMake
|
||||||
// externalNativeBuild {
|
// externalNativeBuild {
|
||||||
// cmake {
|
// cmake {
|
||||||
@ -40,6 +79,9 @@ 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
|
||||||
@ -90,7 +132,6 @@ dependencies {
|
|||||||
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def nav_version = "2.3.2"
|
def nav_version = "2.3.2"
|
||||||
def lottieVersion = "3.5.0"
|
def lottieVersion = "3.5.0"
|
||||||
def fragment_version = "1.2.0"
|
def fragment_version = "1.2.0"
|
||||||
@ -189,6 +230,7 @@ dependencies {
|
|||||||
implementation project(path: ':qrgen-lib')
|
implementation project(path: ':qrgen-lib')
|
||||||
//// implementation project(path: ':samlSirius')
|
//// implementation project(path: ':samlSirius')
|
||||||
implementation project(path: ':ecr')
|
implementation project(path: ':ecr')
|
||||||
|
implementation project(path: ':nexdlkey-lib')
|
||||||
|
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2' // 1.1.2
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2' // 1.1.2
|
||||||
@ -196,6 +238,10 @@ dependencies {
|
|||||||
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
|
||||||
|
|
||||||
|
|
||||||
|
androidTestImplementation 'androidx.test:core:1.5.0'
|
||||||
|
androidTestImplementation 'androidx.test:runner:1.5.2'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||||
|
|
||||||
// Add Mockito dependency for mocking
|
// Add Mockito dependency for mocking
|
||||||
testImplementation 'org.mockito:mockito-core:3.12.4'
|
testImplementation 'org.mockito:mockito-core:3.12.4'
|
||||||
androidTestImplementation 'org.mockito:mockito-android:3.12.4'
|
androidTestImplementation 'org.mockito:mockito-android:3.12.4'
|
||||||
|
|||||||
BIN
app/release/app-release.apk
Normal file
BIN
app/release/app-release.apk
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -4,15 +4,15 @@
|
|||||||
"type": "APK",
|
"type": "APK",
|
||||||
"kind": "Directory"
|
"kind": "Directory"
|
||||||
},
|
},
|
||||||
"applicationId": "com.utsmm.kbz",
|
"applicationId": "com.utsmm.kbz.sit",
|
||||||
"variantName": "release",
|
"variantName": "release",
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
"type": "SINGLE",
|
"type": "SINGLE",
|
||||||
"filters": [],
|
"filters": [],
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"versionCode": 5,
|
"versionCode": 1,
|
||||||
"versionName": "1.05",
|
"versionName": "1.0",
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@ -10,6 +10,29 @@ import org.junit.runner.RunWith;
|
|||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import com.sunmi.pay.hardware.aidl.AidlConstants;
|
||||||
|
import com.utsmm.kbz.util.MockData;
|
||||||
|
import com.utsmm.kbz.util.TransactionUtil;
|
||||||
|
import com.utsmyanmar.checkxread.model.CardDataX;
|
||||||
|
import com.utsmyanmar.checkxread.util.CardTypeX;
|
||||||
|
import com.utsmyanmar.paylibs.Constant;
|
||||||
|
import com.utsmyanmar.paylibs.isobuilder.ISOMode;
|
||||||
|
import com.utsmyanmar.paylibs.isobuilder.builderx.ISOMsgX;
|
||||||
|
import com.utsmyanmar.paylibs.isobuilder.builderx.ISOVersion;
|
||||||
|
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||||
|
import com.utsmyanmar.paylibs.model.TradeData;
|
||||||
|
import com.utsmyanmar.paylibs.model.enums.TransCVM;
|
||||||
|
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||||
|
import com.utsmyanmar.paylibs.utils.MessageType;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.ByteUtil;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
import com.utsmyanmar.paylibs.utils.enums.HostName;
|
||||||
|
import com.utsmyanmar.paylibs.utils.iso_utils.BitmapConfig;
|
||||||
|
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||||
|
import com.utsmyanmar.paylibs.utils.params.Params;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instrumented test, which will execute on an Android device.
|
* Instrumented test, which will execute on an Android device.
|
||||||
*
|
*
|
||||||
@ -23,4 +46,131 @@ public class ExampleInstrumentedTest {
|
|||||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||||
assertEquals("com.utsmm.kbz", appContext.getPackageName());
|
assertEquals("com.utsmm.kbz", appContext.getPackageName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testVoidPacket() {
|
||||||
|
|
||||||
|
CardDataX cardDataX = MockData.getInstance().generateMPUCard();
|
||||||
|
|
||||||
|
TradeData tradeData = TransactionUtil.getInstance().initMPUTransaction(cardDataX, CardTypeX.IC);
|
||||||
|
|
||||||
|
String bitmap = BitmapConfig.MPU_NEW_VOID;
|
||||||
|
MessageType messageType = MessageType.FINANCIAL;
|
||||||
|
|
||||||
|
ISOMsgX isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1987, ISOMode.ONLY_HEADER, HostName.FINEXUS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
TradeData transTradeData = setUpRebuildTransactions(tradeData, TransactionsType.VOID, HostName.FINEXUS);
|
||||||
|
|
||||||
|
transTradeData.getPayDetail().setAmount(50000);
|
||||||
|
PayDetail transPayDetail = transTradeData.getPayDetail();
|
||||||
|
|
||||||
|
byte[] sendBytes;
|
||||||
|
try {
|
||||||
|
sendBytes = isoMsgX.buildISOPackets(transTradeData, bitmap, messageType);
|
||||||
|
|
||||||
|
System.out.println("Hex Str : "+ ByteUtil.bytes2HexStr(sendBytes));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private TradeData setUpRebuildTransactions(TradeData tradeData, TransactionsType transactionsType, HostName hostName) {
|
||||||
|
LogUtil.d(Constant.TAG, "Starting Online Transaction--" + hostName + "--" + transactionsType);
|
||||||
|
|
||||||
|
TradeData newTrade = Params.newTrade(true);
|
||||||
|
PayDetail newPay = newTrade.getPayDetail();
|
||||||
|
PayDetail oldPay = tradeData.getPayDetail();
|
||||||
|
|
||||||
|
newPay.setCardType(100);
|
||||||
|
newPay.setPINCipher("");
|
||||||
|
newPay.setHostName(hostName.name);
|
||||||
|
newPay.setTransType(transactionsType.name);
|
||||||
|
newPay.setProcessCode(transactionsType.processCode);
|
||||||
|
newPay.setCardNo(oldPay.getCardNo());
|
||||||
|
newPay.setCardHolderName(oldPay.getCardHolderName());
|
||||||
|
newPay.setEXPDate(oldPay.getEXPDate());
|
||||||
|
newPay.setTradeDate(oldPay.getTradeDate());
|
||||||
|
newPay.setTradeTime(oldPay.getTradeTime());
|
||||||
|
newPay.setAmount(oldPay.getAmount());
|
||||||
|
newPay.setTransactionType(transactionsType.value);
|
||||||
|
newPay.setAccountType(oldPay.getAccountType());
|
||||||
|
|
||||||
|
newPay.setCardInfo(oldPay.getCardInfo());
|
||||||
|
|
||||||
|
newPay.setSettlementEnabled(SystemParamsOperation.getInstance().getSettlementStatus());
|
||||||
|
|
||||||
|
// added on Nov, 13 2024
|
||||||
|
newPay.setICC55(oldPay.getICC55());
|
||||||
|
|
||||||
|
if(newPay.getICC55() != null && !newPay.getICC55().isEmpty()) {
|
||||||
|
newPay.setAppLabel(oldPay.getAppLabel());
|
||||||
|
newPay.setAppName(oldPay.getAppName());
|
||||||
|
newPay.setTSI(oldPay.getTSI());
|
||||||
|
newPay.setAID(oldPay.getAID());
|
||||||
|
newPay.setArqC(oldPay.getArqC());
|
||||||
|
newPay.setTVR(oldPay.getTVR());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(transactionsType != TransactionsType.PRE_AUTH_COMPLETE) {
|
||||||
|
|
||||||
|
newPay.setTradeDateTime(oldPay.getTradeDateTime());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (transactionsType == TransactionsType.VOID || transactionsType == TransactionsType.REFUND) {
|
||||||
|
String field60;
|
||||||
|
if(hostName == HostName.BPC) {
|
||||||
|
field60 = String.format(Locale.getDefault(), "%010d00", oldPay.getAmount());
|
||||||
|
} else {
|
||||||
|
field60 = String.format(Locale.getDefault(), "%012d", oldPay.getAmount());
|
||||||
|
}
|
||||||
|
// String field60 = String.format(Locale.getDefault(), "%010d00", oldPay.getAmount());
|
||||||
|
newPay.setReferNo(oldPay.getReferNo());
|
||||||
|
newPay.setTransCVM(TransCVM.SIGNATURE);
|
||||||
|
newTrade.setField60(field60);
|
||||||
|
} else if (transactionsType == TransactionsType.PRE_AUTH_VOID) {
|
||||||
|
newPay.setCardType(oldPay.getCardType());
|
||||||
|
newPay.setCustomOrderNo(oldPay.getVoucherNo());
|
||||||
|
newPay.setReferNo(oldPay.getReferNo());
|
||||||
|
newPay.setCardInfo(oldPay.getCardInfo());
|
||||||
|
newPay.setPINCipher(oldPay.getPINCipher());
|
||||||
|
newPay.setTempKSN(oldPay.getTempKSN());
|
||||||
|
newPay.setTransCVM(TransCVM.SIGNATURE);
|
||||||
|
// for manual entry reversal which need de 35
|
||||||
|
|
||||||
|
} else if (transactionsType == TransactionsType.TIP_ADJUSTMENT ) {
|
||||||
|
newPay.setReferNo(oldPay.getReferNo());
|
||||||
|
newPay.setApprovalCode(oldPay.getApprovalCode());
|
||||||
|
} else if (transactionsType == TransactionsType.PRE_AUTH_COMPLETE) {
|
||||||
|
newPay.setCardType(oldPay.getCardType());
|
||||||
|
newPay.setCardInfo(oldPay.getCardInfo());
|
||||||
|
newPay.setPINCipher(oldPay.getPINCipher());
|
||||||
|
newPay.setReferNo(oldPay.getReferNo());
|
||||||
|
newPay.setTempKSN(oldPay.getTempKSN());
|
||||||
|
} else if (transactionsType == TransactionsType.PRE_AUTH_COMPLETE_VOID) {
|
||||||
|
newPay.setVoucherNo(oldPay.getVoucherNo());
|
||||||
|
newPay.setCustomOrderNo(oldPay.getVoucherNo());
|
||||||
|
newPay.setReferNo(oldPay.getReferNo());
|
||||||
|
newPay.setCardInfo(oldPay.getCardInfo());
|
||||||
|
|
||||||
|
/*
|
||||||
|
* new requirements */
|
||||||
|
newPay.setCardType(AidlConstants.CardType.IC.getValue());
|
||||||
|
newPay.setPINCipher("55");
|
||||||
|
newPay.setTransCVM(TransCVM.SIGNATURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(oldPay.getAccountType().equals("MPU")){
|
||||||
|
// newPay.setIsFreeSign(true);
|
||||||
|
newPay.setTransCVM(TransCVM.SIGNATURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
newTrade.setPayDetail(newPay);
|
||||||
|
return newTrade;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -10,6 +10,7 @@
|
|||||||
android:name="android.hardware.telephony"
|
android:name="android.hardware.telephony"
|
||||||
android:required="false" />
|
android:required="false" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" />
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
@ -46,30 +47,32 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme.NoActionBar"
|
android:theme="@style/AppTheme.NoActionBar">
|
||||||
>
|
|
||||||
<!-- android:manageSpaceActivity="com.utsmyanmar.upos.config.UTSManageSpaceActivity"-->
|
<!-- android:manageSpaceActivity="com.utsmyanmar.upos.config.UTSManageSpaceActivity"-->
|
||||||
<!-- <activity-->
|
<!-- <activity-->
|
||||||
<!-- android:screenOrientation="portrait"-->
|
<!-- android:screenOrientation="portrait"-->
|
||||||
<!-- android:name=".config.UTSManageSpaceActivity"/>-->
|
<!-- android:name=".config.UTSManageSpaceActivity"/>-->
|
||||||
<activity android:name="com.utsmm.kbz.MainActivity"
|
<activity android:name="com.utsmm.kbz.MainActivity"
|
||||||
android:exported="true">
|
android:exported="true"
|
||||||
|
android:showWhenLocked="true"
|
||||||
|
android:turnScreenOn="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.HOME"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="com.journeyapps.barcodescanner.CaptureActivity"
|
<activity android:name="com.journeyapps.barcodescanner.CaptureActivity"
|
||||||
android:screenOrientation="fullSensor"
|
android:screenOrientation="fullSensor"
|
||||||
tools:replace="screenOrientation" />
|
tools:replace="screenOrientation" />
|
||||||
|
|
||||||
<receiver android:name="com.utsmm.kbz.service.SmileAlarmReceiver" />
|
<receiver android:name="com.utsmm.kbz.service.AutoAlarmReceiver" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="com.utsmm.kbz.service.SmileSettleService"
|
android:name="com.utsmm.kbz.service.AutoSettleService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
<meta-data
|
<meta-data
|
||||||
|
|||||||
@ -16,23 +16,30 @@ import android.app.PendingIntent;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.android.material.appbar.MaterialToolbar;
|
import com.google.android.material.appbar.MaterialToolbar;
|
||||||
import com.google.android.material.navigation.NavigationView;
|
import com.google.android.material.navigation.NavigationView;
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadFEntity;
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadFlow;
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadFlowProcessListener;
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadFlowResultEntity;
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadResult;
|
||||||
import com.utsmyanmar.baselib.repo.Repository;
|
import com.utsmyanmar.baselib.repo.Repository;
|
||||||
import com.utsmyanmar.baselib.ui.AnimationDialog;
|
import com.utsmyanmar.baselib.ui.AnimationDialog;
|
||||||
import com.utsmyanmar.checkxread.sdk.NexGoSDK;
|
import com.utsmyanmar.checkxread.sdk.NexGoSDK;
|
||||||
import com.utsmyanmar.ecr.ECRHelper;
|
import com.utsmyanmar.ecr.ECRHelper;
|
||||||
import com.utsmyanmar.paylibs.Constant;
|
import com.utsmyanmar.paylibs.Constant;
|
||||||
import com.utsmyanmar.paylibs.print.printx.PrintXReceipt;
|
import com.utsmyanmar.paylibs.print.printx.PrintXReceipt;
|
||||||
|
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.TransMenu;
|
import com.utsmyanmar.paylibs.utils.enums.TransMenu;
|
||||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||||
import com.utsmm.kbz.databinding.ActivityMainNewBinding;
|
import com.utsmm.kbz.databinding.ActivityMainNewBinding;
|
||||||
import com.utsmm.kbz.service.SmileAlarmReceiver;
|
import com.utsmm.kbz.service.AutoAlarmReceiver;
|
||||||
import com.utsmm.kbz.ui.core_ui.InputPasswordFragment;
|
import com.utsmm.kbz.ui.core_ui.InputPasswordFragment;
|
||||||
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||||
import com.utsmm.kbz.ui.navigation.NaviAdminFragment;
|
import com.utsmm.kbz.ui.navigation.NaviAdminFragment;
|
||||||
@ -126,6 +133,8 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
initSpecialBackHandlingFragments();
|
initSpecialBackHandlingFragments();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void initViewModels() {
|
private void initViewModels() {
|
||||||
sharedViewModel = new ViewModelProvider(this).get(SharedViewModel.class);
|
sharedViewModel = new ViewModelProvider(this).get(SharedViewModel.class);
|
||||||
}
|
}
|
||||||
@ -240,7 +249,7 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
PendingIntent pendingIntent = PendingIntent.getBroadcast(
|
PendingIntent pendingIntent = PendingIntent.getBroadcast(
|
||||||
this,
|
this,
|
||||||
0,
|
0,
|
||||||
new Intent(this, SmileAlarmReceiver.class),
|
new Intent(this, AutoAlarmReceiver.class),
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT
|
PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -382,6 +391,32 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
|
|
||||||
SystemParamsOperation.getInstance().setSetupEcr(false);
|
SystemParamsOperation.getInstance().setSetupEcr(false);
|
||||||
SystemParamsOperation.getInstance().setDownloadedParams(false);
|
SystemParamsOperation.getInstance().setDownloadedParams(false);
|
||||||
|
|
||||||
|
handleAutoSettlementIntent(getIntent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
super.onNewIntent(intent);
|
||||||
|
setIntent(intent);
|
||||||
|
handleAutoSettlementIntent(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleAutoSettlementIntent(Intent intent) {
|
||||||
|
if (intent == null) return;
|
||||||
|
boolean auto = intent.getBooleanExtra("AUTO_SETTLEMENT", false);
|
||||||
|
if (!auto) return;
|
||||||
|
|
||||||
|
com.utsmyanmar.paylibs.model.PayDetail payDetail = (com.utsmyanmar.paylibs.model.PayDetail) intent.getSerializableExtra("EXTRA_PAY_DETAIL");
|
||||||
|
if (payDetail != null) {
|
||||||
|
sharedViewModel.payDetail.setValue(payDetail);
|
||||||
|
sharedViewModel.transactionsType.setValue(com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType.SETTLEMENT);
|
||||||
|
try {
|
||||||
|
navController.navigate(R.id.transactionResultFragment);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.e(TAG, "Navigation error: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -36,6 +36,7 @@ import com.utsmyanmar.ecr.data.model.Transactions;
|
|||||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||||
|
|
||||||
import com.utsmyanmar.paylibs.print.PrintHelper;
|
import com.utsmyanmar.paylibs.print.PrintHelper;
|
||||||
|
import com.utsmyanmar.paylibs.print.printx.PrintXReceipt;
|
||||||
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;
|
||||||
@ -134,6 +135,7 @@ public class MainFragment extends DataBindingFragment {
|
|||||||
sharedViewModel.setAmountExist(false);
|
sharedViewModel.setAmountExist(false);
|
||||||
sharedViewModel.setCardDataExist(false);
|
sharedViewModel.setCardDataExist(false);
|
||||||
sharedViewModel.setTransMenu(null);
|
sharedViewModel.setTransMenu(null);
|
||||||
|
|
||||||
updateButtonStatus();
|
updateButtonStatus();
|
||||||
|
|
||||||
delayFunctionCall(this::checkTerminalStatus);
|
delayFunctionCall(this::checkTerminalStatus);
|
||||||
@ -292,7 +294,7 @@ public class MainFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
private void updateButtonStatus() {
|
private void updateButtonStatus() {
|
||||||
mainViewModel.settlementStatus.setValue(SystemParamsOperation.getInstance().getSettlementStatus());
|
mainViewModel.settlementStatus.setValue(SystemParamsOperation.getInstance().getSettlementStatus());
|
||||||
mainViewModel.kPayStatus.setValue(SystemParamsOperation.getInstance().getWavePayStatus());
|
mainViewModel.kPayStatus.setValue(SystemParamsOperation.getInstance().getQRPayStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpCarouselImages() {
|
private void setUpCarouselImages() {
|
||||||
@ -844,11 +846,18 @@ public class MainFragment extends DataBindingFragment {
|
|||||||
} else {
|
} else {
|
||||||
processBatch();
|
processBatch();
|
||||||
sharedViewModel.transactionsType.setValue(TransactionsType.SALE);
|
sharedViewModel.transactionsType.setValue(TransactionsType.SALE);
|
||||||
|
sharedViewModel.setTransMenu(TransMenu.SALE);
|
||||||
sharedViewModel.processCode.postValue(ProcessCode.SALE_PURCHASE + ProcessCode.SMART + ProcessCode.TO_ACCOUNT);
|
sharedViewModel.processCode.postValue(ProcessCode.SALE_PURCHASE + ProcessCode.SMART + ProcessCode.TO_ACCOUNT);
|
||||||
navigateToAmount();
|
navigateToAmount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onClickQR(){
|
||||||
|
// navigate to new QR Pay fragment
|
||||||
|
routeId = R.id.action_nav_main_to_qrFragment;
|
||||||
|
safeNavigateToRouteId();
|
||||||
|
}
|
||||||
|
|
||||||
public void onClickQRPay() {
|
public void onClickQRPay() {
|
||||||
|
|
||||||
String mmqrIp = SystemParamsOperation.getInstance().getSecHostIpAddress();
|
String mmqrIp = SystemParamsOperation.getInstance().getSecHostIpAddress();
|
||||||
@ -922,5 +931,24 @@ public class MainFragment extends DataBindingFragment {
|
|||||||
safeNavigateToRouteId();
|
safeNavigateToRouteId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onClickVoid(){
|
||||||
|
if (mainViewModel.payDetailSingle.getValue() != null) {
|
||||||
|
mainViewModel.startReversal(mainViewModel.payDetailSingle.getValue());
|
||||||
|
} else if (checkTid()) {
|
||||||
|
showDeclineDialog("Please Download Config!");
|
||||||
|
} else {
|
||||||
|
sharedViewModel.setTransactionsType(TransactionsType.VOID);
|
||||||
|
// sharedViewModel.transMenu.postValue(TransMenu.TRANSACTIONS);
|
||||||
|
sharedViewModel.setTransMenu(TransMenu.TRANSACTIONS);
|
||||||
|
routeId = R.id.action_nav_main_to_inputPasswordFragment;
|
||||||
|
safeRouteTo(currentId(),routeId, hostId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClickReport(){
|
||||||
|
routeId = R.id.action_nav_main_to_manageFunctionFragment;
|
||||||
|
safeRouteTo(currentId(), routeId, hostId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import androidx.lifecycle.Observer;
|
|||||||
import androidx.lifecycle.ViewModel;
|
import androidx.lifecycle.ViewModel;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
|
import com.utsmm.kbz.service.AutoSettleService;
|
||||||
import com.utsmyanmar.baselib.db.model.EmvDetail;
|
import com.utsmyanmar.baselib.db.model.EmvDetail;
|
||||||
import com.utsmyanmar.baselib.network.model.sirius.SiriusRequest;
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusRequest;
|
||||||
import com.utsmyanmar.baselib.network.model.sirius.SiriusResponse;
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusResponse;
|
||||||
@ -22,7 +23,6 @@ import com.utsmyanmar.paylibs.reversal.ReversalAction;
|
|||||||
import com.utsmyanmar.paylibs.reversal.ReversalListener;
|
import com.utsmyanmar.paylibs.reversal.ReversalListener;
|
||||||
import com.utsmyanmar.paylibs.system.SingleLiveEvent;
|
import com.utsmyanmar.paylibs.system.SingleLiveEvent;
|
||||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
import com.utsmm.kbz.service.SmileSettleService;
|
|
||||||
import com.utsmm.kbz.util.enums.ReversalStatus;
|
import com.utsmm.kbz.util.enums.ReversalStatus;
|
||||||
import com.utsmm.kbz.util.ecr.ECRConnectionStatus;
|
import com.utsmm.kbz.util.ecr.ECRConnectionStatus;
|
||||||
|
|
||||||
@ -58,6 +58,9 @@ public class MainViewModel extends ViewModel {
|
|||||||
|
|
||||||
public MutableLiveData<Boolean> kPayStatus = new MutableLiveData<>();
|
public MutableLiveData<Boolean> kPayStatus = new MutableLiveData<>();
|
||||||
|
|
||||||
|
public MutableLiveData<Boolean> voidStatus = new MutableLiveData<>();
|
||||||
|
|
||||||
|
|
||||||
public SingleLiveEvent<String> disabledMsg = new SingleLiveEvent<>();
|
public SingleLiveEvent<String> disabledMsg = new SingleLiveEvent<>();
|
||||||
|
|
||||||
public SingleLiveEvent<List<PayDetail>> settlementPOS = new SingleLiveEvent<>();
|
public SingleLiveEvent<List<PayDetail>> settlementPOS = new SingleLiveEvent<>();
|
||||||
@ -75,8 +78,8 @@ public class MainViewModel extends ViewModel {
|
|||||||
private BroadcastReceiver dataReceiver = new BroadcastReceiver() {
|
private BroadcastReceiver dataReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if (intent.getAction().equals(SmileSettleService.ACTION_DATA_RECEIVED)) {
|
if (intent.getAction().equals(AutoSettleService.ACTION_DATA_RECEIVED)) {
|
||||||
String data = intent.getStringExtra(SmileSettleService.EXTRA_DATA);
|
String data = intent.getStringExtra(AutoSettleService.EXTRA_DATA);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,13 +93,15 @@ public class MainViewModel extends ViewModel {
|
|||||||
playAtOnce.setValue(false);
|
playAtOnce.setValue(false);
|
||||||
|
|
||||||
LocalBroadcastManager.getInstance(context).registerReceiver(dataReceiver,
|
LocalBroadcastManager.getInstance(context).registerReceiver(dataReceiver,
|
||||||
new IntentFilter(SmileSettleService.ACTION_DATA_RECEIVED));
|
new IntentFilter(AutoSettleService.ACTION_DATA_RECEIVED));
|
||||||
|
|
||||||
settlementStatus.setValue(SystemParamsOperation.getInstance().getSettlementStatus());
|
settlementStatus.setValue(SystemParamsOperation.getInstance().getSettlementStatus());
|
||||||
|
|
||||||
kPayStatus.setValue(SystemParamsOperation.getInstance().getWavePayStatus());
|
kPayStatus.setValue(SystemParamsOperation.getInstance().getQRPayStatus());
|
||||||
|
|
||||||
disabledMsg.setValue(SystemParamsOperation.getInstance().getDisabledMsg());
|
disabledMsg.setValue(SystemParamsOperation.getInstance().getDisabledMsg());
|
||||||
|
|
||||||
|
voidStatus.setValue(SystemParamsOperation.getInstance().getVoidStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -5,5 +5,6 @@ public enum CardTransactionType {
|
|||||||
MPU,
|
MPU,
|
||||||
EMV,
|
EMV,
|
||||||
MAG,
|
MAG,
|
||||||
FALLBACK
|
FALLBACK,
|
||||||
|
MOCK
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,11 +4,11 @@ import android.content.BroadcastReceiver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
public class SmileAlarmReceiver extends BroadcastReceiver {
|
public class AutoAlarmReceiver extends BroadcastReceiver {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
// Start the service to send the API request
|
// Start the service to send the API request
|
||||||
Intent serviceIntent = new Intent(context, SmileSettleService.class);
|
Intent serviceIntent = new Intent(context, AutoSettleService.class);
|
||||||
context.startService(serviceIntent);
|
context.startService(serviceIntent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
307
app/src/main/java/com/utsmm/kbz/service/AutoSettleService.java
Normal file
307
app/src/main/java/com/utsmm/kbz/service/AutoSettleService.java
Normal file
@ -0,0 +1,307 @@
|
|||||||
|
package com.utsmm.kbz.service;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.NotificationChannel;
|
||||||
|
import android.app.NotificationManager;
|
||||||
|
import android.app.Service;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.IBinder;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.app.NotificationCompat;
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.repo.Repository;
|
||||||
|
import com.utsmm.kbz.BuildConfig;
|
||||||
|
import com.utsmm.kbz.R;
|
||||||
|
import com.utsmm.kbz.ui.settlement.SettlementViewModel;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
|
||||||
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
|
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||||
|
|
||||||
|
@AndroidEntryPoint
|
||||||
|
public class AutoSettleService extends Service {
|
||||||
|
|
||||||
|
private static final String TAG = AutoSettleService.class.getSimpleName();
|
||||||
|
|
||||||
|
public static final String ACTION_DATA_RECEIVED = BuildConfig.APPLICATION_ID + ".ACTION_DATA_RECEIVED";
|
||||||
|
public static final String EXTRA_DATA = BuildConfig.APPLICATION_ID + ".EXTRA_DATA";
|
||||||
|
|
||||||
|
|
||||||
|
private Handler handler;
|
||||||
|
|
||||||
|
|
||||||
|
private SettlementViewModel settlementViewModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
Repository repository;
|
||||||
|
|
||||||
|
public static final String NOTIFICATION_CHANNEL_ID = "10001";
|
||||||
|
private final static String default_notification_channel_id = "default";
|
||||||
|
private void createNotification() {
|
||||||
|
NotificationManager mNotificationManager = (NotificationManager)getSystemService( NOTIFICATION_SERVICE ) ;
|
||||||
|
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext() , default_notification_channel_id ) ;
|
||||||
|
mBuilder.setContentTitle( "Alarm manager is running!" ) ;
|
||||||
|
mBuilder.setContentText( "Wiping out the transactions!" ) ;
|
||||||
|
mBuilder.setTicker( "Notification Listener Service Example" ) ;
|
||||||
|
mBuilder.setSmallIcon(R.drawable. ic_launcher_foreground ) ;
|
||||||
|
mBuilder.setAutoCancel( true ) ;
|
||||||
|
if (android.os.Build.VERSION. SDK_INT >= android.os.Build.VERSION_CODES. O ) {
|
||||||
|
int importance = NotificationManager. IMPORTANCE_HIGH ;
|
||||||
|
NotificationChannel notificationChannel = new NotificationChannel( NOTIFICATION_CHANNEL_ID , "NOTIFICATION_CHANNEL_NAME" , importance) ;
|
||||||
|
mBuilder.setChannelId( NOTIFICATION_CHANNEL_ID ) ;
|
||||||
|
assert mNotificationManager != null;
|
||||||
|
mNotificationManager.createNotificationChannel(notificationChannel) ;
|
||||||
|
}
|
||||||
|
assert mNotificationManager != null;
|
||||||
|
mNotificationManager.notify(( int ) System. currentTimeMillis () , mBuilder.build()) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendDataToViewModel(String data) {
|
||||||
|
Intent intent = new Intent(ACTION_DATA_RECEIVED);
|
||||||
|
intent.putExtra(EXTRA_DATA, data);
|
||||||
|
LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
@Override
|
||||||
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
|
// Perform the Settlement request here
|
||||||
|
// ...
|
||||||
|
|
||||||
|
LogUtil.d(TAG,"<<<<<<<<<<<<<<< This action was called >>>>>>>>>>>>>>>>.");
|
||||||
|
|
||||||
|
|
||||||
|
sendDataToViewModel("Hello there");
|
||||||
|
|
||||||
|
createNotification();
|
||||||
|
|
||||||
|
// Observer<List<PayDetail>> settleObserver = new Observer<List<PayDetail>>() {
|
||||||
|
// @Override
|
||||||
|
// public void onChanged(List<PayDetail> list) {
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// if(list == null || list.size() == 0) {
|
||||||
|
// LogUtil.d(TAG, "Settle is null");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// LogUtil.d(TAG,"Size Settle : "+list.size());
|
||||||
|
//
|
||||||
|
// for (PayDetail pay:list) {
|
||||||
|
// repository.deletePayDetail(pay);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// repository.getSettlementPOS().observeForever(settleObserver);
|
||||||
|
//
|
||||||
|
// repository.getSettlementPOS().removeObserver(settleObserver);
|
||||||
|
//
|
||||||
|
// Observer<List<PayDetail>> deleteTransObserver = new Observer<List<PayDetail>>() {
|
||||||
|
// @Override
|
||||||
|
// public void onChanged(List<PayDetail> lists) {
|
||||||
|
// if(lists == null || lists.size() == 0) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// LogUtil.d(TAG,"Size Delete Trans : "+lists.size());
|
||||||
|
// for (PayDetail pay:lists) {
|
||||||
|
// repository.deletePayDetail(pay);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// repository.getDeleteTrans(SystemParamsOperation.getInstance().getCurrentBatchNum()).observeForever(deleteTransObserver);
|
||||||
|
//
|
||||||
|
// repository.getDeleteTrans(SystemParamsOperation.getInstance().getCurrentBatchNum()).removeObserver(deleteTransObserver);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
// try{
|
||||||
|
// handler.post(new Runnable() {
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
// // Create and show the dialog
|
||||||
|
// AlertDialog.Builder builder = new AlertDialog.Builder(SmileSettleService.this);
|
||||||
|
// builder.setTitle("Auto Settle!")
|
||||||
|
// .setMessage("Settlement process is going to start!")
|
||||||
|
// .setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onClick(DialogInterface dialog, int which) {
|
||||||
|
// // Handle OK button click
|
||||||
|
// dialog.dismiss(); // Dismiss the dialog
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onClick(DialogInterface dialog, int which) {
|
||||||
|
// // Handle Cancel button click
|
||||||
|
// dialog.dismiss(); // Dismiss the dialog
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// AlertDialog dialog = builder.create();
|
||||||
|
//// dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
|
||||||
|
//// dialog.show();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }catch (Exception e){
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
if(com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation.getInstance().getSettlementStatus()) {
|
||||||
|
final com.utsmyanmar.paylibs.isobuilder.builderx.ISOMsgX isoMsgX = new com.utsmyanmar.paylibs.isobuilder.builderx.ISOMsgX.ISOMsgXBuilder(
|
||||||
|
com.utsmyanmar.paylibs.isobuilder.builderx.ISOVersion.VERSION_1993,
|
||||||
|
com.utsmyanmar.paylibs.isobuilder.ISOMode.BOTH_HEADER_TPDU,
|
||||||
|
com.utsmyanmar.paylibs.utils.enums.HostName.BPC
|
||||||
|
).build();
|
||||||
|
|
||||||
|
repository.getSettlementPOS().observeForever(list -> {
|
||||||
|
int saleCount = 0;
|
||||||
|
long saleAmount = 0L;
|
||||||
|
int preCount = 0;
|
||||||
|
long preAmount = 0L;
|
||||||
|
int refundCount = 0;
|
||||||
|
long refundAmount = 0L;
|
||||||
|
int caCount = 0;
|
||||||
|
long caAmount = 0L;
|
||||||
|
|
||||||
|
if(list != null && !list.isEmpty()) {
|
||||||
|
for (com.utsmyanmar.paylibs.model.PayDetail pay : list) {
|
||||||
|
if (pay.getTransactionType() == com.utsmyanmar.paylibs.utils.iso_utils.TransactionType.SALE && !pay.isCanceled) {
|
||||||
|
saleCount++;
|
||||||
|
saleAmount += pay.getAmount();
|
||||||
|
} else if (pay.getTransactionType() == com.utsmyanmar.paylibs.utils.iso_utils.TransactionType.PRE_SALE_COMPLETE && !pay.isCanceled) {
|
||||||
|
preCount++;
|
||||||
|
preAmount += pay.getAmount();
|
||||||
|
} else if (pay.getTransactionType() == com.utsmyanmar.paylibs.utils.iso_utils.TransactionType.REFUND) {
|
||||||
|
refundCount++;
|
||||||
|
refundAmount += pay.getAmount();
|
||||||
|
} else if (pay.getTransactionType() == com.utsmyanmar.paylibs.utils.iso_utils.TransactionType.CASH_ADVANCE) {
|
||||||
|
caCount++;
|
||||||
|
caAmount += pay.getAmount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
com.utsmyanmar.paylibs.model.TradeData tradeData = com.utsmyanmar.paylibs.utils.params.Params.newTrade(true);
|
||||||
|
com.utsmyanmar.paylibs.model.PayDetail payDetail = tradeData.getPayDetail();
|
||||||
|
|
||||||
|
String bitmap = com.utsmyanmar.paylibs.utils.iso_utils.BitmapConfig.BPC_SETTLEMENT;
|
||||||
|
payDetail.setTransType(com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType.SETTLEMENT.name);
|
||||||
|
payDetail.setTransactionType(com.utsmyanmar.paylibs.utils.iso_utils.TransactionType.SETTLEMENT);
|
||||||
|
payDetail.setProcessCode(com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType.SETTLEMENT.processCode);
|
||||||
|
payDetail.setBatchNo(com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation.getInstance().getCurrentBatchNum());
|
||||||
|
|
||||||
|
com.utsmyanmar.paylibs.model.SettleData settleData = new com.utsmyanmar.paylibs.model.SettleData(
|
||||||
|
saleCount,
|
||||||
|
saleAmount,
|
||||||
|
preCount,
|
||||||
|
preAmount,
|
||||||
|
refundCount,
|
||||||
|
refundAmount,
|
||||||
|
caCount,
|
||||||
|
caAmount
|
||||||
|
);
|
||||||
|
payDetail.setSettleDataObj(settleData);
|
||||||
|
|
||||||
|
long totalAmount = saleAmount + preAmount + refundAmount + caAmount;
|
||||||
|
String settlementData;
|
||||||
|
if (refundAmount != 0L) {
|
||||||
|
long creditTotal = saleAmount + preAmount + caAmount;
|
||||||
|
long subTotal = creditTotal - refundAmount;
|
||||||
|
if (subTotal < 0L) {
|
||||||
|
settlementData = "D" + String.format(java.util.Locale.getDefault(), "%012d", Math.abs(subTotal));
|
||||||
|
} else {
|
||||||
|
settlementData = "C" + String.format(java.util.Locale.getDefault(), "%012d", subTotal);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
settlementData = "C" + String.format(java.util.Locale.getDefault(), "%012d", totalAmount);
|
||||||
|
}
|
||||||
|
payDetail.setSettleData(settlementData);
|
||||||
|
payDetail.setAmount(totalAmount);
|
||||||
|
|
||||||
|
tradeData.setPayDetail(payDetail);
|
||||||
|
tradeData.setField60(com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation.getInstance().getCurrentBatchNum());
|
||||||
|
|
||||||
|
byte[] sendBytes = isoMsgX.buildISOPackets(tradeData, bitmap, com.utsmyanmar.paylibs.utils.MessageType.SETTLEMENT);
|
||||||
|
com.utsmyanmar.paylibs.network.ISOSocket.getInstance().enqueue(sendBytes, sendBytes.length, false, new com.utsmyanmar.paylibs.network.ISOCallback() {
|
||||||
|
@Override
|
||||||
|
public void onReceive(byte[] bytes, int length) {
|
||||||
|
java.util.Map<String, com.utsmyanmar.paylibs.model.MsgField> responseMap = isoMsgX.parseISOPackets(bytes, length);
|
||||||
|
if (responseMap != null) {
|
||||||
|
String resultStr = "";
|
||||||
|
try {
|
||||||
|
resultStr = responseMap.get("F039").getDataStr();
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
payDetail.setIsNeedReversal(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
payDetail.setTradeAnswerCode(resultStr);
|
||||||
|
if (TextUtils.equals(resultStr, com.utsmyanmar.paylibs.Constant.ANSWER_CODE_ACCEPT) || TextUtils.equals(resultStr, com.utsmyanmar.paylibs.Constant.ANSWER_CODE_APPROVED)) {
|
||||||
|
payDetail.setIsNeedReversal(false);
|
||||||
|
} else if (TextUtils.equals(resultStr, "95") || TextUtils.equals(resultStr, "095")) {
|
||||||
|
payDetail.setIsNeedReversal(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String msg) {
|
||||||
|
com.utsmyanmar.paylibs.network.ISOSocket.getInstance().switchIp();
|
||||||
|
com.utsmyanmar.paylibs.network.ISOSocket.getInstance().enqueue(sendBytes, sendBytes.length, false, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
if(list != null && !list.isEmpty()) {
|
||||||
|
for (com.utsmyanmar.paylibs.model.PayDetail p : list) {
|
||||||
|
repository.deletePayDetail(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repository.insertPayDetail(payDetail);
|
||||||
|
|
||||||
|
Intent uiIntent = new Intent(getApplicationContext(), com.utsmm.kbz.MainActivity.class);
|
||||||
|
uiIntent.putExtra("AUTO_SETTLEMENT", true);
|
||||||
|
uiIntent.putExtra("EXTRA_TRANSACTION_TYPE", com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType.SETTLEMENT.value);
|
||||||
|
uiIntent.putExtra("EXTRA_PAY_DETAIL", payDetail);
|
||||||
|
uiIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
startActivity(uiIntent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return START_NOT_STICKY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
handler = new Handler();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public IBinder onBind(Intent intent) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onUnbind(Intent intent) {
|
||||||
|
return super.onUnbind(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,183 +0,0 @@
|
|||||||
package com.utsmm.kbz.service;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.NotificationChannel;
|
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.IBinder;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.core.app.NotificationCompat;
|
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|
||||||
|
|
||||||
import com.utsmyanmar.baselib.repo.Repository;
|
|
||||||
import com.utsmm.kbz.BuildConfig;
|
|
||||||
import com.utsmm.kbz.R;
|
|
||||||
import com.utsmm.kbz.ui.settlement.SettlementViewModel;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint;
|
|
||||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
|
||||||
|
|
||||||
// Temporarily disabled Hilt
|
|
||||||
// @AndroidEntryPoint
|
|
||||||
public class SmileSettleService extends Service {
|
|
||||||
|
|
||||||
private static final String TAG = SmileSettleService.class.getSimpleName();
|
|
||||||
|
|
||||||
public static final String ACTION_DATA_RECEIVED = BuildConfig.APPLICATION_ID + ".ACTION_DATA_RECEIVED";
|
|
||||||
public static final String EXTRA_DATA = BuildConfig.APPLICATION_ID + ".EXTRA_DATA";
|
|
||||||
|
|
||||||
|
|
||||||
private Handler handler;
|
|
||||||
|
|
||||||
|
|
||||||
private SettlementViewModel settlementViewModel;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
Repository repository;
|
|
||||||
|
|
||||||
public static final String NOTIFICATION_CHANNEL_ID = "10001";
|
|
||||||
private final static String default_notification_channel_id = "default";
|
|
||||||
private void createNotification() {
|
|
||||||
NotificationManager mNotificationManager = (NotificationManager)getSystemService( NOTIFICATION_SERVICE ) ;
|
|
||||||
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext() , default_notification_channel_id ) ;
|
|
||||||
mBuilder.setContentTitle( "Alarm manager is running!" ) ;
|
|
||||||
mBuilder.setContentText( "Wiping out the transactions!" ) ;
|
|
||||||
mBuilder.setTicker( "Notification Listener Service Example" ) ;
|
|
||||||
mBuilder.setSmallIcon(R.drawable. ic_launcher_foreground ) ;
|
|
||||||
mBuilder.setAutoCancel( true ) ;
|
|
||||||
if (android.os.Build.VERSION. SDK_INT >= android.os.Build.VERSION_CODES. O ) {
|
|
||||||
int importance = NotificationManager. IMPORTANCE_HIGH ;
|
|
||||||
NotificationChannel notificationChannel = new NotificationChannel( NOTIFICATION_CHANNEL_ID , "NOTIFICATION_CHANNEL_NAME" , importance) ;
|
|
||||||
mBuilder.setChannelId( NOTIFICATION_CHANNEL_ID ) ;
|
|
||||||
assert mNotificationManager != null;
|
|
||||||
mNotificationManager.createNotificationChannel(notificationChannel) ;
|
|
||||||
}
|
|
||||||
assert mNotificationManager != null;
|
|
||||||
mNotificationManager.notify(( int ) System. currentTimeMillis () , mBuilder.build()) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendDataToViewModel(String data) {
|
|
||||||
Intent intent = new Intent(ACTION_DATA_RECEIVED);
|
|
||||||
intent.putExtra(EXTRA_DATA, data);
|
|
||||||
LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
|
||||||
@Override
|
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
||||||
// Perform the Settlement request here
|
|
||||||
// ...
|
|
||||||
|
|
||||||
LogUtil.d(TAG,"<<<<<<<<<<<<<<< This action was called >>>>>>>>>>>>>>>>.");
|
|
||||||
|
|
||||||
|
|
||||||
sendDataToViewModel("Hello there");
|
|
||||||
|
|
||||||
createNotification();
|
|
||||||
|
|
||||||
// Observer<List<PayDetail>> settleObserver = new Observer<List<PayDetail>>() {
|
|
||||||
// @Override
|
|
||||||
// public void onChanged(List<PayDetail> list) {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// if(list == null || list.size() == 0) {
|
|
||||||
// LogUtil.d(TAG, "Settle is null");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// LogUtil.d(TAG,"Size Settle : "+list.size());
|
|
||||||
//
|
|
||||||
// for (PayDetail pay:list) {
|
|
||||||
// repository.deletePayDetail(pay);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// repository.getSettlementPOS().observeForever(settleObserver);
|
|
||||||
//
|
|
||||||
// repository.getSettlementPOS().removeObserver(settleObserver);
|
|
||||||
//
|
|
||||||
// Observer<List<PayDetail>> deleteTransObserver = new Observer<List<PayDetail>>() {
|
|
||||||
// @Override
|
|
||||||
// public void onChanged(List<PayDetail> lists) {
|
|
||||||
// if(lists == null || lists.size() == 0) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// LogUtil.d(TAG,"Size Delete Trans : "+lists.size());
|
|
||||||
// for (PayDetail pay:lists) {
|
|
||||||
// repository.deletePayDetail(pay);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// repository.getDeleteTrans(SystemParamsOperation.getInstance().getCurrentBatchNum()).observeForever(deleteTransObserver);
|
|
||||||
//
|
|
||||||
// repository.getDeleteTrans(SystemParamsOperation.getInstance().getCurrentBatchNum()).removeObserver(deleteTransObserver);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
// try{
|
|
||||||
// handler.post(new Runnable() {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// // Create and show the dialog
|
|
||||||
// AlertDialog.Builder builder = new AlertDialog.Builder(SmileSettleService.this);
|
|
||||||
// builder.setTitle("Auto Settle!")
|
|
||||||
// .setMessage("Settlement process is going to start!")
|
|
||||||
// .setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onClick(DialogInterface dialog, int which) {
|
|
||||||
// // Handle OK button click
|
|
||||||
// dialog.dismiss(); // Dismiss the dialog
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onClick(DialogInterface dialog, int which) {
|
|
||||||
// // Handle Cancel button click
|
|
||||||
// dialog.dismiss(); // Dismiss the dialog
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// AlertDialog dialog = builder.create();
|
|
||||||
//// dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
|
|
||||||
//// dialog.show();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }catch (Exception e){
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
return START_NOT_STICKY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
handler = new Handler();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public IBinder onBind(Intent intent) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onUnbind(Intent intent) {
|
|
||||||
return super.onUnbind(intent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,17 +1,24 @@
|
|||||||
package com.utsmm.kbz.ui;
|
package com.utsmm.kbz.ui;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.lifecycle.Observer;
|
import androidx.lifecycle.Observer;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
|
||||||
import androidx.navigation.Navigation;
|
import androidx.navigation.Navigation;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.stream.MalformedJsonException;
|
import com.google.gson.stream.MalformedJsonException;
|
||||||
|
import com.utsmm.kbz.config.Constants;
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadFEntity;
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadFlow;
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadFlowProcessListener;
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadFlowResultEntity;
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadResult;
|
||||||
import com.utsmyanmar.baselib.emv.EmvParamOperation;
|
import com.utsmyanmar.baselib.emv.EmvParamOperation;
|
||||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
import com.utsmyanmar.baselib.network.model.sirius.SiriusError;
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusError;
|
||||||
@ -50,6 +57,7 @@ public class SettingsFragment extends DataBindingFragment {
|
|||||||
private MainViewModel mainViewModel;
|
private MainViewModel mainViewModel;
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
|
||||||
|
|
||||||
// Data binding will handle view access automatically
|
// Data binding will handle view access automatically
|
||||||
private FragmentSettingsModernBinding binding;
|
private FragmentSettingsModernBinding binding;
|
||||||
|
|
||||||
@ -90,9 +98,11 @@ public class SettingsFragment extends DataBindingFragment {
|
|||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
try {
|
try {
|
||||||
LogUtil.d(TAG, "onViewCreated called");
|
LogUtil.d(TAG, "onViewCreated called");
|
||||||
|
SystemParamsOperation.getInstance().setDemoStatus(false);
|
||||||
|
|
||||||
// Get the binding from the base class - this is automatically created
|
// Get the binding from the base class - this is automatically created
|
||||||
binding = (FragmentSettingsModernBinding) mBinding;
|
binding = (FragmentSettingsModernBinding) mBinding;
|
||||||
|
updateDemoSettings();
|
||||||
|
|
||||||
LogUtil.d(TAG, "Updating settings...");
|
LogUtil.d(TAG, "Updating settings...");
|
||||||
updateSettings();
|
updateSettings();
|
||||||
@ -102,6 +112,7 @@ public class SettingsFragment extends DataBindingFragment {
|
|||||||
LogUtil.e(TAG, "Error initializing fragment: " + e.getMessage());
|
LogUtil.e(TAG, "Error initializing fragment: " + e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -144,35 +155,34 @@ public class SettingsFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
private void updateDemoSettings() {
|
private void updateDemoSettings() {
|
||||||
boolean isDemo = SystemParamsOperation.getInstance().getDemoStatus();
|
boolean isDemo = SystemParamsOperation.getInstance().getDemoStatus();
|
||||||
binding.demoSwitch.setChecked(isDemo);
|
// binding.demoSwitch.setChecked(isDemo);
|
||||||
binding.demoSummary.setText(isDemo ?
|
// binding.demoSummary.setText(isDemo ?
|
||||||
"Demo mode active - Test transactions without real processing" :
|
// "Demo mode active - Test transactions without real processing" :
|
||||||
"Simulator mode active - Real transaction processing");
|
// "Simulator mode active - Real transaction processing");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAlertSoundSettings() {
|
private void updateAlertSoundSettings() {
|
||||||
boolean isEnabled = SystemParamsOperation.getInstance().isAlertSound();
|
boolean isEnabled = SystemParamsOperation.getInstance().isAlertSound();
|
||||||
binding.alertSoundSwitch.setChecked(isEnabled);
|
// binding.alertSoundSwitch.setChecked(isEnabled);
|
||||||
binding.alertSoundSummary.setText(isEnabled ?
|
// binding.alertSoundSummary.setText(isEnabled ?
|
||||||
"Sound alerts enabled for notifications" :
|
// "Sound alerts enabled for notifications" :
|
||||||
"Sound alerts disabled - Silent mode");
|
// "Sound alerts disabled - Silent mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void updateReversalSettings() {
|
private void updateReversalSettings() {
|
||||||
boolean isEnabled = SystemParamsOperation.getInstance().isReversalOn();
|
boolean isEnabled = SystemParamsOperation.getInstance().isReversalOn();
|
||||||
binding.reversalSwitch.setChecked(isEnabled);
|
// binding.reversalSwitch.setChecked(isEnabled);
|
||||||
binding.reversalSummary.setText(isEnabled ?
|
// binding.reversalSummary.setText(isEnabled ?
|
||||||
"Automatic reversal enabled for failed transactions" :
|
// "Automatic reversal enabled for failed transactions" :
|
||||||
"Automatic reversal disabled - Manual reversal only");
|
// "Automatic reversal disabled - Manual reversal only");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMultiHostSettings() {
|
private void updateMultiHostSettings() {
|
||||||
boolean isEnabled = SystemParamsOperation.getInstance().isMultiHost();
|
boolean isEnabled = SystemParamsOperation.getInstance().isMultiHost();
|
||||||
binding.multiHostSwitch.setChecked(isEnabled);
|
// binding.multiHostSwitch.setChecked(isEnabled);
|
||||||
binding.multiHostSummary.setText(isEnabled ?
|
// binding.multiHostSummary.setText(isEnabled ?
|
||||||
"Multiple host support enabled" :
|
// "Multiple host support enabled" :
|
||||||
"Single host mode - Primary host only");
|
// "Single host mode - Primary host only");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTmsAddressSettings() {
|
private void updateTmsAddressSettings() {
|
||||||
@ -183,6 +193,12 @@ public class SettingsFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
// ClickEvent class for data binding - this is the proper pattern
|
// ClickEvent class for data binding - this is the proper pattern
|
||||||
public class ClickEvent {
|
public class ClickEvent {
|
||||||
|
public void onHostConfigClick(){
|
||||||
|
int routeId = R.id.action_nav_settings_to_hostConfigFragment;
|
||||||
|
int currentId = R.id.nav_settings;
|
||||||
|
int hostId = Constants.NAV_HOST_ID;
|
||||||
|
safeRouteTo(currentId, routeId, hostId);
|
||||||
|
}
|
||||||
|
|
||||||
public void onVersionClick() {
|
public void onVersionClick() {
|
||||||
try {
|
try {
|
||||||
@ -197,6 +213,16 @@ public class SettingsFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onInjectKeyClick() {
|
||||||
|
try {
|
||||||
|
LogUtil.d(TAG, "Inject Key clicked");
|
||||||
|
Navigation.findNavController(requireActivity(), R.id.nav_host_fragment)
|
||||||
|
.navigate(R.id.action_nav_settings_to_injectKeyFragment);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.e(TAG, "Error navigating to inject key: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onDemoClick() {
|
public void onDemoClick() {
|
||||||
try {
|
try {
|
||||||
boolean newValue = !SystemParamsOperation.getInstance().getDemoStatus();
|
boolean newValue = !SystemParamsOperation.getInstance().getDemoStatus();
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package com.utsmm.kbz.ui.adapters;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
@ -299,4 +301,5 @@ public class MyBindingAdapter {
|
|||||||
textView.setText("TRC:"+payDetail.getVoucherNo());
|
textView.setText("TRC:"+payDetail.getVoucherNo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,78 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private final int[] colors = new int[]{
|
||||||
|
R.color.colorPrimary,
|
||||||
|
R.color.amber,
|
||||||
|
R.color.forestGreen
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
|
QRPayItem item = items.get(position);
|
||||||
|
|
||||||
|
holder.binding.setItem(item);
|
||||||
|
holder.binding.executePendingBindings();
|
||||||
|
|
||||||
|
holder.binding.btnItem.setOnClickListener(v -> {
|
||||||
|
if(item.isActive && 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() {
|
public void onClickManualEntry() {
|
||||||
|
|
||||||
// showSingleInfoDialogAutoHide("Coming Soon!");
|
|
||||||
|
|
||||||
routeId = R.id.action_cardWaitingFragment_to_manualEntryFragment;
|
routeId = R.id.action_cardWaitingFragment_to_manualEntryFragment;
|
||||||
safeNavigateToRouteId();
|
safeNavigateToRouteId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onClickTap() {
|
||||||
|
cardReadViewModel.setCardTransactionType(CardTransactionType.MOCK);
|
||||||
|
routeId = R.id.action_cardWaitingFragment_to_processingCardFragment;
|
||||||
|
safeNavigateToRouteId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -178,7 +178,7 @@ public class EmvReadCardFragment extends DataBindingFragment {
|
|||||||
if(payDetails.size() > 0) {
|
if(payDetails.size() > 0) {
|
||||||
LogUtil.d(TAG,"Pre Auth Comp size :"+payDetails.size());
|
LogUtil.d(TAG,"Pre Auth Comp size :"+payDetails.size());
|
||||||
lists.addAll(payDetails);
|
lists.addAll(payDetails);
|
||||||
sharedViewModel.payDetailList.postValue(payDetails);
|
// sharedViewModel.payDetailList.postValue(payDetails);
|
||||||
} else {
|
} else {
|
||||||
LogUtil.d(TAG,"Pre Auth Comp data not found!");
|
LogUtil.d(TAG,"Pre Auth Comp data not found!");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
|
import com.utsmyanmar.baselib.ui.NumberKeyboard;
|
||||||
import com.utsmyanmar.baselib.util.CardDetectCallback;
|
import com.utsmyanmar.baselib.util.CardDetectCallback;
|
||||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
import com.utsmyanmar.baselib.util.TimeoutCallback;
|
import com.utsmyanmar.baselib.util.TimeoutCallback;
|
||||||
@ -98,6 +99,21 @@ public class InputAmountFragment extends DataBindingFragment implements DataBind
|
|||||||
|
|
||||||
setToolBarTitleWithBackIcon(getResourceString(R.string.txt_subtitle_amount));
|
setToolBarTitleWithBackIcon(getResourceString(R.string.txt_subtitle_amount));
|
||||||
|
|
||||||
|
boolean decimalEnabled = SystemParamsOperation.getInstance().getDecimalEnable();
|
||||||
|
boolean qrDecimalEnabled = SystemParamsOperation.getInstance().isQrDecimalEnable();
|
||||||
|
boolean isDecimalEnabled;
|
||||||
|
|
||||||
|
if(sharedViewModel.transactionsType.getValue() == TransactionsType.MMQR){
|
||||||
|
isDecimalEnabled = qrDecimalEnabled;
|
||||||
|
}else {
|
||||||
|
isDecimalEnabled = decimalEnabled;
|
||||||
|
}
|
||||||
|
View keyboardView = getView().findViewById(R.id.numberKeyboard);
|
||||||
|
|
||||||
|
if (keyboardView instanceof NumberKeyboard) {
|
||||||
|
((NumberKeyboard) keyboardView).setDecimalEnable(isDecimalEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
if(sharedViewModel.isEcr.getValue() != null){
|
if(sharedViewModel.isEcr.getValue() != null){
|
||||||
if(sharedViewModel.isEcr.getValue()){
|
if(sharedViewModel.isEcr.getValue()){
|
||||||
|
|
||||||
|
|||||||
@ -142,6 +142,10 @@ 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);
|
||||||
|
routeId = R.id.action_inputPasswordFragment_to_QRRefundProcessFragment;
|
||||||
|
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));
|
||||||
@ -180,7 +184,7 @@ public class InputPasswordFragment extends DataBindingFragment implements DataBi
|
|||||||
break;
|
break;
|
||||||
case SETTLEMENT:
|
case SETTLEMENT:
|
||||||
inputPasswordViewModel.passwordType.setValue(InputPasswordType.SETTLEMENT);
|
inputPasswordViewModel.passwordType.setValue(InputPasswordType.SETTLEMENT);
|
||||||
routeId = R.id.action_inputPasswordFragment_to_settlementTransactionFragment;
|
routeId = R.id.action_inputPasswordFragment_to_selectSettlementFragment;
|
||||||
break;
|
break;
|
||||||
case SETTING:
|
case SETTING:
|
||||||
inputPasswordViewModel.passwordType.setValue(InputPasswordType.SETTING);
|
inputPasswordViewModel.passwordType.setValue(InputPasswordType.SETTING);
|
||||||
|
|||||||
@ -220,11 +220,13 @@ public class InputRRNFragment extends DataBindingFragment {
|
|||||||
newPay = transProcessViewModel.getPayDetail();
|
newPay = transProcessViewModel.getPayDetail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
newPay.setReferNo(rrnNo);
|
newPay.setReferNo(rrnNo);
|
||||||
if(sharedViewModel.getTransMenu().getValue() == TransMenu.PRE_AUTH_FULL_VOID) {
|
if(sharedViewModel.getTransMenu().getValue() == TransMenu.PRE_AUTH_FULL_VOID) {
|
||||||
newPay.setAmount(payDetail.getAmount());
|
newPay.setAmount(payDetail.getAmount());
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
sharedViewModel.setAmount(POSUtil.getInstance().getDecimalAmountFormat(payDetail.getAmount()));
|
||||||
newPay.setTradeDateTime(payDetail.getTradeDateTime());
|
newPay.setTradeDateTime(payDetail.getTradeDateTime());
|
||||||
|
|
||||||
if(isEmvTrans()) {
|
if(isEmvTrans()) {
|
||||||
@ -311,7 +313,9 @@ public class InputRRNFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newPay.setReferNo(rrnNo);
|
newPay.setReferNo(rrnNo);
|
||||||
|
newPay.setApprovalCode(payDetail.getApprovalCode());
|
||||||
|
newPay.setTradeTime(payDetail.getTradeTime());
|
||||||
|
newPay.setTradeDate(payDetail.getTradeDate());
|
||||||
if(newPay.getAmount() > payDetail.getAmount()) {
|
if(newPay.getAmount() > payDetail.getAmount()) {
|
||||||
newPay.setTradeAnswerCode("C1"); // ---> refer to BaseErrorCode class// ,
|
newPay.setTradeAnswerCode("C1"); // ---> refer to BaseErrorCode class// ,
|
||||||
newPay.setTransType(sharedViewModel.transactionsType.getValue().name);
|
newPay.setTransType(sharedViewModel.transactionsType.getValue().name);
|
||||||
|
|||||||
@ -299,7 +299,7 @@ public class InputTraceNoFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
if(sharedViewModel.hostType.getValue() == HostType.MPU) {
|
if(sharedViewModel.hostType.getValue() == HostType.MPU) {
|
||||||
sharedViewModel.isEmv.setValue(false);
|
sharedViewModel.isEmv.setValue(false);
|
||||||
transProcessViewModel.transType.postValue(sharedViewModel.transactionsType.getValue());
|
transProcessViewModel.transType.setValue(sharedViewModel.transactionsType.getValue());
|
||||||
transProcessViewModel.setOldTransPayDetail(payDetail);
|
transProcessViewModel.setOldTransPayDetail(payDetail);
|
||||||
transProcessViewModel.setPayDetail(payDetail);
|
transProcessViewModel.setPayDetail(payDetail);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import android.view.View;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.utsmm.kbz.util.MockData;
|
||||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
import com.utsmyanmar.checkxread.model.CardDataX;
|
import com.utsmyanmar.checkxread.model.CardDataX;
|
||||||
@ -41,6 +42,8 @@ public class ProcessingCardFragment extends DataBindingFragment {
|
|||||||
private TransProcessViewModel transProcessViewModel;
|
private TransProcessViewModel transProcessViewModel;
|
||||||
private PinPadViewModel pinPadViewModel;
|
private PinPadViewModel pinPadViewModel;
|
||||||
private EmvTransactionProcessViewModel emvTransactionViewModel;
|
private EmvTransactionProcessViewModel emvTransactionViewModel;
|
||||||
|
|
||||||
|
|
||||||
private int routeId;
|
private int routeId;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -102,9 +105,24 @@ public class ProcessingCardFragment extends DataBindingFragment {
|
|||||||
break;
|
break;
|
||||||
case MAG: readMAGStripe(false,true);
|
case MAG: readMAGStripe(false,true);
|
||||||
break;
|
break;
|
||||||
|
case MOCK: mockMPUCard();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void mockMPUCard() {
|
||||||
|
LogUtil.d(TAG,"initialize mock card data...");
|
||||||
|
routeId = R.id.action_processingCardFragment_to_pinPadFragment;
|
||||||
|
transProcessViewModel.transType.setValue(sharedViewModel.transactionsType.getValue());
|
||||||
|
pinPadViewModel.transType.setValue(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() {
|
private void readMPUCard() {
|
||||||
cardReadViewModel.startReadXProcess(MPUXReadCard.getInstance(), new ReadCardResultX() {
|
cardReadViewModel.startReadXProcess(MPUXReadCard.getInstance(), new ReadCardResultX() {
|
||||||
@ -112,18 +130,19 @@ public class ProcessingCardFragment extends DataBindingFragment {
|
|||||||
public void onSuccess(CardDataX cardDataX) {
|
public void onSuccess(CardDataX cardDataX) {
|
||||||
|
|
||||||
routeId = R.id.action_processingCardFragment_to_pinPadFragment;
|
routeId = R.id.action_processingCardFragment_to_pinPadFragment;
|
||||||
transProcessViewModel.transType.postValue(sharedViewModel.transactionsType.getValue());
|
transProcessViewModel.transType.setValue(sharedViewModel.transactionsType.getValue());
|
||||||
pinPadViewModel.transType.postValue(sharedViewModel.transactionsType.getValue());
|
pinPadViewModel.transType.setValue(sharedViewModel.transactionsType.getValue());
|
||||||
|
|
||||||
TradeData tradeData = TransactionUtil.getInstance().initMPUTransaction(cardDataX, CardTypeX.IC);
|
TradeData tradeData = TransactionUtil.getInstance().initMPUTransaction(cardDataX, CardTypeX.IC);
|
||||||
transProcessViewModel.setTradeData(tradeData);
|
transProcessViewModel.setTradeData(tradeData);
|
||||||
pinPadViewModel.setTradeData(tradeData);
|
pinPadViewModel.setTradeData(tradeData);
|
||||||
|
|
||||||
if(sharedViewModel.getTransMenu().getValue() == TransMenu.PRE_AUTH_PARTIAL_VOID ) {
|
if(sharedViewModel.getTransactionsType().getValue() == TransactionsType.PRE_AUTH_VOID ) {
|
||||||
|
|
||||||
sharedViewModel.set_errorFragmentMsg(getResourceString(R.string.txt_function_not_supported));
|
sharedViewModel.set_errorFragmentMsg(getResourceString(R.string.txt_alert_pre_auth_cancel));
|
||||||
routeId = R.id.action_processingCardFragment_to_errorFragment;
|
routeId = R.id.action_processingCardFragment_to_errorFragment;
|
||||||
|
safeNavigateToRouteId();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
// else if(sharedViewModel.transactionsType.getValue() == TransactionsType.REFUND) {
|
// else if(sharedViewModel.transactionsType.getValue() == TransactionsType.REFUND) {
|
||||||
// sharedViewModel.set_errorFragmentMsg(getResourceString(R.string.txt_card_not_supported));
|
// sharedViewModel.set_errorFragmentMsg(getResourceString(R.string.txt_card_not_supported));
|
||||||
@ -164,7 +183,7 @@ public class ProcessingCardFragment extends DataBindingFragment {
|
|||||||
// pin required scenario
|
// pin required scenario
|
||||||
|
|
||||||
routeId = R.id.action_processingCardFragment_to_pinPadFragment;
|
routeId = R.id.action_processingCardFragment_to_pinPadFragment;
|
||||||
transProcessViewModel.transType.postValue(sharedViewModel.transactionsType.getValue());
|
transProcessViewModel.transType.setValue(sharedViewModel.transactionsType.getValue());
|
||||||
pinPadViewModel.transType.postValue(sharedViewModel.transactionsType.getValue());
|
pinPadViewModel.transType.postValue(sharedViewModel.transactionsType.getValue());
|
||||||
|
|
||||||
/* need to check card scheme according to card number --!^--- check below function*/
|
/* need to check card scheme according to card number --!^--- check below function*/
|
||||||
@ -189,10 +208,11 @@ public class ProcessingCardFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(sharedViewModel.getTransMenu().getValue() == TransMenu.PRE_AUTH_PARTIAL_VOID ) {
|
if(sharedViewModel.getTransactionsType().getValue() == TransactionsType.PRE_AUTH_VOID ) {
|
||||||
// sharedViewModel.transMenu.postValue(null);
|
|
||||||
sharedViewModel.setTransMenu(null);
|
sharedViewModel.set_errorFragmentMsg(getResourceString(R.string.txt_alert_pre_auth_cancel));
|
||||||
routeId = R.id.action_processingCardFragment_to_errorFragment;
|
routeId = R.id.action_processingCardFragment_to_errorFragment;
|
||||||
|
|
||||||
}
|
}
|
||||||
// else if(sharedViewModel.transactionsType.getValue() == TransactionsType.REFUND) {
|
// else if(sharedViewModel.transactionsType.getValue() == TransactionsType.REFUND) {
|
||||||
// routeId = R.id.action_processingCardFragment_to_errorFragment;
|
// routeId = R.id.action_processingCardFragment_to_errorFragment;
|
||||||
|
|||||||
@ -9,7 +9,12 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
import androidx.navigation.NavDestination;
|
import androidx.navigation.NavDestination;
|
||||||
|
|
||||||
|
import com.utsmm.kbz.util.tms.TMSUtil;
|
||||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
|
import com.utsmyanmar.baselib.network.model.e_receipt.EReceiptCardRequest;
|
||||||
|
import com.utsmm.kbz.util.EReceiptUtil;
|
||||||
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
|
import com.utsmyanmar.baselib.network.model.e_receipt.EReceiptRequest;
|
||||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
import com.utsmyanmar.baselib.util.TimeoutCallback;
|
import com.utsmyanmar.baselib.util.TimeoutCallback;
|
||||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
@ -25,6 +30,8 @@ import com.utsmm.kbz.util.ecr.CoreUtils;
|
|||||||
|
|
||||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
public class ProcessingFragment extends DataBindingFragment {
|
public class ProcessingFragment extends DataBindingFragment {
|
||||||
|
|
||||||
private static final String TAG = ProcessingFragment.class.getSimpleName();
|
private static final String TAG = ProcessingFragment.class.getSimpleName();
|
||||||
@ -168,14 +175,17 @@ public class ProcessingFragment extends DataBindingFragment {
|
|||||||
} else {
|
} else {
|
||||||
LogUtil.d(TAG,"Updated sharedViewmodel payDetail for non emv");
|
LogUtil.d(TAG,"Updated sharedViewmodel payDetail for non emv");
|
||||||
sharedViewModel.payDetail.setValue(transProcessViewModel.payDetailResult.getValue());
|
sharedViewModel.payDetail.setValue(transProcessViewModel.payDetailResult.getValue());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EReceiptRequest request = EReceiptUtil.getInstance().generateMPUReceipt(sharedViewModel.payDetail.getValue());
|
||||||
|
sharedViewModel.pushReceipt(request);
|
||||||
// transProcessViewModel.payDetailResult.observe(getViewLifecycleOwner(), payDetail -> sharedViewModel.payDetail.postValue(payDetail));
|
// transProcessViewModel.payDetailResult.observe(getViewLifecycleOwner(), payDetail -> sharedViewModel.payDetail.postValue(payDetail));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void callNextScreen(){
|
private void callNextScreen(){
|
||||||
updateData();
|
// updateData();
|
||||||
if (requiresSignature()) {
|
if (requiresSignature()) {
|
||||||
routeId = R.id.action_processingFragment_to_signatureFragment;
|
routeId = R.id.action_processingFragment_to_signatureFragment;
|
||||||
} else {
|
} else {
|
||||||
@ -203,7 +213,7 @@ public class ProcessingFragment extends DataBindingFragment {
|
|||||||
LogUtil.d(TAG,"tradeAnswerCode: "+payDetail.getTradeAnswerCode());
|
LogUtil.d(TAG,"tradeAnswerCode: "+payDetail.getTradeAnswerCode());
|
||||||
|
|
||||||
// For now, let's check if it's a card transaction and successful
|
// For now, let's check if it's a card transaction and successful
|
||||||
boolean isSuccessful = "00".equals(payDetail.getTradeAnswerCode());
|
boolean isSuccessful = "00".equals(payDetail.getTradeAnswerCode()) || "000".equals(payDetail.getTradeAnswerCode());
|
||||||
|
|
||||||
// You can customize this logic based on your business requirements
|
// You can customize this logic based on your business requirements
|
||||||
return isSuccessful && !isEmvTrans(); // Require signature for successful non-EMV transactions
|
return isSuccessful && !isEmvTrans(); // Require signature for successful non-EMV transactions
|
||||||
@ -248,13 +258,23 @@ public class ProcessingFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
private void observeData(ProcessingTransaction processingTransaction) {
|
private void observeData(ProcessingTransaction processingTransaction) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
processingTransaction.getTransStatus().observe(getViewLifecycleOwner(), transResultStatus -> {
|
processingTransaction.getTransStatus().observe(getViewLifecycleOwner(), transResultStatus -> {
|
||||||
LogUtil.d(TAG,"Transaction RESULT :"+transResultStatus);
|
LogUtil.d(TAG,"Transaction RESULT :"+transResultStatus);
|
||||||
|
PayDetail payDetail = isEmvTrans()
|
||||||
|
? emvTransactionProcessViewModel.payDetailResult.getValue()
|
||||||
|
: transProcessViewModel.payDetailResult.getValue();
|
||||||
|
LogUtil.d(TAG, "PayDetail from VM: " + payDetail);
|
||||||
|
|
||||||
switch (transResultStatus) {
|
switch (transResultStatus) {
|
||||||
case FAIL:
|
case FAIL:
|
||||||
|
sharedViewModel.pushReceipt(buildEReceiptCardReceipt(payDetail, false, "FAILED"));
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
|
sharedViewModel.pushReceipt(buildEReceiptCardReceipt(payDetail, true, "SUCCESS"));
|
||||||
case OFFLINE_SUCCESS:
|
case OFFLINE_SUCCESS:
|
||||||
LogUtil.d(TAG,"This was called!");
|
|
||||||
if(SystemParamsOperation.getInstance().getDemoStatus()) {
|
if(SystemParamsOperation.getInstance().getDemoStatus()) {
|
||||||
delayFunctionCall(()->{
|
delayFunctionCall(()->{
|
||||||
// updateData();
|
// updateData();
|
||||||
@ -263,6 +283,7 @@ public class ProcessingFragment extends DataBindingFragment {
|
|||||||
},1500);
|
},1500);
|
||||||
} else {
|
} else {
|
||||||
// updateData();
|
// updateData();
|
||||||
|
|
||||||
sharedViewModel.dismissLoadingMsg();
|
sharedViewModel.dismissLoadingMsg();
|
||||||
callNextScreen();
|
callNextScreen();
|
||||||
}
|
}
|
||||||
@ -366,4 +387,108 @@ public class ProcessingFragment extends DataBindingFragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String mapDE3ToShortCode(String de3) {
|
||||||
|
if (de3 == null) return "UNK";
|
||||||
|
|
||||||
|
switch (de3) {
|
||||||
|
case "000000": return "S"; // Sale
|
||||||
|
case "020000": return "V"; // Void
|
||||||
|
case "200000": return "R"; // Refund
|
||||||
|
case "030000": return "P"; // Preauth
|
||||||
|
case "310000": return "PC"; // Preauth Complete
|
||||||
|
}
|
||||||
|
return "UNK"; // Unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String mapTransactionType(int type) {
|
||||||
|
switch (type) {
|
||||||
|
case 1: // SALE
|
||||||
|
return "S";
|
||||||
|
|
||||||
|
case 2: // VOID SALE
|
||||||
|
return "V";
|
||||||
|
|
||||||
|
case 4: // REFUND
|
||||||
|
return "R";
|
||||||
|
|
||||||
|
case 5: // PRE-AUTH
|
||||||
|
return "P";
|
||||||
|
|
||||||
|
case 6: // PRE-AUTH VOID
|
||||||
|
return "PV";
|
||||||
|
|
||||||
|
case 7: // PRE-AUTH COMPLETE
|
||||||
|
return "PC";
|
||||||
|
|
||||||
|
case 8: // PRE-AUTH COMPLETE VOID
|
||||||
|
return "PCV";
|
||||||
|
|
||||||
|
case 9: // CASH OUT
|
||||||
|
return "CAV";
|
||||||
|
|
||||||
|
case 18: // TIP ADJUST
|
||||||
|
return "TA";
|
||||||
|
|
||||||
|
case 20: // QR PAYMENT
|
||||||
|
return "QR";
|
||||||
|
|
||||||
|
case 34: // QR REFUND
|
||||||
|
return "QRV";
|
||||||
|
|
||||||
|
default:
|
||||||
|
return "UNK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private String mapCurrency(String currency) {
|
||||||
|
if (currency == null) return "MMK";
|
||||||
|
|
||||||
|
switch (currency) {
|
||||||
|
case "104": return "MMK";
|
||||||
|
case "840": return "USD";
|
||||||
|
case "764": return "THB";
|
||||||
|
case "702": return "SGD";
|
||||||
|
case "978": return "EUR";
|
||||||
|
default: return currency; // Already alphabetic? return as-is
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private EReceiptCardRequest buildEReceiptCardReceipt(PayDetail payDetail, boolean isSuccess, String reason){
|
||||||
|
//current timestamp
|
||||||
|
String currentTimestamp = new java.text.SimpleDateFormat(
|
||||||
|
"MMddHHmmss", java.util.Locale.getDefault()
|
||||||
|
).format(new java.util.Date());
|
||||||
|
|
||||||
|
//DeviceInfo
|
||||||
|
String serial = TMSUtil.getInstance().getSerialNumber();
|
||||||
|
String appId = requireActivity().getPackageName();
|
||||||
|
|
||||||
|
//TerminalInfo
|
||||||
|
String terminalId = SystemParamsOperation.getInstance().getTerminalId();
|
||||||
|
String merchantId = SystemParamsOperation.getInstance().getMerchantId();
|
||||||
|
|
||||||
|
double realAmount = payDetail.getAmount() / 100.0;
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
String amount = df.format(realAmount);
|
||||||
|
|
||||||
|
EReceiptCardRequest request = new EReceiptCardRequest();
|
||||||
|
request.setDE2(payDetail.getCardNo());
|
||||||
|
request.setDE3(mapDE3ToShortCode(payDetail.getProcessCode()));
|
||||||
|
request.setDE4(amount);
|
||||||
|
request.setDE7(currentTimestamp);
|
||||||
|
request.setDE11(payDetail.getVoucherNo());
|
||||||
|
request.setDE22(mapTransactionType(payDetail.getTransactionType()));
|
||||||
|
request.setDE37(payDetail.getReferNo());
|
||||||
|
request.setDE38(payDetail.getAuthNo());
|
||||||
|
request.setDE39(isSuccess ? "A" : "E");
|
||||||
|
request.setDE41(terminalId);
|
||||||
|
request.setDE42(merchantId);
|
||||||
|
request.setDE49(mapCurrency(payDetail.getCurrencyCode()));
|
||||||
|
request.setSerial(serial);
|
||||||
|
request.setInvoiceNumber(payDetail.getInvoiceNo());
|
||||||
|
request.setAppId(appId);
|
||||||
|
request.setDescription(reason);
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,11 @@ import com.utsmm.kbz.R;
|
|||||||
import com.utsmm.kbz.config.Constants;
|
import com.utsmm.kbz.config.Constants;
|
||||||
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||||
|
|
||||||
|
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||||
|
import com.utsmyanmar.paylibs.print.printx.PrintX;
|
||||||
|
import com.utsmyanmar.paylibs.print.printx.PrintXReceipt;
|
||||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||||
|
import com.utsmyanmar.paylibs.utils.print_utils.BitmapUtils;
|
||||||
|
|
||||||
public class SignatureFragment extends DataBindingFragment {
|
public class SignatureFragment extends DataBindingFragment {
|
||||||
|
|
||||||
@ -130,6 +134,12 @@ public class SignatureFragment extends DataBindingFragment {
|
|||||||
safeNavigateToRouteId();
|
safeNavigateToRouteId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateData() {
|
||||||
|
PayDetail payDetail = sharedViewModel.payDetail.getValue();
|
||||||
|
payDetail.setESignHexData(BitmapUtils.bitmapToHexString(mSignaturePad.getSignatureBitmap()));
|
||||||
|
sharedViewModel.payDetail.setValue(payDetail);
|
||||||
|
}
|
||||||
|
|
||||||
public class ClickEvent {
|
public class ClickEvent {
|
||||||
|
|
||||||
|
|
||||||
@ -138,6 +148,8 @@ public class SignatureFragment extends DataBindingFragment {
|
|||||||
// Handle digital signature
|
// Handle digital signature
|
||||||
if (isSigned) {
|
if (isSigned) {
|
||||||
sharedViewModel.signBitmap = mSignaturePad.getSignatureBitmap();
|
sharedViewModel.signBitmap = mSignaturePad.getSignatureBitmap();
|
||||||
|
|
||||||
|
updateData();
|
||||||
LogUtil.d(TAG, "Digital signature confirmed and stored");
|
LogUtil.d(TAG, "Digital signature confirmed and stored");
|
||||||
callNextScreen();
|
callNextScreen();
|
||||||
} else {
|
} else {
|
||||||
@ -147,7 +159,6 @@ public class SignatureFragment extends DataBindingFragment {
|
|||||||
// Handle manual signature on paper
|
// Handle manual signature on paper
|
||||||
sharedViewModel.signBitmap = null; // No digital signature
|
sharedViewModel.signBitmap = null; // No digital signature
|
||||||
LogUtil.d(TAG, "Manual signature on paper selected - no digital signature stored");
|
LogUtil.d(TAG, "Manual signature on paper selected - no digital signature stored");
|
||||||
showSingleInfoDialog("Please sign on the printed receipt manually and proceed.");
|
|
||||||
callNextScreen();
|
callNextScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import androidx.appcompat.app.AlertDialog;
|
|||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonSyntaxException;
|
||||||
import com.google.gson.stream.MalformedJsonException;
|
import com.google.gson.stream.MalformedJsonException;
|
||||||
import com.utsmyanmar.baselib.emv.EmvParamOperation;
|
import com.utsmyanmar.baselib.emv.EmvParamOperation;
|
||||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
@ -42,12 +43,13 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
import retrofit2.HttpException;
|
import retrofit2.HttpException;
|
||||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||||
|
|
||||||
|
|
||||||
// Temporarily disabled Hilt
|
// Temporarily disabled Hilt
|
||||||
// @AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
public class TransactionResultFragment extends DataBindingFragment implements DataBindingFragment.BackPressCallback {
|
public class TransactionResultFragment extends DataBindingFragment implements DataBindingFragment.BackPressCallback {
|
||||||
|
|
||||||
private static final String TAG = TransactionResultFragment.class.getSimpleName();
|
private static final String TAG = TransactionResultFragment.class.getSimpleName();
|
||||||
@ -146,6 +148,8 @@ public class TransactionResultFragment extends DataBindingFragment implements Da
|
|||||||
|
|
||||||
PayDetail payDetail = sharedViewModel.payDetail.getValue();
|
PayDetail payDetail = sharedViewModel.payDetail.getValue();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (payDetail == null) {
|
if (payDetail == null) {
|
||||||
navigateToMainScreen();
|
navigateToMainScreen();
|
||||||
return;
|
return;
|
||||||
@ -162,10 +166,11 @@ public class TransactionResultFragment extends DataBindingFragment implements Da
|
|||||||
if (isNonApprovedTrade(payDetail) && isNonWavepayTransaction(transactionType)) {
|
if (isNonApprovedTrade(payDetail) && isNonWavepayTransaction(transactionType)) {
|
||||||
startPrintProcess(false);
|
startPrintProcess(false);
|
||||||
isCardInside();
|
isCardInside();
|
||||||
} else if (transactionType == TransactionsType.SETTLEMENT) {
|
} else if (transactionType == TransactionsType.SETTLEMENT || transactionType == TransactionsType.MMQR_SETTLEMENT) {
|
||||||
handleSettlementTransaction(siriusReq);
|
handleSettlementTransaction(siriusReq);
|
||||||
} else if (isWavePayNonSuccessTransaction(transactionType, payDetail)) {
|
} else if (isWavePayNonSuccessTransaction(transactionType, payDetail)) {
|
||||||
startPrintProcess(false);
|
// startPrintProcess(false);
|
||||||
|
showDeclineDialog("QR Payment Failed!");
|
||||||
navigateToMainScreen();
|
navigateToMainScreen();
|
||||||
} else if (isWavePaySuccessTransaction(transactionType, payDetail)) {
|
} else if (isWavePaySuccessTransaction(transactionType, payDetail)) {
|
||||||
handleWavePaySuccessTransaction(payDetail, siriusReq);
|
handleWavePaySuccessTransaction(payDetail, siriusReq);
|
||||||
@ -203,7 +208,7 @@ public class TransactionResultFragment extends DataBindingFragment implements Da
|
|||||||
private void handleSettlementTransaction(SiriusRequest siriusReq) {
|
private void handleSettlementTransaction(SiriusRequest siriusReq) {
|
||||||
startPrintProcess(true);
|
startPrintProcess(true);
|
||||||
downloadParameters(siriusReq, TMSUpdate.UPDATE);
|
downloadParameters(siriusReq, TMSUpdate.UPDATE);
|
||||||
showSuccessDialog(getResourceString(R.string.txt_configs_are_updated));
|
// showSuccessDialog(getResourceString(R.string.txt_configs_are_updated));
|
||||||
navigateToMainScreen();
|
navigateToMainScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +243,7 @@ public class TransactionResultFragment extends DataBindingFragment implements Da
|
|||||||
try {
|
try {
|
||||||
SiriusError siriusError = new Gson().fromJson(error.response().errorBody().string(), SiriusError.class);
|
SiriusError siriusError = new Gson().fromJson(error.response().errorBody().string(), SiriusError.class);
|
||||||
LogUtil.d(TAG,siriusError.getMessage());
|
LogUtil.d(TAG,siriusError.getMessage());
|
||||||
} catch (IOException ex) {
|
} catch (IOException | JsonSyntaxException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,7 +319,7 @@ public class TransactionResultFragment extends DataBindingFragment implements Da
|
|||||||
@Override
|
@Override
|
||||||
public void printerReady() {
|
public void printerReady() {
|
||||||
if(isSettlement) {
|
if(isSettlement) {
|
||||||
sharedViewModel.startPrintProcessSettlement();
|
sharedViewModel.startPrintSettlement();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sharedViewModel.startPrintProcess();
|
sharedViewModel.startPrintProcess();
|
||||||
|
|||||||
@ -25,6 +25,8 @@ import java.util.HashSet;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Single;
|
||||||
|
|
||||||
|
|
||||||
public class CardReadViewModel extends ViewModel {
|
public class CardReadViewModel extends ViewModel {
|
||||||
|
|
||||||
@ -46,7 +48,6 @@ public class CardReadViewModel extends ViewModel {
|
|||||||
public SingleLiveEvent<Integer> cardTypeData = new SingleLiveEvent<>();
|
public SingleLiveEvent<Integer> cardTypeData = new SingleLiveEvent<>();
|
||||||
public SingleLiveEvent<PayDetail> payDetail = new SingleLiveEvent<>();
|
public SingleLiveEvent<PayDetail> payDetail = new SingleLiveEvent<>();
|
||||||
|
|
||||||
public SingleLiveEvent<CardReadStatus> readStatus = new SingleLiveEvent<>();
|
|
||||||
|
|
||||||
public SingleLiveEvent<String> checkCardAlertMsg = new SingleLiveEvent<>();
|
public SingleLiveEvent<String> checkCardAlertMsg = new SingleLiveEvent<>();
|
||||||
|
|
||||||
@ -95,96 +96,6 @@ public class CardReadViewModel extends ViewModel {
|
|||||||
checkCardAlertMsg.setValue(null);
|
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(){
|
public void resetOneTimeFlag(){
|
||||||
oneTimeFlag = false;
|
oneTimeFlag = false;
|
||||||
}
|
}
|
||||||
@ -193,19 +104,4 @@ public class CardReadViewModel extends ViewModel {
|
|||||||
NexGoSDK.getInstance().cancelCheckCard();
|
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() {
|
private void handleTransactionProcess() {
|
||||||
|
|
||||||
String cardNo = mPayDetail.getCardNo();
|
String cardNo = mPayDetail.getCardNo();
|
||||||
if (cardNo == null || TextUtils.equals(cardNo, "")) {
|
// if (cardNo == null || TextUtils.equals(cardNo, "")) {
|
||||||
getCardInfo();
|
getCardInfo();
|
||||||
}
|
// }
|
||||||
getPayWaveData();
|
getPayWaveData();
|
||||||
getF055Data();
|
getF055Data();
|
||||||
if(transType.getValue() == TransactionsType.PRE_AUTH_COMPLETE || transType.getValue() == TransactionsType.PRE_AUTH_VOID || transType.getValue() == TransactionsType.REFUND ) {
|
if(transType.getValue() == TransactionsType.PRE_AUTH_COMPLETE || transType.getValue() == TransactionsType.PRE_AUTH_VOID || transType.getValue() == TransactionsType.REFUND ) {
|
||||||
|
|||||||
@ -1,15 +1,19 @@
|
|||||||
package com.utsmm.kbz.ui.core_viewmodel;
|
package com.utsmm.kbz.ui.core_viewmodel;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel;
|
import dagger.hilt.android.lifecycle.HiltViewModel;
|
||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
import androidx.lifecycle.ViewModel;
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.utsmyanmar.baselib.network.model.e_receipt.EReceiptResponse;
|
||||||
import com.utsmyanmar.baselib.network.model.sirius.SiriusRequest;
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusRequest;
|
||||||
import com.utsmyanmar.baselib.network.model.sirius.SiriusResponse;
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusResponse;
|
||||||
import com.utsmyanmar.baselib.repo.Repository;
|
import com.utsmyanmar.baselib.repo.Repository;
|
||||||
|
import com.utsmyanmar.baselib.util.TerminalUtil;
|
||||||
import com.utsmyanmar.ecr.data.TransType;
|
import com.utsmyanmar.ecr.data.TransType;
|
||||||
import com.utsmyanmar.ecr.data.model.Transactions;
|
import com.utsmyanmar.ecr.data.model.Transactions;
|
||||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||||
@ -26,9 +30,15 @@ import com.utsmyanmar.paylibs.utils.enums.HostType;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.rxjava3.core.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
|
import retrofit2.HttpException;
|
||||||
|
|
||||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||||
|
|
||||||
|
import javax.crypto.Mac;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@HiltViewModel
|
@HiltViewModel
|
||||||
@ -54,14 +64,14 @@ public class SharedViewModel extends ViewModel {
|
|||||||
|
|
||||||
public SingleLiveEvent<String> processCode = new SingleLiveEvent<>();
|
public SingleLiveEvent<String> processCode = new SingleLiveEvent<>();
|
||||||
|
|
||||||
|
|
||||||
public SingleLiveEvent<PayDetail> payDetail = new SingleLiveEvent<>();
|
public SingleLiveEvent<PayDetail> payDetail = new SingleLiveEvent<>();
|
||||||
|
public SingleLiveEvent<List<PayDetail>> payDetails = new SingleLiveEvent<>();
|
||||||
public SingleLiveEvent<PrintStatus> printStatus = new SingleLiveEvent<>();
|
public SingleLiveEvent<PrintStatus> printStatus = new SingleLiveEvent<>();
|
||||||
public SingleLiveEvent<String> merchantName = new SingleLiveEvent<>();
|
public SingleLiveEvent<String> merchantName = new SingleLiveEvent<>();
|
||||||
|
|
||||||
public SingleLiveEvent<String> transactionName = new SingleLiveEvent<>();
|
public SingleLiveEvent<String> transactionName = new SingleLiveEvent<>();
|
||||||
|
|
||||||
/*Apr 28 2022*/
|
|
||||||
public SingleLiveEvent<List<PayDetail>> payDetailList = new SingleLiveEvent<>();
|
|
||||||
|
|
||||||
/*May 16 2022*/
|
/*May 16 2022*/
|
||||||
public SingleLiveEvent<Boolean> isEcr = new SingleLiveEvent<>();
|
public SingleLiveEvent<Boolean> isEcr = new SingleLiveEvent<>();
|
||||||
@ -157,6 +167,9 @@ public class SharedViewModel extends ViewModel {
|
|||||||
|
|
||||||
private PayDetail mPayDetail = new PayDetail();
|
private PayDetail mPayDetail = new PayDetail();
|
||||||
|
|
||||||
|
public MutableLiveData<String> serialNumber = new MutableLiveData<>();
|
||||||
|
|
||||||
|
|
||||||
// Updated constructor for Hilt ViewModel
|
// Updated constructor for Hilt ViewModel
|
||||||
@Inject
|
@Inject
|
||||||
public SharedViewModel(Repository repository) {
|
public SharedViewModel(Repository repository) {
|
||||||
@ -164,9 +177,12 @@ public class SharedViewModel extends ViewModel {
|
|||||||
setPrintStatus(PrintStatus.FIRST_PRINT);
|
setPrintStatus(PrintStatus.FIRST_PRINT);
|
||||||
isReprint.setValue(false);
|
isReprint.setValue(false);
|
||||||
cardNo.setValue("");
|
cardNo.setValue("");
|
||||||
|
String sn = TerminalUtil.getInstance().getSerialNo();
|
||||||
|
serialNumber.setValue(sn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setEmvTrans(boolean status) {
|
public void setEmvTrans(boolean status) {
|
||||||
isEmv.setValue(status);
|
isEmv.setValue(status);
|
||||||
}
|
}
|
||||||
@ -185,6 +201,23 @@ public class SharedViewModel extends ViewModel {
|
|||||||
printReceiptButtons.postValue(value);
|
printReceiptButtons.postValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTransactionsType(TransactionsType transactionsType) {
|
||||||
|
this.transactionsType.setValue(transactionsType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SingleLiveEvent<TransactionsType> getTransactionsType() {
|
||||||
|
return transactionsType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(String amount) {
|
||||||
|
this.amount.setValue(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SingleLiveEvent<String> getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrintReceiptMsg(String msg) { this.printReceiptMsg.setValue(msg);}
|
||||||
public void postPrintReceiptMsg(String msg) { this.printReceiptMsg.postValue(msg);}
|
public void postPrintReceiptMsg(String msg) { this.printReceiptMsg.postValue(msg);}
|
||||||
public void setPrintStatus(PrintStatus printStatus) { this.printStatus.setValue(printStatus); }
|
public void setPrintStatus(PrintStatus printStatus) { this.printStatus.setValue(printStatus); }
|
||||||
public void postPrintStatus(PrintStatus printStatus) { this.printStatus.postValue(printStatus); }
|
public void postPrintStatus(PrintStatus printStatus) { this.printStatus.postValue(printStatus); }
|
||||||
@ -250,6 +283,7 @@ public class SharedViewModel extends ViewModel {
|
|||||||
return repository.getParams(siriusRequest);
|
return repository.getParams(siriusRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void printReceipt(boolean isMerchantCopy) {
|
private void printReceipt(boolean isMerchantCopy) {
|
||||||
PrintXReceipt.getInstance().printSmileReceipt(payDetail.getValue(), isMerchantCopy, new PrintXStatus() {
|
PrintXReceipt.getInstance().printSmileReceipt(payDetail.getValue(), isMerchantCopy, new PrintXStatus() {
|
||||||
@Override
|
@Override
|
||||||
@ -281,6 +315,7 @@ public class SharedViewModel extends ViewModel {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void startPrintReceipt(boolean isFirstPrint) {
|
public void startPrintReceipt(boolean isFirstPrint) {
|
||||||
/*
|
/*
|
||||||
* First Print is Merchant Copy..
|
* First Print is Merchant Copy..
|
||||||
@ -361,6 +396,15 @@ public class SharedViewModel extends ViewModel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void startPrintSettlement() {
|
||||||
|
if(payDetail.getValue() == null) return;
|
||||||
|
if(payDetail.getValue().getTransactionType() == TransactionsType.SETTLEMENT.value) {
|
||||||
|
startPrintProcessSettlement();
|
||||||
|
} else {
|
||||||
|
startPrintProcessQRSettlement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void startPrintProcessSettlement() {
|
public void startPrintProcessSettlement() {
|
||||||
|
|
||||||
if(payDetail.getValue() == null) return;
|
if(payDetail.getValue() == null) return;
|
||||||
@ -376,8 +420,23 @@ public class SharedViewModel extends ViewModel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/*POS */
|
}
|
||||||
// PrintReceipt.getInstance().printSettlementReceiptPOS(settleData.getSaleCount(), settleData.getSaleAmount(), settleData.getRefundCount(), settleData.getRefundAmount(), settleData.getPreAuthCount(), settleData.getPreAuthAmount(), true);
|
|
||||||
|
private void startPrintProcessQRSettlement() {
|
||||||
|
|
||||||
|
if(payDetail.getValue() == null && payDetails.getValue() == null) return;
|
||||||
|
|
||||||
|
PrintXReceipt.getInstance().printQRSettlementReport(payDetail.getValue(),payDetails.getValue(), new PrintXStatus() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -406,4 +465,34 @@ public class SharedViewModel extends ViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void pushReceipt(Object body){
|
||||||
|
Log.d("push receipt", new Gson().toJson(body));
|
||||||
|
repository.sendReceipt(body)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(
|
||||||
|
response -> Log.d("E-Receipt", "Success =>"+ response.getMessage()),
|
||||||
|
error -> {
|
||||||
|
if (error instanceof HttpException) {
|
||||||
|
HttpException httpEx = (HttpException) error;
|
||||||
|
|
||||||
|
try {
|
||||||
|
String errorJson = httpEx.response().errorBody().string();
|
||||||
|
Log.e("E-Receipt", "Raw error JSON => " + errorJson);
|
||||||
|
|
||||||
|
// Parse JSON to model
|
||||||
|
EReceiptResponse res = new Gson().fromJson(errorJson, EReceiptResponse.class);
|
||||||
|
Log.e("E-Receipt", "Parsed Error => " + res.getMessage());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.e("E-Receipt", "Unexpected error => " + error.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,8 @@ import androidx.annotation.Nullable;
|
|||||||
import com.utsmm.kbz.util.enums.SettlementType;
|
import com.utsmm.kbz.util.enums.SettlementType;
|
||||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
|
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
import com.utsmyanmar.paylibs.utils.enums.TransMenu;
|
import com.utsmyanmar.paylibs.utils.enums.TransMenu;
|
||||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||||
import com.utsmm.kbz.BR;
|
import com.utsmm.kbz.BR;
|
||||||
@ -106,6 +108,9 @@ public class DashboardTransFragment extends DataBindingFragment {
|
|||||||
case HISTORY:
|
case HISTORY:
|
||||||
new DashboardTransFragment.ClickEvent().onClickHistory();
|
new DashboardTransFragment.ClickEvent().onClickHistory();
|
||||||
break;
|
break;
|
||||||
|
case DEVICE_CONFIG:
|
||||||
|
new DashboardTransFragment.ClickEvent().onClickDeviceConfig();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -125,7 +130,8 @@ public class DashboardTransFragment extends DataBindingFragment {
|
|||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
Boolean demoStatus = SystemParamsOperation.getInstance().getDemoStatus();
|
||||||
|
LogUtil.d("KMK", "demo => " + demoStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ClickEvent {
|
public class ClickEvent {
|
||||||
@ -135,7 +141,7 @@ public class DashboardTransFragment extends DataBindingFragment {
|
|||||||
} else if (checkTid()) {
|
} else if (checkTid()) {
|
||||||
showDeclineDialog("Please Download Config!");
|
showDeclineDialog("Please Download Config!");
|
||||||
} else {
|
} else {
|
||||||
sharedViewModel.transactionsType.setValue(TransactionsType.VOID);
|
sharedViewModel.setTransactionsType(TransactionsType.VOID);
|
||||||
// sharedViewModel.transMenu.postValue(TransMenu.TRANSACTIONS);
|
// sharedViewModel.transMenu.postValue(TransMenu.TRANSACTIONS);
|
||||||
sharedViewModel.setTransMenu(TransMenu.TRANSACTIONS);
|
sharedViewModel.setTransMenu(TransMenu.TRANSACTIONS);
|
||||||
|
|
||||||
@ -147,16 +153,15 @@ public class DashboardTransFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
public void onClickSettlement() {
|
public void onClickSettlement() {
|
||||||
sharedViewModel.settlementType.setValue(SettlementType.NORMAL);
|
sharedViewModel.settlementType.setValue(SettlementType.NORMAL);
|
||||||
sharedViewModel.transactionsType.setValue(TransactionsType.SETTLEMENT);
|
|
||||||
sharedViewModel.setTransMenu(TransMenu.SETTLEMENT);
|
sharedViewModel.setTransMenu(TransMenu.SETTLEMENT);
|
||||||
|
sharedViewModel.setTransactionsType(TransactionsType.SETTLEMENT);
|
||||||
|
|
||||||
routeId = R.id.action_dashboardTransFragment_to_inputPasswordFragment;
|
routeId = R.id.action_dashboardTransFragment_to_inputPasswordFragment;
|
||||||
safeRouteTo(currentId,routeId,hostId);
|
safeRouteTo(currentId,routeId,hostId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClickRefund() {
|
public void onClickRefund() {
|
||||||
sharedViewModel.transactionsType.setValue(TransactionsType.REFUND);
|
sharedViewModel.setTransactionsType(TransactionsType.REFUND);
|
||||||
|
|
||||||
routeId = R.id.action_dashboardTransFragment_to_inputPasswordFragment;
|
routeId = R.id.action_dashboardTransFragment_to_inputPasswordFragment;
|
||||||
safeRouteTo(currentId,routeId,hostId);
|
safeRouteTo(currentId,routeId,hostId);
|
||||||
}
|
}
|
||||||
@ -167,8 +172,7 @@ public class DashboardTransFragment extends DataBindingFragment {
|
|||||||
} else if (checkTid()) {
|
} else if (checkTid()) {
|
||||||
showDeclineDialog("Please Download Config!");
|
showDeclineDialog("Please Download Config!");
|
||||||
} else {
|
} else {
|
||||||
sharedViewModel.transactionsType.setValue(TransactionsType.PRE_AUTH_SALE);
|
sharedViewModel.setTransactionsType(TransactionsType.PRE_AUTH_SALE);
|
||||||
|
|
||||||
routeId = R.id.action_dashboardTransFragment_to_inputAmountFragment;
|
routeId = R.id.action_dashboardTransFragment_to_inputAmountFragment;
|
||||||
safeRouteTo(currentId,routeId,hostId);
|
safeRouteTo(currentId,routeId,hostId);
|
||||||
}
|
}
|
||||||
@ -176,7 +180,7 @@ public class DashboardTransFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onClickPreAuthCancel () {
|
public void onClickPreAuthCancel () {
|
||||||
sharedViewModel.transactionsType.setValue(TransactionsType.PRE_AUTH_VOID);
|
sharedViewModel.setTransactionsType(TransactionsType.PRE_AUTH_VOID);
|
||||||
sharedViewModel.setTransMenu(TransMenu.PRE_AUTH_FULL_VOID);
|
sharedViewModel.setTransMenu(TransMenu.PRE_AUTH_FULL_VOID);
|
||||||
sharedViewModel.amount.postValue(null);
|
sharedViewModel.amount.postValue(null);
|
||||||
routeId = R.id.action_dashboardTransFragment_to_inputPasswordFragment;
|
routeId = R.id.action_dashboardTransFragment_to_inputPasswordFragment;
|
||||||
@ -185,14 +189,14 @@ public class DashboardTransFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onClickPreAuthComp () {
|
public void onClickPreAuthComp () {
|
||||||
sharedViewModel.transactionsType.setValue(TransactionsType.PRE_AUTH_COMPLETE);
|
sharedViewModel.setTransactionsType(TransactionsType.PRE_AUTH_COMPLETE);
|
||||||
routeId = R.id.action_dashboardTransFragment_to_inputPasswordFragment;
|
routeId = R.id.action_dashboardTransFragment_to_inputPasswordFragment;
|
||||||
safeRouteTo(currentId,routeId,hostId);
|
safeRouteTo(currentId,routeId,hostId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClickPreAuthCompCancel () {
|
public void onClickPreAuthCompCancel () {
|
||||||
sharedViewModel.transactionsType.setValue(TransactionsType.PRE_AUTH_COMPLETE_VOID);
|
sharedViewModel.setTransactionsType(TransactionsType.PRE_AUTH_COMPLETE_VOID);
|
||||||
routeId = R.id.action_dashboardTransFragment_to_inputPasswordFragment;
|
routeId = R.id.action_dashboardTransFragment_to_inputPasswordFragment;
|
||||||
safeRouteTo(currentId,routeId,hostId);
|
safeRouteTo(currentId,routeId,hostId);
|
||||||
|
|
||||||
@ -200,7 +204,8 @@ public class DashboardTransFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
|
|
||||||
public void onClickCashAdvance() {
|
public void onClickCashAdvance() {
|
||||||
sharedViewModel.transactionsType.setValue(TransactionsType.CASH_OUT);
|
sharedViewModel.setTransactionsType(TransactionsType.CASH_OUT);
|
||||||
|
sharedViewModel.setTransMenu(TransMenu.CASH_OUT);
|
||||||
routeId = R.id.action_dashboardTransFragment_to_inputAmountFragment;
|
routeId = R.id.action_dashboardTransFragment_to_inputAmountFragment;
|
||||||
safeRouteTo(currentId,routeId,hostId);
|
safeRouteTo(currentId,routeId,hostId);
|
||||||
|
|
||||||
@ -211,7 +216,10 @@ public class DashboardTransFragment extends DataBindingFragment {
|
|||||||
safeRouteTo(currentId,routeId,hostId);
|
safeRouteTo(currentId,routeId,hostId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onClickDeviceConfig(){
|
||||||
|
routeId = R.id.action_dashboardTransFragment_to_deviceConfig;
|
||||||
|
safeRouteTo(currentId, routeId, hostId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import androidx.lifecycle.MutableLiveData;
|
|||||||
import androidx.lifecycle.ViewModel;
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
import com.kizzy.xpay.util.Sign;
|
import com.kizzy.xpay.util.Sign;
|
||||||
|
import com.utsmm.kbz.ui.qr_pay.QRRefund;
|
||||||
import com.utsmyanmar.baselib.network.model.DemoQRRequest;
|
import com.utsmyanmar.baselib.network.model.DemoQRRequest;
|
||||||
import com.utsmyanmar.baselib.network.model.DemoQRResponse;
|
import com.utsmyanmar.baselib.network.model.DemoQRResponse;
|
||||||
import com.utsmyanmar.baselib.network.model.DemoQRReturnRequest;
|
import com.utsmyanmar.baselib.network.model.DemoQRReturnRequest;
|
||||||
@ -36,6 +37,7 @@ import com.utsmyanmar.paylibs.model.TradeData;
|
|||||||
import com.utsmyanmar.paylibs.system.SingleLiveEvent;
|
import com.utsmyanmar.paylibs.system.SingleLiveEvent;
|
||||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsSettings;
|
||||||
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -52,7 +54,11 @@ public class KPayViewModel extends ViewModel {
|
|||||||
|
|
||||||
private final Repository repository;
|
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 ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||||
private final Handler mainHandler = new Handler(Looper.getMainLooper());
|
private final Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
@ -61,10 +67,7 @@ public class KPayViewModel extends ViewModel {
|
|||||||
private static final String NONCE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
private static final String NONCE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||||
private static final int NONCE_LENGTH = 32;
|
private static final int NONCE_LENGTH = 32;
|
||||||
private final SecureRandom secureRandom = new SecureRandom();
|
private final SecureRandom secureRandom = new SecureRandom();
|
||||||
|
public MutableLiveData<Boolean> partialRefundEnabled = new MutableLiveData<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String generateRandomTwoChars() {
|
private String generateRandomTwoChars() {
|
||||||
// You can reuse the existing character set and SecureRandom instance
|
// You can reuse the existing character set and SecureRandom instance
|
||||||
@ -114,7 +117,7 @@ public class KPayViewModel extends ViewModel {
|
|||||||
bizContent.put("refund_request_no", refundOrderId);
|
bizContent.put("refund_request_no", refundOrderId);
|
||||||
bizContent.put("merch_order_id", origOrderId);
|
bizContent.put("merch_order_id", origOrderId);
|
||||||
bizContent.put("merch_code", mid);
|
bizContent.put("merch_code", mid);
|
||||||
bizContent.put("appid", "kp9b0794b349ae85b00c51e0677484c7");
|
bizContent.put("appid", appId);
|
||||||
if(!refundAmount.equals("0")) {
|
if(!refundAmount.equals("0")) {
|
||||||
bizContent.put("refund_amount", refundAmount);
|
bizContent.put("refund_amount", refundAmount);
|
||||||
}
|
}
|
||||||
@ -138,7 +141,7 @@ public class KPayViewModel extends ViewModel {
|
|||||||
|
|
||||||
KPayRefund.RefundRequest.RequestBody.BizContent biz =
|
KPayRefund.RefundRequest.RequestBody.BizContent biz =
|
||||||
new KPayRefund.RefundRequest.RequestBody.BizContent(
|
new KPayRefund.RefundRequest.RequestBody.BizContent(
|
||||||
"kp9b0794b349ae85b00c51e0677484c7",
|
appId,
|
||||||
mid,
|
mid,
|
||||||
origOrderId,
|
origOrderId,
|
||||||
refundAmount, // This can be null for original refunds
|
refundAmount, // This can be null for original refunds
|
||||||
@ -160,7 +163,7 @@ public class KPayViewModel extends ViewModel {
|
|||||||
} else {
|
} else {
|
||||||
KPayRefund.RefundRequest.RequestBody.BizContent biz =
|
KPayRefund.RefundRequest.RequestBody.BizContent biz =
|
||||||
new KPayRefund.RefundRequest.RequestBody.BizContent(
|
new KPayRefund.RefundRequest.RequestBody.BizContent(
|
||||||
"kp9b0794b349ae85b00c51e0677484c7",
|
appId,
|
||||||
mid,
|
mid,
|
||||||
origOrderId,
|
origOrderId,
|
||||||
refundOrderId,
|
refundOrderId,
|
||||||
@ -195,7 +198,7 @@ public class KPayViewModel extends ViewModel {
|
|||||||
Map<String, Object> bizContent = new HashMap<>();
|
Map<String, Object> bizContent = new HashMap<>();
|
||||||
bizContent.put("merch_order_id", merchOrderId);
|
bizContent.put("merch_order_id", merchOrderId);
|
||||||
bizContent.put("merch_code", mid);
|
bizContent.put("merch_code", mid);
|
||||||
bizContent.put("appid", "kp9b0794b349ae85b00c51e0677484c7");
|
bizContent.put("appid", appId);
|
||||||
bizContent.put("trade_type", "PAY_BY_QRCODE");
|
bizContent.put("trade_type", "PAY_BY_QRCODE");
|
||||||
bizContent.put("total_amount", amount);
|
bizContent.put("total_amount", amount);
|
||||||
bizContent.put("title", "testing");
|
bizContent.put("title", "testing");
|
||||||
@ -216,7 +219,7 @@ public class KPayViewModel extends ViewModel {
|
|||||||
String sign = Sign.INSTANCE.generateSign(requestMap, appKey);
|
String sign = Sign.INSTANCE.generateSign(requestMap, appKey);
|
||||||
|
|
||||||
KPayQRRequest.QrRequest.RequestBody.BizContent biz = new KPayQRRequest.QrRequest.RequestBody.BizContent(
|
KPayQRRequest.QrRequest.RequestBody.BizContent biz = new KPayQRRequest.QrRequest.RequestBody.BizContent(
|
||||||
"kp9b0794b349ae85b00c51e0677484c7",
|
appId,
|
||||||
mid,
|
mid,
|
||||||
merchOrderId,
|
merchOrderId,
|
||||||
"PAY_BY_QRCODE",
|
"PAY_BY_QRCODE",
|
||||||
@ -252,7 +255,7 @@ public class KPayViewModel extends ViewModel {
|
|||||||
Map<String, Object> bizContentMap = new HashMap<>();
|
Map<String, Object> bizContentMap = new HashMap<>();
|
||||||
bizContentMap.put("merch_order_id", merchOrderId);
|
bizContentMap.put("merch_order_id", merchOrderId);
|
||||||
bizContentMap.put("merch_code", mid);
|
bizContentMap.put("merch_code", mid);
|
||||||
bizContentMap.put("appid", "kp9b0794b349ae85b00c51e0677484c7");
|
bizContentMap.put("appid", appId);
|
||||||
|
|
||||||
Map<String, Object> requestMap = new HashMap<>();
|
Map<String, Object> requestMap = new HashMap<>();
|
||||||
requestMap.put("timestamp", currentTime);
|
requestMap.put("timestamp", currentTime);
|
||||||
@ -264,7 +267,7 @@ public class KPayViewModel extends ViewModel {
|
|||||||
String sign = Sign.INSTANCE.generateSign(requestMap, appKey);
|
String sign = Sign.INSTANCE.generateSign(requestMap, appKey);
|
||||||
|
|
||||||
KPayQRQueryRequest.QRQueryRequest.Request.BizContent bizContent = new KPayQRQueryRequest.QRQueryRequest.Request.BizContent(
|
KPayQRQueryRequest.QRQueryRequest.Request.BizContent bizContent = new KPayQRQueryRequest.QRQueryRequest.Request.BizContent(
|
||||||
"kp9b0794b349ae85b00c51e0677484c7",
|
appId,
|
||||||
mid,
|
mid,
|
||||||
merchOrderId
|
merchOrderId
|
||||||
);
|
);
|
||||||
@ -287,10 +290,14 @@ public class KPayViewModel extends ViewModel {
|
|||||||
@Inject
|
@Inject
|
||||||
public KPayViewModel(Repository repository) {
|
public KPayViewModel(Repository repository) {
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
|
|
||||||
|
boolean enabled = SystemParamsOperation.getInstance().isQrPartialRefundEnable();
|
||||||
|
partialRefundEnabled.setValue(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TradeData tradeData;
|
private TradeData tradeData;
|
||||||
private PayDetail payDetail;
|
private PayDetail payDetail;
|
||||||
|
private QRRefund qrRefund;
|
||||||
|
|
||||||
public void setTradeData(TradeData tradeData){
|
public void setTradeData(TradeData tradeData){
|
||||||
this.tradeData = tradeData;
|
this.tradeData = tradeData;
|
||||||
@ -304,6 +311,12 @@ public class KPayViewModel extends ViewModel {
|
|||||||
public void setPayDetail(PayDetail payDetail) {
|
public void setPayDetail(PayDetail payDetail) {
|
||||||
this.payDetail = payDetail;
|
this.payDetail = payDetail;
|
||||||
}
|
}
|
||||||
|
public void setQrRefund(QRRefund qrRefund) {
|
||||||
|
this.qrRefund = qrRefund;
|
||||||
|
}
|
||||||
|
public QRRefund getQrRefund() {
|
||||||
|
return qrRefund;
|
||||||
|
}
|
||||||
|
|
||||||
public PayDetail getPayDetail() { return payDetail; }
|
public PayDetail getPayDetail() { return payDetail; }
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
|||||||
import com.utsmm.kbz.util.TransactionUtil;
|
import com.utsmm.kbz.util.TransactionUtil;
|
||||||
import com.utsmm.kbz.util.ecr.CoreUtils;
|
import com.utsmm.kbz.util.ecr.CoreUtils;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||||
@ -135,10 +136,14 @@ public class QRConnectingFragment extends DataBindingFragment implements DataBin
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void generateQR() {
|
private void generateQR() {
|
||||||
|
long originalAmount = payDetail.getAmount();
|
||||||
|
|
||||||
// String amount = String.format(Locale.getDefault(), "%.2f", payDetail.getAmount()/100.0);
|
// String amount = String.format(Locale.getDefault(), "%.2f", payDetail.getAmount()/100.0);
|
||||||
String amount = String.format(Locale.getDefault(), "%d", (int)(payDetail.getAmount()/100.0));
|
// String amount = String.format(Locale.getDefault(), "%d", (int)(payDetail.getAmount()/100.0)); //this method have problem for 10055 to 100.00 auto convert (should convert to 100.55)
|
||||||
|
|
||||||
|
double realAmount = payDetail.getAmount() / 100.0;
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
String amount = df.format(realAmount);
|
||||||
|
|
||||||
|
|
||||||
KPayQRRequest.QrRequest kPayQRRequest = KPayViewModel.createQR(amount, merchantId);
|
KPayQRRequest.QrRequest kPayQRRequest = KPayViewModel.createQR(amount, merchantId);
|
||||||
|
|||||||
@ -11,8 +11,10 @@ import android.widget.LinearLayout;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.utsmm.kbz.util.tms.TMSUtil;
|
||||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
import com.utsmyanmar.baselib.network.model.KPayRefund;
|
import com.utsmyanmar.baselib.network.model.KPayRefund;
|
||||||
|
//import com.utsmyanmar.baselib.network.model.e_receipt.EReceiptQRRequest;
|
||||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||||
import com.utsmyanmar.paylibs.model.TradeData;
|
import com.utsmyanmar.paylibs.model.TradeData;
|
||||||
@ -34,6 +36,8 @@ import io.reactivex.rxjava3.disposables.Disposable;
|
|||||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
import com.utsmyanmar.paylibs.utils.LogUtil;
|
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
public class QRRefundFragment extends DataBindingFragment {
|
public class QRRefundFragment extends DataBindingFragment {
|
||||||
|
|
||||||
private SharedViewModel sharedViewModel;
|
private SharedViewModel sharedViewModel;
|
||||||
@ -196,6 +200,8 @@ public class QRRefundFragment extends DataBindingFragment {
|
|||||||
payDetail.setReferNo(referenceNo);
|
payDetail.setReferNo(referenceNo);
|
||||||
payDetail.setIsCanceled(true);
|
payDetail.setIsCanceled(true);
|
||||||
|
|
||||||
|
// sharedViewModel.pushReceipt(buildEReceiptQRReceipt(payDetail, true, "Refund success"));
|
||||||
|
|
||||||
retrievedUpdatePayDetail(referenceNo);
|
retrievedUpdatePayDetail(referenceNo);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -210,6 +216,8 @@ public class QRRefundFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
payDetail.setTradeResultDes(errorMsg);
|
payDetail.setTradeResultDes(errorMsg);
|
||||||
|
|
||||||
|
// sharedViewModel.pushReceipt(buildEReceiptQRReceipt(payDetail, true, "RESP CODE [68]\n Refund Failed"));
|
||||||
|
|
||||||
sharedViewModel.payDetail.setValue(payDetail);
|
sharedViewModel.payDetail.setValue(payDetail);
|
||||||
navigateToNext();
|
navigateToNext();
|
||||||
}
|
}
|
||||||
@ -328,4 +336,6 @@ public class QRRefundFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package com.utsmm.kbz.ui.kpay;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
@ -10,9 +9,11 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
|
||||||
|
import com.utsmm.kbz.util.EReceiptUtil;
|
||||||
|
import com.utsmm.kbz.util.enums.TransResultStatus;
|
||||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
import com.utsmyanmar.baselib.network.model.DemoQRStatusRequest;
|
|
||||||
import com.utsmyanmar.baselib.network.model.KPayQRQueryRequest;
|
import com.utsmyanmar.baselib.network.model.KPayQRQueryRequest;
|
||||||
|
import com.utsmyanmar.baselib.network.model.e_receipt.EReceiptRequest;
|
||||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
import com.utsmyanmar.baselib.util.TimeoutCallback;
|
import com.utsmyanmar.baselib.util.TimeoutCallback;
|
||||||
import com.utsmyanmar.ecr.ECRHelper;
|
import com.utsmyanmar.ecr.ECRHelper;
|
||||||
@ -123,6 +124,7 @@ public class QRTransactionFragment extends DataBindingFragment implements DataBi
|
|||||||
terminalId = TransactionUtil.getInstance().getQRTerminalId();
|
terminalId = TransactionUtil.getInstance().getQRTerminalId();
|
||||||
merchantId = TransactionUtil.getInstance().getQRMerchantId();
|
merchantId = TransactionUtil.getInstance().getQRMerchantId();
|
||||||
|
|
||||||
|
|
||||||
refLabel = sharedViewModel.qrRefNum.getValue();
|
refLabel = sharedViewModel.qrRefNum.getValue();
|
||||||
|
|
||||||
// tradeData = waveViewModel.getTradeData();
|
// tradeData = waveViewModel.getTradeData();
|
||||||
@ -132,6 +134,7 @@ public class QRTransactionFragment extends DataBindingFragment implements DataBi
|
|||||||
|
|
||||||
sharedViewModel.insertPayDetail(payDetail);
|
sharedViewModel.insertPayDetail(payDetail);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -184,6 +187,8 @@ public class QRTransactionFragment extends DataBindingFragment implements DataBi
|
|||||||
setUpCountDown();
|
setUpCountDown();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpCountDown() {
|
private void setUpCountDown() {
|
||||||
@ -297,17 +302,26 @@ public class QRTransactionFragment extends DataBindingFragment implements DataBi
|
|||||||
* trans is success !*/
|
* trans is success !*/
|
||||||
// String transStatus = response.getTransactionStatus();
|
// String transStatus = response.getTransactionStatus();
|
||||||
// String transTime = response.getResponse().;
|
// String transTime = response.getResponse().;
|
||||||
|
if(response.getResponse().getWalletIdentifier() != null) {
|
||||||
|
payDetail.setCustomerMobile(response.getResponse().getWalletIdentifier());
|
||||||
|
} else {
|
||||||
|
payDetail.setCustomerMobile("KBZ PAY");
|
||||||
|
}
|
||||||
|
|
||||||
payDetail.setCustomerMobile("KBZ PAY");
|
payDetail.setTC(response.getResponse().getTradeStatus());
|
||||||
payDetail.setQrReferNo(refLabel);
|
payDetail.setQrReferNo(refLabel);
|
||||||
payDetail.setQrTransId(response.getResponse().getMmOrderId());
|
payDetail.setQrTransId(response.getResponse().getMmOrderId());
|
||||||
payDetail.setReferNo(refLabel);
|
payDetail.setReferNo(refLabel);
|
||||||
payDetail.setApprovalCode(response.getResponse().getMmOrderId());
|
payDetail.setApprovalCode(response.getResponse().getMmOrderId());
|
||||||
payDetail.setQrTransStatus(1);
|
payDetail.setQrTransStatus(1);
|
||||||
payDetail.setOriginalTransDate(response.getResponse().getPaySuccessTime());
|
payDetail.setTradeDateAndTime(response.getResponse().getPaySuccessTime());
|
||||||
|
|
||||||
|
|
||||||
retrievedUpdatePayDetail(refLabel, payDetail,false);
|
retrievedUpdatePayDetail(refLabel, payDetail,false);
|
||||||
|
|
||||||
|
EReceiptRequest request = EReceiptUtil.getInstance().generateQRReceipt(payDetail, TransResultStatus.SUCCESS);
|
||||||
|
sharedViewModel.pushReceipt(request);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,6 +331,9 @@ public class QRTransactionFragment extends DataBindingFragment implements DataBi
|
|||||||
payDetail.setQrTransStatus(2);
|
payDetail.setQrTransStatus(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EReceiptRequest request = EReceiptUtil.getInstance().generateQRReceipt(payDetail, TransResultStatus.FAIL);
|
||||||
|
sharedViewModel.pushReceipt(request);
|
||||||
|
|
||||||
sharedViewModel.payDetail.postValue(payDetail);
|
sharedViewModel.payDetail.postValue(payDetail);
|
||||||
safeNavigateToRouteId();
|
safeNavigateToRouteId();
|
||||||
|
|
||||||
@ -324,7 +341,11 @@ public class QRTransactionFragment extends DataBindingFragment implements DataBi
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.d(TAG, "On Exception::");
|
LogUtil.d(TAG, "On Exception::");
|
||||||
|
// sharedViewModel.pushReceipt(buildEReceiptQRReceipt(payDetail, false, "QR Failed! :" + e.getMessage()));
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
EReceiptRequest request = EReceiptUtil.getInstance().generateQRReceipt(payDetail, TransResultStatus.TIME_OUT);
|
||||||
|
sharedViewModel.pushReceipt(request);
|
||||||
|
|
||||||
if (count == totalCount) {
|
if (count == totalCount) {
|
||||||
if(payDetail.getQrTransStatus() != -1) {
|
if(payDetail.getQrTransStatus() != -1) {
|
||||||
payDetail.setQrTransStatus(2);
|
payDetail.setQrTransStatus(2);
|
||||||
@ -332,8 +353,6 @@ public class QRTransactionFragment extends DataBindingFragment implements DataBi
|
|||||||
|
|
||||||
sharedViewModel.payDetail.postValue(payDetail);
|
sharedViewModel.payDetail.postValue(payDetail);
|
||||||
safeNavigateToRouteId();
|
safeNavigateToRouteId();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ public class ManagementViewModel extends ViewModel {
|
|||||||
public SingleLiveEvent<String> processCodeText = new SingleLiveEvent<>();
|
public SingleLiveEvent<String> processCodeText = new SingleLiveEvent<>();
|
||||||
|
|
||||||
public SingleLiveEvent<PayDetail> payDetail = new SingleLiveEvent<>();
|
public SingleLiveEvent<PayDetail> payDetail = new SingleLiveEvent<>();
|
||||||
|
public SingleLiveEvent<List<PayDetail>> payDetails = new SingleLiveEvent<>();
|
||||||
|
|
||||||
public SingleLiveEvent<String> panErrorMsg = new SingleLiveEvent<>();
|
public SingleLiveEvent<String> panErrorMsg = new SingleLiveEvent<>();
|
||||||
|
|
||||||
@ -75,6 +76,10 @@ public class ManagementViewModel extends ViewModel {
|
|||||||
return repository.getLastSettlement(voucherNo);
|
return repository.getLastSettlement(voucherNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getLastSettlementQR(String voucherNo){
|
||||||
|
return repository.getLastSettlementQR(voucherNo);
|
||||||
|
}
|
||||||
|
|
||||||
public LiveData<List<PayDetail>> getLastTransaction(String voucherNo){
|
public LiveData<List<PayDetail>> getLastTransaction(String voucherNo){
|
||||||
return repository.getLastTransaction(voucherNo);
|
return repository.getLastTransaction(voucherNo);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,6 +72,7 @@ public class SelectHostFragment extends DataBindingFragment implements DataBindi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkQRButtonVisibility();
|
||||||
// try {
|
// try {
|
||||||
// int result = MyApplication.getInstance().basicOptBinder.setScreenMode(1);
|
// int result = MyApplication.getInstance().basicOptBinder.setScreenMode(1);
|
||||||
// } catch (RemoteException e) {
|
// } catch (RemoteException e) {
|
||||||
@ -168,14 +169,16 @@ public class SelectHostFragment extends DataBindingFragment implements DataBindi
|
|||||||
|
|
||||||
observerData();
|
observerData();
|
||||||
|
|
||||||
isReturnTransactions();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void isReturnTransactions() {
|
private void checkQRButtonVisibility() {
|
||||||
if(sharedViewModel.getTransMenu().getValue() == TransMenu.VOID || sharedViewModel.getTransMenu().getValue() == TransMenu.PRE_AUTH_COMPLETE_VOID || sharedViewModel.getTransMenu().getValue() == TransMenu.REVERSAL || sharedViewModel.getTransMenu().getValue() == TransMenu.PRE_AUTH_FULL_VOID) {
|
if(sharedViewModel.getTransMenu().getValue() == TransMenu.VOID || sharedViewModel.getTransMenu().getValue() == TransMenu.PRE_AUTH_COMPLETE_VOID || sharedViewModel.getTransMenu().getValue() == TransMenu.REVERSAL || sharedViewModel.getTransMenu().getValue() == TransMenu.PRE_AUTH_FULL_VOID || sharedViewModel.getTransMenu().getValue() == TransMenu.LAST_SETTLEMENT) {
|
||||||
sharedViewModel.qrPayVisibility.setValue(8);
|
sharedViewModel.qrPayVisibility.setValue(8);
|
||||||
} else {
|
} else {
|
||||||
sharedViewModel.qrPayVisibility.setValue(0);
|
sharedViewModel.qrPayVisibility.setValue(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,6 +271,7 @@ public class SelectHostFragment extends DataBindingFragment implements DataBindi
|
|||||||
public void onChanged(List<PayDetail> payDetails) {
|
public void onChanged(List<PayDetail> payDetails) {
|
||||||
if (payDetails != null) {
|
if (payDetails != null) {
|
||||||
if (!payDetails.isEmpty()) {
|
if (!payDetails.isEmpty()) {
|
||||||
|
managementViewModel.payDetails.setValue(payDetails);
|
||||||
routeId = R.id.action_selectHostFragment_to_settlementTransactionFragment;
|
routeId = R.id.action_selectHostFragment_to_settlementTransactionFragment;
|
||||||
} else {
|
} else {
|
||||||
showSingleInfoDialog(getString(R.string.txt_no_trans_to_print));
|
showSingleInfoDialog(getString(R.string.txt_no_trans_to_print));
|
||||||
@ -283,6 +287,7 @@ public class SelectHostFragment extends DataBindingFragment implements DataBindi
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void observeRoute() {
|
private void observeRoute() {
|
||||||
switch (Objects.requireNonNull(sharedViewModel.getTransMenu().getValue())) {
|
switch (Objects.requireNonNull(sharedViewModel.getTransMenu().getValue())) {
|
||||||
case REVERSAL:
|
case REVERSAL:
|
||||||
@ -296,13 +301,14 @@ public class SelectHostFragment extends DataBindingFragment implements DataBindi
|
|||||||
clearBatch();
|
clearBatch();
|
||||||
break;
|
break;
|
||||||
case LAST_SETTLEMENT:
|
case LAST_SETTLEMENT:
|
||||||
if(sharedViewModel.hostType.getValue() == HostType.MPU)
|
observeLastSettlement();
|
||||||
observeLastSettlement();
|
// if(sharedViewModel.hostType.getValue() != HostType.QR) {
|
||||||
else {
|
// observeLastSettlement();
|
||||||
showSingleInfoDialog(getString(R.string.txt_no_trans_to_print));
|
// } else {
|
||||||
routeId = R.id.action_selectHostFragment_to_nav_main;
|
// showSingleInfoDialog(getString(R.string.txt_no_trans_to_print));
|
||||||
safeNavigateToRouteId();
|
// routeId = R.id.action_selectHostFragment_to_nav_main;
|
||||||
}
|
// safeNavigateToRouteId();
|
||||||
|
// }
|
||||||
break;
|
break;
|
||||||
case CLEAR_REVERSAL:
|
case CLEAR_REVERSAL:
|
||||||
clearReversal();
|
clearReversal();
|
||||||
|
|||||||
@ -166,7 +166,7 @@ public class ManualEntryFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
public void onConfirm() {
|
public void onConfirm() {
|
||||||
if(manualEntryViewModel.validateData()) {
|
if(manualEntryViewModel.validateData()) {
|
||||||
if(sharedViewModel.transactionsType.getValue() == TransactionsType.REFUND || sharedViewModel.transactionsType.getValue() == TransactionsType.PRE_AUTH_SALE || sharedViewModel.transactionsType.getValue() == TransactionsType.SALE || sharedViewModel.transactionsType.getValue() == TransactionsType.PRE_AUTH_VOID) {
|
if(sharedViewModel.transactionsType.getValue() == TransactionsType.REFUND || sharedViewModel.transactionsType.getValue() == TransactionsType.PRE_AUTH_SALE || sharedViewModel.transactionsType.getValue() == TransactionsType.SALE || sharedViewModel.transactionsType.getValue() == TransactionsType.PRE_AUTH_VOID || sharedViewModel.transactionsType.getValue() == TransactionsType.PRE_AUTH_COMPLETE) {
|
||||||
|
|
||||||
if(manualEntryViewModel.get_cardScheme().getValue() != null && manualEntryViewModel.get_cardScheme().getValue() == CardScheme.MPU) {
|
if(manualEntryViewModel.get_cardScheme().getValue() != null && manualEntryViewModel.get_cardScheme().getValue() == CardScheme.MPU) {
|
||||||
processMPUCard();
|
processMPUCard();
|
||||||
|
|||||||
@ -2,8 +2,20 @@ package com.utsmm.kbz.ui.navigation;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.nexgo.oaf.apiv3.APIProxy;
|
||||||
|
import com.nexgo.oaf.apiv3.DeviceEngine;
|
||||||
|
import com.nexgo.oaf.apiv3.DeviceInfo;
|
||||||
|
import com.nexgo.oaf.apiv3.SdkResult;
|
||||||
|
import com.nexgo.oaf.apiv3.device.printer.AlignEnum;
|
||||||
|
import com.nexgo.oaf.apiv3.device.printer.GrayLevelEnum;
|
||||||
|
import com.nexgo.oaf.apiv3.device.printer.LineOptionEntity;
|
||||||
|
import com.nexgo.oaf.apiv3.device.printer.Printer;
|
||||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusHost;
|
||||||
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusMerchant;
|
||||||
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusResponse;
|
||||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
import com.utsmyanmar.paylibs.Constant;
|
import com.utsmyanmar.paylibs.Constant;
|
||||||
import com.utsmyanmar.paylibs.sign_on.EchoTestProcess;
|
import com.utsmyanmar.paylibs.sign_on.EchoTestProcess;
|
||||||
@ -13,6 +25,8 @@ import com.utsmm.kbz.BR;
|
|||||||
import com.utsmm.kbz.R;
|
import com.utsmm.kbz.R;
|
||||||
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class NaviMainFragment extends DataBindingFragment {
|
public class NaviMainFragment extends DataBindingFragment {
|
||||||
|
|
||||||
private OnFragmentInteractionListener mListener;
|
private OnFragmentInteractionListener mListener;
|
||||||
@ -137,6 +151,7 @@ public class NaviMainFragment extends DataBindingFragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onClickLogOff() {
|
public void onClickLogOff() {
|
||||||
showLoadingDialog("Sending LogOff!");
|
showLoadingDialog("Sending LogOff!");
|
||||||
|
|
||||||
@ -176,6 +191,34 @@ public class NaviMainFragment extends DataBindingFragment {
|
|||||||
mListener.onClickFunction();
|
mListener.onClickFunction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private GrayLevelEnum getGrayLevel() {
|
||||||
|
int gray = 2;
|
||||||
|
GrayLevelEnum grayLevelEnum = GrayLevelEnum.LEVEL_1;
|
||||||
|
|
||||||
|
|
||||||
|
switch (gray) {
|
||||||
|
case 0:
|
||||||
|
grayLevelEnum = GrayLevelEnum.LEVEL_0;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
grayLevelEnum = GrayLevelEnum.LEVEL_1;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
grayLevelEnum = GrayLevelEnum.LEVEL_2;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
grayLevelEnum = GrayLevelEnum.LEVEL_3;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
grayLevelEnum = GrayLevelEnum.LEVEL_4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
grayLevelEnum = GrayLevelEnum.LEVEL_1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return grayLevelEnum;
|
||||||
|
}
|
||||||
public void onClickVersion(){
|
public void onClickVersion(){
|
||||||
mListener.onClickVersion();
|
mListener.onClickVersion();
|
||||||
}
|
}
|
||||||
@ -184,7 +227,6 @@ public class NaviMainFragment extends DataBindingFragment {
|
|||||||
mListener.onClickExit();
|
mListener.onClickExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface OnFragmentInteractionListener {
|
public interface OnFragmentInteractionListener {
|
||||||
@ -195,5 +237,6 @@ public class NaviMainFragment extends DataBindingFragment {
|
|||||||
void onClickVersion();
|
void onClickVersion();
|
||||||
|
|
||||||
void onClickExit();
|
void onClickExit();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import android.view.View;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.nexgo.oaf.apiv3.DeviceEngine;
|
||||||
|
import com.nexgo.oaf.apiv3.DeviceInfo;
|
||||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
import com.utsmm.kbz.BR;
|
import com.utsmm.kbz.BR;
|
||||||
@ -32,6 +34,7 @@ public class VersionFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
setToolBarTitleWithBackIcon(getString(R.string.title_version));
|
setToolBarTitleWithBackIcon(getString(R.string.title_version));
|
||||||
fetchVersions();
|
fetchVersions();
|
||||||
|
versionViewModel.loadDeviceInfo(requireContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -75,5 +78,4 @@ public class VersionFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
package com.utsmm.kbz.ui.navigation;
|
package com.utsmm.kbz.ui.navigation;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel;
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
|
import com.nexgo.oaf.apiv3.APIProxy;
|
||||||
|
import com.nexgo.oaf.apiv3.DeviceEngine;
|
||||||
|
import com.nexgo.oaf.apiv3.DeviceInfo;
|
||||||
import com.sunmi.pay.hardware.aidl.AidlConstants;
|
import com.sunmi.pay.hardware.aidl.AidlConstants;
|
||||||
import com.utsmyanmar.paylibs.system.SingleLiveEvent;
|
import com.utsmyanmar.paylibs.system.SingleLiveEvent;
|
||||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
@ -28,7 +32,8 @@ public class VersionViewModel extends ViewModel {
|
|||||||
|
|
||||||
|
|
||||||
public VersionViewModel() {
|
public VersionViewModel() {
|
||||||
initData();
|
// initData();
|
||||||
|
// loadDeviceInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initData() {
|
private void initData() {
|
||||||
@ -55,5 +60,21 @@ public class VersionViewModel extends ViewModel {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void loadDeviceInfo(Context context){
|
||||||
|
try{
|
||||||
|
DeviceEngine deviceEngine = APIProxy.getDeviceEngine(context);
|
||||||
|
DeviceInfo deviceInfo = deviceEngine.getDeviceInfo();
|
||||||
|
serialNumber.setValue(deviceInfo.getSn());
|
||||||
|
deviceModel.setValue(deviceInfo.getModel());
|
||||||
|
hardwareVersion.setValue(deviceInfo.getKernelVer());
|
||||||
|
firmwareVersion.setValue(deviceInfo.getFirmWareVer());
|
||||||
|
swFinalVersion.setValue(deviceInfo.getFirmWareFullVersion());
|
||||||
|
payHardwareVersion.setValue(deviceInfo.getSpCoreVersion());
|
||||||
|
romVersion.setValue(deviceInfo.getOsVer());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import com.nexgo.oaf.apiv3.SdkResult;
|
|||||||
import com.nexgo.oaf.apiv3.device.pinpad.AlgorithmModeEnum;
|
import com.nexgo.oaf.apiv3.device.pinpad.AlgorithmModeEnum;
|
||||||
import com.nexgo.oaf.apiv3.device.pinpad.OnPinPadInputListener;
|
import com.nexgo.oaf.apiv3.device.pinpad.OnPinPadInputListener;
|
||||||
import com.nexgo.oaf.apiv3.device.pinpad.PinAlgorithmModeEnum;
|
import com.nexgo.oaf.apiv3.device.pinpad.PinAlgorithmModeEnum;
|
||||||
|
import com.nexgo.oaf.apiv3.device.pinpad.PinKeyboardModeEnum;
|
||||||
import com.nexgo.oaf.apiv3.device.pinpad.PinKeyboardViewModeEnum;
|
import com.nexgo.oaf.apiv3.device.pinpad.PinKeyboardViewModeEnum;
|
||||||
import com.nexgo.oaf.apiv3.device.pinpad.PinPad;
|
import com.nexgo.oaf.apiv3.device.pinpad.PinPad;
|
||||||
import com.nexgo.oaf.apiv3.device.pinpad.PinPadKeyCode;
|
import com.nexgo.oaf.apiv3.device.pinpad.PinPadKeyCode;
|
||||||
@ -119,7 +120,12 @@ public class PinPadViewModel extends ViewModel {
|
|||||||
case ON_CONFIRM_CLICK:
|
case ON_CONFIRM_CLICK:
|
||||||
LogUtil.d(TAG, "ON CLICK CONFIRM");
|
LogUtil.d(TAG, "ON CLICK CONFIRM");
|
||||||
// increasedKSN();
|
// increasedKSN();
|
||||||
pinStatus.postValue(PinPadStatus.ON_CONFIRM);
|
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;
|
break;
|
||||||
case ON_CANCEL_CLICK:
|
case ON_CANCEL_CLICK:
|
||||||
LogUtil.d(TAG, "ON CLICK CANCEL");
|
LogUtil.d(TAG, "ON CLICK CANCEL");
|
||||||
@ -317,6 +323,8 @@ public class PinPadViewModel extends ViewModel {
|
|||||||
r.bottom = customPinPadKeyboard.getKey_ok().getHeight() + r.top;
|
r.bottom = customPinPadKeyboard.getKey_ok().getHeight() + r.top;
|
||||||
pinpadLayout.setKeyConfirm(r);
|
pinpadLayout.setKeyConfirm(r);
|
||||||
|
|
||||||
|
|
||||||
|
pinPad.setPinKeyboardMode(PinKeyboardModeEnum.FIXED);
|
||||||
byte[] number = pinPad.setPinpadLayout(pinpadLayout);
|
byte[] number = pinPad.setPinpadLayout(pinpadLayout);
|
||||||
|
|
||||||
if(number != null) {
|
if(number != null) {
|
||||||
@ -331,6 +339,8 @@ public class PinPadViewModel extends ViewModel {
|
|||||||
byte[] panBytes = pan.substring(length - 13).getBytes(StandardCharsets.US_ASCII);
|
byte[] panBytes = pan.substring(length - 13).getBytes(StandardCharsets.US_ASCII);
|
||||||
// byte[] panBytes = pan.substring(length - 13, length - 1).getBytes(StandardCharsets.US_ASCII);
|
// byte[] panBytes = pan.substring(length - 13, length - 1).getBytes(StandardCharsets.US_ASCII);
|
||||||
pinPad.setPinKeyboardViewMode(PinKeyboardViewModeEnum.DEFAULT);
|
pinPad.setPinKeyboardViewMode(PinKeyboardViewModeEnum.DEFAULT);
|
||||||
|
pinPad.setPinKeyboardMode(PinKeyboardModeEnum.FIXED);
|
||||||
|
|
||||||
// pinPad.setAlgorithmMode(AlgorithmModeEnum.DES);
|
// pinPad.setAlgorithmMode(AlgorithmModeEnum.DES);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,9 @@ import com.utsmyanmar.paylibs.model.PayDetail;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel;
|
||||||
|
|
||||||
|
@HiltViewModel
|
||||||
public class PreAuthVoidViewModel extends ViewModel {
|
public class PreAuthVoidViewModel extends ViewModel {
|
||||||
|
|
||||||
private Repository repository;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
407
app/src/main/java/com/utsmm/kbz/ui/qr_pay/QRPayFragment.java
Normal file
407
app/src/main/java/com/utsmm/kbz/ui/qr_pay/QRPayFragment.java
Normal file
@ -0,0 +1,407 @@
|
|||||||
|
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.LogUtil;
|
||||||
|
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.ArrayList;
|
||||||
|
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("MMQR 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() {
|
||||||
|
boolean isQrRefundEnable = SystemParamsOperation.getInstance().getQrRefundEnable();
|
||||||
|
LogUtil.d("KMK", "isQrRefundEnable =>" + isQrRefundEnable);
|
||||||
|
List<QRPayItem> features = new ArrayList<>();
|
||||||
|
features.add(new QRPayItem("Sale", R.drawable.ic_qr_pay, true));
|
||||||
|
if(isQrRefundEnable){
|
||||||
|
features.add(new QRPayItem("Refund", R.drawable.ic_refund, false));
|
||||||
|
}
|
||||||
|
features.add(new QRPayItem("History", R.drawable.ic_history, true));
|
||||||
|
|
||||||
|
// List<QRPayItem> features = List.of(
|
||||||
|
// new QRPayItem("Sale", R.drawable.ic_qr_pay, true),
|
||||||
|
// new QRPayItem("Refund", R.drawable.ic_refund, false),
|
||||||
|
// new QRPayItem("History", R.drawable.ic_history, true)
|
||||||
|
// );
|
||||||
|
|
||||||
|
QRPayAdapter adapter = new QRPayAdapter(features, position -> {
|
||||||
|
QRPayItem selectedBtn = features.get(position);
|
||||||
|
switch (selectedBtn.title){
|
||||||
|
case "Sale":
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
14
app/src/main/java/com/utsmm/kbz/ui/qr_pay/QRPayItem.java
Normal file
14
app/src/main/java/com/utsmm/kbz/ui/qr_pay/QRPayItem.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package com.utsmm.kbz.ui.qr_pay;
|
||||||
|
|
||||||
|
public class QRPayItem {
|
||||||
|
public String title;
|
||||||
|
public int icon;
|
||||||
|
public boolean isActive;
|
||||||
|
|
||||||
|
public QRPayItem(String title, int icon, boolean isActive) {
|
||||||
|
this.title = title;
|
||||||
|
this.icon = icon;
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -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,221 @@
|
|||||||
|
package com.utsmm.kbz.ui.qr_pay;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.InputFilter;
|
||||||
|
import android.util.Log;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
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 hostId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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("QR 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);
|
||||||
|
}
|
||||||
|
sharedViewModel.transactionsType.setValue(TransactionsType.MMQR_REFUND);
|
||||||
|
kPayViewModel.setPayDetail(payDetail);
|
||||||
|
routeId = R.id.action_qrRefundDetail_inputPasswordFragment;
|
||||||
|
safeNavigateToRouteId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
142
app/src/main/java/com/utsmm/kbz/ui/qr_pay/QRRefundFragment.java
Normal file
142
app/src/main/java/com/utsmm/kbz/ui/qr_pay/QRRefundFragment.java
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
package com.utsmm.kbz.ui.qr_pay;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.RadioGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
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.ArrayList;
|
||||||
|
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;
|
||||||
|
private LinearLayout emptyStateView;
|
||||||
|
|
||||||
|
@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);
|
||||||
|
emptyStateView = view.findViewById(R.id.emptyStateSectionRefund);
|
||||||
|
observeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void observeData(){
|
||||||
|
qrPayViewModel.getRefundableQrHistory().observe(getViewLifecycleOwner(), this::updateList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateList(List<PayDetail> list){
|
||||||
|
if (adapter == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(list == null || list.isEmpty()){
|
||||||
|
emptyStateView.setVisibility(View.VISIBLE);
|
||||||
|
getView().findViewById(R.id.qrRefundHistory).setVisibility(View.GONE);
|
||||||
|
}else{
|
||||||
|
emptyStateView.setVisibility(View.GONE);
|
||||||
|
getView().findViewById(R.id.qrRefundHistory).setVisibility(View.VISIBLE);
|
||||||
|
adapter.setData(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ClickEvent {
|
||||||
|
public void onCancel(){
|
||||||
|
safeNavigateToRouteId();
|
||||||
|
}
|
||||||
|
public void onSearch(){
|
||||||
|
searchById();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onRefundItemClicked(PayDetail payDetail) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable("payDetail", payDetail);
|
||||||
|
routeId = R.id.action_qrRefundList_to_qrRefundDetail;
|
||||||
|
NavHostFragment.findNavController(this).navigate(routeId, bundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void searchById(){
|
||||||
|
EditText editText = getView().findViewById(R.id.rnn_trace_id);
|
||||||
|
String keyword = editText.getText().toString().trim();
|
||||||
|
|
||||||
|
if(keyword.isEmpty()){
|
||||||
|
updateList(qrPayViewModel.getRefundableQrHistory().getValue());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PayDetail> originalList = qrPayViewModel.getRefundableQrHistory().getValue();
|
||||||
|
if(originalList == null) return;
|
||||||
|
|
||||||
|
List<PayDetail> filteredList = new ArrayList<>();
|
||||||
|
for(PayDetail item: originalList){
|
||||||
|
if(item.getReferNo() != null && item.getReferNo().contains(keyword)){
|
||||||
|
filteredList.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateList(filteredList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,230 @@
|
|||||||
|
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.EReceiptUtil;
|
||||||
|
import com.utsmm.kbz.util.TransactionUtil;
|
||||||
|
import com.utsmm.kbz.util.ecr.CoreUtils;
|
||||||
|
import com.utsmm.kbz.util.enums.TransResultStatus;
|
||||||
|
import com.utsmm.kbz.util.tms.TMSUtil;
|
||||||
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
|
import com.utsmyanmar.baselib.network.model.KPayRefund;
|
||||||
|
//import com.utsmyanmar.baselib.network.model.e_receipt.EReceiptQRRequest;
|
||||||
|
import com.utsmyanmar.baselib.network.model.e_receipt.EReceiptRequest;
|
||||||
|
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 java.text.DecimalFormat;
|
||||||
|
|
||||||
|
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.setTC(response.getResponse().getRefundStatus());
|
||||||
|
payDetail.setAmount(refundAmount == null ? 0 : POSUtil.getInstance().convertAmount(refundAmount));
|
||||||
|
payDetail.setOriginalTransDate(dateTime);
|
||||||
|
payDetail.setQrTransStatus(1);
|
||||||
|
payDetail.setQrReferNo(referenceNo);
|
||||||
|
payDetail.setReferNo(referenceNo);
|
||||||
|
payDetail.setIsCanceled(true);
|
||||||
|
payDetail.setCustomerMobile(response.getResponse().getWalletIdentifier());
|
||||||
|
payDetail.setTradeDateAndTime(response.getResponse().getRefundTime());
|
||||||
|
EReceiptRequest request = EReceiptUtil.getInstance().generateQRRefundReceipt(sharedViewModel.payDetail.getValue(), TransResultStatus.SUCCESS);
|
||||||
|
sharedViewModel.pushReceipt(request);
|
||||||
|
|
||||||
|
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);
|
||||||
|
EReceiptRequest request = EReceiptUtil.getInstance().generateQRRefundReceipt(sharedViewModel.payDetail.getValue(), TransResultStatus.FAIL);
|
||||||
|
sharedViewModel.pushReceipt(request);
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,243 @@
|
|||||||
|
package com.utsmm.kbz.ui.settings;
|
||||||
|
|
||||||
|
import static androidx.databinding.DataBindingUtil.getBinding;
|
||||||
|
|
||||||
|
import static com.utsmyanmar.baselib.BaseApplication.sunmiPrinterService;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.content.res.ResourcesCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.nexgo.oaf.apiv3.APIProxy;
|
||||||
|
import com.nexgo.oaf.apiv3.DeviceEngine;
|
||||||
|
import com.nexgo.oaf.apiv3.DeviceInfo;
|
||||||
|
import com.nexgo.oaf.apiv3.SdkResult;
|
||||||
|
import com.nexgo.oaf.apiv3.device.printer.AlignEnum;
|
||||||
|
import com.nexgo.oaf.apiv3.device.printer.GrayLevelEnum;
|
||||||
|
import com.nexgo.oaf.apiv3.device.printer.Printer;
|
||||||
|
import com.utsmm.kbz.BR;
|
||||||
|
import com.utsmm.kbz.R;
|
||||||
|
import com.utsmm.kbz.config.Constants;
|
||||||
|
import com.utsmm.kbz.databinding.FragmentHostConfigBinding;
|
||||||
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
|
import com.utsmyanmar.baselib.util.DialogCallback;
|
||||||
|
import com.utsmyanmar.paylibs.PayLibsUtils;
|
||||||
|
import com.utsmyanmar.paylibs.print.PaperRollStatusCallback;
|
||||||
|
import com.utsmyanmar.paylibs.print.PrintHelper;
|
||||||
|
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
import com.utsmyanmar.paylibs.utils.print_utils.BitmapUtils;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class HostConfigFragment extends DataBindingFragment {
|
||||||
|
|
||||||
|
private HostConfigViewModel viewModel;
|
||||||
|
protected Printer printer;
|
||||||
|
int FONT_NORMAL = 24;
|
||||||
|
int FONT_HEADER = 30;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initViewModel() {
|
||||||
|
viewModel = new ViewModelProvider(this).get(HostConfigViewModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DataBindingConfig getDataBindingConfig() {
|
||||||
|
return new DataBindingConfig(R.layout.fragment_host_config, BR.viewModel, viewModel)
|
||||||
|
.addBindingParam(BR.click, new ClickHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState){
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
FragmentHostConfigBinding binding = (FragmentHostConfigBinding) this.binding;
|
||||||
|
viewModel.loadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume(){
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
setToolBarTitleWithBackIcon("Host Configs");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int currentId() {
|
||||||
|
return R.id.hostConfigFragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int hostId() {
|
||||||
|
return Constants.NAV_HOST_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int routeId() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ClickHandler {
|
||||||
|
public void onCancel(){
|
||||||
|
safePopBack(R.id.hostConfigFragment, Constants.NAV_HOST_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPrint(){
|
||||||
|
startPrintProcess();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void startPrintProcess() {
|
||||||
|
|
||||||
|
DeviceEngine engine = APIProxy.getDeviceEngine(requireContext());
|
||||||
|
printer = engine.getPrinter();
|
||||||
|
int printerStatus = printer.getStatus();
|
||||||
|
if(printerStatus != SdkResult.Success){
|
||||||
|
Log.e("Print Config", "Printer Error: " + printerStatus);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
printer.setGray(GrayLevelEnum.LEVEL_2);
|
||||||
|
Typeface typeface = ResourcesCompat.getFont(requireContext(), R.font.consolas_regular);
|
||||||
|
printer.setTypeface(typeface);
|
||||||
|
SystemParamsOperation sp = SystemParamsOperation.getInstance();
|
||||||
|
|
||||||
|
Bitmap bitmap = BitmapFactory.decodeResource(requireContext().getResources(), R.drawable.kbz_receipt_logo);
|
||||||
|
printLogo(bitmap);
|
||||||
|
printer.appendPrnStr("TERMINAL CONFIGURATION", FONT_HEADER, AlignEnum.CENTER, true);
|
||||||
|
printer.appendPrnStr("\n", FONT_NORMAL, AlignEnum.CENTER, false);
|
||||||
|
printer.appendPrnStr(sp.getMerchantName(), FONT_NORMAL, AlignEnum.CENTER, false);
|
||||||
|
printer.appendPrnStr(sp.getMerchantAddress(), FONT_NORMAL, AlignEnum.CENTER, false);
|
||||||
|
printer.appendPrnStr(sp.getMerchantAddress2(), FONT_NORMAL, AlignEnum.CENTER, false);
|
||||||
|
printer.appendPrnStr("\n---------------------------\n", FONT_NORMAL, AlignEnum.LEFT, false);
|
||||||
|
printer.appendPrnStr("PRIMARY HOST", FONT_NORMAL, AlignEnum.LEFT, true);
|
||||||
|
printer.appendPrnStr("Name : " + sp.getHostName(), FONT_NORMAL, AlignEnum.LEFT, false);
|
||||||
|
printer.appendPrnStr("TID : " + sp.getTerminalId(), FONT_NORMAL, AlignEnum.LEFT, false);
|
||||||
|
printer.appendPrnStr("MID : " + sp.getMerchantId(), FONT_NORMAL, AlignEnum.LEFT, false);
|
||||||
|
String ipAddress = sp.getIpAddress();
|
||||||
|
String[] ipAndPort = splitIpAndPort(ipAddress);
|
||||||
|
String ip = ipAndPort[0];
|
||||||
|
String port = ipAndPort[1];
|
||||||
|
printer.appendPrnStr("Primary Ip : " + ip, FONT_NORMAL, AlignEnum.LEFT, true);
|
||||||
|
printer.appendPrnStr("Primary Port : " + port, FONT_NORMAL, AlignEnum.LEFT, true);
|
||||||
|
String secIpAddress = sp.getSecIpAddress();
|
||||||
|
String[] secIpAndPort = splitIpAndPort(secIpAddress);
|
||||||
|
String secIp = secIpAndPort[0];
|
||||||
|
String secPort = secIpAndPort[1];
|
||||||
|
printer.appendPrnStr("Secondary Ip : " + secIp, FONT_NORMAL, AlignEnum.LEFT, true);
|
||||||
|
printer.appendPrnStr("Secondary Port: " + secPort, FONT_NORMAL, AlignEnum.LEFT, true);
|
||||||
|
printer.appendPrnStr("Currency Code : " + sp.getCurrencyType(), FONT_NORMAL, AlignEnum.LEFT, true);
|
||||||
|
printer.appendPrnStr("\n---------------------------\n", FONT_NORMAL, AlignEnum.LEFT, false);
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(sp.getSecHostName())) {
|
||||||
|
printer.appendPrnStr("SECONDARY HOST", FONT_NORMAL, AlignEnum.LEFT, true);
|
||||||
|
printer.appendPrnStr("Name : " + sp.getSecHostName(), FONT_NORMAL, AlignEnum.LEFT, false);
|
||||||
|
printer.appendPrnStr("TID : " + sp.getSecHostTerminalId(), FONT_NORMAL, AlignEnum.LEFT, false);
|
||||||
|
printer.appendPrnStr("MID : " + sp.getSecHostMerchantId(), FONT_NORMAL, AlignEnum.LEFT, false);
|
||||||
|
String secHostIpAddress = sp.getSecHostIpAddress();
|
||||||
|
String[] secHostIpAndPort = splitIpAndPort(secHostIpAddress);
|
||||||
|
String secHostIp = secHostIpAndPort[0];
|
||||||
|
String secHostPort = secHostIpAndPort[1];
|
||||||
|
printer.appendPrnStr("Primary Ip : " + secHostIp, FONT_NORMAL, AlignEnum.LEFT, true);
|
||||||
|
printer.appendPrnStr("Primary Port : " + secHostPort, FONT_NORMAL, AlignEnum.LEFT, true);
|
||||||
|
String secHostSecIpAddress = sp.getSecHostSecIpAddress();
|
||||||
|
String[] SecHostSecIpAndPort = splitIpAndPort(secHostSecIpAddress);
|
||||||
|
String secHostSecIp = SecHostSecIpAndPort[0];
|
||||||
|
String secHostSecPort = SecHostSecIpAndPort[1];
|
||||||
|
printer.appendPrnStr("Secondary Ip : " + secHostSecIp, FONT_NORMAL, AlignEnum.LEFT, true);
|
||||||
|
printer.appendPrnStr("Secondary Port: " + secHostSecPort, FONT_NORMAL, AlignEnum.LEFT, true);
|
||||||
|
printer.appendPrnStr("Currency Code : " + sp.getCurrencyType(), FONT_NORMAL, AlignEnum.LEFT, true);
|
||||||
|
printer.appendPrnStr("\n---------------------------\n", FONT_NORMAL, AlignEnum.LEFT, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
printer.startPrint(true, ret -> {
|
||||||
|
Log.d("Print", "Print result = " + ret);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private String[] splitIpAndPort(String raw) {
|
||||||
|
if (raw == null || raw.trim().isEmpty()) {
|
||||||
|
return new String[]{"", ""};
|
||||||
|
}
|
||||||
|
|
||||||
|
raw = raw.trim();
|
||||||
|
|
||||||
|
// If starts with http/https
|
||||||
|
if (raw.startsWith("http://") || raw.startsWith("https://")) {
|
||||||
|
|
||||||
|
// Attempt to extract host + port via URL
|
||||||
|
try {
|
||||||
|
java.net.URL url = new java.net.URL(raw);
|
||||||
|
|
||||||
|
String host = url.getHost(); // hostname or IP
|
||||||
|
int port = url.getPort(); // -1 if no port
|
||||||
|
String path = url.getPath(); // /api or /
|
||||||
|
|
||||||
|
// If port exists → split normally
|
||||||
|
if (port != -1) {
|
||||||
|
return new String[]{
|
||||||
|
host, // e.g. 10.10.10.10
|
||||||
|
String.valueOf(port) // e.g. 5000
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// No port → do NOT split
|
||||||
|
return new String[]{ raw, "" };
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// fail-safe: do not split
|
||||||
|
return new String[]{ raw, "" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normal "IP:Port" split
|
||||||
|
int idx = raw.lastIndexOf(":");
|
||||||
|
|
||||||
|
if (idx == -1) {
|
||||||
|
return new String[]{ raw, "" };
|
||||||
|
}
|
||||||
|
|
||||||
|
return new String[]{
|
||||||
|
raw.substring(0, idx),
|
||||||
|
raw.substring(idx + 1)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void printLogo(Bitmap logoBitmap) {
|
||||||
|
try {
|
||||||
|
if (logoBitmap == null || printer == null) return;
|
||||||
|
|
||||||
|
Bitmap bmp = logoBitmap;
|
||||||
|
|
||||||
|
// Max printable width = 384px
|
||||||
|
if (bmp.getWidth() > 384) {
|
||||||
|
int newHeight = (int) (bmp.getHeight() * (384f / bmp.getWidth()));
|
||||||
|
bmp = Bitmap.createScaledBitmap(bmp, 384, newHeight, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
printer.appendPrnStr("\n", FONT_NORMAL, AlignEnum.CENTER, false);
|
||||||
|
printer.appendImage(bmp, AlignEnum.CENTER);
|
||||||
|
printer.appendPrnStr("\n", FONT_NORMAL, AlignEnum.CENTER, false);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("PRINT", "Logo error: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.utsmm.kbz.ui.settings;
|
||||||
|
|
||||||
|
public class HostConfigItem {
|
||||||
|
public String name;
|
||||||
|
public String ip;
|
||||||
|
public String mid;
|
||||||
|
public String tid;
|
||||||
|
public String secHostName;
|
||||||
|
public String secHostIp;
|
||||||
|
public String secHostMid;
|
||||||
|
public String secHostTid;
|
||||||
|
|
||||||
|
public HostConfigItem(
|
||||||
|
String name,
|
||||||
|
String ip,
|
||||||
|
String mid,
|
||||||
|
String tid,
|
||||||
|
String secHostName,
|
||||||
|
String secHostIp,
|
||||||
|
String secHostMid,
|
||||||
|
String secHostTid
|
||||||
|
){
|
||||||
|
this.name = name;
|
||||||
|
this.ip = ip;
|
||||||
|
this.mid = mid;
|
||||||
|
this.tid = tid;
|
||||||
|
this.secHostName = secHostName;
|
||||||
|
this.secHostIp = secHostIp;
|
||||||
|
this.secHostMid = secHostMid;
|
||||||
|
this.secHostTid = secHostTid;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,123 @@
|
|||||||
|
package com.utsmm.kbz.ui.settings;
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
import androidx.lifecycle.ViewModel;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
|
||||||
|
public class HostConfigViewModel extends ViewModel {
|
||||||
|
|
||||||
|
public MutableLiveData<String> merchantName = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> merchantPhone = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> merchantAddress1 = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> merchantAddress2 = new MutableLiveData<>();
|
||||||
|
|
||||||
|
// Primary Host
|
||||||
|
public MutableLiveData<String> hostName = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> tid = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> mid = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> primaryIp = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> primaryPort = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> secondaryIp = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> secondaryPort = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> currencyCode = new MutableLiveData<>();
|
||||||
|
|
||||||
|
// Secondary Host
|
||||||
|
public MutableLiveData<String> secHostName = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> secHostTid = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> secHostMid = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> secHostPrimaryIp = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> secHostPrimaryPort = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> secHostSecondaryIp = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<String> secHostSecondaryPort = new MutableLiveData<>();
|
||||||
|
|
||||||
|
|
||||||
|
public void loadConfig() {
|
||||||
|
|
||||||
|
SystemParamsOperation sp = SystemParamsOperation.getInstance();
|
||||||
|
|
||||||
|
// Merchant Info
|
||||||
|
merchantName.setValue(sp.getMerchantName());
|
||||||
|
merchantPhone.setValue(sp.getMerchantPhoneNo());
|
||||||
|
merchantAddress1.setValue(sp.getMerchantAddress());
|
||||||
|
merchantAddress2.setValue(sp.getMerchantAddress2());
|
||||||
|
|
||||||
|
// PRIMARY HOST
|
||||||
|
hostName.setValue(sp.getHostName());
|
||||||
|
tid.setValue(sp.getTerminalId());
|
||||||
|
mid.setValue(sp.getMerchantId());
|
||||||
|
|
||||||
|
String[] pri = split(sp.getIpAddress());
|
||||||
|
primaryIp.setValue(pri[0]);
|
||||||
|
primaryPort.setValue(pri[1]);
|
||||||
|
|
||||||
|
String[] sec = split(sp.getSecIpAddress());
|
||||||
|
secondaryIp.setValue(sec[0]);
|
||||||
|
secondaryPort.setValue(sec[1]);
|
||||||
|
|
||||||
|
currencyCode.setValue(sp.getCurrencyType() != null ? sp.getCurrencyType().toString() : "");
|
||||||
|
|
||||||
|
|
||||||
|
if (sp.getSecHostName() != null && !sp.getSecHostName().isEmpty()) {
|
||||||
|
|
||||||
|
secHostName.setValue(sp.getSecHostName());
|
||||||
|
secHostTid.setValue(sp.getSecHostTerminalId());
|
||||||
|
secHostMid.setValue(sp.getSecHostMerchantId());
|
||||||
|
|
||||||
|
String[] shp = split(sp.getSecHostIpAddress());
|
||||||
|
secHostPrimaryIp.setValue(shp[0]);
|
||||||
|
secHostPrimaryPort.setValue(shp[1]);
|
||||||
|
|
||||||
|
String[] shs = split(sp.getSecHostSecIpAddress());
|
||||||
|
secHostSecondaryIp.setValue(shs[0]);
|
||||||
|
secHostSecondaryPort.setValue(shs[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String[] split(String raw) {
|
||||||
|
if (raw == null || raw.trim().isEmpty()) {
|
||||||
|
return new String[]{"", ""};
|
||||||
|
}
|
||||||
|
|
||||||
|
raw = raw.trim();
|
||||||
|
|
||||||
|
// If starts with http/https
|
||||||
|
if (raw.startsWith("http://") || raw.startsWith("https://")) {
|
||||||
|
|
||||||
|
// Attempt to extract host + port via URL
|
||||||
|
try {
|
||||||
|
java.net.URL url = new java.net.URL(raw);
|
||||||
|
|
||||||
|
String host = url.getHost(); // hostname or IP
|
||||||
|
int port = url.getPort(); // -1 if no port
|
||||||
|
String path = url.getPath(); // /api or /
|
||||||
|
|
||||||
|
// If port exists → split normally
|
||||||
|
if (port != -1) {
|
||||||
|
return new String[]{
|
||||||
|
host, // e.g. 10.10.10.10
|
||||||
|
String.valueOf(port) // e.g. 5000
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// No port → do NOT split
|
||||||
|
return new String[]{ raw, "" };
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// fail-safe: do not split
|
||||||
|
return new String[]{ raw, "" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normal "IP:Port" split
|
||||||
|
int idx = raw.lastIndexOf(":");
|
||||||
|
|
||||||
|
if (idx == -1) {
|
||||||
|
return new String[]{ raw, "" };
|
||||||
|
}
|
||||||
|
|
||||||
|
return new String[]{
|
||||||
|
raw.substring(0, idx),
|
||||||
|
raw.substring(idx + 1)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,193 @@
|
|||||||
|
package com.utsmm.kbz.ui.settings;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadFEntity;
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadFlow;
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadFlowProcessListener;
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadFlowResultEntity;
|
||||||
|
import com.nexgo.downloadkey.downloadflow.DownloadResult;
|
||||||
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
import com.utsmm.kbz.BR;
|
||||||
|
import com.utsmm.kbz.R;
|
||||||
|
import com.utsmm.kbz.databinding.FragmentInjectKeyBinding;
|
||||||
|
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||||
|
import com.utsmm.kbz.util.tms.TMSUtil;
|
||||||
|
|
||||||
|
public class InjectKeyFragment extends DataBindingFragment {
|
||||||
|
|
||||||
|
private static final String TAG = InjectKeyFragment.class.getSimpleName();
|
||||||
|
|
||||||
|
// Data binding will handle view access automatically
|
||||||
|
private FragmentInjectKeyBinding binding;
|
||||||
|
|
||||||
|
// Key injection variables
|
||||||
|
private DownloadFlow mDownloadFlow;
|
||||||
|
private int keyIndexTmp = 8; // Default key index
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initViewModel() {
|
||||||
|
// No specific viewmodels needed for this fragment
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DataBindingConfig getDataBindingConfig() {
|
||||||
|
// This is the key method that links the XML and fragment properly
|
||||||
|
return new DataBindingConfig(R.layout.fragment_inject_key, 0, null)
|
||||||
|
.addBindingParam(BR.click, new ClickEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int currentId() {
|
||||||
|
return R.id.injectKeyFragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int hostId() {
|
||||||
|
return R.id.nav_host_fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int routeId() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
try {
|
||||||
|
|
||||||
|
// Get the binding from the base class - this is automatically created
|
||||||
|
binding = (FragmentInjectKeyBinding) mBinding;
|
||||||
|
|
||||||
|
updateConfigurationInfo();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
setToolBarTitleWithBackIcon("Inject Key");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateConfigurationInfo() {
|
||||||
|
|
||||||
|
String terminalId = SystemParamsOperation.getInstance().getTerminalId();
|
||||||
|
binding.terminalIdValue.setText(terminalId != null && !terminalId.isEmpty() ?
|
||||||
|
terminalId : "Not configured");
|
||||||
|
|
||||||
|
// Update Merchant ID
|
||||||
|
String merchantId = SystemParamsOperation.getInstance().getMerchantId();
|
||||||
|
binding.merchantIdValue.setText(merchantId != null && !merchantId.isEmpty() ?
|
||||||
|
merchantId : "Not configured");
|
||||||
|
|
||||||
|
// Update Serial Number
|
||||||
|
String serialNo = TMSUtil.getInstance().getSerialNumber();
|
||||||
|
binding.serialNumberValue.setText(serialNo != null && !serialNo.isEmpty() ?
|
||||||
|
serialNo : "Not configured");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadKeyFromKeyPOS() {
|
||||||
|
try {
|
||||||
|
if (TextUtils.isEmpty(binding.etKeyIndex.getText())) {
|
||||||
|
Toast.makeText(getContext(), "Please input key index", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String keyIndexText = binding.etKeyIndex.getText().toString().trim();
|
||||||
|
|
||||||
|
try {
|
||||||
|
keyIndexTmp = Integer.parseInt(keyIndexText);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Toast.makeText(getContext(), "Invalid key index format", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
showLoadingDialog("Loading key...");
|
||||||
|
|
||||||
|
mDownloadFlow = DownloadFlow.getInstance();
|
||||||
|
|
||||||
|
String terminalId = SystemParamsOperation.getInstance().getTerminalId();
|
||||||
|
String merchantId = SystemParamsOperation.getInstance().getMerchantId();
|
||||||
|
String serialNo = TMSUtil.getInstance().getSerialNumber();
|
||||||
|
|
||||||
|
// Validate configuration
|
||||||
|
if (TextUtils.isEmpty(terminalId) || TextUtils.isEmpty(merchantId) || TextUtils.isEmpty(serialNo)) {
|
||||||
|
dismissLoadingDialog();
|
||||||
|
showDeclineDialog("Please configure Terminal ID, Merchant ID first in TMS Configuration");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final DownloadFEntity downloadFEntity = new DownloadFEntity();
|
||||||
|
downloadFEntity.setSn(serialNo.getBytes());
|
||||||
|
downloadFEntity.setMid(merchantId.getBytes());
|
||||||
|
downloadFEntity.setTid(terminalId.getBytes());
|
||||||
|
downloadFEntity.setTmkIndex(keyIndexTmp);
|
||||||
|
downloadFEntity.setPort(0);
|
||||||
|
downloadFEntity.setTimeOut(10);
|
||||||
|
|
||||||
|
int result = mDownloadFlow.startLoadKey(getActivity(), downloadFEntity, onDownloadFlowProcessListener);
|
||||||
|
if (result != DownloadResult.Success) {
|
||||||
|
dismissLoadingDialog();
|
||||||
|
showDeclineDialog("Failed to start key injection process");
|
||||||
|
LogUtil.e(TAG, "Failed to start key injection, result: " + result);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
dismissLoadingDialog();
|
||||||
|
LogUtil.e(TAG, "Error in key injection: " + e.getMessage());
|
||||||
|
showDeclineDialog("Error occurred during key injection: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private DownloadFlowProcessListener onDownloadFlowProcessListener = new DownloadFlowProcessListener() {
|
||||||
|
@Override
|
||||||
|
public void onFinish(int ret, DownloadFlowResultEntity downloadFlowResultEntity) {
|
||||||
|
try {
|
||||||
|
dismissLoadingDialog();
|
||||||
|
|
||||||
|
if (ret == DownloadResult.Success) {
|
||||||
|
// Show success dialog with key index
|
||||||
|
showSuccessDialog("Key injection successful!\nKey Index: " + keyIndexTmp);
|
||||||
|
LogUtil.d(TAG, "Key injection successful for index: " + keyIndexTmp);
|
||||||
|
} else {
|
||||||
|
// Show decline dialog
|
||||||
|
showDeclineDialog("Key injection failed!\nError code: " + ret);
|
||||||
|
LogUtil.e(TAG, "Key injection failed with error code: " + ret);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.e(TAG, "Error handling injection result: " + e.getMessage());
|
||||||
|
showDeclineDialog("Error processing injection result");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// ClickEvent class for data binding - this is the proper pattern
|
||||||
|
public class ClickEvent {
|
||||||
|
|
||||||
|
public void onInjectKeyClick() {
|
||||||
|
try {
|
||||||
|
LogUtil.d(TAG, "Inject key button clicked");
|
||||||
|
loadKeyFromKeyPOS();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.e(TAG, "Error in inject key click: " + e.getMessage());
|
||||||
|
showDeclineDialog("Error occurred: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,338 @@
|
|||||||
|
package com.utsmm.kbz.ui.settlement;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.lifecycle.Observer;
|
||||||
|
|
||||||
|
import com.utsmm.kbz.util.EReceiptUtil;
|
||||||
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
|
import com.utsmyanmar.baselib.network.model.e_receipt.EReceiptRequest;
|
||||||
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
|
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||||
|
import com.utsmyanmar.paylibs.model.SettleData;
|
||||||
|
import com.utsmyanmar.paylibs.model.TradeData;
|
||||||
|
import com.utsmyanmar.paylibs.utils.POSUtil;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
import com.utsmyanmar.paylibs.utils.enums.HostType;
|
||||||
|
import com.utsmyanmar.paylibs.utils.enums.TransMenu;
|
||||||
|
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||||
|
import com.utsmyanmar.paylibs.utils.params.Params;
|
||||||
|
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.management.ManagementViewModel;
|
||||||
|
import com.utsmm.kbz.util.ecr.CoreUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class QRSettlementTransactionFragment extends DataBindingFragment implements DataBindingFragment.BackPressCallback {
|
||||||
|
|
||||||
|
private SharedViewModel sharedViewModel;
|
||||||
|
private ManagementViewModel managementViewModel;
|
||||||
|
private SettlementViewModel settlementViewModel;
|
||||||
|
|
||||||
|
ArrayList<PayDetail> qrTransactionsList = new ArrayList<>();
|
||||||
|
|
||||||
|
private int routeId;
|
||||||
|
private int count = 0;
|
||||||
|
private long totalAmount = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initViewModel() {
|
||||||
|
sharedViewModel = getFragmentScopeViewModel(SharedViewModel.class);
|
||||||
|
managementViewModel = getFragmentScopeViewModel(ManagementViewModel.class);
|
||||||
|
settlementViewModel = getFragmentScopeViewModel(SettlementViewModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DataBindingConfig getDataBindingConfig() {
|
||||||
|
return new DataBindingConfig(R.layout.fragment_qr_settlement_screen, BR.sharedViewModel, sharedViewModel)
|
||||||
|
.addBindingParam(BR.manageViewModel, managementViewModel)
|
||||||
|
.addBindingParam(BR.settleViewModel, settlementViewModel)
|
||||||
|
.addBindingParam(BR.click, new ClickEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int currentId() {
|
||||||
|
return R.id.QRSettlementTransactionFragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int hostId() {
|
||||||
|
return Constants.NAV_HOST_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int routeId() {
|
||||||
|
return routeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
setToolBarTitleWithBackIcon(getString(R.string.title_qr_settlement));
|
||||||
|
|
||||||
|
String merchantName = SystemParamsOperation.getInstance().getMerchantName();
|
||||||
|
if (!TextUtils.equals(merchantName, "")) {
|
||||||
|
sharedViewModel.merchantName.postValue(merchantName);
|
||||||
|
} else {
|
||||||
|
sharedViewModel.merchantName.postValue("Default Value");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sharedViewModel.getTransMenu().getValue() == TransMenu.LAST_SETTLEMENT) {
|
||||||
|
setToolBarTitleWithBackIcon(getString(R.string.txt_subtitle_reprint_last_settle_report));
|
||||||
|
delayFunctionCall(this::observeQRLastSettlementTransactions);
|
||||||
|
} else {
|
||||||
|
setToolBarTitleWithBackIcon(getString(R.string.title_view_batch));
|
||||||
|
delayFunctionCall(this::observeQRTransactions);
|
||||||
|
}
|
||||||
|
|
||||||
|
showLoadingView();
|
||||||
|
// setupQRSettlementData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
setupBackButtonPressDetection(this);
|
||||||
|
|
||||||
|
setupQRSettlementData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showLoadingView() {
|
||||||
|
managementViewModel.detailReportLayoutLoadingVisibility.setValue(0);
|
||||||
|
managementViewModel.detailReportLayoutVisibility.setValue(8);
|
||||||
|
managementViewModel.detailReportLayoutViewVisibility.setValue(8);
|
||||||
|
managementViewModel.detailReportBottomLayoutVisibility.setValue(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showDataView() {
|
||||||
|
managementViewModel.detailReportLayoutLoadingVisibility.setValue(8);
|
||||||
|
managementViewModel.detailReportLayoutVisibility.setValue(8);
|
||||||
|
managementViewModel.detailReportLayoutViewVisibility.setValue(0);
|
||||||
|
managementViewModel.detailReportBottomLayoutVisibility.setValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showEmptyDataView() {
|
||||||
|
managementViewModel.detailReportLayoutLoadingVisibility.setValue(8);
|
||||||
|
managementViewModel.detailReportLayoutVisibility.setValue(0);
|
||||||
|
managementViewModel.detailReportLayoutViewVisibility.setValue(8);
|
||||||
|
managementViewModel.detailReportBottomLayoutVisibility.setValue(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupQRSettlementData() {
|
||||||
|
managementViewModel.hostTypeDR.setValue("PAYMENT");
|
||||||
|
managementViewModel.cardTypeDR.setValue("QR PAY");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void observeQRTransactions() {
|
||||||
|
managementViewModel.getTransactionHistory().observe(getViewLifecycleOwner(), payDetailList -> {
|
||||||
|
if (payDetailList != null) {
|
||||||
|
qrTransactionsList.clear();
|
||||||
|
count = 0;
|
||||||
|
totalAmount = 0;
|
||||||
|
|
||||||
|
for (PayDetail payDetail : payDetailList) {
|
||||||
|
// Filter for QR transactions only
|
||||||
|
if ((payDetail.getTransactionType() == TransactionsType.MMQR.value
|
||||||
|
|| payDetail.getTransactionType() == TransactionsType.MMQR_REFUND.value)
|
||||||
|
&& payDetail.getQrTransStatus() == 1
|
||||||
|
&& POSUtil.getInstance().getYesterdayDate().compareTo(POSUtil.getInstance().getDateByString(payDetail.transDate)) < 1) {
|
||||||
|
|
||||||
|
boolean isNeedMinusSign = payDetail.getTransactionType() == TransactionsType.MMQR_REFUND.value;
|
||||||
|
qrTransactionsList.add(payDetail);
|
||||||
|
count++;
|
||||||
|
if (isNeedMinusSign) {
|
||||||
|
totalAmount -= payDetail.getAmount();
|
||||||
|
} else {
|
||||||
|
totalAmount += payDetail.getAmount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qrTransactionsList.isEmpty()) {
|
||||||
|
showEmptyDataView();
|
||||||
|
settlementViewModel.isNoData.setValue(true);
|
||||||
|
} else {
|
||||||
|
showDataView();
|
||||||
|
settlementViewModel.isNoData.setValue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
setupSettlementDisplayData();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
showEmptyDataView();
|
||||||
|
settlementViewModel.isNoData.setValue(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void observeQRLastSettlementTransactions() {
|
||||||
|
List<PayDetail> payDetailList = managementViewModel.payDetails.getValue();
|
||||||
|
if( payDetailList != null) {
|
||||||
|
qrTransactionsList.clear();
|
||||||
|
count = 0;
|
||||||
|
totalAmount = 0;
|
||||||
|
|
||||||
|
for (PayDetail payDetail : payDetailList) {
|
||||||
|
// Filter for QR transactions only
|
||||||
|
if ((payDetail.getTransactionType() == TransactionsType.MMQR.value
|
||||||
|
|| payDetail.getTransactionType() == TransactionsType.MMQR_REFUND.value)
|
||||||
|
&& payDetail.getQrTransStatus() == 1
|
||||||
|
&& POSUtil.getInstance().getYesterdayDate().compareTo(POSUtil.getInstance().getDateByString(payDetail.transDate)) < 1) {
|
||||||
|
|
||||||
|
boolean isNeedMinusSign = payDetail.getTransactionType() == TransactionsType.MMQR_REFUND.value;
|
||||||
|
qrTransactionsList.add(payDetail);
|
||||||
|
count++;
|
||||||
|
if (isNeedMinusSign) {
|
||||||
|
totalAmount -= payDetail.getAmount();
|
||||||
|
} else {
|
||||||
|
totalAmount += payDetail.getAmount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qrTransactionsList.isEmpty()) {
|
||||||
|
showEmptyDataView();
|
||||||
|
settlementViewModel.isNoData.setValue(true);
|
||||||
|
} else {
|
||||||
|
showDataView();
|
||||||
|
settlementViewModel.isNoData.setValue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
setupSettlementDisplayData();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
showEmptyDataView();
|
||||||
|
settlementViewModel.isNoData.setValue(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void setupSettlementDisplayData() {
|
||||||
|
|
||||||
|
// Calculate QR sale and refund counts/amounts
|
||||||
|
int qrSaleCount = 0;
|
||||||
|
long qrSaleAmount = 0;
|
||||||
|
int qrRefundCount = 0;
|
||||||
|
long qrRefundAmount = 0;
|
||||||
|
|
||||||
|
for (PayDetail payDetail : qrTransactionsList) {
|
||||||
|
if (payDetail.getTransactionType() == TransactionsType.MMQR.value) {
|
||||||
|
qrSaleCount++;
|
||||||
|
qrSaleAmount += payDetail.getAmount();
|
||||||
|
} else if (payDetail.getTransactionType() == TransactionsType.MMQR_REFUND.value) {
|
||||||
|
qrRefundCount++;
|
||||||
|
qrRefundAmount += payDetail.getAmount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set values in settlement view model for display
|
||||||
|
settlementViewModel.sale_count.setValue(qrSaleCount);
|
||||||
|
settlementViewModel.sale_amount.setValue(qrSaleAmount);
|
||||||
|
settlementViewModel.refund_count.setValue(qrRefundCount);
|
||||||
|
settlementViewModel.refund_amount.setValue(qrRefundAmount);
|
||||||
|
|
||||||
|
managementViewModel.totalAmountDR.setValue(totalAmount);
|
||||||
|
managementViewModel.trnxCountDR.setValue(String.valueOf(count));
|
||||||
|
|
||||||
|
// Create settlement data for transaction result
|
||||||
|
SettleData settleData = new SettleData(qrSaleCount, qrSaleAmount, 0, 0L, qrRefundCount, qrRefundAmount, 0, 0L);
|
||||||
|
TradeData tradeData = Params.newTrade(false);
|
||||||
|
PayDetail payDetail = tradeData.getPayDetail();
|
||||||
|
payDetail.setSettleDataObj(settleData);
|
||||||
|
payDetail.setTransactionType(TransactionsType.MMQR_SETTLEMENT.value);
|
||||||
|
payDetail.setTransType(TransactionsType.MMQR_SETTLEMENT.name);
|
||||||
|
payDetail.setAmount(totalAmount);
|
||||||
|
payDetail.setTradeAnswerCode("000");
|
||||||
|
|
||||||
|
if(sharedViewModel.getTransMenu().getValue() != TransMenu.LAST_SETTLEMENT) {
|
||||||
|
sharedViewModel.insertPayDetail(payDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sharedViewModel.setAmount(String.valueOf(qrSaleAmount - qrRefundAmount));
|
||||||
|
|
||||||
|
sharedViewModel.payDetail.setValue(payDetail);
|
||||||
|
sharedViewModel.payDetails.setValue(qrTransactionsList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void finishECRProcess() {
|
||||||
|
CoreUtils.getInstance(sharedViewModel).responseRejectMsg(getString(R.string.txt_cancel_trans));
|
||||||
|
sharedViewModel.isEcrFinished.postValue(true);
|
||||||
|
sharedViewModel.isEcr.postValue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void navigateToResult() {
|
||||||
|
delayFunctionCall(()->{
|
||||||
|
routeId = R.id.action_QRSettlementTransactionFragment_to_transactionResultFragment;
|
||||||
|
safeNavigateToRouteId();
|
||||||
|
},500);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateData() {
|
||||||
|
EReceiptRequest request = EReceiptUtil.getInstance().generateMPUReceipt(sharedViewModel.payDetail.getValue());
|
||||||
|
sharedViewModel.pushReceipt(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPress() {
|
||||||
|
if (sharedViewModel.isEcr.getValue() != null && sharedViewModel.isEcr.getValue()) {
|
||||||
|
finishECRProcess();
|
||||||
|
}
|
||||||
|
popBackStack();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void navigateToMain() {
|
||||||
|
routeId = R.id.action_QRSettlementTransactionFragment_to_nav_main;
|
||||||
|
safeNavigateToRouteId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ClickEvent {
|
||||||
|
|
||||||
|
public void onCancel() {
|
||||||
|
if(sharedViewModel.getTransMenu().getValue() == TransMenu.SETTLEMENT) {
|
||||||
|
if (sharedViewModel.isEcr.getValue() != null && sharedViewModel.isEcr.getValue()) {
|
||||||
|
finishECRProcess();
|
||||||
|
}
|
||||||
|
popBackStack();
|
||||||
|
} else if(sharedViewModel.getTransMenu().getValue() == TransMenu.LAST_SETTLEMENT) {
|
||||||
|
navigateToMain();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if(sharedViewModel.getTransMenu().getValue() == TransMenu.SETTLEMENT) {
|
||||||
|
if (!qrTransactionsList.isEmpty()) {
|
||||||
|
for (PayDetail payDetail : qrTransactionsList) {
|
||||||
|
settlementViewModel.deletePayDetail(payDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateData();
|
||||||
|
navigateToResult();
|
||||||
|
}
|
||||||
|
} else if(sharedViewModel.getTransMenu().getValue() == TransMenu.LAST_SETTLEMENT) {
|
||||||
|
routeId = R.id.action_QRSettlementTransactionFragment_to_reprintReceiptFragment;
|
||||||
|
safeNavigateToRouteId();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,98 @@
|
|||||||
|
package com.utsmm.kbz.ui.settlement;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
|
import com.utsmyanmar.paylibs.utils.enums.HostType;
|
||||||
|
import com.utsmyanmar.paylibs.utils.enums.TransMenu;
|
||||||
|
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.ecr.CoreUtils;
|
||||||
|
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||||
|
|
||||||
|
public class SelectSettlementFragment extends DataBindingFragment implements DataBindingFragment.BackPressCallback {
|
||||||
|
|
||||||
|
private SharedViewModel sharedViewModel;
|
||||||
|
private int routeId;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initViewModel() {
|
||||||
|
sharedViewModel = getFragmentScopeViewModel(SharedViewModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DataBindingConfig getDataBindingConfig() {
|
||||||
|
return new DataBindingConfig(R.layout.fragment_select_settlement_screen, BR.sharedViewModel, sharedViewModel)
|
||||||
|
.addBindingParam(BR.click, new ClickEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int currentId() {
|
||||||
|
return R.id.selectSettlementFragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int hostId() {
|
||||||
|
return Constants.NAV_HOST_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int routeId() {
|
||||||
|
return routeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
setToolBarTitleWithBackIcon(getString(R.string.title_select_settlement_type));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
setupBackButtonPressDetection(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void finishECRProcess() {
|
||||||
|
CoreUtils.getInstance(sharedViewModel).responseRejectMsg(getString(R.string.txt_cancel_trans));
|
||||||
|
sharedViewModel.isEcrFinished.postValue(true);
|
||||||
|
sharedViewModel.isEcr.postValue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPress() {
|
||||||
|
if (sharedViewModel.isEcr.getValue() != null && sharedViewModel.isEcr.getValue()) {
|
||||||
|
finishECRProcess();
|
||||||
|
}
|
||||||
|
popBackStack();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ClickEvent {
|
||||||
|
|
||||||
|
public void onCardSettlement() {
|
||||||
|
|
||||||
|
routeId = R.id.action_selectSettlementFragment_to_settlementTransactionFragment;
|
||||||
|
safeNavigateToRouteId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onQRSettlement() {
|
||||||
|
sharedViewModel.hostType.setValue(HostType.QR);
|
||||||
|
routeId = R.id.action_selectSettlementFragment_to_QRSettlementTransactionFragment;
|
||||||
|
safeNavigateToRouteId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onCancel() {
|
||||||
|
if (sharedViewModel.isEcr.getValue() != null && sharedViewModel.isEcr.getValue()) {
|
||||||
|
finishECRProcess();
|
||||||
|
}
|
||||||
|
popBackStack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,7 +8,9 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.lifecycle.Observer;
|
import androidx.lifecycle.Observer;
|
||||||
|
|
||||||
|
import com.utsmm.kbz.util.EReceiptUtil;
|
||||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
|
import com.utsmyanmar.baselib.network.model.e_receipt.EReceiptRequest;
|
||||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
import com.utsmyanmar.paylibs.model.PayDetail;
|
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||||
import com.utsmyanmar.paylibs.model.TradeData;
|
import com.utsmyanmar.paylibs.model.TradeData;
|
||||||
@ -316,7 +318,9 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
|||||||
dismissLoadingDialog();
|
dismissLoadingDialog();
|
||||||
updateData();
|
updateData();
|
||||||
if (!SystemParamsOperation.getInstance().getDemoStatus()) {
|
if (!SystemParamsOperation.getInstance().getDemoStatus()) {
|
||||||
networkCutOver();
|
|
||||||
|
networkCutOver(); // bpc
|
||||||
|
navigateToNext();
|
||||||
} else {
|
} else {
|
||||||
navigateToNext();
|
navigateToNext();
|
||||||
}
|
}
|
||||||
@ -336,6 +340,10 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
|||||||
|
|
||||||
private void updateData() {
|
private void updateData() {
|
||||||
sharedViewModel.payDetail.setValue(settlementViewModel.getPayDetail());
|
sharedViewModel.payDetail.setValue(settlementViewModel.getPayDetail());
|
||||||
|
|
||||||
|
EReceiptRequest request = EReceiptUtil.getInstance().generateMPUReceipt(sharedViewModel.payDetail.getValue());
|
||||||
|
|
||||||
|
sharedViewModel.pushReceipt(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -383,7 +391,7 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
|||||||
settlementViewModel.startSettlementProcess();
|
settlementViewModel.startSettlementProcess();
|
||||||
showLoadingDialog("Sending ...");
|
showLoadingDialog("Sending ...");
|
||||||
} else if(sharedViewModel.getTransMenu().getValue() == TransMenu.REVIEW_BATCH) {
|
} else if(sharedViewModel.getTransMenu().getValue() == TransMenu.REVIEW_BATCH) {
|
||||||
sharedViewModel.startPrintProcessSettlement();
|
sharedViewModel.startPrintSettlement();
|
||||||
} else if(sharedViewModel.getTransMenu().getValue() == TransMenu.LAST_SETTLEMENT) {
|
} else if(sharedViewModel.getTransMenu().getValue() == TransMenu.LAST_SETTLEMENT) {
|
||||||
routeId = R.id.action_settlementTransactionFragment_to_reprintReceiptFragment;
|
routeId = R.id.action_settlementTransactionFragment_to_reprintReceiptFragment;
|
||||||
safeNavigateToRouteId();
|
safeNavigateToRouteId();
|
||||||
|
|||||||
@ -7,6 +7,8 @@ import androidx.lifecycle.LiveData;
|
|||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
import androidx.lifecycle.ViewModel;
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
|
import com.utsmm.kbz.util.EReceiptUtil;
|
||||||
|
import com.utsmyanmar.baselib.network.model.e_receipt.EReceiptRequest;
|
||||||
import com.utsmyanmar.baselib.repo.Repository;
|
import com.utsmyanmar.baselib.repo.Repository;
|
||||||
import com.utsmyanmar.paylibs.Constant;
|
import com.utsmyanmar.paylibs.Constant;
|
||||||
import com.utsmyanmar.paylibs.batch_upload.BatchListener;
|
import com.utsmyanmar.paylibs.batch_upload.BatchListener;
|
||||||
@ -209,6 +211,10 @@ public class SettlementViewModel extends ViewModel {
|
|||||||
repository.updatePayDetail(payDetail);
|
repository.updatePayDetail(payDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deletePayDetail(PayDetail payDetail){
|
||||||
|
repository.deletePayDetail(payDetail);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateDB() {
|
private void updateDB() {
|
||||||
|
|
||||||
if(payDetails != null && payDetails.size() > 0) {
|
if(payDetails != null && payDetails.size() > 0) {
|
||||||
@ -218,7 +224,8 @@ public class SettlementViewModel extends ViewModel {
|
|||||||
// paydetail.setIsSettle(true);
|
// paydetail.setIsSettle(true);
|
||||||
// updatePayDetail(paydetail);
|
// updatePayDetail(paydetail);
|
||||||
// } else {
|
// } else {
|
||||||
repository.deletePayDetail(paydetail);
|
deletePayDetail(payDetail);
|
||||||
|
// repository.deletePayDetail(paydetail);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
@ -228,7 +235,8 @@ public class SettlementViewModel extends ViewModel {
|
|||||||
|
|
||||||
for (PayDetail pay:deleteTrans
|
for (PayDetail pay:deleteTrans
|
||||||
) {
|
) {
|
||||||
repository.deletePayDetail(pay);
|
// repository.deletePayDetail(pay);
|
||||||
|
deletePayDetail(pay);
|
||||||
}
|
}
|
||||||
if (payDetails != null) {
|
if (payDetails != null) {
|
||||||
payDetails.clear();
|
payDetails.clear();
|
||||||
@ -245,6 +253,8 @@ public class SettlementViewModel extends ViewModel {
|
|||||||
repository.insertPayDetail(payDetail);
|
repository.insertPayDetail(payDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("ConstantConditions")
|
@SuppressWarnings("ConstantConditions")
|
||||||
public void startSettlementProcess() {
|
public void startSettlementProcess() {
|
||||||
saleCount = sale_count.getValue();
|
saleCount = sale_count.getValue();
|
||||||
@ -361,14 +371,26 @@ public class SettlementViewModel extends ViewModel {
|
|||||||
payDetail = tradeData.getPayDetail();
|
payDetail = tradeData.getPayDetail();
|
||||||
|
|
||||||
|
|
||||||
bitmap = BitmapConfig.BPC_SETTLEMENT;
|
//
|
||||||
|
if(hostName == HostName.BPC) {
|
||||||
|
bitmap = BitmapConfig.BPC_SETTLEMENT;
|
||||||
|
} else {
|
||||||
|
bitmap = BitmapConfig.MPU_NEW_SETTLE;
|
||||||
|
}
|
||||||
|
|
||||||
payDetail.setTransType(TransactionsType.SETTLEMENT.name);
|
payDetail.setTransType(TransactionsType.SETTLEMENT.name);
|
||||||
payDetail.setTransactionType(TransactionType.SETTLEMENT);
|
payDetail.setTransactionType(TransactionType.SETTLEMENT);
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
payDetail.setProcessCode(TransactionsType.SETTLEMENT.processCode);
|
payDetail.setProcessCode(TransactionsType.SETTLEMENT.processCode);
|
||||||
} else {
|
} else {
|
||||||
bitmap = BitmapConfig.BPC_SETTLEMENT_TRAILER;
|
if(hostName == HostName.BPC) {
|
||||||
payDetail.setProcessCode("910000");
|
bitmap = BitmapConfig.BPC_SETTLEMENT_TRAILER;
|
||||||
|
payDetail.setProcessCode("910000");
|
||||||
|
} else {
|
||||||
|
bitmap = BitmapConfig.MPU_NEW_SETTLE;
|
||||||
|
payDetail.setProcessCode("960000");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CA:CA - CD - FT
|
// CA:CA - CD - FT
|
||||||
@ -403,7 +425,8 @@ public class SettlementViewModel extends ViewModel {
|
|||||||
payDetail.setSettleData(settlementData);
|
payDetail.setSettleData(settlementData);
|
||||||
payDetail.setAmount(totalAmount);
|
payDetail.setAmount(totalAmount);
|
||||||
} else {
|
} else {
|
||||||
payDetail.setSettleData(totalSaleCount + totalSaleAmount + totalRefundCount + totalRefundAmount + totalDebitSaleCount + totalDebitSaleAmount + totalERefundCount + totalERefundAmount); //field 63
|
// payDetail.setSettleData(totalSaleCount + totalSaleAmount + totalRefundCount + totalRefundAmount + totalDebitSaleCount + totalDebitSaleAmount + totalERefundCount + totalERefundAmount); //field 63 BPC
|
||||||
|
payDetail.setSettleData(totalSaleCount + totalSaleAmount + totalRefundCount + totalRefundAmount + totalDebitSaleCount + totalDebitSaleAmount ); //field 63
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -486,8 +509,12 @@ public class SettlementViewModel extends ViewModel {
|
|||||||
// to leave data for testing
|
// to leave data for testing
|
||||||
// if (settlementType.getValue() == SettlementType.NORMAL) {
|
// if (settlementType.getValue() == SettlementType.NORMAL) {
|
||||||
updateDB();
|
updateDB();
|
||||||
|
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
insertPayDetail(payDetail);
|
insertPayDetail(payDetail);
|
||||||
|
|
||||||
if (errorFlag) {
|
if (errorFlag) {
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import androidx.annotation.Nullable;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.stream.MalformedJsonException;
|
import com.google.gson.stream.MalformedJsonException;
|
||||||
|
import com.utsmm.kbz.service.AutoAlarmReceiver;
|
||||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
import com.utsmyanmar.baselib.network.model.sirius.SiriusError;
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusError;
|
||||||
import com.utsmyanmar.baselib.network.model.sirius.SiriusRequest;
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusRequest;
|
||||||
@ -213,6 +214,7 @@ public class TMSProcessFragment extends DataBindingFragment {
|
|||||||
CurrencyType currencyType = SystemParamsOperation.getInstance().getCurrencyType();
|
CurrencyType currencyType = SystemParamsOperation.getInstance().getCurrencyType();
|
||||||
sharedViewModel.set_currencyText(currencyType.name);
|
sharedViewModel.set_currencyText(currencyType.name);
|
||||||
// tmsProcessViewModel.loadEmvParameters();
|
// tmsProcessViewModel.loadEmvParameters();
|
||||||
|
// scheduleAutoSettlement();
|
||||||
navigateToMain();
|
navigateToMain();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -224,4 +226,48 @@ public class TMSProcessFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void scheduleAutoSettlement() {
|
||||||
|
String timeStr = SystemParamsOperation.getInstance().getClearBatchTime();
|
||||||
|
if(timeStr == null || timeStr.trim().isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String[] parts = timeStr.trim().split(":");
|
||||||
|
if(parts.length != 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int hour;
|
||||||
|
int minute;
|
||||||
|
try {
|
||||||
|
hour = Integer.parseInt(parts[0]);
|
||||||
|
minute = Integer.parseInt(parts[1]);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
android.app.AlarmManager alarmManager = (android.app.AlarmManager) requireContext().getSystemService(android.content.Context.ALARM_SERVICE);
|
||||||
|
if(alarmManager == null) return;
|
||||||
|
|
||||||
|
java.util.Calendar calendar = java.util.Calendar.getInstance();
|
||||||
|
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||||
|
calendar.set(java.util.Calendar.HOUR_OF_DAY, hour);
|
||||||
|
calendar.set(java.util.Calendar.MINUTE, minute);
|
||||||
|
calendar.set(java.util.Calendar.SECOND, 0);
|
||||||
|
|
||||||
|
long triggerAtMillis = calendar.getTimeInMillis();
|
||||||
|
if(System.currentTimeMillis() > triggerAtMillis) {
|
||||||
|
calendar.add(java.util.Calendar.DAY_OF_YEAR, 1);
|
||||||
|
triggerAtMillis = calendar.getTimeInMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
android.content.Intent intent = new android.content.Intent(requireContext(), AutoAlarmReceiver.class);
|
||||||
|
android.app.PendingIntent pendingIntent = android.app.PendingIntent.getBroadcast(
|
||||||
|
requireContext(),
|
||||||
|
1001,
|
||||||
|
intent,
|
||||||
|
android.app.PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
|
);
|
||||||
|
|
||||||
|
alarmManager.setRepeating(android.app.AlarmManager.RTC_WAKEUP, triggerAtMillis, android.app.AlarmManager.INTERVAL_DAY, pendingIntent);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
50
app/src/main/java/com/utsmm/kbz/util/DownloadUtil.java
Normal file
50
app/src/main/java/com/utsmm/kbz/util/DownloadUtil.java
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
package com.utsmm.kbz.util;
|
||||||
|
|
||||||
|
import com.utsmm.kbz.MyApplication;
|
||||||
|
import com.utsmyanmar.paylibs.utils.LogUtil;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
|
||||||
|
import okhttp3.OkHttp;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class DownloadUtil {
|
||||||
|
|
||||||
|
final static String TAG = DownloadUtil.class.getSimpleName();
|
||||||
|
private void downloadFile(String url){
|
||||||
|
try{
|
||||||
|
OkHttpClient okHttpClient = new OkHttpClient();
|
||||||
|
Request request = new Request.Builder().url(url).build();
|
||||||
|
Response response = okHttpClient.newCall(request).execute();
|
||||||
|
|
||||||
|
if(!response.isSuccessful()){
|
||||||
|
LogUtil.e(TAG, "file download failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
byte[] bytes = response.body().bytes();
|
||||||
|
saveFile("cert_file.ctr", bytes);
|
||||||
|
LogUtil.d(TAG, "file saved successfully.");
|
||||||
|
}catch (Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveFile(String filename, byte[] data){
|
||||||
|
try{
|
||||||
|
File dir = MyApplication.getInstance().getFilesDir();
|
||||||
|
File file = new File(dir, filename);
|
||||||
|
|
||||||
|
FileOutputStream fos = new FileOutputStream(file);
|
||||||
|
fos.write(data);
|
||||||
|
fos.flush();
|
||||||
|
fos.close();
|
||||||
|
|
||||||
|
LogUtil.d(TAG, "Saved file at => " + file.getAbsolutePath());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
234
app/src/main/java/com/utsmm/kbz/util/EReceiptUtil.java
Normal file
234
app/src/main/java/com/utsmm/kbz/util/EReceiptUtil.java
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
package com.utsmm.kbz.util;
|
||||||
|
|
||||||
|
import com.utsmm.kbz.BuildConfig;
|
||||||
|
import com.utsmm.kbz.util.enums.TransResultStatus;
|
||||||
|
import com.utsmm.kbz.util.tms.TMSUtil;
|
||||||
|
import com.utsmyanmar.baselib.network.model.e_receipt.EReceiptRequest;
|
||||||
|
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||||
|
import com.utsmyanmar.paylibs.model.SettleData;
|
||||||
|
import com.utsmyanmar.paylibs.system.BaseErrorCode;
|
||||||
|
import com.utsmyanmar.paylibs.utils.POSUtil;
|
||||||
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
|
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
|
public class EReceiptUtil {
|
||||||
|
|
||||||
|
private static EReceiptUtil instance;
|
||||||
|
|
||||||
|
|
||||||
|
public static EReceiptUtil getInstance(){
|
||||||
|
|
||||||
|
instance = new EReceiptUtil();
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String terminalId;
|
||||||
|
private String merchantId;
|
||||||
|
private String traceNo;
|
||||||
|
private String invoiceNo;
|
||||||
|
private String serialNum;
|
||||||
|
private String batchNumber;
|
||||||
|
|
||||||
|
private String packageName;
|
||||||
|
private String qrTerminalId;
|
||||||
|
private String qrMerchantId;
|
||||||
|
private EReceiptUtil(){
|
||||||
|
terminalId = SystemParamsOperation.getInstance().getTerminalId();
|
||||||
|
merchantId = SystemParamsOperation.getInstance().getMerchantId();
|
||||||
|
traceNo = SystemParamsOperation.getInstance().getCurrentSerialNum();
|
||||||
|
invoiceNo = SystemParamsOperation.getInstance().getCurrentInvoiceNum();
|
||||||
|
batchNumber = SystemParamsOperation.getInstance().getCurrentBatchNum();
|
||||||
|
serialNum = TMSUtil.getInstance().getSerialNumber();
|
||||||
|
packageName = BuildConfig.APPLICATION_ID;
|
||||||
|
qrTerminalId = SystemParamsOperation.getInstance().getSecHostTerminalId();
|
||||||
|
qrMerchantId = SystemParamsOperation.getInstance().getSecHostMerchantId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public EReceiptRequest generateQRReceipt(PayDetail payDetail, TransResultStatus status) {
|
||||||
|
|
||||||
|
double realAmount = payDetail.getAmount() / 100.0;
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
String amount = df.format(realAmount);
|
||||||
|
|
||||||
|
String currentTimeStamp = new java.text.SimpleDateFormat("MMddHHmmss", java.util.Locale.getDefault())
|
||||||
|
.format(new java.util.Date());
|
||||||
|
EReceiptRequest request = new EReceiptRequest();
|
||||||
|
request.setDE3("QR");
|
||||||
|
|
||||||
|
request.setDE7(currentTimeStamp);
|
||||||
|
request.setDE37(payDetail.getReferNo());
|
||||||
|
|
||||||
|
request.setDE49("MMK");
|
||||||
|
request.setSerial(serialNum);
|
||||||
|
request.setAppId(packageName);
|
||||||
|
request.setDE41(qrTerminalId);
|
||||||
|
request.setDE42(qrMerchantId);
|
||||||
|
request.setInvoiceNumber(payDetail.getInvoiceNo());
|
||||||
|
request.setDE11(payDetail.getVoucherNo());
|
||||||
|
|
||||||
|
// need to add payment identifier field too
|
||||||
|
|
||||||
|
if(status == TransResultStatus.SUCCESS) {
|
||||||
|
request.setDE4(amount);
|
||||||
|
request.setDescription("qr pay success");
|
||||||
|
request.setDE39("A");
|
||||||
|
} else if(status == TransResultStatus.TIME_OUT) {
|
||||||
|
request.setDE4("0");
|
||||||
|
request.setDescription("qr timeout");
|
||||||
|
request.setDE39("D");
|
||||||
|
} else if(status == TransResultStatus.FAIL) {
|
||||||
|
request.setDE4("0");
|
||||||
|
request.setDescription("qr failed");
|
||||||
|
request.setDE39("E");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EReceiptRequest generateQRRefundReceipt(PayDetail payDetail, TransResultStatus status) {
|
||||||
|
|
||||||
|
double realAmount = payDetail.getAmount() / 100.0;
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
String amount = df.format(realAmount);
|
||||||
|
|
||||||
|
String currentTimeStamp = new java.text.SimpleDateFormat("MMddHHmmss", java.util.Locale.getDefault())
|
||||||
|
.format(new java.util.Date());
|
||||||
|
EReceiptRequest request = new EReceiptRequest();
|
||||||
|
request.setDE3("QRV");
|
||||||
|
|
||||||
|
request.setDE7(currentTimeStamp);
|
||||||
|
request.setDE37(payDetail.getReferNo());
|
||||||
|
|
||||||
|
request.setDE49("MMK");
|
||||||
|
request.setSerial(serialNum);
|
||||||
|
request.setAppId(packageName);
|
||||||
|
request.setDE41(qrTerminalId);
|
||||||
|
request.setDE42(qrMerchantId);
|
||||||
|
request.setInvoiceNumber(payDetail.getInvoiceNo());
|
||||||
|
request.setDE11(payDetail.getVoucherNo());
|
||||||
|
|
||||||
|
// need to add payment identifier field too
|
||||||
|
|
||||||
|
if(status == TransResultStatus.SUCCESS) {
|
||||||
|
request.setDE4(amount);
|
||||||
|
request.setDescription("qr refund success");
|
||||||
|
request.setDE39("A");
|
||||||
|
} else if(status == TransResultStatus.TIME_OUT) {
|
||||||
|
request.setDE4("0");
|
||||||
|
request.setDescription("qr refund timeout");
|
||||||
|
request.setDE39("D");
|
||||||
|
} else if(status == TransResultStatus.FAIL) {
|
||||||
|
request.setDE4("0");
|
||||||
|
request.setDescription("qr refund failed");
|
||||||
|
request.setDE39("E");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EReceiptRequest generateMPUReceipt(PayDetail payDetail) {
|
||||||
|
|
||||||
|
double realAmount = payDetail.getAmount() / 100.0;
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
String amount = df.format(realAmount);
|
||||||
|
|
||||||
|
String currentTimeStamp = new java.text.SimpleDateFormat("MMddHHmmss", java.util.Locale.getDefault())
|
||||||
|
.format(new java.util.Date());
|
||||||
|
EReceiptRequest request = new EReceiptRequest();
|
||||||
|
|
||||||
|
request.setDE3(convertTransactionType(payDetail.getTransactionType()));
|
||||||
|
request.setDE7(currentTimeStamp);
|
||||||
|
request.setDE11(payDetail.getVoucherNo());
|
||||||
|
|
||||||
|
if(payDetail.getTransactionType() == TransactionsType.SETTLEMENT.value) {
|
||||||
|
SettleData settleData = payDetail.getSettleDataObj();
|
||||||
|
|
||||||
|
long totalAmt = settleData.getSaleAmount() + settleData.getRefundAmount() + settleData.getPreAuthCompAmount() + settleData.getCashAdvanceAmount();
|
||||||
|
double realTotalAmount = totalAmt / 100.0;
|
||||||
|
String totalAmount = df.format(realTotalAmount);
|
||||||
|
request.setDE4(totalAmount);
|
||||||
|
|
||||||
|
|
||||||
|
request.setDE63_01(settleData.getSaleCount()+"");
|
||||||
|
request.setDE63_02(settleData.getSaleAmount()+"");
|
||||||
|
request.setDE63_03(settleData.getRefundCount()+"");
|
||||||
|
request.setDE63_04(settleData.getRefundAmount()+"");
|
||||||
|
request.setDE63_05(settleData.getPreAuthCompCount()+"");
|
||||||
|
request.setDE63_06(settleData.getPreAuthCompAmount()+"");
|
||||||
|
request.setDE63_07(settleData.getCashAdvanceCount()+"");
|
||||||
|
request.setDE63_08(settleData.getCashAdvanceAmount()+"");
|
||||||
|
invoiceNo = SystemParamsOperation.getInstance().getIncrementInvoiceNum();
|
||||||
|
request.setBatchNumber(batchNumber);
|
||||||
|
request.setInvoiceNumber(invoiceNo);
|
||||||
|
request.setDescription("success");
|
||||||
|
request.setDE39("A");
|
||||||
|
request.setDE37("0000");
|
||||||
|
request.setDE49("MMK");
|
||||||
|
} else {
|
||||||
|
request.setDE2(POSUtil.getInstance().getCardNumMasking(payDetail.getCardNo()));
|
||||||
|
|
||||||
|
request.setDE4(amount);
|
||||||
|
|
||||||
|
|
||||||
|
request.setDE37(payDetail.getReferNo());
|
||||||
|
request.setDE38(payDetail.getApprovalCode());
|
||||||
|
// will check it later for currency code
|
||||||
|
request.setDE49("MMK");
|
||||||
|
request.setInvoiceNumber(payDetail.getInvoiceNo());
|
||||||
|
request.setCardLabel("MPU");
|
||||||
|
|
||||||
|
if(payDetail.getTradeAnswerCode().equals("000") || payDetail.getTradeAnswerCode().equals("00") ) {
|
||||||
|
|
||||||
|
request.setDescription("success");
|
||||||
|
request.setDE39("A");
|
||||||
|
} else {
|
||||||
|
request.setDescription(BaseErrorCode.getErrorMessage(payDetail.getTradeAnswerCode()));
|
||||||
|
request.setDE39("E");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
request.setDE41(terminalId);
|
||||||
|
request.setDE42(merchantId);
|
||||||
|
|
||||||
|
request.setSerial(serialNum);
|
||||||
|
request.setAppId(packageName);
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String convertTransactionType(int transactionType) {
|
||||||
|
if(transactionType == TransactionsType.SALE.value) {
|
||||||
|
return "S";
|
||||||
|
} else if(transactionType == TransactionsType.VOID.value) {
|
||||||
|
return "V";
|
||||||
|
} else if(transactionType == TransactionsType.PRE_AUTH_SALE.value) {
|
||||||
|
return "P";
|
||||||
|
} else if(transactionType == TransactionsType.PRE_AUTH_VOID.value) {
|
||||||
|
return "PV";
|
||||||
|
} else if(transactionType == TransactionsType.PRE_AUTH_COMPLETE.value) {
|
||||||
|
return "PC";
|
||||||
|
} else if(transactionType == TransactionsType.PRE_AUTH_COMPLETE_VOID.value) {
|
||||||
|
return "PCV";
|
||||||
|
} else if(transactionType == TransactionsType.CASH_OUT.value) {
|
||||||
|
return "CAV";
|
||||||
|
} else if(transactionType == TransactionsType.REFUND.value) {
|
||||||
|
return "R";
|
||||||
|
} else if(transactionType == TransactionsType.SETTLEMENT.value) {
|
||||||
|
return "ST";
|
||||||
|
} else if(transactionType == TransactionsType.MMQR_SETTLEMENT.value) {
|
||||||
|
return "ST";
|
||||||
|
}
|
||||||
|
return "E";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1,6 +1,7 @@
|
|||||||
package com.utsmm.kbz.util;
|
package com.utsmm.kbz.util;
|
||||||
|
|
||||||
import com.sunmi.pay.hardware.aidlv2.AidlConstantsV2;
|
import com.sunmi.pay.hardware.aidlv2.AidlConstantsV2;
|
||||||
|
import com.utsmyanmar.checkxread.model.CardDataX;
|
||||||
import com.utsmyanmar.paylibs.model.CardInfo;
|
import com.utsmyanmar.paylibs.model.CardInfo;
|
||||||
import com.utsmyanmar.paylibs.model.ICCardInfo;
|
import com.utsmyanmar.paylibs.model.ICCardInfo;
|
||||||
import com.utsmyanmar.paylibs.model.MAGCardInfo;
|
import com.utsmyanmar.paylibs.model.MAGCardInfo;
|
||||||
@ -42,15 +43,42 @@ public class MockData {
|
|||||||
// .cardScheme("VISA")
|
// .cardScheme("VISA")
|
||||||
// .cardHolderName("U AYE")
|
// .cardHolderName("U AYE")
|
||||||
// .iccData("5F21BLAHBLAH")
|
// .iccData("5F21BLAHBLAH")
|
||||||
|
// .build();
|
||||||
|
|
||||||
|
// mockCardData = new MockCardData.Builder()
|
||||||
|
// .cardNo("9503051034047056")
|
||||||
|
// .expDate("3002")
|
||||||
|
// .cardScheme("MPU")
|
||||||
|
// .cardHolderName("KBZ Debit")
|
||||||
|
// .iccData("9503051034047056=30021015930000000000")
|
||||||
// .build();
|
// .build();
|
||||||
|
|
||||||
mockCardData = new MockCardData.Builder()
|
mockCardData = new MockCardData.Builder()
|
||||||
.cardNo("9503190006079422")
|
.cardNo("9505050161133125")
|
||||||
.expDate("0725")
|
.expDate("2701")
|
||||||
.cardScheme("MPU")
|
.cardScheme("MPU")
|
||||||
.cardHolderName("YOMA VALUED CUSTOMER")
|
.cardHolderName("KBZ Credit")
|
||||||
|
.iccData("9505050161133125=27011017250000000000")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// mockCardData = new MockCardData.Builder()
|
||||||
|
// .cardNo("9503712156912514")
|
||||||
|
// .expDate("2912")
|
||||||
|
// .cardScheme("MPU")
|
||||||
|
// .cardHolderName("Htin Kyaw Win")
|
||||||
|
// .iccData("9503712156912514=29121010000000000000")
|
||||||
|
// .build();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// mockCardData = new MockCardData.Builder()
|
||||||
|
// .cardNo("9503742975107251")
|
||||||
|
// .expDate("0629")
|
||||||
|
// .cardScheme("MPU")
|
||||||
|
// .cardHolderName("Bank Q")
|
||||||
|
// .iccData("9503742975107251=22081010000000000000")
|
||||||
|
// .build();
|
||||||
|
|
||||||
// mockCardData = new MockCardData.Builder()
|
// mockCardData = new MockCardData.Builder()
|
||||||
// .phoneNo("9794452506")
|
// .phoneNo("9794452506")
|
||||||
// .expDate("0425")
|
// .expDate("0425")
|
||||||
@ -74,6 +102,15 @@ public class MockData {
|
|||||||
return String.valueOf(randomNumber);
|
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) {
|
public TradeData generateMockDataWithTime(TransactionsType transType,int cardInputType,String transDate,String transTime) {
|
||||||
String strDate = SystemDateTime.getMMDD();
|
String strDate = SystemDateTime.getMMDD();
|
||||||
String strTime = SystemDateTime.getHHmmss();
|
String strTime = SystemDateTime.getHHmmss();
|
||||||
|
|||||||
@ -21,5 +21,6 @@ public enum FeaturesType {
|
|||||||
TEST,
|
TEST,
|
||||||
QR_INQUIRY,
|
QR_INQUIRY,
|
||||||
QR_REFUND,
|
QR_REFUND,
|
||||||
LOG_OUT
|
LOG_OUT,
|
||||||
|
DEVICE_CONFIG
|
||||||
}
|
}
|
||||||
@ -26,6 +26,7 @@ public enum TransResultStatus {
|
|||||||
RETRY_AGAIN,
|
RETRY_AGAIN,
|
||||||
NEXT_SCREEN,
|
NEXT_SCREEN,
|
||||||
EMPTY_PIN,
|
EMPTY_PIN,
|
||||||
NETWORK_ERROR
|
NETWORK_ERROR,
|
||||||
|
TIME_OUT
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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.SiriusProperty;
|
||||||
import com.utsmyanmar.baselib.network.model.sirius.SiriusResponse;
|
import com.utsmyanmar.baselib.network.model.sirius.SiriusResponse;
|
||||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
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.utsmyanmar.paylibs.utils.enums.CurrencyType;
|
||||||
|
|
||||||
import com.utsmm.kbz.BuildConfig;
|
import com.utsmm.kbz.BuildConfig;
|
||||||
@ -170,7 +171,7 @@ public class TMSSetupsImpl implements TMSSetups{
|
|||||||
|
|
||||||
for (SiriusHost siriusHost: siriusHosts) {
|
for (SiriusHost siriusHost: siriusHosts) {
|
||||||
|
|
||||||
if( siriusHost.getName().toLowerCase().contains("mmqr") || siriusHost.getName().toLowerCase().contains("kbzpay") || siriusHost.getDescription().toLowerCase().contains("mmqr") || siriusHost.getDescription().toLowerCase().contains("qr")) {
|
if( siriusHost.getName().toLowerCase().contains("mmqr") || siriusHost.getName().toLowerCase().contains("kbzpay") || siriusHost.getName().toLowerCase().contains("mmqr") || siriusHost.getName().toLowerCase().contains("qr")) {
|
||||||
|
|
||||||
SystemParamsOperation.getInstance().setSecHostName(siriusHost.getName());
|
SystemParamsOperation.getInstance().setSecHostName(siriusHost.getName());
|
||||||
SystemParamsOperation.getInstance().setSecHostTerminalId(siriusHost.getTid());
|
SystemParamsOperation.getInstance().setSecHostTerminalId(siriusHost.getTid());
|
||||||
@ -236,15 +237,21 @@ public class TMSSetupsImpl implements TMSSetups{
|
|||||||
} else if(siriusHost.getPrimaryIP().trim().isEmpty()) {
|
} else if(siriusHost.getPrimaryIP().trim().isEmpty()) {
|
||||||
SystemParamsOperation.getInstance().setIpAddress("");
|
SystemParamsOperation.getInstance().setIpAddress("");
|
||||||
}
|
}
|
||||||
|
String secondaryIp = siriusHost.getSecondaryIP();
|
||||||
if (siriusHost.getSecondaryIP().contains(":")) {
|
if(secondaryIp == null || secondaryIp.trim().isEmpty()){
|
||||||
|
|
||||||
SystemParamsOperation.getInstance().setSecIpAddress(siriusHost.getSecondaryIP().trim());
|
|
||||||
|
|
||||||
} else if(siriusHost.getSecondaryIP().trim().isEmpty()){
|
|
||||||
SystemParamsOperation.getInstance().setSecIpAddress("");
|
SystemParamsOperation.getInstance().setSecIpAddress("");
|
||||||
|
}else if(secondaryIp.contains(":")){
|
||||||
|
SystemParamsOperation.getInstance().setSecIpAddress(secondaryIp.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (siriusHost.getSecondaryIP().contains(":")) {
|
||||||
|
//
|
||||||
|
// SystemParamsOperation.getInstance().setSecIpAddress(siriusHost.getSecondaryIP().trim());
|
||||||
|
//
|
||||||
|
// } else if(siriusHost.getSecondaryIP().trim().isEmpty()){
|
||||||
|
// SystemParamsOperation.getInstance().setSecIpAddress("");
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
if (!siriusHost.getCurrency().isEmpty()) {
|
if (!siriusHost.getCurrency().isEmpty()) {
|
||||||
SystemParamsOperation.getInstance().setCurrencyType(currencyTextToCurrencyType(siriusHost.getCurrency()));
|
SystemParamsOperation.getInstance().setCurrencyType(currencyTextToCurrencyType(siriusHost.getCurrency()));
|
||||||
@ -412,15 +419,20 @@ public class TMSSetupsImpl implements TMSSetups{
|
|||||||
} else if (TextUtils.equals(name,"ssl_enable")) {
|
} else if (TextUtils.equals(name,"ssl_enable")) {
|
||||||
|
|
||||||
SystemParamsOperation.getInstance().setSslSwitchStatus(parseBoolean(data));
|
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")) {
|
} else if (TextUtils.equals(name,"tips_adjustment_enable")) {
|
||||||
|
|
||||||
SystemParamsOperation.getInstance().setTipsAdjustmentStatus(parseBoolean(data));
|
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, "qr_partial_refund_enable")){
|
||||||
|
SystemParamsOperation.getInstance().setQrPartialRefundEnable(parseBoolean(data));
|
||||||
|
} else if(TextUtils.equals(name, "mmqr_interval_waiting_time")){
|
||||||
|
|
||||||
|
SystemParamsOperation.getInstance().setWaveIntervalTime(data);
|
||||||
} else if (TextUtils.equals(name,"print_iso_enable")) {
|
} else if (TextUtils.equals(name,"print_iso_enable")) {
|
||||||
|
|
||||||
SystemParamsOperation.getInstance().setPrintISOStatus(parseBoolean(data));
|
SystemParamsOperation.getInstance().setPrintISOStatus(parseBoolean(data));
|
||||||
@ -582,13 +594,21 @@ public class TMSSetupsImpl implements TMSSetups{
|
|||||||
}
|
}
|
||||||
} else if (TextUtils.equals(name,"speedup_contactless_enable")) {
|
} else if (TextUtils.equals(name,"speedup_contactless_enable")) {
|
||||||
SystemParamsOperation.getInstance().setSpeedUpContactless(parseBoolean(data));
|
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));
|
SystemParamsOperation.getInstance().setManualEntryPinEnable(parseBoolean(data));
|
||||||
} else if (TextUtils.equals(name,"decimal_enable")) {
|
} else if (TextUtils.equals(name,"decimal_enable")) {
|
||||||
SystemParamsOperation.getInstance().setDecimalEnable(parseBoolean(data));
|
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);
|
||||||
|
}else if (TextUtils.equals(name, "qr_decimal_enable")) {
|
||||||
|
SystemParamsOperation.getInstance().setQrDecimalEnable(parseBoolean(data));
|
||||||
|
} else if (TextUtils.equals(name, "qr_refund_enable")){
|
||||||
|
SystemParamsOperation.getInstance().setQrRefundEnable(parseBoolean(data));
|
||||||
|
} else if (TextUtils.equals(name, "tpdu_value")){
|
||||||
|
SystemParamsOperation.getInstance().setTpduValue(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemParamsOperation.getInstance().setCarouselUrls(convertToString(imgUrls));
|
SystemParamsOperation.getInstance().setCarouselUrls(convertToString(imgUrls));
|
||||||
@ -683,8 +703,8 @@ public class TMSSetupsImpl implements TMSSetups{
|
|||||||
int value = Integer.parseInt(data);
|
int value = Integer.parseInt(data);
|
||||||
return value == 1;
|
return value == 1;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
return false;
|
return Boolean.parseBoolean(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,7 +147,8 @@ public class TMSUtil {
|
|||||||
siriusRequest.setApplicationVersion(BuildConfig.VERSION_NAME);
|
siriusRequest.setApplicationVersion(BuildConfig.VERSION_NAME);
|
||||||
siriusRequest.setCurrentNetwork(getNetworkType(context));
|
siriusRequest.setCurrentNetwork(getNetworkType(context));
|
||||||
siriusRequest.setLastTransaction(lastTransName);
|
siriusRequest.setLastTransaction(lastTransName);
|
||||||
siriusRequest.setLastTranTime(lastTransTime);
|
siriusRequest.setLastTranTime(Long.parseLong(lastTransTime));
|
||||||
|
siriusRequest.setValue("YourValueHere");
|
||||||
|
|
||||||
return siriusRequest;
|
return siriusRequest;
|
||||||
}
|
}
|
||||||
@ -176,7 +177,6 @@ public class TMSUtil {
|
|||||||
LogUtil.d(TAG,"Receipt Footer: "+SystemParamsOperation.getInstance().getReceiptFooter());
|
LogUtil.d(TAG,"Receipt Footer: "+SystemParamsOperation.getInstance().getReceiptFooter());
|
||||||
LogUtil.d(TAG,"Manual Update: "+SystemParamsOperation.getInstance().getManualUpdate());
|
LogUtil.d(TAG,"Manual Update: "+SystemParamsOperation.getInstance().getManualUpdate());
|
||||||
LogUtil.d(TAG,"Master Enabled: "+SystemParamsOperation.getInstance().isEmvEnabled());
|
LogUtil.d(TAG,"Master Enabled: "+SystemParamsOperation.getInstance().isEmvEnabled());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -206,21 +206,20 @@ public class TMSUtil {
|
|||||||
voidStatus = SystemParamsOperation.getInstance().getVoidStatus();
|
voidStatus = SystemParamsOperation.getInstance().getVoidStatus();
|
||||||
cashAdvanceStatus = SystemParamsOperation.getInstance().getCashAdvanceStatus();
|
cashAdvanceStatus = SystemParamsOperation.getInstance().getCashAdvanceStatus();
|
||||||
refundStatus = SystemParamsOperation.getInstance().getRefundStatus();
|
refundStatus = SystemParamsOperation.getInstance().getRefundStatus();
|
||||||
wavePayInquiryStatus = SystemParamsOperation.getInstance().getWavePayInquiryStatus();
|
wavePayInquiryStatus = SystemParamsOperation.getInstance().getQRPayInquiryStatus();
|
||||||
tipAdjustmentStatus = SystemParamsOperation.getInstance().getTipsAdjustmentStatus();
|
tipAdjustmentStatus = SystemParamsOperation.getInstance().getTipsAdjustmentStatus();
|
||||||
settlementStatus = SystemParamsOperation.getInstance().getSettlementStatus();
|
settlementStatus = SystemParamsOperation.getInstance().getSettlementStatus();
|
||||||
|
|
||||||
featuresList.add(new Features(2, fragmentActivity.getString(R.string.menu_sale_void), R.drawable.ic_void_dash, FeaturesType.VOID, voidStatus));
|
featuresList.add(new Features(2, fragmentActivity.getString(R.string.menu_sale_void), R.drawable.ic_void_dash, FeaturesType.VOID, voidStatus));
|
||||||
featuresList.add(new Features(2, fragmentActivity.getString(R.string.menu_settlement), R.drawable.ic_settlement, FeaturesType.SETTLEMENT, settlementStatus));
|
// featuresList.add(new Features(2, fragmentActivity.getString(R.string.menu_settlement), R.drawable.ic_settlement, FeaturesType.SETTLEMENT, settlementStatus));
|
||||||
featuresList.add(new Features(4, fragmentActivity.getString(R.string.menu_refund), R.drawable.ic_refund, FeaturesType.REFUND, refundStatus));
|
featuresList.add(new Features(4, fragmentActivity.getString(R.string.menu_refund), R.drawable.ic_refund, FeaturesType.REFUND, refundStatus));
|
||||||
featuresList.add(new Features(3, fragmentActivity.getString(R.string.menu_preauth), R.drawable.ic_pre_auth_dash, FeaturesType.PRE_AUTH_SALE, preAuthStatus));
|
featuresList.add(new Features(3, fragmentActivity.getString(R.string.menu_preauth), R.drawable.ic_pre_auth_dash, FeaturesType.PRE_AUTH_SALE, preAuthStatus));
|
||||||
featuresList.add(new Features(6, fragmentActivity.getString(R.string.menu_preauth_cancellation), R.drawable.ic_pre_auth_dash, FeaturesType.PRE_AUTH_VOID, preAuthCancelStatus));
|
featuresList.add(new Features(6, fragmentActivity.getString(R.string.menu_preauth_cancellation), R.drawable.ic_pre_auth_dash, FeaturesType.PRE_AUTH_VOID, preAuthCancelStatus));
|
||||||
featuresList.add(new Features(6, fragmentActivity.getString(R.string.menu_preauth_completion), R.drawable.ic_pre_auth_dash, FeaturesType.PRE_AUTH_COMPLETE, preAuthCompleteStatus));
|
featuresList.add(new Features(6, fragmentActivity.getString(R.string.menu_preauth_completion), R.drawable.ic_pre_auth_dash, FeaturesType.PRE_AUTH_COMPLETE, preAuthCompleteStatus));
|
||||||
featuresList.add(new Features(6, fragmentActivity.getString(R.string.menu_preauth_comp_cancellation), R.drawable.ic_pre_auth_dash, FeaturesType.PRE_AUTH_COMPLETE_VOID, preAuthCompleteCancelStatus));
|
|
||||||
// featuresList.add(new Features(5, fragmentActivity.getString(R.string.menu_wavepay_inquiry), R.drawable.ic_wave_status_dash, FeaturesType.WAVE_PAY_INQUIRY, wavePayInquiryStatus));
|
// featuresList.add(new Features(5, fragmentActivity.getString(R.string.menu_wavepay_inquiry), R.drawable.ic_wave_status_dash, FeaturesType.WAVE_PAY_INQUIRY, wavePayInquiryStatus));
|
||||||
featuresList.add(new Features(1, fragmentActivity.getString(R.string.menu_cash_advance), R.drawable.ic_cash_advance, FeaturesType.CASH_ADVANCE, cashAdvanceStatus));
|
featuresList.add(new Features(1, fragmentActivity.getString(R.string.menu_cash_advance), R.drawable.ic_cash_advance, FeaturesType.CASH_ADVANCE, cashAdvanceStatus));
|
||||||
featuresList.add(new Features(9, fragmentActivity.getString(R.string.menu_history), R.drawable.ic_history, FeaturesType.HISTORY, true));
|
featuresList.add(new Features(9, fragmentActivity.getString(R.string.menu_history), R.drawable.ic_history, FeaturesType.HISTORY, true));
|
||||||
|
featuresList.add(new Features(10, "Configs", R.drawable.ic_host, FeaturesType.DEVICE_CONFIG, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public TMSValidity checkParams() {
|
public TMSValidity checkParams() {
|
||||||
@ -232,17 +231,19 @@ public class TMSUtil {
|
|||||||
String secHostIp = SystemParamsOperation.getInstance().getSecIpAddress();
|
String secHostIp = SystemParamsOperation.getInstance().getSecIpAddress();
|
||||||
String keyIndex = SystemParamsOperation.getInstance().getTMKIndex();
|
String keyIndex = SystemParamsOperation.getInstance().getTMKIndex();
|
||||||
|
|
||||||
if(tid.length() == 8 && mid.length() == 15 && !hostIp.isEmpty() && !secHostIp.isEmpty() && !keyIndex.isEmpty()) {
|
if(tid.length() == 8 && (mid.length() == 11 || mid.length() == 15) && !hostIp.isEmpty() && !keyIndex.isEmpty()) {
|
||||||
tmsValidity = new TMSValidity(ValidityStatus.SUCCESS,"Success");
|
tmsValidity = new TMSValidity(ValidityStatus.SUCCESS,"Success");
|
||||||
} else if(tid.length() != 8) {
|
} else if(tid.length() != 8) {
|
||||||
tmsValidity = new TMSValidity(ValidityStatus.FAILURE,"Tid is invalid!");
|
tmsValidity = new TMSValidity(ValidityStatus.FAILURE,"Tid is invalid!");
|
||||||
} else if(mid.length() != 15) {
|
} else if(mid.length() != 15 && mid.length() != 11 ) {
|
||||||
tmsValidity = new TMSValidity(ValidityStatus.FAILURE,"Mid is invalid!");
|
tmsValidity = new TMSValidity(ValidityStatus.FAILURE,"Mid is invalid!");
|
||||||
} else if(hostIp.isEmpty()) {
|
} else if(hostIp.isEmpty()) {
|
||||||
tmsValidity = new TMSValidity(ValidityStatus.FAILURE,"Pri-Ip is invalid!");
|
tmsValidity = new TMSValidity(ValidityStatus.FAILURE,"Pri-Ip is invalid!");
|
||||||
} else if(secHostIp.isEmpty()) {
|
}
|
||||||
tmsValidity = new TMSValidity(ValidityStatus.FAILURE,"Sec-Ip is invalid!");
|
// else if(secHostIp.isEmpty()) {
|
||||||
} else {
|
// tmsValidity = new TMSValidity(ValidityStatus.FAILURE,"Sec-Ip is invalid!");
|
||||||
|
// }
|
||||||
|
else {
|
||||||
tmsValidity = new TMSValidity(ValidityStatus.FAILURE,"KeyIndex is invalid!");
|
tmsValidity = new TMSValidity(ValidityStatus.FAILURE,"KeyIndex is invalid!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
22
app/src/main/res/drawable/btn_bottom_left.xml
Normal file
22
app/src/main/res/drawable/btn_bottom_left.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="200dp"
|
||||||
|
android:height="200dp"
|
||||||
|
android:viewportWidth="200"
|
||||||
|
android:viewportHeight="200">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/colorPrimary"
|
||||||
|
android:strokeColor="@color/colorPrimary"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:pathData="
|
||||||
|
M 24 0
|
||||||
|
H 140
|
||||||
|
A 60 60 0 0 0 200 60
|
||||||
|
V 176
|
||||||
|
Q 200 200 176 200
|
||||||
|
H 24
|
||||||
|
Q 0 200 0 176
|
||||||
|
V 24
|
||||||
|
Q 0 0 24 0
|
||||||
|
Z" />
|
||||||
|
</vector>
|
||||||
23
app/src/main/res/drawable/btn_bottom_right.xml
Normal file
23
app/src/main/res/drawable/btn_bottom_right.xml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="200dp"
|
||||||
|
android:height="200dp"
|
||||||
|
android:viewportWidth="200"
|
||||||
|
android:viewportHeight="200">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/colorPrimary"
|
||||||
|
android:strokeColor="@color/colorPrimary"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:pathData="
|
||||||
|
M 60 0
|
||||||
|
H 176
|
||||||
|
Q 200 0 200 24
|
||||||
|
V 176
|
||||||
|
Q 200 200 176 200
|
||||||
|
H 24
|
||||||
|
Q 0 200 0 176
|
||||||
|
V 60
|
||||||
|
A 60 60 0 0 1 60 0
|
||||||
|
Z" />
|
||||||
|
</vector>
|
||||||
23
app/src/main/res/drawable/btn_top_left.xml
Normal file
23
app/src/main/res/drawable/btn_top_left.xml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="200dp"
|
||||||
|
android:height="200dp"
|
||||||
|
android:viewportWidth="200"
|
||||||
|
android:viewportHeight="200">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/colorPrimary"
|
||||||
|
android:strokeColor="@color/colorPrimary"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:pathData="
|
||||||
|
M 24 0
|
||||||
|
H 176
|
||||||
|
Q 200 0 200 24
|
||||||
|
V 176
|
||||||
|
Q 200 200 176 200
|
||||||
|
H 60
|
||||||
|
A 60 60 0 0 0 0 140
|
||||||
|
V 24
|
||||||
|
Q 0 0 24 0
|
||||||
|
Z" />
|
||||||
|
</vector>
|
||||||
22
app/src/main/res/drawable/btn_top_right.xml
Normal file
22
app/src/main/res/drawable/btn_top_right.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="200dp"
|
||||||
|
android:height="200dp"
|
||||||
|
android:viewportWidth="200"
|
||||||
|
android:viewportHeight="200">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/colorPrimary"
|
||||||
|
android:strokeColor="@color/colorPrimary"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:pathData="
|
||||||
|
M 24 0
|
||||||
|
H 176
|
||||||
|
Q 200 0 200 24
|
||||||
|
V 140
|
||||||
|
A 60 60 0 0 0 140 200
|
||||||
|
H 24
|
||||||
|
Q 0 200 0 176
|
||||||
|
V 24
|
||||||
|
Q 0 0 24 0
|
||||||
|
Z" />
|
||||||
|
</vector>
|
||||||
28
app/src/main/res/drawable/honey.xml
Normal file
28
app/src/main/res/drawable/honey.xml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="200dp"
|
||||||
|
android:height="200dp"
|
||||||
|
android:viewportWidth="100"
|
||||||
|
android:viewportHeight="100">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/white"
|
||||||
|
android:strokeColor="@color/white"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:pathData="
|
||||||
|
M55.1858,3.015
|
||||||
|
L87.8142,21.985
|
||||||
|
Q93,25 93,31
|
||||||
|
L93,69
|
||||||
|
Q93,75 87.8142,78.015
|
||||||
|
L55.1858,96.985
|
||||||
|
Q50,100 44.8142,96.985
|
||||||
|
L12.1858,78.015
|
||||||
|
Q7,75 7,69
|
||||||
|
L7,31
|
||||||
|
Q7,25 12.1858,21.985
|
||||||
|
L44.8142,3.015
|
||||||
|
Q50,0 55.1858,3.015
|
||||||
|
Z" />
|
||||||
|
</vector>
|
||||||
35
app/src/main/res/drawable/ic_dash_report.xml
Normal file
35
app/src/main/res/drawable/ic_dash_report.xml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="422.074"
|
||||||
|
android:viewportHeight="422.073">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M229.001,392.729H44.522V27.274h198.907V82.69c0,5.6,4.534,10.133,10.131,10.133h53.791l0.009,181.564c9.418,0.215,18.602,1.963,27.266,5.188V77.743c0,-2.168,-0.863,-4.248,-2.396,-5.787L262.667,2.395C261.133,0.862,259.053,0,256.881,0H41.796C28.262,0,17.25,11.008,17.25,24.543v370.915c0,13.533,11.012,24.543,24.547,24.543h206.973C240.466,412.384,233.714,403.114,229.001,392.729z"/>
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M404.824,311.648c0,-4.586,-1.785,-8.896,-5.027,-12.142l-12.844,-12.844c-3.244,-3.242,-7.555,-5.027,-12.139,-5.027c-4.582,0,-8.896,1.785,-12.141,5.029l-19.602,19.6c-10.47,-7.506,-23.304,-11.928,-37.168,-11.928c-35.273,0,-63.867,28.596,-63.867,63.869c0,35.271,28.594,63.867,63.867,63.867c35.271,0,63.867,-28.597,63.867,-63.867c0,-1.43,-0.051,-2.848,-0.145,-4.254l30.166,-30.166C403.039,320.546,404.824,316.232,404.824,311.648z M385.857,315.467l-61.43,61.428c-1.295,1.296,-3.051,2.021,-4.881,2.021h-0.002c-1.832,0,-3.588,-0.729,-4.881,-2.023l-28.465,-28.51c-2.691,-2.693,-2.689,-7.062,0.002,-9.758l5.483,-5.479c2.69,-2.693,7.058,-2.695,9.755,-0.007l18.104,18.058l51.019,-51.021c1.296,-1.296,3.052,-2.021,4.882,-2.021s3.586,0.727,4.881,2.021l5.531,5.53C388.552,308.4,388.552,312.77,385.857,315.467z"/>
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M188.141,108.951l-57.438,13.148l13.149,-57.438c-20.125,-5.047,-42.319,0.296,-58.059,16.035c-23.835,23.834,-23.835,62.478,0,86.312c23.835,23.835,62.478,23.835,86.313,0C187.843,151.269,193.187,129.075,188.141,108.951z"/>
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M188.689,64.113c-8.097,-8.096,-17.901,-13.439,-28.254,-16.035l-13.149,57.437l57.438,-13.149C202.128,82.014,196.785,72.209,188.689,64.113z"/>
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M89.161,249.945h20.993c5.813,0,10.542,-4.729,10.542,-10.543c0,-5.814,-4.729,-10.543,-10.542,-10.543H89.161c-5.813,0,-10.543,4.729,-10.543,10.543C78.618,245.216,83.348,249.945,89.161,249.945z"/>
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M170.153,267.859H89.161c-5.813,0,-10.543,4.729,-10.543,10.543c0,5.813,4.729,10.543,10.543,10.543h80.993c5.813,0,10.542,-4.729,10.542,-10.543C180.695,272.588,175.966,267.859,170.153,267.859z"/>
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M158.153,306.859H89.161c-5.813,0,-10.543,4.729,-10.543,10.543c0,5.813,4.729,10.543,10.543,10.543h68.993c5.813,0,10.542,-4.729,10.542,-10.543C168.695,311.588,163.966,306.859,158.153,306.859z"/>
|
||||||
|
</vector>
|
||||||
53
app/src/main/res/drawable/ic_dash_reports.xml
Normal file
53
app/src/main/res/drawable/ic_dash_reports.xml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="64"
|
||||||
|
android:viewportHeight="64">
|
||||||
|
|
||||||
|
<!-- Centering shift: moved whole document from x=6 to x=12 -->
|
||||||
|
<!-- Document outline -->
|
||||||
|
<path
|
||||||
|
android:pathData="M12,4 H52 V60 H12 Z"
|
||||||
|
android:fillColor="@android:color/transparent"
|
||||||
|
android:strokeColor="#FFFFFF"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeLineCap="round" />
|
||||||
|
|
||||||
|
<!-- Folded corner -->
|
||||||
|
<path
|
||||||
|
android:pathData="M52,4 V16 H42"
|
||||||
|
android:fillColor="@android:color/transparent"
|
||||||
|
android:strokeColor="#FFFFFF"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeLineCap="round" />
|
||||||
|
|
||||||
|
<!-- Bar chart (centered as well) -->
|
||||||
|
<path android:pathData="M20,34 H26 V50 H20 Z" android:fillColor="#FFFFFF"/>
|
||||||
|
<path android:pathData="M28,26 H34 V50 H28 Z" android:fillColor="#FFFFFF"/>
|
||||||
|
<path android:pathData="M36,30 H42 V50 H36 Z" android:fillColor="#FFFFFF"/>
|
||||||
|
|
||||||
|
<!-- Text lines -->
|
||||||
|
<path
|
||||||
|
android:pathData="M20,14 H44"
|
||||||
|
android:fillColor="@android:color/transparent"
|
||||||
|
android:strokeColor="#FFFFFF"
|
||||||
|
android:strokeWidth="1.6"
|
||||||
|
android:strokeLineCap="round" />
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:pathData="M20,18 H44"
|
||||||
|
android:fillColor="@android:color/transparent"
|
||||||
|
android:strokeColor="#FFFFFF"
|
||||||
|
android:strokeWidth="1.6"
|
||||||
|
android:strokeLineCap="round" />
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:pathData="M20,22 H32"
|
||||||
|
android:fillColor="@android:color/transparent"
|
||||||
|
android:strokeColor="#FFFFFF"
|
||||||
|
android:strokeWidth="1.6"
|
||||||
|
android:strokeLineCap="round" />
|
||||||
|
</vector>
|
||||||
11
app/src/main/res/drawable/ic_down_arrow.xml
Normal file
11
app/src/main/res/drawable/ic_down_arrow.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/colorPrimary"
|
||||||
|
android:pathData="M7.41,8.59L12,13.17l4.59,-4.58L18,10l-6,6 -6,-6z" />
|
||||||
|
</vector>
|
||||||
BIN
app/src/main/res/drawable/ic_mmqr.png
Normal file
BIN
app/src/main/res/drawable/ic_mmqr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
BIN
app/src/main/res/drawable/kbz_receipt_logo.png
Normal file
BIN
app/src/main/res/drawable/kbz_receipt_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
app/src/main/res/drawable/mmqr_logo.png
Normal file
BIN
app/src/main/res/drawable/mmqr_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
BIN
app/src/main/res/font/consolas_regular.ttf
Normal file
BIN
app/src/main/res/font/consolas_regular.ttf
Normal file
Binary file not shown.
@ -149,6 +149,7 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
app:cardCornerRadius="12dp"
|
app:cardCornerRadius="12dp"
|
||||||
app:cardElevation="2dp"
|
app:cardElevation="2dp"
|
||||||
|
android:onClick="@{()->click.onClickTap()}"
|
||||||
android:backgroundTint="#fff"
|
android:backgroundTint="#fff"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
|
|||||||
@ -65,6 +65,7 @@
|
|||||||
tools:fontFamily="sans-serif-medium" />
|
tools:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
<!-- System PIN Card -->
|
<!-- System PIN Card -->
|
||||||
|
<!-- android:onClick="@{()->click.onSystemPinClick()}"-->
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/systemPinCard"
|
android:id="@+id/systemPinCard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -72,7 +73,6 @@
|
|||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:onClick="@{()->click.onSystemPinClick()}"
|
|
||||||
app:cardBackgroundColor="@color/white"
|
app:cardBackgroundColor="@color/white"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardElevation="2dp">
|
app:cardElevation="2dp">
|
||||||
@ -141,6 +141,7 @@
|
|||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<!-- Settings PIN Card -->
|
<!-- Settings PIN Card -->
|
||||||
|
<!-- android:onClick="@{()->click.onSettingPinClick()}"-->
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/settingPinCard"
|
android:id="@+id/settingPinCard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -148,7 +149,6 @@
|
|||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:onClick="@{()->click.onSettingPinClick()}"
|
|
||||||
app:cardBackgroundColor="@color/white"
|
app:cardBackgroundColor="@color/white"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardElevation="2dp">
|
app:cardElevation="2dp">
|
||||||
@ -237,6 +237,7 @@
|
|||||||
tools:fontFamily="sans-serif-medium" />
|
tools:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
<!-- Primary Host IP Card -->
|
<!-- Primary Host IP Card -->
|
||||||
|
<!-- android:onClick="@{()->click.onHostIpClick()}"-->
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/hostIpCard"
|
android:id="@+id/hostIpCard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -244,7 +245,6 @@
|
|||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:onClick="@{()->click.onHostIpClick()}"
|
|
||||||
app:cardBackgroundColor="@color/white"
|
app:cardBackgroundColor="@color/white"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardElevation="2dp">
|
app:cardElevation="2dp">
|
||||||
@ -313,6 +313,7 @@
|
|||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<!-- Secondary Host IP Card -->
|
<!-- Secondary Host IP Card -->
|
||||||
|
<!-- android:onClick="@{()->click.onSecHostIpClick()}"-->
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/secHostIpCard"
|
android:id="@+id/secHostIpCard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -320,7 +321,6 @@
|
|||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:onClick="@{()->click.onSecHostIpClick()}"
|
|
||||||
app:cardBackgroundColor="@color/white"
|
app:cardBackgroundColor="@color/white"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardElevation="2dp">
|
app:cardElevation="2dp">
|
||||||
@ -389,6 +389,7 @@
|
|||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<!-- Host Port Card -->
|
<!-- Host Port Card -->
|
||||||
|
<!-- android:onClick="@{()->click.onHostPortClick()}"-->
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/hostPortCard"
|
android:id="@+id/hostPortCard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -396,7 +397,6 @@
|
|||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:onClick="@{()->click.onHostPortClick()}"
|
|
||||||
app:cardBackgroundColor="@color/white"
|
app:cardBackgroundColor="@color/white"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardElevation="2dp">
|
app:cardElevation="2dp">
|
||||||
@ -485,6 +485,7 @@
|
|||||||
tools:fontFamily="sans-serif-medium" />
|
tools:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
<!-- Terminal ID Card -->
|
<!-- Terminal ID Card -->
|
||||||
|
<!-- android:onClick="@{()->click.onTidClick()}"-->
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/tidCard"
|
android:id="@+id/tidCard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -492,7 +493,6 @@
|
|||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:onClick="@{()->click.onTidClick()}"
|
|
||||||
app:cardBackgroundColor="@color/white"
|
app:cardBackgroundColor="@color/white"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardElevation="2dp">
|
app:cardElevation="2dp">
|
||||||
@ -561,6 +561,7 @@
|
|||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<!-- Merchant ID Card -->
|
<!-- Merchant ID Card -->
|
||||||
|
<!-- android:onClick="@{()->click.onMidClick()}"-->
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/midCard"
|
android:id="@+id/midCard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -568,7 +569,6 @@
|
|||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:onClick="@{()->click.onMidClick()}"
|
|
||||||
app:cardBackgroundColor="@color/white"
|
app:cardBackgroundColor="@color/white"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardElevation="2dp">
|
app:cardElevation="2dp">
|
||||||
@ -657,6 +657,7 @@
|
|||||||
tools:fontFamily="sans-serif-medium" />
|
tools:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
<!-- Save Configuration Card -->
|
<!-- Save Configuration Card -->
|
||||||
|
<!-- android:onClick="@{()->click.onSaveConfigClick()}"-->
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/saveConfigCard"
|
android:id="@+id/saveConfigCard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -664,7 +665,6 @@
|
|||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:onClick="@{()->click.onSaveConfigClick()}"
|
|
||||||
app:cardBackgroundColor="@color/white"
|
app:cardBackgroundColor="@color/white"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardElevation="2dp">
|
app:cardElevation="2dp">
|
||||||
|
|||||||
@ -8,326 +8,354 @@
|
|||||||
<import type="android.view.View"/>
|
<import type="android.view.View"/>
|
||||||
<import type="com.utsmm.kbz.R"/>
|
<import type="com.utsmm.kbz.R"/>
|
||||||
<import type="com.utsmm.kbz.util.layout.LayoutDataUtil"/>
|
<import type="com.utsmm.kbz.util.layout.LayoutDataUtil"/>
|
||||||
<variable
|
|
||||||
name="shareViewModel"
|
<variable name="shareViewModel" type="com.utsmm.kbz.ui.core_viewmodel.SharedViewModel"/>
|
||||||
type="com.utsmm.kbz.ui.core_viewmodel.SharedViewModel" />
|
<variable name="mainViewModel" type="com.utsmm.kbz.MainViewModel"/>
|
||||||
<variable
|
<variable name="click" type="com.utsmm.kbz.MainFragment.ClickEvent"/>
|
||||||
name="mainViewModel"
|
<variable name="carouselAdapter" type="androidx.recyclerview.widget.RecyclerView.Adapter"/>
|
||||||
type="com.utsmm.kbz.MainViewModel" />
|
<variable name="myAdapter" type="com.utsmm.kbz.ui.adapters.MainAdapter"/>
|
||||||
<variable
|
|
||||||
name="click"
|
|
||||||
type="com.utsmm.kbz.MainFragment.ClickEvent" />
|
|
||||||
<variable
|
|
||||||
name="carouselAdapter"
|
|
||||||
type="androidx.recyclerview.widget.RecyclerView.Adapter" />
|
|
||||||
<variable
|
|
||||||
name="myAdapter"
|
|
||||||
type="com.utsmm.kbz.ui.adapters.MainAdapter" />
|
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ======== ROOT ======== -->
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/colorBackground">
|
android:background="@color/colorPrimary"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/serialNumber"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="S/N : N86PW500019"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:text='@{"S/N : " + shareViewModel.serialNumber}'
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- ====================== BANNER ====================== -->
|
||||||
|
|
||||||
<!-- Banner Section (25% of screen) -->
|
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/bannerCard"
|
android:id="@+id/bannerCard"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardElevation="8dp"
|
app:cardElevation="6dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintDimensionRatio="16:6"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHeight_percent="0.25">
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/serialNumber">
|
||||||
|
|
||||||
<RelativeLayout
|
<com.denzcoskun.imageslider.ImageSlider
|
||||||
|
android:id="@+id/image_slider"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
app:iss_auto_cycle="true"
|
||||||
<com.denzcoskun.imageslider.ImageSlider
|
app:iss_delay="5000"
|
||||||
android:id="@+id/image_slider"
|
app:iss_no_dots="true"
|
||||||
android:layout_width="match_parent"
|
app:iss_period="5000"
|
||||||
android:layout_height="match_parent"
|
app:iss_title_background="@color/transparent" />
|
||||||
app:iss_auto_cycle="true"
|
|
||||||
app:iss_period="5000"
|
|
||||||
app:iss_delay="5000"
|
|
||||||
app:iss_no_dots="true"
|
|
||||||
app:iss_title_background="@color/transparent" />
|
|
||||||
|
|
||||||
<!-- Gradient overlay for better text visibility -->
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@drawable/gradient_overlay" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<!-- Main Menu Grid (3+2 layout for 5 functions) -->
|
|
||||||
|
<!-- ====================== GRID AREA ====================== -->
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/menuGrid"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_margin="16dp"
|
android:paddingTop="12dp"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/bannerCard"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent">
|
app:layout_constraintHorizontal_bias="1.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/bannerCard"
|
||||||
|
app:layout_constraintVertical_bias="1.0">
|
||||||
|
|
||||||
<!-- First Row - 3 cards -->
|
<FrameLayout
|
||||||
<!-- Sale Card -->
|
android:id="@+id/btn1"
|
||||||
<androidx.cardview.widget.CardView
|
android:layout_width="120dp"
|
||||||
android:id="@+id/cardMenuCard"
|
android:layout_height="120dp"
|
||||||
android:layout_width="0dp"
|
android:layout_marginStart="60dp"
|
||||||
android:layout_height="0dp"
|
android:layout_marginTop="45dp"
|
||||||
android:layout_marginEnd="4dp"
|
android:background="@drawable/honey"
|
||||||
android:layout_marginBottom="8dp"
|
app:layout_constraintBottom_toTopOf="@+id/btn3"
|
||||||
app:cardCornerRadius="16dp"
|
|
||||||
app:cardElevation="6dp"
|
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:onClick="@{() -> click.onClickCard()}"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/signOnMenuCard"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/qrPayMenuCard"
|
android:onClick="@{() -> click.onClickCard()}">
|
||||||
app:layout_constraintWidth_percent="0.32"
|
|
||||||
app:layout_constraintHeight_percent="0.48">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:background="@drawable/primary_card_bg"
|
android:orientation="vertical">
|
||||||
android:padding="12dp">
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:src="@drawable/ic_sale"
|
|
||||||
android:layout_marginBottom="6dp"
|
android:layout_marginBottom="6dp"
|
||||||
app:tint="@color/white" />
|
android:src="@drawable/ic_sale"
|
||||||
|
app:tint="@color/colorPrimary" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/menu_sale"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:fontFamily="@font/rubik_medium"
|
android:fontFamily="@font/rubik_medium"
|
||||||
android:textAlignment="center" />
|
android:text="@string/menu_sale"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</FrameLayout>
|
||||||
|
|
||||||
<!-- Sign On Card -->
|
<FrameLayout
|
||||||
<androidx.cardview.widget.CardView
|
android:id="@+id/btn2"
|
||||||
android:id="@+id/signOnMenuCard"
|
android:layout_width="120dp"
|
||||||
android:layout_width="0dp"
|
android:layout_height="120dp"
|
||||||
android:layout_height="0dp"
|
android:layout_marginTop="45dp"
|
||||||
android:layout_marginStart="4dp"
|
android:layout_marginEnd="60dp"
|
||||||
android:layout_marginEnd="4dp"
|
android:background="@drawable/honey"
|
||||||
android:layout_marginBottom="8dp"
|
app:layout_constraintBottom_toTopOf="@+id/bt4"
|
||||||
app:cardCornerRadius="16dp"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:cardElevation="6dp"
|
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:onClick="@{() -> click.onClickSignOn()}"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/cardMenuCard"
|
android:clickable="@{mainViewModel.kPayStatus}"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/settlementMenuCard"
|
android:focusable="@{mainViewModel.kPayStatus}"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/otherFeaturesCard"
|
android:alpha="@{mainViewModel.kPayStatus ? 1f : 0.5f}"
|
||||||
app:layout_constraintWidth_percent="0.32"
|
android:onClick="@{() -> click.onClickQR()}">
|
||||||
app:layout_constraintHeight_percent="0.48">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="70dp"
|
||||||
|
android:layout_height="70dp"
|
||||||
|
android:layout_marginBottom="6dp"
|
||||||
|
android:src="@drawable/mmqr_logo"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:fontFamily="@font/rubik_medium"-->
|
||||||
|
<!-- android:text="@string/qr_pay"-->
|
||||||
|
<!-- android:textAlignment="center"-->
|
||||||
|
<!-- android:textColor="@color/colorPrimary"-->
|
||||||
|
<!-- android:textSize="14sp"-->
|
||||||
|
<!-- android:textStyle="bold" />-->
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/btn3"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:background="@drawable/honey"
|
||||||
|
android:clickable="@{mainViewModel.voidStatus}"
|
||||||
|
android:focusable="@{mainViewModel.voidStatus}"
|
||||||
|
android:alpha="@{mainViewModel.voidStatus ? 1f : 0.5f}"
|
||||||
|
android:onClick="@{() -> click.onClickVoid()}"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/bt4"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginBottom="6dp"
|
||||||
|
android:src="@drawable/ic_void_dash"
|
||||||
|
app:tint="@color/colorPrimary" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:text="Void"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/bt4"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:background="@drawable/honey"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:onClick="@{() -> click.onClickSignOn()}"
|
||||||
|
>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:background="@drawable/primary_card_bg"
|
android:layout_width="match_parent"
|
||||||
android:padding="12dp">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:src="@drawable/ic_signon"
|
android:src="@drawable/ic_signon"
|
||||||
android:layout_marginBottom="6dp"
|
android:layout_marginBottom="6dp"
|
||||||
app:tint="@color/white" />
|
app:tint="@color/colorPrimary" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/menu_sign_on"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:fontFamily="@font/rubik_medium"
|
android:fontFamily="@font/rubik_medium"
|
||||||
android:textAlignment="center" />
|
android:text="@string/menu_sign_on"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</FrameLayout>
|
||||||
|
|
||||||
<!-- Settlement Card -->
|
<FrameLayout
|
||||||
<androidx.cardview.widget.CardView
|
android:id="@+id/bt5"
|
||||||
android:id="@+id/settlementMenuCard"
|
android:layout_width="120dp"
|
||||||
android:layout_width="0dp"
|
android:layout_height="120dp"
|
||||||
android:layout_height="0dp"
|
android:background="@drawable/honey"
|
||||||
android:layout_marginStart="4dp"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
android:layout_marginBottom="8dp"
|
app:layout_constraintStart_toEndOf="@+id/bt4"
|
||||||
app:cardCornerRadius="16dp"
|
android:onClick="@{() -> click.onClickReport()}"
|
||||||
app:cardElevation="6dp"
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:onClick="@{() -> click.onClickSettlement()}"
|
|
||||||
app:disableBtn="@{mainViewModel.settlementStatus}"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/signOnMenuCard"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/otherFeaturesCard"
|
|
||||||
app:layout_constraintWidth_percent="0.32"
|
|
||||||
app:layout_constraintHeight_percent="0.48">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:background="@drawable/primary_card_bg"
|
android:orientation="vertical">
|
||||||
android:padding="12dp">
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:src="@drawable/ic_settlement"
|
|
||||||
android:layout_marginBottom="6dp"
|
android:layout_marginBottom="6dp"
|
||||||
app:tint="@color/white" />
|
android:src="@drawable/ic_dash_report"
|
||||||
|
app:tint="@color/colorPrimary" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/menu_settlement"
|
android:fontFamily="@font/rubik_medium"
|
||||||
android:textColor="@color/white"
|
android:text="Reports"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold" />
|
||||||
android:fontFamily="@font/rubik_medium"
|
|
||||||
android:textAlignment="center" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</FrameLayout>
|
||||||
|
|
||||||
<!-- Second Row - 2 cards centered -->
|
<FrameLayout
|
||||||
<!-- QR Pay Card -->
|
android:id="@+id/bt6"
|
||||||
<androidx.cardview.widget.CardView
|
android:layout_width="120dp"
|
||||||
android:id="@+id/qrPayMenuCard"
|
android:layout_height="120dp"
|
||||||
android:layout_width="0dp"
|
android:layout_marginStart="60dp"
|
||||||
android:layout_height="0dp"
|
android:layout_marginBottom="45dp"
|
||||||
android:layout_marginEnd="8dp"
|
android:background="@drawable/honey"
|
||||||
android:layout_marginTop="8dp"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:cardCornerRadius="16dp"
|
|
||||||
app:cardElevation="6dp"
|
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:onClick="@{() -> click.onClickQRPay()}"
|
|
||||||
app:disableBtn="@{mainViewModel.kPayStatus}"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/cardMenuCard"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/otherFeaturesCard"
|
app:layout_constraintTop_toBottomOf="@+id/bt4"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:clickable="@{mainViewModel.settlementStatus}"
|
||||||
app:layout_constraintWidth_percent="0.48"
|
android:focusable="@{mainViewModel.settlementStatus}"
|
||||||
app:layout_constraintHeight_percent="0.48">
|
android:alpha="@{mainViewModel.settlementStatus ? 1f : 0.5f}"
|
||||||
|
android:onClick="@{() -> click.onClickSettlement()}">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:background="@drawable/primary_card_bg"
|
android:orientation="vertical">
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="48dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="40dp"
|
||||||
android:src="@drawable/ic_qr_pay"
|
android:layout_marginBottom="6dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:src="@drawable/ic_settlement"
|
||||||
app:tint="@color/white" />
|
app:tint="@color/colorPrimary" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/menu_qrpay"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:fontFamily="@font/rubik_medium"
|
android:fontFamily="@font/rubik_medium"
|
||||||
android:textAlignment="center" />
|
android:text="@string/menu_settlement"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
<FrameLayout
|
||||||
|
android:id="@+id/bt7"
|
||||||
<!-- Transactions Card -->
|
android:layout_width="120dp"
|
||||||
<androidx.cardview.widget.CardView
|
android:layout_height="120dp"
|
||||||
android:id="@+id/otherFeaturesCard"
|
android:layout_marginEnd="60dp"
|
||||||
android:layout_width="0dp"
|
android:layout_marginBottom="45dp"
|
||||||
android:layout_height="0dp"
|
android:background="@drawable/honey"
|
||||||
android:layout_marginStart="8dp"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
app:cardCornerRadius="16dp"
|
|
||||||
app:cardElevation="6dp"
|
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:onClick="@{() -> click.onClickTrans()}"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/signOnMenuCard"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/qrPayMenuCard"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:onClick="@{() -> click.onClickTrans()}"
|
||||||
app:layout_constraintWidth_percent="0.48"
|
app:layout_constraintTop_toBottomOf="@+id/bt4">
|
||||||
app:layout_constraintHeight_percent="0.48">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:background="@drawable/primary_card_bg"
|
android:orientation="vertical">
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="48dp"
|
android:layout_width="39dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="36dp"
|
||||||
|
android:layout_marginBottom="6dp"
|
||||||
android:src="@drawable/ic_other_features"
|
android:src="@drawable/ic_other_features"
|
||||||
android:layout_marginBottom="8dp"
|
app:tint="@color/colorPrimary" />
|
||||||
app:tint="@color/white" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/menu_transactions"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:fontFamily="@font/rubik_medium"
|
android:fontFamily="@font/rubik_medium"
|
||||||
android:textAlignment="center" />
|
android:text="@string/dash_see_more"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</layout>
|
|
||||||
|
|
||||||
|
</layout>
|
||||||
|
|||||||
333
app/src/main/res/layout/fragment_dashboard_screen_old.xml
Normal file
333
app/src/main/res/layout/fragment_dashboard_screen_old.xml
Normal file
@ -0,0 +1,333 @@
|
|||||||
|
<?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.util.ecr.ECRConnectionStatus"/>
|
||||||
|
<import type="android.view.View"/>
|
||||||
|
<import type="com.utsmm.kbz.R"/>
|
||||||
|
<import type="com.utsmm.kbz.util.layout.LayoutDataUtil"/>
|
||||||
|
<variable
|
||||||
|
name="shareViewModel"
|
||||||
|
type="com.utsmm.kbz.ui.core_viewmodel.SharedViewModel" />
|
||||||
|
<variable
|
||||||
|
name="mainViewModel"
|
||||||
|
type="com.utsmm.kbz.MainViewModel" />
|
||||||
|
<variable
|
||||||
|
name="click"
|
||||||
|
type="com.utsmm.kbz.MainFragment.ClickEvent" />
|
||||||
|
<variable
|
||||||
|
name="carouselAdapter"
|
||||||
|
type="androidx.recyclerview.widget.RecyclerView.Adapter" />
|
||||||
|
<variable
|
||||||
|
name="myAdapter"
|
||||||
|
type="com.utsmm.kbz.ui.adapters.MainAdapter" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/colorBackground">
|
||||||
|
|
||||||
|
<!-- Banner Section (25% of screen) -->
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/bannerCard"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="8dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHeight_percent="0.25">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<com.denzcoskun.imageslider.ImageSlider
|
||||||
|
android:id="@+id/image_slider"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:iss_auto_cycle="true"
|
||||||
|
app:iss_period="5000"
|
||||||
|
app:iss_delay="5000"
|
||||||
|
app:iss_no_dots="true"
|
||||||
|
app:iss_title_background="@color/transparent" />
|
||||||
|
|
||||||
|
<!-- Gradient overlay for better text visibility -->
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<!-- Main Menu Grid (3+2 layout for 5 functions) -->
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/bannerCard"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent">
|
||||||
|
|
||||||
|
<!-- First Row - 3 cards -->
|
||||||
|
<!-- Sale Card -->
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/cardMenuCard"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="6dp"
|
||||||
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:onClick="@{() -> click.onClickCard()}"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/signOnMenuCard"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/qrPayMenuCard"
|
||||||
|
app:layout_constraintWidth_percent="0.32"
|
||||||
|
app:layout_constraintHeight_percent="0.48">
|
||||||
|
|
||||||
|
<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="12dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:src="@drawable/ic_sale"
|
||||||
|
android:layout_marginBottom="6dp"
|
||||||
|
app:tint="@color/white" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/menu_sale"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:textAlignment="center" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<!-- Sign On Card -->
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/signOnMenuCard"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="6dp"
|
||||||
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:onClick="@{() -> click.onClickSignOn()}"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/cardMenuCard"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/settlementMenuCard"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/otherFeaturesCard"
|
||||||
|
app:layout_constraintWidth_percent="0.32"
|
||||||
|
app:layout_constraintHeight_percent="0.48">
|
||||||
|
|
||||||
|
<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="12dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:src="@drawable/ic_signon"
|
||||||
|
android:layout_marginBottom="6dp"
|
||||||
|
app:tint="@color/white" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/menu_sign_on"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:textAlignment="center" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<!-- Settlement Card -->
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/settlementMenuCard"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="6dp"
|
||||||
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:onClick="@{() -> click.onClickSettlement()}"
|
||||||
|
app:disableBtn="@{mainViewModel.settlementStatus}"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/signOnMenuCard"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/otherFeaturesCard"
|
||||||
|
app:layout_constraintWidth_percent="0.32"
|
||||||
|
app:layout_constraintHeight_percent="0.48">
|
||||||
|
|
||||||
|
<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="12dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:src="@drawable/ic_settlement"
|
||||||
|
android:layout_marginBottom="6dp"
|
||||||
|
app:tint="@color/white" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/menu_settlement"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:textAlignment="center" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<!-- Second Row - 2 cards centered -->
|
||||||
|
<!-- QR Pay Card -->
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/qrPayMenuCard"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="6dp"
|
||||||
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:onClick="@{() -> click.onClickQR()}"
|
||||||
|
app:disableBtn="@{mainViewModel.kPayStatus}"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/cardMenuCard"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/otherFeaturesCard"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintWidth_percent="0.48"
|
||||||
|
app:layout_constraintHeight_percent="0.48">
|
||||||
|
|
||||||
|
<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:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:src="@drawable/ic_qr_pay"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
app:tint="@color/white" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/menu_qrpay"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:textAlignment="center" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<!-- Transactions Card -->
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/otherFeaturesCard"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="6dp"
|
||||||
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:onClick="@{() -> click.onClickTrans()}"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/signOnMenuCard"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/qrPayMenuCard"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintWidth_percent="0.48"
|
||||||
|
app:layout_constraintHeight_percent="0.48">
|
||||||
|
|
||||||
|
<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:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:src="@drawable/ic_other_features"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
app:tint="@color/white" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/menu_transactions"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:textAlignment="center" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</layout>
|
||||||
@ -41,7 +41,7 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:spanCount="2"
|
app:spanCount="3"
|
||||||
bind:setAdapter="@{adapter}"
|
bind:setAdapter="@{adapter}"
|
||||||
tools:itemCount="6"
|
tools:itemCount="6"
|
||||||
tools:listitem="@layout/item_view_dashboard" />
|
tools:listitem="@layout/item_view_dashboard" />
|
||||||
|
|||||||
206
app/src/main/res/layout/fragment_host_config.xml
Normal file
206
app/src/main/res/layout/fragment_host_config.xml
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:bind="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
<import type="android.view.View"/>
|
||||||
|
<import type="android.text.TextUtils" />
|
||||||
|
<variable
|
||||||
|
name="viewModel"
|
||||||
|
type="com.utsmm.kbz.ui.settings.HostConfigViewModel" />
|
||||||
|
<variable
|
||||||
|
name="click"
|
||||||
|
type="com.utsmm.kbz.ui.settings.HostConfigFragment.ClickHandler" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<!-- CARD SECTION -->
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/hostCard"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="0dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/actionButtons"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/bg_edittext_primary_border"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fillViewport="true"
|
||||||
|
android:scrollbars="none">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<!-- HEADER -->
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="TERMINAL CONFIGURATION"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:paddingBottom="12dp"/>
|
||||||
|
|
||||||
|
<!-- Merchant Info -->
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text="@{viewModel.merchantName}" />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text="@{viewModel.merchantPhone}" />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text="@{viewModel.merchantAddress1}" />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text="@{viewModel.merchantAddress2}" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="--------------------------------"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:paddingBottom="8dp"/>
|
||||||
|
|
||||||
|
<!-- PRIMARY HOST -->
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="PRIMARY HOST"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"Name : " + viewModel.hostName}' />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"TID : " + viewModel.tid}' />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"MID : " + viewModel.mid}' />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"Primary Ip : " + viewModel.primaryIp}' />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"Primary Port : " + viewModel.primaryPort}' />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"Secondary Ip : " + viewModel.secondaryIp}' />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"Secondary Port : " + viewModel.secondaryPort}' />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"Currency Code : " + viewModel.currencyCode}' />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="--------------------------------"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:paddingBottom="8dp"/>
|
||||||
|
|
||||||
|
<!-- SECONDARY HOST (only if exists) -->
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility='@{!viewModel.secHostName.isEmpty() ? View.VISIBLE : View.GONE}'>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="SECONDARY HOST"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"Name : " + viewModel.secHostName}' />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"TID : " + viewModel.secHostTid}' />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"MID : " + viewModel.secHostMid}' />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"Primary Ip : " + viewModel.secHostPrimaryIp}' />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"Primary Port : " + viewModel.secHostPrimaryPort}' />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"Secondary Ip : " + viewModel.secHostSecondaryIp}' />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"Secondary Port : " + viewModel.secHostSecondaryPort}' />
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text='@{"Currency Code : " + viewModel.currencyCode}' />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="--------------------------------"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:paddingBottom="8dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ACTION BUTTONS -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/actionButtons"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="52dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:text="Cancel"
|
||||||
|
android:onClick="@{()-> click.onCancel()}"
|
||||||
|
android:background="@drawable/bg_rounded_btn_cancel_cv"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
|
android:textStyle="bold"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="52dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:text="Print"
|
||||||
|
android:onClick="@{()-> click.onPrint()}"
|
||||||
|
android:background="@drawable/bg_rounded_btn_cv"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textStyle="bold"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</layout>
|
||||||
352
app/src/main/res/layout/fragment_inject_key.xml
Normal file
352
app/src/main/res/layout/fragment_inject_key.xml
Normal file
@ -0,0 +1,352 @@
|
|||||||
|
<?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="click"
|
||||||
|
type="com.utsmm.kbz.ui.settings.InjectKeyFragment.ClickEvent" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/colorBackground">
|
||||||
|
|
||||||
|
<!-- Modern Header -->
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/headerContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:elevation="8dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<!-- Main Content Scroll View -->
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:fillViewport="true"
|
||||||
|
android:paddingHorizontal="20dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/headerContainer">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<!-- Key Configuration Section -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:text="Key Injection Configuration"
|
||||||
|
android:textColor="@color/colorTextTitle"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
|
<!-- Key Index Input Card -->
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/keyIndexCard"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
app:cardBackgroundColor="@color/white"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="2dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="20dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:text="Key Index"
|
||||||
|
android:textColor="@color/colorTextTitle"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
|
android:fontFamily="@font/rubik_regular"
|
||||||
|
android:text="Enter the key index for injection"
|
||||||
|
android:textColor="@color/colorTextContent"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:fontFamily="sans-serif" />
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="Key Index"
|
||||||
|
app:boxBackgroundMode="outline"
|
||||||
|
app:boxCornerRadiusBottomEnd="8dp"
|
||||||
|
app:boxCornerRadiusBottomStart="8dp"
|
||||||
|
app:boxCornerRadiusTopEnd="8dp"
|
||||||
|
app:boxCornerRadiusTopStart="8dp"
|
||||||
|
app:boxStrokeColor="@color/colorPrimary">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/etKeyIndex"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/rubik_regular"
|
||||||
|
android:inputType="number"
|
||||||
|
android:maxLength="2"
|
||||||
|
android:textColor="@color/colorTextTitle"
|
||||||
|
android:textSize="16sp"
|
||||||
|
tools:fontFamily="sans-serif" />
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<!-- Current Configuration Info Card -->
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/configInfoCard"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
app:cardBackgroundColor="@color/white"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="2dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="20dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:text="Current Configuration"
|
||||||
|
android:textColor="@color/colorTextTitle"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
|
<!-- Terminal ID -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:fontFamily="@font/rubik_regular"
|
||||||
|
android:text="Terminal ID:"
|
||||||
|
android:textColor="@color/colorTextContent"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:fontFamily="sans-serif" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/terminalIdValue"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:text="Not configured"
|
||||||
|
android:textColor="@color/colorTextTitle"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Merchant ID -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:fontFamily="@font/rubik_regular"
|
||||||
|
android:text="Merchant ID:"
|
||||||
|
android:textColor="@color/colorTextContent"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:fontFamily="sans-serif" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/merchantIdValue"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:text="Not configured"
|
||||||
|
android:textColor="@color/colorTextTitle"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Serial Number -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:fontFamily="@font/rubik_regular"
|
||||||
|
android:text="Serial Number:"
|
||||||
|
android:textColor="@color/colorTextContent"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:fontFamily="sans-serif" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/serialNumberValue"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:text="Not configured"
|
||||||
|
android:textColor="@color/colorTextTitle"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Actions Section -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:text="Actions"
|
||||||
|
android:textColor="@color/colorTextTitle"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
|
<!-- Inject Key Button Card -->
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/injectKeyCard"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
|
android:onClick="@{()->click.onInjectKeyClick()}"
|
||||||
|
app:cardBackgroundColor="@color/white"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="2dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="20dp">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
app:cardBackgroundColor="@color/colorPrimary"
|
||||||
|
app:cardCornerRadius="24dp"
|
||||||
|
app:cardElevation="0dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@drawable/ic_lock"
|
||||||
|
app:tint="@color/white" />
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/rubik_medium"
|
||||||
|
android:text="Start Key Injection"
|
||||||
|
android:textColor="@color/colorTextTitle"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:fontFamily="@font/rubik_regular"
|
||||||
|
android:text="Inject encryption key from KeyPOS"
|
||||||
|
android:textColor="@color/colorTextContent"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:fontFamily="sans-serif" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:src="@drawable/ic_right_arrow"
|
||||||
|
app:tint="@color/colorPrimary" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</layout>
|
||||||
@ -32,21 +32,21 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="16dp"
|
android:padding="10dp"
|
||||||
android:paddingTop="24dp"
|
android:paddingTop="14dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<!-- Trace Number Icon -->
|
<!-- Trace Number Icon -->
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="48dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="36dp"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:src="@drawable/ic_txn_history"
|
android:src="@drawable/ic_txn_history"
|
||||||
app:tint="@color/colorPrimary"
|
app:tint="@color/colorPrimary"
|
||||||
android:alpha="0.9"
|
android:alpha="0.88"
|
||||||
android:padding="8dp"
|
android:padding="6dp"
|
||||||
android:background="@drawable/bg_oval" />
|
android:background="@drawable/bg_oval" />
|
||||||
|
|
||||||
<!-- Compact Title -->
|
<!-- Compact Title -->
|
||||||
@ -56,10 +56,10 @@
|
|||||||
android:text="@string/enter_trace_text"
|
android:text="@string/enter_trace_text"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="22sp"
|
android:textSize="17sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:fontFamily="sans-serif-medium"
|
android:fontFamily="sans-serif-medium"
|
||||||
android:layout_marginBottom="4dp" />
|
android:layout_marginBottom="2dp" />
|
||||||
|
|
||||||
<!-- Compact Subtitle -->
|
<!-- Compact Subtitle -->
|
||||||
<TextView
|
<TextView
|
||||||
@ -68,18 +68,18 @@
|
|||||||
android:text="Enter the transaction trace number"
|
android:text="Enter the transaction trace number"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="14sp"
|
android:textSize="12sp"
|
||||||
android:alpha="0.75"
|
android:alpha="0.7"
|
||||||
android:fontFamily="sans-serif"
|
android:fontFamily="sans-serif"
|
||||||
android:layout_marginBottom="16dp" />
|
android:layout_marginBottom="10dp" />
|
||||||
|
|
||||||
<!-- Compact Trace Number Display Card -->
|
<!-- Compact Trace Number Display Card -->
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/traceCard"
|
android:id="@+id/traceCard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="70dp"
|
android:layout_height="48dp"
|
||||||
android:layout_marginHorizontal="8dp"
|
android:layout_marginHorizontal="4dp"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="12dp"
|
||||||
app:cardElevation="0dp"
|
app:cardElevation="0dp"
|
||||||
app:cardBackgroundColor="@color/white">
|
app:cardBackgroundColor="@color/white">
|
||||||
|
|
||||||
@ -87,11 +87,11 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="2dp"
|
android:layout_margin="1dp"
|
||||||
android:background="@drawable/bg_edittext_primary_border"
|
android:background="@drawable/bg_edittext_primary_border"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="16dp">
|
android:padding="8dp">
|
||||||
|
|
||||||
<!-- Trace number display -->
|
<!-- Trace number display -->
|
||||||
<TextView
|
<TextView
|
||||||
@ -102,22 +102,22 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@{inputTraceViewModel.invoiceNo}"
|
android:text="@{inputTraceViewModel.invoiceNo}"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="28sp"
|
android:textSize="20sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:letterSpacing="0.1"
|
android:letterSpacing="0.07"
|
||||||
android:fontFamily="monospace"
|
android:fontFamily="monospace"
|
||||||
android:hint="000000"
|
android:hint="000000"
|
||||||
android:textColorHint="@color/colorPrimary"
|
android:textColorHint="@color/colorPrimary"
|
||||||
android:alpha="0.6"
|
android:alpha="0.5"
|
||||||
tools:text="123456" />
|
tools:text="123456" />
|
||||||
|
|
||||||
<!-- Transaction indicator -->
|
<!-- Transaction indicator -->
|
||||||
<View
|
<View
|
||||||
android:layout_width="6dp"
|
android:layout_width="5dp"
|
||||||
android:layout_height="6dp"
|
android:layout_height="5dp"
|
||||||
android:background="@drawable/bg_oval"
|
android:background="@drawable/bg_oval"
|
||||||
android:backgroundTint="@color/colorPrimary"
|
android:backgroundTint="@color/colorPrimary"
|
||||||
android:alpha="0.6" />
|
android:alpha="0.5" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -125,14 +125,14 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- Number Keyboard - guaranteed space -->
|
<!-- Number Keyboard - guaranteed space, more compact -->
|
||||||
<com.utsmyanmar.baselib.ui.NumberKeyboard
|
<com.utsmyanmar.baselib.ui.NumberKeyboard
|
||||||
android:id="@+id/passwordKeyboard"
|
android:id="@+id/passwordKeyboard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginHorizontal="16dp"
|
android:layout_marginHorizontal="8dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="4dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="4dp"
|
||||||
app:KeyClickCallback="@{inputTraceViewModel.onKeyClick}"
|
app:KeyClickCallback="@{inputTraceViewModel.onKeyClick}"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/actionButtonsContainer"
|
app:layout_constraintBottom_toTopOf="@+id/actionButtonsContainer"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
@ -146,8 +146,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="16dp"
|
android:padding="8dp"
|
||||||
android:paddingBottom="24dp"
|
android:paddingBottom="12dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
@ -155,34 +155,34 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnCancel"
|
android:id="@+id/btnCancel"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="52dp"
|
android:layout_height="42dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="6dp"
|
||||||
android:text="@string/layout_cancel"
|
android:text="@string/layout_cancel"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="15sp"
|
android:textSize="12sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:background="@drawable/bg_rounded_btn_cancel_cv"
|
android:background="@drawable/bg_rounded_btn_cancel_cv"
|
||||||
android:fontFamily="sans-serif-medium"
|
android:fontFamily="sans-serif-medium"
|
||||||
android:onClick="@{()->click.onCancel()}"
|
android:onClick="@{()->click.onCancel()}"
|
||||||
android:elevation="2dp"
|
android:elevation="1dp"
|
||||||
android:textAllCaps="false" />
|
android:textAllCaps="false" />
|
||||||
|
|
||||||
<!-- Confirm Button -->
|
<!-- Confirm Button -->
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnConfirm"
|
android:id="@+id/btnConfirm"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="52dp"
|
android:layout_height="42dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="6dp"
|
||||||
android:text="@string/layout_confirm"
|
android:text="@string/layout_confirm"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="15sp"
|
android:textSize="12sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:background="@drawable/bg_rounded_btn_cv"
|
android:background="@drawable/bg_rounded_btn_cv"
|
||||||
android:fontFamily="sans-serif-medium"
|
android:fontFamily="sans-serif-medium"
|
||||||
android:onClick="@{()->click.onConfirm()}"
|
android:onClick="@{()->click.onConfirm()}"
|
||||||
android:elevation="8dp"
|
android:elevation="3dp"
|
||||||
android:textAllCaps="false" />
|
android:textAllCaps="false" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@ -446,55 +446,55 @@
|
|||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<!-- Manual Reversal -->
|
<!-- Manual Reversal -->
|
||||||
<androidx.cardview.widget.CardView
|
<!-- <androidx.cardview.widget.CardView-->
|
||||||
android:layout_width="match_parent"
|
<!-- android:layout_width="match_parent"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_marginBottom="12dp"
|
<!-- android:layout_marginBottom="12dp"-->
|
||||||
app:cardCornerRadius="12dp"
|
<!-- app:cardCornerRadius="12dp"-->
|
||||||
app:cardElevation="0dp"
|
<!-- app:cardElevation="0dp"-->
|
||||||
app:cardBackgroundColor="@color/white"
|
<!-- 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"-->
|
||||||
android:onClick="@{()->click.onClickManualReversal()}">
|
<!-- android:onClick="@{()->click.onClickManualReversal()}">-->
|
||||||
|
|
||||||
<LinearLayout
|
<!-- <LinearLayout-->
|
||||||
android:layout_width="match_parent"
|
<!-- android:layout_width="match_parent"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_margin="2dp"
|
<!-- android:layout_margin="2dp"-->
|
||||||
android:background="@drawable/bg_edittext_primary_border"
|
<!-- android:background="@drawable/bg_edittext_primary_border"-->
|
||||||
android:orientation="horizontal"
|
<!-- android:orientation="horizontal"-->
|
||||||
android:gravity="center_vertical"
|
<!-- android:gravity="center_vertical"-->
|
||||||
android:padding="16dp">
|
<!-- android:padding="16dp">-->
|
||||||
|
|
||||||
<ImageView
|
<!-- <ImageView-->
|
||||||
android:layout_width="20dp"
|
<!-- android:layout_width="20dp"-->
|
||||||
android:layout_height="20dp"
|
<!-- android:layout_height="20dp"-->
|
||||||
android:src="@drawable/ic_custom_pos"
|
<!-- android:src="@drawable/ic_custom_pos"-->
|
||||||
app:tint="@color/colorPrimary"
|
<!-- app:tint="@color/colorPrimary"-->
|
||||||
android:alpha="0.8"
|
<!-- android:alpha="0.8"-->
|
||||||
android:layout_marginEnd="12dp" />
|
<!-- android:layout_marginEnd="12dp" />-->
|
||||||
|
|
||||||
<TextView
|
<!-- <TextView-->
|
||||||
android:layout_width="0dp"
|
<!-- android:layout_width="0dp"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_weight="1"
|
<!-- android:layout_weight="1"-->
|
||||||
android:text="@string/txt_subtitle_manual_reversal"
|
<!-- android:text="@string/txt_subtitle_manual_reversal"-->
|
||||||
android:textColor="@color/colorPrimary"
|
<!-- android:textColor="@color/colorPrimary"-->
|
||||||
android:textSize="15sp"
|
<!-- android:textSize="15sp"-->
|
||||||
android:textStyle="normal"
|
<!-- android:textStyle="normal"-->
|
||||||
android:fontFamily="sans-serif-medium" />
|
<!-- android:fontFamily="sans-serif-medium" />-->
|
||||||
|
|
||||||
<ImageView
|
<!-- <ImageView-->
|
||||||
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/colorPrimary"
|
<!-- app:tint="@color/colorPrimary"-->
|
||||||
android:alpha="0.6" />
|
<!-- android:alpha="0.6" />-->
|
||||||
|
|
||||||
</LinearLayout>
|
<!-- </LinearLayout>-->
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
<!-- </androidx.cardview.widget.CardView>-->
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user