diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-06-15 19:57:19 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-06-15 19:57:19 +0200 |
commit | 629448f16c69a90cc84c72f131596aac4aea45e1 (patch) | |
tree | 4a2a0dc2b45ef8f22f920eab6697c68abd9d9fcc | |
parent | 613b9b7296ff8f7a2c406d02b0de5319b0da3953 (diff) |
-spelling
-rw-r--r-- | src/backend/taler-merchant-httpd_post-orders-ID-pay.c | 118 | ||||
-rw-r--r-- | src/include/taler_merchant_service.h | 7 |
2 files changed, 67 insertions, 58 deletions
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c index cbfd8fdd..fe18377a 100644 --- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c +++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c @@ -1511,8 +1511,10 @@ build_token_sigs (struct PayContext *pc) for (unsigned int i = 0; i < pc->output_tokens_len; i++) { json_array_append_new (token_sigs, GNUNET_JSON_PACK ( - GNUNET_JSON_pack_blinded_sig ("blind_sig", pc->output_tokens[i].sig.signature) - )); + GNUNET_JSON_pack_blinded_sig ("blind_sig", pc-> + output_tokens[i].sig. + signature) + )); } return token_sigs; @@ -2059,7 +2061,7 @@ phase_execute_pay_transaction (struct PayContext *pc) enum GNUNET_DB_QueryStatus qs; - /* Insert used token into database, the unique contraint will + /* Insert used token into database, the unique constraint will case an error if this token was used before. */ qs = TMH_db->insert_spent_token (TMH_db->cls, &pc->h_contract_terms, @@ -2321,11 +2323,11 @@ find_valid_input_tokens (struct PayContext *pc, GNUNET_TIME_timestamp2s (key->valid_after)); GNUNET_break (0); pay_end (pc, - TALER_MHD_reply_with_error (pc->connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_GENERIC_PARAMETER_MALFORMED, - "'tokens' array is missing " - "required input token")); + TALER_MHD_reply_with_error (pc->connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "'tokens' array is missing " + "required input token")); return GNUNET_NO; } @@ -2341,10 +2343,10 @@ find_valid_input_tokens (struct PayContext *pc, GNUNET_TIME_timestamp2s (key->valid_after)); GNUNET_break (0); pay_end (pc, - TALER_MHD_reply_with_error (pc->connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_MERCHANT_POST_ORDERS_ID_PAY_TOKEN_ISSUE_SIG_INVALID, - NULL)); + TALER_MHD_reply_with_error (pc->connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_MERCHANT_POST_ORDERS_ID_PAY_TOKEN_ISSUE_SIG_INVALID, + NULL)); return GNUNET_NO; } @@ -2359,10 +2361,10 @@ find_valid_input_tokens (struct PayContext *pc, GNUNET_TIME_timestamp2s (key->valid_after)); GNUNET_break (0); pay_end (pc, - TALER_MHD_reply_with_error (pc->connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_MERCHANT_POST_ORDERS_ID_PAY_TOKEN_USE_SIG_INVALID, - NULL)); + TALER_MHD_reply_with_error (pc->connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_MERCHANT_POST_ORDERS_ID_PAY_TOKEN_USE_SIG_INVALID, + NULL)); return GNUNET_NO; } @@ -2379,10 +2381,10 @@ find_valid_input_tokens (struct PayContext *pc, num_validated); GNUNET_break (0); pay_end (pc, - TALER_MHD_reply_with_error (pc->connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_MERCHANT_POST_ORDERS_ID_PAY_TOKEN_COUNT_MISMATCH, - NULL)); + TALER_MHD_reply_with_error (pc->connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_MERCHANT_POST_ORDERS_ID_PAY_TOKEN_COUNT_MISMATCH, + NULL)); return GNUNET_NO; } @@ -2404,7 +2406,8 @@ sign_token_envelopes (struct PayContext *pc, { unsigned int pos = index + j; - if (pos > pc->token_envelopes_cnt || pos > pc->output_tokens_len) { + if (pos > pc->token_envelopes_cnt || pos > pc->output_tokens_len) + { GNUNET_assert (0); /* this should not happen */ return GNUNET_NO; } @@ -2413,7 +2416,7 @@ sign_token_envelopes (struct PayContext *pc, if (NULL == env) { - if (!critical) + if (! critical) { continue; } @@ -2421,11 +2424,11 @@ sign_token_envelopes (struct PayContext *pc, /* critical token families require a token envelope. */ GNUNET_break (0); pay_end (pc, - TALER_MHD_reply_with_error (pc->connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_GENERIC_PARAMETER_MALFORMED, - "Token envelope for critical " - "token family missing")); + TALER_MHD_reply_with_error (pc->connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "Token envelope for critical " + "token family missing")); return GNUNET_NO; } @@ -2450,10 +2453,10 @@ sign_token_envelopes (struct PayContext *pc, num_signed); GNUNET_break (0); pay_end (pc, - TALER_MHD_reply_with_error (pc->connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_MERCHANT_POST_ORDERS_ID_PAY_TOKEN_ENVELOPE_COUNT_MISMATCH, - NULL)); + TALER_MHD_reply_with_error (pc->connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_MERCHANT_POST_ORDERS_ID_PAY_TOKEN_ENVELOPE_COUNT_MISMATCH, + NULL)); return GNUNET_NO; } @@ -2486,10 +2489,10 @@ phase_validate_tokens (struct PayContext *pc) pc->order_id); GNUNET_break (0); pay_end (pc, - TALER_MHD_reply_with_error (pc->connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_MERCHANT_POST_ORDERS_ID_PAY_CHOICE_INDEX_MISSING, - NULL)); + TALER_MHD_reply_with_error (pc->connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_MERCHANT_POST_ORDERS_ID_PAY_CHOICE_INDEX_MISSING, + NULL)); return; } @@ -2503,10 +2506,10 @@ phase_validate_tokens (struct PayContext *pc) pc->choice_index); GNUNET_break (0); pay_end (pc, - TALER_MHD_reply_with_error (pc->connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_MERCHANT_POST_ORDERS_ID_PAY_CHOICE_INDEX_OUT_OF_BOUNDS, - NULL)); + TALER_MHD_reply_with_error (pc->connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_MERCHANT_POST_ORDERS_ID_PAY_CHOICE_INDEX_OUT_OF_BOUNDS, + NULL)); return; } @@ -2528,8 +2531,10 @@ phase_validate_tokens (struct PayContext *pc) } /* TODO: Replace this with ordering convention. */ - if (GNUNET_OK != TMH_find_token_family_key (input.details.token.token_family_slug, - input.details.token.valid_after, + if (GNUNET_OK != TMH_find_token_family_key (input.details.token. + token_family_slug, + input.details.token. + valid_after, pc->token_families, pc->token_families_len, &family, @@ -2594,8 +2599,10 @@ phase_validate_tokens (struct PayContext *pc) continue; } - if (GNUNET_OK != TMH_find_token_family_key (output.details.token.token_family_slug, - output.details.token.valid_after, + if (GNUNET_OK != TMH_find_token_family_key (output.details.token. + token_family_slug, + output.details.token. + valid_after, pc->token_families, pc->token_families_len, &family, @@ -2637,7 +2644,7 @@ phase_validate_tokens (struct PayContext *pc) &details.priv, /* TODO: Use critical field stored in database here instead. */ details.token_family.kind == - TALER_MERCHANTDB_TFK_Subscription, + TALER_MERCHANTDB_TFK_Subscription, i, output.details.token.count)) { @@ -2731,6 +2738,7 @@ input_tokens_paid_check ( } } + /** * Handle case where contract was already paid. Either decides * the payment is idempotent, or refunds the excess payment. @@ -2756,14 +2764,14 @@ phase_contract_paid (struct PayContext *pc) { GNUNET_break (0); pay_end (pc, - TALER_MHD_reply_with_error (pc->connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_FETCH_FAILED, - "lookup_deposits_by_order")); + TALER_MHD_reply_with_error (pc->connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_FETCH_FAILED, + "lookup_deposits_by_order")); return; } } - for (size_t i = 0; i<pc->coins_cnt && !unmatched; i++) + for (size_t i = 0; i<pc->coins_cnt && ! unmatched; i++) { struct DepositConfirmation *dci = &pc->dc[i]; @@ -2784,14 +2792,14 @@ phase_contract_paid (struct PayContext *pc) { GNUNET_break (0); pay_end (pc, - TALER_MHD_reply_with_error (pc->connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_FETCH_FAILED, - "lookup_spent_tokens_by_order")); + TALER_MHD_reply_with_error (pc->connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_FETCH_FAILED, + "lookup_spent_tokens_by_order")); return; } } - for (size_t i = 0; i<pc->tokens_cnt && !unmatched; i++) + for (size_t i = 0; i<pc->tokens_cnt && ! unmatched; i++) { struct TokenUseConfirmation *tuc = &pc->tokens[i]; @@ -3117,7 +3125,7 @@ phase_parse_wallet_data (struct PayContext *pc) const json_t *tokens_evs; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_mark_optional( + GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_int64 ("choice_index", &pc->choice_index), NULL), diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 3c660742..63be079a 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -3343,7 +3343,7 @@ struct TALER_MERCHANT_UsedToken /** * Information the frontend forwards to the backend for an output token. The * blinded issue signature is set once the request return with an HTTP_OK. - * This does not inlcude the blinding secret or any other private information. + * This does not include the blinding secret or any other private information. */ struct TALER_MERCHANT_OutputToken { @@ -3481,7 +3481,7 @@ struct TALER_MERCHANT_UseToken * @param merchant_url base URL of the merchant * @param session_id session to pay for, or NULL for none * @param h_contract hash of the contact of the merchant with the customer - * @param choice_index index of the selected contract coice, -1 for none + * @param choice_index index of the selected contract choice, -1 for none * @param amount total value of the contract to be paid to the merchant * @param max_fee maximum fee covered by the merchant (according to the contract) * @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests) @@ -3522,7 +3522,8 @@ TALER_MERCHANT_order_pay ( unsigned int num_tokens, const struct TALER_MERCHANT_UseToken tokens[static num_tokens], unsigned int num_output_tokens, - const struct TALER_MERCHANT_OutputToken output_tokens[static num_output_tokens], + const struct TALER_MERCHANT_OutputToken output_tokens[static num_output_tokens + ], TALER_MERCHANT_OrderPayCallback pay_cb, void *pay_cb_cls); |