aboutsummaryrefslogtreecommitdiff
path: root/src/bank-lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/bank-lib')
-rw-r--r--src/bank-lib/bank_api_credit.c10
-rw-r--r--src/bank-lib/bank_api_debit.c10
-rw-r--r--src/bank-lib/fakebank.h2
-rw-r--r--src/bank-lib/fakebank_bank.c2
-rw-r--r--src/bank-lib/fakebank_bank_get_root.c5
-rw-r--r--src/bank-lib/fakebank_bank_post_withdrawals_id_op.c120
-rw-r--r--src/bank-lib/fakebank_common_lp.c1
-rw-r--r--src/bank-lib/fakebank_common_make_admin_transfer.c51
-rw-r--r--src/bank-lib/fakebank_common_parser.c1
-rw-r--r--src/bank-lib/fakebank_tbi_get_withdrawal_operation.c2
-rw-r--r--src/bank-lib/fakebank_tbr.c1
-rw-r--r--src/bank-lib/fakebank_tbr_get_history.c4
-rw-r--r--src/bank-lib/fakebank_tbr_get_root.c6
-rw-r--r--src/bank-lib/fakebank_twg_get_root.c6
-rw-r--r--src/bank-lib/fakebank_twg_get_transfers.c3
-rw-r--r--src/bank-lib/fakebank_twg_history.c9
-rw-r--r--src/bank-lib/fakebank_twg_transfer.c84
-rw-r--r--src/bank-lib/taler-exchange-wire-gateway-client.c6
18 files changed, 199 insertions, 124 deletions
diff --git a/src/bank-lib/bank_api_credit.c b/src/bank-lib/bank_api_credit.c
index 29becbfa9..dc92b064a 100644
--- a/src/bank-lib/bank_api_credit.c
+++ b/src/bank-lib/bank_api_credit.c
@@ -86,8 +86,8 @@ parse_account_history (struct TALER_BANK_CreditHistoryHandle *hh,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_array_const ("incoming_transactions",
&history_array),
- GNUNET_JSON_spec_string ("credit_account",
- &chr.details.ok.credit_account_uri),
+ TALER_JSON_spec_payto_uri ("credit_account",
+ &chr.details.ok.credit_account_uri),
GNUNET_JSON_spec_end ()
};
@@ -118,8 +118,8 @@ parse_account_history (struct TALER_BANK_CreditHistoryHandle *hh,
&td->execution_date),
GNUNET_JSON_spec_uint64 ("row_id",
&td->serial_id),
- GNUNET_JSON_spec_string ("debit_account",
- &td->debit_account_uri),
+ TALER_JSON_spec_payto_uri ("debit_account",
+ &td->debit_account_uri),
GNUNET_JSON_spec_end ()
};
json_t *transaction = json_array_get (history_array,
@@ -178,7 +178,7 @@ parse_account_history (struct TALER_BANK_CreditHistoryHandle *hh,
type))
{
struct GNUNET_JSON_Specification wad_spec[] = {
- GNUNET_JSON_spec_string ("origin_exchange_url",
+ TALER_JSON_spec_web_url ("origin_exchange_url",
&td->details.wad.origin_exchange_url),
GNUNET_JSON_spec_fixed_auto ("wad_id",
&td->details.wad.wad_id),
diff --git a/src/bank-lib/bank_api_debit.c b/src/bank-lib/bank_api_debit.c
index 58dc0a736..62bf66c0f 100644
--- a/src/bank-lib/bank_api_debit.c
+++ b/src/bank-lib/bank_api_debit.c
@@ -86,8 +86,8 @@ parse_account_history (struct TALER_BANK_DebitHistoryHandle *hh,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_array_const ("outgoing_transactions",
&history_array),
- GNUNET_JSON_spec_string ("debit_account",
- &dhr.details.ok.debit_account_uri),
+ TALER_JSON_spec_payto_uri ("debit_account",
+ &dhr.details.ok.debit_account_uri),
GNUNET_JSON_spec_end ()
};
@@ -117,9 +117,9 @@ parse_account_history (struct TALER_BANK_DebitHistoryHandle *hh,
&td->serial_id),
GNUNET_JSON_spec_fixed_auto ("wtid",
&td->wtid),
- GNUNET_JSON_spec_string ("credit_account",
- &td->credit_account_uri),
- GNUNET_JSON_spec_string ("exchange_base_url",
+ TALER_JSON_spec_payto_uri ("credit_account",
+ &td->credit_account_uri),
+ TALER_JSON_spec_web_url ("exchange_base_url",
&td->exchange_base_url),
GNUNET_JSON_spec_end ()
};
diff --git a/src/bank-lib/fakebank.h b/src/bank-lib/fakebank.h
index 87c7a4af1..8cbf60403 100644
--- a/src/bank-lib/fakebank.h
+++ b/src/bank-lib/fakebank.h
@@ -159,7 +159,7 @@ struct WithdrawalOperation
uint64_t row_id;
/**
- * Amount transferred.
+ * Amount transferred, NULL if still unknown.
*/
struct TALER_Amount *amount;
diff --git a/src/bank-lib/fakebank_bank.c b/src/bank-lib/fakebank_bank.c
index 96100943c..dcbe4a26c 100644
--- a/src/bank-lib/fakebank_bank.c
+++ b/src/bank-lib/fakebank_bank.c
@@ -72,7 +72,7 @@ TALER_FAKEBANK_bank_main_ (
connection,
MHD_HTTP_OK,
GNUNET_JSON_pack_string ("version",
- "4:1:4"), /* not sure, API versions are not properly marked up! */
+ "4:1:4"),
GNUNET_JSON_pack_string ("currency",
h->currency),
GNUNET_JSON_pack_string ("implementation",
diff --git a/src/bank-lib/fakebank_bank_get_root.c b/src/bank-lib/fakebank_bank_get_root.c
index 8c34697b4..ef2247e36 100644
--- a/src/bank-lib/fakebank_bank_get_root.c
+++ b/src/bank-lib/fakebank_bank_get_root.c
@@ -46,10 +46,9 @@ TALER_FAKEBANK_bank_get_root_ (struct TALER_FAKEBANK_Handle *h,
#define HELLOMSG "Hello, Fakebank!"
(void) h;
- resp = MHD_create_response_from_buffer (
+ resp = MHD_create_response_from_buffer_static (
strlen (HELLOMSG),
- HELLOMSG,
- MHD_RESPMEM_MUST_COPY);
+ HELLOMSG);
ret = MHD_queue_response (connection,
MHD_HTTP_OK,
resp);
diff --git a/src/bank-lib/fakebank_bank_post_withdrawals_id_op.c b/src/bank-lib/fakebank_bank_post_withdrawals_id_op.c
index 2adc07df0..1b81c8670 100644
--- a/src/bank-lib/fakebank_bank_post_withdrawals_id_op.c
+++ b/src/bank-lib/fakebank_bank_post_withdrawals_id_op.c
@@ -41,6 +41,7 @@
* @param connection the connection
* @param account name of the account
* @param withdrawal_id the withdrawal operation identifier
+ * @param body uploaded JSON body, NULL if none
* @return MHD result code
*/
static MHD_RESULT
@@ -48,10 +49,32 @@ bank_withdrawals_confirm (
struct TALER_FAKEBANK_Handle *h,
struct MHD_Connection *connection,
const char *account,
- const char *withdrawal_id)
+ const char *withdrawal_id,
+ const json_t *body)
{
const struct Account *acc;
struct WithdrawalOperation *wo;
+ struct TALER_Amount amount;
+ bool amount_missing = true;
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_mark_optional (
+ TALER_JSON_spec_amount ("amount",
+ h->currency,
+ &amount),
+ &amount_missing),
+ GNUNET_JSON_spec_end ()
+ };
+ enum GNUNET_GenericReturnValue ret;
+
+ if ( (NULL != body) &&
+ (GNUNET_OK !=
+ (ret = TALER_MHD_parse_json_data (connection,
+ body,
+ spec))) )
+ {
+ GNUNET_break_op (0);
+ return (GNUNET_NO == ret) ? MHD_YES : MHD_NO;
+ }
GNUNET_assert (0 ==
pthread_mutex_lock (&h->big_lock));
@@ -91,14 +114,33 @@ bank_withdrawals_confirm (
TALER_EC_BANK_POST_WITHDRAWAL_OPERATION_REQUIRED,
NULL);
}
- if (NULL == wo->amount)
+ if ( (NULL != wo->amount) &&
+ (! amount_missing) &&
+ (0 != TALER_amount_cmp (&amount,
+ wo->amount)) )
{
GNUNET_assert (0 ==
pthread_mutex_unlock (&h->big_lock));
return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_BANK_POST_WITHDRAWAL_OPERATION_REQUIRED,
- NULL);
+ MHD_HTTP_CONFLICT,
+ TALER_EC_BANK_CONFIRM_ABORT_CONFLICT,
+ "amount inconsistent");
+ }
+ if ( (NULL == wo->amount) &&
+ (amount_missing) )
+ {
+ GNUNET_assert (0 ==
+ pthread_mutex_unlock (&h->big_lock));
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_CONFLICT,
+ TALER_EC_BANK_CONFIRM_ABORT_CONFLICT,
+ "amount required");
+ }
+ if (NULL == wo->amount)
+ {
+ GNUNET_assert (! amount_missing);
+ wo->amount = GNUNET_new (struct TALER_Amount);
+ *wo->amount = amount;
}
if (wo->aborted)
{
@@ -152,6 +194,7 @@ bank_withdrawals_confirm (
* @param connection the connection
* @param account name of the account
* @param withdrawal_id the withdrawal operation identifier
+ * @param body uploaded JSON body, NULL if none
* @return MHD result code
*/
static MHD_RESULT
@@ -159,7 +202,8 @@ bank_withdrawals_abort (
struct TALER_FAKEBANK_Handle *h,
struct MHD_Connection *connection,
const char *account,
- const char *withdrawal_id)
+ const char *withdrawal_id,
+ const json_t *body)
{
struct WithdrawalOperation *wo;
const struct Account *acc;
@@ -226,23 +270,71 @@ TALER_FAKEBANK_bank_withdrawals_id_op_ (
size_t *upload_data_size,
void **con_cls)
{
+ struct ConnectionContext *cc = *con_cls;
+ json_t *json = NULL;
+
+ if (NULL == cc)
+ {
+ cc = GNUNET_new (struct ConnectionContext);
+ cc->ctx_cleaner = &GNUNET_JSON_post_parser_cleanup;
+ *con_cls = cc;
+ }
+ if (0 != *upload_data_size)
+ {
+ enum GNUNET_JSON_PostResult pr;
+
+ pr = GNUNET_JSON_post_parser (REQUEST_BUFFER_MAX,
+ connection,
+ &cc->ctx,
+ upload_data,
+ upload_data_size,
+ &json);
+ switch (pr)
+ {
+ case GNUNET_JSON_PR_OUT_OF_MEMORY:
+ GNUNET_break (0);
+ return MHD_NO;
+ case GNUNET_JSON_PR_CONTINUE:
+ return MHD_YES;
+ case GNUNET_JSON_PR_REQUEST_TOO_LARGE:
+ GNUNET_break (0);
+ return MHD_NO;
+ case GNUNET_JSON_PR_JSON_INVALID:
+ GNUNET_break (0);
+ return MHD_NO;
+ case GNUNET_JSON_PR_SUCCESS:
+ break;
+ }
+ }
+
if (0 == strcmp (op,
"/confirm"))
{
- return bank_withdrawals_confirm (h,
- connection,
- account,
- withdrawal_id);
+ MHD_RESULT res;
+
+ res = bank_withdrawals_confirm (h,
+ connection,
+ account,
+ withdrawal_id,
+ json);
+ json_decref (json);
+ return res;
}
if (0 == strcmp (op,
"/abort"))
{
- return bank_withdrawals_abort (h,
- connection,
- account,
- withdrawal_id);
+ MHD_RESULT res;
+
+ res = bank_withdrawals_abort (h,
+ connection,
+ account,
+ withdrawal_id,
+ json);
+ json_decref (json);
+ return res;
}
GNUNET_break_op (0);
+ json_decref (json);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND,
TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
diff --git a/src/bank-lib/fakebank_common_lp.c b/src/bank-lib/fakebank_common_lp.c
index 22a9e3ab4..e73ed4593 100644
--- a/src/bank-lib/fakebank_common_lp.c
+++ b/src/bank-lib/fakebank_common_lp.c
@@ -32,6 +32,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "fakebank.h"
+#include "fakebank_common_lp.h"
void
diff --git a/src/bank-lib/fakebank_common_make_admin_transfer.c b/src/bank-lib/fakebank_common_make_admin_transfer.c
index 865eaa640..984a4d19f 100644
--- a/src/bank-lib/fakebank_common_make_admin_transfer.c
+++ b/src/bank-lib/fakebank_common_make_admin_transfer.c
@@ -28,6 +28,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "fakebank.h"
+#include "fakebank_common_make_admin_transfer.h"
#include "fakebank_common_lookup.h"
#include "fakebank_common_lp.h"
#include "fakebank_common_transact.h"
@@ -90,20 +91,27 @@ TALER_FAKEBANK_make_admin_transfer_ (
*timestamp = t->date;
t->type = T_CREDIT;
t->subject.credit.reserve_pub = *reserve_pub;
- TALER_FAKEBANK_transact_ (h,
- t);
- if (NULL != row_id)
- *row_id = t->row_id;
GNUNET_assert (0 ==
pthread_mutex_lock (&h->rpubs_lock));
- GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multipeermap_put (
- h->rpubs,
- pid,
- t,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+ if (GNUNET_OK !=
+ GNUNET_CONTAINER_multipeermap_put (
+ h->rpubs,
+ pid,
+ t,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
+ {
+ /* duplicate reserve public key not allowed */
+ GNUNET_break_op (0);
+ GNUNET_free (t);
+ GNUNET_assert (0 ==
+ pthread_mutex_unlock (&h->rpubs_lock));
+ }
GNUNET_assert (0 ==
pthread_mutex_unlock (&h->rpubs_lock));
+ TALER_FAKEBANK_transact_ (h,
+ t);
+ if (NULL != row_id)
+ *row_id = t->row_id;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Making transfer from %s to %s over %s and subject %s at row %llu\n",
debit_account,
@@ -151,19 +159,6 @@ TALER_FAKEBANK_make_kycauth_transfer_ (
credit_acc = TALER_FAKEBANK_lookup_account_ (h,
credit_account,
credit_account);
- GNUNET_assert (0 ==
- pthread_mutex_lock (&h->rpubs_lock));
- t = GNUNET_CONTAINER_multipeermap_get (h->rpubs,
- pid);
- GNUNET_assert (0 ==
- pthread_mutex_unlock (&h->rpubs_lock));
- if (NULL != t)
- {
- /* duplicate reserve public key not allowed */
- GNUNET_break_op (0);
- return GNUNET_NO;
- }
-
t = GNUNET_new (struct Transaction);
t->unchecked = true;
t->debit_account = debit_acc;
@@ -178,16 +173,6 @@ TALER_FAKEBANK_make_kycauth_transfer_ (
t);
if (NULL != row_id)
*row_id = t->row_id;
- GNUNET_assert (0 ==
- pthread_mutex_lock (&h->rpubs_lock));
- GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multipeermap_put (
- h->rpubs,
- pid,
- t,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
- GNUNET_assert (0 ==
- pthread_mutex_unlock (&h->rpubs_lock));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Making transfer from %s to %s over %s and subject %s at row %llu\n",
debit_account,
diff --git a/src/bank-lib/fakebank_common_parser.c b/src/bank-lib/fakebank_common_parser.c
index cf2dc5a74..82836359a 100644
--- a/src/bank-lib/fakebank_common_parser.c
+++ b/src/bank-lib/fakebank_common_parser.c
@@ -27,6 +27,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "fakebank.h"
+#include "fakebank_common_parser.h"
enum GNUNET_GenericReturnValue
diff --git a/src/bank-lib/fakebank_tbi_get_withdrawal_operation.c b/src/bank-lib/fakebank_tbi_get_withdrawal_operation.c
index fd6f3b7c4..63c247db1 100644
--- a/src/bank-lib/fakebank_tbi_get_withdrawal_operation.c
+++ b/src/bank-lib/fakebank_tbi_get_withdrawal_operation.c
@@ -120,6 +120,8 @@ TALER_FAKEBANK_tbi_get_withdrawal_operation_ (
wc->wo->confirmation_done),
GNUNET_JSON_pack_string ("status",
status_string),
+ GNUNET_JSON_pack_string ("sender_wire",
+ wc->wo->debit_account->payto_uri),
GNUNET_JSON_pack_allow_null (
GNUNET_JSON_pack_string ("suggested_exchange",
h->exchange_url)),
diff --git a/src/bank-lib/fakebank_tbr.c b/src/bank-lib/fakebank_tbr.c
index 0f0e5bdc1..4de6028a9 100644
--- a/src/bank-lib/fakebank_tbr.c
+++ b/src/bank-lib/fakebank_tbr.c
@@ -27,6 +27,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "fakebank.h"
+#include "fakebank_tbr.h"
#include "fakebank_tbr_get_history.h"
#include "fakebank_tbr_get_root.h"
diff --git a/src/bank-lib/fakebank_tbr_get_history.c b/src/bank-lib/fakebank_tbr_get_history.c
index a6cfaad8d..f6aa8f5cc 100644
--- a/src/bank-lib/fakebank_tbr_get_history.c
+++ b/src/bank-lib/fakebank_tbr_get_history.c
@@ -296,7 +296,7 @@ finish:
0);
}
{
- json_t *h = hc->history;
+ json_t *jh = hc->history;
hc->history = NULL;
return TALER_MHD_REPLY_JSON_PACK (
@@ -307,6 +307,6 @@ finish:
acc_payto_uri),
GNUNET_JSON_pack_array_steal (
"incoming_transactions",
- h));
+ jh));
}
}
diff --git a/src/bank-lib/fakebank_tbr_get_root.c b/src/bank-lib/fakebank_tbr_get_root.c
index 6e518d661..17591da18 100644
--- a/src/bank-lib/fakebank_tbr_get_root.c
+++ b/src/bank-lib/fakebank_tbr_get_root.c
@@ -27,6 +27,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "fakebank.h"
+#include "fakebank_tbr_get_root.h"
MHD_RESULT
@@ -38,10 +39,9 @@ TALER_FAKEBANK_tbr_get_root (struct TALER_FAKEBANK_Handle *h,
#define HELLOMSG "Hello, Fakebank (Bank Revenue API here)!"
(void) h;
- resp = MHD_create_response_from_buffer (
+ resp = MHD_create_response_from_buffer_static (
strlen (HELLOMSG),
- HELLOMSG,
- MHD_RESPMEM_MUST_COPY);
+ HELLOMSG);
ret = MHD_queue_response (connection,
MHD_HTTP_OK,
resp);
diff --git a/src/bank-lib/fakebank_twg_get_root.c b/src/bank-lib/fakebank_twg_get_root.c
index 09589890e..af40ed820 100644
--- a/src/bank-lib/fakebank_twg_get_root.c
+++ b/src/bank-lib/fakebank_twg_get_root.c
@@ -27,6 +27,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "fakebank.h"
+#include "fakebank_twg_get_root.h"
/**
@@ -46,10 +47,9 @@ TALER_FAKEBANK_twg_get_root_ (
#define HELLOMSG "Hello, Fakebank (Taler Wire Gateway)!"
(void) h;
- resp = MHD_create_response_from_buffer (
+ resp = MHD_create_response_from_buffer_static (
strlen (HELLOMSG),
- HELLOMSG,
- MHD_RESPMEM_MUST_COPY);
+ HELLOMSG);
ret = MHD_queue_response (connection,
MHD_HTTP_OK,
resp);
diff --git a/src/bank-lib/fakebank_twg_get_transfers.c b/src/bank-lib/fakebank_twg_get_transfers.c
index 18b66dd54..ea1064268 100644
--- a/src/bank-lib/fakebank_twg_get_transfers.c
+++ b/src/bank-lib/fakebank_twg_get_transfers.c
@@ -132,7 +132,8 @@ TALER_FAKEBANK_twg_get_transfers_ (
(t->row_id == offset) )
overflow = true; /* full circle, give up! */
}
- if (t->debit_account != acc)
+ if ( (NULL == t) ||
+ (t->debit_account != acc) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid start specified, transaction %llu not with account %s!\n",
diff --git a/src/bank-lib/fakebank_twg_history.c b/src/bank-lib/fakebank_twg_history.c
index ccb385537..9e5ef3b98 100644
--- a/src/bank-lib/fakebank_twg_history.c
+++ b/src/bank-lib/fakebank_twg_history.c
@@ -28,6 +28,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "fakebank.h"
+#include "fakebank_twg_history.h"
#include "fakebank_common_lookup.h"
#include "fakebank_common_lp.h"
#include "fakebank_common_parser.h"
@@ -288,7 +289,7 @@ finish:
0);
}
{
- json_t *h = hc->history;
+ json_t *jh = hc->history;
hc->history = NULL;
return TALER_MHD_REPLY_JSON_PACK (
@@ -299,7 +300,7 @@ finish:
acc_payto_uri),
GNUNET_JSON_pack_array_steal (
"outgoing_transactions",
- h));
+ jh));
}
}
@@ -564,7 +565,7 @@ finish:
0);
}
{
- json_t *h = hc->history;
+ json_t *jh = hc->history;
hc->history = NULL;
return TALER_MHD_REPLY_JSON_PACK (
@@ -575,6 +576,6 @@ finish:
acc_payto_uri),
GNUNET_JSON_pack_array_steal (
"incoming_transactions",
- h));
+ jh));
}
}
diff --git a/src/bank-lib/fakebank_twg_transfer.c b/src/bank-lib/fakebank_twg_transfer.c
index fef314a52..6a22c7dad 100644
--- a/src/bank-lib/fakebank_twg_transfer.c
+++ b/src/bank-lib/fakebank_twg_transfer.c
@@ -117,53 +117,49 @@ TALER_FAKEBANK_handle_transfer_ (
json_decref (json);
return (GNUNET_NO == ret) ? MHD_YES : MHD_NO;
}
+ credit = TALER_xtalerbank_account_from_payto (credit_account);
+ if (NULL == credit)
{
- enum GNUNET_GenericReturnValue ret;
-
- credit = TALER_xtalerbank_account_from_payto (credit_account);
- if (NULL == credit)
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (
- connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_PAYTO_URI_MALFORMED,
- credit_account);
- }
- ret = TALER_FAKEBANK_make_transfer_ (h,
- account,
- credit,
- &amount,
- &wtid,
- base_url,
- &uuid,
- &row_id,
- &ts);
- if (GNUNET_OK != ret)
- {
- MHD_RESULT res;
- char *uids;
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_GENERIC_PAYTO_URI_MALFORMED,
+ credit_account);
+ }
+ ret = TALER_FAKEBANK_make_transfer_ (h,
+ account,
+ credit,
+ &amount,
+ &wtid,
+ base_url,
+ &uuid,
+ &row_id,
+ &ts);
+ if (GNUNET_OK != ret)
+ {
+ MHD_RESULT res;
+ char *uids;
- GNUNET_break (0);
- uids = GNUNET_STRINGS_data_to_string_alloc (&uuid,
- sizeof (uuid));
- json_decref (json);
- res = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_CONFLICT,
- TALER_EC_BANK_TRANSFER_REQUEST_UID_REUSED,
- uids);
- GNUNET_free (uids);
- return res;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Receiving incoming wire transfer: %s->%s, subject: %s, amount: %s, from %s\n",
- account,
- credit,
- TALER_B2S (&wtid),
- TALER_amount2s (&amount),
- base_url);
- GNUNET_free (credit);
+ GNUNET_break (0);
+ uids = GNUNET_STRINGS_data_to_string_alloc (&uuid,
+ sizeof (uuid));
+ json_decref (json);
+ res = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_CONFLICT,
+ TALER_EC_BANK_TRANSFER_REQUEST_UID_REUSED,
+ uids);
+ GNUNET_free (uids);
+ return res;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Receiving incoming wire transfer: %s->%s, subject: %s, amount: %s, from %s\n",
+ account,
+ credit,
+ TALER_B2S (&wtid),
+ TALER_amount2s (&amount),
+ base_url);
+ GNUNET_free (credit);
}
json_decref (json);
diff --git a/src/bank-lib/taler-exchange-wire-gateway-client.c b/src/bank-lib/taler-exchange-wire-gateway-client.c
index 81b63401c..93837b15d 100644
--- a/src/bank-lib/taler-exchange-wire-gateway-client.c
+++ b/src/bank-lib/taler-exchange-wire-gateway-client.c
@@ -214,6 +214,7 @@ credit_history_cb (void *cls,
TALER_B2S (&cd->details.kycauth.account_pub),
TALER_amount2s (&cd->amount),
GNUNET_TIME_timestamp2s (cd->execution_date));
+ break;
case TALER_BANK_CT_WAD:
GNUNET_break (0); // FIXME
break;
@@ -746,10 +747,6 @@ main (int argc,
not do this, the linker may "optimize" libtalerutil
away and skip #TALER_OS_init(), which we do need */
(void) TALER_project_data_default ();
- if (GNUNET_OK !=
- GNUNET_STRINGS_get_utf8_args (argc, argv,
- &argc, &argv))
- return 4;
global_ret = 1;
ret = GNUNET_PROGRAM_run (
argc, argv,
@@ -757,7 +754,6 @@ main (int argc,
gettext_noop ("Client tool of the Taler Wire Gateway"),
options,
&run, NULL);
- GNUNET_free_nz ((void *) argv);
if (GNUNET_SYSERR == ret)
return 3;
if (GNUNET_NO == ret)