merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit b378eea34812a9b561be6149e40c4518070f34f7
parent 8dbb0c68bc6b6518afe75bd74e6dd69a4a24ea43
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 22 Apr 2020 22:51:08 +0200

add DELETE/PURGE /instances/ID command

Diffstat:
Msrc/include/taler_merchant_testing_lib.h | 34++++++++++++++++++++++++++++++++++
Msrc/testing/testing_api_cmd_delete_instance.c | 58+++++++++++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 87 insertions(+), 5 deletions(-)

diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h @@ -213,6 +213,40 @@ TALER_TESTING_cmd_merchant_get_instance (const char *label, const char *instance_reference); +/** + * Define a "PURGE instance" CMD. + * + * @param label command label. + * @param merchant_url base URL of the merchant serving the + * PURGE /instances/$ID request. + * @param instance_id the ID of the instance to query + * @param http_status expected HTTP response code. + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_merchant_purge_instance (const char *label, + const char *merchant_url, + const char *instance_id, + unsigned int http_status); + + +/** + * Define a "DELETE instance" CMD. + * + * @param label command label. + * @param merchant_url base URL of the merchant serving the + * DELETE /instances/$ID request. + * @param instance_id the ID of the instance to query + * @param http_status expected HTTP response code. + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_merchant_delete_instance (const char *label, + const char *merchant_url, + const char *instance_id, + unsigned int http_status); + + /* ******************** OLD ******************* */ /** diff --git a/src/testing/testing_api_cmd_delete_instance.c b/src/testing/testing_api_cmd_delete_instance.c @@ -59,6 +59,11 @@ struct DeleteInstanceState */ unsigned int http_status; + /** + * Use purge, not delete. + */ + bool purge; + }; @@ -112,11 +117,18 @@ delete_instance_run (void *cls, struct DeleteInstanceState *dis = cls; dis->is = is; - dis->igh = TALER_MERCHANT_instance_delete (is->ctx, - dis->merchant_url, - dis->instance_id, - &delete_instance_cb, - dis); + if (dis->purge) + dis->igh = TALER_MERCHANT_instance_purge (is->ctx, + dis->merchant_url, + dis->instance_id, + &delete_instance_cb, + dis); + else + dis->igh = TALER_MERCHANT_instance_delete (is->ctx, + dis->merchant_url, + dis->instance_id, + &delete_instance_cb, + dis); GNUNET_assert (NULL != dis->igh); } @@ -179,4 +191,40 @@ TALER_TESTING_cmd_merchant_delete_instance (const char *label, } +/** + * Define a "PURGE instance" CMD. + * + * @param label command label. + * @param merchant_url base URL of the merchant serving the + * PURGE /instances/$ID request. + * @param instance_id the ID of the instance to query + * @param http_status expected HTTP response code. + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_merchant_purge_instance (const char *label, + const char *merchant_url, + const char *instance_id, + unsigned int http_status) +{ + struct DeleteInstanceState *dis; + + dis = GNUNET_new (struct DeleteInstanceState); + dis->merchant_url = merchant_url; + dis->instance_id = instance_id; + dis->http_status = http_status; + dis->purge = true; + { + struct TALER_TESTING_Command cmd = { + .cls = dis, + .label = label, + .run = &delete_instance_run, + .cleanup = &delete_instance_cleanup + }; + + return cmd; + } +} + + /* end of testing_api_cmd_delete_instance.c */