summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_merchant_get_order.c
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-08-10 16:10:52 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-08-10 16:10:52 -0400
commit280bbb526c245ac69762e989816cb4c4848cd22c (patch)
tree0b9f6a19629ab04597ae52186d0d38769f9f6c6b /src/testing/testing_api_cmd_merchant_get_order.c
parent119de8db9e317e46ebe800524b806809d2b435b0 (diff)
downloadmerchant-280bbb526c245ac69762e989816cb4c4848cd22c.tar.gz
merchant-280bbb526c245ac69762e989816cb4c4848cd22c.tar.bz2
merchant-280bbb526c245ac69762e989816cb4c4848cd22c.zip
implement parse refund uri (untested) & add more tests for pay uri
Diffstat (limited to 'src/testing/testing_api_cmd_merchant_get_order.c')
-rw-r--r--src/testing/testing_api_cmd_merchant_get_order.c40
1 files changed, 38 insertions, 2 deletions
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;