diff options
author | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-06-24 17:38:09 -0400 |
---|---|---|
committer | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-06-24 17:38:09 -0400 |
commit | 0fbdd6c6cda1c7e0ad0b4ffc3f22bac3e1176c1d (patch) | |
tree | 8935dc12924a27e8c1112314b88fa895e1bf1240 /src/testing/testing_api_cmd_wallet_get_order.c | |
parent | ebfa7888c0cbb461cf70a8d809b1d183011713ce (diff) | |
download | merchant-0fbdd6c6cda1c7e0ad0b4ffc3f22bac3e1176c1d.tar.gz merchant-0fbdd6c6cda1c7e0ad0b4ffc3f22bac3e1176c1d.tar.bz2 merchant-0fbdd6c6cda1c7e0ad0b4ffc3f22bac3e1176c1d.zip |
got refunds working and tested
Diffstat (limited to 'src/testing/testing_api_cmd_wallet_get_order.c')
-rw-r--r-- | src/testing/testing_api_cmd_wallet_get_order.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/testing/testing_api_cmd_wallet_get_order.c b/src/testing/testing_api_cmd_wallet_get_order.c index 1dce69c9..7cc9c352 100644 --- a/src/testing/testing_api_cmd_wallet_get_order.c +++ b/src/testing/testing_api_cmd_wallet_get_order.c @@ -57,6 +57,16 @@ struct WalletGetOrderState * Reference to a command that created an order. */ const char *order_reference; + + /** + * Whether the order was paid or not. + */ + bool paid; + + /** + * Whether the order was refunded or not. + */ + bool refunded; }; @@ -95,6 +105,8 @@ wallet_get_order_cb ( { /* FIXME, deeper checks should be implemented here. */ struct WalletGetOrderState *gos = cls; + bool paid_b = (paid == GNUNET_YES); + bool refunded_b = (refunded == GNUNET_YES); gos->ogh = NULL; if (gos->http_status != hr->http_status) @@ -110,8 +122,22 @@ wallet_get_order_cb ( switch (hr->http_status) { case MHD_HTTP_OK: - // FIXME: use gts->tip_reference here to + // FIXME: use gos->order_reference here to // check if the data returned matches that from the POST / PATCH + if (gos->paid != paid_b) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Order paid does not match\n"); + TALER_TESTING_interpreter_fail (gos->is); + return; + } + if (gos->refunded != refunded_b) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Order refunded does not match\n"); + TALER_TESTING_interpreter_fail (gos->is); + return; + } break; default: GNUNET_log (GNUNET_ERROR_TYPE_WARNING, @@ -196,12 +222,16 @@ wallet_get_order_cleanup (void *cls, * @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 refunded whether the order has been refunded. * @param http_status expected HTTP response code for the request. */ struct TALER_TESTING_Command TALER_TESTING_cmd_wallet_get_order (const char *label, const char *merchant_url, const char *order_reference, + bool paid, + bool refunded, unsigned int http_status) { struct WalletGetOrderState *gos; @@ -210,6 +240,8 @@ TALER_TESTING_cmd_wallet_get_order (const char *label, gos->merchant_url = merchant_url; gos->order_reference = order_reference; gos->http_status = http_status; + gos->paid = paid; + gos->refunded = refunded; { struct TALER_TESTING_Command cmd = { .cls = gos, |