more work on wire plugins
This commit is contained in:
parent
9aa323ca7b
commit
5c58c43609
@ -123,7 +123,7 @@ struct TALER_WIRE_Plugin
|
|||||||
(*prepare_wire_transfer) (void *cls,
|
(*prepare_wire_transfer) (void *cls,
|
||||||
const json_t *wire,
|
const json_t *wire,
|
||||||
const struct TALER_Amount *amount,
|
const struct TALER_Amount *amount,
|
||||||
const void *wtid,
|
const struct TALER_WireTransferIdentifierRawP *wtid,
|
||||||
TALER_WIRE_PrepareTransactionCallback ptc,
|
TALER_WIRE_PrepareTransactionCallback ptc,
|
||||||
void *ptc_cls);
|
void *ptc_cls);
|
||||||
|
|
||||||
|
@ -60,7 +60,15 @@ static int
|
|||||||
template_amount_round (void *cls,
|
template_amount_round (void *cls,
|
||||||
struct TALER_Amount *amount)
|
struct TALER_Amount *amount)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
struct TemplateClosure *tc = cls;
|
||||||
|
|
||||||
|
if (0 != strcasecmp (amount->currency,
|
||||||
|
tc->currency))
|
||||||
|
{
|
||||||
|
GNUNET_break (0);
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
}
|
||||||
|
GNUNET_break (0); // not implemented
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +102,7 @@ static struct TALER_WIRE_PrepareHandle *
|
|||||||
template_prepare_wire_transfer (void *cls,
|
template_prepare_wire_transfer (void *cls,
|
||||||
const json_t *wire,
|
const json_t *wire,
|
||||||
const struct TALER_Amount *amount,
|
const struct TALER_Amount *amount,
|
||||||
const void *wtid,
|
const struct TALER_WireTransferIdentifierRawP *wtid,
|
||||||
TALER_WIRE_PrepareTransactionCallback ptc,
|
TALER_WIRE_PrepareTransactionCallback ptc,
|
||||||
void *ptc_cls)
|
void *ptc_cls)
|
||||||
{
|
{
|
||||||
|
@ -60,8 +60,21 @@ static int
|
|||||||
test_amount_round (void *cls,
|
test_amount_round (void *cls,
|
||||||
struct TALER_Amount *amount)
|
struct TALER_Amount *amount)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
struct TestClosure *tc = cls;
|
||||||
return GNUNET_SYSERR;
|
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
|
static int
|
||||||
test_wire_validate (const json_t *wire)
|
test_wire_validate (const json_t *wire)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0); /* FIXME: we still need to define the
|
||||||
return GNUNET_SYSERR;
|
proper wire format for 'test' */
|
||||||
|
return GNUNET_YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -94,7 +108,7 @@ static struct TALER_WIRE_PrepareHandle *
|
|||||||
test_prepare_wire_transfer (void *cls,
|
test_prepare_wire_transfer (void *cls,
|
||||||
const json_t *wire,
|
const json_t *wire,
|
||||||
const struct TALER_Amount *amount,
|
const struct TALER_Amount *amount,
|
||||||
const void *wtid,
|
const struct TALER_WireTransferIdentifierRawP *wtid,
|
||||||
TALER_WIRE_PrepareTransactionCallback ptc,
|
TALER_WIRE_PrepareTransactionCallback ptc,
|
||||||
void *ptc_cls)
|
void *ptc_cls)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user