commit e6d9c810c6049ef77f84f6e33ecf310b86ce0bd9
parent c70b560da01eae609664433590123ecd64d68396
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 11 Jun 2016 20:08:27 +0200
handle HTTP_ACCEPTED case properly
Diffstat:
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_track-transaction.c b/src/backend/taler-merchant-httpd_track-transaction.c
@@ -427,6 +427,21 @@ wtid_cb (void *cls,
struct TrackTransactionContext *tctx = tcc->tctx;
tcc->dwh = NULL;
+ if (MHD_HTTP_OK != http_status)
+ {
+ /* Transaction not resolved for one of the coins, report error!
+ We keep the status code for #MHD_HTTP_ACCEPTED, but box all the
+ others (as #MHD_HTTP_ACCEPTED is not an error). */
+ resume_track_transaction_with_response
+ (tcc->tctx,
+ (MHD_HTTP_ACCEPTED == http_status)
+ ? MHD_HTTP_ACCEPTED
+ : MHD_HTTP_FAILED_DEPENDENCY,
+ TMH_RESPONSE_make_json_pack ("{s:I, s:O}",
+ "exchange_status", (json_int_t) http_status,
+ "details", json));
+ return;
+ }
tctx->current_wtid = *wtid;
if (GNUNET_YES ==
@@ -442,9 +457,9 @@ wtid_cb (void *cls,
(or our DB is internally inconsistent.) */
}
tctx->wdh = TALER_EXCHANGE_track_transfer (tctx->eh,
- wtid,
- &wire_deposits_cb,
- tctx);
+ wtid,
+ &wire_deposits_cb,
+ tctx);
}
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
@@ -2043,6 +2043,13 @@ run (void *cls)
.details.pay.amount_with_fee = "EUR:5",
.details.pay.amount_without_fee = "EUR:4.99" },
+ /* Check "failure" to trace transaction to WTID before aggregator */
+ { .oc = OC_TRACK_TRANSACTION,
+ .label = "track-transaction-2-found",
+ .expected_response_code = MHD_HTTP_ACCEPTED,
+ .details.track_transaction.pay_ref = "deposit-simple-2"
+ },
+
/* Run transfers. */
{ .oc = OC_RUN_AGGREGATOR,
.label = "run-aggregator-2" },
@@ -2076,6 +2083,7 @@ run (void *cls)
.details.track_transfer.expected_pay_ref = "deposit-simple-2"
},
+
/* end of testcase */
{ .oc = OC_END }
};