commit 717a29c9aaf3633657089223ddc184a44b0eb167 parent 8f27ed6aa7b97ba05f3e863f154ee29e0cf2c43e Author: Christian Grothoff <christian@grothoff.org> Date: Sat, 7 Mar 2026 16:27:44 +0100 add logic for sending notifications on KYC status changes Diffstat:
20 files changed, 564 insertions(+), 19 deletions(-)
diff --git a/bootstrap b/bootstrap @@ -32,7 +32,7 @@ existence() } # Freeze SQL files that must no longer be edited. -for n in 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 +for n in 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 0032 do chmod -w src/backenddb/merchant-$n.sql* done diff --git a/configure.ac b/configure.ac @@ -496,6 +496,7 @@ AC_CONFIG_FILES([Makefile contrib/Makefile contrib/typst/Makefile contrib/typst/common/Makefile +contrib/typst/kyc/Makefile contrib/typst/orders/Makefile contrib/typst/transactions/Makefile doc/Makefile diff --git a/contrib/kyc-text.en.must b/contrib/kyc-text.en.must @@ -0,0 +1,130 @@ +GNU Taler Merchant — Compliance Onboarding Status +================================================= + +{{#kyc_data}} +──────────────────────────────────────── +Your account : {{payto_uri}} +Payment service: {{exchange_url}} +Currency : {{exchange_currency}} +──────────────────────────────────────── +{{#limits}} +* {{operation_type}} within {{timeframe}} is allowed up to {{threshold}}. +{{#soft_limit}} + This limit may be relaxed after additional legitimization steps. +{{/soft_limit}} +{{/limits}} +{{#status_ready}} +{{^limits}} +The payment service provider did not communicate any limits +that would restrict the use of the account. +{{/limits}} +{{/status_ready}} +{{#no_keys}} +⚠️ Note: The payment service provider keys (/keys) are not yet available. + Some checks — such as default account limits and account eligibility — + cannot be performed until the keys are retrieved. +{{/no_keys}} +Status: {{status}} +{{#status_ready}} +✅ This account is verified and ready to use. + You can send and receive payments in {{exchange_currency}} + without any restrictions. +{{/status_ready}} +{{#status_awaiting_aml_review}} +🔄 Your account is currently under review by the payment provider. + This is a normal part of their compliance process. No action is needed + from you right now. +{{/status_awaiting_aml_review}} +{{#status_kyc_required}} +⚠️ ACTION REQUIRED — KYC verification needed + Before this account can process payments, you must complete a + Know-Your-Customer (KYC) identity check. + + Instructions can be found in your merchant portal. +{{/status_kyc_required}} +{{#status_kyc_wire_required}} +⚠️ ACTION REQUIRED — KYC authentication wire transfer needed + The payment service provider requires a small wire transfer + from your bank account to verify that you are the legitimate + owner of the account. + + Detailed wire transfer instructions can be found in your + merchant portal. +{{/status_kyc_wire_required}} +{{#status_unsupported_account}} +🟡 This payment service provider does not support your bank account type. + No action is required. +{{/status_unsupported_account}} +{{#status_no_exchange_keys}} +🟡 Waiting for payment service provider key data. + The merchant backend has not yet received the cryptographic key + information (/keys) from this provider. This is usually a temporary + situation that resolves itself within a few minutes. + + If it does not resolve itself, contact your merchant backend operator. +{{/status_no_exchange_keys}} +{{#status_merchant_internal_error}} +🟡 The merchant backend encountered an internal error while checking + the KYC status of this account. This is likely a temporary issue. + + If the problem persists, contact your system administrator. +{{/status_merchant_internal_error}} +{{#status_exchange_internal_error}} +🟡 The payment service provider reported an internal error + (HTTP status: {{exchange_http_status}}). + This is a problem on the payment service provider's side + and not caused by your account. + + If the problem persists, contact the payment service provider of + {{exchange_url}}. +{{/status_exchange_internal_error}} +{{#status_exchange_gateway_timeout}} +🟡 The payment service provider gateway timed out + (HTTP status: {{exchange_http_status}}). + The merchant backend could not reach it in time. + This is usually a short-lived network issue. +{{/status_exchange_gateway_timeout}} +{{#status_exchange_unreachable}} +🟡 The payment service provider did not respond to our KYC status inquiry. + This can occur briefly even when the payment service provider is online, + since requests take time to process. The KYC status for this account is + currently unknown. +{{/status_exchange_unreachable}} +{{#status_kyc_wire_impossible}} +🔴 ERROR — KYC authentication wire transfer required but not possible. + The payment service requires a wire transfer to verify your account + ownership, but there is no compatible wire method available + to complete it. +{{#auth_conflict}} + + Specifically, there is a conflict: none of the payment service + providers's wire accounts use a wire method that matches your + account ({{payto_uri}}). + You may need to use a different bank account or contact the + payment service provider for guidance. +{{/auth_conflict}} + Payment service provider: {{exchange_url}} +{{/status_kyc_wire_impossible}} +{{#status_exchange_status_invalid}} +🔴 ERROR — The payment service provider returned an invalid or + unexpected response (HTTP status: {{exchange_http_status}}{{#exchange_code}}, error code: {{exchange_code}}{{/exchange_code}}). + This means the payment service provider violated the + GNU Taler protocol. + + You should report this to the payment service provider operator + of {{exchange_url}}. +{{/status_exchange_status_invalid}} +{{#status_logic_bug}} +🔴 ERROR — A logic bug was detected in the merchant backend. + + This is a software defect and requires attention from your system + administrator or the GNU Taler support team. Payments through this + account may not work until the issue is resolved. +{{/status_logic_bug}} + + +{{/kyc_data}} +{{^kyc_data}} +No KYC account data was returned. This may mean no accounts are configured +or no accounts matched your query. +{{/kyc_data}} diff --git a/contrib/typst/Makefile.am b/contrib/typst/Makefile.am @@ -1 +1 @@ -SUBDIRS = . common orders transactions +SUBDIRS = . common kyc orders transactions diff --git a/contrib/typst/kyc/Makefile.am b/contrib/typst/kyc/Makefile.am @@ -0,0 +1,10 @@ +SUBDIRS = . + +formdatadir = $(prefix)/.local/share/typst/packages/taler-merchant/kyc/0.0.0/ +dist_formdata_DATA = \ + typst.toml \ + kyc.typ + +EXTRA_DIST = \ + template/main.typ \ + $(dist_formdata_DATA) diff --git a/contrib/typst/kyc/kyc.typ b/contrib/typst/kyc/kyc.typ @@ -0,0 +1,23 @@ +#let form(data) = { + set page( + paper: "a4", + margin: (left: 2cm, right: 2cm, top: 2cm, bottom: 2.5cm), + footer: context [ + #grid( + columns: (1fr, 1fr), + align: (left, right), + text(size: 8pt)[], + text(size: 8pt)[ + Page #here().page() of #counter(page).final().first() + ] + ) + ] + ) + + heading(level: 1)[GNU Taler Merchant: #data.business_name] + + v(0.5cm) + + [Your KYC status changed.] + +} diff --git a/contrib/typst/kyc/template/main.typ b/contrib/typst/kyc/template/main.typ @@ -0,0 +1,5 @@ +#import "@taler-merchant/kyc:0.0.0": form + +#form(( + business_name: "example.com", +)) diff --git a/contrib/typst/kyc/typst.toml b/contrib/typst/kyc/typst.toml @@ -0,0 +1,9 @@ +[package] +name = "kyc" +version = "0.0.0" +entrypoint = "kyc.typ" +authors = ["Christian Grothoff <https://grothoff.org/christian/>"] +license = "GPLv3+" +description = "KYC status change alert for GNU Taler merchant PDF generation" +repository = "git://git.taler.net/merchant" +keywords = ["accounting"] diff --git a/contrib/typst/orders/typst.toml b/contrib/typst/orders/typst.toml @@ -5,5 +5,5 @@ entrypoint = "orders.typ" authors = ["Christian Grothoff <https://grothoff.org/christian/>"] license = "GPLv3+" description = "Order summary for GNU Taler merchant PDF generation" -repository = "git://git.taler.net/exchange" +repository = "git://git.taler.net/merchant" keywords = ["accounting"] diff --git a/contrib/typst/transactions/typst.toml b/contrib/typst/transactions/typst.toml @@ -5,5 +5,5 @@ entrypoint = "transactions.typ" authors = ["Christian Grothoff <https://grothoff.org/christian/>"] license = "GPLv3+" description = "Transaction overview for GNU Taler merchant PDF generation" -repository = "git://git.taler.net/exchange" +repository = "git://git.taler.net/merchant" keywords = ["accounting"] diff --git a/src/backend/taler-merchant-httpd_get-private-kyc.c b/src/backend/taler-merchant-httpd_get-private-kyc.c @@ -28,6 +28,7 @@ #include "taler-merchant-httpd_helper.h" #include "taler-merchant-httpd_get-exchanges.h" #include <taler/taler_json_lib.h> +#include <taler/taler_templating_lib.h> #include <taler/taler_dbevents.h> #include <regex.h> @@ -271,6 +272,15 @@ struct KycContext * (no reply, return #MHD_NO). */ unsigned int response_code; + /** + * Output format requested by the client. + */ + enum + { + POF_JSON, + POF_TEXT, + POF_PDF + } format; /** * True if @e h_wire was given. @@ -459,9 +469,53 @@ resume_kyc_with_response (struct KycContext *kc) kc->response_code = not_modified ? MHD_HTTP_NOT_MODIFIED : MHD_HTTP_OK; - kc->response = TALER_MHD_MAKE_JSON_PACK ( - GNUNET_JSON_pack_array_incref ("kyc_data", - kc->kycs_data)); + switch (kc->format) + { + case POF_JSON: + kc->response = TALER_MHD_MAKE_JSON_PACK ( + GNUNET_JSON_pack_array_incref ("kyc_data", + kc->kycs_data)); + break; + case POF_TEXT: + { + enum GNUNET_GenericReturnValue ret; + json_t *obj; + + obj = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_array_incref ("kyc_data", + kc->kycs_data)); + ret = TALER_TEMPLATING_build (kc->connection, + &kc->response_code, + "kyc-text", + kc->mi->settings.id, + NULL, + obj, + &kc->response); + json_decref (obj); + if (GNUNET_SYSERR == ret) + { + /* fail hard */ + kc->suspended = GNUNET_SYSERR; + MHD_resume_connection (kc->connection); + TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */ + return; + } + if (GNUNET_OK == ret) + { + TALER_MHD_add_global_headers (kc->response, + false); + GNUNET_break (MHD_YES == + MHD_add_response_header (kc->response, + MHD_HTTP_HEADER_CONTENT_TYPE, + "text/plain")); + } + } + break; + case POF_PDF: + // not yet implemented + GNUNET_assert (0); + break; + } { char *etag; char *qetag; @@ -1309,6 +1363,49 @@ get_instances_ID_kyc ( &kc->lp_not_etag, kc->have_lp_not_etag); + /* Determine desired output format from Accept header */ + { + const char *mime; + + mime = MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, + MHD_HTTP_HEADER_ACCEPT); + if (NULL == mime) + mime = "application/json"; + if (0 == strcmp (mime, + "*/*")) + mime = "application/json"; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "KYC status requested for format %s\n", + mime); + if (0 == strcmp (mime, + "application/json")) + { + kc->format = POF_JSON; + } + else if (0 == strcmp (mime, + "text/plain")) + { + kc->format = POF_TEXT; + } +#if FUTURE + else if (0 == strcmp (mime, + "application/pdf")) + { + kc->format = POF_PDF; + } +#endif + else + { + GNUNET_break_op (0); + return TALER_MHD_REPLY_JSON_PACK ( + connection, + MHD_HTTP_NOT_ACCEPTABLE, + GNUNET_JSON_pack_string ("hint", + mime)); + } + } + if (! GNUNET_TIME_absolute_is_past (kc->timeout)) { if (kc->have_h_wire) diff --git a/src/backend/taler-merchant-report-generator.c b/src/backend/taler-merchant-report-generator.c @@ -120,6 +120,11 @@ struct ReportActivity */ long response_code; + /** + * Set to true if this is a one-shot report. + */ + bool one_shot; + }; @@ -254,12 +259,22 @@ finish_transmission (struct ReportActivity *ra, struct GNUNET_TIME_Timestamp next_ts; next_ts = GNUNET_TIME_absolute_to_timestamp (ra->next_transmission); - qs = db_plugin->update_report_status (db_plugin->cls, - ra->instance_id, - ra->report_id, - next_ts, - ec, - error_details); + if ( (TALER_EC_NONE == ec) && + (ra->one_shot) ) + { + qs = db_plugin->delete_report (db_plugin->cls, + ra->instance_id, + ra->report_id); + } + else + { + qs = db_plugin->update_report_status (db_plugin->cls, + ra->instance_id, + ra->report_id, + next_ts, + ec, + error_details); + } if (qs < 0) { free_ra (ra); @@ -594,6 +609,8 @@ fetch_and_transmit ( * multiple of the report @a frequency * @param next_transmission when is the next transmission of this report * due + * @param one_shot true if the report should be removed from the + * list after generation instead of being repeated */ static void process_pending_report ( @@ -607,7 +624,8 @@ process_pending_report ( const char *target_address, struct GNUNET_TIME_Relative frequency, struct GNUNET_TIME_Relative frequency_shift, - struct GNUNET_TIME_Absolute next_transmission) + struct GNUNET_TIME_Absolute next_transmission, + bool one_shot) { struct GNUNET_TIME_Absolute *next = cls; struct ReportActivity *ra; @@ -641,6 +659,7 @@ process_pending_report ( ra->report_description = GNUNET_strdup (report_description); ra->target_address = GNUNET_strdup (target_address); ra->mime_type = GNUNET_strdup (mime_type); + ra->one_shot = one_shot; GNUNET_CONTAINER_DLL_insert (ra_head, ra_tail, ra); diff --git a/src/backenddb/Makefile.am b/src/backenddb/Makefile.am @@ -48,6 +48,7 @@ sql_DATA = \ merchant-0029.sql \ merchant-0030.sql \ merchant-0031.sql \ + merchant-0032.sql \ drop.sql BUILT_SOURCES = \ diff --git a/src/backenddb/merchant-0032.sql b/src/backenddb/merchant-0032.sql @@ -0,0 +1,224 @@ +-- +-- This file is part of TALER +-- Copyright (C) 2026 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + +-- @file merchant-0032.sql +-- @brief Add field for one-shot reports in the merchant_reports table +-- @author Christian Grothoff + +BEGIN; + +-- Check patch versioning is in place. +SELECT _v.register_patch('merchant-0032', NULL, NULL); + +SET search_path TO merchant; + +ALTER TABLE merchant_reports + ADD COLUMN one_shot_hidden BOOL DEFAULT(FALSE); + +COMMENT ON COLUMN merchant_reports.one_shot_hidden + IS 'True for reports that are only supposed to trigger once and that should be hidden from the user interface as they are internally generated. Used for alerts, such as those generated when the KYC status changes.'; + + +CREATE FUNCTION random_bytea( + bytea_length INT +) +RETURNS BYTEA + AS $body$ + SELECT decode(string_agg(lpad(to_hex(width_bucket(random(), 0, 1, 256)-1),2,'0') ,''), 'hex') + FROM generate_series(1, $1); + $body$ +LANGUAGE 'sql' +VOLATILE; + +COMMENT ON FUNCTION random_bytea(INT) + IS 'Create BYTEA of the given length and fill it with random bytes'; + + +CREATE FUNCTION base32_crockford(data BYTEA) +RETURNS TEXT +LANGUAGE plpgsql +IMMUTABLE +STRICT +PARALLEL SAFE +AS $$ +DECLARE + alphabet TEXT := '0123456789ABCDEFGHJKMNPQRSTVWXYZ'; + chars TEXT[] := '{}'; + bit_buf BIGINT := 0; -- sliding window of accumulated bits + bit_count INT := 0; -- how many valid bits are in bit_buf + b INT; + i INT; +BEGIN + IF length(data) = 0 THEN + RETURN ''; + END IF; + + -- Process each byte, emitting 5-bit groups as we go + FOR i IN 0 .. length(data) - 1 + LOOP + b := get_byte(data, i); + bit_buf := (bit_buf << 8) | b; + bit_count := bit_count + 8; + + WHILE bit_count >= 5 + LOOP + bit_count := bit_count - 5; + chars := array_append( + chars, + substr(alphabet, ((bit_buf >> bit_count) & 31) + 1, 1) + ); + END LOOP; + END LOOP; + + -- Flush any remaining bits (zero-padded to 5) + IF bit_count > 0 + THEN + chars := array_append( + chars, + substr(alphabet, ((bit_buf << (5 - bit_count)) & 31) + 1, 1) + ); + END IF; + RETURN array_to_string(chars, ''); +END; +$$; +COMMENT ON FUNCTION base32_crockford(BYTEA) + IS 'Encodes binary data using Crockford Base32'; + + +CREATE FUNCTION uri_escape(input TEXT) +RETURNS TEXT +LANGUAGE sql +IMMUTABLE +PARALLEL SAFE +AS $$ +SELECT COALESCE(string_agg( + CASE + WHEN chr(get_byte(b, i)) ~ '[A-Za-z0-9._~-]' + THEN chr(get_byte(b, i)) + ELSE '%' || lpad(upper(to_hex(get_byte(b, i))), 2, '0') + END, + '' +), '') +FROM ( + SELECT convert_to(input, 'UTF8') AS b +) s, +generate_series(0, length(b) - 1) AS i; +$$; +COMMENT ON FUNCTION uri_escape(TEXT) + IS 'Percent-encodes all characters except RFC 3986 unreserved chars: A-Z a-z 0-9 - . _ ~'; + + +CREATE OR REPLACE PROCEDURE merchant_send_kyc_notification( + in_account_serial INT8 + ,in_exchange_url TEXT + ) +LANGUAGE plpgsql +AS $$ +DECLARE + my_instance_serial INT8; + my_report_token BYTEA; + my_h_wire BYTEA; + my_email TEXT; +BEGIN + SELECT merchant_serial + ,h_wire + INTO my_instance_serial + ,my_h_wire + FROM merchant_accounts + WHERE account_serial=in_account_serial; + IF NOT FOUND + THEN + RAISE WARNING 'Account not found, KYC change notification not triggered'; + RETURN; + END IF; + SELECT email + INTO my_email + FROM merchant_instances + WHERE merchant_serial=my_instance_serial; + IF NOT FOUND + THEN + RAISE WARNING 'Instance not found, KYC change notification not triggered'; + RETURN; + END IF; + IF my_email IS NULL + THEN + -- Note: we MAY want to consider sending an SMS instead... + RETURN; + END IF; + + my_report_token = random_bytea(32); + INSERT INTO merchant_reports ( + merchant_serial + ,report_program_section + ,report_description + ,mime_type + ,report_token + ,data_source + ,target_address + ,frequency + ,frequency_shift + ,next_transmission + ,one_shot_hidden + ) VALUES ( + my_instance_serial + ,'email' + ,'automatically triggered KYC alert' + ,'text/plain' + ,my_report_token + ,'/private/kyc?exchange_url=' || uri_escape(in_exchange_url) + || '&h_wire=' || base32_crockford (my_h_wire) + ,my_email + ,0 + ,0 + ,0 + ,TRUE + ); + -- Notify taler-merchant-report-generator + NOTIFY XSSAB8NCBQR1K2VK7H2M6SMY3V5TNJT1C3BW0SN4F2QV0KHR3PRB0; +END $$; + +CREATE FUNCTION merchant_kyc_insert_trigger() +RETURNS trigger +LANGUAGE plpgsql +AS $$ +BEGIN + CALL merchant_send_kyc_notification(NEW.account_serial, + NEW.exchange_url); + RETURN NEW; +END $$; + +CREATE FUNCTION merchant_kyc_update_trigger() +RETURNS trigger +LANGUAGE plpgsql +AS $$ +BEGIN + CALL merchant_send_kyc_notification(NEW.account_serial, + NEW.exchange_url); + RETURN NEW; +END $$; + +-- Whenever KYC status changes, call our trigger to generate a notification +CREATE TRIGGER merchant_kyc_on_insert + AFTER INSERT + ON merchant_kyc + FOR EACH ROW EXECUTE FUNCTION merchant_kyc_insert_trigger(); + +CREATE TRIGGER merchant_kyc_on_update + AFTER UPDATE + ON merchant_kyc + FOR EACH ROW EXECUTE FUNCTION merchant_kyc_update_trigger(); + + +COMMIT; diff --git a/src/backenddb/pg_lookup_reports_pending.c b/src/backenddb/pg_lookup_reports_pending.c @@ -75,6 +75,7 @@ select_pending_reports_cb (void *cls, struct GNUNET_TIME_Relative frequency; struct GNUNET_TIME_Relative frequency_shift; struct GNUNET_TIME_Absolute next_transmission; + bool one_shot; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_string ("merchant_id", &instance_id), @@ -96,6 +97,8 @@ select_pending_reports_cb (void *cls, &frequency_shift), GNUNET_PQ_result_spec_absolute_time ("next_transmission", &next_transmission), + GNUNET_PQ_result_spec_bool ("one_shot_hidden", + &one_shot), GNUNET_PQ_result_spec_end }; @@ -118,7 +121,8 @@ select_pending_reports_cb (void *cls, target_address, frequency, frequency_shift, - next_transmission); + next_transmission, + one_shot); GNUNET_PQ_cleanup_result (rs); } } @@ -155,6 +159,7 @@ TMH_PG_lookup_reports_pending (void *cls, " ,mr.frequency" " ,mr.frequency_shift" " ,mr.next_transmission" + " ,mr.one_shot_hidden" " FROM merchant_reports mr" " JOIN merchant_instances mi" " USING (merchant_serial)" diff --git a/src/backenddb/pg_select_reports.c b/src/backenddb/pg_select_reports.c @@ -132,6 +132,7 @@ TMH_PG_select_reports (void *cls, " USING (merchant_serial)" " WHERE merchant_instances.merchant_id=$1" " AND report_serial > $2" + " AND NOT one_shot_hidden" " ORDER BY report_serial ASC" " LIMIT $3"); PREPARE (pg, @@ -145,6 +146,7 @@ TMH_PG_select_reports (void *cls, " USING (merchant_serial)" " WHERE merchant_instances.merchant_id=$1" " AND report_serial < $2" + " AND NOT one_shot_hidden" " ORDER BY report_serial DESC" " LIMIT $3"); qs = GNUNET_PQ_eval_prepared_multi_select ( diff --git a/src/include/taler/taler_merchantdb_plugin.h b/src/include/taler/taler_merchantdb_plugin.h @@ -1659,6 +1659,8 @@ typedef void * multiple of the report @a frequency * @param next_transmission when is the next transmission of this report * due + * @param one_shot true if the report should be removed from the + * list after generation instead of being repeated */ typedef void (*TALER_MERCHANTDB_ReportsPendingCallback)( @@ -1672,7 +1674,8 @@ typedef void const char *target_address, struct GNUNET_TIME_Relative frequency, struct GNUNET_TIME_Relative frequency_shift, - struct GNUNET_TIME_Absolute next_transmission); + struct GNUNET_TIME_Absolute next_transmission, + bool one_shot); /** diff --git a/src/testing/test_kyc_api.conf b/src/testing/test_kyc_api.conf @@ -23,6 +23,7 @@ HTTP_PORT = 8082 PORT = 8080 SERVE = tcp DB = postgres +BASE_URL = http://localhost:8080/ # This specifies which database the postgres backend uses. [merchantdb-postgres] diff --git a/src/testing/test_merchant_api.conf b/src/testing/test_merchant_api.conf @@ -46,6 +46,7 @@ PORT = 8080 SERVE = tcp DB = postgres STRICT_PROTOCOL_V19 = NO +BASE_URL = http://localhost:8080/ [merchantdb-postgres] CONFIG = postgres:///talercheck diff --git a/src/testing/test_merchant_kyc.sh b/src/testing/test_merchant_kyc.sh @@ -150,9 +150,9 @@ echo "OK" echo -n "Getting information about KYC ..." -STATUS=$(curl -H "Content-Type: application/json" -X GET \ +STATUS=$(curl -H "Accept: application/json" -X GET \ http://localhost:9966/private/kyc \ - -w "%{http_code}" -s -o /dev/null) + -w "%{http_code}" -s -o "$LAST_RESPONSE") if [ "$STATUS" != "200" ] then @@ -161,9 +161,23 @@ fi echo " OK" +echo -n "Getting information about KYC in plaintext ..." + +STATUS=$(curl -H "Accept: text/plain" -X GET \ + http://localhost:9966/private/kyc \ + -w "%{http_code}" -s -o "$LAST_RESPONSE") + +if [ "$STATUS" != "200" ] +then + exit_fail "Expected 200. got: $STATUS" +fi +cat "$LAST_RESPONSE" + +echo " OK" + echo -n "Getting exchange status information ..." -STATUS=$(curl -H "Content-Type: application/json" -X GET \ +STATUS=$(curl -H "Accept: application/json" -X GET \ http://localhost:9966/exchanges \ -w "%{http_code}" -s -o "$LAST_RESPONSE")