diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-01-24 16:52:39 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-01-24 16:52:39 +0100 |
commit | 5c58c43609609e6871c7105c7ca8fc3d794dca04 (patch) | |
tree | c0c2a63b78765bef45ee8181d1dcbf35d64c3073 /src/wire/plugin_wire_test.c | |
parent | 9aa323ca7bcf1567f6ecf98cf73b5691ade1b816 (diff) |
more work on wire plugins
Diffstat (limited to 'src/wire/plugin_wire_test.c')
-rw-r--r-- | src/wire/plugin_wire_test.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/wire/plugin_wire_test.c b/src/wire/plugin_wire_test.c index 72c87ef55..1ea856fd1 100644 --- a/src/wire/plugin_wire_test.c +++ b/src/wire/plugin_wire_test.c @@ -60,8 +60,21 @@ static int test_amount_round (void *cls, struct TALER_Amount *amount) { - GNUNET_break (0); - return GNUNET_SYSERR; + struct TestClosure *tc = cls; + uint32_t delta; + + if (0 != strcasecmp (amount->currency, + tc->currency)) + { + GNUNET_break (0); + return GNUNET_SYSERR; + } + /* 'test' method supports 1/100 of the unit currency, i.e. 0.01 CUR */ + delta = amount->fraction % (TALER_AMOUNT_FRAC_BASE / 100); + if (0 == delta) + return GNUNET_NO; + amount->fraction -= delta; + return GNUNET_OK; } @@ -74,8 +87,9 @@ test_amount_round (void *cls, static int test_wire_validate (const json_t *wire) { - GNUNET_break (0); - return GNUNET_SYSERR; + GNUNET_break (0); /* FIXME: we still need to define the + proper wire format for 'test' */ + return GNUNET_YES; } @@ -94,7 +108,7 @@ static struct TALER_WIRE_PrepareHandle * test_prepare_wire_transfer (void *cls, const json_t *wire, const struct TALER_Amount *amount, - const void *wtid, + const struct TALER_WireTransferIdentifierRawP *wtid, TALER_WIRE_PrepareTransactionCallback ptc, void *ptc_cls) { |