diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-06-03 23:24:31 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-06-03 23:24:31 +0200 |
commit | 7f8c111f1383805d64ab7f754cb6456d3dfb7250 (patch) | |
tree | 4b5561f5e7ed8a07be933ccd6bbd2c8ec29aa0f0 /src/include | |
parent | cea5867be3735f7c418a456b93ba9a45535f8cbc (diff) |
address more FIXMEs
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_merchant_service.h | 227 |
1 files changed, 185 insertions, 42 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 83035455..cb9edb29 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -2904,24 +2904,58 @@ struct TALER_MERCHANT_AbortedCoin }; -// FIXME: change signature! +/** + * Response to an /orders/$ID/abort request. + */ +struct TALER_MERCHANT_AbortResponse +{ + /** + * HTTP response details + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on HTTP status code. + */ + union + { + /** + * Details for #MHD_HTTP_OK. + */ + struct + { + + /** + * public key of the merchant + */ + const struct TALER_MerchantPublicKeyP *merchant_pub; + + /** + * size of the @e aborts array + */ + unsigned int num_aborts; + + /** + * merchant signatures refunding coins + */ + const struct TALER_MERCHANT_AbortedCoin *aborts; + } ok; + + } details; +}; + + /** * Callbacks of this type are used to serve the result of submitting a * /orders/$ID/abort request to a merchant. * * @param cls closure - * @param hr HTTP response details - * @param merchant_pub public key of the merchant - * @param num_aborts size of the @a res array, 0 on errors - * @param aborts merchant signatures refunding coins, NULL on errors + * @param ar response details */ typedef void (*TALER_MERCHANT_AbortCallback) ( void *cls, - const struct TALER_MERCHANT_HttpResponse *hr, - const struct TALER_MerchantPublicKeyP *merchant_pub, - unsigned int num_aborts, - const struct TALER_MERCHANT_AbortedCoin aborts[]); + const struct TALER_MERCHANT_AbortResponse *ar); /** @@ -3048,22 +3082,52 @@ TALER_MERCHANT_order_forget_cancel (struct struct TALER_MERCHANT_OrderRefundHandle; -// FIXME: change signature! /** - * Callback to process a POST /orders/ID/refund request + * Response to a POST /orders/$ID/refund request + */ +struct TALER_MERCHANT_RefundResponse +{ + /** + * HTTP response details this request + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on HTTP status. + */ + union + { + /** + * Details if status is #MHD_HTTP_OK. + */ + struct + { + + /** + * the refund uri offered to the wallet + */ + const char *taler_refund_uri; + + /** + * Hash of the contract a wallet may need to authorize obtaining the HTTP + * response. + */ + struct TALER_PrivateContractHashP h_contract; + } ok; + } details; +}; + + +/** + * Callback to process a POST /orders/$ID/refund request * * @param cls closure - * @param hr HTTP response details this request - * @param taler_refund_uri the refund uri offered to the wallet - * @param h_contract hash of the contract a Browser may need to authorize - * obtaining the HTTP response. + * @param rr response details this request */ typedef void (*TALER_MERCHANT_RefundCallback) ( void *cls, - const struct TALER_MERCHANT_HttpResponse *hr, - const char *taler_refund_uri, - const struct TALER_PrivateContractHashP *h_contract); + const struct TALER_MERCHANT_RefundResponse *rr); /** @@ -3130,39 +3194,87 @@ struct TALER_MERCHANT_RefundDetail struct TALER_Amount refund_amount; /** - * Public key of the exchange affirming the refund, - * only valid if the @e hr http_status is #MHD_HTTP_OK. + * Details depending on exchange HTTP status. */ - struct TALER_ExchangePublicKeyP exchange_pub; + union + { + /** + * Details if exchange status is #MHD_HTTP_OK. + */ + struct + { + /** + * Public key of the exchange affirming the refund, + * only valid if the @e hr http_status is #MHD_HTTP_OK. + */ + struct TALER_ExchangePublicKeyP exchange_pub; + + /** + * Signature of the exchange affirming the refund, + * only valid if the @e hr http_status is #MHD_HTTP_OK. + */ + struct TALER_ExchangeSignatureP exchange_sig; + } ok; + } details; +}; + + +/** + * Response to a POST /orders/$ID/refund request + * for wallet API. + */ +struct TALER_MERCHANT_WalletRefundResponse +{ + /** + * HTTP response details this request + */ + struct TALER_MERCHANT_HttpResponse hr; /** - * Signature of the exchange affirming the refund, - * only valid if the @e hr http_status is #MHD_HTTP_OK. + * Details depending on HTTP status. */ - struct TALER_ExchangeSignatureP exchange_sig; + union + { + /** + * Details if status is #MHD_HTTP_OK. + */ + struct + { + + /** + * Total amount of the refund that was granted + */ + struct TALER_Amount refund_amount; + /** + * public key of the merchant signing the @e refunds + */ + struct TALER_MerchantPublicKeyP merchant_pub; + + /** + * array with details about the refunds obtained + */ + const struct TALER_MERCHANT_RefundDetail *refunds; + + /** + * length of the @e refunds array + */ + unsigned int refunds_length; + } ok; + } details; }; -// FIXME: change signature! /** * Callback to process a (public) POST /orders/ID/refund request * * @param cls closure - * @param hr HTTP response details - * @param refund_amount what is the total amount of the refund that was granted - * @param merchant_pub public key of the merchant signing the @a refunds - * @param refunds array with details about the refunds obtained - * @param refunds_length length of the @a refunds array + * @param wrr HTTP response details */ typedef void (*TALER_MERCHANT_WalletRefundCallback) ( void *cls, - const struct TALER_MERCHANT_HttpResponse *hr, - const struct TALER_Amount *refund_amount, - const struct TALER_MerchantPublicKeyP *merchant_pub, - struct TALER_MERCHANT_RefundDetail refunds[], - unsigned int refunds_length); + const struct TALER_MERCHANT_WalletRefundResponse *wrr); /** @@ -3403,22 +3515,53 @@ struct TALER_MERCHANT_TransferData }; -// FIXME: change signature! +/** + * Response from a GET /transfers request. + */ +struct TALER_MERCHANT_GetTransfersResponse +{ + /** + * HTTP response details + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on HTTP status. + */ + union + { + + /** + * Details for status #MHD_HTTP_OK. + */ + struct + { + + /** + * length of the @e transfers array + */ + unsigned int transfers_length; + + /** + * array with details about the transfers we received + */ + const struct TALER_MERCHANT_TransferData *transfers; + } ok; + } details; +}; + + /** * Callbacks of this type are used to work the result of submitting a * GET /transfers request to a merchant * * @param cls closure - * @param hr HTTP response details - * @param transfers_length length of the @a transfers array - * @param transfers array with details about the transfers we received + * @param gtr HTTP response details */ typedef void (*TALER_MERCHANT_GetTransfersCallback) ( void *cls, - const struct TALER_MERCHANT_HttpResponse *hr, - unsigned int transfers_length, - const struct TALER_MERCHANT_TransferData transfers[]); + const struct TALER_MERCHANT_GetTransfersResponse *gtr); /** |