diff options
author | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-08-18 21:36:50 -0400 |
---|---|---|
committer | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-08-18 21:36:50 -0400 |
commit | 807b6e0b125100b1dd8ec56521517522a0cbfd4f (patch) | |
tree | 8bd5cc24c14684fa1e3b4bf873aeeb56a50a67bd /src/testing | |
parent | f90d0e3aab659614c6cb0c32506220ad4a369cde (diff) | |
download | merchant-807b6e0b125100b1dd8ec56521517522a0cbfd4f.tar.gz merchant-807b6e0b125100b1dd8ec56521517522a0cbfd4f.tar.bz2 merchant-807b6e0b125100b1dd8ec56521517522a0cbfd4f.zip |
expose refund_pending in merchant lib
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_merchant_api.c | 11 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_wallet_get_order.c | 24 |
2 files changed, 31 insertions, 4 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c index 8e5903e1..d4348bff 100644 --- a/src/testing/test_merchant_api.c +++ b/src/testing/test_merchant_api.c @@ -329,6 +329,7 @@ run (void *cls, "create-proposal-1", false, false, + false, MHD_HTTP_OK), TALER_TESTING_cmd_merchant_get_order ("get-order-merchant-1", merchant_url, @@ -361,6 +362,7 @@ run (void *cls, "create-proposal-1", true, false, + false, MHD_HTTP_OK), TALER_TESTING_cmd_merchant_get_order ("get-order-merchant-1-2", merchant_url, @@ -681,6 +683,7 @@ run (void *cls, "create-proposal-1r", true, true, + true, MHD_HTTP_OK), TALER_TESTING_cmd_merchant_order_refund ("refund-increase-1r-2", merchant_url, @@ -693,6 +696,7 @@ run (void *cls, "create-proposal-1r", true, true, + true, MHD_HTTP_OK), TALER_TESTING_cmd_wallet_order_refund ("obtain-refund-1r", merchant_url, @@ -701,6 +705,13 @@ run (void *cls, "refund-increase-1r", "refund-increase-1r-2", NULL), + TALER_TESTING_cmd_wallet_get_order ("get-order-wallet-1r-3", + merchant_url, + "create-proposal-1r", + true, + true, + false, + MHD_HTTP_OK), TALER_TESTING_cmd_merchant_get_order ("get-order-merchant-1r", merchant_url, "create-proposal-1r", diff --git a/src/testing/testing_api_cmd_wallet_get_order.c b/src/testing/testing_api_cmd_wallet_get_order.c index aeae42a5..04acf791 100644 --- a/src/testing/testing_api_cmd_wallet_get_order.c +++ b/src/testing/testing_api_cmd_wallet_get_order.c @@ -67,6 +67,11 @@ struct WalletGetOrderState * Whether the order was refunded or not. */ bool refunded; + + /** + * Whether the order has refunds pending. + */ + bool refund_pending; }; @@ -80,6 +85,9 @@ struct WalletGetOrderState * (note that refunded payments are returned as paid!) * @param refunded #GNUNET_YES if there is at least on refund on this payment, * #GNUNET_NO if refunded, #GNUNET_SYSERR or error + * @param refund_pending #GNUNET_YES if there are refunds waiting to be + * obtained, #GNUNET_NO if all refunds have been obtained, #GNUNET_SYSERR + * on error. * @param refunded_amount amount that was refunded, NULL if there * was no refund * @param taler_pay_uri the URI that instructs the wallets to process @@ -93,6 +101,7 @@ wallet_get_order_cb ( const struct TALER_MERCHANT_HttpResponse *hr, enum GNUNET_GenericReturnValue paid, enum GNUNET_GenericReturnValue refunded, + enum GNUNET_GenericReturnValue refund_pending, struct TALER_Amount *refund_amount, const char *taler_pay_uri, const char *already_paid_order_id) @@ -101,6 +110,7 @@ wallet_get_order_cb ( struct WalletGetOrderState *gos = cls; bool paid_b = (paid == GNUNET_YES); bool refunded_b = (refunded == GNUNET_YES); + bool refund_pending_b = (refund_pending == GNUNET_YES); gos->ogh = NULL; if (gos->http_status != hr->http_status) @@ -132,6 +142,13 @@ wallet_get_order_cb ( TALER_TESTING_interpreter_fail (gos->is); return; } + if (gos->refund_pending != refund_pending_b) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Order refund pending does not match\n"); + TALER_TESTING_interpreter_fail (gos->is); + return; + } if (!paid_b) { /* FIXME: Check all of the members of `pud` */ @@ -280,11 +297,8 @@ wallet_get_order_cleanup (void *cls, * @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 refund_pending whether the order has refunds that haven't been obtained. * @param http_status expected HTTP response code for the request. - * @param ... NULL-terminated list of labels (const char *) of - * refunds (commands) we expect to be aggregated in the transfer - * (assuming @a http_code is #MHD_HTTP_OK). If @e refunded is false, - * this parameter is ignored. */ struct TALER_TESTING_Command TALER_TESTING_cmd_wallet_get_order (const char *label, @@ -292,6 +306,7 @@ TALER_TESTING_cmd_wallet_get_order (const char *label, const char *order_reference, bool paid, bool refunded, + bool refund_pending, unsigned int http_status) { struct WalletGetOrderState *gos; @@ -302,6 +317,7 @@ TALER_TESTING_cmd_wallet_get_order (const char *label, gos->http_status = http_status; gos->paid = paid; gos->refunded = refunded; + gos->refund_pending = refund_pending; { struct TALER_TESTING_Command cmd = { .cls = gos, |