merchant

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

commit 04692ee482cc0951adff62f7a4d309135d2c59cc
parent c993c0d650ae8fe603f38e6993f6f0966611f6dc
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat, 18 Aug 2018 13:33:13 +0200

insert missing rollback, move another rollback to proper location

Diffstat:
Msrc/backend/taler-merchant-httpd_pay.c | 28+++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c @@ -1461,7 +1461,7 @@ parse_pay (struct MHD_Connection *connection, { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Frontend specified wire transfer delay\n"); - + struct GNUNET_JSON_Specification wspec[] = { GNUNET_JSON_spec_relative_time ("wire_transfer_delay", &used_wire_transfer_delay), @@ -1687,6 +1687,17 @@ begin_transaction (struct PayContext *pc) GNUNET_assert (GNUNET_YES == pc->suspended); + /* Init. some price accumulators. */ + GNUNET_break (GNUNET_OK == + TALER_amount_get_zero (pc->amount.currency, + &pc->total_paid)); + GNUNET_break (GNUNET_OK == + TALER_amount_get_zero (pc->amount.currency, + &pc->total_fees_paid)); + GNUNET_break (GNUNET_OK == + TALER_amount_get_zero (pc->amount.currency, + &pc->total_refunded)); + /* First, try to see if we have all we need already done */ db->preflight (db->cls); if (GNUNET_OK != @@ -1701,17 +1712,6 @@ begin_transaction (struct PayContext *pc) return; } - /* Init. some price accumulators. */ - GNUNET_break (GNUNET_OK == - TALER_amount_get_zero (pc->amount.currency, - &pc->total_paid)); - GNUNET_break (GNUNET_OK == - TALER_amount_get_zero (pc->amount.currency, - &pc->total_fees_paid)); - GNUNET_break (GNUNET_OK == - TALER_amount_get_zero (pc->amount.currency, - &pc->total_refunded)); - /* Check if some of these coins already succeeded for _this_ contract. */ qs = db->find_payments (db->cls, &pc->h_contract_terms, @@ -1828,9 +1828,9 @@ begin_transaction (struct PayContext *pc) qs = db->commit (db->cls); if (0 > qs) { + db->rollback (db->cls); if (GNUNET_DB_STATUS_SOFT_ERROR == qs) { - db->rollback (db->cls); begin_transaction (pc); return; } @@ -1926,6 +1926,8 @@ begin_transaction (struct PayContext *pc) pc->session_id); if (0 <= qs) qs = db->commit (db->cls); + else + db->rollback (db->cls); if (0 > qs) { if (GNUNET_DB_STATUS_SOFT_ERROR == qs)