diff options
| author | Christian Grothoff <christian@grothoff.org> | 2020-01-18 23:49:37 +0100 | 
|---|---|---|
| committer | Christian Grothoff <christian@grothoff.org> | 2020-01-18 23:49:37 +0100 | 
| commit | db669ee495a29384c6d592cb1080db58e832a649 (patch) | |
| tree | 0bbc1a119098467eb731cd53c59d9df4dba079d7 /src/lib | |
| parent | 6e17a847e8267ae10beaa8fc849bf10517088ab2 (diff) | |
payback -> recoup stranglers
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/Makefile.am | 4 | ||||
| -rw-r--r-- | src/lib/exchange_api_common.c | 10 | ||||
| -rw-r--r-- | src/lib/exchange_api_recoup.c (renamed from src/lib/exchange_api_payback.c) | 142 | ||||
| -rw-r--r-- | src/lib/exchange_api_reserve.c | 34 | ||||
| -rw-r--r-- | src/lib/test_auditor_api.c | 54 | ||||
| -rw-r--r-- | src/lib/test_exchange_api.c | 108 | ||||
| -rw-r--r-- | src/lib/test_exchange_api_revocation.c | 56 | ||||
| -rw-r--r-- | src/lib/testing_api_cmd_recoup.c (renamed from src/lib/testing_api_cmd_payback.c) | 84 | ||||
| -rw-r--r-- | src/lib/testing_api_cmd_refresh.c | 2 | 
9 files changed, 247 insertions, 247 deletions
| diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 9a12d25b..07761675 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -24,7 +24,7 @@ libtalerexchange_la_SOURCES = \    exchange_api_common.c \    exchange_api_handle.c exchange_api_handle.h \    exchange_api_deposit.c \ -  exchange_api_payback.c \ +  exchange_api_recoup.c \    exchange_api_refresh.c \    exchange_api_refresh_link.c \    exchange_api_refund.c \ @@ -87,7 +87,7 @@ libtalertesting_la_SOURCES = \    testing_api_cmd_exec_wirewatch.c \    testing_api_cmd_exec_keyup.c \    testing_api_cmd_exec_auditor-sign.c \ -  testing_api_cmd_payback.c \ +  testing_api_cmd_recoup.c \    testing_api_cmd_refund.c \    testing_api_cmd_refresh.c \    testing_api_cmd_serialize_keys.c \ diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c index 556ca204..ae02b3db 100644 --- a/src/lib/exchange_api_common.c +++ b/src/lib/exchange_api_common.c @@ -277,9 +277,9 @@ TALER_EXCHANGE_verify_coin_history (const struct        add = GNUNET_NO;      }      else if (0 == strcasecmp (type, -                              "PAYBACK")) +                              "RECOUP"))      { -      struct TALER_PaybackConfirmationPS pc; +      struct TALER_RecoupConfirmationPS pc;        struct TALER_ExchangePublicKeyP exchange_pub;        struct TALER_ExchangeSignatureP exchange_sig;        struct GNUNET_JSON_Specification spec[] = { @@ -303,12 +303,12 @@ TALER_EXCHANGE_verify_coin_history (const struct          return GNUNET_SYSERR;        }        pc.purpose.size = htonl (sizeof (pc)); -      pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK); +      pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP);        pc.coin_pub = *coin_pub; -      TALER_amount_hton (&pc.payback_amount, +      TALER_amount_hton (&pc.recoup_amount,                           &amount);        if (GNUNET_OK != -          GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK, +          GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP,                                        &pc.purpose,                                        &exchange_sig.eddsa_signature,                                        &exchange_pub.eddsa_pub)) diff --git a/src/lib/exchange_api_payback.c b/src/lib/exchange_api_recoup.c index c2020805..f1f65ad8 100644 --- a/src/lib/exchange_api_payback.c +++ b/src/lib/exchange_api_recoup.c @@ -15,8 +15,8 @@    <http://www.gnu.org/licenses/>  */  /** - * @file lib/exchange_api_payback.c - * @brief Implementation of the /payback request of the exchange's HTTP API + * @file lib/exchange_api_recoup.c + * @brief Implementation of the /recoup request of the exchange's HTTP API   * @author Christian Grothoff   */  #include "platform.h" @@ -33,9 +33,9 @@  /** - * @brief A Payback Handle + * @brief A Recoup Handle   */ -struct TALER_EXCHANGE_PaybackHandle +struct TALER_EXCHANGE_RecoupHandle  {    /** @@ -67,7 +67,7 @@ struct TALER_EXCHANGE_PaybackHandle    /**     * Function to call with the result.     */ -  TALER_EXCHANGE_PaybackResultCallback cb; +  TALER_EXCHANGE_RecoupResultCallback cb;    /**     * Closure for @a cb. @@ -92,17 +92,17 @@ struct TALER_EXCHANGE_PaybackHandle   * from the exchange is valid. If it is, call the   * callback.   * - * @param ph payback handle + * @param ph recoup handle   * @param json json reply with the signature   * @return #GNUNET_OK if the signature is valid and we called the callback;   *         #GNUNET_SYSERR if not (callback must still be called)   */  static int -verify_payback_signature_ok (const struct TALER_EXCHANGE_PaybackHandle *ph, -                             const json_t *json) +verify_recoup_signature_ok (const struct TALER_EXCHANGE_RecoupHandle *ph, +                            const json_t *json)  { -  struct TALER_PaybackConfirmationPS pc; -  struct TALER_PaybackRefreshConfirmationPS pr; +  struct TALER_RecoupConfirmationPS pc; +  struct TALER_RecoupRefreshConfirmationPS pr;    struct TALER_ExchangePublicKeyP exchange_pub;    struct TALER_ExchangeSignatureP exchange_sig;    struct TALER_Amount amount; @@ -144,15 +144,15 @@ verify_payback_signature_ok (const struct TALER_EXCHANGE_PaybackHandle *ph,    if (ph->was_refreshed)    {      pr.purpose.purpose = htonl ( -      TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH); +      TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH);      pr.purpose.size = htonl (sizeof (pr));      pr.timestamp = GNUNET_TIME_absolute_hton (timestamp); -    TALER_amount_hton (&pr.payback_amount, +    TALER_amount_hton (&pr.recoup_amount,                         &amount);      pr.coin_pub = ph->coin_pub;      if (GNUNET_OK !=          GNUNET_CRYPTO_eddsa_verify ( -          TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH, +          TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH,            &pr.purpose,            &exchange_sig.eddsa_signature,            &exchange_pub.eddsa_pub)) @@ -163,14 +163,14 @@ verify_payback_signature_ok (const struct TALER_EXCHANGE_PaybackHandle *ph,    }    else    { -    pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK); +    pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP);      pc.purpose.size = htonl (sizeof (pc));      pc.timestamp = GNUNET_TIME_absolute_hton (timestamp); -    TALER_amount_hton (&pc.payback_amount, +    TALER_amount_hton (&pc.recoup_amount,                         &amount);      pc.coin_pub = ph->coin_pub;      if (GNUNET_OK != -        GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK, +        GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP,                                      &pc.purpose,                                      &exchange_sig.eddsa_signature,                                      &exchange_pub.eddsa_pub)) @@ -193,18 +193,18 @@ verify_payback_signature_ok (const struct TALER_EXCHANGE_PaybackHandle *ph,  /**   * Function called when we're done processing the - * HTTP /payback request. + * HTTP /recoup request.   * - * @param cls the `struct TALER_EXCHANGE_PaybackHandle` + * @param cls the `struct TALER_EXCHANGE_RecoupHandle`   * @param response_code HTTP response code, 0 on error   * @param response parsed JSON result, NULL on error   */  static void -handle_payback_finished (void *cls, -                         long response_code, -                         const void *response) +handle_recoup_finished (void *cls, +                        long response_code, +                        const void *response)  { -  struct TALER_EXCHANGE_PaybackHandle *ph = cls; +  struct TALER_EXCHANGE_RecoupHandle *ph = cls;    const json_t *j = response;    ph->job = NULL; @@ -214,14 +214,14 @@ handle_payback_finished (void *cls,      break;    case MHD_HTTP_OK:      if (GNUNET_OK != -        verify_payback_signature_ok (ph, -                                     j)) +        verify_recoup_signature_ok (ph, +                                    j))      {        GNUNET_break_op (0);        response_code = 0;        break;      } -    TALER_EXCHANGE_payback_cancel (ph); +    TALER_EXCHANGE_recoup_cancel (ph);      return;    case MHD_HTTP_BAD_REQUEST:      /* This should never happen, either us or the exchange is buggy @@ -255,7 +255,7 @@ handle_payback_finished (void *cls,                NULL,                NULL,                j); -      TALER_EXCHANGE_payback_cancel (ph); +      TALER_EXCHANGE_recoup_cancel (ph);        return;      }    case MHD_HTTP_FORBIDDEN: @@ -292,13 +292,13 @@ handle_payback_finished (void *cls,            NULL,            NULL,            j); -  TALER_EXCHANGE_payback_cancel (ph); +  TALER_EXCHANGE_recoup_cancel (ph);  }  /**   * Ask the exchange to pay back a coin due to the exchange triggering - * the emergency payback protocol for a given denomination.  The value + * the emergency recoup protocol for a given denomination.  The value   * of the coin will be refunded to the original customer (without fees).   *   * @param exchange the exchange handle; the exchange must be ready to operate @@ -306,33 +306,33 @@ handle_payback_finished (void *cls,   * @param denom_sig signature over the coin by the exchange using @a pk   * @param ps secret internals of the original planchet   * @param was_refreshed #GNUNET_YES if the coin in @a ps was refreshed - * @param payback_cb the callback to call when the final result for this request is available - * @param payback_cb_cls closure for @a payback_cb + * @param recoup_cb the callback to call when the final result for this request is available + * @param recoup_cb_cls closure for @a recoup_cb   * @return NULL   *         if the inputs are invalid (i.e. denomination key not with this exchange).   *         In this case, the callback is not called.   */ -struct TALER_EXCHANGE_PaybackHandle * -TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange, -                        const struct TALER_EXCHANGE_DenomPublicKey *pk, -                        const struct TALER_DenominationSignature *denom_sig, -                        const struct TALER_PlanchetSecretsP *ps, -                        int was_refreshed, -                        TALER_EXCHANGE_PaybackResultCallback payback_cb, -                        void *payback_cb_cls) +struct TALER_EXCHANGE_RecoupHandle * +TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange, +                       const struct TALER_EXCHANGE_DenomPublicKey *pk, +                       const struct TALER_DenominationSignature *denom_sig, +                       const struct TALER_PlanchetSecretsP *ps, +                       int was_refreshed, +                       TALER_EXCHANGE_RecoupResultCallback recoup_cb, +                       void *recoup_cb_cls)  { -  struct TALER_EXCHANGE_PaybackHandle *ph; +  struct TALER_EXCHANGE_RecoupHandle *ph;    struct GNUNET_CURL_Context *ctx; -  struct TALER_PaybackRequestPS pr; +  struct TALER_RecoupRequestPS pr;    struct TALER_CoinSpendSignatureP coin_sig;    struct GNUNET_HashCode h_denom_pub; -  json_t *payback_obj; +  json_t *recoup_obj;    CURL *eh;    GNUNET_assert (GNUNET_YES ==                   TEAH_handle_is_ready (exchange)); -  pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_PAYBACK); -  pr.purpose.size = htonl (sizeof (struct TALER_PaybackRequestPS)); +  pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_RECOUP); +  pr.purpose.size = htonl (sizeof (struct TALER_RecoupRequestPS));    GNUNET_CRYPTO_eddsa_key_get_public (&ps->coin_priv.eddsa_priv,                                        &pr.coin_pub.eddsa_pub);    GNUNET_CRYPTO_rsa_public_key_hash (pk->key.rsa_public_key, @@ -344,70 +344,70 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange,                                             &pr.purpose,                                             &coin_sig.eddsa_signature)); -  payback_obj = json_pack ("{s:o, s:o," /* denom pub/sig */ -                           " s:o, s:o," /* coin pub/sig */ -                           " s:o, s:o}", /* coin_bks */ -                           "denom_pub_hash", GNUNET_JSON_from_data_auto ( -                             &h_denom_pub), -                           "denom_sig", GNUNET_JSON_from_rsa_signature ( -                             denom_sig->rsa_signature), -                           "coin_pub", GNUNET_JSON_from_data_auto ( -                             &pr.coin_pub), -                           "coin_sig", GNUNET_JSON_from_data_auto (&coin_sig), -                           "coin_blind_key_secret", GNUNET_JSON_from_data_auto ( -                             &ps->blinding_key), -                           "refreshed", json_boolean (was_refreshed) -                           ); -  if (NULL == payback_obj) +  recoup_obj = json_pack ("{s:o, s:o," /* denom pub/sig */ +                          " s:o, s:o,"  /* coin pub/sig */ +                          " s:o, s:o}",  /* coin_bks */ +                          "denom_pub_hash", GNUNET_JSON_from_data_auto ( +                            &h_denom_pub), +                          "denom_sig", GNUNET_JSON_from_rsa_signature ( +                            denom_sig->rsa_signature), +                          "coin_pub", GNUNET_JSON_from_data_auto ( +                            &pr.coin_pub), +                          "coin_sig", GNUNET_JSON_from_data_auto (&coin_sig), +                          "coin_blind_key_secret", GNUNET_JSON_from_data_auto ( +                            &ps->blinding_key), +                          "refreshed", json_boolean (was_refreshed) +                          ); +  if (NULL == recoup_obj)    {      GNUNET_break (0);      return NULL;    } -  ph = GNUNET_new (struct TALER_EXCHANGE_PaybackHandle); +  ph = GNUNET_new (struct TALER_EXCHANGE_RecoupHandle);    ph->coin_pub = pr.coin_pub;    ph->exchange = exchange;    ph->pk = *pk;    ph->pk.key.rsa_public_key = NULL; /* zero out, as lifetime cannot be warranted */ -  ph->cb = payback_cb; -  ph->cb_cls = payback_cb_cls; -  ph->url = TEAH_path_to_url (exchange, "/payback"); +  ph->cb = recoup_cb; +  ph->cb_cls = recoup_cb_cls; +  ph->url = TEAH_path_to_url (exchange, "/recoup");    ph->was_refreshed = was_refreshed;    eh = TEL_curl_easy_get (ph->url);    if (GNUNET_OK !=        TALER_curl_easy_post (&ph->ctx,                              eh, -                            payback_obj)) +                            recoup_obj))    {      GNUNET_break (0);      curl_easy_cleanup (eh); -    json_decref (payback_obj); +    json_decref (recoup_obj);      GNUNET_free (ph->url);      GNUNET_free (ph);      return NULL;    } -  json_decref (payback_obj); +  json_decref (recoup_obj);    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, -              "URL for payback: `%s'\n", +              "URL for recoup: `%s'\n",                ph->url);    ctx = TEAH_handle_to_context (exchange);    ph->job = GNUNET_CURL_job_add2 (ctx,                                    eh,                                    ph->ctx.headers, -                                  &handle_payback_finished, +                                  &handle_recoup_finished,                                    ph);    return ph;  }  /** - * Cancel a payback request.  This function cannot be used on a + * Cancel a recoup request.  This function cannot be used on a   * request handle if the callback was already invoked.   * - * @param ph the payback handle + * @param ph the recoup handle   */  void -TALER_EXCHANGE_payback_cancel (struct TALER_EXCHANGE_PaybackHandle *ph) +TALER_EXCHANGE_recoup_cancel (struct TALER_EXCHANGE_RecoupHandle *ph)  {    if (NULL != ph->job)    { @@ -420,4 +420,4 @@ TALER_EXCHANGE_payback_cancel (struct TALER_EXCHANGE_PaybackHandle *ph)  } -/* end of exchange_api_payback.c */ +/* end of exchange_api_recoup.c */ diff --git a/src/lib/exchange_api_reserve.c b/src/lib/exchange_api_reserve.c index 9934aeba..4777b472 100644 --- a/src/lib/exchange_api_reserve.c +++ b/src/lib/exchange_api_reserve.c @@ -284,59 +284,59 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange,        /* end type==WITHDRAW */      }      else if (0 == strcasecmp (type, -                              "PAYBACK")) +                              "RECOUP"))      { -      struct TALER_PaybackConfirmationPS pc; +      struct TALER_RecoupConfirmationPS pc;        struct GNUNET_TIME_Absolute timestamp;        const struct TALER_EXCHANGE_Keys *key_state; -      struct GNUNET_JSON_Specification payback_spec[] = { +      struct GNUNET_JSON_Specification recoup_spec[] = {          GNUNET_JSON_spec_fixed_auto ("coin_pub",                                       &pc.coin_pub),          GNUNET_JSON_spec_fixed_auto ("exchange_sig", -                                     &rhistory[off].details.payback_details. +                                     &rhistory[off].details.recoup_details.                                       exchange_sig),          GNUNET_JSON_spec_fixed_auto ("exchange_pub", -                                     &rhistory[off].details.payback_details. +                                     &rhistory[off].details.recoup_details.                                       exchange_pub),          GNUNET_JSON_spec_absolute_time_nbo ("timestamp",                                              &pc.timestamp),          GNUNET_JSON_spec_end ()        }; -      rhistory[off].type = TALER_EXCHANGE_RTT_PAYBACK; +      rhistory[off].type = TALER_EXCHANGE_RTT_RECOUP;        rhistory[off].amount = amount;        if (GNUNET_OK !=            GNUNET_JSON_parse (transaction, -                             payback_spec, +                             recoup_spec,                               NULL, NULL))        {          GNUNET_break_op (0);          return GNUNET_SYSERR;        } -      rhistory[off].details.payback_details.coin_pub = pc.coin_pub; -      TALER_amount_hton (&pc.payback_amount, +      rhistory[off].details.recoup_details.coin_pub = pc.coin_pub; +      TALER_amount_hton (&pc.recoup_amount,                           &amount);        pc.purpose.size = htonl (sizeof (pc)); -      pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK); +      pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP);        pc.reserve_pub = *reserve_pub;        timestamp = GNUNET_TIME_absolute_ntoh (pc.timestamp); -      rhistory[off].details.payback_details.timestamp = timestamp; +      rhistory[off].details.recoup_details.timestamp = timestamp;        key_state = TALER_EXCHANGE_get_keys (exchange);        if (GNUNET_OK !=            TALER_EXCHANGE_test_signing_key (key_state,                                             &rhistory[off].details. -                                           payback_details.exchange_pub)) +                                           recoup_details.exchange_pub))        {          GNUNET_break_op (0);          return GNUNET_SYSERR;        }        if (GNUNET_OK != -          GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK, +          GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP,                                        &pc.purpose, -                                      &rhistory[off].details.payback_details. +                                      &rhistory[off].details.recoup_details.                                        exchange_sig.eddsa_signature, -                                      &rhistory[off].details.payback_details. +                                      &rhistory[off].details.recoup_details.                                        exchange_pub.eddsa_pub))        {          GNUNET_break_op (0); @@ -351,7 +351,7 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange,          GNUNET_break_op (0);          return GNUNET_SYSERR;        } -      /* end type==PAYBACK */ +      /* end type==RECOUP */      }      else if (0 == strcasecmp (type,                                "CLOSING")) @@ -475,7 +475,7 @@ free_rhistory (struct TALER_EXCHANGE_ReserveHistory *rhistory,        break;      case TALER_EXCHANGE_RTT_WITHDRAWAL:        break; -    case TALER_EXCHANGE_RTT_PAYBACK: +    case TALER_EXCHANGE_RTT_RECOUP:        break;      case TALER_EXCHANGE_RTT_CLOSE:        // should we free "receiver_account_details" ? diff --git a/src/lib/test_auditor_api.c b/src/lib/test_auditor_api.c index ac3a6459..d4971f6c 100644 --- a/src/lib/test_auditor_api.c +++ b/src/lib/test_auditor_api.c @@ -382,12 +382,12 @@ run (void *cls,      TALER_TESTING_cmd_end ()    }; -  struct TALER_TESTING_Command payback[] = { +  struct TALER_TESTING_Command recoup[] = {      /**       * Fill reserve with EUR:5.01, as withdraw fee is 1 ct per       * config.       */ -    CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-1", +    CMD_TRANSFER_TO_EXCHANGE ("recoup-create-reserve-1",                                "EUR:5.01"),      /**       * Run wire-watch to trigger the reserve creation. @@ -396,24 +396,24 @@ run (void *cls,      /**       * Withdraw a 5 EUR coin, at fee of 1 ct       */ -    TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-1", -                                       "payback-create-reserve-1", +    TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-1", +                                       "recoup-create-reserve-1",                                         "EUR:5",                                         MHD_HTTP_OK),      TALER_TESTING_cmd_revoke ("revoke-1",                                MHD_HTTP_OK, -                              "payback-withdraw-coin-1", +                              "recoup-withdraw-coin-1",                                CONFIG_FILE), -    TALER_TESTING_cmd_payback ("payback-1", -                               MHD_HTTP_OK, -                               "payback-withdraw-coin-1", -                               "EUR:5", -                               NULL), +    TALER_TESTING_cmd_recoup ("recoup-1", +                              MHD_HTTP_OK, +                              "recoup-withdraw-coin-1", +                              "EUR:5", +                              NULL),      /**       * Re-withdraw from this reserve       */ -    TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2", -                                       "payback-create-reserve-1", +    TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2", +                                       "recoup-create-reserve-1",                                         "EUR:1",                                         MHD_HTTP_OK),      /** @@ -432,7 +432,7 @@ run (void *cls,       * then have the rest paid back.  Check deposit of other coin       * fails.  (Do not use EUR:5 here as the EUR:5 coin was       * revoked and we did not bother to create a new one...) -     */CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-2", +     */CMD_TRANSFER_TO_EXCHANGE ("recoup-create-reserve-2",                                "EUR:2.02"),      /**       * Make previous command effective. @@ -441,19 +441,19 @@ run (void *cls,      /**       * Withdraw a 1 EUR coin, at fee of 1 ct       */ -    TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2a", -                                       "payback-create-reserve-2", +    TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2a", +                                       "recoup-create-reserve-2",                                         "EUR:1",                                         MHD_HTTP_OK),      /**       * Withdraw a 1 EUR coin, at fee of 1 ct       */ -    TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2b", -                                       "payback-create-reserve-2", +    TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2b", +                                       "recoup-create-reserve-2",                                         "EUR:1",                                         MHD_HTTP_OK), -    TALER_TESTING_cmd_deposit ("payback-deposit-partial", -                               "payback-withdraw-coin-2a", +    TALER_TESTING_cmd_deposit ("recoup-deposit-partial", +                               "recoup-withdraw-coin-2a",                                 0,                                 bc.user42_payto,                                 "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}", @@ -462,13 +462,13 @@ run (void *cls,                                 MHD_HTTP_OK),      TALER_TESTING_cmd_revoke ("revoke-2",                                MHD_HTTP_OK, -                              "payback-withdraw-coin-2a", +                              "recoup-withdraw-coin-2a",                                CONFIG_FILE), -    TALER_TESTING_cmd_payback ("payback-2", -                               MHD_HTTP_OK, -                               "payback-withdraw-coin-2a", -                               "EUR:0.5", -                               NULL), +    TALER_TESTING_cmd_recoup ("recoup-2", +                              MHD_HTTP_OK, +                              "recoup-withdraw-coin-2a", +                              "EUR:0.5", +                              NULL),      TALER_TESTING_cmd_end ()    }; @@ -647,8 +647,8 @@ run (void *cls,                               unaggregation),      TALER_TESTING_cmd_batch ("refund",                               refund), -    TALER_TESTING_cmd_batch ("payback", -                             payback), +    TALER_TESTING_cmd_batch ("recoup", +                             recoup),      CMD_RUN_AUDITOR ("normal-auditor"),      CMD_RUN_WIRE_AUDITOR ("normal-wire-auditor"),      TALER_TESTING_cmd_end () diff --git a/src/lib/test_exchange_api.c b/src/lib/test_exchange_api.c index d7db2ef9..67aeebcc 100644 --- a/src/lib/test_exchange_api.c +++ b/src/lib/test_exchange_api.c @@ -553,58 +553,58 @@ run (void *cls,      TALER_TESTING_cmd_end ()    }; -  struct TALER_TESTING_Command payback[] = { +  struct TALER_TESTING_Command recoup[] = {      /**       * Fill reserve with EUR:5.01, as withdraw fee is 1 ct per       * config.       */ -    CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-1", +    CMD_TRANSFER_TO_EXCHANGE ("recoup-create-reserve-1",                                "EUR:5.01"), -    TALER_TESTING_cmd_check_bank_admin_transfer ("payback-create-reserve-1", +    TALER_TESTING_cmd_check_bank_admin_transfer ("recoup-create-reserve-1",                                                   "EUR:5.01",                                                   bc.user42_payto,                                                   bc.exchange_payto, -                                                 "payback-create-reserve-1"), +                                                 "recoup-create-reserve-1"),      /**       * Run wire-watch to trigger the reserve creation.       */      CMD_EXEC_WIREWATCH ("wirewatch-4"),      /* Withdraw a 5 EUR coin, at fee of 1 ct */ -    TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-1", -                                       "payback-create-reserve-1", +    TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-1", +                                       "recoup-create-reserve-1",                                         "EUR:5",                                         MHD_HTTP_OK),      /* Make coin invalid */      TALER_TESTING_cmd_revoke ("revoke-0-EUR:5",                                MHD_HTTP_OK, -                              "payback-withdraw-coin-1", +                              "recoup-withdraw-coin-1",                                CONFIG_FILE),      /* Refund coin to bank account */ -    TALER_TESTING_cmd_payback ("payback-1", -                               MHD_HTTP_OK, -                               "payback-withdraw-coin-1", -                               "EUR:5", -                               NULL), +    TALER_TESTING_cmd_recoup ("recoup-1", +                              MHD_HTTP_OK, +                              "recoup-withdraw-coin-1", +                              "EUR:5", +                              NULL),      /* Check the money is back with the reserve */ -    TALER_TESTING_cmd_status ("payback-reserve-status-1", -                              "payback-create-reserve-1", +    TALER_TESTING_cmd_status ("recoup-reserve-status-1", +                              "recoup-create-reserve-1",                                "EUR:5.0",                                MHD_HTTP_OK),      /* Re-withdraw from this reserve */ -    TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2", -                                       "payback-create-reserve-1", +    TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2", +                                       "recoup-create-reserve-1",                                         "EUR:1",                                         MHD_HTTP_OK),      /** -     * This withdrawal will test the logic to create a "payback" +     * This withdrawal will test the logic to create a "recoup"       * element to insert into the reserve's history.       */ -    TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2-over", -                                       "payback-create-reserve-1", +    TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2-over", +                                       "recoup-create-reserve-1",                                         "EUR:10",                                         MHD_HTTP_CONFLICT), -    TALER_TESTING_cmd_status ("payback-reserve-status-2", -                              "payback-create-reserve-1", +    TALER_TESTING_cmd_status ("recoup-reserve-status-2", +                              "recoup-create-reserve-1",                                "EUR:3.99",                                MHD_HTTP_OK), @@ -642,27 +642,27 @@ run (void *cls,       * then have the rest paid back.  Check deposit of other coin       * fails.  Do not use EUR:5 here as the EUR:5 coin was       * revoked and we did not bother to create a new one... */// -    CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-2", +    CMD_TRANSFER_TO_EXCHANGE ("recoup-create-reserve-2",                                "EUR:2.02"), -    TALER_TESTING_cmd_check_bank_admin_transfer ("ck-payback-create-reserve-2", +    TALER_TESTING_cmd_check_bank_admin_transfer ("ck-recoup-create-reserve-2",                                                   "EUR:2.02",                                                   bc.user42_payto,                                                   bc.exchange_payto, -                                                 "payback-create-reserve-2"), +                                                 "recoup-create-reserve-2"),      /* Make previous command effective. */      CMD_EXEC_WIREWATCH ("wirewatch-5"),      /* Withdraw a 1 EUR coin, at fee of 1 ct */ -    TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2a", -                                       "payback-create-reserve-2", +    TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2a", +                                       "recoup-create-reserve-2",                                         "EUR:1",                                         MHD_HTTP_OK),      /* Withdraw a 1 EUR coin, at fee of 1 ct */ -    TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2b", -                                       "payback-create-reserve-2", +    TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2b", +                                       "recoup-create-reserve-2",                                         "EUR:1",                                         MHD_HTTP_OK), -    TALER_TESTING_cmd_deposit ("payback-deposit-partial", -                               "payback-withdraw-coin-2a", +    TALER_TESTING_cmd_deposit ("recoup-deposit-partial", +                               "recoup-withdraw-coin-2a",                                 0,                                 bc.user42_payto,                                 "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}", @@ -671,32 +671,32 @@ run (void *cls,                                 MHD_HTTP_OK),      TALER_TESTING_cmd_revoke ("revoke-1-EUR:1",                                MHD_HTTP_OK, -                              "payback-withdraw-coin-2a", +                              "recoup-withdraw-coin-2a",                                CONFIG_FILE), -    TALER_TESTING_cmd_payback ("payback-2", -                               MHD_HTTP_OK, -                               "payback-withdraw-coin-2a", -                               "EUR:0.5", -                               NULL), -    TALER_TESTING_cmd_payback ("payback-2b", -                               MHD_HTTP_CONFLICT, -                               "payback-withdraw-coin-2a", -                               "EUR:0.5", -                               NULL), -    TALER_TESTING_cmd_deposit ("payback-deposit-revoked", -                               "payback-withdraw-coin-2b", +    TALER_TESTING_cmd_recoup ("recoup-2", +                              MHD_HTTP_OK, +                              "recoup-withdraw-coin-2a", +                              "EUR:0.5", +                              NULL), +    TALER_TESTING_cmd_recoup ("recoup-2b", +                              MHD_HTTP_CONFLICT, +                              "recoup-withdraw-coin-2a", +                              "EUR:0.5", +                              NULL), +    TALER_TESTING_cmd_deposit ("recoup-deposit-revoked", +                               "recoup-withdraw-coin-2b",                                 0,                                 bc.user42_payto,                                 "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}",                                 GNUNET_TIME_UNIT_ZERO,                                 "EUR:1",                                 MHD_HTTP_NOT_FOUND), -    /* Test deposit fails after payback, with proof in payback */ +    /* Test deposit fails after recoup, with proof in recoup */      /* Note that, the exchange will never return the coin's transaction -     * history with payback data, as we get a 404 on the DK! */ -    TALER_TESTING_cmd_deposit ("payback-deposit-partial-after-payback", -                               "payback-withdraw-coin-2a", +     * history with recoup data, as we get a 404 on the DK! */ +    TALER_TESTING_cmd_deposit ("recoup-deposit-partial-after-recoup", +                               "recoup-withdraw-coin-2a",                                 0,                                 bc.user42_payto,                                 "{\"items\":[{\"name\":\"extra ice cream\",\"value\":1}]}", @@ -704,17 +704,17 @@ run (void *cls,                                 "EUR:0.5",                                 MHD_HTTP_NOT_FOUND),      /* Test that revoked coins cannot be withdrawn */ -    CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-3", +    CMD_TRANSFER_TO_EXCHANGE ("recoup-create-reserve-3",                                "EUR:1.01"),      TALER_TESTING_cmd_check_bank_admin_transfer ( -      "check-payback-create-reserve-3", +      "check-recoup-create-reserve-3",        "EUR:1.01",        bc.user42_payto,        bc.exchange_payto, -      "payback-create-reserve-3"), +      "recoup-create-reserve-3"),      CMD_EXEC_WIREWATCH ("wirewatch-6"), -    TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-3-revoked", -                                       "payback-create-reserve-3", +    TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-3-revoked", +                                       "recoup-create-reserve-3",                                         "EUR:1",                                         MHD_HTTP_NOT_FOUND),      /* check that we are empty before the rejection test */ @@ -767,8 +767,8 @@ run (void *cls,                                 unaggregation),        TALER_TESTING_cmd_batch ("refund",                                 refund), -      TALER_TESTING_cmd_batch ("payback", -                               payback), +      TALER_TESTING_cmd_batch ("recoup", +                               recoup),        TALER_TESTING_cmd_batch ("reserve-open-close",                                 reserve_open_close),        /* End the suite. */ diff --git a/src/lib/test_exchange_api_revocation.c b/src/lib/test_exchange_api_revocation.c index 02253b20..1c06340e 100644 --- a/src/lib/test_exchange_api_revocation.c +++ b/src/lib/test_exchange_api_revocation.c @@ -114,22 +114,22 @@ run (void *cls,                                "refresh-melt-1",                                CONFIG_FILE),      /* Refund coin to original coin */ -    TALER_TESTING_cmd_payback ("payback-1a", -                               MHD_HTTP_OK, -                               "refresh-reveal-1#0", -                               "EUR:1", -                               "refresh-melt-1"), -    TALER_TESTING_cmd_payback ("payback-1b", -                               MHD_HTTP_OK, -                               "refresh-reveal-1#1", -                               "EUR:1", -                               "refresh-melt-1"), -    TALER_TESTING_cmd_payback ("payback-1c", -                               MHD_HTTP_OK, -                               "refresh-reveal-1#2", -                               "EUR:1", -                               "refresh-melt-1"), -    /* Now we have EUR:3.83 EUR back after 3x EUR:1 in paybacks */ +    TALER_TESTING_cmd_recoup ("recoup-1a", +                              MHD_HTTP_OK, +                              "refresh-reveal-1#0", +                              "EUR:1", +                              "refresh-melt-1"), +    TALER_TESTING_cmd_recoup ("recoup-1b", +                              MHD_HTTP_OK, +                              "refresh-reveal-1#1", +                              "EUR:1", +                              "refresh-melt-1"), +    TALER_TESTING_cmd_recoup ("recoup-1c", +                              MHD_HTTP_OK, +                              "refresh-reveal-1#2", +                              "EUR:1", +                              "refresh-melt-1"), +    /* Now we have EUR:3.83 EUR back after 3x EUR:1 in recoups */      /* Melt original coin AGAIN, but only create one 0.1 EUR coin;         This costs EUR:0.03 in refresh and EUR:01 in withdraw fees,         leaving EUR:3.69. */ @@ -155,20 +155,20 @@ run (void *cls,                                "withdraw-revocation-coin-1",                                CONFIG_FILE),      /* Refund coin EUR:0.1 to original coin, creating zombie! */ -    TALER_TESTING_cmd_payback ("payback-2", -                               MHD_HTTP_OK, -                               "refresh-reveal-2", -                               "EUR:0.1", -                               "refresh-melt-2"), -    /* Due to payback, original coin is now at EUR:3.79 */ +    TALER_TESTING_cmd_recoup ("recoup-2", +                              MHD_HTTP_OK, +                              "refresh-reveal-2", +                              "EUR:0.1", +                              "refresh-melt-2"), +    /* Due to recoup, original coin is now at EUR:3.79 */      /* Refund original (now zombie) coin to reserve */ -    TALER_TESTING_cmd_payback ("payback-3", -                               MHD_HTTP_OK, -                               "withdraw-revocation-coin-1", -                               "EUR:3.79", -                               NULL), +    TALER_TESTING_cmd_recoup ("recoup-3", +                              MHD_HTTP_OK, +                              "withdraw-revocation-coin-1", +                              "EUR:3.79", +                              NULL),      /* Check the money is back with the reserve */ -    TALER_TESTING_cmd_status ("payback-reserve-status-1", +    TALER_TESTING_cmd_status ("recoup-reserve-status-1",                                "create-reserve-1",                                "EUR:3.79",                                MHD_HTTP_OK), diff --git a/src/lib/testing_api_cmd_payback.c b/src/lib/testing_api_cmd_recoup.c index 41e60b04..63319d4f 100644 --- a/src/lib/testing_api_cmd_payback.c +++ b/src/lib/testing_api_cmd_recoup.c @@ -17,8 +17,8 @@    <http://www.gnu.org/licenses/>  */  /** - * @file lib/testing_api_cmd_payback.c - * @brief Implement the /revoke and /payback test commands. + * @file lib/testing_api_cmd_recoup.c + * @brief Implement the /revoke and /recoup test commands.   * @author Marcello Stanisci   */  #include "platform.h" @@ -69,7 +69,7 @@ struct RevokeState  /**   * State for a "pay back" CMD.   */ -struct PaybackState +struct RecoupState  {    /**     * Expected HTTP status code. @@ -95,7 +95,7 @@ struct PaybackState    /**     * Handle to the ongoing operation.     */ -  struct TALER_EXCHANGE_PaybackHandle *ph; +  struct TALER_EXCHANGE_RecoupHandle *ph;    /**     * NULL if coin was not refreshed, otherwise reference @@ -151,7 +151,7 @@ parse_coin_reference (const char *coin_reference,  /** - * Check the result of the payback request: checks whether + * Check the result of the recoup request: checks whether   * the HTTP response code is good, and that the coin that   * was paid back belonged to the right reserve.   * @@ -160,22 +160,22 @@ parse_coin_reference (const char *coin_reference,   * @param ec taler-specific error code.   * @param amount amount the exchange will wire back for this coin.   * @param timestamp what time did the exchange receive the - *        /payback request - * @param reserve_pub public key of the reserve receiving the payback, NULL if refreshed or on error + *        /recoup request + * @param reserve_pub public key of the reserve receiving the recoup, NULL if refreshed or on error   * @param old_coin_pub public key of the dirty coin, NULL if not refreshed or on error   * @param full_response raw response from the exchange.   */  static void -payback_cb (void *cls, -            unsigned int http_status, -            enum TALER_ErrorCode ec, -            const struct TALER_Amount *amount, -            struct GNUNET_TIME_Absolute timestamp, -            const struct TALER_ReservePublicKeyP *reserve_pub, -            const struct TALER_CoinSpendPublicKeyP *old_coin_pub, -            const json_t *full_response) +recoup_cb (void *cls, +           unsigned int http_status, +           enum TALER_ErrorCode ec, +           const struct TALER_Amount *amount, +           struct GNUNET_TIME_Absolute timestamp, +           const struct TALER_ReservePublicKeyP *reserve_pub, +           const struct TALER_CoinSpendPublicKeyP *old_coin_pub, +           const json_t *full_response)  { -  struct PaybackState *ps = cls; +  struct RecoupState *ps = cls;    struct TALER_TESTING_Interpreter *is = ps->is;    struct TALER_TESTING_Command *cmd = &is->commands[is->ip];    const struct TALER_TESTING_Command *reserve_cmd; @@ -321,11 +321,11 @@ payback_cb (void *cls,   * @param is the interpreter state.   */  static void -payback_run (void *cls, -             const struct TALER_TESTING_Command *cmd, -             struct TALER_TESTING_Interpreter *is) +recoup_run (void *cls, +            const struct TALER_TESTING_Command *cmd, +            struct TALER_TESTING_Interpreter *is)  { -  struct PaybackState *ps = cls; +  struct RecoupState *ps = cls;    const struct TALER_TESTING_Command *coin_cmd;    const struct TALER_CoinSpendPrivateKeyP *coin_priv;    const struct TALER_DenominationBlindingKeyP *blinding_key; @@ -394,13 +394,13 @@ payback_run (void *cls,                "Trying to get '%s..' paid back\n",                TALER_B2S (&denom_pub->h_key)); -  ps->ph = TALER_EXCHANGE_payback (is->exchange, -                                   denom_pub, -                                   coin_sig, -                                   &planchet, -                                   NULL != ps->melt_reference, -                                   payback_cb, -                                   ps); +  ps->ph = TALER_EXCHANGE_recoup (is->exchange, +                                  denom_pub, +                                  coin_sig, +                                  &planchet, +                                  NULL != ps->melt_reference, +                                  recoup_cb, +                                  ps);    GNUNET_assert (NULL != ps->ph);  } @@ -431,20 +431,20 @@ revoke_cleanup (void *cls,  /** - * Cleanup the "payback" CMD state, and possibly cancel + * Cleanup the "recoup" CMD state, and possibly cancel   * a pending operation thereof.   *   * @param cls closure.   * @param cmd the command which is being cleaned up.   */  static void -payback_cleanup (void *cls, -                 const struct TALER_TESTING_Command *cmd) +recoup_cleanup (void *cls, +                const struct TALER_TESTING_Command *cmd)  { -  struct PaybackState *ps = cls; +  struct RecoupState *ps = cls;    if (NULL != ps->ph)    { -    TALER_EXCHANGE_payback_cancel (ps->ph); +    TALER_EXCHANGE_recoup_cancel (ps->ph);      ps->ph = NULL;    }    GNUNET_free (ps); @@ -546,7 +546,7 @@ revoke_run (void *cls,  /** - * Make a "payback" command. + * Make a "recoup" command.   *   * @param label the command label   * @param expected_response_code expected HTTP status code @@ -557,15 +557,15 @@ revoke_run (void *cls,   * @return the command.   */  struct TALER_TESTING_Command -TALER_TESTING_cmd_payback (const char *label, -                           unsigned int expected_response_code, -                           const char *coin_reference, -                           const char *amount, -                           const char *melt_reference) +TALER_TESTING_cmd_recoup (const char *label, +                          unsigned int expected_response_code, +                          const char *coin_reference, +                          const char *amount, +                          const char *melt_reference)  { -  struct PaybackState *ps; +  struct RecoupState *ps; -  ps = GNUNET_new (struct PaybackState); +  ps = GNUNET_new (struct RecoupState);    ps->expected_response_code = expected_response_code;    ps->coin_reference = coin_reference;    ps->amount = amount; @@ -574,8 +574,8 @@ TALER_TESTING_cmd_payback (const char *label,      struct TALER_TESTING_Command cmd = {        .cls = ps,        .label = label, -      .run = &payback_run, -      .cleanup = &payback_cleanup +      .run = &recoup_run, +      .cleanup = &recoup_cleanup      };      return cmd; diff --git a/src/lib/testing_api_cmd_refresh.c b/src/lib/testing_api_cmd_refresh.c index 019c000f..575f1a0c 100644 --- a/src/lib/testing_api_cmd_refresh.c +++ b/src/lib/testing_api_cmd_refresh.c @@ -56,7 +56,7 @@ struct TALER_TESTING_FreshCoinData    struct TALER_CoinSpendPrivateKeyP coin_priv;    /** -   * The blinding key (needed for payback operations). +   * The blinding key (needed for recoup operations).     */    struct TALER_DenominationBlindingKeyP blinding_key; | 
