merchant

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

commit 685c30de4d4bad1e04b65717e91873179f369aab
parent 3ac8ef95f9bb89aa821846c2f714fc63c7858005
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon,  2 Mar 2026 17:12:19 +0100

adjust to latest libtalerexchange API changes

Diffstat:
Msrc/backend/taler-merchant-depositcheck.c | 30++++++++++++++++++++++--------
Msrc/backend/taler-merchant-httpd_post-orders-ID-abort.c | 16+++++++++-------
Msrc/backend/taler-merchant-httpd_post-orders-ID-pay.c | 21++++++++++++---------
Msrc/backend/taler-merchant-httpd_post-orders-ID-refund.c | 19+++++++++++--------
Msrc/backend/taler-merchant-reconciliation.c | 19+++++++++++--------
5 files changed, 65 insertions(+), 40 deletions(-)

diff --git a/src/backend/taler-merchant-depositcheck.c b/src/backend/taler-merchant-depositcheck.c @@ -107,7 +107,7 @@ struct ExchangeInteraction /** * Handle for exchange interaction. */ - struct TALER_EXCHANGE_DepositGetHandle *dgh; + struct TALER_EXCHANGE_GetDepositsHandle *dgh; /** * Wire deadline for the deposit. @@ -291,7 +291,7 @@ shutdown_task (void *cls) w); if (NULL != w->dgh) { - TALER_EXCHANGE_deposits_get_cancel (w->dgh); + TALER_EXCHANGE_get_deposits_cancel (w->dgh); w->dgh = NULL; } w_count--; @@ -411,7 +411,7 @@ run_at (struct GNUNET_TIME_Absolute deadline) static void deposit_get_cb ( void *cls, - const struct TALER_EXCHANGE_GetDepositResponse *dr) + const struct TALER_EXCHANGE_GetDepositsResponse *dr) { struct ExchangeInteraction *w = cls; struct GNUNET_TIME_Absolute future_retry; @@ -665,17 +665,31 @@ pending_deposits_cb ( return; } GNUNET_assert (NULL == w->dgh); - w->dgh = TALER_EXCHANGE_deposits_get ( + w->dgh = TALER_EXCHANGE_get_deposits_create ( ctx, exchange_url, keys, &w->merchant_priv, &w->h_wire, &w->h_contract_terms, - &w->coin_pub, - GNUNET_TIME_UNIT_ZERO, - &deposit_get_cb, - w); + &w->coin_pub); + if (NULL == w->dgh) + { + GNUNET_break (0); + GNUNET_SCHEDULER_shutdown (); + return; + } + if (TALER_EC_NONE != + TALER_EXCHANGE_get_deposits_start (w->dgh, + &deposit_get_cb, + w)) + { + GNUNET_break (0); + TALER_EXCHANGE_get_deposits_cancel (w->dgh); + w->dgh = NULL; + GNUNET_SCHEDULER_shutdown (); + return; + } } diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-abort.c b/src/backend/taler-merchant-httpd_post-orders-ID-abort.c @@ -80,7 +80,7 @@ struct RefundDetails * Handle to the refund operation we are performing for * this coin, NULL after the operation is done. */ - struct TALER_EXCHANGE_RefundHandle *rh; + struct TALER_EXCHANGE_PostCoinsRefundHandle *rh; /** * URL of the exchange that issued this coin. @@ -258,7 +258,7 @@ abort_refunds (struct AbortContext *ac) if (NULL != rdi->rh) { - TALER_EXCHANGE_refund_cancel (rdi->rh); + TALER_EXCHANGE_post_coins_refund_cancel (rdi->rh); rdi->rh = NULL; } } @@ -493,7 +493,7 @@ find_next_exchange (struct AbortContext *ac); */ static void refund_cb (void *cls, - const struct TALER_EXCHANGE_RefundResponse *rr) + const struct TALER_EXCHANGE_PostCoinsRefundResponse *rr) { struct RefundDetails *rd = cls; const struct TALER_EXCHANGE_HttpResponse *hr = &rr->hr; @@ -560,7 +560,7 @@ process_abort_with_exchange (void *cls, /* Coin wasn't even deposited yet, we do not need to refund it. */ continue; } - rdi->rh = TALER_EXCHANGE_refund ( + rdi->rh = TALER_EXCHANGE_post_coins_refund_create ( TMH_curl_ctx, ac->current_exchange, keys, @@ -568,9 +568,7 @@ process_abort_with_exchange (void *cls, &ac->h_contract_terms, &rdi->coin_pub, 0, /* rtransaction_id */ - &ac->hc->instance->merchant_priv, - &refund_cb, - rdi); + &ac->hc->instance->merchant_priv); if (NULL == rdi->rh) { GNUNET_break_op (0); @@ -580,6 +578,10 @@ process_abort_with_exchange (void *cls, "Failed to start refund with exchange"); return; } + GNUNET_assert (TALER_EC_NONE == + TALER_EXCHANGE_post_coins_refund_start (rdi->rh, + &refund_cb, + rdi)); ac->pending_at_ce++; } /* Still continue if no coins for this exchange were deposited. */ diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c @@ -352,7 +352,7 @@ struct ExchangeGroup * Handle to the batch deposit operation we are performing for this * exchange, NULL after the operation is done. */ - struct TALER_EXCHANGE_BatchDepositHandle *bdh; + struct TALER_EXCHANGE_PostBatchDepositHandle *bdh; /** * Handle for operation to lookup /keys (and auditors) from @@ -895,7 +895,7 @@ resume_pay_with_response (struct PayContext *pc, } if (NULL != eg->bdh) { - TALER_EXCHANGE_batch_deposit_cancel (eg->bdh); + TALER_EXCHANGE_post_batch_deposit_cancel (eg->bdh); eg->bdh = NULL; pc->batch_deposits.pending_at_eg--; } @@ -1020,7 +1020,8 @@ phase_fail_for_legal_reasons (struct PayContext *pc) */ static enum GNUNET_DB_QueryStatus batch_deposit_transaction (const struct ExchangeGroup *eg, - const struct TALER_EXCHANGE_BatchDepositResult *dr) + const struct + TALER_EXCHANGE_PostBatchDepositResponse *dr) { const struct PayContext *pc = eg->pc; enum GNUNET_DB_QueryStatus qs; @@ -1111,7 +1112,8 @@ batch_deposit_transaction (const struct ExchangeGroup *eg, */ static void handle_batch_deposit_ok (struct ExchangeGroup *eg, - const struct TALER_EXCHANGE_BatchDepositResult *dr) + const struct TALER_EXCHANGE_PostBatchDepositResponse * + dr) { struct PayContext *pc = eg->pc; enum GNUNET_DB_QueryStatus qs @@ -1236,7 +1238,7 @@ notify_kyc_required (const struct ExchangeGroup *eg) static void batch_deposit_cb ( void *cls, - const struct TALER_EXCHANGE_BatchDepositResult *dr) + const struct TALER_EXCHANGE_PostBatchDepositResponse *dr) { struct ExchangeGroup *eg = cls; struct PayContext *pc = eg->pc; @@ -1645,15 +1647,13 @@ AGE_FAIL: group_size); /* Note: the coin signatures over the wallet_data_hash are checked inside of this call */ - eg->bdh = TALER_EXCHANGE_batch_deposit ( + eg->bdh = TALER_EXCHANGE_post_batch_deposit_create ( TMH_curl_ctx, eg->exchange_url, keys, &dcd, group_size, cdds, - &batch_deposit_cb, - eg, &ec); if (NULL == eg->bdh) { @@ -1672,7 +1672,10 @@ AGE_FAIL: } pc->batch_deposits.pending_at_eg++; if (TMH_force_audit) - TALER_EXCHANGE_batch_deposit_force_dc (eg->bdh); + TALER_EXCHANGE_post_batch_deposit_force_dc (eg->bdh); + TALER_EXCHANGE_post_batch_deposit_start (eg->bdh, + &batch_deposit_cb, + eg); } } diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-refund.c b/src/backend/taler-merchant-httpd_post-orders-ID-refund.c @@ -56,7 +56,7 @@ struct CoinRefund /** * Handle for the refund operation with the exchange. */ - struct TALER_EXCHANGE_RefundHandle *rh; + struct TALER_EXCHANGE_PostCoinsRefundHandle *rh; /** * Request this operation is part of. @@ -283,7 +283,7 @@ refund_cleanup (void *ctx) } if (NULL != cr->rh) { - TALER_EXCHANGE_refund_cancel (cr->rh); + TALER_EXCHANGE_post_coins_refund_cancel (cr->rh); cr->rh = NULL; } GNUNET_free (cr); @@ -389,7 +389,7 @@ notify_refund_obtained (struct PostRefundData *prd) */ static void refund_cb (void *cls, - const struct TALER_EXCHANGE_RefundResponse *rr) + const struct TALER_EXCHANGE_PostCoinsRefundResponse *rr) { struct CoinRefund *cr = cls; const struct TALER_EXCHANGE_HttpResponse *hr = &rr->hr; @@ -461,7 +461,7 @@ exchange_found_cb (void *cls, check_resume_prd (prd); return; } - cr->rh = TALER_EXCHANGE_refund ( + cr->rh = TALER_EXCHANGE_post_coins_refund_create ( TMH_curl_ctx, cr->exchange_url, keys, @@ -469,9 +469,12 @@ exchange_found_cb (void *cls, &prd->h_contract_terms, &cr->coin_pub, cr->rtransaction_id, - &prd->hc->instance->merchant_priv, - &refund_cb, - cr); + &prd->hc->instance->merchant_priv); + GNUNET_assert (NULL != cr->rh); + GNUNET_assert (TALER_EC_NONE == + TALER_EXCHANGE_post_coins_refund_start (cr->rh, + &refund_cb, + cr)); } @@ -659,7 +662,7 @@ TMH_post_orders_ID_refund (const struct TMH_RequestHandler *rh, } if (NULL != cr->rh) { - TALER_EXCHANGE_refund_cancel (cr->rh); + TALER_EXCHANGE_post_coins_refund_cancel (cr->rh); cr->rh = NULL; } } diff --git a/src/backend/taler-merchant-reconciliation.c b/src/backend/taler-merchant-reconciliation.c @@ -139,9 +139,9 @@ struct Inquiry struct TALER_FullPayto payto_uri; /** - * Handle for the /wire/transfers request. + * Handle for the GET /transfers request. */ - struct TALER_EXCHANGE_TransfersGetHandle *wdh; + struct TALER_EXCHANGE_GetTransfersHandle *wdh; /** * When did the transfer happen? @@ -396,7 +396,7 @@ end_inquiry (struct Inquiry *w) active_inquiries--; if (NULL != w->wdh) { - TALER_EXCHANGE_transfers_get_cancel (w->wdh); + TALER_EXCHANGE_get_transfers_cancel (w->wdh); w->wdh = NULL; } GNUNET_free (w->instance_id); @@ -702,7 +702,7 @@ check_transfer (void *cls, */ static void wire_transfer_cb (void *cls, - const struct TALER_EXCHANGE_TransfersGetResponse *tgr) + const struct TALER_EXCHANGE_GetTransfersResponse *tgr) { struct Inquiry *w = cls; struct Exchange *e = w->exchange; @@ -927,13 +927,11 @@ exchange_request (void *cls) w->task = NULL; if (NULL == e->keys) return; - w->wdh = TALER_EXCHANGE_transfers_get ( + w->wdh = TALER_EXCHANGE_get_transfers_create ( ctx, e->exchange_url, e->keys, - &w->wtid, - &wire_transfer_cb, - w); + &w->wtid); if (NULL == w->wdh) { GNUNET_break (0); @@ -949,6 +947,11 @@ exchange_request (void *cls) end_inquiry (w); return; } + GNUNET_assert (TALER_EC_NONE == + TALER_EXCHANGE_get_transfers_start (w->wdh, + &wire_transfer_cb, + w)); + /* Wait at least 1m for the network transfer */ update_transaction_status (w, GNUNET_TIME_relative_to_absolute (