commit d579354cf5ef1a0d71669f41e29e8c42488f90eb
parent 6be7ac41b2d1e7784df1fc2337aab065b438dd39
Author: bohdan-potuzhnyi <bohdan.potuzhnyi@gmail.com>
Date: Tue, 22 Jul 2025 19:30:41 +0200
the horses
Diffstat:
3 files changed, 50 insertions(+), 27 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -2030,7 +2030,6 @@ merchant_parse_json_bkp (struct DONAU_BlindedUniqueDonorIdentifierKeyPair *bkp,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- /* FIXME: Add donau signatures length to the batch issue */
return GNUNET_OK;
}
@@ -3216,12 +3215,35 @@ handle_output_donation_receipt (
return GNUNET_NO;
}
+ /* currency must match */
+ if (GNUNET_OK !=
+ TALER_amount_cmp_currency (wallet_amount,
+ &output->details.donation_receipt.amount))
+ {
+ GNUNET_break_op (0);
+ pay_end (pc,
+ TALER_MHD_reply_with_error (
+ pc->connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_GENERIC_CURRENCY_MISMATCH,
+ output->details.donation_receipt.amount.currency));
+ return GNUNET_NO;
+ }
- /* IDEA: Might be a nice thing to introduce a lock amount so that we don't allow donation to
- * go through the payment and be cancelled by donau */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "handle_output_donation_receipt: ignoring donation output index %u\n",
- output_index);
+ /* value must match */
+ if (0 != TALER_amount_cmp (wallet_amount,
+ &output->details.donation_receipt.amount))
+ {
+ GNUNET_break_op (0);
+ pay_end (pc,
+ TALER_MHD_reply_with_error (
+ pc->connection,
+ MHD_HTTP_CONFLICT,
+ /*FIXME : CHANGE TO PROPER ONE */
+ TALER_EC_MERCHANT_POST_ORDERS_ID_PAY_TOKEN_COUNT_MISMATCH,
+ "donation amount mismatch"));
+ return GNUNET_NO;
+ }
return GNUNET_OK;
#endif /* HAVE_DONAU_DONAU_SERVICE_H */
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
@@ -48,7 +48,7 @@
* commands should NOT wait for this timeout!
*/
#define POLL_ORDER_TIMEOUT \
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
/**
* The 'poll-orders-conclude-1x' and other 'conclude'
@@ -56,7 +56,7 @@
* here we use a short value!
*/
#define POLL_ORDER_SHORT_TIMEOUT \
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2)
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2)
/**
* Configuration file we use. One (big) configuration is used
@@ -176,8 +176,8 @@ cmd_exec_wirewatch (const char *label)
* @param label label to use for the command.
*/
#define CMD_EXEC_AGGREGATOR(label) \
- TALER_TESTING_cmd_exec_aggregator (label "-aggregator", config_file), \
- TALER_TESTING_cmd_exec_transfer (label "-transfer", config_file)
+ TALER_TESTING_cmd_exec_aggregator (label "-aggregator", config_file), \
+ TALER_TESTING_cmd_exec_transfer (label "-transfer", config_file)
/**
@@ -1863,21 +1863,22 @@ run (void *cls,
cred.cfg,
true)),
TALER_TESTING_cmd_charity_post_merchant ("post-charity",
- "example",
- "example.com",
- "EUR:50", // max_per_year
- "EUR:0", // receipts_to_date
- 2025, // current year
- &bearer,
- "create-another-order-with-input-and-output", //reusing the merhcant_reference for merchant_pub
- MHD_HTTP_CREATED),
+ "example",
+ "example.com",
+ "EUR:50", // max_per_year
+ "EUR:0", // receipts_to_date
+ 2025, // current year
+ &bearer,
+ "create-another-order-with-input-and-output", // reusing the merhcant_reference for merchant_pub
+ MHD_HTTP_CREATED),
TALER_TESTING_cmd_merchant_post_donau_instance (
"post-donau-instance",
merchant_url,
- "create-another-order-with-input-and-output", //reusing the merhcant_reference
+ "create-another-order-with-input-and-output", // reusing the merhcant_reference
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_sleep (
- "In this time donaukeyupdate must fetch the keys from the donau", 1),
+ "In this time donaukeyupdate must fetch the keys from the donau",
+ 1),
TALER_TESTING_cmd_merchant_get_donau_instances (
"get-donau-instance",
merchant_url,
@@ -1891,22 +1892,22 @@ run (void *cls,
"donau",
GNUNET_TIME_UNIT_ZERO_TS,
GNUNET_TIME_UNIT_FOREVER_TS,
- "EUR:5.0"),
- TALER_TESTING_cmd_merchant_pay_order_donau(
+ "EUR:0.05"),
+ TALER_TESTING_cmd_merchant_pay_order_donau (
"pay-donau-order",
merchant_url,
MHD_HTTP_OK,
"create-donau-order",
"withdraw-coin-3",
- "EUR:5.0",
- "EUR:4.99",
+ "EUR:0.05",
+ "EUR:0.04",
NULL,
0,
"post-charity",
2025,
"7560001010000",
"1234"
- ),
+ ),
TALER_TESTING_cmd_merchant_delete_donau_instance (
"delete-donau-instance",
merchant_url,
@@ -2258,7 +2259,7 @@ run (void *cls,
tokens),
#ifdef HAVE_DONAU_DONAU_SERVICE_H
- //TALER_TESTING_cmd_sleep("dream", 30),
+ // TALER_TESTING_cmd_sleep("dream", 30),
TALER_TESTING_cmd_batch ("donau",
donau),
#endif
diff --git a/src/testing/testing_api_cmd_pay_order.c b/src/testing/testing_api_cmd_pay_order.c
@@ -1583,7 +1583,7 @@ TALER_TESTING_cmd_merchant_pay_order_donau (const char *label,
mdpd = GNUNET_new (struct MerchantDonauPayData);
mdpd->year = year;
- mdpd->num_bkps = 3;
+ mdpd->num_bkps = 5;
mdpd->charity_reference = charity_reference;
/* Here we generate the h_donor_tax_id*/