Commenting the "deposit" CMD.
This commit is contained in:
parent
9c896fe4cc
commit
1ecef98609
@ -30,6 +30,10 @@
|
|||||||
#include "taler_testing_lib.h"
|
#include "taler_testing_lib.h"
|
||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* State for a "deposit" CMD.
|
||||||
|
*/
|
||||||
struct DepositState
|
struct DepositState
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -44,13 +48,14 @@ struct DepositState
|
|||||||
const char *coin_reference;
|
const char *coin_reference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this @e coin_ref refers to an operation that generated
|
* If @e coin_reference refers to an operation that generated
|
||||||
* an array of coins, this value determines which coin to pick.
|
* an array of coins, this value determines which coin to pick.
|
||||||
*/
|
*/
|
||||||
unsigned int coin_index;
|
unsigned int coin_index;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* payto://-URL of the merchant's bank account.
|
* Wire details of who is depositing -- this would be merchant
|
||||||
|
* wire details in a normal scenario.
|
||||||
*/
|
*/
|
||||||
json_t *wire_details;
|
json_t *wire_details;
|
||||||
|
|
||||||
@ -66,7 +71,8 @@ struct DepositState
|
|||||||
struct GNUNET_TIME_Relative refund_deadline;
|
struct GNUNET_TIME_Relative refund_deadline;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set (by the interpreter) to a fresh private key.
|
* Set (by the interpreter) to a fresh private key. This
|
||||||
|
* key will be used to sign the deposit request.
|
||||||
*/
|
*/
|
||||||
struct TALER_MerchantPrivateKeyP merchant_priv;
|
struct TALER_MerchantPrivateKeyP merchant_priv;
|
||||||
|
|
||||||
@ -92,16 +98,15 @@ struct DepositState
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called with the result of a /deposit operation.
|
* Callback to analyze the /deposit response, just used to
|
||||||
|
* check if the response code is acceptable.
|
||||||
*
|
*
|
||||||
* @param cls closure with the interpreter state
|
* @param cls closure.
|
||||||
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for
|
* @param http_status HTTP response code.
|
||||||
* successful deposit; 0 if the exchange's reply is bogus
|
* @param ec taler-specific error code.
|
||||||
* (fails to follow the protocol)
|
* @param exchange_pub public key of the exchange,
|
||||||
* @param ec taler-specific error code, #TALER_EC_NONE on success
|
* used for signing the response.
|
||||||
* @param exchange_pub public key the exchange used for signing
|
* @param obj raw response from the exchange.
|
||||||
* @param obj the received JSON reply, should be kept as proof
|
|
||||||
* (and, in case of errors, be forwarded to the customer)
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
deposit_cb (void *cls,
|
deposit_cb (void *cls,
|
||||||
@ -130,9 +135,9 @@ deposit_cb (void *cls,
|
|||||||
/**
|
/**
|
||||||
* 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 i the interpreter state.
|
* @param is the interpreter state.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
deposit_run (void *cls,
|
deposit_run (void *cls,
|
||||||
@ -252,9 +257,10 @@ deposit_run (void *cls,
|
|||||||
dr.purpose.purpose = htonl
|
dr.purpose.purpose = htonl
|
||||||
(TALER_SIGNATURE_WALLET_COIN_DEPOSIT);
|
(TALER_SIGNATURE_WALLET_COIN_DEPOSIT);
|
||||||
dr.h_contract_terms = h_contract_terms;
|
dr.h_contract_terms = h_contract_terms;
|
||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert
|
||||||
TALER_JSON_wire_signature_hash (ds->wire_details,
|
(GNUNET_OK ==
|
||||||
&dr.h_wire));
|
TALER_JSON_wire_signature_hash (ds->wire_details,
|
||||||
|
&dr.h_wire));
|
||||||
dr.timestamp = GNUNET_TIME_absolute_hton (timestamp);
|
dr.timestamp = GNUNET_TIME_absolute_hton (timestamp);
|
||||||
dr.refund_deadline = GNUNET_TIME_absolute_hton
|
dr.refund_deadline = GNUNET_TIME_absolute_hton
|
||||||
(refund_deadline);
|
(refund_deadline);
|
||||||
@ -295,7 +301,8 @@ deposit_run (void *cls,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleanup the state.
|
* Free the state of a "deposit" CMD, and possibly cancel a
|
||||||
|
* pending operation thereof.
|
||||||
*
|
*
|
||||||
* @param cls closure, typically a #struct WireState.
|
* @param cls closure, typically a #struct WireState.
|
||||||
* @param cmd the command which is being cleaned up.
|
* @param cmd the command which is being cleaned up.
|
||||||
@ -322,16 +329,16 @@ deposit_cleanup (void *cls,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract information from a command that is useful for other
|
* Offer internal data from a "deposit" CMD, to other commands.
|
||||||
* commands.
|
|
||||||
*
|
*
|
||||||
* @param cls closure
|
* @param cls closure.
|
||||||
* @param ret[out] result (could be anything)
|
* @param ret[out] result (could be anything).
|
||||||
* @param trait name of the trait
|
* @param trait name of the trait.
|
||||||
* @param selector more detailed information about which object
|
* @param selector more detailed information about which object
|
||||||
* to return in case there were multiple generated
|
* to return in case there were multiple generated
|
||||||
* by the command
|
* by the command.
|
||||||
* @return #GNUNET_OK on success
|
*
|
||||||
|
* @return #GNUNET_OK on success.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
deposit_traits (void *cls,
|
deposit_traits (void *cls,
|
||||||
@ -378,26 +385,25 @@ deposit_traits (void *cls,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a deposit command.
|
* Create a "deposit" command.
|
||||||
*
|
*
|
||||||
* @param label command label
|
* @param label command label.
|
||||||
* @param exchange exchange connection
|
* @param exchange exchange connection.
|
||||||
* @param coin_reference reference to any operation that can
|
* @param coin_reference reference to any operation that can
|
||||||
* provide a coin
|
* provide a coin.
|
||||||
* @param coin_index if @a withdraw_reference offers an array of
|
* @param coin_index if @a withdraw_reference offers an array of
|
||||||
* coins, this parameter selects which one in that array.
|
* coins, this parameter selects which one in that array.
|
||||||
* This value is currently ignored, as only one-coin
|
* This value is currently ignored, as only one-coin
|
||||||
* withdrawals are implemented.
|
* withdrawals are implemented.
|
||||||
* @param wire_details JSON details of the wire account of the merchant performing the
|
* @param wire_details wire details associated with the "deposit"
|
||||||
* deposit, reference is captured by this command
|
* request.
|
||||||
* @param contract_terms contract terms to be signed over by the
|
* @param contract_terms contract terms to be signed over by the
|
||||||
* coin
|
* coin.
|
||||||
* @param refund_deadline refund deadline, zero means 'no refunds'
|
* @param refund_deadline refund deadline, zero means 'no refunds'.
|
||||||
* @param amount how much is going to be deposited
|
* @param amount how much is going to be deposited.
|
||||||
* @param expected_response_code which HTTP status code we expect
|
* @param expected_response_code expected HTTP response code.
|
||||||
* in the response
|
|
||||||
*
|
*
|
||||||
* @return the deposit command to be run by the interpreter
|
* @return the command.
|
||||||
*/
|
*/
|
||||||
struct TALER_TESTING_Command
|
struct TALER_TESTING_Command
|
||||||
TALER_TESTING_cmd_deposit
|
TALER_TESTING_cmd_deposit
|
||||||
|
Loading…
Reference in New Issue
Block a user