merchant

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

commit 23c362cf59f8580556d556d0740c93ef420c6b51
parent 35678332df0f2bd45491bc062f06cdc7a4d3b86a
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 27 Feb 2025 12:37:04 +0100

-fixmes for Bohdan

Diffstat:
Msrc/backend/taler-merchant-httpd_post-orders-ID-pay.c | 33++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 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 @@ -116,6 +116,8 @@ enum PayPhase */ PP_PAY_TRANSACTION, + // FIXME: new (optional) phase for DONAU interaction here. + /** * Notify other processes about successful payment. */ @@ -1689,6 +1691,7 @@ phase_success_response (struct PayContext *pc) token_sigs = (0 >= pc->validate_tokens.output_tokens_len) ? NULL : build_token_sigs (pc); + // FIXME: add signatures obtained from donau to response pay_end (pc, TALER_MHD_REPLY_JSON_PACK ( pc->connection, @@ -2390,6 +2393,9 @@ phase_execute_pay_transaction (struct PayContext *pc) } } + // FIXME: insert donau blinded inputs (into DB here!), + // idempotency: if already exists, no problem! + TMH_notify_order_change (hc->instance, TMH_OSF_CLAIMED | TMH_OSF_PAID, pc->check_contract.contract_terms->timestamp, @@ -2443,6 +2449,9 @@ phase_execute_pay_transaction (struct PayContext *pc) return; } } + // FIXME: if we have donation receipts, do NEW phase + // DONAU interaction here, otherwise skip DONAU phase + // and move to payment notification pc->phase = PP_PAYMENT_NOTIFICATION; } @@ -2786,12 +2795,15 @@ phase_validate_tokens (struct PayContext *pc) const struct TALER_MERCHANT_ContractTokenFamily *family; struct TALER_MERCHANT_ContractTokenFamilyKey *key; + // FIXME: check donau outputs are good choices + // (allowed donau, total amount below max, correct year, ...) + // change 'if' to switch... if (output->type != TALER_MERCHANT_CONTRACT_OUTPUT_TYPE_TOKEN) { /* only validate outputs of type tokens (for now) */ continue; } - + // FIXME: move this into a function for the switch case on token... family = find_family (pc, output->details.token.token_family_slug); if (NULL == family) @@ -3350,6 +3362,12 @@ phase_parse_wallet_data (struct PayContext *pc) GNUNET_JSON_spec_array_const ("tokens_evs", &tokens_evs), NULL), + // FIXME: extend spec for wallet to submit + // - URL of selected donau + // - year + // - BUDIs with blinded donation receipts (donau-key-hash, blinded value) + // + check in later phase (once we have the contract) + // that the selected donau was offered and the BUDIs are below the allowed amount GNUNET_JSON_spec_end () }; @@ -3823,24 +3841,25 @@ TMH_post_orders_ID_pay (const struct TMH_RequestHandler *rh, case PP_CHECK_CONTRACT: phase_check_contract (pc); break; - case PP_CONTRACT_PAID: - phase_contract_paid (pc); - break; case PP_VALIDATE_TOKENS: phase_validate_tokens (pc); break; + case PP_CONTRACT_PAID: + phase_contract_paid (pc); + break; case PP_PAY_TRANSACTION: phase_execute_pay_transaction (pc); break; - case PP_BATCH_DEPOSITS: - phase_batch_deposits (pc); - break; case PP_PAYMENT_NOTIFICATION: phase_payment_notification (pc); break; + // FIXME: donau phase case PP_SUCCESS_RESPONSE: phase_success_response (pc); break; + case PP_BATCH_DEPOSITS: + phase_batch_deposits (pc); + break; case PP_RETURN_RESPONSE: phase_return_response (pc); break;