diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-06-09 20:57:17 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-06-09 20:57:17 +0200 |
commit | 1fe7e885c9f3ac200c8dc6c1badbe09e7235a980 (patch) | |
tree | 265d14c49bba59f6275a868cbf492c17cfa4f8d3 | |
parent | 7afcc8275c0e8e19ceeb178bca21c7988966cba5 (diff) |
pass base URIs instead of full URIs
-rw-r--r-- | src/include/taler_merchant_service.h | 10 | ||||
-rw-r--r-- | src/lib/merchant_api_contract.c | 5 | ||||
-rw-r--r-- | src/lib/merchant_api_pay.c | 11 | ||||
-rw-r--r-- | src/lib/merchant_api_track_transaction.c | 5 | ||||
-rw-r--r-- | src/lib/merchant_api_track_transfer.c | 5 | ||||
-rw-r--r-- | src/lib/test_merchant_api.c | 8 |
6 files changed, 25 insertions, 19 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 5b959bfc..48274db1 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -63,7 +63,7 @@ typedef void * details). * * @param ctx execution context - * @param backend_uri URI of the backend + * @param backend_uri base URI of the backend * @param contract prototype of the contract * @param contract_cb the callback to call when a reply for this request is available * @param contract_cb_cls closure for @a contract_cb @@ -160,7 +160,7 @@ struct TALER_MERCHANT_PayCoin * Pay a merchant. API for wallets that have the coin's private keys. * * @param ctx execution context - * @param merchant_uri URI of the merchant + * @param merchant_uri base URI of the merchant * @param h_wire hash of the merchant’s account details * @param h_contract hash of the contact of the merchant with the customer * @param transaction_id transaction id for the transaction between merchant and customer @@ -248,7 +248,7 @@ struct TALER_MERCHANT_PaidCoin * in the type of @a coins compared to #TALER_MERCHANT_pay(). * * @param ctx execution context - * @param merchant_uri URI of the merchant + * @param merchant_uri base URI of the merchant * @param h_contract hash of the contact of the merchant with the customer * @param amount total value of the contract to be paid to the merchant * @param max_fee maximum fee covered by the merchant (according to the contract) @@ -316,7 +316,7 @@ typedef void * Request backend to return deposits associated with a given wtid. * * @param ctx execution context - * @param backend_uri URI of the backend (having /track/transfer appended) + * @param backend_uri base URI of the backend * @param wtid base32 string indicating a wtid * @param exchange base URL of the exchange in charge of returning the wanted information * @param track_transfer_cb the callback to call when a reply for this request is available @@ -361,7 +361,7 @@ typedef void * Request backend to return deposits associated with a given wtid. * * @param ctx execution context - * @param backend_uri URI of the backend (having /track/transaction appended) + * @param backend_uri base URI of the backend * @param wtid base32 string indicating a wtid * @param exchange base URL of the exchange in charge of returning the wanted information * @param track_transaction_cb the callback to call when a reply for this request is available diff --git a/src/lib/merchant_api_contract.c b/src/lib/merchant_api_contract.c index 1938afa6..1addfba7 100644 --- a/src/lib/merchant_api_contract.c +++ b/src/lib/merchant_api_contract.c @@ -184,7 +184,10 @@ TALER_MERCHANT_contract_sign (struct GNUNET_CURL_Context *ctx, co->ctx = ctx; co->cb = contract_cb; co->cb_cls = contract_cb_cls; - co->url = GNUNET_strdup (backend_uri); + GNUNET_asprintf (&co->url, + "%s%s", + backend_uri, + "/contract"); req = json_pack ("{s:O}", "contract", (json_t *) contract); diff --git a/src/lib/merchant_api_pay.c b/src/lib/merchant_api_pay.c index 7cdea830..ffe29c4d 100644 --- a/src/lib/merchant_api_pay.c +++ b/src/lib/merchant_api_pay.c @@ -244,7 +244,7 @@ handle_pay_finished (void *cls, * Pay a merchant. API for wallets that have the coin's private keys. * * @param ctx the execution loop context - * @param exchange_uri URI of the exchange that the coins belong to + * @param merchant_uri base URI of the merchant's backend * @param h_wire hash of the merchant’s account details * @param h_contract hash of the contact of the merchant with the customer * @param transaction_id transaction id for the transaction between merchant and customer @@ -256,6 +256,7 @@ handle_pay_finished (void *cls, * @param transaction_id transaction id for the transaction between merchant and customer * @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests) * @param refund_deadline date until which the merchant can issue a refund to the customer via the merchant (can be zero if refunds are not allowed) + * @param exchange_uri URI of the exchange that the coins belong to * @param num_coins number of coins used to pay * @param coins array of coins we use to pay * @param coin_sig the signature made with purpose #TALER_SIGNATURE_WALLET_COIN_DEPOSIT made by the customer with the coin’s private key. @@ -353,12 +354,13 @@ TALER_MERCHANT_pay_wallet (struct GNUNET_CURL_Context *ctx, * in the type of @a coins compared to #TALER_MERCHANT_pay(). * * @param ctx the execution loop context - * @param exchange_uri URI of the exchange that the coins belong to + * @param merchant_uri base URI of the merchant's backend * @param h_contract hash of the contact of the merchant with the customer * @param timestamp timestamp when the contract was finalized, must match approximately the current time of the merchant * @param transaction_id transaction id for the transaction between merchant and customer * @param refund_deadline date until which the merchant can issue a refund to the customer via the merchant (can be zero if refunds are not allowed) * @param wire_transfer_deadline date by which the merchant would like the exchange to execute the wire transfer (can be zero if there is no specific date desired by the frontend). If non-zero, must be larger than @a refund_deadline. + * @param exchange_uri URI of the exchange that the coins belong to * @param num_coins number of coins used to pay * @param coins array of coins we use to pay * @param coin_sig the signature made with purpose #TALER_SIGNATURE_WALLET_COIN_DEPOSIT made by the customer with the coin’s private key. @@ -561,7 +563,10 @@ TALER_MERCHANT_pay_frontend (struct GNUNET_CURL_Context *ctx, ph->ctx = ctx; ph->cb = pay_cb; ph->cb_cls = pay_cb_cls; - ph->url = GNUNET_strdup (merchant_uri); + GNUNET_asprintf (&ph->url, + "%s%s", + merchant_uri, + "/pay"); ph->num_coins = num_coins; ph->coins = GNUNET_new_array (num_coins, struct TALER_MERCHANT_PaidCoin); diff --git a/src/lib/merchant_api_track_transaction.c b/src/lib/merchant_api_track_transaction.c index 356c0852..dcb7e531 100644 --- a/src/lib/merchant_api_track_transaction.c +++ b/src/lib/merchant_api_track_transaction.c @@ -129,7 +129,7 @@ handle_tracktransaction_finished (void *cls, * Request backend to return transactions associated with a given wtid. * * @param ctx execution context - * @param backend_uri URI of the backend (having "/track/transaction" appended) + * @param backend_uri base URI of the backend * @param wtid base32 string indicating a wtid * @param exchange base URL of the exchange in charge of returning the wanted information * @param track_transaction_cb the callback to call when a reply for this request is available @@ -151,9 +151,8 @@ TALER_MERCHANT_track_transaction (struct GNUNET_CURL_Context *ctx, tdo->ctx = ctx; tdo->cb = track_transaction_cb; tdo->cb_cls = track_transaction_cb_cls; - /* URI gotten with /track/transaction already appended... */ GNUNET_asprintf (&tdo->url, - "%s?transaction=%llu&exchange=%s", + "%s/track/transaction?transaction=%llu&exchange=%s", backend_uri, (unsigned long long) transaction_id, exchange_uri); diff --git a/src/lib/merchant_api_track_transfer.c b/src/lib/merchant_api_track_transfer.c index 9b87f9ce..111934d6 100644 --- a/src/lib/merchant_api_track_transfer.c +++ b/src/lib/merchant_api_track_transfer.c @@ -129,7 +129,7 @@ handle_track_transfer_finished (void *cls, * Request backend to return transfers associated with a given wtid. * * @param ctx execution context - * @param backend_uri URI of the backend (having "/track/transfer" appended) + * @param backend_uri base URI of the backend * @param wtid base32 string indicating a wtid * @param exchange base URL of the exchange in charge of returning the wanted information * @param tracktransfer_cb the callback to call when a reply for this request is available @@ -154,9 +154,8 @@ TALER_MERCHANT_track_transfer (struct GNUNET_CURL_Context *ctx, tdo->ctx = ctx; tdo->cb = tracktransfer_cb; tdo->cb_cls = tracktransfer_cb_cls; - /* URI gotten with /track/transfer already appended... */ GNUNET_asprintf (&tdo->url, - "%s?wtid=%s&exchange=%s", + "%s/track/transfer?wtid=%s&exchange=%s", backend_uri, wtid_str, exchange_uri); diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c index df423519..cd4d147c 100644 --- a/src/lib/test_merchant_api.c +++ b/src/lib/test_merchant_api.c @@ -33,7 +33,7 @@ /** * URI under which the merchant is reachable during the testcase. */ -#define MERCHANT_URI "http://localhost:8082/" +#define MERCHANT_URI "http://localhost:8082" /** * URI under which the exchange is reachable during the testcase. @@ -1246,7 +1246,7 @@ interpreter_run (void *cls) } cmd->details.contract.co = TALER_MERCHANT_contract_sign (ctx, - MERCHANT_URI "contract", + MERCHANT_URI, proposal, &contract_cb, is); @@ -1355,7 +1355,7 @@ interpreter_run (void *cls) cmd->details.pay.ph = TALER_MERCHANT_pay_wallet (ctx, - MERCHANT_URI "pay", + MERCHANT_URI, &h_contract, transaction_id, &total_amount, @@ -1449,7 +1449,7 @@ interpreter_run (void *cls) GNUNET_assert (NULL != ref); cmd->details.track_deposit.tdo = TALER_MERCHANT_track_transfer (ctx, - MERCHANT_URI "track/deposit", + MERCHANT_URI, &ref->details.check_bank_transfer.wtid, EXCHANGE_URI, &track_deposit_cb, |