From 4a031a692b962483d9ebc04f6d2526e192f1c7cd Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 4 May 2016 09:42:52 +0200 Subject: implementing /refund API (#3848) --- src/include/taler_exchange_service.h | 5 +-- src/include/taler_signatures.h | 63 ++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) (limited to 'src/include') diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index 794051e26..4fbadb79b 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -504,7 +504,7 @@ typedef void * * @param exchange the exchange handle; the exchange must be ready to operate * @param amount the amount to be refunded; must be larger than the refund fee - * (as that fee is still being subtracted), and smaller than the amount + * (as that fee is still being subtracted), and smaller than the amount * (with deposit fee) of the original deposit contribution of this coin * @param refund_fee fee applicable to this coin for the refund * @param h_contract hash of the contact of the merchant with the customer that is being refunded @@ -525,6 +525,7 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, const struct TALER_Amount *amount, const struct TALER_Amount *refund_fee, const struct GNUNET_HashCode *h_contract, + uint64_t transaction_id, const struct TALER_CoinSpendPublicKeyP *coin_pub, uint64_t rtransaction_id, const struct TALER_MerchantPrivateKeyP *merchant_priv, @@ -534,7 +535,7 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, /** * Cancel a refund permission request. This function cannot be used - * on a request handle if a response is already served for it. If + * on a request handle if a response is already served for it. If * this function is called, the refund may or may not have happened. * However, it is fine to try to refund the coin a second time. * diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h index e338916e1..c31cc6b93 100644 --- a/src/include/taler_signatures.h +++ b/src/include/taler_signatures.h @@ -117,6 +117,11 @@ */ #define TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT 1037 +/** + * Signature where the Exchange confirms a refund request. + */ +#define TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND 1038 + /*********************/ /* Wallet signatures */ @@ -453,6 +458,64 @@ struct TALER_RefundRequestPS }; +/** + * @brief Format used to generate the signature on a request to refund + * a coin into the account of the customer. + */ +struct TALER_RefundConfirmationPS +{ + /** + * Purpose must be #TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND. + */ + struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + + /** + * Hash over the contract which is being refunded. + */ + struct GNUNET_HashCode h_contract GNUNET_PACKED; + + /** + * Merchant-generated transaction ID of the orginal transaction. + */ + uint64_t transaction_id GNUNET_PACKED; + + /** + * The coin's public key. This is the value that must have been + * signed (blindly) by the Exchange. + */ + struct TALER_CoinSpendPublicKeyP coin_pub; + + /** + * The Merchant's public key. Allows the merchant to later refund + * the transaction or to inquire about the wire transfer identifier. + */ + struct TALER_MerchantPublicKeyP merchant; + + /** + * Merchant-generated transaction ID for the refund. + */ + uint64_t rtransaction_id GNUNET_PACKED; + + /** + * Amount to be refunded, including refund fee charged by the + * exchange to the customer. + */ + struct TALER_AmountNBO refund_amount; + + /** + * Refund fee charged by the exchange. This must match the + * Exchange's denomination key's refund fee. If the client puts in + * an invalid refund fee (too high or too low) that does not match + * the Exchange's denomination key, the refund operation is invalid + * and will be rejected by the exchange. The @e amount_with_fee + * minus the @e refund_fee is the amount that will be credited to + * the original coin. + */ + struct TALER_AmountNBO refund_fee; + +}; + + /** * @brief Message signed by a coin to indicate that the coin should be * melted. -- cgit v1.2.3