summaryrefslogtreecommitdiff
path: root/src/lib/merchant_api_get_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/merchant_api_get_config.c')
-rw-r--r--src/lib/merchant_api_get_config.c37
1 files changed, 12 insertions, 25 deletions
diff --git a/src/lib/merchant_api_get_config.c b/src/lib/merchant_api_get_config.c
index 708b7907..93b7c863 100644
--- a/src/lib/merchant_api_get_config.c
+++ b/src/lib/merchant_api_get_config.c
@@ -105,11 +105,14 @@ handle_config_finished (void *cls,
case MHD_HTTP_OK:
{
const json_t *jcs;
+ struct TALER_JSON_ProtocolVersion pv;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_object_const ("currencies",
&jcs),
GNUNET_JSON_spec_string ("currency",
&cr.details.ok.ci.currency),
+ TALER_JSON_spec_version ("version",
+ &pv),
GNUNET_JSON_spec_string ("version",
&cr.details.ok.ci.version),
GNUNET_JSON_spec_end ()
@@ -126,34 +129,18 @@ handle_config_finished (void *cls,
}
else
{
- unsigned int age;
- unsigned int revision;
- unsigned int current;
-
- if (3 != sscanf (cr.details.ok.ci.version,
- "%u:%u:%u",
- &current,
- &revision,
- &age))
+ cr.details.ok.compat = TALER_MERCHANT_VC_MATCH;
+ if (MERCHANT_PROTOCOL_CURRENT < pv.current)
{
- cr.hr.http_status = 0;
- cr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ cr.details.ok.compat |= TALER_MERCHANT_VC_NEWER;
+ if (MERCHANT_PROTOCOL_CURRENT < pv.current - pv.age)
+ cr.details.ok.compat |= TALER_MERCHANT_VC_INCOMPATIBLE;
}
- else
+ if (MERCHANT_PROTOCOL_CURRENT > pv.current)
{
- cr.details.ok.compat = TALER_MERCHANT_VC_MATCH;
- if (MERCHANT_PROTOCOL_CURRENT < current)
- {
- cr.details.ok.compat |= TALER_MERCHANT_VC_NEWER;
- if (MERCHANT_PROTOCOL_CURRENT < current - age)
- cr.details.ok.compat |= TALER_MERCHANT_VC_INCOMPATIBLE;
- }
- if (MERCHANT_PROTOCOL_CURRENT > current)
- {
- cr.details.ok.compat |= TALER_MERCHANT_VC_OLDER;
- if (MERCHANT_PROTOCOL_CURRENT - MERCHANT_PROTOCOL_AGE > current)
- cr.details.ok.compat |= TALER_MERCHANT_VC_INCOMPATIBLE;
- }
+ cr.details.ok.compat |= TALER_MERCHANT_VC_OLDER;
+ if (MERCHANT_PROTOCOL_CURRENT - MERCHANT_PROTOCOL_AGE > pv.current)
+ cr.details.ok.compat |= TALER_MERCHANT_VC_INCOMPATIBLE;
}
}
{