Skip to content
GitLab
Menu
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
78a434e0
Commit
78a434e0
authored
Dec 30, 2017
by
Nastuzzi Samy
Browse files
Cancel fix
parent
22ff6701
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/fr/utc/simde/jessy/BuyerInfoActivity.java
View file @
78a434e0
...
...
@@ -135,90 +135,110 @@ public class BuyerInfoActivity extends BaseActivity {
.
setCancelable
(
true
)
.
setPositiveButton
(
R
.
string
.
cancel
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
new
Thread
()
{
hasRights
(
getString
(
R
.
string
.
cancel_transaction
),
new
String
[]{
"GESSALES"
},
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
hasRights
(
getString
(
R
.
string
.
configurate
),
new
String
[]{
"GESSALES"
},
new
Runnable
()
{
@Override
public
void
run
()
{
new
Thread
()
{
@Override
public
void
run
()
{
try
{
nemopaySession
.
cancelTransaction
(
article
.
get
(
"fundation_id"
).
intValue
(),
article
.
get
(
"purchase_id"
).
intValue
(),
true
);
Thread
.
sleep
(
100
);
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
try
{
nemopaySession
.
cancelTransaction
(
article
.
get
(
"fundation_id"
).
intValue
(),
article
.
get
(
"purchase_id"
).
intValue
(),
true
);
}
catch
(
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
final
JsonNode
response
=
nemopaySession
.
getRequest
().
getJSONResponse
();
if
(
response
.
has
(
"error"
)
&&
response
.
get
(
"error"
).
has
(
"message"
))
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
BuyerInfoActivity
.
this
,
getString
(
R
.
string
.
cancel_transaction
),
response
.
get
(
"error"
).
get
(
"message"
).
textValue
());
}
});
}
else
throw
new
Exception
(
""
);
}
catch
(
Exception
e1
)
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
BuyerInfoActivity
.
this
,
getString
(
R
.
string
.
cancel_transaction
),
e
.
getMessage
());
}
});
}
}
},
new
Runnable
()
{
@Override
public
void
run
()
{
}
}.
start
();
}
},
new
Runnable
()
{
@Override
public
void
run
()
{
new
Thread
()
{
@Override
public
void
run
()
{
try
{
nemopaySession
.
cancelTransaction
(
article
.
get
(
"fundation_id"
).
intValue
(),
article
.
get
(
"purchase_id"
).
intValue
(),
false
);
Thread
.
sleep
(
100
);
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
try
{
nemopaySession
.
cancelTransaction
(
article
.
get
(
"fundation_id"
).
intValue
(),
article
.
get
(
"purchase_id"
).
intValue
(),
false
);
}
catch
(
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
}
}
});
Thread
.
sleep
(
100
);
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
final
AlertDialog
.
Builder
alertDialogBuilder
=
new
AlertDialog
.
Builder
(
BuyerInfoActivity
.
this
);
alertDialogBuilder
.
setTitle
(
R
.
string
.
cancel_transaction
)
.
setMessage
(
getString
(
R
.
string
.
transaction_canceled
))
.
setCancelable
(
true
)
.
setPositiveButton
(
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
try
{
startBuyerInfoActivity
(
BuyerInfoActivity
.
this
,
badgeId
);
}
catch
(
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
dialog
.
errorDialog
(
BuyerInfoActivity
.
this
,
getResources
().
getString
(
R
.
string
.
information_collection
),
getResources
().
getString
(
R
.
string
.
error_view
),
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
finish
();
}
});
}
final
JsonNode
response
=
nemopaySession
.
getRequest
().
getJSONResponse
();
if
(
response
.
has
(
"error"
)
&&
response
.
get
(
"error"
).
has
(
"message"
))
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
BuyerInfoActivity
.
this
,
getString
(
R
.
string
.
cancel_transaction
),
response
.
get
(
"error"
).
get
(
"message"
).
textValue
());
}
});
dialog
.
createDialog
(
alertDialogBuilder
);
}
else
throw
new
Exception
(
""
);
}
catch
(
Exception
e1
)
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
BuyerInfoActivity
.
this
,
getString
(
R
.
string
.
cancel_transaction
),
e
.
getMessage
());
}
});
}
}
});
}
catch
(
final
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
try
{
final
JsonNode
response
=
nemopaySession
.
getRequest
().
getJSONResponse
();
if
(
response
.
has
(
"error"
)
&&
response
.
get
(
"error"
).
has
(
"message"
))
{
runOnUiThread
(
new
Runnable
()
{
}
}.
start
();
}
});
dialog
.
stopLoading
();
final
AlertDialog
.
Builder
alertDialogBuilder
=
new
AlertDialog
.
Builder
(
BuyerInfoActivity
.
this
);
alertDialogBuilder
.
setTitle
(
R
.
string
.
cancel_transaction
)
.
setMessage
(
getString
(
R
.
string
.
transaction_canceled
))
.
setCancelable
(
true
)
.
setPositiveButton
(
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
try
{
startBuyerInfoActivity
(
BuyerInfoActivity
.
this
,
badgeId
);
}
catch
(
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"error: "
+
e
.
getMessage
());
dialog
.
errorDialog
(
BuyerInfoActivity
.
this
,
getResources
().
getString
(
R
.
string
.
information_collection
),
getResources
().
getString
(
R
.
string
.
error_view
),
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
BuyerInfoActivity
.
this
,
getString
(
R
.
string
.
cancel_transaction
),
response
.
get
(
"error"
).
get
(
"message"
).
textValue
());
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
finish
();
}
});
}
else
throw
new
Exception
(
""
);
}
catch
(
Exception
e1
)
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dialog
.
stopLoading
();
dialog
.
errorDialog
(
BuyerInfoActivity
.
this
,
getString
(
R
.
string
.
cancel_transaction
),
e
.
getMessage
());
}
});
}
}
}
}
}.
start
(
);
}
);
dialog
.
createDialog
(
alertDialogBuilder
);
}
})
.
setNegativeButton
(
R
.
string
.
do_nothing
,
null
);
...
...
app/src/main/java/fr/utc/simde/jessy/tools/NemopaySession.java
View file @
78a434e0
...
...
@@ -223,27 +223,27 @@ public class NemopaySession {
if
(
hasSalesRights
)
return
request
(
"
POSS3
"
,
"cancel"
,
"
GESSALES
"
,
"cancel
TransactionRow
"
,
new
HashMap
<
String
,
Object
>()
{{
put
(
"fun_id"
,
foundationId
);
put
(
"
pur_
id"
,
purchaseId
);
put
(
"id"
,
purchaseId
);
}},
new
String
[]{
"POSS3"
"POSS3"
,
"GESSALES"
}
);
else
return
request
(
"
GESSALES
"
,
"cancel
TransactionRow
"
,
"
POSS3
"
,
"cancel"
,
new
HashMap
<
String
,
Object
>()
{{
put
(
"fun_id"
,
foundationId
);
put
(
"pur_id"
,
purchaseId
);
}},
new
String
[]{
"POSS3"
,
"GESSALES"
"POSS3"
}
);
}
...
...
Write
Preview
Supports
Markdown
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