summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_post_transfers.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-05-03 23:13:51 +0200
committerChristian Grothoff <christian@grothoff.org>2023-05-03 23:13:51 +0200
commit8535f1e81939e87258ad9d2503ad25df9cfb021d (patch)
tree6a01388ace0fcd23f57eb3bf19ea7d756b8401b7 /src/testing/testing_api_cmd_post_transfers.c
parent63960574154ca1615fb095a71b958ec5d00df4ae (diff)
downloadmerchant-8535f1e81939e87258ad9d2503ad25df9cfb021d.tar.gz
merchant-8535f1e81939e87258ad9d2503ad25df9cfb021d.tar.bz2
merchant-8535f1e81939e87258ad9d2503ad25df9cfb021d.zip
simplify POST /private/transfers implementation to match new situation with taler-merchant-exchange (incomplete)
Diffstat (limited to 'src/testing/testing_api_cmd_post_transfers.c')
-rw-r--r--src/testing/testing_api_cmd_post_transfers.c151
1 files changed, 1 insertions, 150 deletions
diff --git a/src/testing/testing_api_cmd_post_transfers.c b/src/testing/testing_api_cmd_post_transfers.c
index b73c6b15..4971d952 100644
--- a/src/testing/testing_api_cmd_post_transfers.c
+++ b/src/testing/testing_api_cmd_post_transfers.c
@@ -115,10 +115,6 @@ struct PostTransfersState
*/
unsigned int deposits_length;
- /**
- * When the exchange executed the transfer.
- */
- struct GNUNET_TIME_Timestamp execution_time;
};
@@ -147,150 +143,7 @@ transfers_cb (void *cls,
}
switch (ptr->hr.http_status)
{
- case MHD_HTTP_OK:
- {
- pts->execution_time = ptr->details.success.execution_time;
- pts->wire_fee = ptr->details.success.wire_fee;
- fprintf (stderr,
- "FIXME");
- json_dumpf (ptr->hr.reply,
- stderr,
- 0);
-#if FIXME_WRITE_PROPPER_CHECK_OF_RETURNED_DATA_HERE
- /* this code is some legacy logic that is close to what we
- need but needs to be updated to the current API */
- struct TALER_Amount total;
-
- if (0 >
- TALER_amount_subtract (&total,
- total_amount,
- wire_fee))
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (pts->is);
- return;
- }
- if (0 !=
- TALER_amount_cmp (&total,
- &pts->credit_amount))
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (pts->is);
- return;
- }
- TALER_amount_set_zero (total.currency,
- &total);
- for (unsigned int i = 0; i<details_length; i++)
- {
- const struct TALER_MERCHANT_TrackTransferDetail *tdd = &details[i];
- struct TALER_Amount sum;
- struct TALER_Amount fees;
-
- TALER_amount_set_zero (tdd->deposit_value.currency,
- &sum);
- TALER_amount_set_zero (tdd->deposit_fee.currency,
- &fees);
- for (unsigned int j = 0; j<pts->deposits_length; j++)
- {
- const char *label = pts->deposits[j];
- const struct TALER_TESTING_Command *cmd;
- const json_t *contract_terms;
- const struct TALER_Amount *deposit_value;
- const struct TALER_Amount *deposit_fee;
- const char *order_id;
-
- cmd = TALER_TESTING_interpreter_lookup_command (pts->is,
- label);
- if (NULL == cmd)
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (pts->is);
- return;
- }
- if ( (GNUNET_OK !=
- TALER_TESTING_get_trait_contract_terms (cmd,
- 0,
- &contract_terms)) ||
- (GNUNET_OK !=
- TALER_TESTING_get_trait_amount_obj (cmd,
- TALER_TESTING_CMD_DEPOSIT_TRAIT_IDX_DEPOSIT_VALUE,
- &deposit_value)) ||
- (GNUNET_OK !=
- TALER_TESTING_get_trait_amount_obj (cmd,
- TALER_TESTING_CMD_DEPOSIT_TRAIT_IDX_DEPOSIT_FEE,
- &deposit_fee)) )
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (pts->is);
- return;
- }
- order_id = json_string_value (json_object_get (contract_terms,
- "order_id"));
- if (NULL == order_id)
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (pts->is);
- return;
- }
- if (0 != strcmp (tdd->order_id,
- order_id))
- continue;
- if (0 >
- TALER_amount_add (&sum,
- &sum,
- deposit_value))
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (pts->is);
- return;
- }
- if (0 >
- TALER_amount_add (&fees,
- &fees,
- deposit_fee))
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (pts->is);
- return;
- }
- }
- if (0 !=
- TALER_amount_cmp (&sum,
- &tdd->deposit_value))
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (pts->is);
- return;
- }
- if (0 !=
- TALER_amount_cmp (&fees,
- &tdd->deposit_fee))
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (pts->is);
- return;
- }
- GNUNET_assert (0 <=
- TALER_amount_add (&total,
- &total,
- &tdd->deposit_value));
- GNUNET_assert (0 <=
- TALER_amount_subtract (&total,
- &total,
- &tdd->deposit_fee));
- }
- if (0 !=
- TALER_amount_cmp (&total,
- &pts->credit_amount))
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (pts->is);
- return;
- }
-#endif
- break;
- }
- case MHD_HTTP_ACCEPTED:
+ case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_UNAUTHORIZED:
break;
@@ -334,8 +187,6 @@ post_transfers_traits (void *cls,
TALER_TESTING_make_trait_fee (&pts->wire_fee),
TALER_TESTING_make_trait_exchange_url (
(const char **) &pts->exchange_url),
- TALER_TESTING_make_trait_timestamp (0,
- &pts->execution_time),
TALER_TESTING_make_trait_bank_row (&pts->serial),
TALER_TESTING_trait_end (),
};