[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: adapt to latest bank API
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: adapt to latest bank API |
Date: |
Mon, 21 Nov 2022 14:28:08 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new 24b919d9 adapt to latest bank API
24b919d9 is described below
commit 24b919d917860e5cb2e774d44e8b80990940ba29
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Nov 21 14:28:06 2022 +0100
adapt to latest bank API
---
src/testing/testing_api_cmd_post_transfers.c | 91 +++++++++++-----------------
1 file changed, 36 insertions(+), 55 deletions(-)
diff --git a/src/testing/testing_api_cmd_post_transfers.c
b/src/testing/testing_api_cmd_post_transfers.c
index 571cfb9a..dee1b183 100644
--- a/src/testing/testing_api_cmd_post_transfers.c
+++ b/src/testing/testing_api_cmd_post_transfers.c
@@ -55,12 +55,12 @@ struct PostTransfersState
const char *merchant_url;
/**
- * URL of the bank to run history on (set once @e found is set).
+ * URL of the bank to run history on.
*/
char *exchange_url;
/**
- * Credit account of the merchant (set once @e found is set).
+ * Credit account of the merchant.
*/
char *credit_account;
@@ -75,7 +75,7 @@ struct PostTransfersState
struct TALER_BANK_AuthenticationData auth;
/**
- * Set once we discovered the WTID and thus @e found is true.
+ * Set once we discovered the WTID.
*/
struct TALER_WireTransferIdentifierRawP wtid;
@@ -110,11 +110,6 @@ struct PostTransfersState
*/
unsigned int deposits_length;
- /**
- * Set to true once @e wtid and @e exchange_url are initialized.
- */
- bool found;
-
/**
* When the exchange executed the transfer.
*/
@@ -393,38 +388,45 @@ post_transfers_run2 (void *cls,
* the bank for the debit transaction history.
*
* @param cls closure with a `struct PostTransfersState *`
- * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful
status request
- * 0 if the bank's reply is bogus (fails to follow the
protocol),
- * #MHD_HTTP_NO_CONTENT if there are no more results; on
success the
- * last callback is always of this status (even if
`abs(num_results)` were
- * already returned).
- * @param ec detailed error code
- * @param serial_id monotonically increasing counter corresponding to the
transaction
- * @param details details about the wire transfer
- * @param json detailed response from the HTTPD, or NULL if reply was not in
JSON
- * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
+ * @param reply details from the HTTP response code
*/
-static int
+static void
debit_cb (
void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
- uint64_t serial_id,
- const struct TALER_BANK_DebitDetails *details,
- const json_t *json)
+ const struct TALER_BANK_DebitHistoryResponse *reply)
{
struct PostTransfersState *pts = cls;
- if (MHD_HTTP_NO_CONTENT == http_status)
+ pts->dhh = NULL;
+ switch (reply->http_status)
{
- pts->dhh = NULL;
- if (! pts->found)
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (pts->is);
- return GNUNET_OK;
- }
- GNUNET_assert (NULL != pts->exchange_url);
+ case MHD_HTTP_NO_CONTENT:
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (pts->is);
+ return;
+ case MHD_HTTP_OK:
+ /* handled below */
+ break;
+ default:
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (pts->is);
+ return;
+ }
+ for (unsigned int i = 0; i<reply->details.success.details_length; i++)
+ {
+ const struct TALER_BANK_DebitDetails *details
+ = &reply->details.success.details[i];
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Bank reports transfer of %s to %s\n",
+ TALER_amount2s (&details->amount),
+ details->credit_account_uri);
+ if (0 != TALER_amount_cmp (&pts->credit_amount,
+ &details->amount))
+ continue;
+ pts->wtid = details->wtid;
+ pts->credit_account = GNUNET_strdup (details->credit_account_uri);
+ pts->exchange_url = GNUNET_strdup (details->exchange_base_url);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Bank transfer found, checking with merchant backend at %s
about %s from %s to %s with %s\n",
pts->merchant_url,
@@ -441,29 +443,8 @@ debit_cb (
&transfers_cb,
pts);
GNUNET_assert (NULL != pts->pth);
- return GNUNET_OK;
- }
- if (MHD_HTTP_OK != http_status)
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (pts->is);
- pts->dhh = NULL;
- return GNUNET_SYSERR;
+ break;
}
- if (pts->found)
- return GNUNET_OK;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Bank reports transfer of %s to %s\n",
- TALER_amount2s (&details->amount),
- details->credit_account_uri);
- if (0 != TALER_amount_cmp (&pts->credit_amount,
- &details->amount))
- return GNUNET_OK;
- pts->found = true;
- pts->wtid = details->wtid;
- pts->credit_account = GNUNET_strdup (details->credit_account_uri);
- pts->exchange_url = GNUNET_strdup (details->exchange_base_url);
- return GNUNET_OK;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: adapt to latest bank API,
gnunet <=