summaryrefslogtreecommitdiff
path: root/src/include/taler_wire_plugin.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-11-12 15:46:52 +0100
committerChristian Grothoff <christian@grothoff.org>2017-11-12 15:46:52 +0100
commit8440de13339a3b38d9efa18b69df409e45cde625 (patch)
treecd4c63c5d8c58eb9ac2dac93f057d8cb31f5ffca /src/include/taler_wire_plugin.h
parentf299130c50ca79efbfc8daf7f73aaba7ffb3a258 (diff)
downloadexchange-8440de13339a3b38d9efa18b69df409e45cde625.tar.gz
exchange-8440de13339a3b38d9efa18b69df409e45cde625.tar.bz2
exchange-8440de13339a3b38d9efa18b69df409e45cde625.zip
work on #5077: reserve_pub vs. wtid issue, add reject functionality to wire plugin API (with stub implementations for now)
Diffstat (limited to 'src/include/taler_wire_plugin.h')
-rw-r--r--src/include/taler_wire_plugin.h71
1 files changed, 65 insertions, 6 deletions
diff --git a/src/include/taler_wire_plugin.h b/src/include/taler_wire_plugin.h
index 969af3571..6e355baf6 100644
--- a/src/include/taler_wire_plugin.h
+++ b/src/include/taler_wire_plugin.h
@@ -59,13 +59,17 @@ struct TALER_WIRE_TransferDetails
struct GNUNET_TIME_Absolute execution_date;
/**
- * Reserve public key that was encoded in the wire transfer subject.
- * FIXME (#5077): this is incorrect for *outgoing* wire transfers.
- * Maybe use `struct TALER_WireTransferIdentifierRawP` here instead?
- * OTOH, we might want to make this even more generic in case of
- * invalid transfers, so that we can capture those as well!
+ * Binary data that was encoded in the wire transfer subject, if
+ * it decoded properly. Otherwise all-zeros and @e wtid_s is set.
*/
- struct TALER_ReservePublicKeyP reserve_pub;
+ struct TALER_WireTransferIdentifierRawP wtid;
+
+ /**
+ * Wire transfer identifer as a string. Set to NULL if the
+ * identifier was properly Base32 encoded and this @e wtid could be
+ * set instead.
+ */
+ char *wtid_s;
/**
* The other account that was involved
@@ -94,6 +98,18 @@ typedef int
/**
+ * Callbacks of this type are used to serve the result of asking
+ * the bank to reject a wire transfer.
+ *
+ * @param cls closure
+ * @param ec status of the operation, #TALER_EC_NONE on success
+ */
+typedef void
+(*TALER_WIRE_RejectTransferCallback) (void *cls,
+ enum TALER_ErrorCode ec);
+
+
+/**
* Handle returned for cancelling a preparation step.
*/
struct TALER_WIRE_PrepareHandle;
@@ -308,12 +324,55 @@ struct TALER_WIRE_Plugin
/**
* Cancel going over the account's history.
*
+ * @param cls plugins' closure
* @param whh operation to cancel
*/
void
(*get_history_cancel) (void *cls,
struct TALER_WIRE_HistoryHandle *whh);
+
+ /**
+ * Reject an incoming wire transfer that was obtained from the
+ * history. This function can be used to transfer funds back to
+ * the sender if the WTID was malformed (i.e. due to a typo).
+ *
+ * Calling `reject_transfer` twice on the same wire transfer should
+ * be idempotent, i.e. not cause the funds to be wired back twice.
+ * Furthermore, the transfer should henceforth be removed from the
+ * results returned by @e get_history.
+ *
+ * @param cls plugin's closure
+ * @param start_off offset of the wire transfer in plugin-specific format
+ * @param start_off_len number of bytes in @a start_off
+ * @param rej_cb function to call with the result of the operation
+ * @param rej_cb_cls closure for @a rej_cb
+ * @return handle to cancel the operation
+ */
+ struct TALER_WIRE_RejectHandle *
+ (*reject_transfer)(void *cls,
+ const void *start_off,
+ size_t start_off_len,
+ TALER_WIRE_RejectTransferCallback rej_cb,
+ void *rej_cb_cls);
+
+ /**
+ * Cancel ongoing reject operation. Note that the rejection may still
+ * proceed. Basically, if this function is called, the rejection may
+ * have happened or not. This function is usually used during shutdown
+ * or system upgrades. At a later point, the application must call
+ * @e reject_transfer again for this wire transfer, unless the
+ * @e get_history shows that the wire transfer no longer exists.
+ *
+ * @param cls plugins' closure
+ * @param rh operation to cancel
+ * @return closure of the callback of the operation
+ */
+ void *
+ (*reject_transfer_cancel)(void *cls,
+ struct TALER_WIRE_RejectHandle *rh);
+
+
};