From 3d7de36cdd35fbfe95ba20c30b37cd81249b076b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 15 Aug 2021 10:11:17 +0200 Subject: expand database plugin with logic to store wire transfer data made for authentication --- src/include/anastasis_database_plugin.h | 64 +++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'src/include') diff --git a/src/include/anastasis_database_plugin.h b/src/include/anastasis_database_plugin.h index 44f6b55..ae414dc 100644 --- a/src/include/anastasis_database_plugin.h +++ b/src/include/anastasis_database_plugin.h @@ -141,6 +141,23 @@ typedef void const struct TALER_Amount *amount); +/** + * Function called to test if a given wire transfer + * satisfied the authentication requirement of the + * IBAN plugin. + * + * @param cls closure + * @param credit amount that was transferred + * @param wire_subject subject provided in the wire transfer + * @return true if this wire transfer satisfied the authentication check + */ +typedef bool +(*ANASTASIS_DB_AuthIbanTransfercheck)( + void *cls, + const struct TALER_Amount *credit, + const char *wire_subject); + + /** * Handle to interact with the database. * @@ -714,6 +731,53 @@ struct ANASTASIS_DatabasePlugin const struct ANASTASIS_PaymentSecretP *payment_identifier); + /** + * Store inbound IBAN payment made for authentication. + * + * @param cls closure + * @param wire_reference unique identifier inside LibEuFin/Nexus + * @param wire_subject subject of the wire transfer + * @param amount how much was transferred + * @param debit_account account that was debited + * @param credit_account Anastasis operator account credited + * @param execution_date when was the transfer made + * @return transaction status + */ + enum GNUNET_DB_QueryStatus + (*record_auth_iban_payment)( + void *cls, + uint64_t wire_reference, + const char *wire_subject, + const struct TALER_Amount *amount, + const char *debit_account, + const char *credit_account, + struct GNUNET_TIME_Absolute execution_date); + + + /** + * Function to check if we are aware of a wire transfer + * that satisfies the IBAN plugin's authentication check. + * + * @param cls closure + * @param debit_account which debit account to check + * @param earliest_date earliest date to check + * @param cb function to call on all entries found + * @param cb_cls closure for @a cb + * @return transaction status, + * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT if @a cb + * returned 'true' once + * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if no + * wire transfers existed for which @a cb returned true + */ + enum GNUNET_DB_QueryStatus + (*test_auth_iban_payment)( + void *cls, + const char *debit_account, + struct GNUNET_TIME_Absolute earliest_date, + ANASTASIS_DB_AuthIbanTransfercheck cb, + void *cb_cls); + + /** * Function called to remove all expired codes from the database. * -- cgit v1.2.3