summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-08-03 12:55:11 +0200
committerChristian Grothoff <christian@grothoff.org>2020-08-03 12:55:11 +0200
commit9b053802d49703fc1918c3621095e369beaaf604 (patch)
tree9e217c20beff49386459a67f70b462bd6932ed3a /src/backend
parent9776c13c24d52521ef46eac35fb4ad73b3d86260 (diff)
downloadmerchant-9b053802d49703fc1918c3621095e369beaaf604.tar.gz
merchant-9b053802d49703fc1918c3621095e369beaaf604.tar.bz2
merchant-9b053802d49703fc1918c3621095e369beaaf604.zip
test for refund available
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-httpd_get-orders-ID.c18
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders-ID.c4
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders.c4
3 files changed, 21 insertions, 5 deletions
diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c b/src/backend/taler-merchant-httpd_get-orders-ID.c
index d587745c..fb189d37 100644
--- a/src/backend/taler-merchant-httpd_get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_get-orders-ID.c
@@ -238,6 +238,12 @@ struct GetOrderData
bool refunded;
/**
+ * Set to true if a refund is still available for the
+ * wallet for this payment.
+ */
+ bool refund_available;
+
+ /**
* Set to true if the client requested HTML, otherwise
* we generate JSON.
*/
@@ -682,6 +688,7 @@ exchange_found_cb (void *cls,
* @param rtransaction_id identificator of the refund
* @param reason human-readable explanation of the refund
* @param refund_amount refund amount which is being taken from @a coin_pub
+ * @param pending true if the this refund was not yet processed by the wallet/exchange
*/
static void
process_refunds_cb (void *cls,
@@ -691,7 +698,8 @@ process_refunds_cb (void *cls,
const char *exchange_url,
uint64_t rtransaction_id,
const char *reason,
- const struct TALER_Amount *refund_amount)
+ const struct TALER_Amount *refund_amount,
+ bool pending)
{
struct GetOrderData *god = cls;
struct CoinRefund *cr;
@@ -722,6 +730,7 @@ process_refunds_cb (void *cls,
}
god->refund_amount = *refund_amount;
god->refunded = true;
+ god->refund_available |= pending;
}
@@ -1307,7 +1316,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
{
enum GNUNET_GenericReturnValue res;
- if (god->refunded) // FIXME: don't check for refunded, but for PENDING refund!
+ if (god->refund_available)
{
char *qr;
char *uri;
@@ -1320,7 +1329,10 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
{
GNUNET_break (0);
GNUNET_free (uri);
- return MHD_NO; // FIXME: add nicer error reply...
+ return TALER_MHD_reply_with_error (god->sc.con,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_ALLOCATION_FAILURE,
+ "during QR code generation");
}
{
struct KVC kvc[] = {
diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
index 7fdeeed6..7823837f 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -628,6 +628,7 @@ gorc_cleanup (void *cls)
* @param reason human-readable explanation of the refund
* @param timestamp when was the refund made
* @param refund_amount refund amount which is being taken from @a coin_pub
+ * @param pending true if the this refund was not yet processed by the wallet/exchange
*/
static void
process_refunds_cb (void *cls,
@@ -637,7 +638,8 @@ process_refunds_cb (void *cls,
const char *exchange_url,
uint64_t rtransaction_id,
const char *reason,
- const struct TALER_Amount *refund_amount)
+ const struct TALER_Amount *refund_amount,
+ bool pending)
{
struct GetOrderRequestContext *gorc = cls;
diff --git a/src/backend/taler-merchant-httpd_private-get-orders.c b/src/backend/taler-merchant-httpd_private-get-orders.c
index dc4901c3..41f5be48 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders.c
@@ -222,6 +222,7 @@ cleanup (void *ctx)
* @param reason human-readable explanation of the refund
* @param timestamp when was the refund made
* @param refund_amount refund amount which is being taken from @a coin_pub
+ * @param pending true if the this refund was not yet processed by the wallet/exchange
*/
static void
process_refunds_cb (void *cls,
@@ -231,7 +232,8 @@ process_refunds_cb (void *cls,
const char *exchange_url,
uint64_t rtransaction_id,
const char *reason,
- const struct TALER_Amount *refund_amount)
+ const struct TALER_Amount *refund_amount,
+ bool pending)
{
struct TALER_Amount *total_refund_amount = cls;