diff options
author | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-07-07 05:52:23 -0400 |
---|---|---|
committer | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-07-07 05:52:23 -0400 |
commit | 5eb0a2e98faecfec89add4845f817548b3fee86b (patch) | |
tree | 113ddae80b46f5f34a2ae7f4159323d98bf021fd /src/testing/testing_api_cmd_merchant_get_order.c | |
parent | 002772c388aaa794c068c9239565c8467f6c65a8 (diff) | |
download | merchant-5eb0a2e98faecfec89add4845f817548b3fee86b.tar.gz merchant-5eb0a2e98faecfec89add4845f817548b3fee86b.tar.bz2 merchant-5eb0a2e98faecfec89add4845f817548b3fee86b.zip |
fixed merchant get order with transfer status
Diffstat (limited to 'src/testing/testing_api_cmd_merchant_get_order.c')
-rw-r--r-- | src/testing/testing_api_cmd_merchant_get_order.c | 96 |
1 files changed, 95 insertions, 1 deletions
diff --git a/src/testing/testing_api_cmd_merchant_get_order.c b/src/testing/testing_api_cmd_merchant_get_order.c index 76bc75b8..cf0263ba 100644 --- a/src/testing/testing_api_cmd_merchant_get_order.c +++ b/src/testing/testing_api_cmd_merchant_get_order.c @@ -77,6 +77,21 @@ struct MerchantGetOrderState * The length of @e refunds. */ unsigned int refunds_length; + + /** + * Whether the order was wired or not. + */ + bool wired; + + /** + * A NULL-terminated list of transfers associated with this order. + */ + const char **transfers; + + /** + * The length of @e transfers. + */ + unsigned int transfers_length; }; @@ -230,6 +245,14 @@ merchant_get_order_cb ( } } } + + if (gos->wired != osr->details.paid.wired) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Order wired does not match\n"); + TALER_TESTING_interpreter_fail (gos->is); + return; + } } break; default: @@ -278,7 +301,7 @@ merchant_get_order_run (void *cls, gos->merchant_url, order_id, NULL, - false, + true, GNUNET_TIME_UNIT_ZERO, &merchant_get_order_cb, gos); @@ -366,6 +389,77 @@ TALER_TESTING_cmd_merchant_get_order (const char *label, } +/** + * Define a GET /private/orders/$ORDER_ID CMD. + * + * @param label the command label + * @param merchant_url base URL of the merchant which will + * serve the request. + * @param order_reference reference to a command that created an order. + * @param paid whether the order has been paid for or not. + * @param wired whether the order has been wired or not. + * @param transfers NULL-terminated list of labels (const char *) of + * wire transfers (commands) we expect to be aggregated in the order + * (assuming @a http_code is #MHD_HTTP_OK). If @e paid is fale, this + * parameter is ignored. + * @param refunded whether the order has been refunded. + * @param refunds NULL-terminated list of labels (const char *) of + * refunds (commands) we expect to be aggregated in the order + * (assuming @a http_code is #MHD_HTTP_OK). If @e refunded is false, + * this parameter is ignored. + * @param http_status expected HTTP response code for the request. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_merchant_get_order2 (const char *label, + const char *merchant_url, + const char *order_reference, + bool paid, + bool wired, + const char **transfers, + bool refunded, + const char **refunds, + unsigned int http_status) +{ + struct MerchantGetOrderState *gos; + + gos = GNUNET_new (struct MerchantGetOrderState); + gos->merchant_url = merchant_url; + gos->order_reference = order_reference; + gos->paid = paid; + gos->wired = wired; + gos->refunded = refunded; + gos->http_status = http_status; + /*if (paid) + { + for (const char *clabel = transfers[0]; clabel != NULL; ++clabel) + { + GNUNET_array_append (gos->transfers, + gos->transfers_length, + clabel); + } + } + if (refunded) + { + for (const char *clabel = refunds[0]; clabel != NULL; ++clabel) + { + GNUNET_array_append (gos->refunds, + gos->refunds_length, + clabel); + } + }*/ + { + struct TALER_TESTING_Command cmd = { + .cls = gos, + .label = label, + .run = &merchant_get_order_run, + .cleanup = &merchant_get_order_cleanup + }; + + return cmd; + } +} + + struct MerchantPollOrderConcludeState { /** |