diff options
Diffstat (limited to 'src/lib/exchange_api_refund.c')
-rw-r--r-- | src/lib/exchange_api_refund.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c index c64dcc97a..9cb8794d3 100644 --- a/src/lib/exchange_api_refund.c +++ b/src/lib/exchange_api_refund.c | |||
@@ -81,14 +81,14 @@ struct TALER_EXCHANGE_RefundHandle | |||
81 | * Verify that the signature on the "200 OK" response | 81 | * Verify that the signature on the "200 OK" response |
82 | * from the exchange is valid. | 82 | * from the exchange is valid. |
83 | * | 83 | * |
84 | * @param rh refund handle | 84 | * @param[in,out] rh refund handle (refund fee added) |
85 | * @param json json reply with the signature | 85 | * @param json json reply with the signature |
86 | * @param[out] exchange_pub set to the exchange's public key | 86 | * @param[out] exchange_pub set to the exchange's public key |
87 | * @param[out] exchange_sig set to the exchange's signature | 87 | * @param[out] exchange_sig set to the exchange's signature |
88 | * @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not | 88 | * @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not |
89 | */ | 89 | */ |
90 | static int | 90 | static int |
91 | verify_refund_signature_ok (const struct TALER_EXCHANGE_RefundHandle *rh, | 91 | verify_refund_signature_ok (struct TALER_EXCHANGE_RefundHandle *rh, |
92 | const json_t *json, | 92 | const json_t *json, |
93 | struct TALER_ExchangePublicKeyP *exchange_pub, | 93 | struct TALER_ExchangePublicKeyP *exchange_pub, |
94 | struct TALER_ExchangeSignatureP *exchange_sig) | 94 | struct TALER_ExchangeSignatureP *exchange_sig) |
@@ -96,8 +96,9 @@ verify_refund_signature_ok (const struct TALER_EXCHANGE_RefundHandle *rh, | |||
96 | { | 96 | { |
97 | const struct TALER_EXCHANGE_Keys *key_state; | 97 | const struct TALER_EXCHANGE_Keys *key_state; |
98 | struct GNUNET_JSON_Specification spec[] = { | 98 | struct GNUNET_JSON_Specification spec[] = { |
99 | GNUNET_JSON_spec_fixed_auto ("sig", exchange_sig), | 99 | GNUNET_JSON_spec_fixed_auto ("exchange_sig", exchange_sig), |
100 | GNUNET_JSON_spec_fixed_auto ("pub", exchange_pub), | 100 | GNUNET_JSON_spec_fixed_auto ("exchange_pub", exchange_pub), |
101 | TALER_JSON_spec_amount_nbo ("refund_fee", &rh->depconf.refund_fee), | ||
101 | GNUNET_JSON_spec_end () | 102 | GNUNET_JSON_spec_end () |
102 | }; | 103 | }; |
103 | 104 | ||
@@ -256,7 +257,6 @@ handle_refund_finished (void *cls, | |||
256 | * @param amount the amount to be refunded; must be larger than the refund fee | 257 | * @param amount the amount to be refunded; must be larger than the refund fee |
257 | * (as that fee is still being subtracted), and smaller than the amount | 258 | * (as that fee is still being subtracted), and smaller than the amount |
258 | * (with deposit fee) of the original deposit contribution of this coin | 259 | * (with deposit fee) of the original deposit contribution of this coin |
259 | * @param refund_fee fee applicable to this coin for the refund | ||
260 | * @param h_contract_terms hash of the contact of the merchant with the customer that is being refunded | 260 | * @param h_contract_terms hash of the contact of the merchant with the customer that is being refunded |
261 | * @param coin_pub coin’s public key of the coin from the original deposit operation | 261 | * @param coin_pub coin’s public key of the coin from the original deposit operation |
262 | * @param rtransaction_id transaction id for the transaction between merchant and customer (of refunding operation); | 262 | * @param rtransaction_id transaction id for the transaction between merchant and customer (of refunding operation); |
@@ -272,7 +272,6 @@ handle_refund_finished (void *cls, | |||
272 | struct TALER_EXCHANGE_RefundHandle * | 272 | struct TALER_EXCHANGE_RefundHandle * |
273 | TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, | 273 | TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, |
274 | const struct TALER_Amount *amount, | 274 | const struct TALER_Amount *amount, |
275 | const struct TALER_Amount *refund_fee, | ||
276 | const struct GNUNET_HashCode *h_contract_terms, | 275 | const struct GNUNET_HashCode *h_contract_terms, |
277 | const struct TALER_CoinSpendPublicKeyP *coin_pub, | 276 | const struct TALER_CoinSpendPublicKeyP *coin_pub, |
278 | uint64_t rtransaction_id, | 277 | uint64_t rtransaction_id, |
@@ -294,14 +293,11 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, | |||
294 | rr.rtransaction_id = GNUNET_htonll (rtransaction_id); | 293 | rr.rtransaction_id = GNUNET_htonll (rtransaction_id); |
295 | TALER_amount_hton (&rr.refund_amount, | 294 | TALER_amount_hton (&rr.refund_amount, |
296 | amount); | 295 | amount); |
297 | TALER_amount_hton (&rr.refund_fee, | ||
298 | refund_fee); | ||
299 | GNUNET_CRYPTO_eddsa_sign (&merchant_priv->eddsa_priv, | 296 | GNUNET_CRYPTO_eddsa_sign (&merchant_priv->eddsa_priv, |
300 | &rr, | 297 | &rr, |
301 | &merchant_sig.eddsa_sig); | 298 | &merchant_sig.eddsa_sig); |
302 | return TALER_EXCHANGE_refund2 (exchange, | 299 | return TALER_EXCHANGE_refund2 (exchange, |
303 | amount, | 300 | amount, |
304 | refund_fee, | ||
305 | h_contract_terms, | 301 | h_contract_terms, |
306 | coin_pub, | 302 | coin_pub, |
307 | rtransaction_id, | 303 | rtransaction_id, |
@@ -329,7 +325,6 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, | |||
329 | * @param amount the amount to be refunded; must be larger than the refund fee | 325 | * @param amount the amount to be refunded; must be larger than the refund fee |
330 | * (as that fee is still being subtracted), and smaller than the amount | 326 | * (as that fee is still being subtracted), and smaller than the amount |
331 | * (with deposit fee) of the original deposit contribution of this coin | 327 | * (with deposit fee) of the original deposit contribution of this coin |
332 | * @param refund_fee fee applicable to this coin for the refund | ||
333 | * @param h_contract_terms hash of the contact of the merchant with the customer that is being refunded | 328 | * @param h_contract_terms hash of the contact of the merchant with the customer that is being refunded |
334 | * @param coin_pub coin’s public key of the coin from the original deposit operation | 329 | * @param coin_pub coin’s public key of the coin from the original deposit operation |
335 | * @param rtransaction_id transaction id for the transaction between merchant and customer (of refunding operation); | 330 | * @param rtransaction_id transaction id for the transaction between merchant and customer (of refunding operation); |
@@ -346,7 +341,6 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, | |||
346 | struct TALER_EXCHANGE_RefundHandle * | 341 | struct TALER_EXCHANGE_RefundHandle * |
347 | TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange, | 342 | TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange, |
348 | const struct TALER_Amount *amount, | 343 | const struct TALER_Amount *amount, |
349 | const struct TALER_Amount *refund_fee, | ||
350 | const struct GNUNET_HashCode *h_contract_terms, | 344 | const struct GNUNET_HashCode *h_contract_terms, |
351 | const struct TALER_CoinSpendPublicKeyP *coin_pub, | 345 | const struct TALER_CoinSpendPublicKeyP *coin_pub, |
352 | uint64_t rtransaction_id, | 346 | uint64_t rtransaction_id, |
@@ -376,12 +370,11 @@ TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange, | |||
376 | "/coins/%s/refund", | 370 | "/coins/%s/refund", |
377 | pub_str); | 371 | pub_str); |
378 | } | 372 | } |
379 | refund_obj = json_pack ("{s:o, s:o," /* amount/fee */ | 373 | refund_obj = json_pack ("{s:o," /* amount */ |
380 | " s:o," /* h_contract_terms */ | 374 | " s:o," /* h_contract_terms */ |
381 | " s:I," /* rtransaction id */ | 375 | " s:I," /* rtransaction id */ |
382 | " s:o, s:o}", /* merchant_pub, merchant_sig */ | 376 | " s:o, s:o}", /* merchant_pub, merchant_sig */ |
383 | "refund_amount", TALER_JSON_from_amount (amount), | 377 | "refund_amount", TALER_JSON_from_amount (amount), |
384 | "refund_fee", TALER_JSON_from_amount (refund_fee), | ||
385 | "h_contract_terms", GNUNET_JSON_from_data_auto ( | 378 | "h_contract_terms", GNUNET_JSON_from_data_auto ( |
386 | h_contract_terms), | 379 | h_contract_terms), |
387 | "rtransaction_id", (json_int_t) rtransaction_id, | 380 | "rtransaction_id", (json_int_t) rtransaction_id, |
@@ -410,8 +403,6 @@ TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange, | |||
410 | rh->depconf.rtransaction_id = GNUNET_htonll (rtransaction_id); | 403 | rh->depconf.rtransaction_id = GNUNET_htonll (rtransaction_id); |
411 | TALER_amount_hton (&rh->depconf.refund_amount, | 404 | TALER_amount_hton (&rh->depconf.refund_amount, |
412 | amount); | 405 | amount); |
413 | TALER_amount_hton (&rh->depconf.refund_fee, | ||
414 | refund_fee); | ||
415 | 406 | ||
416 | eh = TALER_EXCHANGE_curl_easy_get_ (rh->url); | 407 | eh = TALER_EXCHANGE_curl_easy_get_ (rh->url); |
417 | if ( (NULL == eh) || | 408 | if ( (NULL == eh) || |