Commit 2602297d authored by Izol's avatar Izol

added_database_transactions_negativ&&adjust_receipt_print

parent 241a3a09
This diff is collapsed.
......@@ -14,10 +14,22 @@
</component>
<component name="ChangeListManager">
<list default="true" id="8704a1d9-96ef-4cdc-ac57-c88bc9c0306e" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.flutter-plugins-dependencies" beforeDir="false" afterPath="$PROJECT_DIR$/.flutter-plugins-dependencies" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/.gradle/7.4/executionHistory/executionHistory.bin" beforeDir="false" afterPath="$PROJECT_DIR$/android/.gradle/7.4/executionHistory/executionHistory.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/.gradle/7.4/executionHistory/executionHistory.lock" beforeDir="false" afterPath="$PROJECT_DIR$/android/.gradle/7.4/executionHistory/executionHistory.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/.gradle/7.4/fileHashes/fileHashes.bin" beforeDir="false" afterPath="$PROJECT_DIR$/android/.gradle/7.4/fileHashes/fileHashes.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/.gradle/7.4/fileHashes/fileHashes.lock" beforeDir="false" afterPath="$PROJECT_DIR$/android/.gradle/7.4/fileHashes/fileHashes.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/.gradle/7.4/fileHashes/resourceHashesCache.bin" beforeDir="false" afterPath="$PROJECT_DIR$/android/.gradle/7.4/fileHashes/resourceHashesCache.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock" beforeDir="false" afterPath="$PROJECT_DIR$/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/.gradle/buildOutputCleanup/outputFiles.bin" beforeDir="false" afterPath="$PROJECT_DIR$/android/.gradle/buildOutputCleanup/outputFiles.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/.gradle/file-system.probe" beforeDir="false" afterPath="$PROJECT_DIR$/android/.gradle/file-system.probe" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/android/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/app/src/main/kotlin/com/example/self_service_3/MainActivity.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/app/src/main/kotlin/com/example/self_service_3/MainActivity.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/reader/reader_flutter.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/reader/reader_flutter.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/daemon/7.4/registry.bin" beforeDir="false" afterPath="$PROJECT_DIR$/daemon/7.4/registry.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/daemon/7.4/registry.bin.lock" beforeDir="false" afterPath="$PROJECT_DIR$/daemon/7.4/registry.bin.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/database/database_helper.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/database/database_helper.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/models/wirstband_info.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/models/wirstband_info.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/ui/pages/home_page.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/ui/pages/home_page.dart" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
......
......@@ -14,10 +14,22 @@
</component>
<component name="ChangeListManager">
<list default="true" id="d7f16c77-9245-4a59-8524-9e417f68f24f" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/../.flutter-plugins-dependencies" beforeDir="false" afterPath="$PROJECT_DIR$/../.flutter-plugins-dependencies" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/7.4/executionHistory/executionHistory.bin" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.4/executionHistory/executionHistory.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/7.4/executionHistory/executionHistory.lock" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.4/executionHistory/executionHistory.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/7.4/fileHashes/fileHashes.bin" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.4/fileHashes/fileHashes.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/7.4/fileHashes/fileHashes.lock" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.4/fileHashes/fileHashes.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/7.4/fileHashes/resourceHashesCache.bin" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.4/fileHashes/resourceHashesCache.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/buildOutputCleanup/buildOutputCleanup.lock" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/buildOutputCleanup/buildOutputCleanup.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/buildOutputCleanup/outputFiles.bin" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/buildOutputCleanup/outputFiles.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/file-system.probe" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/file-system.probe" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/kotlin/com/example/self_service_3/MainActivity.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/kotlin/com/example/self_service_3/MainActivity.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../lib/reader/reader_flutter.dart" beforeDir="false" afterPath="$PROJECT_DIR$/../lib/reader/reader_flutter.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../daemon/7.4/registry.bin" beforeDir="false" afterPath="$PROJECT_DIR$/../daemon/7.4/registry.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../daemon/7.4/registry.bin.lock" beforeDir="false" afterPath="$PROJECT_DIR$/../daemon/7.4/registry.bin.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../lib/database/database_helper.dart" beforeDir="false" afterPath="$PROJECT_DIR$/../lib/database/database_helper.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../lib/models/wirstband_info.dart" beforeDir="false" afterPath="$PROJECT_DIR$/../lib/models/wirstband_info.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../lib/ui/pages/home_page.dart" beforeDir="false" afterPath="$PROJECT_DIR$/../lib/ui/pages/home_page.dart" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
......@@ -25,7 +37,7 @@
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[192.168.3.108:5555]" />
<component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[192.168.7.108:5555]" />
<component name="ExternalProjectsData">
<projectState path="$PROJECT_DIR$">
<ProjectState />
......@@ -44,9 +56,13 @@
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="DEBUGGABLE_DEVICE" value="sunmi-t2mini-192.168.36.108:5555" />
<property name="DEBUGGABLE_PROCESS" value="com.example.self_service_3" />
<property name="DEBUGGER_ID" value="Auto" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="RunOnceActivity.cidr.known.project.marker" value="true" />
<property name="SHOW_ALL_PROCESSES" value="false" />
<property name="cidr.known.project.marker" value="true" />
<property name="dart.analysis.tool.window.visible" value="false" />
<property name="show.migrate.to.gradle.popup" value="false" />
......
......@@ -165,6 +165,7 @@ class MainActivity : MethodChannel.MethodCallHandler, FlutterActivity(), MifareT
override fun onErrorOperation(reason: String?, errorCode: String) {
Log.d("onErrorOperation", reason.toString())
Log.d("ini pesan errorCode", errorCode)
if (errorCode == "103F") {
result?.success(reason)
} else if (errorCode == "0005") {
......@@ -195,6 +196,7 @@ class MainActivity : MethodChannel.MethodCallHandler, FlutterActivity(), MifareT
}
override fun onSuccessGetAllInfoTicket(ticket: Ticket?) {
Log.d("ini pesan gson", Gson().toJson(ticket))
result?.success(Gson().toJson(ticket))
}
......@@ -265,18 +267,33 @@ class MainActivity : MethodChannel.MethodCallHandler, FlutterActivity(), MifareT
[L]Metode Bayar : ${metodeBayar}
[L]Status : ${status}
[C]--------------------------------
""".trimIndent()
"""
if(status == "success"){
text += """
[C]Top Up Berhasil
[C]powered by dolanapp.com
""".trimIndent()
"""
} else {
text += """
[C]${companyName}
[C]${companyAddress}
[C]${companyPhone}
[C]--------------------------------
[L]Tanggal : ${sdf.format(timeNow)}
[L]No Transaksi : ${approvalCode}
[L]No Kartu : ${ticket.cardNumber.toString()}
[L]Masa Berlaku : ${sdf.format(cardExpiry)}
[L]Saldo : Rp${formatDecimalToPrice(prevBalance.toDouble()).toString()}
[L]Biaya Layanan : Rp${formatDecimalToPrice(serviceCharge.toDouble()).toString()}
[L]Jumlah Bayar : Rp${formatDecimalToPrice(serviceChargeAmount.toDouble()).toString()}
[L]Metode Bayar : ${metodeBayar}
[L]Status : ${status}
[C]--------------------------------
[C]Top Up Gagal
[C]powered by dolanapp.com
""".trimIndent()
"""
}
text = text.trimIndent()
_mifareTicketing?.generateReceiptTopup(null, text, bitmapIcon)
} else {
var receiptLayout: ReceiptBuilder = ReceiptBuilder(570)
......
No preview for this file type
......@@ -5,8 +5,6 @@ class DatabaseHelper {
static final _database = $FloorAppDatabase
.databaseBuilder("edc_selfservices.db").build();
static Future<void> insertTransaction(WristbandInfo wristbandInfo) async {
var db = await _database;
db.wristbandInfoDao.insertTransaction(wristbandInfo);
......
......@@ -27,7 +27,10 @@ class WristbandInfo {
String rawData;
@ColumnInfo(name: 'perso_reff')
String? persoReff;
@ColumnInfo(name: 'metode_bayar')
String? metodeBayar;
@ColumnInfo(name: 'status')
String? status;
WristbandInfo(
this.readerDate,
......@@ -41,6 +44,8 @@ class WristbandInfo {
this.bankType,
this.rawData,
this.persoReff,
this.metodeBayar,
this.status,
);
Map<String, dynamic> toJson() => {
......@@ -54,6 +59,7 @@ class WristbandInfo {
'bank_type': bankType,
'raw_data': rawData,
'perso_reff': persoReff,
'metode_bayar': metodeBayar,
'status': status,
};
}
......@@ -252,13 +252,32 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
// phone4CharValidation(subPhone);
_showQris(context);
} else {
print("ini response fail : ${infoInquiry['response']['message']}");
denom(outletName, info);
print("ini response fail : ${infoInquiry['errors'][0]['details'][0]}");
String error = infoInquiry['errors'][0]['details'][0];
if(error == "Card not found"){
AwesomeDialog(
context: context,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Maaf kartu anda tidak dapat digunakan untuk isi saldo',
desc: "Sorry, your card cannot be used to top up",
btnOkOnPress: () {
setState((){
isShowingDialog = false;
});
if (timer != null) timer?.cancel();
tapIdle();
},
btnOkIcon: Icons.error,
btnOkColor: Colors.red)
.show();
}
}
}
Future<String> topUpBalance(String approvalCode) async {
var info, infoMap, lastBalance, samReport, paymentMethod, paymentProvider;
var info, infoMap, lastBalance, samReport, paymentMethod, paymentProvider,metodeBayar,status;
info = await StartService.topupBalanceCard(cardNumber, int.parse(amount));
infoMap = jsonDecode(info);
lastBalance = infoMap['balance'].toString();
......@@ -317,16 +336,18 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
"M",
rawData,
persoReff,
'Link-Aja',
'Berhasil',
);
DatabaseHelper.insertTransaction(wristbandInfo);
print("ini pesan $wristbandInfo");
print("ini pesan tersimpan berhasil ke database$wristbandInfo");
String ticketJson, companyName, companyPhone, denom;
companyName = PreferencesHelper.getString('outletname');
companyPhone = PreferencesHelper.getString('companyphone');
companyAddress = PreferencesHelper.getString('multioutletaddress');
denom = amountController!.text.replaceAll(",", "");
String sca =
PreferencesHelper.getString("multioutletservicechargeamount");
PreferencesHelper.getString("multioutletservicechargeamount");
String sc = PreferencesHelper.getString("multioutletservicecharge");
String metodeBayar = "link-aja";
String status = "success";
......@@ -447,19 +468,69 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
btnOkOnPress: (){
setState(() {
countMax = 0 ;
}); /*disini juga ga bisa*/
});
String readerDate,
gateId,
persoReff,
kodeGate,
outletName,
versionApp,
rawData;
readerDate = DateFormat("ddMMyyyyHHmmss").format(DateTime.now());
gateId = PreferencesHelper.getString('tid');
persoReff = infoMap['regDb'];
kodeGate = PreferencesHelper.getString('tid');
outletName = PreferencesHelper.getString('outletname');
versionApp = PreferencesHelper.getString(kVersionApp);
rawData = (report == null)
? "balance|"
"$report,"
"$kodeGate,"
"$outletName,"
"$gateId,"
"$cardNumber,"
"$readerDate,"
"$amount,"
"$lastBalance,"
"$versionApp"
: "$kodeGate,"
"$outletName,"
"$gateId,"
"$cardNumber,"
"$readerDate,"
"$amount,"
"$lastBalance,"
"$versionApp";
print("proses simpan transaksi gagal wristband info");
WristbandInfo wristbandInfo = WristbandInfo(
readerDate,
int.parse(amount),
gateId,
'TOPUP',
cardNumber,
'card_topup',
lastBalance,
prevBalance!,
"M",
rawData,
persoReff,
'Link-Aja',
'Gagal',
);
DatabaseHelper.insertTransaction(wristbandInfo);
print("ini pesan tersimpan gagal ke database$wristbandInfo");
if (timer != null) timer?.cancel();
// Navigator.pop(context);
String companyName, companyPhone, denom, metodeBayar,status;
companyName = 'Rockefeller';
companyPhone = 'TOPUP - GAGAL';
companyAddress = 'st.indonesia, jakarta raya';
companyName = PreferencesHelper.getString('outletname');
companyPhone = PreferencesHelper.getString('companyphone');
companyAddress = PreferencesHelper.getString('multioutletaddress');
denom = amountController!.text.replaceAll(",", "");
metodeBayar = "link-aja";
String sca =
PreferencesHelper.getString("multioutletservicechargeamount");
String sc = PreferencesHelper.getString("multioutletservicecharge");
metodeBayar = 'Link-aja';
status = 'gagal';
StartService.print(
info,
......@@ -1394,6 +1465,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
int.parse(amountController!
.text
.replaceAll(",", "")));
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment