LCOV - code coverage report
Current view: top level - lib - testing_api_cmd_refund.c (source / functions) Hit Total Coverage
Test: rcoverage.info Lines: 122 144 84.7 %
Date: 2018-09-19 06:18:31 Functions: 11 11 100.0 %

          Line data    Source code
       1             : /*
       2             :   This file is part of TALER
       3             :   Copyright (C) 2014-2018 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             : /**
      21             :  * @file lib/testing_api_cmd_refund.c
      22             :  * @brief command to test refunds.
      23             :  * @author Marcello Stanisci
      24             :  */
      25             : 
      26             : #include "platform.h"
      27             : #include <taler/taler_exchange_service.h>
      28             : #include <taler/taler_testing_lib.h>
      29             : #include "taler_merchant_service.h"
      30             : #include "taler_merchant_testing_lib.h"
      31             : 
      32             : 
      33             : /**
      34             :  * State for a "refund increase" CMD.
      35             :  */
      36             : struct RefundIncreaseState
      37             : {
      38             :   /**
      39             :    * Operation handle for a POST /refund request.
      40             :    */
      41             :   struct TALER_MERCHANT_RefundIncreaseOperation *rio;
      42             : 
      43             :   /**
      44             :    * Base URL of the merchant serving the request.
      45             :    */
      46             :   const char *merchant_url;
      47             : 
      48             :   /**
      49             :    * CURL context.
      50             :    */
      51             :   struct GNUNET_CURL_Context *ctx;
      52             : 
      53             :   /**
      54             :    * Order id of the contract to refund.
      55             :    */
      56             :   const char *order_id;
      57             : 
      58             :   /**
      59             :    * The amount to refund.
      60             :    */
      61             :   const char *refund_amount;
      62             : 
      63             :   /**
      64             :    * Refund fee.
      65             :    */
      66             :   const char *refund_fee;
      67             : 
      68             :   /**
      69             :    * Human-readable justification for the refund.
      70             :    */
      71             :   const char *reason;
      72             : 
      73             :   /**
      74             :    * Interpreter state.
      75             :    */
      76             :   struct TALER_TESTING_Interpreter *is;
      77             : 
      78             :   /**
      79             :    * Expected HTTP response code.
      80             :    */
      81             :   unsigned int http_code;
      82             : };
      83             : 
      84             : 
      85             : /**
      86             :  * State for a "refund lookup" CMD.
      87             :  */
      88             : struct RefundLookupState
      89             : {
      90             :   /**
      91             :    * Operation handle for a GET /public/refund request.
      92             :    */
      93             :   struct TALER_MERCHANT_RefundLookupOperation *rlo;
      94             : 
      95             :   /**
      96             :    * Base URL of the merchant serving the request.
      97             :    */
      98             :   const char *merchant_url;
      99             : 
     100             :   /**
     101             :    * CURL context.
     102             :    */
     103             :   struct GNUNET_CURL_Context *ctx;
     104             : 
     105             :   /**
     106             :    * Order id to look up.
     107             :    */
     108             :   const char *order_id;
     109             : 
     110             :   /**
     111             :    * Reference to a "pay" CMD, used to double-check if
     112             :    * refunded coins were actually spent:
     113             :    */
     114             :   const char *pay_reference;
     115             : 
     116             :   /**
     117             :    * Reference to a "refund increase" CMD that offer
     118             :    * the expected amount to be refunded; can be NULL.
     119             :    */
     120             :   const char *increase_reference;
     121             : 
     122             :   /**
     123             :    * Expected HTTP response code.
     124             :    */
     125             :   unsigned int http_code;
     126             : 
     127             :   /**
     128             :    * Interpreter state.
     129             :    */
     130             :   struct TALER_TESTING_Interpreter *is;
     131             : 
     132             :   /**
     133             :    * Explicit amount to be refunded, must be defined if @a
     134             :    * increase_reference is NULL.
     135             :    */
     136             :   const char *refund_amount;
     137             : };
     138             : 
     139             : 
     140             : /**
     141             :  * Free the state of a "refund increase" CMD, and
     142             :  * possibly cancel a pending "refund increase" operation.
     143             :  *
     144             :  * @param cls closure
     145             :  * @param cmd command currently being freed.
     146             :  */
     147             : static void
     148           3 : refund_increase_cleanup (void *cls,
     149             :                          const struct TALER_TESTING_Command *cmd)
     150             : {
     151           3 :   struct RefundIncreaseState *ris = cls;
     152             : 
     153           3 :   if (NULL != ris->rio)
     154             :   {
     155           0 :     TALER_LOG_WARNING ("Refund-increase operation"
     156             :                        " did not complete\n");
     157           0 :     TALER_MERCHANT_refund_increase_cancel (ris->rio);
     158             :   }
     159           3 :   GNUNET_free (ris);
     160           3 : }
     161             : 
     162             : 
     163             : /**
     164             :  * Free the state of a "refund lookup" CMD, and
     165             :  * possibly cancel a pending "refund lookup" operation.
     166             :  *
     167             :  * @param cls closure
     168             :  * @param cmd command currently being freed.
     169             :  */
     170             : static void
     171           3 : refund_lookup_cleanup (void *cls,
     172             :                        const struct TALER_TESTING_Command *cmd)
     173             : {
     174           3 :   struct RefundLookupState *rls = cls;
     175             : 
     176           3 :   if (NULL != rls->rlo)
     177             :   {
     178           0 :     TALER_LOG_WARNING ("Refund-lookup operation"
     179             :                        " did not complete\n");
     180           0 :     TALER_MERCHANT_refund_lookup_cancel (rls->rlo);
     181             :   }
     182           3 :   GNUNET_free (rls);
     183           3 : }
     184             : 
     185             : /**
     186             :  * Process POST /refund (increase) response; just checking
     187             :  * if the HTTP response code is the one expected.
     188             :  *
     189             :  * @param cls closure
     190             :  * @param http_status HTTP status code
     191             :  * @param ec taler-specific error object
     192             :  * @param obj response body; is NULL on success.
     193             :  */
     194             : static void
     195           3 : refund_increase_cb (void *cls,
     196             :                     unsigned int http_status,
     197             :                     enum TALER_ErrorCode ec,
     198             :                     const json_t *obj)
     199             : {
     200           3 :   struct RefundIncreaseState *ris = cls;
     201             : 
     202           3 :   ris->rio = NULL;
     203           3 :   if (ris->http_code != http_status)
     204           0 :     TALER_TESTING_FAIL (ris->is);
     205             : 
     206           3 :   TALER_TESTING_interpreter_next (ris->is);
     207             : }
     208             : 
     209             : 
     210             : /**
     211             :  * Run the "refund increase" CMD.
     212             :  *
     213             :  * @param cls closure.
     214             :  * @param cmd command currently being run.
     215             :  * @param is the interpreter state.
     216             :  */
     217             : static void
     218           3 : refund_increase_run (void *cls,
     219             :                      const struct TALER_TESTING_Command *cmd,
     220             :                      struct TALER_TESTING_Interpreter *is)
     221             : {
     222           3 :   struct RefundIncreaseState *ris = cls;
     223             :   struct TALER_Amount refund_amount;
     224             : 
     225           3 :   ris->is = is;
     226           3 :   if (GNUNET_OK != TALER_string_to_amount (ris->refund_amount,
     227             :                                            &refund_amount))
     228           0 :     TALER_TESTING_FAIL (is);
     229           3 :   ris->rio = TALER_MERCHANT_refund_increase (ris->ctx,
     230             :                                              ris->merchant_url,
     231             :                                              ris->order_id,
     232             :                                              &refund_amount,
     233             :                                              ris->reason,
     234             :                                              "default",
     235             :                                              &refund_increase_cb,
     236             :                                              ris);
     237           3 :   GNUNET_assert (NULL != ris->rio);
     238             : }
     239             : 
     240             : /**
     241             :  * Callback that frees all the elements in the hashmap
     242             :  *
     243             :  * @param cls closure, NULL
     244             :  * @param key current key
     245             :  * @param value a `struct TALER_Amount`
     246             :  *
     247             :  * @return always #GNUNET_YES (continue to iterate)
     248             :  */
     249             : static int
     250           1 : hashmap_free (void *cls,
     251             :               const struct GNUNET_HashCode *key,
     252             :               void *value)
     253             : {
     254           1 :   struct TALER_Amount *refund_amount = value;
     255             : 
     256           1 :   GNUNET_free (refund_amount);
     257           1 :   return GNUNET_YES;
     258             : }
     259             : 
     260             : 
     261             : /**
     262             :  * Process "GET /public/refund" (lookup) response;
     263             :  * mainly checking if the refunded amount matches the
     264             :  * expectation.
     265             :  *
     266             :  * @param cls closure
     267             :  * @param http_status HTTP status code
     268             :  * @param ec taler-specific error object
     269             :  * @param obj response body; is NULL on error.
     270             :  */
     271             : static void
     272           3 : refund_lookup_cb (void *cls,
     273             :                   unsigned int http_status,
     274             :                   enum TALER_ErrorCode ec,
     275             :                   const json_t *obj)
     276             : {
     277           3 :   struct RefundLookupState *rls = cls;
     278             :   struct GNUNET_CONTAINER_MultiHashMap *map;
     279             :   size_t index;
     280             :   json_t *elem;
     281             :   const char *error_name;
     282             :   unsigned int error_line;
     283             :   struct GNUNET_HashCode h_coin_pub;
     284             :   const char *coin_reference;
     285             :   char *coin_reference_dup;
     286             :   const char *icoin_reference;
     287             :   const struct TALER_TESTING_Command *pay_cmd;
     288             :   const struct TALER_TESTING_Command *icoin_cmd;
     289             :   const struct TALER_TESTING_Command *increase_cmd;
     290             :   const char *refund_amount;
     291             :   struct TALER_Amount acc;
     292             :   struct TALER_Amount ra;
     293             :   const json_t *arr;
     294             : 
     295           3 :   rls->rlo = NULL;
     296           3 :   if (rls->http_code != http_status)
     297           1 :     TALER_TESTING_FAIL (rls->is);
     298             : 
     299           3 :   map = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO);
     300           3 :   arr = json_object_get (obj, "refund_permissions");
     301           3 :   if (NULL == arr)
     302             :   {
     303           1 :     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
     304             :                 "Tolerating a refund permission not found\n");
     305           1 :     TALER_TESTING_interpreter_next (rls->is);
     306           1 :     return;
     307             :   }
     308             : 
     309             :   /* Put in array every refunded coin.  */
     310           3 :   json_array_foreach (arr, index, elem)
     311             :   {
     312             :     struct TALER_CoinSpendPublicKeyP coin_pub;
     313           1 :     struct TALER_Amount *irefund_amount = GNUNET_new
     314             :       (struct TALER_Amount);
     315           1 :     struct GNUNET_JSON_Specification spec[] = {
     316             :       GNUNET_JSON_spec_fixed_auto ("coin_pub", &coin_pub),
     317             :       TALER_JSON_spec_amount ("refund_amount", irefund_amount),
     318             :       GNUNET_JSON_spec_end ()
     319             :     };
     320             : 
     321           1 :     GNUNET_assert (GNUNET_OK == GNUNET_JSON_parse (elem,
     322             :                                                    spec,
     323             :                                                    &error_name,
     324             :                                                    &error_line));
     325           1 :     GNUNET_CRYPTO_hash (&coin_pub,
     326             :                         sizeof (struct TALER_CoinSpendPublicKeyP),
     327             :                         &h_coin_pub);
     328           1 :     GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put
     329             :       (map,
     330             :        &h_coin_pub, // which
     331             :        irefund_amount, // how much
     332             :        GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
     333             :   };
     334             : 
     335             :   /* Compare spent coins with refunded, and if they match,
     336             :    * increase an accumulator.  */
     337           2 :   if ( NULL ==
     338           2 :      ( pay_cmd = TALER_TESTING_interpreter_lookup_command
     339             :        (rls->is, rls->pay_reference)))
     340           0 :     TALER_TESTING_FAIL (rls->is);
     341             : 
     342           2 :   if (GNUNET_OK != TALER_TESTING_get_trait_coin_reference
     343             :       (pay_cmd, 0, &coin_reference))
     344           0 :     TALER_TESTING_FAIL (rls->is);
     345             : 
     346           2 :   GNUNET_assert (GNUNET_OK == TALER_amount_get_zero ("EUR",
     347             :                                                      &acc));
     348           2 :   coin_reference_dup = GNUNET_strdup (coin_reference);
     349           6 :   for (icoin_reference = strtok (coin_reference_dup, ";");
     350             :        NULL != icoin_reference;
     351           2 :        icoin_reference = strtok (NULL, ";"))
     352             :   {
     353             :     struct TALER_CoinSpendPrivateKeyP *icoin_priv;
     354             :     struct TALER_CoinSpendPublicKeyP icoin_pub;
     355             :     struct GNUNET_HashCode h_icoin_pub;
     356             :     struct TALER_Amount *iamount;
     357             : 
     358           2 :     if ( NULL ==
     359           2 :        ( icoin_cmd = TALER_TESTING_interpreter_lookup_command
     360             :          (rls->is, icoin_reference)) )
     361             :     {
     362           0 :       GNUNET_break (0);
     363           0 :       TALER_LOG_ERROR ("Bad reference `%s'\n",
     364             :                        icoin_reference); 
     365           0 :       TALER_TESTING_interpreter_fail (rls->is);
     366           0 :       return;
     367             :     }
     368             : 
     369           2 :    if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv
     370             :       (icoin_cmd, 0, &icoin_priv))
     371             :    {
     372           0 :      GNUNET_break (0);
     373           0 :      TALER_LOG_ERROR ("Command `%s' failed to give coin"
     374             :                       " priv trait\n",
     375             :                       icoin_reference); 
     376           0 :      TALER_TESTING_interpreter_fail (rls->is);
     377           0 :      return;
     378             :     }
     379             :      
     380           2 :     GNUNET_CRYPTO_eddsa_key_get_public (&icoin_priv->eddsa_priv,
     381             :                                         &icoin_pub.eddsa_pub);
     382           2 :     GNUNET_CRYPTO_hash (&icoin_pub,
     383             :                         sizeof (struct TALER_CoinSpendPublicKeyP),
     384             :                         &h_icoin_pub);
     385             : 
     386           2 :     iamount = GNUNET_CONTAINER_multihashmap_get
     387             :       (map, &h_icoin_pub);
     388             : 
     389             :     /* Can be NULL: not all coins are involved in refund */
     390           2 :     if (NULL == iamount)
     391           1 :       continue;
     392             : 
     393           1 :     GNUNET_assert (GNUNET_OK == TALER_amount_add (&acc,
     394             :                                                   &acc,
     395             :                                                   iamount));
     396             :   }
     397             : 
     398           2 :   GNUNET_free (coin_reference_dup);
     399             :   
     400           2 :   if (NULL !=
     401           2 :     (increase_cmd = TALER_TESTING_interpreter_lookup_command
     402             :       (rls->is, rls->increase_reference)))
     403             :   {
     404           1 :     if (GNUNET_OK != TALER_TESTING_get_trait_amount
     405             :         (increase_cmd, 0, &refund_amount))
     406           0 :       TALER_TESTING_FAIL (rls->is);
     407             : 
     408           1 :     if (GNUNET_OK != TALER_string_to_amount
     409             :         (refund_amount, &ra))
     410           0 :       TALER_TESTING_FAIL (rls->is);
     411             :   }
     412             :   else
     413             :   {
     414           1 :     GNUNET_assert (NULL != rls->refund_amount);
     415             : 
     416           1 :     if (GNUNET_OK != TALER_string_to_amount
     417             :         (rls->refund_amount, &ra))
     418           0 :       TALER_TESTING_FAIL (rls->is);
     419             :   }
     420             : 
     421           2 :   GNUNET_CONTAINER_multihashmap_iterate (map,
     422             :                                          &hashmap_free,
     423             :                                          NULL);
     424           2 :   GNUNET_CONTAINER_multihashmap_destroy (map);
     425             : 
     426             :   /* Check that what the backend claims to have been refunded
     427             :    * actually matches _our_ refund expectation.  */
     428           2 :   if (0 != TALER_amount_cmp (&acc,
     429             :                              &ra))
     430             :   {
     431           0 :     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
     432             :                 "Incomplete refund: expected '%s', got '%s'\n",
     433             :                 TALER_amount_to_string (&ra),
     434             :                 TALER_amount_to_string (&acc));
     435           0 :     TALER_TESTING_interpreter_fail (rls->is);
     436           0 :     return;
     437             :   }
     438             : 
     439           2 :   TALER_TESTING_interpreter_next (rls->is);
     440             : }
     441             : 
     442             : 
     443             : /**
     444             :  * Run the "refund lookup" CMD.
     445             :  *
     446             :  * @param cls closure.
     447             :  * @param cmd command being currently run.
     448             :  * @param is interpreter state.
     449             :  */
     450             : static void
     451           3 : refund_lookup_run (void *cls,
     452             :                    const struct TALER_TESTING_Command *cmd,
     453             :                    struct TALER_TESTING_Interpreter *is)
     454             : {
     455           3 :   struct RefundLookupState *rls = cls;
     456             :   
     457           3 :   rls->is = is;
     458           3 :   rls->rlo = TALER_MERCHANT_refund_lookup (rls->ctx,
     459             :                                            rls->merchant_url,
     460             :                                            rls->order_id,
     461             :                                            "default",
     462             :                                            &refund_lookup_cb,
     463             :                                            rls);
     464           3 :   GNUNET_assert (NULL != rls->rlo);
     465           3 : }
     466             : 
     467             : 
     468             : /**
     469             :  * Offer internal data from the "refund increase" CMD
     470             :  * state to other commands.
     471             :  *
     472             :  * @param cls closure
     473             :  * @param ret[out] result (could be anything)
     474             :  * @param trait name of the trait
     475             :  * @param index index number of the object to extract.
     476             :  * @return #GNUNET_OK on success
     477             :  */
     478             : static int
     479           1 : refund_increase_traits (void *cls,
     480             :                         void **ret,
     481             :                         const char *trait,
     482             :                         unsigned int index)
     483             : {
     484           1 :   struct RefundIncreaseState *ris = cls;
     485             :   
     486           1 :   struct TALER_TESTING_Trait traits[] = {
     487           1 :     TALER_TESTING_make_trait_amount (0, ris->refund_amount),
     488             :     TALER_TESTING_trait_end ()
     489             :   };
     490             : 
     491           1 :   return TALER_TESTING_get_trait (traits,
     492             :                                   ret,
     493             :                                   trait,
     494             :                                   index);
     495             : 
     496             :   return GNUNET_SYSERR;
     497             : }
     498             : 
     499             : /**
     500             :  * Define a "refund increase" CMD.
     501             :  *
     502             :  * @param label command label.
     503             :  * @param merchant_url base URL of the backend serving the
     504             :  *        "refund increase" request.
     505             :  * @param ctx CURL context.
     506             :  * @param reason refund justification, human-readable.
     507             :  * @param order_id order id of the contract to refund.
     508             :  * @param refund_amount amount to be refund-increased.
     509             :  * @param refund_fee refund fee.
     510             :  * @param http_code expected HTTP response code.
     511             :  *
     512             :  * @return the command.
     513             :  */
     514             : struct TALER_TESTING_Command
     515           3 : TALER_TESTING_cmd_refund_increase
     516             :   (const char *label,
     517             :    const char *merchant_url,
     518             :    struct GNUNET_CURL_Context *ctx,
     519             :    const char *reason,
     520             :    const char *order_id,
     521             :    const char *refund_amount,
     522             :    const char *refund_fee,
     523             :    unsigned int http_code)
     524             : {
     525             :   struct RefundIncreaseState *ris;
     526             :   struct TALER_TESTING_Command cmd;
     527             : 
     528           3 :   ris = GNUNET_new (struct RefundIncreaseState);
     529           3 :   ris->merchant_url = merchant_url;
     530           3 :   ris->ctx = ctx;
     531           3 :   ris->order_id = order_id;
     532           3 :   ris->refund_amount = refund_amount;
     533           3 :   ris->refund_fee = refund_fee;
     534           3 :   ris->reason = reason;
     535           3 :   ris->http_code = http_code;
     536             : 
     537           3 :   cmd.cls = ris;
     538           3 :   cmd.label = label;
     539           3 :   cmd.run = &refund_increase_run;
     540           3 :   cmd.cleanup = &refund_increase_cleanup;
     541           3 :   cmd.traits = &refund_increase_traits;
     542             : 
     543           3 :   return cmd;
     544             : }
     545             : 
     546             : /**
     547             :  * Define a "refund lookup" CMD.
     548             :  *
     549             :  * @param label command label.
     550             :  * @param merchant_url base URL of the merchant serving the
     551             :  *        "refund lookup" request.
     552             :  * @param ctx CURL context.
     553             :  * @param increase_reference reference to a "refund increase" CMD
     554             :  *        that will offer the amount to check the looked up refund
     555             :  *        against.  Must NOT be NULL.
     556             :  * @param pay_reference reference to the "pay" CMD whose coins got
     557             :  *        refunded.  It is used to double-check if the refunded
     558             :  *        coins were actually spent in the first place.
     559             :  * @param order_id order id whose refund status is to be looked up.
     560             :  * @param http_code expected HTTP response code.
     561             :  *
     562             :  * @return the command.
     563             :  */
     564             : struct TALER_TESTING_Command
     565           2 : TALER_TESTING_cmd_refund_lookup
     566             :   (const char *label,
     567             :    const char *merchant_url,
     568             :    struct GNUNET_CURL_Context *ctx,
     569             :    const char *increase_reference,
     570             :    const char *pay_reference,
     571             :    const char *order_id,
     572             :    unsigned int http_code)
     573             : {
     574             :   struct RefundLookupState *rls;
     575             :   struct TALER_TESTING_Command cmd;
     576             : 
     577           2 :   rls = GNUNET_new (struct RefundLookupState);
     578           2 :   rls->merchant_url = merchant_url;
     579           2 :   rls->ctx = ctx;
     580           2 :   rls->order_id = order_id;
     581           2 :   rls->pay_reference = pay_reference;
     582           2 :   rls->increase_reference = increase_reference;
     583           2 :   rls->http_code = http_code;
     584             : 
     585           2 :   cmd.cls = rls;
     586           2 :   cmd.label = label;
     587           2 :   cmd.run = &refund_lookup_run;
     588           2 :   cmd.cleanup = &refund_lookup_cleanup;
     589             : 
     590           2 :   return cmd;
     591             : }
     592             : 
     593             : 
     594             : /**
     595             :  * Define a "refund lookup" CMD, equipped with a expected refund
     596             :  * amount.
     597             :  *
     598             :  * @param label command label.
     599             :  * @param merchant_url base URL of the merchant serving the
     600             :  *        "refund lookup" request.
     601             :  * @param ctx CURL context.
     602             :  * @param increase_reference reference to a "refund increase" CMD
     603             :  *        that will offer the amount to check the looked up refund
     604             :  *        against.  Can be NULL, takes precedence over @a
     605             :  *        refund_amount.
     606             :  * @param pay_reference reference to the "pay" CMD whose coins got
     607             :  *        refunded.  It is used to double-check if the refunded
     608             :  *        coins were actually spent in the first place.
     609             :  * @param order_id order id whose refund status is to be looked up.
     610             :  * @param http_code expected HTTP response code.
     611             :  * @param refund_amount expected refund amount.  Must be defined
     612             :  *        if @a increase_reference is NULL.
     613             :  *
     614             :  * @return the command.
     615             :  */
     616             : struct TALER_TESTING_Command
     617           1 : TALER_TESTING_cmd_refund_lookup_with_amount
     618             :   (const char *label,
     619             :    const char *merchant_url,
     620             :    struct GNUNET_CURL_Context *ctx,
     621             :    const char *increase_reference,
     622             :    const char *pay_reference,
     623             :    const char *order_id,
     624             :    unsigned int http_code,
     625             :    const char *refund_amount)
     626             : {
     627             :   struct RefundLookupState *rls;
     628             :   struct TALER_TESTING_Command cmd;
     629             : 
     630           1 :   rls = GNUNET_new (struct RefundLookupState);
     631           1 :   rls->merchant_url = merchant_url;
     632           1 :   rls->ctx = ctx;
     633           1 :   rls->order_id = order_id;
     634           1 :   rls->pay_reference = pay_reference;
     635           1 :   rls->increase_reference = increase_reference;
     636           1 :   rls->http_code = http_code;
     637           1 :   rls->refund_amount = refund_amount;
     638             : 
     639           1 :   cmd.cls = rls;
     640           1 :   cmd.label = label;
     641           1 :   cmd.run = &refund_lookup_run;
     642           1 :   cmd.cleanup = &refund_lookup_cleanup;
     643             : 
     644           1 :   return cmd;
     645             : }
     646             : 
     647             : /* end of testing_api_cmd_refund.c */

Generated by: LCOV version 1.13