From 280bbb526c245ac69762e989816cb4c4848cd22c Mon Sep 17 00:00:00 2001 From: Jonathan Buchanan Date: Mon, 10 Aug 2020 16:10:52 -0400 Subject: implement parse refund uri (untested) & add more tests for pay uri --- src/testing/testing_api_cmd_merchant_get_order.c | 40 ++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'src/testing/testing_api_cmd_merchant_get_order.c') diff --git a/src/testing/testing_api_cmd_merchant_get_order.c b/src/testing/testing_api_cmd_merchant_get_order.c index 1da6b7b6..1fed93a6 100644 --- a/src/testing/testing_api_cmd_merchant_get_order.c +++ b/src/testing/testing_api_cmd_merchant_get_order.c @@ -445,6 +445,10 @@ merchant_get_order_cb ( { /* FIXME: Check all of the members of `pud` */ struct TALER_MERCHANT_PayUriData pud; + const struct TALER_TESTING_Command *order_cmd; + const char *order_id; + const struct TALER_ClaimTokenP *claim_token; + if (GNUNET_OK != TALER_MERCHANT_parse_pay_uri (osr->details.unpaid.taler_pay_uri, &pud)) @@ -455,12 +459,44 @@ merchant_get_order_cb ( return; } + order_cmd = TALER_TESTING_interpreter_lookup_command ( + gos->is, + gos->order_reference); + + if (GNUNET_OK != + TALER_TESTING_get_trait_order_id (order_cmd, + 0, + &order_id)) + TALER_TESTING_FAIL (gos->is); + + if (GNUNET_OK != + TALER_TESTING_get_trait_claim_token (order_cmd, + 0, + &claim_token)) + TALER_TESTING_FAIL (gos->is); + if ((0 != strcmp ("localhost:8080", pud.merchant_host)) || - (NULL != pud.merchant_prefix_path)) + (NULL != pud.merchant_prefix_path) || + (0 != strcmp (order_id, + pud.order_id)) || + (NULL != pud.ssid)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Order pay uri does not match\n"); + TALER_TESTING_interpreter_fail (gos->is); + TALER_MERCHANT_parse_pay_uri_free (&pud); + return; + } + /* The claim token is not given in the pay uri if the order + has been claimed already. */ + if ((NULL != pud.claim_token) && + ((NULL == claim_token) || + (0 != GNUNET_memcmp (claim_token, + pud.claim_token)))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Taler pay uri is incorrect\n"); + "Order pay uri does not match\n"); TALER_TESTING_interpreter_fail (gos->is); TALER_MERCHANT_parse_pay_uri_free (&pud); return; -- cgit v1.2.3