diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-06-21 23:52:30 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-06-21 23:52:30 +0200 |
commit | 5d3bfab13a189a5f8a94ccadf257a6a612e618dc (patch) | |
tree | 696f6b036c78044f057ea77ca7754744f7dc8dfa /src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c | |
parent | e5c81bcae0e402877fc9b6c54f91ef9ef3267b67 (diff) | |
download | merchant-5d3bfab13a189a5f8a94ccadf257a6a612e618dc.tar.gz merchant-5d3bfab13a189a5f8a94ccadf257a6a612e618dc.tar.bz2 merchant-5d3bfab13a189a5f8a94ccadf257a6a612e618dc.zip |
add missing notifications to private-get-orders long poller
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c index 70bce7ff..6db0497a 100644 --- a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c +++ b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c @@ -24,6 +24,8 @@ #include <taler/taler_signatures.h> #include <taler/taler_json_lib.h> #include "taler-merchant-httpd_private-post-orders-ID-refund.h" +#include "taler-merchant-httpd_private-get-orders.h" + /** * How often do we retry the non-trivial refund INSERT database @@ -136,7 +138,10 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh, "increase refund")) { GNUNET_break (0); - return GNUNET_DB_STATUS_HARD_ERROR; + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_REFUND_STORE_DB_ERROR, + "Could not begin DB transaction"); } rs = TMH_db->increase_refund (TMH_db->cls, hc->instance->settings.id, @@ -200,7 +205,32 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh, TMH_long_poll_resume (hc->infix, hc->instance, &refund); - + { + struct GNUNET_TIME_Absolute timestamp; + uint64_t order_serial; + enum GNUNET_DB_QueryStatus qs; + + qs = TMH_db->lookup_order_summary (TMH_db->cls, + hc->instance->settings.id, + hc->infix, + ×tamp, + &order_serial); + if (0 >= qs) + { + GNUNET_break (0); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_REFUND_DB_INCONSISTENT, + "Database inconsistent, could not trigger notifications"); + } + TMH_notify_order_change (hc->instance, + hc->infix, + true, /* paid */ + true, /* refunded */ + false, /* wired, cannot be if we could still do refunds */ + timestamp, + order_serial); + } { MHD_RESULT ret; char *taler_refund_uri; |