Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Dolan SelfService Topup
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Faizol
Dolan SelfService Topup
Commits
109adcce
Commit
109adcce
authored
Jun 09, 2023
by
Izol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing errror code #!
parent
28446cca
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
117 additions
and
126 deletions
+117
-126
jarRepositories.xml
android/.idea/jarRepositories.xml
+5
-5
MainActivity.kt
...rc/main/kotlin/com/example/self_service_3/MainActivity.kt
+6
-6
local.properties
android/local.properties
+2
-2
home_page.dart
lib/ui/pages/home_page.dart
+104
-113
No files found.
android/.idea/jarRepositories.xml
View file @
109adcce
...
...
@@ -31,15 +31,15 @@
<option
name=
"name"
value=
"maven2"
/>
<option
name=
"url"
value=
"https://jitpack.io"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"maven"
/>
<option
name=
"name"
value=
"maven"
/>
<option
name=
"url"
value=
"https://mobile-repo.mdd.co.id/artifactory/android-library/"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"maven3"
/>
<option
name=
"name"
value=
"maven3"
/>
<option
name=
"url"
value=
"https://plugins.gradle.org/m2/"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"maven"
/>
<option
name=
"name"
value=
"maven"
/>
<option
name=
"url"
value=
"https://mobile-repo.mdd.co.id:8081/artifactory/android-library/"
/>
</remote-repository>
</component>
</project>
\ No newline at end of file
android/app/src/main/kotlin/com/example/self_service_3/MainActivity.kt
View file @
109adcce
...
...
@@ -179,14 +179,14 @@ class MainActivity : MethodChannel.MethodCallHandler, FlutterActivity(), MifareT
}
override
fun
onErrorOperation
(
reason
:
String
?,
errorCode
:
String
)
{
Log
.
d
(
"onErrorOperation"
,
reason
.
toString
())
val
errorMessage
=
"$error: $reason"
Log
.
d
(
"onErrorOperation"
,
errorMessage
)
Log
.
d
(
"ini pesan errorCode"
,
errorCode
)
if
(
errorCode
==
"103F"
)
{
result
?.
success
(
reason
)
}
else
if
(
errorCode
==
"0005"
)
{
result
?.
success
(
reason
)
if
(
errorCode
==
"103F"
||
errorCode
==
"0005"
)
{
result
?.
success
(
errorMessage
)
}
else
{
result
?.
success
(
reason
)
result
?.
success
(
errorMessage
)
}
}
...
...
android/local.properties
View file @
109adcce
sdk.dir
=
/Users/macbookpro/Library/Android/sdk
flutter.sdk
=
/Users/macbookpro/Developer/flutter
flutter.buildMode
=
debug
flutter.versionName
=
SS.21.WWW
flutter.versionCode
=
14
\ No newline at end of file
flutter.versionName
=
1.0.0
flutter.versionCode
=
1
\ No newline at end of file
lib/ui/pages/home_page.dart
View file @
109adcce
...
...
@@ -97,6 +97,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
bool
isPaymentProcessed
=
false
;
double
_targetDuration
=
3
;
// Durasi yang dituju (dalam detik)
double
_maxDurationPage
=
3
;
// Durasi maksimum (dalam detik)
bool
isPaymentSuccessful
=
false
;
String
latestTransaction
=
""
;
late
Timer
timerPageHome
;
var
infoCard
,
...
...
@@ -456,6 +458,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
paymentNotes
,
metodeBayar
,
status
;
isPaymentSuccessful
=
false
;
info
=
await
StartService
.
topupBalanceCard
(
cardNumber
,
int
.
parse
(
amount
));
if
(
info
==
null
)
{
...
...
@@ -491,6 +494,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
paymentMethod
,
paymentProvider
,
paymentNotes
);
countMax
=
0
;
checkCountZero
=
false
;
timer
?.
cancel
();
isShowingDialog
=
true
;
dataQris
=
null
;
print
(
'topUpConfirm result:
$result
'
);
String
readerDate
,
...
...
@@ -585,6 +595,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
checkCountZero
=
false
;
timer
?.
cancel
();
isShowingDialog
=
true
;
_showTap
();
tapDial
();
});
...
...
@@ -602,6 +613,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
status
,
);
isHitApi
=
false
;
dataQris
=
null
;
}
else
{
print
(
'topup gagal'
);
isShowingDialog
=
true
;
...
...
@@ -628,12 +640,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
.
toString
()
.
toLowerCase
()
.
contains
(
'settlement'
))
{
Navigator
.
pop
(
context
);
//TODO: getcard
tapBalance
();
showPop
(
approvalCode
);
dataQris
=
null
;
result
=
true
;
isPaymentSuccessful
=
true
;
}
else
{
result
=
false
;
if
(!
isBackgroundServices
)
{
...
...
@@ -1054,117 +1062,95 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Future
.
delayed
(
const
Duration
(
milliseconds:
500
),
()
async
{
// await StartService.initLibrary();
var
isTap
=
await
StartService
.
getCard
();
try
{
var
infoMap
=
jsonDecode
(
isTap
);
_getInfoBeforeTopup
(
isTap
);
}
catch
(
e
)
{
String
errorMessage
=
""
;
String
dialogTitle
=
"Coba Lagi!"
;
String
dialogDesc
=
"Try Again!"
;
if
(
isTap
==
"Card Not Found"
)
{
print
(
"Card Not Found"
);
await
StartService
.
initLibrary
();
AwesomeDialog
(
context:
context
,
dialogType:
DialogType
.
info
,
animType:
AnimType
.
rightSlide
,
dismissOnTouchOutside:
false
,
headerAnimationLoop:
true
,
title:
'Pastikan Wristband Anda Tertempel Di Reader!'
,
titleTextStyle:
blackTextStyle
.
copyWith
(
fontSize:
20
,
fontWeight:
bold
,
),
desc:
"Make sure your wristband is attached to the reader!"
,
descTextStyle:
greyTextStyle
.
copyWith
(
fontSize:
18
,
fontWeight:
light
,
),
btnOkOnPress:
()
{
countMax
=
0
;
tapBalance
();
},
btnOkColor:
Colors
.
blue
,
).
show
();
}
else
if
(
isTap
==
"Error Get Card Type"
){
print
(
"Error Get Card Type"
);
await
StartService
.
initLibrary
();
AwesomeDialog
(
context:
context
,
dialogType:
DialogType
.
info
,
animType:
AnimType
.
rightSlide
,
dismissOnTouchOutside:
false
,
headerAnimationLoop:
true
,
title:
'Coba Lagi!'
,
titleTextStyle:
blackTextStyle
.
copyWith
(
fontSize:
20
,
fontWeight:
bold
,
),
desc:
"Try Again!"
,
descTextStyle:
greyTextStyle
.
copyWith
(
fontSize:
18
,
fontWeight:
light
,
),
btnOkOnPress:
()
{
countMax
=
0
;
tapBalance
();
},
btnOkColor:
Colors
.
blue
,
).
show
();
}
else
if
(
isTap
==
"CardInfoError: 5001"
){
print
(
"CardInfoError: 5001"
);
await
StartService
.
initLibrary
();
AwesomeDialog
(
context:
context
,
dialogType:
DialogType
.
info
,
animType:
AnimType
.
rightSlide
,
dismissOnTouchOutside:
false
,
headerAnimationLoop:
true
,
title:
'Coba Lagi!'
,
titleTextStyle:
blackTextStyle
.
copyWith
(
fontSize:
20
,
fontWeight:
bold
,
),
desc:
"Try Again!"
,
descTextStyle:
greyTextStyle
.
copyWith
(
fontSize:
18
,
fontWeight:
light
,
),
btnOkOnPress:
()
{
countMax
=
0
;
tapBalance
();
},
btnOkColor:
Colors
.
blue
,
).
show
();
}
else
if
(
isTap
==
"Get TicketList Error 5001"
){
print
(
"Get TicketList Error 5001"
);
await
StartService
.
initLibrary
();
AwesomeDialog
(
context:
context
,
dialogType:
DialogType
.
info
,
animType:
AnimType
.
rightSlide
,
dismissOnTouchOutside:
false
,
headerAnimationLoop:
true
,
title:
'Coba Lagi!'
,
titleTextStyle:
blackTextStyle
.
copyWith
(
fontSize:
20
,
fontWeight:
bold
,
),
desc:
"Try Again!"
,
descTextStyle:
greyTextStyle
.
copyWith
(
fontSize:
18
,
fontWeight:
light
,
),
btnOkOnPress:
()
{
countMax
=
0
;
tapBalance
();
},
btnOkColor:
Colors
.
blue
,
).
show
();
}
else
{
print
(
"Error
$isTap
"
);
errorMessage
=
"Card Not Found"
;
dialogTitle
=
"Pastikan Wristband Anda Tertempel Di Reader!"
;
dialogDesc
=
"Make sure your wristband is attached to the reader!"
;
}
else
if
(
isTap
==
"Error Get Card Type"
)
{
errorMessage
=
"Error Get Card Type"
;
}
else
if
(
isTap
==
"CardInfoError: 5001"
)
{
errorMessage
=
"CardInfoError: 5001"
;
}
else
if
(
isTap
==
"ERROR_INVALID_CARD(0x0005)"
)
{
errorMessage
=
"Error Invalid Card"
;
}
else
if
(
isTap
==
"ERROR_GET_TICKET_QUOTA(0x0204)"
)
{
errorMessage
=
"Error Get Ticket Quota"
;
}
else
{
errorMessage
=
"Error
$isTap
"
;
}
print
(
errorMessage
);
await
StartService
.
initLibrary
();
AwesomeDialog
(
context:
context
,
dialogType:
DialogType
.
info
,
animType:
AnimType
.
rightSlide
,
dismissOnTouchOutside:
false
,
headerAnimationLoop:
true
,
title:
dialogTitle
,
titleTextStyle:
blackTextStyle
.
copyWith
(
fontSize:
20
,
fontWeight:
bold
,
),
desc:
dialogDesc
,
descTextStyle:
greyTextStyle
.
copyWith
(
fontSize:
18
,
fontWeight:
light
,
),
btnOkOnPress:
()
{
countMax
=
0
;
tapBalance
();
},
btnOkColor:
Colors
.
blue
,
).
show
();
}
});
}
// ERROR_GET_TICKET_LIST(0x0203),!
// ERROR_CARD_INFO(0x0202),!
// ERROR_GET_CARD_TYPE(0x0207), !
//
// NO_ERROR(0x0000),
// ERROR_INVALID_CARD(0x0005),
// ERROR_GET_TICKET_QUOTA(0x0204),
// ERROR_GET_REG_DB(0x0205),
// ERROR_POST_PERSO(0x0206),
// ERROR_TOPUP_TICKET(0x0208),
// ERROR_TOPUP_BALANCE(0x0209),
// ERROR_REDEEM_TICKET(0x020A),
// ERROR_DEDUCT_BALANCE(0x020B),
// ERROR_REFUND_CARD(0x020C),
// ERROR_REFUND_DEPOSIT_BALANCE_CARD(0x020D),
// ERROR_MULTIBINDING(0x020E),
// ERROR_HOST_VALIDATION_FAILED(0x0401),
// ERROR_CARD_NOT_FOUND(0xFFD0),
// ERROR_UNKNOWN(0xFFFF),
//
// ERROR_INSUFFICIENT_FUND(0x1003),
// ERROR_INSUFFICIENT_FUND1(0x100B),
// ERROR_CARD_EXPIRED(0x100F),
// ERROR_TICKET_NOT_FOUND(0x1010),
// ERROR_TICKET_EXPIRED(0x1011),
// ERROR_HOST_VALIDATION(0x1012),
// ERROR_DAILY_VALIDATION(0x1013),
// ERROR_CRC_ERROR(0x1027),
//
// ERROR_MIFARE_AUTH(0x5001),
// ERROR_WRONG_CARD_TYPE(0x5002),
// ERROR_MIFARE_READ(0x5005),
// ERROR_MIFARE_WRITE(0x5006),
// ERROR_BROKEN_CARD(0x5009),
// ERROR_MIFARE_SUSPECT_EXP_DATE(0x5009),
Future
<
void
>
_showTap
()
{
return
showDialog
<
void
>(
...
...
@@ -2067,7 +2053,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
SizedBox
(
height:
5
,
),
// Container Button Batalakan, Saya Sudah Bayar Dan TimeOut
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
...
...
@@ -2079,10 +2064,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
setState
(()
=>
isProcessCheck
=
true
);
try
{
bool
result
=
await
_cekStatus
();
setState
((){
if
(
result
)
{
print
(
"pembayaran berhasil dilakukan"
);
Navigator
.
pop
(
context
);
//TODO: getcard
tapBalance
();
showPop
(
approvalCode
);
dataQris
=
null
;
}
else
{
AwesomeDialog
(
context:
context
,
...
...
@@ -2104,7 +2092,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
tapDial
();
});
}
});
}
catch
(
e
)
{
print
(
"Error:
$e
"
);
setState
(()
=>
isProcessCheck
=
false
);
...
...
@@ -2162,15 +2149,18 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
// Button Saya sudah Bayar di Showqris
TextButton
(
onPressed:
()
async
{
if
(
isProcessCheck
)
return
;
// Tambahkan pengecekan jika proses sedang berjalan
if
(
isProcessCheck
)
return
;
setState
(()
=>
isProcessCheck
=
true
);
try
{
bool
result
=
await
_cekStatus
();
setState
(()
{
if
(
result
)
{
if
(
result
&&
isPaymentSuccessful
)
{
print
(
"pembayaran berhasil dilakukan"
);
isPaymentSuccessful
=
true
;
Navigator
.
pop
(
context
);
//TODO: getcard
tapBalance
();
showPop
(
approvalCode
);
dataQris
=
null
;
}
else
{
AwesomeDialog
(
context:
context
,
...
...
@@ -2186,10 +2176,11 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
setState
(()
=>
isProcessCheck
=
false
);
});
}
});
}
catch
(
e
)
{
print
(
"Error:
$e
"
);
setState
(()
=>
isProcessCheck
=
false
);
}
finally
{
setState
(()
=>
isProcessCheck
=
false
);
}
},
child:
(
isProcessCheck
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment