merchant

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

commit d0871c3b8fcd2cbeb37175579d6f114d048520e9
parent c8011ae1bd004575c5c11b0b30952cbbd8bbc983
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date:   Fri, 30 Oct 2015 07:48:23 +0100

adding /deposit roadmap in _pay.c comments, fixing minor things

Diffstat:
Msrc/backend/taler-merchant-httpd_pay.c | 36+++++++++++++++++++++++++++++++++++-
Msrc/frontend/pay.php | 5+----
2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c @@ -61,7 +61,12 @@ MH_handler_pay (struct TMH_RequestHandler *rh, { json_t *root; + json_t *coins; + int res; + struct TALER_Amount max_deposit_fee; + //struct TALER_Amount acc_deposit_fee; + //struct TALER_Amount coin_deposit_fee; res = TMH_PARSE_post_json (connection, connection_cls, @@ -74,5 +79,34 @@ MH_handler_pay (struct TMH_RequestHandler *rh, if ((GNUNET_NO == res) || (NULL == root)) return MHD_YES; - /* 1 Check if the total deposit fee is leq the limit */ + //printf ("/pay\n"); + + /* 0 What if the coin gives zero-length coins array? */ + + /* 1 Check if the total deposit fee is \leq the limit */ + + /* 2 Check if the chosen mint is among the merchant's preferred. + + An error in this case could be due to: + + * the wallet indicated a non existent mint + * the wallet indicated a non trusted mint + + NOTE: by preventively checking this, the merchant + avoids getting HTTP response codes from random + websites that may mislead the wallet in the way + of managing the error. Of course, that protect the + merchant from POSTing coins to untrusted mints. + + */ + + /* 3 For each coin in DB + + a. Generate a deposit permission + b. store it in DB + c. POST to the mint (see mint-lib for this) + (retry until getting a persisten state) + */ + /* 4 Return response code: success, or whatever data the + mint sent back regarding some bad coin */ } diff --git a/src/frontend/pay.php b/src/frontend/pay.php @@ -43,10 +43,7 @@ $now = new DateTime('now'); $edate = array ('edate' => "/Date(" . $now->add(new DateInterval('P2W'))->getTimestamp() . ")/"); -echo $post_body; - $deposit_permission = json_decode ($post_body, true); - $max_fee = array ('max_fee' => array ('value' => 3, 'fraction' => 8, 'currency' => "KUDOS")); @@ -71,7 +68,7 @@ if ($cli_debug && !$backend_test) $req = new http\Client\Request ("POST", "http://" . $_SERVER["SERVER_NAME"] . "/backend/pay", array ("Content-Type" => "application/json")); -$req->getBody()->append ($new_deposit_permission); +$req->getBody()->append (json_encode ($new_deposit_permission)); // Execute the HTTP request $client = new http\Client;