LCOV - code coverage report
Current view: top level - testing - testing_api_cmd_post_transfers.c (source / functions) Hit Total Coverage
Test: GNU Taler merchant coverage report Lines: 105 131 80.2 %
Date: 2021-08-30 06:54:17 Functions: 9 9 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   This file is part of TALER
       3             :   Copyright (C) 2020 Taler Systems SA
       4             : 
       5             :   TALER is free software; you can redistribute it and/or modify
       6             :   it under the terms of the GNU General Public License as
       7             :   published by the Free Software Foundation; either version 3, or
       8             :   (at your option) any later version.
       9             : 
      10             :   TALER is distributed in the hope that it will be useful, but
      11             :   WITHOUT ANY WARRANTY; without even the implied warranty of
      12             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13             :   GNU General Public License for more details.
      14             : 
      15             :   You should have received a copy of the GNU General Public
      16             :   License along with TALER; see the file COPYING.  If not, see
      17             :   <http://www.gnu.org/licenses/>
      18             : */
      19             : /**
      20             :  * @file testing_api_cmd_post_transfers.c
      21             :  * @brief command to test POST /transfers
      22             :  * @author Christian Grothoff
      23             :  */
      24             : #include "platform.h"
      25             : #include <taler/taler_exchange_service.h>
      26             : #include <taler/taler_testing_lib.h>
      27             : #include "taler_merchant_service.h"
      28             : #include "taler_merchant_testing_lib.h"
      29             : 
      30             : 
      31             : /**
      32             :  * State of a "POST /transfers" CMD.
      33             :  */
      34             : struct PostTransfersState
      35             : {
      36             : 
      37             :   /**
      38             :    * Handle for a "POST /transfers" request.
      39             :    */
      40             :   struct TALER_MERCHANT_PostTransfersHandle *pth;
      41             : 
      42             :   /**
      43             :    * Handle for a "GET" bank account history request.
      44             :    */
      45             :   struct TALER_BANK_DebitHistoryHandle *dhh;
      46             : 
      47             :   /**
      48             :    * The interpreter state.
      49             :    */
      50             :   struct TALER_TESTING_Interpreter *is;
      51             : 
      52             :   /**
      53             :    * Base URL of the merchant serving the request.
      54             :    */
      55             :   const char *merchant_url;
      56             : 
      57             :   /**
      58             :    * URL of the bank to run history on (set once @e found is set).
      59             :    */
      60             :   char *exchange_url;
      61             : 
      62             :   /**
      63             :    * Credit account of the merchant (set once @e found is set).
      64             :    */
      65             :   char *credit_account;
      66             : 
      67             :   /**
      68             :    * Payto URI to filter on.
      69             :    */
      70             :   const char *payto_uri;
      71             : 
      72             :   /**
      73             :    * Authentication details to authenticate to the bank.
      74             :    */
      75             :   struct TALER_BANK_AuthenticationData auth;
      76             : 
      77             :   /**
      78             :    * Set once we discovered the WTID and thus @e found is true.
      79             :    */
      80             :   struct TALER_WireTransferIdentifierRawP wtid;
      81             : 
      82             :   /**
      83             :    * the credit amount to look for at @e bank_url.
      84             :    */
      85             :   struct TALER_Amount credit_amount;
      86             : 
      87             :   /**
      88             :    * The fee incurred on the wire transfer.
      89             :    */
      90             :   struct TALER_Amount wire_fee;
      91             : 
      92             :   /**
      93             :    * Expected HTTP response code.
      94             :    */
      95             :   unsigned int http_status;
      96             : 
      97             :   /**
      98             :    * Array of deposit command labels we expect to see aggregated.
      99             :    */
     100             :   const char **deposits;
     101             : 
     102             :   /**
     103             :    * Serial number of the wire transfer in the merchant backend,
     104             :    * set by #TALER_TESTING_cmd_merchant_get_transfers(). 0 if unknown.
     105             :    */
     106             :   uint64_t serial;
     107             : 
     108             :   /**
     109             :    * Length of @e deposits.
     110             :    */
     111             :   unsigned int deposits_length;
     112             : 
     113             :   /**
     114             :    * Set to true once @e wtid and @e exchange_url are initialized.
     115             :    */
     116             :   bool found;
     117             : 
     118             :   /**
     119             :    * When the exchange executed the transfer.
     120             :    */
     121             :   struct GNUNET_TIME_Absolute execution_time;
     122             : };
     123             : 
     124             : 
     125             : /**
     126             :  * Callback for a POST /transfers operation.
     127             :  *
     128             :  * @param cls closure for this function
     129             :  * @param hr HTTP response details
     130             :  * @param execution_time when did the transfer happen (according to the exchange),
     131             :  *          #GNUNET_TIME_UNIT_FOREVER_ABS if the transfer did not yet happen or if
     132             :  *          we have no data from the exchange about it
     133             :  * @param total_amount total amount of the wire transfer, or NULL if the exchange did
     134             :  *             not provide any details
     135             :  * @param wire_fee how much did the exchange charge in terms of wire fees, or NULL
     136             :  *             if the exchange did not provide any details
     137             :  * @param details_length length of the @a details array
     138             :  * @param details array with details about the combined transactions
     139             :  */
     140             : static void
     141           2 : transfers_cb (void *cls,
     142             :               const struct TALER_MERCHANT_HttpResponse *hr,
     143             :               struct GNUNET_TIME_Absolute execution_time,
     144             :               const struct TALER_Amount *total_amount,
     145             :               const struct TALER_Amount *wire_fee,
     146             :               unsigned int details_length,
     147             :               const struct TALER_MERCHANT_TrackTransferDetail details[])
     148             : {
     149           2 :   struct PostTransfersState *pts = cls;
     150             : 
     151           2 :   pts->pth = NULL;
     152           2 :   if (pts->http_status != hr->http_status)
     153             :   {
     154           0 :     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
     155             :                 "Unexpected response code %u (%d) to command %s\n",
     156             :                 hr->http_status,
     157             :                 (int) hr->ec,
     158             :                 TALER_TESTING_interpreter_get_current_label (pts->is));
     159           0 :     TALER_TESTING_interpreter_fail (pts->is);
     160           0 :     return;
     161             :   }
     162           2 :   switch (hr->http_status)
     163             :   {
     164           1 :   case MHD_HTTP_OK:
     165             :     {
     166           1 :       pts->execution_time = execution_time;
     167           1 :       pts->wire_fee = *wire_fee;
     168           1 :       fprintf (stderr,
     169             :                "FIXME");
     170           1 :       json_dumpf (hr->reply,
     171             :                   stderr,
     172             :                   0);
     173             : #if FIXME_WRITE_PROPPER_CHECK_OF_RETURNED_DATA_HERE
     174             :       /* this code is some legacy logic that is close to what we
     175             :          need but needs to be updated to the current API */
     176             :       struct TALER_Amount total;
     177             : 
     178             :       if (0 >
     179             :           TALER_amount_subtract (&total,
     180             :                                  total_amount,
     181             :                                  wire_fee))
     182             :       {
     183             :         GNUNET_break (0);
     184             :         TALER_TESTING_interpreter_fail (pts->is);
     185             :         return;
     186             :       }
     187             :       if (0 !=
     188             :           TALER_amount_cmp (&total,
     189             :                             &pts->credit_amount))
     190             :       {
     191             :         GNUNET_break (0);
     192             :         TALER_TESTING_interpreter_fail (pts->is);
     193             :         return;
     194             :       }
     195             :       TALER_amount_set_zero (total.currency,
     196             :                              &total);
     197             :       for (unsigned int i = 0; i<details_length; i++)
     198             :       {
     199             :         const struct TALER_MERCHANT_TrackTransferDetail *tdd = &details[i];
     200             :         struct TALER_Amount sum;
     201             :         struct TALER_Amount fees;
     202             : 
     203             :         TALER_amount_set_zero (tdd->deposit_value.currency,
     204             :                                &sum);
     205             :         TALER_amount_set_zero (tdd->deposit_fee.currency,
     206             :                                &fees);
     207             :         for (unsigned int j = 0; j<pts->deposits_length; j++)
     208             :         {
     209             :           const char *label = pts->deposits[j];
     210             :           const struct TALER_TESTING_Command *cmd;
     211             :           const json_t *contract_terms;
     212             :           const struct TALER_Amount *deposit_value;
     213             :           const struct TALER_Amount *deposit_fee;
     214             :           const char *order_id;
     215             : 
     216             :           cmd = TALER_TESTING_interpreter_lookup_command (pts->is,
     217             :                                                           label);
     218             :           if (NULL == cmd)
     219             :           {
     220             :             GNUNET_break (0);
     221             :             TALER_TESTING_interpreter_fail (pts->is);
     222             :             return;
     223             :           }
     224             :           if ( (GNUNET_OK !=
     225             :                 TALER_TESTING_get_trait_contract_terms (cmd,
     226             :                                                         0,
     227             :                                                         &contract_terms)) ||
     228             :                (GNUNET_OK !=
     229             :                 TALER_TESTING_get_trait_amount_obj (cmd,
     230             :                                                     TALER_TESTING_CMD_DEPOSIT_TRAIT_IDX_DEPOSIT_VALUE,
     231             :                                                     &deposit_value)) ||
     232             :                (GNUNET_OK !=
     233             :                 TALER_TESTING_get_trait_amount_obj (cmd,
     234             :                                                     TALER_TESTING_CMD_DEPOSIT_TRAIT_IDX_DEPOSIT_FEE,
     235             :                                                     &deposit_fee)) )
     236             :           {
     237             :             GNUNET_break (0);
     238             :             TALER_TESTING_interpreter_fail (pts->is);
     239             :             return;
     240             :           }
     241             :           order_id = json_string_value (json_object_get (contract_terms,
     242             :                                                          "order_id"));
     243             :           if (NULL == order_id)
     244             :           {
     245             :             GNUNET_break (0);
     246             :             TALER_TESTING_interpreter_fail (pts->is);
     247             :             return;
     248             :           }
     249             :           if (0 != strcmp (tdd->order_id,
     250             :                            order_id))
     251             :             continue;
     252             :           if (0 >
     253             :               TALER_amount_add (&sum,
     254             :                                 &sum,
     255             :                                 deposit_value))
     256             :           {
     257             :             GNUNET_break (0);
     258             :             TALER_TESTING_interpreter_fail (pts->is);
     259             :             return;
     260             :           }
     261             :           if (0 >
     262             :               TALER_amount_add (&fees,
     263             :                                 &fees,
     264             :                                 deposit_fee))
     265             :           {
     266             :             GNUNET_break (0);
     267             :             TALER_TESTING_interpreter_fail (pts->is);
     268             :             return;
     269             :           }
     270             :         }
     271             :         if (0 !=
     272             :             TALER_amount_cmp (&sum,
     273             :                               &tdd->deposit_value))
     274             :         {
     275             :           GNUNET_break (0);
     276             :           TALER_TESTING_interpreter_fail (pts->is);
     277             :           return;
     278             :         }
     279             :         if (0 !=
     280             :             TALER_amount_cmp (&fees,
     281             :                               &tdd->deposit_fee))
     282             :         {
     283             :           GNUNET_break (0);
     284             :           TALER_TESTING_interpreter_fail (pts->is);
     285             :           return;
     286             :         }
     287             :         GNUNET_assert (0 <=
     288             :                        TALER_amount_add (&total,
     289             :                                          &total,
     290             :                                          &tdd->deposit_value));
     291             :         GNUNET_assert (0 <=
     292             :                        TALER_amount_subtract (&total,
     293             :                                               &total,
     294             :                                               &tdd->deposit_fee));
     295             :       }
     296             :       if (0 !=
     297             :           TALER_amount_cmp (&total,
     298             :                             &pts->credit_amount))
     299             :       {
     300             :         GNUNET_break (0);
     301             :         TALER_TESTING_interpreter_fail (pts->is);
     302             :         return;
     303             :       }
     304             : #endif
     305           1 :       break;
     306             :     }
     307           0 :   case MHD_HTTP_ACCEPTED:
     308           0 :     break;
     309           0 :   case MHD_HTTP_UNAUTHORIZED:
     310           0 :     break;
     311           0 :   case MHD_HTTP_NOT_FOUND:
     312           0 :     break;
     313           1 :   case MHD_HTTP_GATEWAY_TIMEOUT:
     314           1 :     break;
     315           0 :   default:
     316           0 :     GNUNET_break (0);
     317           0 :     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
     318             :                 "Unhandled HTTP status %u for POST /transfers.\n",
     319             :                 hr->http_status);
     320             :   }
     321           2 :   TALER_TESTING_interpreter_next (pts->is);
     322             : }
     323             : 
     324             : 
     325             : /**
     326             :  * Offers information from the POST /transfers CMD state to other
     327             :  * commands.
     328             :  *
     329             :  * @param cls closure
     330             :  * @param[out] ret result (could be anything)
     331             :  * @param trait name of the trait
     332             :  * @param index index number of the object to extract.
     333             :  * @return #GNUNET_OK on success
     334             :  */
     335             : static int
     336          33 : post_transfers_traits (void *cls,
     337             :                        const void **ret,
     338             :                        const char *trait,
     339             :                        unsigned int index)
     340             : {
     341          33 :   struct PostTransfersState *pts = cls;
     342             :   struct TALER_TESTING_Trait traits[] = {
     343          33 :     TALER_TESTING_make_trait_wtid (0, &pts->wtid),
     344          33 :     TALER_TESTING_make_trait_string (0, pts->credit_account),
     345          33 :     TALER_TESTING_make_trait_amount_obj (0, &pts->credit_amount),
     346          33 :     TALER_TESTING_make_trait_amount_obj (1, &pts->wire_fee),
     347          33 :     TALER_TESTING_make_trait_string (1, pts->exchange_url),
     348          33 :     TALER_TESTING_make_trait_absolute_time (0, &pts->execution_time),
     349          33 :     TALER_TESTING_make_trait_bank_row (&pts->serial),
     350          33 :     TALER_TESTING_trait_end (),
     351             :   };
     352             : 
     353          33 :   return TALER_TESTING_get_trait (traits,
     354             :                                   ret,
     355             :                                   trait,
     356             :                                   index);
     357             : }
     358             : 
     359             : 
     360             : /**
     361             :  * Run the "POST /transfers" CMD. First, get the bank history to find
     362             :  * the wtid.
     363             :  *
     364             :  * @param cls closure.
     365             :  * @param cmd command being run now.
     366             :  * @param is interpreter state.
     367             :  */
     368             : static void
     369           1 : post_transfers_run2 (void *cls,
     370             :                      const struct TALER_TESTING_Command *cmd,
     371             :                      struct TALER_TESTING_Interpreter *is)
     372             : {
     373           1 :   struct PostTransfersState *pts = cls;
     374             : 
     375           1 :   pts->is = is;
     376           2 :   pts->pth = TALER_MERCHANT_transfers_post (pts->is->ctx,
     377             :                                             pts->merchant_url,
     378           1 :                                             &pts->credit_amount,
     379           1 :                                             &pts->wtid,
     380           1 :                                             pts->credit_account,
     381           1 :                                             pts->exchange_url,
     382             :                                             &transfers_cb,
     383             :                                             pts);
     384           1 :   GNUNET_assert (NULL != pts->pth);
     385           1 : }
     386             : 
     387             : 
     388             : /**
     389             :  * Callbacks of this type are used to serve the result of asking
     390             :  * the bank for the debit transaction history.
     391             :  *
     392             :  * @param cls closure with a `struct PostTransfersState *`
     393             :  * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
     394             :  *                    0 if the bank's reply is bogus (fails to follow the protocol),
     395             :  *                    #MHD_HTTP_NO_CONTENT if there are no more results; on success the
     396             :  *                    last callback is always of this status (even if `abs(num_results)` were
     397             :  *                    already returned).
     398             :  * @param ec detailed error code
     399             :  * @param serial_id monotonically increasing counter corresponding to the transaction
     400             :  * @param details details about the wire transfer
     401             :  * @param json detailed response from the HTTPD, or NULL if reply was not in JSON
     402             :  * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
     403             :  */
     404             : static int
     405           2 : debit_cb (
     406             :   void *cls,
     407             :   unsigned int http_status,
     408             :   enum TALER_ErrorCode ec,
     409             :   uint64_t serial_id,
     410             :   const struct TALER_BANK_DebitDetails *details,
     411             :   const json_t *json)
     412             : {
     413           2 :   struct PostTransfersState *pts = cls;
     414             : 
     415           2 :   if (MHD_HTTP_NO_CONTENT == http_status)
     416             :   {
     417           1 :     pts->dhh = NULL;
     418           1 :     if (! pts->found)
     419             :     {
     420           0 :       GNUNET_break (0);
     421           0 :       TALER_TESTING_interpreter_fail (pts->is);
     422           0 :       return GNUNET_OK;
     423             :     }
     424           1 :     GNUNET_assert (NULL != pts->exchange_url);
     425           1 :     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
     426             :                 "Bank transfer found, checking with merchant backend at %s about %s from %s to %s with %s\n",
     427             :                 pts->merchant_url,
     428             :                 TALER_amount2s (&pts->credit_amount),
     429             :                 pts->payto_uri,
     430             :                 pts->exchange_url,
     431             :                 TALER_B2S (&pts->wtid));
     432           2 :     pts->pth = TALER_MERCHANT_transfers_post (pts->is->ctx,
     433             :                                               pts->merchant_url,
     434           1 :                                               &pts->credit_amount,
     435           1 :                                               &pts->wtid,
     436           1 :                                               pts->credit_account,
     437           1 :                                               pts->exchange_url,
     438             :                                               &transfers_cb,
     439             :                                               pts);
     440           1 :     GNUNET_assert (NULL != pts->pth);
     441           1 :     return GNUNET_OK;
     442             :   }
     443           1 :   if (MHD_HTTP_OK != http_status)
     444             :   {
     445           0 :     GNUNET_break (0);
     446           0 :     TALER_TESTING_interpreter_fail (pts->is);
     447           0 :     pts->dhh = NULL;
     448           0 :     return GNUNET_SYSERR;
     449             :   }
     450           1 :   if (pts->found)
     451           0 :     return GNUNET_OK;
     452           1 :   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
     453             :               "Bank reports transfer of %s to %s\n",
     454             :               TALER_amount2s (&details->amount),
     455             :               details->credit_account_uri);
     456           1 :   if (0 != TALER_amount_cmp (&pts->credit_amount,
     457             :                              &details->amount))
     458           0 :     return GNUNET_OK;
     459           1 :   pts->found = true;
     460           1 :   pts->wtid = details->wtid;
     461           1 :   pts->credit_account = GNUNET_strdup (details->credit_account_uri);
     462           1 :   pts->exchange_url = GNUNET_strdup (details->exchange_base_url);
     463           1 :   return GNUNET_OK;
     464             : }
     465             : 
     466             : 
     467             : /**
     468             :  * Run the "POST /transfers" CMD. First, get the bank history to find
     469             :  * the wtid.
     470             :  *
     471             :  * @param cls closure.
     472             :  * @param cmd command being run now.
     473             :  * @param is interpreter state.
     474             :  */
     475             : static void
     476           1 : post_transfers_run (void *cls,
     477             :                     const struct TALER_TESTING_Command *cmd,
     478             :                     struct TALER_TESTING_Interpreter *is)
     479             : {
     480           1 :   struct PostTransfersState *pts = cls;
     481             : 
     482           1 :   pts->is = is;
     483           1 :   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
     484             :               "Looking for transfer of %s from %s at bank\n",
     485             :               TALER_amount2s (&pts->credit_amount),
     486             :               pts->payto_uri);
     487           1 :   pts->dhh = TALER_BANK_debit_history (is->ctx,
     488           1 :                                        &pts->auth,
     489             :                                        UINT64_MAX,
     490             :                                        -INT64_MAX,
     491             :                                        GNUNET_TIME_UNIT_ZERO,
     492             :                                        &debit_cb,
     493             :                                        pts);
     494           1 :   GNUNET_assert (NULL != pts->dhh);
     495           1 : }
     496             : 
     497             : 
     498             : /**
     499             :  * Free the state of a "POST product" CMD, and possibly
     500             :  * cancel a pending operation thereof.
     501             :  *
     502             :  * @param cls closure.
     503             :  * @param cmd command being run.
     504             :  */
     505             : static void
     506           2 : post_transfers_cleanup (void *cls,
     507             :                         const struct TALER_TESTING_Command *cmd)
     508             : {
     509           2 :   struct PostTransfersState *pts = cls;
     510             : 
     511           2 :   if (NULL != pts->pth)
     512             :   {
     513           0 :     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
     514             :                 "POST /transfers operation did not complete\n");
     515           0 :     TALER_MERCHANT_transfers_post_cancel (pts->pth);
     516             :   }
     517           2 :   if (NULL != pts->dhh)
     518             :   {
     519           0 :     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
     520             :                 "GET debit history operation did not complete\n");
     521           0 :     TALER_BANK_debit_history_cancel (pts->dhh);
     522             :   }
     523           2 :   GNUNET_array_grow (pts->deposits,
     524             :                      pts->deposits_length,
     525             :                      0);
     526           2 :   GNUNET_free (pts->exchange_url);
     527           2 :   GNUNET_free (pts->credit_account);
     528           2 :   GNUNET_free (pts);
     529           2 : }
     530             : 
     531             : 
     532             : struct TALER_TESTING_Command
     533           1 : TALER_TESTING_cmd_merchant_post_transfer (
     534             :   const char *label,
     535             :   const struct TALER_BANK_AuthenticationData *auth,
     536             :   const char *payto_uri,
     537             :   const char *merchant_url,
     538             :   const char *credit_amount,
     539             :   unsigned int http_code,
     540             :   ...)
     541             : {
     542             :   struct PostTransfersState *pts;
     543             : 
     544           1 :   pts = GNUNET_new (struct PostTransfersState);
     545           1 :   pts->merchant_url = merchant_url;
     546           1 :   pts->auth = *auth;
     547           1 :   pts->payto_uri = payto_uri;
     548           1 :   GNUNET_assert (GNUNET_OK ==
     549             :                  TALER_string_to_amount (credit_amount,
     550             :                                          &pts->credit_amount));
     551           1 :   pts->http_status = http_code;
     552             :   {
     553             :     const char *clabel;
     554             :     va_list ap;
     555             : 
     556           1 :     va_start (ap, http_code);
     557           2 :     while (NULL != (clabel = va_arg (ap, const char *)))
     558             :     {
     559           1 :       GNUNET_array_append (pts->deposits,
     560             :                            pts->deposits_length,
     561             :                            clabel);
     562             :     }
     563           1 :     va_end (ap);
     564             :   }
     565             :   {
     566           1 :     struct TALER_TESTING_Command cmd = {
     567             :       .cls = pts,
     568             :       .label = label,
     569             :       .run = &post_transfers_run,
     570             :       .cleanup = &post_transfers_cleanup,
     571             :       .traits = &post_transfers_traits
     572             :     };
     573             : 
     574           1 :     return cmd;
     575             :   }
     576             : }
     577             : 
     578             : 
     579             : struct TALER_TESTING_Command
     580           1 : TALER_TESTING_cmd_merchant_post_transfer2 (
     581             :   const char *label,
     582             :   const char *merchant_url,
     583             :   const char *payto_uri,
     584             :   const char *credit_amount,
     585             :   const char *wtid,
     586             :   const char *exchange_url,
     587             :   unsigned int http_code)
     588             : {
     589             :   struct PostTransfersState *pts;
     590             : 
     591           1 :   pts = GNUNET_new (struct PostTransfersState);
     592           1 :   pts->merchant_url = merchant_url;
     593           1 :   pts->credit_account = GNUNET_strdup (payto_uri);
     594           1 :   pts->exchange_url = GNUNET_strdup (exchange_url);
     595           1 :   GNUNET_assert (GNUNET_OK ==
     596             :                  TALER_string_to_amount (credit_amount,
     597             :                                          &pts->credit_amount));
     598           1 :   if (NULL == wtid)
     599             :   {
     600           1 :     GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
     601           1 :                                 &pts->wtid,
     602             :                                 sizeof (pts->wtid));
     603             :   }
     604             :   else
     605             :   {
     606           0 :     GNUNET_assert (GNUNET_OK ==
     607             :                    GNUNET_STRINGS_string_to_data (wtid,
     608             :                                                   strlen (wtid),
     609             :                                                   &pts->wtid,
     610             :                                                   sizeof (pts->wtid)));
     611             :   }
     612           1 :   pts->http_status = http_code;
     613             :   {
     614           1 :     struct TALER_TESTING_Command cmd = {
     615             :       .cls = pts,
     616             :       .label = label,
     617             :       .run = &post_transfers_run2,
     618             :       .cleanup = &post_transfers_cleanup,
     619             :       .traits = &post_transfers_traits
     620             :     };
     621             : 
     622           1 :     return cmd;
     623             :   }
     624             : }
     625             : 
     626             : 
     627             : void
     628           2 : TALER_TESTING_cmd_merchant_post_transfer_set_serial (
     629             :   struct TALER_TESTING_Command *cmd,
     630             :   uint64_t serial)
     631             : {
     632           2 :   struct PostTransfersState *pts = cmd->cls;
     633             : 
     634           2 :   GNUNET_assert (cmd->run = &post_transfers_run);
     635           2 :   pts->serial = serial;
     636           2 : }
     637             : 
     638             : 
     639             : /* end of testing_api_cmd_post_transfers.c */

Generated by: LCOV version 1.14