Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hds
flexin
android-app
Commits
6d4b5a0c
Commit
6d4b5a0c
authored
Oct 25, 2017
by
Nastuzzi Samy
Browse files
Optimization
Move service and revalue it
parent
8fa2f1f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/fr/utc/simde/payutc/MainActivity.java
View file @
6d4b5a0c
...
...
@@ -24,6 +24,7 @@ import fr.utc.simde.payutc.tools.NemopaySession;
public
class
MainActivity
extends
NFCActivity
{
private
static
final
String
LOG_TAG
=
"_MainActivity"
;
private
static
final
String
service
=
"http://assos.utc.fr"
;
private
static
Boolean
registered
=
false
;
private
static
Dialog
dialog
;
...
...
@@ -94,7 +95,7 @@ public class MainActivity extends NFCActivity {
if
(
casConnexion
.
isConnected
())
{
try
{
casConnexion
.
addService
();
casConnexion
.
addService
(
service
);
Thread
.
sleep
(
100
);
}
catch
(
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
e
.
getMessage
());
...
...
@@ -115,7 +116,7 @@ public class MainActivity extends NFCActivity {
if
(
casConnexion
.
isServiceAdded
())
{
try
{
HTTPRequest
request
=
nemopaySession
.
loginCas
(
casConnexion
.
getTicket
(),
casConnexion
.
getS
ervice
()
);
HTTPRequest
request
=
nemopaySession
.
loginCas
(
casConnexion
.
getTicket
(),
s
ervice
);
Thread
.
sleep
(
1000
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
app/src/main/java/fr/utc/simde/payutc/tools/CASConnexion.java
View file @
6d4b5a0c
...
...
@@ -8,7 +8,6 @@ import android.util.Log;
public
class
CASConnexion
{
private
static
final
String
LOG_TAG
=
"_CASConnexion"
;
private
static
final
String
service
=
"http://localhost"
;
private
static
String
url
;
private
static
String
username
;
private
static
String
location
;
...
...
@@ -24,7 +23,7 @@ public class CASConnexion {
@Override
public
void
run
()
{
try
{
HTTPRequest
http
=
new
HTTPRequest
(
"https://api.nemopay.net/services/POSS3/getCasUrl?system_id=payutc"
);
HTTPRequest
http
=
new
HTTPRequest
(
"https://api.nemopay.net/services/POSS3/getCasUrl?system_id=payutc"
);
// Remettre le getCasUrl
http
.
post
();
url
=
http
.
getResponse
();
url
=
url
.
substring
(
1
,
url
.
length
()
-
1
);
...
...
@@ -39,7 +38,6 @@ public class CASConnexion {
public
String
getUsername
()
{
return
this
.
username
;
}
public
String
getTicket
()
{
return
this
.
ticket
;
}
public
String
getService
()
{
return
this
.
service
;
}
public
String
getUrl
()
{
return
this
.
url
;
}
...
...
@@ -63,7 +61,7 @@ public class CASConnexion {
public
Boolean
isConnected
()
{
return
!
this
.
location
.
isEmpty
();
}
public
void
addService
()
throws
Exception
{
public
void
addService
(
final
String
service
)
throws
Exception
{
this
.
ticket
=
""
;
if
(!
isConnected
())
...
...
@@ -73,7 +71,7 @@ public class CASConnexion {
throw
new
RuntimeException
(
"Elements required"
);
HTTPRequest
request
=
new
HTTPRequest
(
this
.
location
);
request
.
addPost
(
"service"
,
this
.
service
);
request
.
addPost
(
"service"
,
service
);
if
(
request
.
post
()
==
200
)
this
.
ticket
=
request
.
getResponse
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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