Compare commits
4 Commits
f969bd3c5b
...
47620fa81b
Author | SHA1 | Date | |
---|---|---|---|
47620fa81b | |||
|
d3772a834f | ||
|
290268e9af | ||
|
75ea35722b |
@ -961,10 +961,11 @@ struct TALER_EXCHANGE_WireAccount
|
||||
* @return #GNUNET_OK if parsing @a accounts succeeded
|
||||
*/
|
||||
enum GNUNET_GenericReturnValue
|
||||
TALER_EXCHANGE_parse_accounts (const struct TALER_MasterPublicKeyP *master_pub,
|
||||
const json_t *accounts,
|
||||
struct TALER_EXCHANGE_WireAccount was[],
|
||||
unsigned int was_length);
|
||||
TALER_EXCHANGE_parse_accounts (
|
||||
const struct TALER_MasterPublicKeyP *master_pub,
|
||||
const json_t *accounts,
|
||||
unsigned int was_length,
|
||||
struct TALER_EXCHANGE_WireAccount was[static was_length]);
|
||||
|
||||
|
||||
/**
|
||||
@ -974,8 +975,9 @@ TALER_EXCHANGE_parse_accounts (const struct TALER_MasterPublicKeyP *master_pub,
|
||||
* @param was_len length of the @a was array
|
||||
*/
|
||||
void
|
||||
TALER_EXCHANGE_free_accounts (struct TALER_EXCHANGE_WireAccount *was,
|
||||
unsigned int was_len);
|
||||
TALER_EXCHANGE_free_accounts (
|
||||
unsigned int was_len,
|
||||
struct TALER_EXCHANGE_WireAccount was[static was_len]);
|
||||
|
||||
|
||||
/**
|
||||
@ -1062,14 +1064,18 @@ struct TALER_EXCHANGE_WireHandle;
|
||||
* response are all valid). If the exchange's reply is not
|
||||
* well-formed, we return an HTTP status code of zero to @a cb.
|
||||
*
|
||||
* @param exchange the exchange handle; the exchange must be ready to operate
|
||||
* @param ctx curl context
|
||||
* @param url exchange base URL
|
||||
* @param keys the keys of the exchange
|
||||
* @param wire_cb the callback to call when a reply for this request is available
|
||||
* @param wire_cb_cls closure for the above callback
|
||||
* @return a handle for this request
|
||||
*/
|
||||
struct TALER_EXCHANGE_WireHandle *
|
||||
TALER_EXCHANGE_wire (
|
||||
struct TALER_EXCHANGE_Handle *exchange,
|
||||
struct GNUNET_CURL_Context *ctx,
|
||||
const char *url,
|
||||
struct TALER_EXCHANGE_Keys *keys,
|
||||
TALER_EXCHANGE_WireCallback wire_cb,
|
||||
void *wire_cb_cls);
|
||||
|
||||
@ -1298,7 +1304,7 @@ TALER_EXCHANGE_batch_deposit (
|
||||
struct TALER_EXCHANGE_Keys *keys,
|
||||
const struct TALER_EXCHANGE_DepositContractDetail *dcd,
|
||||
unsigned int num_cdds,
|
||||
const struct TALER_EXCHANGE_CoinDepositDetail *cdds,
|
||||
const struct TALER_EXCHANGE_CoinDepositDetail cdds[static num_cdds],
|
||||
TALER_EXCHANGE_BatchDepositResultCallback cb,
|
||||
void *cb_cls,
|
||||
enum TALER_ErrorCode *ec);
|
||||
@ -1308,7 +1314,7 @@ TALER_EXCHANGE_batch_deposit (
|
||||
* Change the chance that our deposit confirmation will be given to the
|
||||
* auditor to 100%.
|
||||
*
|
||||
* @param deposit the batch deposit permission request handle
|
||||
* @param[in,out] deposit the batch deposit permission request handle
|
||||
*/
|
||||
void
|
||||
TALER_EXCHANGE_batch_deposit_force_dc (
|
||||
@ -1319,7 +1325,7 @@ TALER_EXCHANGE_batch_deposit_force_dc (
|
||||
* Cancel a batch deposit permission request. This function cannot be used
|
||||
* on a request handle if a response is already served for it.
|
||||
*
|
||||
* @param deposit the deposit permission request handle
|
||||
* @param[in] deposit the deposit permission request handle
|
||||
*/
|
||||
void
|
||||
TALER_EXCHANGE_batch_deposit_cancel (
|
||||
@ -1539,7 +1545,7 @@ TALER_EXCHANGE_csr_melt (
|
||||
const char *url,
|
||||
const struct TALER_RefreshMasterSecretP *rms,
|
||||
unsigned int nks_len,
|
||||
struct TALER_EXCHANGE_NonceKey *nks,
|
||||
struct TALER_EXCHANGE_NonceKey nks[static nks_len],
|
||||
TALER_EXCHANGE_CsRMeltCallback res_cb,
|
||||
void *res_cb_cls);
|
||||
|
||||
@ -2586,8 +2592,8 @@ typedef void
|
||||
* @param exchange_url The base-URL of the exchange
|
||||
* @param keys The /keys material from the exchange
|
||||
* @param reserve_priv private key of the reserve to withdraw from
|
||||
* @param wcis inputs that determine the planchets
|
||||
* @param wci_length number of entries in @a wcis
|
||||
* @param wcis inputs that determine the planchets
|
||||
* @param res_cb the callback to call when the final result for this request is available
|
||||
* @param res_cb_cls closure for @a res_cb
|
||||
* @return NULL
|
||||
@ -2600,8 +2606,8 @@ TALER_EXCHANGE_batch_withdraw (
|
||||
const char *exchange_url,
|
||||
const struct TALER_EXCHANGE_Keys *keys,
|
||||
const struct TALER_ReservePrivateKeyP *reserve_priv,
|
||||
const struct TALER_EXCHANGE_WithdrawCoinInput *wcis,
|
||||
unsigned int wci_length,
|
||||
const struct TALER_EXCHANGE_WithdrawCoinInput wcis[static wci_length],
|
||||
TALER_EXCHANGE_BatchWithdrawCallback res_cb,
|
||||
void *res_cb_cls);
|
||||
|
||||
@ -2798,8 +2804,8 @@ TALER_EXCHANGE_batch_withdraw2 (
|
||||
const char *exchange_url,
|
||||
const struct TALER_EXCHANGE_Keys *keys,
|
||||
const struct TALER_ReservePrivateKeyP *reserve_priv,
|
||||
const struct TALER_PlanchetDetail *pds,
|
||||
unsigned int pds_length,
|
||||
const struct TALER_PlanchetDetail pds[static pds_length],
|
||||
TALER_EXCHANGE_BatchWithdraw2Callback res_cb,
|
||||
void *res_cb_cls);
|
||||
|
||||
@ -2897,8 +2903,8 @@ typedef void
|
||||
* @param exchange_url The base url of the exchange
|
||||
* @parm keys The denomination keys from the exchange
|
||||
* @param reserve_priv The pivate key to the reserve
|
||||
* @param coin_inputs The input for the coins to withdraw
|
||||
* @param num_coins The number of elements in @e coin_inputs
|
||||
* @param coin_inputs The input for the coins to withdraw
|
||||
* @param max_age The maximum age we commit to.
|
||||
* @param res_cb A callback for the result, maybe NULL
|
||||
* @param res_cb_cls A closure for @e res_cb, maybe NULL
|
||||
@ -2911,8 +2917,9 @@ TALER_EXCHANGE_age_withdraw (
|
||||
const char *exchange_url,
|
||||
struct TALER_EXCHANGE_Keys *keys,
|
||||
const struct TALER_ReservePrivateKeyP *reserve_priv,
|
||||
const struct TALER_EXCHANGE_AgeWithdrawCoinInput *coin_inputs,
|
||||
size_t num_coins,
|
||||
const struct TALER_EXCHANGE_AgeWithdrawCoinInput coin_inputs[
|
||||
const static num_coins],
|
||||
uint8_t max_age,
|
||||
TALER_EXCHANGE_AgeWithdrawCallback res_cb,
|
||||
void *res_cb_cls);
|
||||
@ -3233,7 +3240,7 @@ TALER_EXCHANGE_refreshes_reveal (
|
||||
const struct TALER_RefreshMasterSecretP *rms,
|
||||
const struct TALER_EXCHANGE_RefreshData *rd,
|
||||
unsigned int num_coins,
|
||||
const struct TALER_ExchangeWithdrawValues *alg_values,
|
||||
const struct TALER_ExchangeWithdrawValues alg_values[static num_coins],
|
||||
uint32_t noreveal_index,
|
||||
TALER_EXCHANGE_RefreshesRevealCallback reveal_cb,
|
||||
void *reveal_cb_cls);
|
||||
@ -3704,19 +3711,19 @@ TALER_EXCHANGE_parse_reserve_history (
|
||||
struct TALER_Amount *total_in,
|
||||
struct TALER_Amount *total_out,
|
||||
unsigned int history_length,
|
||||
struct TALER_EXCHANGE_ReserveHistoryEntry *rhistory);
|
||||
struct TALER_EXCHANGE_ReserveHistoryEntry rhistory[static history_length]);
|
||||
|
||||
|
||||
/**
|
||||
* Free memory (potentially) allocated by #TALER_EXCHANGE_parse_reserve_history().
|
||||
*
|
||||
* @param rhistory result to free
|
||||
* @param len number of entries in @a rhistory
|
||||
* @param[in] rhistory result to free
|
||||
*/
|
||||
void
|
||||
TALER_EXCHANGE_free_reserve_history (
|
||||
struct TALER_EXCHANGE_ReserveHistoryEntry *rhistory,
|
||||
unsigned int len);
|
||||
unsigned int len,
|
||||
struct TALER_EXCHANGE_ReserveHistoryEntry rhistory[static len]);
|
||||
|
||||
|
||||
/* ********************* /recoup *********************** */
|
||||
@ -4030,7 +4037,9 @@ typedef void
|
||||
* Run interaction with exchange to check KYC status
|
||||
* of a merchant.
|
||||
*
|
||||
* @param eh exchange handle to use
|
||||
* @param ctx CURL context
|
||||
* @param url exchange base URL
|
||||
* @param keys keys of the exchange
|
||||
* @param requirement_row number identifying the KYC requirement
|
||||
* @param h_payto hash of the payto:// URI at @a payment_target
|
||||
* @param ut type of the entity performing the KYC check
|
||||
@ -4040,13 +4049,16 @@ typedef void
|
||||
* @return NULL on error
|
||||
*/
|
||||
struct TALER_EXCHANGE_KycCheckHandle *
|
||||
TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *eh,
|
||||
uint64_t requirement_row,
|
||||
const struct TALER_PaytoHashP *h_payto,
|
||||
enum TALER_KYCLOGIC_KycUserType ut,
|
||||
struct GNUNET_TIME_Relative timeout,
|
||||
TALER_EXCHANGE_KycStatusCallback cb,
|
||||
void *cb_cls);
|
||||
TALER_EXCHANGE_kyc_check (
|
||||
struct GNUNET_CURL_Context *ctx,
|
||||
const char *url,
|
||||
struct TALER_EXCHANGE_Keys *keys,
|
||||
uint64_t requirement_row,
|
||||
const struct TALER_PaytoHashP *h_payto,
|
||||
enum TALER_KYCLOGIC_KycUserType ut,
|
||||
struct GNUNET_TIME_Relative timeout,
|
||||
TALER_EXCHANGE_KycStatusCallback cb,
|
||||
void *cb_cls);
|
||||
|
||||
|
||||
/**
|
||||
@ -6129,7 +6141,7 @@ TALER_EXCHANGE_purse_create_with_deposit (
|
||||
const struct TALER_ContractDiffiePrivateP *contract_priv,
|
||||
const json_t *contract_terms,
|
||||
unsigned int num_deposits,
|
||||
const struct TALER_EXCHANGE_PurseDeposit *deposits,
|
||||
const struct TALER_EXCHANGE_PurseDeposit deposits[static num_deposits],
|
||||
bool upload_contract,
|
||||
TALER_EXCHANGE_PurseCreateDepositCallback cb,
|
||||
void *cb_cls);
|
||||
@ -6531,7 +6543,7 @@ TALER_EXCHANGE_purse_deposit (
|
||||
const struct TALER_PurseContractPublicKeyP *purse_pub,
|
||||
uint8_t min_age,
|
||||
unsigned int num_deposits,
|
||||
const struct TALER_EXCHANGE_PurseDeposit *deposits,
|
||||
const struct TALER_EXCHANGE_PurseDeposit deposits[static num_deposits],
|
||||
TALER_EXCHANGE_PurseDepositCallback cb,
|
||||
void *cb_cls);
|
||||
|
||||
@ -6672,7 +6684,8 @@ TALER_EXCHANGE_reserves_open (
|
||||
const struct TALER_ReservePrivateKeyP *reserve_priv,
|
||||
const struct TALER_Amount *reserve_contribution,
|
||||
unsigned int coin_payments_length,
|
||||
const struct TALER_EXCHANGE_PurseDeposit *coin_payments,
|
||||
const struct TALER_EXCHANGE_PurseDeposit coin_payments[
|
||||
static coin_payments_length],
|
||||
struct GNUNET_TIME_Timestamp expiration_time,
|
||||
uint32_t min_purses,
|
||||
TALER_EXCHANGE_ReservesOpenCallback cb,
|
||||
@ -6683,7 +6696,7 @@ TALER_EXCHANGE_reserves_open (
|
||||
* Cancel a reserve status request. This function cannot be used
|
||||
* on a request handle if a response is already served for it.
|
||||
*
|
||||
* @param roh the reserve open request handle
|
||||
* @param[in] roh the reserve open request handle
|
||||
*/
|
||||
void
|
||||
TALER_EXCHANGE_reserves_open_cancel (
|
||||
@ -6877,7 +6890,7 @@ TALER_EXCHANGE_reserves_attest (
|
||||
const char *url,
|
||||
const struct TALER_ReservePrivateKeyP *reserve_priv,
|
||||
unsigned int attributes_length,
|
||||
const char *const*attributes,
|
||||
const char *attributes[const static attributes_length],
|
||||
TALER_EXCHANGE_ReservesPostAttestCallback cb,
|
||||
void *cb_cls);
|
||||
|
||||
|
@ -356,12 +356,12 @@ reserve_age_withdraw_payment_required (
|
||||
rhistory))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
TALER_EXCHANGE_free_reserve_history (rhistory,
|
||||
len);
|
||||
TALER_EXCHANGE_free_reserve_history (len,
|
||||
rhistory);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
TALER_EXCHANGE_free_reserve_history (rhistory,
|
||||
len);
|
||||
TALER_EXCHANGE_free_reserve_history (len,
|
||||
rhistory);
|
||||
}
|
||||
|
||||
/* Check that funds were really insufficient */
|
||||
@ -769,33 +769,37 @@ csr_withdraw_done (
|
||||
* csr-parameter via /csr-withdraw.
|
||||
*
|
||||
* @param awh The handler to the age-withdraw
|
||||
* @param coin_inputs The input for the individial coin(-candidates)
|
||||
* @param num_coins The number of coins in @e coin_inputs
|
||||
*
|
||||
* @param coin_inputs The input for the individial coin(-candidates)
|
||||
* @return GNUNET_OK on success, GNUNET_SYSERR on failure
|
||||
*/
|
||||
static
|
||||
enum GNUNET_GenericReturnValue
|
||||
prepare_coins (
|
||||
struct TALER_EXCHANGE_AgeWithdrawHandle *awh,
|
||||
const struct TALER_EXCHANGE_AgeWithdrawCoinInput *coin_inputs,
|
||||
size_t num_coins)
|
||||
size_t num_coins,
|
||||
const struct TALER_EXCHANGE_AgeWithdrawCoinInput coin_inputs[
|
||||
static num_coins])
|
||||
{
|
||||
|
||||
if (GNUNET_OK != TALER_amount_set_zero (
|
||||
awh->keys->currency,
|
||||
&awh->amount_with_fee))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
|
||||
awh->coin_data = GNUNET_new_array (awh->num_coins,
|
||||
struct CoinData);
|
||||
#define FAIL_IF(cond) \
|
||||
do { \
|
||||
if ((cond)) \
|
||||
{ \
|
||||
GNUNET_break (! (cond)); \
|
||||
goto ERROR; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
GNUNET_assert (0 < num_coins);
|
||||
awh->age_mask = coin_inputs[0].denom_pub->key.age_mask;
|
||||
|
||||
FAIL_IF (GNUNET_OK !=
|
||||
TALER_amount_set_zero (awh->keys->currency,
|
||||
&awh->amount_with_fee));
|
||||
|
||||
awh->coin_data = GNUNET_new_array (awh->num_coins,
|
||||
struct CoinData);
|
||||
|
||||
for (size_t i = 0; i < num_coins; i++)
|
||||
{
|
||||
struct CoinData *cd = &awh->coin_data[i];
|
||||
@ -803,12 +807,7 @@ prepare_coins (
|
||||
cd->denom_pub = *input->denom_pub;
|
||||
|
||||
/* The mask must be the same for all coins */
|
||||
if (awh->age_mask.bits != input->denom_pub->key.age_mask.bits)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TALER_EXCHANGE_age_withdraw_cancel (awh);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
FAIL_IF (awh->age_mask.bits != input->denom_pub->key.age_mask.bits);
|
||||
|
||||
TALER_denom_pub_deep_copy (&cd->denom_pub.key,
|
||||
&input->denom_pub->key);
|
||||
@ -817,26 +816,15 @@ prepare_coins (
|
||||
{
|
||||
struct TALER_Amount coin_total;
|
||||
|
||||
if (0 >
|
||||
TALER_amount_add (&coin_total,
|
||||
&cd->denom_pub.fees.withdraw,
|
||||
&cd->denom_pub.value))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TALER_EXCHANGE_age_withdraw_cancel (awh);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
FAIL_IF (0 >
|
||||
TALER_amount_add (&coin_total,
|
||||
&cd->denom_pub.fees.withdraw,
|
||||
&cd->denom_pub.value));
|
||||
|
||||
if (0 >
|
||||
TALER_amount_add (&awh->amount_with_fee,
|
||||
&awh->amount_with_fee,
|
||||
&coin_total))
|
||||
{
|
||||
/* Overflow here? Very strange, our CPU must be fried... */
|
||||
GNUNET_break (0);
|
||||
TALER_EXCHANGE_age_withdraw_cancel (awh);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
FAIL_IF (0 >
|
||||
TALER_amount_add (&awh->amount_with_fee,
|
||||
&awh->amount_with_fee,
|
||||
&coin_total));
|
||||
}
|
||||
|
||||
for (uint8_t k = 0; k < TALER_CNC_KAPPA; k++)
|
||||
@ -847,12 +835,13 @@ prepare_coins (
|
||||
|
||||
/* Derive the age restriction from the given secret and
|
||||
* the maximum age */
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_age_restriction_from_secret (
|
||||
&can->secret,
|
||||
&input->denom_pub->key.age_mask,
|
||||
awh->max_age,
|
||||
&can->age_commitment_proof));
|
||||
FAIL_IF (GNUNET_OK !=
|
||||
TALER_age_restriction_from_secret (
|
||||
&can->secret,
|
||||
&input->denom_pub->key.age_mask,
|
||||
awh->max_age,
|
||||
&can->age_commitment_proof));
|
||||
|
||||
TALER_age_commitment_hash (&can->age_commitment_proof.commitment,
|
||||
&can->h_age_commitment);
|
||||
|
||||
@ -867,28 +856,18 @@ prepare_coins (
|
||||
TALER_planchet_blinding_secret_create (&can->secret,
|
||||
&can->alg_values,
|
||||
&can->blinding_key);
|
||||
if (GNUNET_OK !=
|
||||
TALER_planchet_prepare (&cd->denom_pub.key,
|
||||
&can->alg_values,
|
||||
&can->blinding_key,
|
||||
&can->coin_priv,
|
||||
&can->h_age_commitment,
|
||||
&can->h_coin_pub,
|
||||
&can->planchet_detail))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TALER_EXCHANGE_age_withdraw_cancel (awh);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
if (GNUNET_OK !=
|
||||
TALER_coin_ev_hash (&can->planchet_detail.blinded_planchet,
|
||||
&can->planchet_detail.denom_pub_hash,
|
||||
&can->blinded_coin_h))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TALER_EXCHANGE_age_withdraw_cancel (awh);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
FAIL_IF (GNUNET_OK !=
|
||||
TALER_planchet_prepare (&cd->denom_pub.key,
|
||||
&can->alg_values,
|
||||
&can->blinding_key,
|
||||
&can->coin_priv,
|
||||
&can->h_age_commitment,
|
||||
&can->h_coin_pub,
|
||||
&can->planchet_detail));
|
||||
FAIL_IF (GNUNET_OK !=
|
||||
TALER_coin_ev_hash (&can->planchet_detail.blinded_planchet,
|
||||
&can->planchet_detail.denom_pub_hash,
|
||||
&can->blinded_coin_h));
|
||||
break;
|
||||
}
|
||||
case TALER_DENOMINATION_CS:
|
||||
@ -911,36 +890,33 @@ prepare_coins (
|
||||
of the blinded_planchet here; the other part
|
||||
will be done after the /csr-withdraw request! */
|
||||
can->planchet_detail.blinded_planchet.cipher = TALER_DENOMINATION_CS;
|
||||
can->csr_withdraw_handle = NULL;
|
||||
TALER_EXCHANGE_csr_withdraw (
|
||||
awh->curl_ctx,
|
||||
awh->exchange_url,
|
||||
&cd->denom_pub,
|
||||
&can->planchet_detail
|
||||
.blinded_planchet
|
||||
.details
|
||||
.cs_blinded_planchet
|
||||
.nonce,
|
||||
&csr_withdraw_done,
|
||||
&can);
|
||||
if (NULL == can->csr_withdraw_handle)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TALER_EXCHANGE_age_withdraw_cancel (awh);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
can->csr_withdraw_handle =
|
||||
TALER_EXCHANGE_csr_withdraw (awh->curl_ctx,
|
||||
awh->exchange_url,
|
||||
&cd->denom_pub,
|
||||
&can->planchet_detail
|
||||
.blinded_planchet
|
||||
.details
|
||||
.cs_blinded_planchet
|
||||
.nonce,
|
||||
&csr_withdraw_done,
|
||||
&can);
|
||||
FAIL_IF (NULL == can->csr_withdraw_handle);
|
||||
|
||||
awh->csr_pending++;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
GNUNET_break (0);
|
||||
TALER_EXCHANGE_age_withdraw_cancel (awh);
|
||||
return GNUNET_SYSERR;
|
||||
FAIL_IF (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return GNUNET_OK;
|
||||
|
||||
ERROR:
|
||||
TALER_EXCHANGE_age_withdraw_cancel (awh);
|
||||
return GNUNET_SYSERR;
|
||||
#undef FAIL_IF
|
||||
};
|
||||
|
||||
struct TALER_EXCHANGE_AgeWithdrawHandle *
|
||||
@ -949,8 +925,9 @@ TALER_EXCHANGE_age_withdraw (
|
||||
const char *exchange_url,
|
||||
struct TALER_EXCHANGE_Keys *keys,
|
||||
const struct TALER_ReservePrivateKeyP *reserve_priv,
|
||||
const struct TALER_EXCHANGE_AgeWithdrawCoinInput *coin_inputs,
|
||||
size_t num_coins,
|
||||
const struct TALER_EXCHANGE_AgeWithdrawCoinInput coin_inputs[const static
|
||||
num_coins],
|
||||
uint8_t max_age,
|
||||
TALER_EXCHANGE_AgeWithdrawCallback res_cb,
|
||||
void *res_cb_cls)
|
||||
@ -976,8 +953,8 @@ TALER_EXCHANGE_age_withdraw (
|
||||
return NULL;
|
||||
|
||||
if (GNUNET_OK != prepare_coins (awh,
|
||||
coin_inputs,
|
||||
num_coins))
|
||||
num_coins,
|
||||
coin_inputs))
|
||||
return NULL;
|
||||
|
||||
/* If there were no CS denominations, we can now perform the actual
|
||||
|
@ -559,7 +559,7 @@ TALER_EXCHANGE_batch_deposit (
|
||||
struct TALER_EXCHANGE_Keys *keys,
|
||||
const struct TALER_EXCHANGE_DepositContractDetail *dcd,
|
||||
unsigned int num_cdds,
|
||||
const struct TALER_EXCHANGE_CoinDepositDetail *cdds,
|
||||
const struct TALER_EXCHANGE_CoinDepositDetail cdds[static num_cdds],
|
||||
TALER_EXCHANGE_BatchDepositResultCallback cb,
|
||||
void *cb_cls,
|
||||
enum TALER_ErrorCode *ec)
|
||||
|
@ -270,8 +270,8 @@ phase_two (struct TALER_EXCHANGE_BatchWithdrawHandle *wh)
|
||||
wh->exchange_url,
|
||||
wh->keys,
|
||||
wh->reserve_priv,
|
||||
pds,
|
||||
wh->num_coins,
|
||||
pds,
|
||||
&handle_reserve_batch_withdraw_finished,
|
||||
wh);
|
||||
}
|
||||
@ -339,8 +339,8 @@ TALER_EXCHANGE_batch_withdraw (
|
||||
const char *exchange_url,
|
||||
const struct TALER_EXCHANGE_Keys *keys,
|
||||
const struct TALER_ReservePrivateKeyP *reserve_priv,
|
||||
const struct TALER_EXCHANGE_WithdrawCoinInput *wcis,
|
||||
unsigned int wci_length,
|
||||
const struct TALER_EXCHANGE_WithdrawCoinInput wcis[static wci_length],
|
||||
TALER_EXCHANGE_BatchWithdrawCallback res_cb,
|
||||
void *res_cb_cls)
|
||||
{
|
||||
|
@ -229,12 +229,12 @@ reserve_batch_withdraw_payment_required (
|
||||
rhistory))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
TALER_EXCHANGE_free_reserve_history (rhistory,
|
||||
len);
|
||||
TALER_EXCHANGE_free_reserve_history (len,
|
||||
rhistory);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
TALER_EXCHANGE_free_reserve_history (rhistory,
|
||||
len);
|
||||
TALER_EXCHANGE_free_reserve_history (len,
|
||||
rhistory);
|
||||
}
|
||||
|
||||
/* Check that funds were really insufficient */
|
||||
@ -391,8 +391,8 @@ TALER_EXCHANGE_batch_withdraw2 (
|
||||
const char *exchange_url,
|
||||
const struct TALER_EXCHANGE_Keys *keys,
|
||||
const struct TALER_ReservePrivateKeyP *reserve_priv,
|
||||
const struct TALER_PlanchetDetail *pds,
|
||||
unsigned int pds_length,
|
||||
const struct TALER_PlanchetDetail pds[static pds_length],
|
||||
TALER_EXCHANGE_BatchWithdraw2Callback res_cb,
|
||||
void *res_cb_cls)
|
||||
{
|
||||
|
@ -654,7 +654,7 @@ TALER_EXCHANGE_parse_reserve_history (
|
||||
struct TALER_Amount *total_in,
|
||||
struct TALER_Amount *total_out,
|
||||
unsigned int history_length,
|
||||
struct TALER_EXCHANGE_ReserveHistoryEntry *rhistory)
|
||||
struct TALER_EXCHANGE_ReserveHistoryEntry rhistory[static history_length])
|
||||
{
|
||||
const struct
|
||||
{
|
||||
@ -753,8 +753,8 @@ TALER_EXCHANGE_parse_reserve_history (
|
||||
|
||||
void
|
||||
TALER_EXCHANGE_free_reserve_history (
|
||||
struct TALER_EXCHANGE_ReserveHistoryEntry *rhistory,
|
||||
unsigned int len)
|
||||
unsigned int len,
|
||||
struct TALER_EXCHANGE_ReserveHistoryEntry rhistory[static len])
|
||||
{
|
||||
for (unsigned int i = 0; i<len; i++)
|
||||
{
|
||||
@ -2281,10 +2281,11 @@ fail:
|
||||
|
||||
|
||||
enum GNUNET_GenericReturnValue
|
||||
TALER_EXCHANGE_parse_accounts (const struct TALER_MasterPublicKeyP *master_pub,
|
||||
const json_t *accounts,
|
||||
struct TALER_EXCHANGE_WireAccount was[],
|
||||
unsigned int was_length)
|
||||
TALER_EXCHANGE_parse_accounts (
|
||||
const struct TALER_MasterPublicKeyP *master_pub,
|
||||
const json_t *accounts,
|
||||
unsigned int was_length,
|
||||
struct TALER_EXCHANGE_WireAccount was[static was_length])
|
||||
{
|
||||
memset (was,
|
||||
0,
|
||||
@ -2370,8 +2371,9 @@ TALER_EXCHANGE_parse_accounts (const struct TALER_MasterPublicKeyP *master_pub,
|
||||
|
||||
|
||||
void
|
||||
TALER_EXCHANGE_free_accounts (struct TALER_EXCHANGE_WireAccount *was,
|
||||
unsigned int was_len)
|
||||
TALER_EXCHANGE_free_accounts (
|
||||
unsigned int was_len,
|
||||
struct TALER_EXCHANGE_WireAccount was[static was_len])
|
||||
{
|
||||
for (unsigned int i = 0; i<was_len; i++)
|
||||
{
|
||||
|
@ -221,7 +221,7 @@ TALER_EXCHANGE_csr_melt (
|
||||
const char *url,
|
||||
const struct TALER_RefreshMasterSecretP *rms,
|
||||
unsigned int nks_len,
|
||||
struct TALER_EXCHANGE_NonceKey *nks,
|
||||
struct TALER_EXCHANGE_NonceKey nks[static nks_len],
|
||||
TALER_EXCHANGE_CsRMeltCallback res_cb,
|
||||
void *res_cb_cls)
|
||||
{
|
||||
|
@ -36,16 +36,16 @@
|
||||
struct TALER_EXCHANGE_KycCheckHandle
|
||||
{
|
||||
|
||||
/**
|
||||
* The connection to exchange this request handle will use
|
||||
*/
|
||||
struct TALER_EXCHANGE_Handle *exchange;
|
||||
|
||||
/**
|
||||
* The url for this request.
|
||||
*/
|
||||
char *url;
|
||||
|
||||
/**
|
||||
* Keys of the exchange.
|
||||
*/
|
||||
struct TALER_EXCHANGE_Keys *keys;
|
||||
|
||||
/**
|
||||
* Handle for the request.
|
||||
*/
|
||||
@ -111,7 +111,6 @@ handle_kyc_check_finished (void *cls,
|
||||
&status),
|
||||
GNUNET_JSON_spec_end ()
|
||||
};
|
||||
const struct TALER_EXCHANGE_Keys *key_state;
|
||||
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_JSON_parse (j,
|
||||
@ -126,9 +125,8 @@ handle_kyc_check_finished (void *cls,
|
||||
ks.details.ok.kyc_details = kyc_details;
|
||||
ks.details.ok.aml_status
|
||||
= (enum TALER_AmlDecisionState) status;
|
||||
key_state = TALER_EXCHANGE_get_keys (kch->exchange);
|
||||
if (GNUNET_OK !=
|
||||
TALER_EXCHANGE_test_signing_key (key_state,
|
||||
TALER_EXCHANGE_test_signing_key (kch->keys,
|
||||
&ks.details.ok.exchange_pub))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
@ -249,25 +247,21 @@ handle_kyc_check_finished (void *cls,
|
||||
|
||||
|
||||
struct TALER_EXCHANGE_KycCheckHandle *
|
||||
TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *exchange,
|
||||
uint64_t requirement_row,
|
||||
const struct TALER_PaytoHashP *h_payto,
|
||||
enum TALER_KYCLOGIC_KycUserType ut,
|
||||
struct GNUNET_TIME_Relative timeout,
|
||||
TALER_EXCHANGE_KycStatusCallback cb,
|
||||
void *cb_cls)
|
||||
TALER_EXCHANGE_kyc_check (
|
||||
struct GNUNET_CURL_Context *ctx,
|
||||
const char *url,
|
||||
struct TALER_EXCHANGE_Keys *keys,
|
||||
uint64_t requirement_row,
|
||||
const struct TALER_PaytoHashP *h_payto,
|
||||
enum TALER_KYCLOGIC_KycUserType ut,
|
||||
struct GNUNET_TIME_Relative timeout,
|
||||
TALER_EXCHANGE_KycStatusCallback cb,
|
||||
void *cb_cls)
|
||||
{
|
||||
struct TALER_EXCHANGE_KycCheckHandle *kch;
|
||||
CURL *eh;
|
||||
struct GNUNET_CURL_Context *ctx;
|
||||
char *arg_str;
|
||||
|
||||
if (GNUNET_YES !=
|
||||
TEAH_handle_is_ready (exchange))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
char payto_str[sizeof (*h_payto) * 2];
|
||||
char *end;
|
||||
@ -282,19 +276,19 @@ TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *exchange,
|
||||
timeout_ms = timeout.rel_value_us
|
||||
/ GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us;
|
||||
GNUNET_asprintf (&arg_str,
|
||||
"/kyc-check/%llu/%s/%s?timeout_ms=%llu",
|
||||
"kyc-check/%llu/%s/%s?timeout_ms=%llu",
|
||||
(unsigned long long) requirement_row,
|
||||
payto_str,
|
||||
TALER_KYCLOGIC_kyc_user_type2s (ut),
|
||||
timeout_ms);
|
||||
}
|
||||
kch = GNUNET_new (struct TALER_EXCHANGE_KycCheckHandle);
|
||||
kch->exchange = exchange;
|
||||
kch->h_payto = *h_payto;
|
||||
kch->cb = cb;
|
||||
kch->cb_cls = cb_cls;
|
||||
kch->url = TEAH_path_to_url (exchange,
|
||||
arg_str);
|
||||
kch->url = TALER_url_join (url,
|
||||
arg_str,
|
||||
NULL);
|
||||
GNUNET_free (arg_str);
|
||||
if (NULL == kch->url)
|
||||
{
|
||||
@ -309,7 +303,7 @@ TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *exchange,
|
||||
GNUNET_free (kch);
|
||||
return NULL;
|
||||
}
|
||||
ctx = TEAH_handle_to_context (exchange);
|
||||
kch->keys = TALER_EXCHANGE_keys_incref (keys);
|
||||
kch->job = GNUNET_CURL_job_add_with_ct_json (ctx,
|
||||
eh,
|
||||
&handle_kyc_check_finished,
|
||||
@ -326,6 +320,7 @@ TALER_EXCHANGE_kyc_check_cancel (struct TALER_EXCHANGE_KycCheckHandle *kch)
|
||||
GNUNET_CURL_job_cancel (kch->job);
|
||||
kch->job = NULL;
|
||||
}
|
||||
TALER_EXCHANGE_keys_decref (kch->keys);
|
||||
GNUNET_free (kch->url);
|
||||
GNUNET_free (kch);
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ TALER_EXCHANGE_purse_create_with_deposit (
|
||||
const struct TALER_ContractDiffiePrivateP *contract_priv,
|
||||
const json_t *contract_terms,
|
||||
unsigned int num_deposits,
|
||||
const struct TALER_EXCHANGE_PurseDeposit *deposits,
|
||||
const struct TALER_EXCHANGE_PurseDeposit deposits[static num_deposits],
|
||||
bool upload_contract,
|
||||
TALER_EXCHANGE_PurseCreateDepositCallback cb,
|
||||
void *cb_cls)
|
||||
|
@ -453,7 +453,7 @@ TALER_EXCHANGE_purse_deposit (
|
||||
const struct TALER_PurseContractPublicKeyP *purse_pub,
|
||||
uint8_t min_age,
|
||||
unsigned int num_deposits,
|
||||
const struct TALER_EXCHANGE_PurseDeposit *deposits,
|
||||
const struct TALER_EXCHANGE_PurseDeposit deposits[static num_deposits],
|
||||
TALER_EXCHANGE_PurseDepositCallback cb,
|
||||
void *cb_cls)
|
||||
{
|
||||
|
@ -311,7 +311,7 @@ TALER_EXCHANGE_refreshes_reveal (
|
||||
const struct TALER_RefreshMasterSecretP *rms,
|
||||
const struct TALER_EXCHANGE_RefreshData *rd,
|
||||
unsigned int num_coins,
|
||||
const struct TALER_ExchangeWithdrawValues *alg_values,
|
||||
const struct TALER_ExchangeWithdrawValues alg_values[static num_coins],
|
||||
uint32_t noreveal_index,
|
||||
TALER_EXCHANGE_RefreshesRevealCallback reveal_cb,
|
||||
void *reveal_cb_cls)
|
||||
|
@ -229,7 +229,7 @@ TALER_EXCHANGE_reserves_attest (
|
||||
const char *url,
|
||||
const struct TALER_ReservePrivateKeyP *reserve_priv,
|
||||
unsigned int attributes_length,
|
||||
const char *const*attributes,
|
||||
const char *attributes[const static attributes_length],
|
||||
TALER_EXCHANGE_ReservesPostAttestCallback cb,
|
||||
void *cb_cls)
|
||||
{
|
||||
|
@ -141,8 +141,8 @@ handle_reserves_history_ok (struct TALER_EXCHANGE_ReservesHistoryHandle *rsh,
|
||||
rhistory))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
TALER_EXCHANGE_free_reserve_history (rhistory,
|
||||
len);
|
||||
TALER_EXCHANGE_free_reserve_history (len,
|
||||
rhistory);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
if (NULL != rsh->cb)
|
||||
@ -153,8 +153,8 @@ handle_reserves_history_ok (struct TALER_EXCHANGE_ReservesHistoryHandle *rsh,
|
||||
&rs);
|
||||
rsh->cb = NULL;
|
||||
}
|
||||
TALER_EXCHANGE_free_reserve_history (rhistory,
|
||||
len);
|
||||
TALER_EXCHANGE_free_reserve_history (len,
|
||||
rhistory);
|
||||
}
|
||||
return GNUNET_OK;
|
||||
}
|
||||
|
@ -430,7 +430,8 @@ TALER_EXCHANGE_reserves_open (
|
||||
const struct TALER_ReservePrivateKeyP *reserve_priv,
|
||||
const struct TALER_Amount *reserve_contribution,
|
||||
unsigned int coin_payments_length,
|
||||
const struct TALER_EXCHANGE_PurseDeposit *coin_payments,
|
||||
const struct TALER_EXCHANGE_PurseDeposit coin_payments[
|
||||
static coin_payments_length],
|
||||
struct GNUNET_TIME_Timestamp expiration_time,
|
||||
uint32_t min_purses,
|
||||
TALER_EXCHANGE_ReservesOpenCallback cb,
|
||||
|
@ -129,8 +129,8 @@ handle_reserves_status_ok (struct TALER_EXCHANGE_ReservesStatusHandle *rsh,
|
||||
rhistory))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
TALER_EXCHANGE_free_reserve_history (rhistory,
|
||||
len);
|
||||
TALER_EXCHANGE_free_reserve_history (len,
|
||||
rhistory);
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
@ -142,8 +142,8 @@ handle_reserves_status_ok (struct TALER_EXCHANGE_ReservesStatusHandle *rsh,
|
||||
&rs);
|
||||
rsh->cb = NULL;
|
||||
}
|
||||
TALER_EXCHANGE_free_reserve_history (rhistory,
|
||||
len);
|
||||
TALER_EXCHANGE_free_reserve_history (len,
|
||||
rhistory);
|
||||
}
|
||||
return GNUNET_OK;
|
||||
}
|
||||
|
@ -38,9 +38,9 @@ struct TALER_EXCHANGE_WireHandle
|
||||
{
|
||||
|
||||
/**
|
||||
* The connection to exchange this request handle will use
|
||||
* The keys of the exchange this request handle will use
|
||||
*/
|
||||
struct TALER_EXCHANGE_Handle *exchange;
|
||||
struct TALER_EXCHANGE_Keys *keys;
|
||||
|
||||
/**
|
||||
* The url for this request.
|
||||
@ -199,7 +199,6 @@ handle_wire_finished (void *cls,
|
||||
{
|
||||
case 0:
|
||||
wr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
|
||||
wh->exchange->wire_error_count++;
|
||||
break;
|
||||
case MHD_HTTP_OK:
|
||||
{
|
||||
@ -220,7 +219,6 @@ handle_wire_finished (void *cls,
|
||||
GNUNET_JSON_spec_end ()
|
||||
};
|
||||
|
||||
wh->exchange->wire_error_count = 0;
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_JSON_parse (j,
|
||||
spec,
|
||||
@ -232,19 +230,14 @@ handle_wire_finished (void *cls,
|
||||
wr.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
|
||||
break;
|
||||
}
|
||||
if (0 != GNUNET_memcmp (&wh->keys->master_pub,
|
||||
&master_pub))
|
||||
{
|
||||
const struct TALER_EXCHANGE_Keys *key_state;
|
||||
|
||||
key_state = TALER_EXCHANGE_get_keys (wh->exchange);
|
||||
if (0 != GNUNET_memcmp (&key_state->master_pub,
|
||||
&master_pub))
|
||||
{
|
||||
/* bogus reply: master public key in /wire differs from that in /keys */
|
||||
GNUNET_break_op (0);
|
||||
wr.hr.http_status = 0;
|
||||
wr.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
|
||||
break;
|
||||
}
|
||||
/* bogus reply: master public key in /wire differs from that in /keys */
|
||||
GNUNET_break_op (0);
|
||||
wr.hr.http_status = 0;
|
||||
wr.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
|
||||
break;
|
||||
}
|
||||
|
||||
wr.details.ok.accounts_len
|
||||
@ -280,8 +273,8 @@ handle_wire_finished (void *cls,
|
||||
if (GNUNET_OK !=
|
||||
TALER_EXCHANGE_parse_accounts (&master_pub,
|
||||
accounts,
|
||||
was,
|
||||
wr.details.ok.accounts_len))
|
||||
wr.details.ok.accounts_len,
|
||||
was))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
wr.hr.http_status = 0;
|
||||
@ -293,8 +286,9 @@ handle_wire_finished (void *cls,
|
||||
&wr);
|
||||
wh->cb = NULL;
|
||||
}
|
||||
TALER_EXCHANGE_free_accounts (was,
|
||||
wr.details.ok.accounts_len);
|
||||
TALER_EXCHANGE_free_accounts (
|
||||
wr.details.ok.accounts_len,
|
||||
was);
|
||||
} /* end of 'parse accounts */
|
||||
free_fees (fbm,
|
||||
wr.details.ok.fees_len);
|
||||
@ -321,8 +315,6 @@ handle_wire_finished (void *cls,
|
||||
break;
|
||||
default:
|
||||
/* unexpected response code */
|
||||
if (MHD_HTTP_GATEWAY_TIMEOUT == response_code)
|
||||
wh->exchange->wire_error_count++;
|
||||
GNUNET_break_op (0);
|
||||
wr.hr.ec = TALER_JSON_get_error_code (j);
|
||||
wr.hr.hint = TALER_JSON_get_error_hint (j);
|
||||
@ -339,61 +331,23 @@ handle_wire_finished (void *cls,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compute the network timeout for the next request to /wire.
|
||||
*
|
||||
* @param exchange the exchange handle
|
||||
* @returns the timeout in seconds (for use by CURL)
|
||||
*/
|
||||
static long
|
||||
get_wire_timeout_seconds (struct TALER_EXCHANGE_Handle *exchange)
|
||||
{
|
||||
return GNUNET_MIN (60,
|
||||
5 + (1L << exchange->wire_error_count));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtain information about a exchange's wire instructions.
|
||||
* A exchange may provide wire instructions for creating
|
||||
* a reserve. The wire instructions also indicate
|
||||
* which wire formats merchants may use with the exchange.
|
||||
* This API is typically used by a wallet for wiring
|
||||
* funds, and possibly by a merchant to determine
|
||||
* supported wire formats.
|
||||
*
|
||||
* Note that while we return the (main) 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.
|
||||
*
|
||||
* @param exchange the exchange handle; the exchange must be ready to operate
|
||||
* @param wire_cb the callback to call when a reply for this request is available
|
||||
* @param wire_cb_cls closure for the above callback
|
||||
* @return a handle for this request
|
||||
*/
|
||||
struct TALER_EXCHANGE_WireHandle *
|
||||
TALER_EXCHANGE_wire (struct TALER_EXCHANGE_Handle *exchange,
|
||||
TALER_EXCHANGE_WireCallback wire_cb,
|
||||
void *wire_cb_cls)
|
||||
TALER_EXCHANGE_wire (
|
||||
struct GNUNET_CURL_Context *ctx,
|
||||
const char *url,
|
||||
struct TALER_EXCHANGE_Keys *keys,
|
||||
TALER_EXCHANGE_WireCallback wire_cb,
|
||||
void *wire_cb_cls)
|
||||
{
|
||||
struct TALER_EXCHANGE_WireHandle *wh;
|
||||
struct GNUNET_CURL_Context *ctx;
|
||||
CURL *eh;
|
||||
|
||||
if (GNUNET_YES !=
|
||||
TEAH_handle_is_ready (exchange))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return NULL;
|
||||
}
|
||||
wh = GNUNET_new (struct TALER_EXCHANGE_WireHandle);
|
||||
wh->exchange = exchange;
|
||||
wh->cb = wire_cb;
|
||||
wh->cb_cls = wire_cb_cls;
|
||||
wh->url = TEAH_path_to_url (exchange,
|
||||
"/wire");
|
||||
wh->url = TALER_url_join (url,
|
||||
"wire",
|
||||
NULL);
|
||||
if (NULL == wh->url)
|
||||
{
|
||||
GNUNET_free (wh);
|
||||
@ -410,8 +364,8 @@ TALER_EXCHANGE_wire (struct TALER_EXCHANGE_Handle *exchange,
|
||||
GNUNET_break (CURLE_OK ==
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_TIMEOUT,
|
||||
get_wire_timeout_seconds (wh->exchange)));
|
||||
ctx = TEAH_handle_to_context (exchange);
|
||||
60 /* seconds */));
|
||||
wh->keys = TALER_EXCHANGE_keys_incref (keys);
|
||||
wh->job = GNUNET_CURL_job_add_with_ct_json (ctx,
|
||||
eh,
|
||||
&handle_wire_finished,
|
||||
@ -420,14 +374,9 @@ TALER_EXCHANGE_wire (struct TALER_EXCHANGE_Handle *exchange,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cancel a wire information request. This function cannot be used
|
||||
* on a request handle if a response is already served for it.
|
||||
*
|
||||
* @param wh the wire information request handle
|
||||
*/
|
||||
void
|
||||
TALER_EXCHANGE_wire_cancel (struct TALER_EXCHANGE_WireHandle *wh)
|
||||
TALER_EXCHANGE_wire_cancel (
|
||||
struct TALER_EXCHANGE_WireHandle *wh)
|
||||
{
|
||||
if (NULL != wh->job)
|
||||
{
|
||||
@ -435,6 +384,7 @@ TALER_EXCHANGE_wire_cancel (struct TALER_EXCHANGE_WireHandle *wh)
|
||||
wh->job = NULL;
|
||||
}
|
||||
GNUNET_free (wh->url);
|
||||
TALER_EXCHANGE_keys_decref (wh->keys);
|
||||
GNUNET_free (wh);
|
||||
}
|
||||
|
||||
|
@ -202,12 +202,12 @@ reserve_withdraw_payment_required (
|
||||
rhistory))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
TALER_EXCHANGE_free_reserve_history (rhistory,
|
||||
len);
|
||||
TALER_EXCHANGE_free_reserve_history (len,
|
||||
rhistory);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
TALER_EXCHANGE_free_reserve_history (rhistory,
|
||||
len);
|
||||
TALER_EXCHANGE_free_reserve_history (len,
|
||||
rhistory);
|
||||
}
|
||||
|
||||
/* Check that funds were really insufficient */
|
||||
|
@ -326,8 +326,8 @@ batch_withdraw_run (void *cls,
|
||||
TALER_TESTING_get_exchange_url (is),
|
||||
TALER_TESTING_get_keys (is),
|
||||
rp,
|
||||
wcis,
|
||||
ws->num_coins,
|
||||
wcis,
|
||||
&reserve_batch_withdraw_cb,
|
||||
ws);
|
||||
if (NULL == ws->wsh)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of TALER
|
||||
Copyright (C) 2021 Taler Systems SA
|
||||
Copyright (C) 2021-2023 Taler Systems SA
|
||||
|
||||
TALER is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as
|
||||
@ -114,16 +114,12 @@ check_kyc_run (void *cls,
|
||||
const struct TALER_TESTING_Command *res_cmd;
|
||||
const uint64_t *requirement_row;
|
||||
const struct TALER_PaytoHashP *h_payto;
|
||||
struct TALER_EXCHANGE_Handle *exchange
|
||||
= TALER_TESTING_get_exchange (is);
|
||||
|
||||
(void) cmd;
|
||||
if (NULL == exchange)
|
||||
return;
|
||||
kcg->is = is;
|
||||
res_cmd = TALER_TESTING_interpreter_lookup_command (kcg->is,
|
||||
kcg->
|
||||
payment_target_reference);
|
||||
res_cmd = TALER_TESTING_interpreter_lookup_command (
|
||||
kcg->is,
|
||||
kcg->payment_target_reference);
|
||||
if (NULL == res_cmd)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
@ -152,13 +148,16 @@ check_kyc_run (void *cls,
|
||||
TALER_TESTING_interpreter_fail (kcg->is);
|
||||
return;
|
||||
}
|
||||
kcg->kwh = TALER_EXCHANGE_kyc_check (exchange,
|
||||
*requirement_row,
|
||||
h_payto,
|
||||
TALER_KYCLOGIC_KYC_UT_INDIVIDUAL,
|
||||
GNUNET_TIME_UNIT_SECONDS,
|
||||
&check_kyc_cb,
|
||||
kcg);
|
||||
kcg->kwh = TALER_EXCHANGE_kyc_check (
|
||||
TALER_TESTING_interpreter_get_context (is),
|
||||
TALER_TESTING_get_exchange_url (is),
|
||||
TALER_TESTING_get_keys (is),
|
||||
*requirement_row,
|
||||
h_payto,
|
||||
TALER_KYCLOGIC_KYC_UT_INDIVIDUAL,
|
||||
GNUNET_TIME_UNIT_SECONDS,
|
||||
&check_kyc_cb,
|
||||
kcg);
|
||||
GNUNET_assert (NULL != kcg->kwh);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of TALER
|
||||
Copyright (C) 2018 Taler Systems SA
|
||||
Copyright (C) 2018, 2023 Taler Systems SA
|
||||
|
||||
TALER is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
@ -191,16 +191,15 @@ wire_run (void *cls,
|
||||
struct TALER_TESTING_Interpreter *is)
|
||||
{
|
||||
struct WireState *ws = cls;
|
||||
struct TALER_EXCHANGE_Handle *exchange
|
||||
= TALER_TESTING_get_exchange (is);
|
||||
|
||||
ws->cmd = cmd;
|
||||
if (NULL == exchange)
|
||||
return;
|
||||
ws->is = is;
|
||||
ws->wh = TALER_EXCHANGE_wire (exchange,
|
||||
&wire_cb,
|
||||
ws);
|
||||
ws->wh = TALER_EXCHANGE_wire (
|
||||
TALER_TESTING_interpreter_get_context (is),
|
||||
TALER_TESTING_get_exchange_url (is),
|
||||
TALER_TESTING_get_keys (is),
|
||||
&wire_cb,
|
||||
ws);
|
||||
}
|
||||
|
||||
|
||||
@ -228,17 +227,6 @@ wire_cleanup (void *cls,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a "wire" command.
|
||||
*
|
||||
* @param label the command label.
|
||||
* @param expected_method which wire-transfer method is expected
|
||||
* to be offered by the exchange.
|
||||
* @param expected_fee the fee the exchange should charge.
|
||||
* @param expected_response_code the HTTP response the exchange
|
||||
* should return.
|
||||
* @return the command.
|
||||
*/
|
||||
struct TALER_TESTING_Command
|
||||
TALER_TESTING_cmd_wire (const char *label,
|
||||
const char *expected_method,
|
||||
|
Loading…
Reference in New Issue
Block a user