summaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_kyc_wallet.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/exchange_api_kyc_wallet.c')
-rw-r--r--src/lib/exchange_api_kyc_wallet.c63
1 files changed, 33 insertions, 30 deletions
diff --git a/src/lib/exchange_api_kyc_wallet.c b/src/lib/exchange_api_kyc_wallet.c
index fe5e6b702..7197694ae 100644
--- a/src/lib/exchange_api_kyc_wallet.c
+++ b/src/lib/exchange_api_kyc_wallet.c
@@ -43,11 +43,6 @@ struct TALER_EXCHANGE_KycWalletHandle
struct TALER_CURL_PostContext ctx;
/**
- * The connection to exchange this request handle will use
- */
- struct TALER_EXCHANGE_Handle *exchange;
-
- /**
* The url for this request.
*/
char *url;
@@ -95,11 +90,28 @@ handle_kyc_wallet_finished (void *cls,
case 0:
ks.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
break;
- case MHD_HTTP_OK:
+ case MHD_HTTP_NO_CONTENT:
+ break;
+ case MHD_HTTP_BAD_REQUEST:
+ ks.ec = TALER_JSON_get_error_code (j);
+ /* This should never happen, either us or the exchange is buggy
+ (or API version conflict); just pass JSON reply to the application */
+ break;
+ case MHD_HTTP_FORBIDDEN:
+ ks.ec = TALER_JSON_get_error_code (j);
+ break;
+ case MHD_HTTP_NOT_FOUND:
+ ks.ec = TALER_JSON_get_error_code (j);
+ break;
+ case MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS:
{
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_uint64 ("payment_target_uuid",
- &ks.payment_target_uuid),
+ GNUNET_JSON_spec_fixed_auto (
+ "h_payto",
+ &ks.details.unavailable_for_legal_reasons.h_payto),
+ GNUNET_JSON_spec_uint64 (
+ "requirement_row",
+ &ks.details.unavailable_for_legal_reasons.requirement_row),
GNUNET_JSON_spec_end ()
};
@@ -115,19 +127,6 @@ handle_kyc_wallet_finished (void *cls,
}
break;
}
- case MHD_HTTP_NO_CONTENT:
- break;
- case MHD_HTTP_BAD_REQUEST:
- ks.ec = TALER_JSON_get_error_code (j);
- /* This should never happen, either us or the exchange is buggy
- (or API version conflict); just pass JSON reply to the application */
- break;
- case MHD_HTTP_FORBIDDEN:
- ks.ec = TALER_JSON_get_error_code (j);
- break;
- case MHD_HTTP_NOT_FOUND:
- ks.ec = TALER_JSON_get_error_code (j);
- break;
case MHD_HTTP_INTERNAL_SERVER_ERROR:
ks.ec = TALER_JSON_get_error_code (j);
/* Server had an internal issue; we should retry, but this API
@@ -150,41 +149,45 @@ handle_kyc_wallet_finished (void *cls,
struct TALER_EXCHANGE_KycWalletHandle *
-TALER_EXCHANGE_kyc_wallet (struct TALER_EXCHANGE_Handle *exchange,
- const struct TALER_ReservePrivateKeyP *reserve_priv,
- TALER_EXCHANGE_KycWalletCallback cb,
- void *cb_cls)
+TALER_EXCHANGE_kyc_wallet (
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ const struct TALER_ReservePrivateKeyP *reserve_priv,
+ const struct TALER_Amount *balance,
+ TALER_EXCHANGE_KycWalletCallback cb,
+ void *cb_cls)
{
struct TALER_EXCHANGE_KycWalletHandle *kwh;
CURL *eh;
json_t *req;
- struct GNUNET_CURL_Context *ctx;
struct TALER_ReservePublicKeyP reserve_pub;
struct TALER_ReserveSignatureP reserve_sig;
GNUNET_CRYPTO_eddsa_key_get_public (&reserve_priv->eddsa_priv,
&reserve_pub.eddsa_pub);
TALER_wallet_account_setup_sign (reserve_priv,
+ balance,
&reserve_sig);
req = GNUNET_JSON_PACK (
+ TALER_JSON_pack_amount ("balance",
+ balance),
GNUNET_JSON_pack_data_auto ("reserve_pub",
&reserve_pub),
GNUNET_JSON_pack_data_auto ("reserve_sig",
&reserve_sig));
GNUNET_assert (NULL != req);
kwh = GNUNET_new (struct TALER_EXCHANGE_KycWalletHandle);
- kwh->exchange = exchange;
kwh->cb = cb;
kwh->cb_cls = cb_cls;
- kwh->url = TEAH_path_to_url (exchange,
- "/kyc-wallet");
+ kwh->url = TALER_url_join (url,
+ "kyc-wallet",
+ NULL);
if (NULL == kwh->url)
{
json_decref (req);
GNUNET_free (kwh);
return NULL;
}
- ctx = TEAH_handle_to_context (exchange);
eh = TALER_EXCHANGE_curl_easy_get_ (kwh->url);
if ( (NULL == eh) ||
(GNUNET_OK !=