Commenting the "reject" CMD

This commit is contained in:
Marcello Stanisci 2018-05-28 22:20:21 +02:00
parent 7a1146f147
commit 0579b1d9cb
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F

View File

@ -32,25 +32,39 @@
#include "taler_bank_service.h" #include "taler_bank_service.h"
#include "taler_fakebank_lib.h" #include "taler_fakebank_lib.h"
/**
* State for a "reject" CMD.
*/
struct RejectState struct RejectState
{ {
/**
* Handle of a ongoing "reject" operation.
*/
struct TALER_BANK_RejectHandle *rh; struct TALER_BANK_RejectHandle *rh;
/**
* Reference to any command that can offer a wire
* transfer "row id" and its credit account so as
* to give input data to the "reject" operation.
*/
const char *deposit_reference; const char *deposit_reference;
/**
* Base URL of the bank implementing the "reject"
* operation.
*/
const char *bank_url; const char *bank_url;
}; };
/** /**
* Callbacks of this type are used to serve the result * Check that the response code from the "reject" opetation
* of asking the bank to reject an incoming wire transfer. * is acceptable, namely it equals "204 No Content".
* *
* @param cls closure * @param cls closure.
* @param http_status HTTP response code, #MHD_HTTP_NO_CONTENT * @param http_status HTTP response code.
* (204) for successful status request; #MHD_HTTP_NOT_FOUND * @param ec taler-specific error code.
* if the rowid is unknown; 0 if the bank's reply is bogus
* (fails to follow the protocol),
* @param ec detailed error code
*/ */
static void static void
reject_cb (void *cls, reject_cb (void *cls,
@ -74,10 +88,11 @@ reject_cb (void *cls,
} }
/** /**
* Cleanup the state. * Cleanup the state of a "reject" CMD, and possibly
* cancel a pending operation thereof.
* *
* @param cls closure, typically a #struct WireState. * @param cls closure.
* @param cmd the command which is being cleaned up. * @param cmd the command.
*/ */
void void
reject_cleanup reject_cleanup
@ -98,8 +113,8 @@ reject_cleanup
/** /**
* Run the command. * Run the command.
* *
* @param cls closure, typically a #struct WireState. * @param cls closure.
* @param cmd the command to execute, a /wire one. * @param cmd the command to execute.
* @param is the interpreter state. * @param is the interpreter state.
*/ */
void void
@ -140,13 +155,14 @@ reject_run (void *cls,
/** /**
* @param cls closure * Offer internal data from a "reject" CMD to other commands.
* @param ret[out] result (could be anything) *
* @param trait name of the trait * @param cls closure.
* @param selector more detailed information about which object * @param ret[out] result.
* to return in case there were multiple generated * @param trait name of the trait.
* by the command * @param index index number of the trait to return.
* @return #GNUNET_OK on success *
* @return #GNUNET_OK on success.
*/ */
static int static int
reject_traits (void *cls, reject_traits (void *cls,
@ -167,7 +183,16 @@ reject_traits (void *cls,
} }
/** /**
* FIXME. * Create a "reject" CMD.
*
* @param label command label.
* @param bank_url base URL of the bank implementing the
* "reject" operation.
* @param deposit_reference reference to a command that will
* provide a "row id" and credit (bank) account to craft
* the "reject" request.
*
* @return the command.
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_bank_reject (const char *label, TALER_TESTING_cmd_bank_reject (const char *label,