diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-06-06 19:42:46 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-06-06 19:43:06 +0200 |
commit | 89d4f6430956129d9bfb29551fc2fa1c5c147676 (patch) | |
tree | 81bc1888abd15b01e18071615416f591a6a40b3f /src/include | |
parent | 2d1e2b3e9992652ab1ff2e7b8a34a511779d04dd (diff) |
fix backend double-pay issue (#7244)
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_merchant_service.h | 43 | ||||
-rw-r--r-- | src/include/taler_merchantdb_plugin.h | 6 |
2 files changed, 46 insertions, 3 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index d632df67..32209bcd 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -2027,6 +2027,7 @@ typedef void * @param ctx the context * @param backend_url HTTP base URL for the backend * @param order_id identifier of the order + * @param force force deletion of claimed (but unpaid) orders * @param cb function to call with the backend's deletion status * @param cb_cls closure for @a cb * @return the request handle; NULL upon error @@ -2036,6 +2037,7 @@ TALER_MERCHANT_order_delete ( struct GNUNET_CURL_Context *ctx, const char *backend_url, const char *order_id, + bool force, TALER_MERCHANT_OrderDeleteCallback cb, void *cb_cls); @@ -2120,6 +2122,44 @@ struct TALER_MERCHANT_OrderPayHandle; /** + * Information returned in response to a payment. + */ +struct TALER_MERCHANT_PayResponse +{ + + /** + * General HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details returned depending on @e hr. + */ + union + { + + /** + * Details returned on success. + */ + struct + { + + /** + * Signature affirming that the order was paid. + */ + struct TALER_MerchantSignatureP merchant_sig; + + } success; + + // TODO: might want to return further details on errors, + // especially refund signatures on double-pay conflict. + + } details; + +}; + + +/** * Callbacks of this type are used to serve the result of submitting a * POST /orders/$ID/pay request to a merchant. * @@ -2131,8 +2171,7 @@ struct TALER_MERCHANT_OrderPayHandle; typedef void (*TALER_MERCHANT_OrderPayCallback) ( void *cls, - const struct TALER_MERCHANT_HttpResponse *hr, - const struct TALER_MerchantSignatureP *merchant_sig); + const struct TALER_MERCHANT_PayResponse *pr); /** diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h index 41fb0b59..79d679e9 100644 --- a/src/include/taler_merchantdb_plugin.h +++ b/src/include/taler_merchantdb_plugin.h @@ -1222,13 +1222,15 @@ struct TALER_MERCHANTDB_Plugin * @param cls closure * @param instance_id instance to delete order of * @param order_id order to delete + * @param force force deletion of claimed but unpaid orders * @return DB status code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS * if locks prevent deletion OR order unknown */ enum GNUNET_DB_QueryStatus (*delete_order)(void *cls, const char *instance_id, - const char *order_id); + const char *order_id, + bool force); /** @@ -1354,6 +1356,7 @@ struct TALER_MERCHANTDB_Plugin * @param order_id order_id used to lookup. * @param[out] contract_terms where to store the result, NULL to only check for existence * @param[out] order_serial set to the order's serial number + * @param[out] paid set to true if the order is fully paid * @param[out] claim_token set to the claim token, NULL to only check for existence * @return transaction status */ @@ -1363,6 +1366,7 @@ struct TALER_MERCHANTDB_Plugin const char *order_id, json_t **contract_terms, uint64_t *order_serial, + bool *paid, struct TALER_ClaimTokenP *claim_token); |