merchant

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

commit 6d874378f38e78e43f3a42fe764f3adc9e1f3427
parent 9ac12f14e9d2272b67877525c076824ff4b813f5
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 26 Nov 2015 13:53:57 +0100

also compute total amount deposited

Diffstat:
Msrc/backend/taler-merchant-httpd_auditors.c | 1-
Msrc/backend/taler-merchant-httpd_pay.c | 20++++++++++++++++----
2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_auditors.c b/src/backend/taler-merchant-httpd_auditors.c @@ -147,7 +147,6 @@ int TMH_AUDITORS_init (const struct GNUNET_CONFIGURATION_Handle *cfg) { unsigned int cnt; - int ok; GNUNET_CONFIGURATION_iterate_sections (cfg, &parse_auditors, diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c @@ -61,6 +61,7 @@ struct MERCHANT_DepositConfirmation /** * Amount "f" that this coin contributes to the overall payment. + * FIXME: is this with/without fee? */ struct TALER_Amount percoin_amount; @@ -316,6 +317,7 @@ process_pay_with_mint (void *cls, { struct PayContext *pc = cls; struct TALER_Amount acc_fee; + struct TALER_Amount acc_amount; struct TALER_Amount coin_fee; const struct TALER_MINT_Keys *keys; unsigned int i; @@ -326,8 +328,8 @@ process_pay_with_mint (void *cls, mints. Reject the payment. */ GNUNET_break_op (0); resume_pay_with_response (pc, - 403, /* FIXME */ - TMH_RESPONSE_make_external_error ("unknown mint")); + MHD_HTTP_PRECONDITION_FAILED, + TMH_RESPONSE_make_external_error ("mint not supported")); return; } @@ -336,7 +338,7 @@ process_pay_with_mint (void *cls, { GNUNET_break (0); resume_pay_with_response (pc, - UINT_MAX, /* FIXME */ + MHD_HTTP_INTERNAL_SERVER_ERROR, TMH_RESPONSE_make_internal_error ("no keys")); return; } @@ -359,12 +361,22 @@ process_pay_with_mint (void *cls, "denom_pub", TALER_json_from_rsa_public_key (dc->denom.rsa_public_key))); return; } + /* FIXME: also check that this denomination key is + audited by an acceptable auditor! */ if (0 == i) + { acc_fee = denom_details->fee_deposit; + acc_amount = dc->percoin_amount; + } else + { TALER_amount_add (&acc_fee, &denom_details->fee_deposit, - &coin_fee); + &acc_fee); + TALER_amount_add (&acc_amount, + &dc->percoin_amount, + &acc_amount); + } } /* FIXME: we should check that the total matches as well... */