remove TALER_TESTING_cmd_admin_add_incoming_with_instance and TALER_EXCHANGE_refund2
This commit is contained in:
parent
0e808b648a
commit
c24a18e1a5
@ -961,50 +961,6 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
void *cb_cls);
|
void *cb_cls);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Submit a refund request to the exchange and get the exchange's
|
|
||||||
* response. This API is used by a merchant. Note that
|
|
||||||
* while we return the response verbatim to the caller for further
|
|
||||||
* processing, we do already verify that the response is well-formed
|
|
||||||
* (i.e. that signatures included in the response are all valid). If
|
|
||||||
* the exchange's reply is not well-formed, we return an HTTP status code
|
|
||||||
* of zero to @a cb.
|
|
||||||
*
|
|
||||||
* The @a exchange must be ready to operate (i.e. have
|
|
||||||
* finished processing the /keys reply). If this check fails, we do
|
|
||||||
* NOT initiate the transaction with the exchange and instead return NULL.
|
|
||||||
*
|
|
||||||
* FIXME: We can probably DEPRECATE this API and only use #TALER_EXCHANGE_refund()!
|
|
||||||
*
|
|
||||||
* @param exchange the exchange handle; the exchange must be ready to operate
|
|
||||||
* @param amount the amount to be refunded; must be larger than the refund fee
|
|
||||||
* (as that fee is still being subtracted), and smaller than the amount
|
|
||||||
* (with deposit fee) of the original deposit contribution of this coin
|
|
||||||
* @param h_contract_terms hash of the contact of the merchant with the customer that is being refunded
|
|
||||||
* @param coin_pub coin’s public key of the coin from the original deposit operation
|
|
||||||
* @param rtransaction_id transaction id for the transaction between merchant and customer (of refunding operation);
|
|
||||||
* this is needed as we may first do a partial refund and later a full refund. If both
|
|
||||||
* refunds are also over the same amount, we need the @a rtransaction_id to make the disjoint
|
|
||||||
* refund requests different (as requests are idempotent and otherwise the 2nd refund might not work).
|
|
||||||
* @param merchant_pub public key of the merchant
|
|
||||||
* @param merchant_sig signature affirming the refund from the merchant
|
|
||||||
* @param cb the callback to call when a reply for this request is available
|
|
||||||
* @param cb_cls closure for the above callback
|
|
||||||
* @return a handle for this request; NULL if the inputs are invalid (i.e.
|
|
||||||
* signatures fail to verify). In this case, the callback is not called.
|
|
||||||
*/
|
|
||||||
struct TALER_EXCHANGE_RefundHandle *
|
|
||||||
TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange,
|
|
||||||
const struct TALER_Amount *amount,
|
|
||||||
const struct GNUNET_HashCode *h_contract_terms,
|
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
|
||||||
uint64_t rtransaction_id,
|
|
||||||
const struct TALER_MerchantPublicKeyP *merchant_pub,
|
|
||||||
const struct TALER_MerchantSignatureP *merchant_sig,
|
|
||||||
TALER_EXCHANGE_RefundCallback cb,
|
|
||||||
void *cb_cls);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel a refund permission request. This function cannot be used
|
* Cancel a refund permission request. This function cannot be used
|
||||||
* on a request handle if a response is already served for it. If
|
* on a request handle if a response is already served for it. If
|
||||||
|
@ -1126,34 +1126,6 @@ TALER_TESTING_cmd_admin_add_incoming_with_ref (
|
|||||||
const char *ref);
|
const char *ref);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create "fakebank transfer" CMD, letting the caller specifying
|
|
||||||
* the merchant instance. This version is useful when a tip
|
|
||||||
* reserve should be topped up, in fact the interpreter will need
|
|
||||||
* the "tipping instance" in order to get the instance public key
|
|
||||||
* and make a wire transfer subject out of it.
|
|
||||||
*
|
|
||||||
* @param label command label.
|
|
||||||
* @param amount amount to transfer.
|
|
||||||
* @param payto_debit_account which account sends money.
|
|
||||||
* @param auth authentication data
|
|
||||||
* @param instance the instance that runs the tipping. Under this
|
|
||||||
* instance, the configuration file will provide the private
|
|
||||||
* key of the tipping reserve. This data will then used to
|
|
||||||
* construct the wire transfer subject line.
|
|
||||||
* @param config_filename configuration file to use.
|
|
||||||
* @return the command.
|
|
||||||
*/
|
|
||||||
struct TALER_TESTING_Command
|
|
||||||
TALER_TESTING_cmd_admin_add_incoming_with_instance (
|
|
||||||
const char *label,
|
|
||||||
const char *amount,
|
|
||||||
const struct TALER_BANK_AuthenticationData *auth,
|
|
||||||
const char *payto_debit_account,
|
|
||||||
const char *instance,
|
|
||||||
const char *config_filename);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify a fakebank transfer command to enable retries when the
|
* Modify a fakebank transfer command to enable retries when the
|
||||||
* reserve is not yet full or we get other transient errors from
|
* reserve is not yet full or we get other transient errors from
|
||||||
|
@ -295,59 +295,7 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
GNUNET_CRYPTO_eddsa_sign (&merchant_priv->eddsa_priv,
|
GNUNET_CRYPTO_eddsa_sign (&merchant_priv->eddsa_priv,
|
||||||
&rr,
|
&rr,
|
||||||
&merchant_sig.eddsa_sig);
|
&merchant_sig.eddsa_sig);
|
||||||
return TALER_EXCHANGE_refund2 (exchange,
|
|
||||||
amount,
|
|
||||||
h_contract_terms,
|
|
||||||
coin_pub,
|
|
||||||
rtransaction_id,
|
|
||||||
&rr.merchant,
|
|
||||||
&merchant_sig,
|
|
||||||
cb,
|
|
||||||
cb_cls);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Submit a refund request to the exchange and get the exchange's
|
|
||||||
* response. This API is used by a merchant. Note that
|
|
||||||
* while we return the response verbatim to the caller for further
|
|
||||||
* processing, we do already verify that the response is well-formed
|
|
||||||
* (i.e. that signatures included in the response are all valid). If
|
|
||||||
* the exchange's reply is not well-formed, we return an HTTP status code
|
|
||||||
* of zero to @a cb.
|
|
||||||
*
|
|
||||||
* The @a exchange must be ready to operate (i.e. have
|
|
||||||
* finished processing the /keys reply). If this check fails, we do
|
|
||||||
* NOT initiate the transaction with the exchange and instead return NULL.
|
|
||||||
*
|
|
||||||
* @param exchange the exchange handle; the exchange must be ready to operate
|
|
||||||
* @param amount the amount to be refunded; must be larger than the refund fee
|
|
||||||
* (as that fee is still being subtracted), and smaller than the amount
|
|
||||||
* (with deposit fee) of the original deposit contribution of this coin
|
|
||||||
* @param h_contract_terms hash of the contact of the merchant with the customer that is being refunded
|
|
||||||
* @param coin_pub coin’s public key of the coin from the original deposit operation
|
|
||||||
* @param rtransaction_id transaction id for the transaction between merchant and customer (of refunding operation);
|
|
||||||
* this is needed as we may first do a partial refund and later a full refund. If both
|
|
||||||
* refunds are also over the same amount, we need the @a rtransaction_id to make the disjoint
|
|
||||||
* refund requests different (as requests are idempotent and otherwise the 2nd refund might not work).
|
|
||||||
* @param merchant_pub public key of the merchant
|
|
||||||
* @param merchant_sig signature affirming the refund from the merchant
|
|
||||||
* @param cb the callback to call when a reply for this request is available
|
|
||||||
* @param cb_cls closure for the above callback
|
|
||||||
* @return a handle for this request; NULL if the inputs are invalid (i.e.
|
|
||||||
* signatures fail to verify). In this case, the callback is not called.
|
|
||||||
*/
|
|
||||||
struct TALER_EXCHANGE_RefundHandle *
|
|
||||||
TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange,
|
|
||||||
const struct TALER_Amount *amount,
|
|
||||||
const struct GNUNET_HashCode *h_contract_terms,
|
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
|
||||||
uint64_t rtransaction_id,
|
|
||||||
const struct TALER_MerchantPublicKeyP *merchant_pub,
|
|
||||||
const struct TALER_MerchantSignatureP *merchant_sig,
|
|
||||||
TALER_EXCHANGE_RefundCallback cb,
|
|
||||||
void *cb_cls)
|
|
||||||
{
|
|
||||||
struct TALER_EXCHANGE_RefundHandle *rh;
|
struct TALER_EXCHANGE_RefundHandle *rh;
|
||||||
struct GNUNET_CURL_Context *ctx;
|
struct GNUNET_CURL_Context *ctx;
|
||||||
json_t *refund_obj;
|
json_t *refund_obj;
|
||||||
@ -378,9 +326,9 @@ TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
h_contract_terms),
|
h_contract_terms),
|
||||||
"rtransaction_id", (json_int_t) rtransaction_id,
|
"rtransaction_id", (json_int_t) rtransaction_id,
|
||||||
"merchant_pub", GNUNET_JSON_from_data_auto (
|
"merchant_pub", GNUNET_JSON_from_data_auto (
|
||||||
merchant_pub),
|
&rr.merchant),
|
||||||
"merchant_sig", GNUNET_JSON_from_data_auto (
|
"merchant_sig", GNUNET_JSON_from_data_auto (
|
||||||
merchant_sig)
|
&merchant_sig)
|
||||||
);
|
);
|
||||||
if (NULL == refund_obj)
|
if (NULL == refund_obj)
|
||||||
{
|
{
|
||||||
@ -398,7 +346,7 @@ TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
rh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND);
|
rh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND);
|
||||||
rh->depconf.h_contract_terms = *h_contract_terms;
|
rh->depconf.h_contract_terms = *h_contract_terms;
|
||||||
rh->depconf.coin_pub = *coin_pub;
|
rh->depconf.coin_pub = *coin_pub;
|
||||||
rh->depconf.merchant = *merchant_pub;
|
rh->depconf.merchant = rr.merchant;
|
||||||
rh->depconf.rtransaction_id = GNUNET_htonll (rtransaction_id);
|
rh->depconf.rtransaction_id = GNUNET_htonll (rtransaction_id);
|
||||||
TALER_amount_hton (&rh->depconf.refund_amount,
|
TALER_amount_hton (&rh->depconf.refund_amount,
|
||||||
amount);
|
amount);
|
||||||
|
@ -319,67 +319,10 @@ admin_add_incoming_run (void *cls,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (NULL != fts->instance)
|
/* No referenced reserve, no instance to take priv
|
||||||
{
|
* from, no explicit subject given: create new key! */
|
||||||
char *section;
|
GNUNET_CRYPTO_eddsa_key_create (&fts->reserve_priv.eddsa_priv);
|
||||||
char *keys;
|
fts->reserve_priv_known = true;
|
||||||
struct GNUNET_CONFIGURATION_Handle *cfg;
|
|
||||||
|
|
||||||
GNUNET_assert (NULL != fts->config_filename);
|
|
||||||
cfg = GNUNET_CONFIGURATION_create ();
|
|
||||||
if (GNUNET_OK !=
|
|
||||||
GNUNET_CONFIGURATION_load (cfg,
|
|
||||||
fts->config_filename))
|
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
TALER_TESTING_interpreter_fail (is);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GNUNET_asprintf (§ion,
|
|
||||||
"instance-%s",
|
|
||||||
fts->instance);
|
|
||||||
if (GNUNET_OK !=
|
|
||||||
GNUNET_CONFIGURATION_get_value_filename
|
|
||||||
(cfg,
|
|
||||||
section,
|
|
||||||
"TIP_RESERVE_PRIV_FILENAME",
|
|
||||||
&keys))
|
|
||||||
{
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
|
||||||
"Configuration fails to specify reserve"
|
|
||||||
" private key filename in section %s\n",
|
|
||||||
section);
|
|
||||||
GNUNET_free (section);
|
|
||||||
TALER_TESTING_interpreter_fail (is);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (GNUNET_OK !=
|
|
||||||
GNUNET_CRYPTO_eddsa_key_from_file (keys,
|
|
||||||
GNUNET_NO,
|
|
||||||
&fts->reserve_priv.eddsa_priv))
|
|
||||||
{
|
|
||||||
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
|
|
||||||
section,
|
|
||||||
"TIP_RESERVE_PRIV_FILENAME",
|
|
||||||
"Failed to read private key");
|
|
||||||
GNUNET_free (section);
|
|
||||||
GNUNET_free (keys);
|
|
||||||
TALER_TESTING_interpreter_fail (is);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fts->reserve_priv_known = true;
|
|
||||||
GNUNET_free (keys);
|
|
||||||
GNUNET_free (section);
|
|
||||||
GNUNET_CONFIGURATION_destroy (cfg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* No referenced reserve, no instance to take priv
|
|
||||||
* from, no explicit subject given: create new key! */
|
|
||||||
GNUNET_CRYPTO_eddsa_key_create (&fts->reserve_priv.eddsa_priv);
|
|
||||||
fts->reserve_priv_known = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (! have_public)
|
if (! have_public)
|
||||||
GNUNET_CRYPTO_eddsa_key_get_public (&fts->reserve_priv.eddsa_priv,
|
GNUNET_CRYPTO_eddsa_key_get_public (&fts->reserve_priv.eddsa_priv,
|
||||||
@ -620,47 +563,6 @@ TALER_TESTING_cmd_admin_add_incoming_with_ref
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create "/admin/add-incoming" CMD, letting the caller specifying
|
|
||||||
* the merchant instance. This version is useful when a tip
|
|
||||||
* reserve should be topped up, in fact the interpreter will need
|
|
||||||
* the "tipping instance" in order to get the instance public key
|
|
||||||
* and make a wire transfer subject out of it.
|
|
||||||
*
|
|
||||||
* @param label command label.
|
|
||||||
* @param amount amount to transfer.
|
|
||||||
* @param payto_debit_account which account (expressed as a number)
|
|
||||||
* gives money
|
|
||||||
* @param auth authentication data
|
|
||||||
* @param instance the instance that runs the tipping. Under this
|
|
||||||
* instance, the configuration file will provide the private
|
|
||||||
* key of the tipping reserve. This data will then used to
|
|
||||||
* construct the wire transfer subject line.
|
|
||||||
* @param config_filename configuration file to use.
|
|
||||||
* @return the command.
|
|
||||||
*/
|
|
||||||
struct TALER_TESTING_Command
|
|
||||||
TALER_TESTING_cmd_admin_add_incoming_with_instance
|
|
||||||
(const char *label,
|
|
||||||
const char *amount,
|
|
||||||
const struct TALER_BANK_AuthenticationData *auth,
|
|
||||||
const char *payto_debit_account,
|
|
||||||
const char *instance,
|
|
||||||
const char *config_filename)
|
|
||||||
{
|
|
||||||
struct AdminAddIncomingState *fts;
|
|
||||||
|
|
||||||
fts = make_fts (amount,
|
|
||||||
auth,
|
|
||||||
payto_debit_account);
|
|
||||||
fts->instance = instance;
|
|
||||||
fts->config_filename = config_filename;
|
|
||||||
|
|
||||||
return make_command (label,
|
|
||||||
fts);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify a fakebank transfer command to enable retries when the
|
* Modify a fakebank transfer command to enable retries when the
|
||||||
* reserve is not yet full or we get other transient errors from the
|
* reserve is not yet full or we get other transient errors from the
|
||||||
|
Loading…
Reference in New Issue
Block a user