aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-11-03 17:11:20 +0100
committerChristian Grothoff <christian@grothoff.org>2024-11-05 10:38:39 +0100
commit6608c8466e74a77de329bf928aa0a43874d4d4ca (patch)
tree11244756d55d0163b79bf030dbb3d2491afe96e6 /src
parente8c170eff8a9e14c48fc90143fdef78c0ca739dd (diff)
work on merchant
Diffstat (limited to 'src')
-rw-r--r--src/include/taler_merchant_testing_lib.h19
-rw-r--r--src/testing/testing_api_cmd_get_transfers.c15
-rw-r--r--src/testing/testing_api_cmd_kyc_get.c12
-rw-r--r--src/testing/testing_api_cmd_post_account.c11
-rw-r--r--src/testing/testing_api_cmd_post_transfers.c34
5 files changed, 48 insertions, 43 deletions
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h
index c18274dc..66da80db 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -169,7 +169,7 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_post_account (
const char *label,
const char *merchant_url,
- const char *payto_uri,
+ struct TALER_FullPayto payto_uri,
const char *credit_facade_url,
const json_t *credit_facade_credentials,
unsigned int http_status);
@@ -1167,7 +1167,7 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_post_transfer (
const char *label,
const struct TALER_BANK_AuthenticationData *auth,
- const char *payto_uri,
+ struct TALER_FullPayto payto_uri,
const char *merchant_url,
const char *credit_amount,
unsigned int http_code,
@@ -1191,7 +1191,7 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_post_transfer2 (
const char *label,
const char *merchant_url,
- const char *payto_uri,
+ struct TALER_FullPayto payto_uri,
const char *credit_amount,
const char *wtid,
const char *exchange_url,
@@ -1225,11 +1225,12 @@ TALER_TESTING_cmd_merchant_post_transfer_set_serial (
* @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_get_transfers (const char *label,
- const char *merchant_url,
- const char *payto_uri,
- unsigned int http_code,
- ...);
+TALER_TESTING_cmd_merchant_get_transfers (
+ const char *label,
+ const char *merchant_url,
+ struct TALER_FullPayto payto_uri,
+ unsigned int http_code,
+ ...);
/**
@@ -1856,7 +1857,7 @@ TALER_TESTING_cmd_checkserver2 (const char *label,
#define TALER_MERCHANT_TESTING_INDEXED_TRAITS(op) \
op (coin_reference, const char) \
op (paths, const char) \
- op (payto_uris, const char) \
+ op (payto_uris, const struct TALER_FullPayto) \
op (h_wires, const struct TALER_MerchantWireHashP) \
op (amounts, const struct TALER_Amount) \
op (urls, const char) \
diff --git a/src/testing/testing_api_cmd_get_transfers.c b/src/testing/testing_api_cmd_get_transfers.c
index b5b05295..659ef1d9 100644
--- a/src/testing/testing_api_cmd_get_transfers.c
+++ b/src/testing/testing_api_cmd_get_transfers.c
@@ -53,7 +53,7 @@ struct GetTransfersState
/**
* payto URI of the merchant to filter by.
*/
- const char *payto_uri;
+ struct TALER_FullPayto payto_uri;
/**
* Expected HTTP response code.
@@ -157,7 +157,7 @@ get_transfers_cb (
transfer->credit_serial);
}
{
- const char *payto_uri;
+ const struct TALER_FullPayto *payto_uri;
if (GNUNET_OK !=
TALER_TESTING_get_trait_credit_payto_uri (transfer_cmd,
@@ -168,13 +168,14 @@ get_transfers_cb (
TALER_TESTING_interpreter_fail (gts->is);
return;
}
- if (0 != strcmp (payto_uri,
- transfer->payto_uri))
+ if (0 !=
+ TALER_full_payto_cmp (*payto_uri,
+ transfer->payto_uri))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Wire transfer payto uri does not match: %s != %s\n",
- payto_uri,
- transfer->payto_uri);
+ payto_uri->full_payto,
+ transfer->payto_uri.full_payto);
TALER_TESTING_interpreter_fail (gts->is);
return;
}
@@ -296,7 +297,7 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_get_transfers (
const char *label,
const char *merchant_url,
- const char *payto_uri,
+ struct TALER_FullPayto payto_uri,
unsigned int http_code,
...)
{
diff --git a/src/testing/testing_api_cmd_kyc_get.c b/src/testing/testing_api_cmd_kyc_get.c
index f58b091d..6fc4d08b 100644
--- a/src/testing/testing_api_cmd_kyc_get.c
+++ b/src/testing/testing_api_cmd_kyc_get.c
@@ -63,7 +63,7 @@ struct KycGetState
* Set to the payto hash of the first account
* for which we failed to pass the KYC check.
*/
- struct TALER_PaytoHashP h_payto;
+ struct TALER_NormalizedPaytoHashP h_payto;
/**
* Access token the user needs to start a KYC process.
@@ -154,15 +154,15 @@ kyc_get_cb (void *cls,
}
for (unsigned int i = 0; i<kr->details.ok.kycs_length; i++)
{
- const char *payto_uri;
+ struct TALER_FullPayto payto_uri;
payto_uri = kr->details.ok.kycs[i].payto_uri;
- if (NULL == payto_uri)
+ if (NULL == payto_uri.full_payto)
{
continue;
}
- TALER_payto_hash (payto_uri,
- &cs->h_payto);
+ TALER_full_payto_normalize_and_hash (payto_uri,
+ &cs->h_payto);
if (! kr->details.ok.kycs[i].no_access_token)
{
cs->access_token
@@ -263,7 +263,7 @@ kyc_get_traits (void *cls,
/* Must be first, skipped if we have no token! */
TALER_TESTING_make_trait_account_access_token (
&cs->access_token),
- TALER_TESTING_make_trait_h_payto (
+ TALER_TESTING_make_trait_h_normalized_payto (
&cs->h_payto),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_api_cmd_post_account.c b/src/testing/testing_api_cmd_post_account.c
index 057ab060..85734c7a 100644
--- a/src/testing/testing_api_cmd_post_account.c
+++ b/src/testing/testing_api_cmd_post_account.c
@@ -57,7 +57,7 @@ struct PostAccountState
/**
* RFC 8905 URI for the account to create.
*/
- char *payto_uri;
+ struct TALER_FullPayto payto_uri;
/**
* Credit facade URL for the account to create.
@@ -176,7 +176,7 @@ post_account_traits (void *cls,
&pps->h_wire),
TALER_TESTING_make_trait_payto_uris (
0,
- pps->payto_uri),
+ &pps->payto_uri),
TALER_TESTING_make_trait_merchant_base_url (
pps->merchant_url),
TALER_TESTING_trait_end (),
@@ -208,7 +208,7 @@ post_account_cleanup (void *cls,
"POST /account operation did not complete\n");
TALER_MERCHANT_accounts_post_cancel (pas->aph);
}
- GNUNET_free (pas->payto_uri);
+ GNUNET_free (pas->payto_uri.full_payto);
GNUNET_free (pas->credit_facade_url);
json_decref (pas->credit_facade_credentials);
GNUNET_free (pas);
@@ -219,7 +219,7 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_post_account (
const char *label,
const char *merchant_url,
- const char *payto_uri,
+ struct TALER_FullPayto payto_uri,
const char *credit_facade_url,
const json_t *credit_facade_credentials,
unsigned int http_status)
@@ -228,7 +228,8 @@ TALER_TESTING_cmd_merchant_post_account (
pas = GNUNET_new (struct PostAccountState);
pas->merchant_url = merchant_url;
- pas->payto_uri = GNUNET_strdup (payto_uri);
+ pas->payto_uri.full_payto
+ = GNUNET_strdup (payto_uri.full_payto);
if (NULL != credit_facade_url)
pas->credit_facade_url = GNUNET_strdup (credit_facade_url);
if (NULL != credit_facade_credentials)
diff --git a/src/testing/testing_api_cmd_post_transfers.c b/src/testing/testing_api_cmd_post_transfers.c
index c194bd1e..eb247c55 100644
--- a/src/testing/testing_api_cmd_post_transfers.c
+++ b/src/testing/testing_api_cmd_post_transfers.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2020, 2023 Taler Systems SA
+ Copyright (C) 2020, 2023, 2024 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
@@ -62,17 +62,17 @@ struct PostTransfersState
/**
* Credit account of the merchant.
*/
- char *credit_account;
+ struct TALER_FullPayto credit_account;
/**
* Payto URI to filter on.
*/
- const char *payto_uri;
+ struct TALER_FullPayto payto_uri;
/**
* Set to the hash of the @e payto_uri.
*/
- struct TALER_PaytoHashP h_payto;
+ struct TALER_FullPaytoHashP h_payto;
/**
* Authentication details to authenticate to the bank.
@@ -176,8 +176,8 @@ post_transfers_traits (void *cls,
struct PostTransfersState *pts = cls;
struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_wtid (&pts->wtid),
- TALER_TESTING_make_trait_credit_payto_uri (pts->credit_account),
- TALER_TESTING_make_trait_h_payto (&pts->h_payto),
+ TALER_TESTING_make_trait_credit_payto_uri (&pts->credit_account),
+ TALER_TESTING_make_trait_h_full_payto (&pts->h_payto),
TALER_TESTING_make_trait_amount (&pts->credit_amount),
TALER_TESTING_make_trait_exchange_url (pts->exchange_url),
TALER_TESTING_make_trait_bank_row (&pts->serial),
@@ -257,18 +257,19 @@ debit_cb (
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Bank reports transfer of %s to %s\n",
TALER_amount2s (&details->amount),
- details->credit_account_uri);
+ details->credit_account_uri.full_payto);
if (0 != TALER_amount_cmp (&pts->credit_amount,
&details->amount))
continue;
pts->wtid = details->wtid;
- pts->credit_account = GNUNET_strdup (details->credit_account_uri);
+ pts->credit_account.full_payto
+ = GNUNET_strdup (details->credit_account_uri.full_payto);
pts->exchange_url = GNUNET_strdup (details->exchange_base_url);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Bank transfer found, checking with merchant backend at %s about %s from %s to %s with %s\n",
pts->merchant_url,
TALER_amount2s (&pts->credit_amount),
- pts->payto_uri,
+ pts->payto_uri.full_payto,
pts->exchange_url,
TALER_B2S (&pts->wtid));
pts->pth = TALER_MERCHANT_transfers_post (
@@ -311,7 +312,7 @@ post_transfers_run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Looking for transfer of %s from %s at bank\n",
TALER_amount2s (&pts->credit_amount),
- pts->payto_uri);
+ pts->payto_uri.full_payto);
pts->dhh = TALER_BANK_debit_history (TALER_TESTING_interpreter_get_context (
is),
&pts->auth,
@@ -353,7 +354,7 @@ post_transfers_cleanup (void *cls,
pts->deposits_length,
0);
GNUNET_free (pts->exchange_url);
- GNUNET_free (pts->credit_account);
+ GNUNET_free (pts->credit_account.full_payto);
GNUNET_free (pts);
}
@@ -362,7 +363,7 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_post_transfer (
const char *label,
const struct TALER_BANK_AuthenticationData *auth,
- const char *payto_uri,
+ struct TALER_FullPayto payto_uri,
const char *merchant_url,
const char *credit_amount,
unsigned int http_code,
@@ -374,8 +375,8 @@ TALER_TESTING_cmd_merchant_post_transfer (
pts->merchant_url = merchant_url;
pts->auth = *auth;
pts->payto_uri = payto_uri;
- TALER_payto_hash (payto_uri,
- &pts->h_payto);
+ TALER_full_payto_hash (payto_uri,
+ &pts->h_payto);
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (credit_amount,
&pts->credit_amount));
@@ -411,7 +412,7 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_post_transfer2 (
const char *label,
const char *merchant_url,
- const char *payto_uri,
+ struct TALER_FullPayto payto_uri,
const char *credit_amount,
const char *wtid,
const char *exchange_url,
@@ -421,7 +422,8 @@ TALER_TESTING_cmd_merchant_post_transfer2 (
pts = GNUNET_new (struct PostTransfersState);
pts->merchant_url = merchant_url;
- pts->credit_account = GNUNET_strdup (payto_uri);
+ pts->credit_account.full_payto
+ = GNUNET_strdup (payto_uri.full_payto);
pts->exchange_url = GNUNET_strdup (exchange_url);
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (credit_amount,