taler-mdb

GNU Taler Extensions and Integrations
Log | Files | Refs | Submodules | README | LICENSE

commit a394d000417cbcea29f66ae686ad57692fa48c63
parent 445d48e8010e427d19416ad9c146fe284c512037
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Thu,  7 Sep 2023 14:19:29 +0200

Merge branch 'master' of git+ssh://git.taler.net/taler-mdb

Diffstat:
Msrc/taler-coin-acceptor.c | 92++++++++++++++++++++++++++++++++++++++-----------------------------------------
Msrc/taler-mdb.c | 7++++++-
2 files changed, 50 insertions(+), 49 deletions(-)

diff --git a/src/taler-coin-acceptor.c b/src/taler-coin-acceptor.c @@ -83,14 +83,14 @@ static struct GNUNET_CURL_Context *ctx; static struct GNUNET_CURL_RescheduleContext *rc; /** - * Handle used to issue the tip. + * Handle used to issue the reward. */ -static struct TALER_MERCHANT_TipAuthorizeHandle *tah; +static struct TALER_MERCHANT_RewardAuthorizeHandle *tah; /** - * Handle to watch for tip being picked up. + * Handle to watch for reward being picked up. */ -static struct TALER_MERCHANT_TipMerchantGetHandle *tmgh; +static struct TALER_MERCHANT_RewardMerchantGetHandle *tmgh; /** * Current sum. @@ -98,9 +98,9 @@ static struct TALER_MERCHANT_TipMerchantGetHandle *tmgh; static struct TALER_Amount sum; /** - * Tip ID of the currently active tip. + * Reward ID of the currently active reward. */ -static struct TALER_TipIdentifierP tip_id; +static struct TALER_RewardIdentifierP reward_id; /** * Function run on shutdown. @@ -141,12 +141,12 @@ do_shutdown (void *cls) } if (NULL != tah) { - TALER_MERCHANT_tip_authorize_cancel (tah); + TALER_MERCHANT_reward_authorize_cancel (tah); tah = NULL; } if (NULL != tmgh) { - TALER_MERCHANT_merchant_tip_get_cancel (tmgh); + TALER_MERCHANT_merchant_reward_get_cancel (tmgh); tmgh = NULL; } if (GNUNET_OK == @@ -163,7 +163,7 @@ do_shutdown (void *cls) /** - * With result of a GET /private/tips/$TIP_ID request + * With result of a GET /private/rewards/$REWARD_ID request * * @param cls closure * @param tsr response details @@ -171,7 +171,7 @@ do_shutdown (void *cls) static void pickup_cb ( void *cls, - const struct TALER_MERCHANT_TipStatusResponse *tsr) + const struct TALER_MERCHANT_RewardStatusResponse *tsr) { tmgh = NULL; switch (tsr->hr.http_status) @@ -189,14 +189,14 @@ pickup_cb ( return; } /* Keep checking */ - tmgh = TALER_MERCHANT_merchant_tip_get (ctx, - merchant_url, - &tip_id, - NULL, - GNUNET_TIME_UNIT_ZERO, - false, - &pickup_cb, - NULL); + tmgh = TALER_MERCHANT_merchant_reward_get (ctx, + merchant_url, + &reward_id, + NULL, + GNUNET_TIME_UNIT_ZERO, + false, + &pickup_cb, + NULL); GNUNET_assert (NULL != tmgh); return; default: @@ -206,23 +206,19 @@ pickup_cb ( /** - * Callback for a /reserves/$RESERVE_PUB/tip-authorize request. Returns the result of + * Callback for a /reserves/$RESERVE_PUB/reward-authorize request. Returns the result of * the operation. * * @param cls closure, NULL - * @param hr HTTP response details - * @param tip_idp which tip ID should be used to pickup the tip - * @param tip_uri URI for the tip - * @param tip_expiration when does the tip expire + * @param tar response details */ static void authorize_cb ( void *cls, - const struct TALER_MERCHANT_HttpResponse *hr, - struct TALER_TipIdentifierP *tip_idp, - const char *tip_uri, - struct GNUNET_TIME_Timestamp tip_expiration) + const struct TALER_MERCHANT_RewardAuthorizeResponse *tar) { + const struct TALER_MERCHANT_HttpResponse *hr = &tar->hr; + (void) cls; tah = NULL; switch (hr->http_status) @@ -234,20 +230,20 @@ authorize_cb ( return; } - // FIXME: show tip_uri on display! + // FIXME: show reward_uri on display! GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Tip pickup uri: %s\n", - tip_uri); + "Reward pickup uri: %s\n", + tar->details.ok.reward_uri); /* FIXME: merchant service to support long-polling here! */ - tip_id = *tip_idp; - tmgh = TALER_MERCHANT_merchant_tip_get (ctx, - merchant_url, - &tip_id, - NULL, - GNUNET_TIME_UNIT_ZERO, - false, - &pickup_cb, - NULL); + reward_id = tar->details.ok.reward_id; + tmgh = TALER_MERCHANT_merchant_reward_get (ctx, + merchant_url, + &tar->details.ok.reward_id, + NULL, + GNUNET_TIME_UNIT_ZERO, + false, + &pickup_cb, + NULL); GNUNET_assert (NULL != tmgh); } @@ -296,18 +292,18 @@ do_read (void *cls) value)); if (NULL != tah) { - TALER_MERCHANT_tip_authorize_cancel (tah); + TALER_MERCHANT_reward_authorize_cancel (tah); tah = NULL; } /* FIXME: handle case where we INCREASE an - existing tip! (needs new backend API!) */ - tah = TALER_MERCHANT_tip_authorize (ctx, - merchant_url, - "taler://FIXME", - &sum, - "coin acceptor", - &authorize_cb, - NULL); + existing reward! (needs new backend API!) */ + tah = TALER_MERCHANT_reward_authorize (ctx, + merchant_url, + "taler://FIXME", + &sum, + "coin acceptor", + &authorize_cb, + NULL); } } tt = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, diff --git a/src/taler-mdb.c b/src/taler-mdb.c @@ -895,6 +895,10 @@ show_qrcode (const char *uri) } /* set QR-code border */ + memset (qrDisplay.memory, + 0xFF, + qrDisplay.var_info.xres * qrDisplay.var_info.yres + * sizeof (uint16_t)); size = GNUNET_MIN (qrDisplay.var_info.xres, qrDisplay.var_info.yres); unsigned int nwidth = qrc->width + 8; /* +8 for 4 pixel border */ @@ -1653,6 +1657,7 @@ start_read_cancel_button (void); static struct PaymentActivity * launch_payment (struct Product *product) { + static const char *uuids[1]; struct PaymentActivity *pa; json_t *orderReq; char *msg; @@ -1767,7 +1772,7 @@ launch_payment (struct Product *product) 0, NULL, /* no inventory */ 0, - NULL, /* no locks */ + uuids, /* no locks */ false, /* no claim token */ &proposal_cb, pa);