merchant

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

commit a2ba9b3b5d39a6f74e1514a675065c1d3d7e6280
parent 10c8c40738452931d8eece0705cb562b0bd30d72
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon,  9 Dec 2024 12:26:14 +0100

rename fest: remove 'P' suffixes from non-packable structures

Diffstat:
Msrc/backend/taler-merchant-httpd_contract.h | 2+-
Msrc/backend/taler-merchant-httpd_post-orders-ID-pay.c | 8++++----
Msrc/backend/taler-merchant-httpd_private-post-orders.c | 31++++++++++++++++---------------
Msrc/backenddb/pg_insert_issued_token.c | 2+-
Msrc/backenddb/pg_insert_issued_token.h | 2+-
Msrc/backenddb/pg_insert_spent_token.c | 2+-
Msrc/backenddb/pg_insert_spent_token.h | 2+-
Msrc/backenddb/pg_insert_token_family_key.c | 4++--
Msrc/backenddb/pg_insert_token_family_key.h | 4++--
Msrc/backenddb/pg_lookup_spent_tokens_by_order.c | 2+-
Msrc/include/taler_merchant_service.h | 16++++++++--------
Msrc/include/taler_merchant_testing_lib.h | 4++--
Msrc/include/taler_merchantdb_plugin.h | 16++++++++--------
Msrc/testing/testing_api_cmd_pay_order.c | 6+++---
14 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_contract.h b/src/backend/taler-merchant-httpd_contract.h @@ -261,7 +261,7 @@ struct TALER_MerchantContractTokenFamilyKey /** * Public key. */ - struct TALER_TokenIssuePublicKeyP pub; + struct TALER_TokenIssuePublicKey pub; /** * Tokens signed by this key will be valid after this time. diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c @@ -258,7 +258,7 @@ struct TokenUseConfirmation /** * Unblinded signature on the token use public key done by the merchant. */ - struct TALER_TokenIssueSignatureP unblinded_sig; + struct TALER_TokenIssueSignature unblinded_sig; /** * Hash of the token issue public key associated with this token. @@ -297,7 +297,7 @@ struct SignedOutputToken /** * Blinded token use public keys waiting to be signed. */ - struct TALER_TokenIssueBlindSignatureP sig; + struct TALER_BlindedTokenIssueSignature sig; /** * Hash of token issue public key. @@ -2553,7 +2553,7 @@ find_valid_input_tokens (struct PayContext *pc, static enum GNUNET_GenericReturnValue sign_token_envelopes (struct PayContext *pc, struct TALER_MerchantContractTokenFamilyKey *key, - struct TALER_TokenIssuePrivateKeyP *priv, + struct TALER_TokenIssuePrivateKey *priv, bool critical, unsigned int index, unsigned int expected_num) @@ -2874,7 +2874,7 @@ input_tokens_paid_check ( const struct TALER_TokenIssuePublicKeyHashP *h_issue_pub, const struct TALER_TokenUsePublicKeyP *use_pub, const struct TALER_TokenUseSignatureP *use_sig, - const struct TALER_TokenIssueSignatureP *issue_sig) + const struct TALER_TokenIssueSignature *issue_sig) { struct PayContext *pc = cls; diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c @@ -1341,7 +1341,6 @@ set_token_family (struct OrderContext *oc, break; } } - if (NULL != family) { for (unsigned int i = 0; i<family->keys_len; i++) @@ -1366,6 +1365,8 @@ set_token_family (struct OrderContext *oc, min_valid_after, max_valid_after, &key_details); + /* slug is not needed */ + GNUNET_free (key_details.token_family.slug); if (qs <= 0) { @@ -1375,10 +1376,12 @@ set_token_family (struct OrderContext *oc, switch (qs) { case GNUNET_DB_STATUS_HARD_ERROR: + GNUNET_break (0); http_status = MHD_HTTP_INTERNAL_SERVER_ERROR; ec = TALER_EC_GENERIC_DB_FETCH_FAILED; break; case GNUNET_DB_STATUS_SOFT_ERROR: + GNUNET_break (0); http_status = MHD_HTTP_INTERNAL_SERVER_ERROR; ec = TALER_EC_GENERIC_DB_SOFT_FAILURE; break; @@ -1393,11 +1396,10 @@ set_token_family (struct OrderContext *oc, /* case listed to make compilers happy */ GNUNET_assert (0); } - GNUNET_break (0); reply_with_error (oc, http_status, ec, - "token_family_slug"); + slug); return GNUNET_SYSERR; } @@ -1405,27 +1407,26 @@ set_token_family (struct OrderContext *oc, struct GNUNET_TIME_Timestamp now = GNUNET_TIME_timestamp_get (); /* Verify that the token family is valid right now. */ - if (GNUNET_TIME_timestamp_cmp (key_details.token_family.valid_after, >, now) - || - GNUNET_TIME_timestamp_cmp (key_details.token_family.valid_before, <=, - now) - ) + if (GNUNET_TIME_timestamp_cmp (key_details.token_family.valid_after, + >, + now) || + GNUNET_TIME_timestamp_cmp (key_details.token_family.valid_before, + <=, + now)) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Token family expired or not yet valid\n"); + "Token family %s expired or not yet valid\n", + slug); reply_with_error (oc, /* TODO: HTTP Status Code GONE would be more elegant, but that is already used to indicate that a product is out of stock. */ MHD_HTTP_CONFLICT, TALER_EC_MERCHANT_PRIVATE_POST_ORDERS_TOKEN_FAMILY_NOT_VALID, - key_details.token_family.slug); + slug); return GNUNET_SYSERR; } } - /* slug is not needed */ - GNUNET_free (key_details.token_family.slug); - { struct TALER_MerchantContractTokenFamilyKey key; @@ -1500,10 +1501,10 @@ set_token_family (struct OrderContext *oc, GNUNET_CRYPTO_BSA_RSA, 4096); { - struct TALER_TokenIssuePublicKeyP token_pub = { + struct TALER_TokenIssuePublicKey token_pub = { .public_key = pub, }; - struct TALER_TokenIssuePrivateKeyP token_priv = { + struct TALER_TokenIssuePrivateKey token_priv = { .private_key = priv, }; diff --git a/src/backenddb/pg_insert_issued_token.c b/src/backenddb/pg_insert_issued_token.c @@ -29,7 +29,7 @@ enum GNUNET_DB_QueryStatus TMH_PG_insert_issued_token (void *cls, const struct TALER_PrivateContractHashP *h_contract_terms, const struct TALER_TokenIssuePublicKeyHashP *h_issue_pub, - const struct TALER_TokenIssueBlindSignatureP *blind_sig) + const struct TALER_BlindedTokenIssueSignature *blind_sig) { struct PostgresClosure *pg = cls; diff --git a/src/backenddb/pg_insert_issued_token.h b/src/backenddb/pg_insert_issued_token.h @@ -37,6 +37,6 @@ enum GNUNET_DB_QueryStatus TMH_PG_insert_issued_token (void *cls, const struct TALER_PrivateContractHashP *h_contract_terms, const struct TALER_TokenIssuePublicKeyHashP *h_issue_pub, - const struct TALER_TokenIssueBlindSignatureP *blind_sig); + const struct TALER_BlindedTokenIssueSignature *blind_sig); #endif diff --git a/src/backenddb/pg_insert_spent_token.c b/src/backenddb/pg_insert_spent_token.c @@ -33,7 +33,7 @@ TMH_PG_insert_spent_token ( const struct TALER_TokenIssuePublicKeyHashP *h_issue_pub, const struct TALER_TokenUsePublicKeyP *use_pub, const struct TALER_TokenUseSignatureP *use_sig, - const struct TALER_TokenIssueSignatureP *issue_sig) + const struct TALER_TokenIssueSignature *issue_sig) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { diff --git a/src/backenddb/pg_insert_spent_token.h b/src/backenddb/pg_insert_spent_token.h @@ -42,6 +42,6 @@ TMH_PG_insert_spent_token ( const struct TALER_TokenIssuePublicKeyHashP *h_issue_pub, const struct TALER_TokenUsePublicKeyP *use_pub, const struct TALER_TokenUseSignatureP *use_sig, - const struct TALER_TokenIssueSignatureP *issue_sig); + const struct TALER_TokenIssueSignature *issue_sig); #endif diff --git a/src/backenddb/pg_insert_token_family_key.c b/src/backenddb/pg_insert_token_family_key.c @@ -33,8 +33,8 @@ TMH_PG_insert_token_family_key ( void *cls, const char *merchant_id, const char *token_family_slug, - const struct TALER_TokenIssuePublicKeyP *pub, - const struct TALER_TokenIssuePrivateKeyP *priv, + const struct TALER_TokenIssuePublicKey *pub, + const struct TALER_TokenIssuePrivateKey *priv, const struct GNUNET_TIME_Timestamp valid_after, const struct GNUNET_TIME_Timestamp valid_before) { diff --git a/src/backenddb/pg_insert_token_family_key.h b/src/backenddb/pg_insert_token_family_key.h @@ -43,8 +43,8 @@ TMH_PG_insert_token_family_key ( void *cls, const char *merchant_id, const char *token_family_slug, - const struct TALER_TokenIssuePublicKeyP *pub, - const struct TALER_TokenIssuePrivateKeyP *priv, + const struct TALER_TokenIssuePublicKey *pub, + const struct TALER_TokenIssuePrivateKey *priv, const struct GNUNET_TIME_Timestamp valid_after, const struct GNUNET_TIME_Timestamp valid_before); diff --git a/src/backenddb/pg_lookup_spent_tokens_by_order.c b/src/backenddb/pg_lookup_spent_tokens_by_order.c @@ -76,7 +76,7 @@ lookup_spent_tokens_by_order_cb (void *cls, struct TALER_TokenIssuePublicKeyHashP h_issue_pub; struct TALER_TokenUsePublicKeyP use_pub; struct TALER_TokenUseSignatureP use_sig; - struct TALER_TokenIssueSignatureP issue_sig; + struct TALER_TokenIssueSignature issue_sig; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_uint64 ("spent_token_serial", &spent_token_serial), diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h @@ -3167,17 +3167,17 @@ struct TALER_MERCHANT_PrivateTokenDetails /** * Token issue public key. */ - struct TALER_TokenIssuePublicKeyP issue_pub; + struct TALER_TokenIssuePublicKey issue_pub; /** * Unblinded token issue signature made by the merchant. */ - struct TALER_TokenIssueSignatureP issue_sig; + struct TALER_TokenIssueSignature issue_sig; /** * Blinded token issue signature made by the merchant. */ - struct TALER_TokenIssueBlindSignatureP blinded_sig; + struct TALER_BlindedTokenIssueSignature blinded_sig; }; @@ -3343,12 +3343,12 @@ struct TALER_MERCHANT_UsedToken /** * Unblinded signature made by the token issue public key of the merchant. */ - struct TALER_TokenIssueSignatureP ub_sig; + struct TALER_TokenIssueSignature ub_sig; /** * Token issue public key associated with this token. */ - struct TALER_TokenIssuePublicKeyP issue_pub; + struct TALER_TokenIssuePublicKey issue_pub; }; @@ -3369,7 +3369,7 @@ struct TALER_MERCHANT_OutputToken /** * Blinded issue signature made by the merchant. */ - struct TALER_TokenIssueBlindSignatureP blinded_sig; + struct TALER_BlindedTokenIssueSignature blinded_sig; }; @@ -3475,12 +3475,12 @@ struct TALER_MERCHANT_UseToken /** * Unblinded signature made by the token issue public key of the merchant. */ - struct TALER_TokenIssueSignatureP ub_sig; + struct TALER_TokenIssueSignature ub_sig; /** * Token issue public key associated with this token. */ - struct TALER_TokenIssuePublicKeyP issue_pub; + struct TALER_TokenIssuePublicKey issue_pub; }; diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h @@ -1867,8 +1867,8 @@ TALER_TESTING_cmd_checkserver2 (const char *label, op (http_body_size, const size_t) \ op (planchet_secrets, const struct TALER_PlanchetMasterSecretP) \ op (token_priv, const struct TALER_TokenUsePrivateKeyP) \ - op (token_issue_sig, const struct TALER_TokenIssueSignatureP) \ - op (token_issue_pub, const struct TALER_TokenIssuePublicKeyP) + op (token_issue_sig, const struct TALER_TokenIssueSignature) \ + op (token_issue_pub, const struct TALER_TokenIssuePublicKey) TALER_MERCHANT_TESTING_SIMPLE_TRAITS (TALER_TESTING_MAKE_DECL_SIMPLE_TRAIT) diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h @@ -1264,12 +1264,12 @@ struct TALER_MERCHANTDB_TokenFamilyKeyDetails /** * Token family public key. */ - struct TALER_TokenIssuePublicKeyP pub; + struct TALER_TokenIssuePublicKey pub; /** * Token family private key. */ - struct TALER_TokenIssuePrivateKeyP priv; + struct TALER_TokenIssuePrivateKey priv; /** * Details about the token family this key belongs to. @@ -1295,7 +1295,7 @@ struct TALER_MERCHANTDB_SpentTokenDetails /** * Blind signature for the spent token to prove validity of it. */ - struct TALER_TokenIssueBlindSignatureP blind_sig; + struct TALER_BlindedTokenIssueSignature blind_sig; }; @@ -1318,7 +1318,7 @@ typedef void const struct TALER_TokenIssuePublicKeyHashP *h_issue_pub, const struct TALER_TokenUsePublicKeyP *use_pub, const struct TALER_TokenUseSignatureP *use_sig, - const struct TALER_TokenIssueSignatureP *issue_sig); + const struct TALER_TokenIssueSignature *issue_sig); /** * Handle to interact with the database. @@ -2722,7 +2722,7 @@ struct TALER_MERCHANTDB_Plugin const struct TALER_TokenIssuePublicKeyHashP *h_issue_pub, const struct TALER_TokenUsePublicKeyP *use_pub, const struct TALER_TokenUseSignatureP *use_sig, - const struct TALER_TokenIssueSignatureP *issue_sig); + const struct TALER_TokenIssueSignature *issue_sig); /** @@ -2739,7 +2739,7 @@ struct TALER_MERCHANTDB_Plugin void *cls, const struct TALER_PrivateContractHashP *h_contract_terms, const struct TALER_TokenIssuePublicKeyHashP *h_issue_pub, - const struct TALER_TokenIssueBlindSignatureP *blind_sig); + const struct TALER_BlindedTokenIssueSignature *blind_sig); /** @@ -3772,8 +3772,8 @@ struct TALER_MERCHANTDB_Plugin void *cls, const char *merchant_id, const char *token_family_slug, - const struct TALER_TokenIssuePublicKeyP *pub, - const struct TALER_TokenIssuePrivateKeyP *priv, + const struct TALER_TokenIssuePublicKey *pub, + const struct TALER_TokenIssuePrivateKey *priv, struct GNUNET_TIME_Timestamp valid_after, struct GNUNET_TIME_Timestamp valid_before); diff --git a/src/testing/testing_api_cmd_pay_order.c b/src/testing/testing_api_cmd_pay_order.c @@ -152,7 +152,7 @@ static enum GNUNET_GenericReturnValue find_token_public_key (const json_t *token_families, const char *slug, struct GNUNET_TIME_Timestamp valid_after, - struct TALER_TokenIssuePublicKeyP *pub) + struct TALER_TokenIssuePublicKey *pub) { const json_t *tf = json_object_get (token_families, slug); const json_t *keys; @@ -443,8 +443,8 @@ build_tokens (struct TALER_MERCHANT_UseToken **tokens, { const struct TALER_TokenUsePrivateKeyP *token_priv; - const struct TALER_TokenIssueSignatureP *issue_sig; - const struct TALER_TokenIssuePublicKeyP *issue_pub; + const struct TALER_TokenIssueSignature *issue_sig; + const struct TALER_TokenIssuePublicKey *issue_pub; GNUNET_assert (GNUNET_OK == TALER_TESTING_get_trait_token_priv (pay_cmd,