aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-05-05 22:17:16 +0200
committerChristian Grothoff <christian@grothoff.org>2020-07-05 16:35:00 +0200
commit727b7b04f3ae23fd49da7479fe4b4258513aef83 (patch)
treefb82190537a3ef1e023d8d95a8a840d85f2eb34c
parente0e06276b959e499fc9c8f1d62bf776dfb348032 (diff)
downloadexchange-727b7b04f3ae23fd49da7479fe4b4258513aef83.tar.gz
exchange-727b7b04f3ae23fd49da7479fe4b4258513aef83.zip
return fee as well
-rw-r--r--src/include/taler_error_codes.h19
-rw-r--r--src/include/taler_exchange_service.h2
-rw-r--r--src/lib/exchange_api_refund.c4
-rw-r--r--src/testing/testing_api_cmd_refund.c3
4 files changed, 27 insertions, 1 deletions
diff --git a/src/include/taler_error_codes.h b/src/include/taler_error_codes.h
index f75464c35..74660303d 100644
--- a/src/include/taler_error_codes.h
+++ b/src/include/taler_error_codes.h
@@ -2199,6 +2199,25 @@ enum TALER_ErrorCode
2199 TALER_EC_TIP_PICKUP_UNBLIND_FAILURE = 2812, 2199 TALER_EC_TIP_PICKUP_UNBLIND_FAILURE = 2812,
2200 2200
2201 /** 2201 /**
2202 * We failed to fetch contract terms from our merchant database. The
2203 * response is provided with HTTP status code
2204 * #MHD_HTTP_INTERNAL_SERVER_ERROR.
2205 */
2206 TALER_EC_GET_ORDERS_DB_LOOKUP_ERROR = 2900,
2207
2208 /**
2209 * We failed to find the contract terms from our merchant database.
2210 * The response is provided with HTTP status code #MHD_HTTP_NOT_FOUND.
2211 */
2212 TALER_EC_GET_ORDERS_ID_UNKNOWN = 2901,
2213
2214 /**
2215 * The contract hash provided by the wallet does not match the order.
2216 * The response is provided with HTTP status code #MHD_HTTP_FORBIDDEN.
2217 */
2218 TALER_EC_GET_ORDERS_WRONG_CONTRACT = 2902,
2219
2220 /**
2202 * We failed to contract terms from our merchant database. The 2221 * We failed to contract terms from our merchant database. The
2203 * response is provided with HTTP status code 2222 * response is provided with HTTP status code
2204 * #MHD_HTTP_INTERNAL_SERVER_ERROR. 2223 * #MHD_HTTP_INTERNAL_SERVER_ERROR.
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index f94b8253d..82b9b83df 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -851,6 +851,7 @@ struct TALER_EXCHANGE_RefundHandle;
851 * 851 *
852 * @param cls closure 852 * @param cls closure
853 * @param hr HTTP response data 853 * @param hr HTTP response data
854 * @param refund_fee the refund fee the exchange charged us
854 * @param sign_key exchange key used to sign @a obj, or NULL 855 * @param sign_key exchange key used to sign @a obj, or NULL
855 * @param signature the actual signature, or NULL on error 856 * @param signature the actual signature, or NULL on error
856 */ 857 */
@@ -858,6 +859,7 @@ typedef void
858(*TALER_EXCHANGE_RefundCallback) ( 859(*TALER_EXCHANGE_RefundCallback) (
859 void *cls, 860 void *cls,
860 const struct TALER_EXCHANGE_HttpResponse *hr, 861 const struct TALER_EXCHANGE_HttpResponse *hr,
862 const struct TALER_Amount *refund_fee,
861 const struct TALER_ExchangePublicKeyP *sign_key, 863 const struct TALER_ExchangePublicKeyP *sign_key,
862 const struct TALER_ExchangeSignatureP *signature); 864 const struct TALER_ExchangeSignatureP *signature);
863 865
diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c
index 9cb8794d3..b1ea176bf 100644
--- a/src/lib/exchange_api_refund.c
+++ b/src/lib/exchange_api_refund.c
@@ -92,7 +92,6 @@ 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)
95
96{ 95{
97 const struct TALER_EXCHANGE_Keys *key_state; 96 const struct TALER_EXCHANGE_Keys *key_state;
98 struct GNUNET_JSON_Specification spec[] = { 97 struct GNUNET_JSON_Specification spec[] = {
@@ -149,6 +148,7 @@ handle_refund_finished (void *cls,
149 struct TALER_ExchangeSignatureP exchange_sig; 148 struct TALER_ExchangeSignatureP exchange_sig;
150 struct TALER_ExchangePublicKeyP *ep = NULL; 149 struct TALER_ExchangePublicKeyP *ep = NULL;
151 struct TALER_ExchangeSignatureP *es = NULL; 150 struct TALER_ExchangeSignatureP *es = NULL;
151 struct TALER_Amount *rf = NULL;
152 const json_t *j = response; 152 const json_t *j = response;
153 struct TALER_EXCHANGE_HttpResponse hr = { 153 struct TALER_EXCHANGE_HttpResponse hr = {
154 .reply = j, 154 .reply = j,
@@ -176,6 +176,7 @@ handle_refund_finished (void *cls,
176 { 176 {
177 ep = &exchange_pub; 177 ep = &exchange_pub;
178 es = &exchange_sig; 178 es = &exchange_sig;
179 rf = &rh->depconf.refund_fee;
179 } 180 }
180 break; 181 break;
181 case MHD_HTTP_BAD_REQUEST: 182 case MHD_HTTP_BAD_REQUEST:
@@ -234,6 +235,7 @@ handle_refund_finished (void *cls,
234 } 235 }
235 rh->cb (rh->cb_cls, 236 rh->cb (rh->cb_cls,
236 &hr, 237 &hr,
238 rf,
237 ep, 239 ep,
238 es); 240 es);
239 TALER_EXCHANGE_refund_cancel (rh); 241 TALER_EXCHANGE_refund_cancel (rh);
diff --git a/src/testing/testing_api_cmd_refund.c b/src/testing/testing_api_cmd_refund.c
index c27311fbf..e662ace2e 100644
--- a/src/testing/testing_api_cmd_refund.c
+++ b/src/testing/testing_api_cmd_refund.c
@@ -76,6 +76,7 @@ struct RefundState
76 * 76 *
77 * @param cls closure 77 * @param cls closure
78 * @param hr HTTP response details 78 * @param hr HTTP response details
79 * @param refund_fee the refund fee the exchange charged
79 * @param exchange_pub public key the exchange 80 * @param exchange_pub public key the exchange
80 * used for signing @a obj. 81 * used for signing @a obj.
81 * @param exchange_sig actual signature confirming the refund 82 * @param exchange_sig actual signature confirming the refund
@@ -83,6 +84,7 @@ struct RefundState
83static void 84static void
84refund_cb (void *cls, 85refund_cb (void *cls,
85 const struct TALER_EXCHANGE_HttpResponse *hr, 86 const struct TALER_EXCHANGE_HttpResponse *hr,
87 const struct TALER_Amount *refund_fee,
86 const struct TALER_ExchangePublicKeyP *exchange_pub, 88 const struct TALER_ExchangePublicKeyP *exchange_pub,
87 const struct TALER_ExchangeSignatureP *exchange_sig) 89 const struct TALER_ExchangeSignatureP *exchange_sig)
88{ 90{
@@ -90,6 +92,7 @@ refund_cb (void *cls,
90 struct RefundState *rs = cls; 92 struct RefundState *rs = cls;
91 struct TALER_TESTING_Command *refund_cmd; 93 struct TALER_TESTING_Command *refund_cmd;
92 94
95 (void) refund_fee;
93 refund_cmd = &rs->is->commands[rs->is->ip]; 96 refund_cmd = &rs->is->commands[rs->is->ip];
94 rs->rh = NULL; 97 rs->rh = NULL;
95 if (rs->expected_response_code != hr->http_status) 98 if (rs->expected_response_code != hr->http_status)