exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit dc691eb596b61bbf26d9b38cf245c1188f056f51
parent 9902e88b2d9dceb948275cf17b7ff62002da6fe3
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 29 Jun 2022 14:08:19 +0200

-rename, as logic is purse deposit specific

Diffstat:
Msrc/exchange/taler-exchange-httpd_common_deposit.c | 8++++----
Msrc/exchange/taler-exchange-httpd_common_deposit.h | 10+++++-----
Msrc/exchange/taler-exchange-httpd_purses_create.c | 28++++++++++++++--------------
Msrc/exchange/taler-exchange-httpd_purses_deposit.c | 24++++++++++++------------
4 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_common_deposit.c b/src/exchange/taler-exchange-httpd_common_deposit.c @@ -25,9 +25,9 @@ enum GNUNET_GenericReturnValue -TEH_common_deposit_parse_coin ( +TEH_common_purse_deposit_parse_coin ( struct MHD_Connection *connection, - struct TEH_DepositedCoin *coin, + struct TEH_PurseDepositedCoin *coin, const json_t *jcoin) { struct GNUNET_JSON_Specification spec[] = { @@ -194,7 +194,7 @@ TEH_common_deposit_parse_coin ( enum GNUNET_GenericReturnValue TEH_common_deposit_check_purse_deposit ( struct MHD_Connection *connection, - const struct TEH_DepositedCoin *coin, + const struct TEH_PurseDepositedCoin *coin, const struct TALER_PurseContractPublicKeyP *purse_pub, uint32_t min_age) { @@ -255,7 +255,7 @@ TEH_common_deposit_check_purse_deposit ( * @param[in] coin information to release */ void -TEH_common_deposit_free_coin (struct TEH_DepositedCoin *coin) +TEH_common_purse_deposit_free_coin (struct TEH_PurseDepositedCoin *coin) { TALER_denom_sig_free (&coin->cpi.denom_sig); if (! coin->cpi.no_age_commitment) diff --git a/src/exchange/taler-exchange-httpd_common_deposit.h b/src/exchange/taler-exchange-httpd_common_deposit.h @@ -32,7 +32,7 @@ /** * Information about an individual coin being deposited. */ -struct TEH_DepositedCoin +struct TEH_PurseDepositedCoin { /** * Public information about the coin. @@ -93,9 +93,9 @@ struct TEH_DepositedCoin * #GNUNET_SYSERR on failure and no error could be returned */ enum GNUNET_GenericReturnValue -TEH_common_deposit_parse_coin ( +TEH_common_purse_deposit_parse_coin ( struct MHD_Connection *connection, - struct TEH_DepositedCoin *coin, + struct TEH_PurseDepositedCoin *coin, const json_t *jcoin); @@ -113,7 +113,7 @@ TEH_common_deposit_parse_coin ( enum GNUNET_GenericReturnValue TEH_common_deposit_check_purse_deposit ( struct MHD_Connection *connection, - const struct TEH_DepositedCoin *coin, + const struct TEH_PurseDepositedCoin *coin, const struct TALER_PurseContractPublicKeyP *purse_pub, uint32_t min_age); @@ -125,6 +125,6 @@ TEH_common_deposit_check_purse_deposit ( * @param[in] coin information to release */ void -TEH_common_deposit_free_coin (struct TEH_DepositedCoin *coin); +TEH_common_purse_deposit_free_coin (struct TEH_PurseDepositedCoin *coin); #endif diff --git a/src/exchange/taler-exchange-httpd_purses_create.c b/src/exchange/taler-exchange-httpd_purses_create.c @@ -87,7 +87,7 @@ struct PurseCreateContext /** * Array of coins being deposited. */ - struct TEH_DepositedCoin *coins; + struct TEH_PurseDepositedCoin *coins; /** * Length of the @e coins array. @@ -258,7 +258,7 @@ create_transaction (void *cls, /* 2) deposit all coins */ for (unsigned int i = 0; i<pcc->num_coins; i++) { - struct TEH_DepositedCoin *coin = &pcc->coins[i]; + struct TEH_PurseDepositedCoin *coin = &pcc->coins[i]; bool balance_ok = false; bool conflict = true; @@ -430,15 +430,15 @@ create_transaction (void *cls, static enum GNUNET_GenericReturnValue parse_coin (struct MHD_Connection *connection, struct PurseCreateContext *pcc, - struct TEH_DepositedCoin *coin, + struct TEH_PurseDepositedCoin *coin, const json_t *jcoin) { enum GNUNET_GenericReturnValue iret; if (GNUNET_OK != - (iret = TEH_common_deposit_parse_coin (connection, - coin, - jcoin))) + (iret = TEH_common_purse_deposit_parse_coin (connection, + coin, + jcoin))) return iret; if (GNUNET_OK != (iret = TEH_common_deposit_check_purse_deposit ( @@ -580,11 +580,11 @@ TEH_handler_purses_create ( } /* parse deposits */ pcc.coins = GNUNET_new_array (pcc.num_coins, - struct TEH_DepositedCoin); + struct TEH_PurseDepositedCoin); json_array_foreach (deposits, idx, deposit) { enum GNUNET_GenericReturnValue res; - struct TEH_DepositedCoin *coin = &pcc.coins[idx]; + struct TEH_PurseDepositedCoin *coin = &pcc.coins[idx]; res = parse_coin (connection, &pcc, @@ -594,7 +594,7 @@ TEH_handler_purses_create ( { GNUNET_JSON_parse_free (spec); for (unsigned int i = 0; i<idx; i++) - TEH_common_deposit_free_coin (&pcc.coins[i]); + TEH_common_purse_deposit_free_coin (&pcc.coins[i]); GNUNET_free (pcc.coins); return (GNUNET_NO == res) ? MHD_YES : MHD_NO; } @@ -626,7 +626,7 @@ TEH_handler_purses_create ( TALER_LOG_WARNING ("Invalid signature on /purses/$PID/create request\n"); GNUNET_JSON_parse_free (spec); for (unsigned int i = 0; i<pcc.num_coins; i++) - TEH_common_deposit_free_coin (&pcc.coins[i]); + TEH_common_purse_deposit_free_coin (&pcc.coins[i]); GNUNET_free (pcc.coins); return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, @@ -644,7 +644,7 @@ TEH_handler_purses_create ( TALER_LOG_WARNING ("Invalid signature on /purses/$PID/create request\n"); GNUNET_JSON_parse_free (spec); for (unsigned int i = 0; i<pcc.num_coins; i++) - TEH_common_deposit_free_coin (&pcc.coins[i]); + TEH_common_purse_deposit_free_coin (&pcc.coins[i]); GNUNET_free (pcc.coins); return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, @@ -659,7 +659,7 @@ TEH_handler_purses_create ( GNUNET_break (0); GNUNET_JSON_parse_free (spec); for (unsigned int i = 0; i<pcc.num_coins; i++) - TEH_common_deposit_free_coin (&pcc.coins[i]); + TEH_common_purse_deposit_free_coin (&pcc.coins[i]); GNUNET_free (pcc.coins); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, @@ -681,7 +681,7 @@ TEH_handler_purses_create ( { GNUNET_JSON_parse_free (spec); for (unsigned int i = 0; i<pcc.num_coins; i++) - TEH_common_deposit_free_coin (&pcc.coins[i]); + TEH_common_purse_deposit_free_coin (&pcc.coins[i]); GNUNET_free (pcc.coins); return mhd_ret; } @@ -694,7 +694,7 @@ TEH_handler_purses_create ( res = reply_create_success (connection, &pcc); for (unsigned int i = 0; i<pcc.num_coins; i++) - TEH_common_deposit_free_coin (&pcc.coins[i]); + TEH_common_purse_deposit_free_coin (&pcc.coins[i]); GNUNET_free (pcc.coins); GNUNET_JSON_parse_free (spec); return res; diff --git a/src/exchange/taler-exchange-httpd_purses_deposit.c b/src/exchange/taler-exchange-httpd_purses_deposit.c @@ -73,7 +73,7 @@ struct PurseDepositContext /** * Array of coins being deposited. */ - struct TEH_DepositedCoin *coins; + struct TEH_PurseDepositedCoin *coins; /** * Length of the @e coins array. @@ -163,7 +163,7 @@ deposit_transaction (void *cls, qs = GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; for (unsigned int i = 0; i<pcc->num_coins; i++) { - struct TEH_DepositedCoin *coin = &pcc->coins[i]; + struct TEH_PurseDepositedCoin *coin = &pcc->coins[i]; bool balance_ok = false; bool conflict = true; @@ -274,15 +274,15 @@ deposit_transaction (void *cls, static enum GNUNET_GenericReturnValue parse_coin (struct MHD_Connection *connection, struct PurseDepositContext *pcc, - struct TEH_DepositedCoin *coin, + struct TEH_PurseDepositedCoin *coin, const json_t *jcoin) { enum GNUNET_GenericReturnValue iret; if (GNUNET_OK != - (iret = TEH_common_deposit_parse_coin (connection, - coin, - jcoin))) + (iret = TEH_common_purse_deposit_parse_coin (connection, + coin, + jcoin))) return iret; if (GNUNET_OK != (iret = TEH_common_deposit_check_purse_deposit ( @@ -402,11 +402,11 @@ TEH_handler_purses_deposit ( /* parse deposits */ pcc.coins = GNUNET_new_array (pcc.num_coins, - struct TEH_DepositedCoin); + struct TEH_PurseDepositedCoin); json_array_foreach (deposits, idx, deposit) { enum GNUNET_GenericReturnValue res; - struct TEH_DepositedCoin *coin = &pcc.coins[idx]; + struct TEH_PurseDepositedCoin *coin = &pcc.coins[idx]; res = parse_coin (connection, &pcc, @@ -416,7 +416,7 @@ TEH_handler_purses_deposit ( { GNUNET_JSON_parse_free (spec); for (unsigned int i = 0; i<idx; i++) - TEH_common_deposit_free_coin (&pcc.coins[i]); + TEH_common_purse_deposit_free_coin (&pcc.coins[i]); GNUNET_free (pcc.coins); return (GNUNET_NO == res) ? MHD_YES : MHD_NO; } @@ -428,7 +428,7 @@ TEH_handler_purses_deposit ( GNUNET_break (0); GNUNET_JSON_parse_free (spec); for (unsigned int i = 0; i<pcc.num_coins; i++) - TEH_common_deposit_free_coin (&pcc.coins[i]); + TEH_common_purse_deposit_free_coin (&pcc.coins[i]); GNUNET_free (pcc.coins); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, @@ -450,7 +450,7 @@ TEH_handler_purses_deposit ( { GNUNET_JSON_parse_free (spec); for (unsigned int i = 0; i<pcc.num_coins; i++) - TEH_common_deposit_free_coin (&pcc.coins[i]); + TEH_common_purse_deposit_free_coin (&pcc.coins[i]); GNUNET_free (pcc.coins); return mhd_ret; } @@ -478,7 +478,7 @@ TEH_handler_purses_deposit ( res = reply_deposit_success (connection, &pcc); for (unsigned int i = 0; i<pcc.num_coins; i++) - TEH_common_deposit_free_coin (&pcc.coins[i]); + TEH_common_purse_deposit_free_coin (&pcc.coins[i]); GNUNET_free (pcc.coins); GNUNET_JSON_parse_free (spec); return res;