summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-06-04 15:21:41 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2018-06-04 15:21:41 +0200
commitcd56aaf0f90c5ef15077c87309f050e156b49b3b (patch)
tree1bb8c59903a0e463b53b30798fdea020f8208a62
parent7a7c675a07119b72664c311ed964d2e7eb3ce055 (diff)
downloadbackoffice-cd56aaf0f90c5ef15077c87309f050e156b49b3b.tar.gz
backoffice-cd56aaf0f90c5ef15077c87309f050e156b49b3b.tar.bz2
backoffice-cd56aaf0f90c5ef15077c87309f050e156b49b3b.zip
Query the backend respecting the new authorization scheme.
-rw-r--r--js/backoffice.js10
-rw-r--r--talerbackoffice/backoffice/backoffice.py15
2 files changed, 15 insertions, 10 deletions
diff --git a/js/backoffice.js b/js/backoffice.js
index 4af24dd..eeac8f3 100644
--- a/js/backoffice.js
+++ b/js/backoffice.js
@@ -162,9 +162,8 @@ var track_transfer = function(exchange, wtid, cb){
/* Fill the information bar on the top of the page with
* error messages. */
var show_error = function(response_text){
+ var msg = response_text;
- console.log("Filling info bar");
- var msg;
try{
var parse = JSON.parse(response_text);
console.log("Response was at least JSON");
@@ -178,7 +177,6 @@ var show_error = function(response_text){
} catch (e) {
console.log("Must keep raw HTML-ish response");
- msg = response_text;
}
/* msg is ready here. */
@@ -200,14 +198,13 @@ var track_order = function(order_id, cb){
var req = new XMLHttpRequest();
var url = `/track/order?` +
`order_id=${order_id}&` +
- `instance=${get_instance()}`
+ `instance=${get_instance()}`;
req.open("GET", url, true);
req.onload = function(){
if (4 == req.readyState){
if ((200 == req.status) || (202 == req.status))
cb(JSON.parse(req.responseText), req.status);
else
- console.log("Calling info bar filler");
show_error(req.responseText);
return;
}
@@ -365,8 +362,7 @@ function fill_table(refresh, data, execution_time, wtid_marker){
${entry.order_id}</a>`;
td_summary.className = "summary";
td_summary.innerHTML = entry.summary;
- td_amount.innerHTML = amount_to_string
- (entry.amount || entry.deposit_value);
+ td_amount.innerHTML = entry.amount;
td_date.innerHTML = parse_date
(entry.timestamp || execution_time);
row.appendChild(td_order_id);
diff --git a/talerbackoffice/backoffice/backoffice.py b/talerbackoffice/backoffice/backoffice.py
index 646dc64..2ce66e6 100644
--- a/talerbackoffice/backoffice/backoffice.py
+++ b/talerbackoffice/backoffice/backoffice.py
@@ -68,7 +68,10 @@ def javascript_licensing():
def history():
qs = get_query_string().decode("utf-8")
url = urljoin(BACKEND_URL, "history")
- resp = requests.get(url, params=dict(parse_qsl(qs)))
+ resp = requests.get(url,
+ params=dict(parse_qsl(qs)),
+ headers={"Authorization":
+ "ApiKey sandbox"})
if resp.status_code != 200:
return backend_error(resp)
return flask.jsonify(resp.json()), resp.status_code
@@ -78,7 +81,10 @@ def history():
def track_transfer():
qs = get_query_string().decode("utf-8")
url = urljoin(BACKEND_URL, "track/transfer")
- resp = requests.get(url, params=dict(parse_qsl(qs)))
+ resp = requests.get (url,
+ params=dict(parse_qsl(qs)),
+ headers={"Authorization":
+ "ApiKey sandbox"})
if resp.status_code != 200:
return backend_error(resp)
return flask.jsonify(resp.json()), resp.status_code
@@ -88,7 +94,10 @@ def track_transfer():
def track_order():
qs = get_query_string().decode("utf-8")
url = urljoin(BACKEND_URL, "track/transaction")
- resp = requests.get(url, params=dict(parse_qsl(qs)))
+ resp = requests.get(url,
+ params=dict(parse_qsl(qs)),
+ headers={"Authorization":
+ "ApiKey sandbox"})
if resp.status_code != 200:
return backend_error(resp)
return flask.jsonify(resp.json()), resp.status_code