diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2019-01-31 17:44:13 +0100 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2019-01-31 17:44:13 +0100 |
commit | 9bf941792d5d093a51d811f5e2595ca5b718cdb0 (patch) | |
tree | 3a288e7e86874f4e85728f0d9056d72ee652ffbe /src/lib | |
parent | dbffac740680e26e6a310ec7100e6bc0ae45af61 (diff) |
/proposal API disambiguation.
The order object gives the client TWO ways to specify
the merchant instance: one is at the object top-level,
and the other one is within the "merchant" sub-object.
This change makes sure that the top-level instance
indication and the one internal to the merchant sub-object
refer always to the same instance.
Note: when the top-level indication is missing, then
the instance is set to "default", and the merchant sub-
object must likewise specify a "default" instance.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/test_merchant_api.c | 22 | ||||
-rw-r--r-- | src/lib/test_merchant_api_twisted.c | 1 | ||||
-rw-r--r-- | src/lib/testing_api_cmd_proposal.c | 5 |
3 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c index 83025518..1f74b302 100644 --- a/src/lib/test_merchant_api.c +++ b/src/lib/test_merchant_api.c @@ -3311,14 +3311,36 @@ interpreter_run (void *cls) { json_t *merchant; + TALER_LOG_DEBUG ("/proposal: explicit set of merchant:instance to '%s'\n", + instance); + merchant = json_object (); + json_object_set_new (merchant, "instance", json_string (instance)); + json_object_set_new (order, "merchant", merchant); + + /* When a instance other than the default is used, we're + forced to specify the outer 'instance' field too, otherwise + we'll hit a 2001 "inconsistent instance" error. */ + if (0 != strcmp ("default", + instance)) + { + json_object_set_new (order, + "instance", + json_string (instance)); + + } } + + TALER_LOG_DEBUG ("PUTting order: %s\n", + json_dumps (order, + JSON_INDENT (1))); + cmd->details.proposal.po = TALER_MERCHANT_order_put (ctx, MERCHANT_URL, order, diff --git a/src/lib/test_merchant_api_twisted.c b/src/lib/test_merchant_api_twisted.c index 0c22c0a5..0335153b 100644 --- a/src/lib/test_merchant_api_twisted.c +++ b/src/lib/test_merchant_api_twisted.c @@ -504,6 +504,7 @@ run (void *cls, \"refund_deadline\":\"\\/Date(2)\\/\",\ \"pay_deadline\":\"\\/Date(1)\\/\",\ \"wire_transfer_delay\":\"\\/Delay(30000)\\/\",\ + \"instance\":\"tor\",\ \"amount\":\ {\"currency\":\"EUR\",\ \"value\":5,\ diff --git a/src/lib/testing_api_cmd_proposal.c b/src/lib/testing_api_cmd_proposal.c index 8fc52d9f..bceecc17 100644 --- a/src/lib/testing_api_cmd_proposal.c +++ b/src/lib/testing_api_cmd_proposal.c @@ -272,7 +272,12 @@ proposal_cb (void *cls, ps->po = NULL; if (ps->http_status != http_status) + { + TALER_LOG_ERROR ("Given vs expected: %u vs %u\n", + http_status, + ps->http_status); TALER_TESTING_FAIL (ps->is); + } if (0 == ps->http_status) { |